Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions gbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ def cli_get(api: GBD, args):
for index, row in df.iterrows():
print(args.delimiter.join([ item or "[None]" for item in row.to_list() ]))

def cli_interactive(api: GBD, args):
data = api.query(args.query, args.hashes, args.resolve, args.collapse, args.group_by, args.join_type)
if args.group_by:
data.set_index(args.group_by, inplace=True)
else:
data.set_index('hash', inplace=True)
import IPython
IPython.embed(header ="GBD data is available as `data`", colors="neutral")

def cli_set(api: GBD, args):
hashes = api.query(args.query, args.hashes)['hash'].tolist()
if args.create:
Expand Down Expand Up @@ -187,6 +196,17 @@ def main():
parser_get.add_argument('-H', '--header', action='store_true', help='Include header information in output')
parser_get.set_defaults(func=cli_get)

# GBD INTERACTIVE $QUERY
parser_interactive = subparsers.add_parser('interactive', help='Get data by query (or hash-list via stdin) and open interactive Python prompt')
add_query_and_hashes_arguments(parser_interactive)
parser_interactive.add_argument('-r', '--resolve', help='List of feature names to resolve against', nargs='+', default=[])
parser_interactive.add_argument('-c', '--collapse', default='group_concat',
choices=['group_concat', 'min', 'max', 'avg', 'count', 'sum', 'none'],
help='Specify a function for the handling of multiple feature values')
parser_interactive.add_argument('-g', '--group_by', default=None, help='Group by the specified feature as the key, rather than by the primary key')
parser_interactive.add_argument('--join-type', help='Join Type: treatment of missing values', choices=['INNER', 'OUTER', 'LEFT'], default="LEFT")
parser_interactive.set_defaults(func=cli_interactive)

# GBD SET
parser_set = subparsers.add_parser('set', help='Set specified attribute-value for query result')
parser_set.add_argument('assign', type=key_value_type, help='key=value')
Expand Down
21 changes: 9 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ description = "GBD Tools: Maintenance and Distribution of Benchmark Instances an
readme = "README.md"
license-files = ["LICENSE"]
requires-python = ">=3.6"
authors = [
{ name = "Markus Iser", email = "markus.iser@kit.edu" }
]
authors = [{ name = "Markus Iser", email = "markus.iser@kit.edu" }]
urls = { Homepage = "https://github.com/Udopia/gbd" }
classifiers = [
"Programming Language :: Python :: 3"
]
classifiers = ["Programming Language :: Python :: 3"]
dependencies = [
"flask",
"tatsu",
"pandas",
"waitress",
"pebble",
"gbdc"
"flask",
"tatsu",
"pandas",
"waitress",
"pebble",
"gbdc",
"IPython",
]
scripts = { gbd = "gbd:main" }

Expand Down