repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
tomduck/pandoc-eqnos
pandoc_eqnos.py
_process_equation
def _process_equation(value, fmt): """Processes the equation. Returns a dict containing eq properties.""" # pylint: disable=global-statement global Nreferences # Global references counter global cursec # Current section # Parse the equation attrs = value[0] # Initialize the return...
python
def _process_equation(value, fmt): """Processes the equation. Returns a dict containing eq properties.""" # pylint: disable=global-statement global Nreferences # Global references counter global cursec # Current section # Parse the equation attrs = value[0] # Initialize the return...
[ "def", "_process_equation", "(", "value", ",", "fmt", ")", ":", "# pylint: disable=global-statement", "global", "Nreferences", "# Global references counter", "global", "cursec", "# Current section", "# Parse the equation", "attrs", "=", "value", "[", "0", "]", "# Initiali...
Processes the equation. Returns a dict containing eq properties.
[ "Processes", "the", "equation", ".", "Returns", "a", "dict", "containing", "eq", "properties", "." ]
train
https://github.com/tomduck/pandoc-eqnos/blob/a0e2b5684d2024ea96049ed2cff3acf4ab47c541/pandoc_eqnos.py#L84-L154
tomduck/pandoc-eqnos
pandoc_eqnos.py
process_equations
def process_equations(key, value, fmt, meta): """Processes the attributed equations.""" if key == 'Math' and len(value) == 3: # Process the equation eq = _process_equation(value, fmt) # Get the attributes and label attrs = eq['attrs'] label = attrs[0] if eq['is...
python
def process_equations(key, value, fmt, meta): """Processes the attributed equations.""" if key == 'Math' and len(value) == 3: # Process the equation eq = _process_equation(value, fmt) # Get the attributes and label attrs = eq['attrs'] label = attrs[0] if eq['is...
[ "def", "process_equations", "(", "key", ",", "value", ",", "fmt", ",", "meta", ")", ":", "if", "key", "==", "'Math'", "and", "len", "(", "value", ")", "==", "3", ":", "# Process the equation", "eq", "=", "_process_equation", "(", "value", ",", "fmt", "...
Processes the attributed equations.
[ "Processes", "the", "attributed", "equations", "." ]
train
https://github.com/tomduck/pandoc-eqnos/blob/a0e2b5684d2024ea96049ed2cff3acf4ab47c541/pandoc_eqnos.py#L158-L208
tomduck/pandoc-eqnos
pandoc_eqnos.py
process
def process(meta): """Saves metadata fields in global variables and returns a few computed fields.""" # pylint: disable=global-statement global capitalize global use_cleveref_default global plusname global starname global numbersections # Read in the metadata fields and do some che...
python
def process(meta): """Saves metadata fields in global variables and returns a few computed fields.""" # pylint: disable=global-statement global capitalize global use_cleveref_default global plusname global starname global numbersections # Read in the metadata fields and do some che...
[ "def", "process", "(", "meta", ")", ":", "# pylint: disable=global-statement", "global", "capitalize", "global", "use_cleveref_default", "global", "plusname", "global", "starname", "global", "numbersections", "# Read in the metadata fields and do some checking", "for", "name", ...
Saves metadata fields in global variables and returns a few computed fields.
[ "Saves", "metadata", "fields", "in", "global", "variables", "and", "returns", "a", "few", "computed", "fields", "." ]
train
https://github.com/tomduck/pandoc-eqnos/blob/a0e2b5684d2024ea96049ed2cff3acf4ab47c541/pandoc_eqnos.py#L213-L263
tomduck/pandoc-eqnos
pandoc_eqnos.py
main
def main(): """Filters the document AST.""" # pylint: disable=global-statement global PANDOCVERSION global AttrMath # Get the output format and document fmt = args.fmt doc = json.loads(STDIN.read()) # Initialize pandocxnos # pylint: disable=too-many-function-args PANDOCVERSION...
python
def main(): """Filters the document AST.""" # pylint: disable=global-statement global PANDOCVERSION global AttrMath # Get the output format and document fmt = args.fmt doc = json.loads(STDIN.read()) # Initialize pandocxnos # pylint: disable=too-many-function-args PANDOCVERSION...
[ "def", "main", "(", ")", ":", "# pylint: disable=global-statement", "global", "PANDOCVERSION", "global", "AttrMath", "# Get the output format and document", "fmt", "=", "args", ".", "fmt", "doc", "=", "json", ".", "loads", "(", "STDIN", ".", "read", "(", ")", ")...
Filters the document AST.
[ "Filters", "the", "document", "AST", "." ]
train
https://github.com/tomduck/pandoc-eqnos/blob/a0e2b5684d2024ea96049ed2cff3acf4ab47c541/pandoc_eqnos.py#L266-L322
nedbat/django_coverage_plugin
django_coverage_plugin/plugin.py
check_debug
def check_debug(): """Check that Django's template debugging is enabled. Django's built-in "template debugging" records information the plugin needs to do its work. Check that the setting is correct, and raise an exception if it is not. Returns True if the debug check was performed, False otherwi...
python
def check_debug(): """Check that Django's template debugging is enabled. Django's built-in "template debugging" records information the plugin needs to do its work. Check that the setting is correct, and raise an exception if it is not. Returns True if the debug check was performed, False otherwi...
[ "def", "check_debug", "(", ")", ":", "from", "django", ".", "conf", "import", "settings", "if", "not", "settings", ".", "configured", ":", "return", "False", "# I _think_ this check is all that's needed and the 3 \"hasattr\" checks", "# below can be removed, but it's not clea...
Check that Django's template debugging is enabled. Django's built-in "template debugging" records information the plugin needs to do its work. Check that the setting is correct, and raise an exception if it is not. Returns True if the debug check was performed, False otherwise
[ "Check", "that", "Django", "s", "template", "debugging", "is", "enabled", "." ]
train
https://github.com/nedbat/django_coverage_plugin/blob/0072737c0ea5a1ca6b9f046af4947de191f13804/django_coverage_plugin/plugin.py#L50-L89
nedbat/django_coverage_plugin
django_coverage_plugin/plugin.py
read_template_source
def read_template_source(filename): """Read the source of a Django template, returning the Unicode text.""" # Import this late to be sure we don't trigger settings machinery too # early. from django.conf import settings if not settings.configured: settings.configure() with open(filenam...
python
def read_template_source(filename): """Read the source of a Django template, returning the Unicode text.""" # Import this late to be sure we don't trigger settings machinery too # early. from django.conf import settings if not settings.configured: settings.configure() with open(filenam...
[ "def", "read_template_source", "(", "filename", ")", ":", "# Import this late to be sure we don't trigger settings machinery too", "# early.", "from", "django", ".", "conf", "import", "settings", "if", "not", "settings", ".", "configured", ":", "settings", ".", "configure...
Read the source of a Django template, returning the Unicode text.
[ "Read", "the", "source", "of", "a", "Django", "template", "returning", "the", "Unicode", "text", "." ]
train
https://github.com/nedbat/django_coverage_plugin/blob/0072737c0ea5a1ca6b9f046af4947de191f13804/django_coverage_plugin/plugin.py#L127-L139
nedbat/django_coverage_plugin
django_coverage_plugin/plugin.py
get_line_number
def get_line_number(line_map, offset): """Find a line number, given a line map and a character offset.""" for lineno, line_offset in enumerate(line_map, start=1): if line_offset > offset: return lineno return -1
python
def get_line_number(line_map, offset): """Find a line number, given a line map and a character offset.""" for lineno, line_offset in enumerate(line_map, start=1): if line_offset > offset: return lineno return -1
[ "def", "get_line_number", "(", "line_map", ",", "offset", ")", ":", "for", "lineno", ",", "line_offset", "in", "enumerate", "(", "line_map", ",", "start", "=", "1", ")", ":", "if", "line_offset", ">", "offset", ":", "return", "lineno", "return", "-", "1"...
Find a line number, given a line map and a character offset.
[ "Find", "a", "line", "number", "given", "a", "line", "map", "and", "a", "character", "offset", "." ]
train
https://github.com/nedbat/django_coverage_plugin/blob/0072737c0ea5a1ca6b9f046af4947de191f13804/django_coverage_plugin/plugin.py#L389-L394
nedbat/django_coverage_plugin
django_coverage_plugin/plugin.py
dump_frame
def dump_frame(frame, label=""): """Dump interesting information about this frame.""" locals = dict(frame.f_locals) self = locals.get('self', None) context = locals.get('context', None) if "__builtins__" in locals: del locals["__builtins__"] if label: label = " ( %s ) " % label ...
python
def dump_frame(frame, label=""): """Dump interesting information about this frame.""" locals = dict(frame.f_locals) self = locals.get('self', None) context = locals.get('context', None) if "__builtins__" in locals: del locals["__builtins__"] if label: label = " ( %s ) " % label ...
[ "def", "dump_frame", "(", "frame", ",", "label", "=", "\"\"", ")", ":", "locals", "=", "dict", "(", "frame", ".", "f_locals", ")", "self", "=", "locals", ".", "get", "(", "'self'", ",", "None", ")", "context", "=", "locals", ".", "get", "(", "'cont...
Dump interesting information about this frame.
[ "Dump", "interesting", "information", "about", "this", "frame", "." ]
train
https://github.com/nedbat/django_coverage_plugin/blob/0072737c0ea5a1ca6b9f046af4947de191f13804/django_coverage_plugin/plugin.py#L397-L418
nedbat/django_coverage_plugin
django_coverage_plugin/plugin.py
DjangoTemplatePlugin.get_line_map
def get_line_map(self, filename): """The line map for `filename`. A line map is a list of character offsets, indicating where each line in the text begins. For example, a line map like this:: [13, 19, 30] means that line 2 starts at character 13, line 3 starts at 19, etc....
python
def get_line_map(self, filename): """The line map for `filename`. A line map is a list of character offsets, indicating where each line in the text begins. For example, a line map like this:: [13, 19, 30] means that line 2 starts at character 13, line 3 starts at 19, etc....
[ "def", "get_line_map", "(", "self", ",", "filename", ")", ":", "if", "filename", "not", "in", "self", ".", "source_map", ":", "template_source", "=", "read_template_source", "(", "filename", ")", "if", "0", ":", "# change to see the template text", "for", "i", ...
The line map for `filename`. A line map is a list of character offsets, indicating where each line in the text begins. For example, a line map like this:: [13, 19, 30] means that line 2 starts at character 13, line 3 starts at 19, etc. Line 1 always starts at character 0.
[ "The", "line", "map", "for", "filename", "." ]
train
https://github.com/nedbat/django_coverage_plugin/blob/0072737c0ea5a1ca6b9f046af4947de191f13804/django_coverage_plugin/plugin.py#L256-L274
dylanaraps/bum
bum/display.py
init
def init(size=250): """Initialize mpv.""" player = mpv.MPV(start_event_thread=False) player["force-window"] = "immediate" player["keep-open"] = "yes" player["geometry"] = f"{size}x{size}" player["autofit"] = f"{size}x{size}" player["title"] = "bum" return player
python
def init(size=250): """Initialize mpv.""" player = mpv.MPV(start_event_thread=False) player["force-window"] = "immediate" player["keep-open"] = "yes" player["geometry"] = f"{size}x{size}" player["autofit"] = f"{size}x{size}" player["title"] = "bum" return player
[ "def", "init", "(", "size", "=", "250", ")", ":", "player", "=", "mpv", ".", "MPV", "(", "start_event_thread", "=", "False", ")", "player", "[", "\"force-window\"", "]", "=", "\"immediate\"", "player", "[", "\"keep-open\"", "]", "=", "\"yes\"", "player", ...
Initialize mpv.
[ "Initialize", "mpv", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/display.py#L7-L16
dylanaraps/bum
bum/util.py
bytes_to_file
def bytes_to_file(input_data, output_file): """Save bytes to a file.""" pathlib.Path(output_file.parent).mkdir(parents=True, exist_ok=True) with open(output_file, "wb") as file: file.write(input_data)
python
def bytes_to_file(input_data, output_file): """Save bytes to a file.""" pathlib.Path(output_file.parent).mkdir(parents=True, exist_ok=True) with open(output_file, "wb") as file: file.write(input_data)
[ "def", "bytes_to_file", "(", "input_data", ",", "output_file", ")", ":", "pathlib", ".", "Path", "(", "output_file", ".", "parent", ")", ".", "mkdir", "(", "parents", "=", "True", ",", "exist_ok", "=", "True", ")", "with", "open", "(", "output_file", ","...
Save bytes to a file.
[ "Save", "bytes", "to", "a", "file", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/util.py#L7-L12
dylanaraps/bum
bum/song.py
init
def init(port=6600, server="localhost"): """Initialize mpd.""" client = mpd.MPDClient() try: client.connect(server, port) return client except ConnectionRefusedError: print("error: Connection refused to mpd/mopidy.") os._exit(1)
python
def init(port=6600, server="localhost"): """Initialize mpd.""" client = mpd.MPDClient() try: client.connect(server, port) return client except ConnectionRefusedError: print("error: Connection refused to mpd/mopidy.") os._exit(1)
[ "def", "init", "(", "port", "=", "6600", ",", "server", "=", "\"localhost\"", ")", ":", "client", "=", "mpd", ".", "MPDClient", "(", ")", "try", ":", "client", ".", "connect", "(", "server", ",", "port", ")", "return", "client", "except", "ConnectionRe...
Initialize mpd.
[ "Initialize", "mpd", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/song.py#L12-L22
dylanaraps/bum
bum/song.py
get_art
def get_art(cache_dir, size, client): """Get the album art.""" song = client.currentsong() if len(song) < 2: print("album: Nothing currently playing.") return file_name = f"{song['artist']}_{song['album']}_{size}.jpg".replace("/", "") file_name = cache_dir / file_name if file_...
python
def get_art(cache_dir, size, client): """Get the album art.""" song = client.currentsong() if len(song) < 2: print("album: Nothing currently playing.") return file_name = f"{song['artist']}_{song['album']}_{size}.jpg".replace("/", "") file_name = cache_dir / file_name if file_...
[ "def", "get_art", "(", "cache_dir", ",", "size", ",", "client", ")", ":", "song", "=", "client", ".", "currentsong", "(", ")", "if", "len", "(", "song", ")", "<", "2", ":", "print", "(", "\"album: Nothing currently playing.\"", ")", "return", "file_name", ...
Get the album art.
[ "Get", "the", "album", "art", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/song.py#L25-L50
dylanaraps/bum
bum/brainz.py
get_cover
def get_cover(song, size=250): """Download the cover art.""" try: data = mus.search_releases(artist=song["artist"], release=song["album"], limit=1) release_id = data["release-list"][0]["release-group"]["id"] print(f"al...
python
def get_cover(song, size=250): """Download the cover art.""" try: data = mus.search_releases(artist=song["artist"], release=song["album"], limit=1) release_id = data["release-list"][0]["release-group"]["id"] print(f"al...
[ "def", "get_cover", "(", "song", ",", "size", "=", "250", ")", ":", "try", ":", "data", "=", "mus", ".", "search_releases", "(", "artist", "=", "song", "[", "\"artist\"", "]", ",", "release", "=", "song", "[", "\"album\"", "]", ",", "limit", "=", "...
Download the cover art.
[ "Download", "the", "cover", "art", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/brainz.py#L16-L32
dylanaraps/bum
bum/__main__.py
get_args
def get_args(): """Get the script arguments.""" description = "bum - Download and display album art \ for mpd tracks." arg = argparse.ArgumentParser(description=description) arg.add_argument("--size", metavar="\"px\"", help="what size to display the album art in....
python
def get_args(): """Get the script arguments.""" description = "bum - Download and display album art \ for mpd tracks." arg = argparse.ArgumentParser(description=description) arg.add_argument("--size", metavar="\"px\"", help="what size to display the album art in....
[ "def", "get_args", "(", ")", ":", "description", "=", "\"bum - Download and display album art \\\n for mpd tracks.\"", "arg", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "description", ")", "arg", ".", "add_argument", "(", "\"--size\...
Get the script arguments.
[ "Get", "the", "script", "arguments", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/__main__.py#L19-L48
dylanaraps/bum
bum/__main__.py
main
def main(): """Main script function.""" args = get_args() process_args(args) if not args.no_display: disp = display.init(args.size) client = song.init(args.port, args.server) while True: song.get_art(args.cache_dir, args.size, client) if not args.no_display: ...
python
def main(): """Main script function.""" args = get_args() process_args(args) if not args.no_display: disp = display.init(args.size) client = song.init(args.port, args.server) while True: song.get_art(args.cache_dir, args.size, client) if not args.no_display: ...
[ "def", "main", "(", ")", ":", "args", "=", "get_args", "(", ")", "process_args", "(", "args", ")", "if", "not", "args", ".", "no_display", ":", "disp", "=", "display", ".", "init", "(", "args", ".", "size", ")", "client", "=", "song", ".", "init", ...
Main script function.
[ "Main", "script", "function", "." ]
train
https://github.com/dylanaraps/bum/blob/004d795a67398e79f2c098d7775e9cd97231646b/bum/__main__.py#L58-L77
proycon/clam
clam/common/converters.py
AbstractConverter.convertforinput
def convertforinput(self,filepath, metadata): """Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file. 'filepath' is both the source and the target file, the source file will be erased and overwrit...
python
def convertforinput(self,filepath, metadata): """Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file. 'filepath' is both the source and the target file, the source file will be erased and overwrit...
[ "def", "convertforinput", "(", "self", ",", "filepath", ",", "metadata", ")", ":", "assert", "isinstance", "(", "metadata", ",", "CLAMMetaData", ")", "#metadata of the destination file (file to be generated here)", "if", "not", "metadata", ".", "__class__", "in", "sel...
Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file. 'filepath' is both the source and the target file, the source file will be erased and overwritten with the conversion result!
[ "Convert", "from", "target", "format", "into", "one", "of", "the", "source", "formats", ".", "Relevant", "if", "converters", "are", "used", "in", "InputTemplates", ".", "Metadata", "already", "is", "metadata", "for", "the", "to", "-", "be", "-", "generated",...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/converters.py#L37-L42
proycon/clam
clam/common/converters.py
AbstractConverter.convertforoutput
def convertforoutput(self,outputfile): """Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Sourcefile is a CLAMOutputFile instance.""" assert isinstance(outputfile, CLAMOutputFile) #metadata of the destination file (file to be generated here)...
python
def convertforoutput(self,outputfile): """Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Sourcefile is a CLAMOutputFile instance.""" assert isinstance(outputfile, CLAMOutputFile) #metadata of the destination file (file to be generated here)...
[ "def", "convertforoutput", "(", "self", ",", "outputfile", ")", ":", "assert", "isinstance", "(", "outputfile", ",", "CLAMOutputFile", ")", "#metadata of the destination file (file to be generated here)", "if", "not", "outputfile", ".", "metadata", ".", "__class__", "in...
Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Sourcefile is a CLAMOutputFile instance.
[ "Convert", "from", "one", "of", "the", "source", "formats", "into", "target", "format", ".", "Relevant", "if", "converters", "are", "used", "in", "OutputTemplates", ".", "Sourcefile", "is", "a", "CLAMOutputFile", "instance", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/converters.py#L44-L49
proycon/clam
clam/common/converters.py
CharEncodingConverter.convertforinput
def convertforinput(self,filepath, metadata=None): """Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file.""" super(CharEncodingConverter,self).convertforinput(filepath, metadata) ...
python
def convertforinput(self,filepath, metadata=None): """Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file.""" super(CharEncodingConverter,self).convertforinput(filepath, metadata) ...
[ "def", "convertforinput", "(", "self", ",", "filepath", ",", "metadata", "=", "None", ")", ":", "super", "(", "CharEncodingConverter", ",", "self", ")", ".", "convertforinput", "(", "filepath", ",", "metadata", ")", "shutil", ".", "copy", "(", "filepath", ...
Convert from target format into one of the source formats. Relevant if converters are used in InputTemplates. Metadata already is metadata for the to-be-generated file.
[ "Convert", "from", "target", "format", "into", "one", "of", "the", "source", "formats", ".", "Relevant", "if", "converters", "are", "used", "in", "InputTemplates", ".", "Metadata", "already", "is", "metadata", "for", "the", "to", "-", "be", "-", "generated",...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/converters.py#L71-L90
proycon/clam
clam/common/converters.py
CharEncodingConverter.convertforoutput
def convertforoutput(self,outputfile): """Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Outputfile is a CLAMOutputFile instance.""" super(CharEncodingConverter,self).convertforoutput(outputfile) return withheaders( flask.make_resp...
python
def convertforoutput(self,outputfile): """Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Outputfile is a CLAMOutputFile instance.""" super(CharEncodingConverter,self).convertforoutput(outputfile) return withheaders( flask.make_resp...
[ "def", "convertforoutput", "(", "self", ",", "outputfile", ")", ":", "super", "(", "CharEncodingConverter", ",", "self", ")", ".", "convertforoutput", "(", "outputfile", ")", "return", "withheaders", "(", "flask", ".", "make_response", "(", "(", "line", ".", ...
Convert from one of the source formats into target format. Relevant if converters are used in OutputTemplates. Outputfile is a CLAMOutputFile instance.
[ "Convert", "from", "one", "of", "the", "source", "formats", "into", "target", "format", ".", "Relevant", "if", "converters", "are", "used", "in", "OutputTemplates", ".", "Outputfile", "is", "a", "CLAMOutputFile", "instance", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/converters.py#L93-L97
proycon/clam
clam/common/data.py
getclamdata
def getclamdata(filename, custom_formats=None): global CUSTOM_FORMATS #pylint: disable=global-statement """This function reads the CLAM Data from an XML file. Use this to read the clam.xml file from your system wrapper. It returns a CLAMData instance. If you make use of CUSTOM_FORMATS, you need to pas...
python
def getclamdata(filename, custom_formats=None): global CUSTOM_FORMATS #pylint: disable=global-statement """This function reads the CLAM Data from an XML file. Use this to read the clam.xml file from your system wrapper. It returns a CLAMData instance. If you make use of CUSTOM_FORMATS, you need to pas...
[ "def", "getclamdata", "(", "filename", ",", "custom_formats", "=", "None", ")", ":", "global", "CUSTOM_FORMATS", "#pylint: disable=global-statement", "f", "=", "io", ".", "open", "(", "filename", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "xml", "=", ...
This function reads the CLAM Data from an XML file. Use this to read the clam.xml file from your system wrapper. It returns a CLAMData instance. If you make use of CUSTOM_FORMATS, you need to pass the CUSTOM_FORMATS list as 2nd argument.
[ "This", "function", "reads", "the", "CLAM", "Data", "from", "an", "XML", "file", ".", "Use", "this", "to", "read", "the", "clam", ".", "xml", "file", "from", "your", "system", "wrapper", ".", "It", "returns", "a", "CLAMData", "instance", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L379-L391
proycon/clam
clam/common/data.py
sanitizeparameters
def sanitizeparameters(parameters): """Construct a dictionary of parameters, for internal use only""" if not isinstance(parameters,dict): d = {} for x in parameters: if isinstance(x,tuple) and len(x) == 2: for parameter in x[1]: d[parameter.id] = p...
python
def sanitizeparameters(parameters): """Construct a dictionary of parameters, for internal use only""" if not isinstance(parameters,dict): d = {} for x in parameters: if isinstance(x,tuple) and len(x) == 2: for parameter in x[1]: d[parameter.id] = p...
[ "def", "sanitizeparameters", "(", "parameters", ")", ":", "if", "not", "isinstance", "(", "parameters", ",", "dict", ")", ":", "d", "=", "{", "}", "for", "x", "in", "parameters", ":", "if", "isinstance", "(", "x", ",", "tuple", ")", "and", "len", "("...
Construct a dictionary of parameters, for internal use only
[ "Construct", "a", "dictionary", "of", "parameters", "for", "internal", "use", "only" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L773-L785
proycon/clam
clam/common/data.py
profiler
def profiler(profiles, projectpath,parameters,serviceid,servicename,serviceurl,printdebug=None): """Given input files and parameters, produce metadata for outputfiles. Returns a list of matched profiles (empty if none match), and a program.""" parameters = sanitizeparameters(parameters) matched = [] p...
python
def profiler(profiles, projectpath,parameters,serviceid,servicename,serviceurl,printdebug=None): """Given input files and parameters, produce metadata for outputfiles. Returns a list of matched profiles (empty if none match), and a program.""" parameters = sanitizeparameters(parameters) matched = [] p...
[ "def", "profiler", "(", "profiles", ",", "projectpath", ",", "parameters", ",", "serviceid", ",", "servicename", ",", "serviceurl", ",", "printdebug", "=", "None", ")", ":", "parameters", "=", "sanitizeparameters", "(", "parameters", ")", "matched", "=", "[", ...
Given input files and parameters, produce metadata for outputfiles. Returns a list of matched profiles (empty if none match), and a program.
[ "Given", "input", "files", "and", "parameters", "produce", "metadata", "for", "outputfiles", ".", "Returns", "a", "list", "of", "matched", "profiles", "(", "empty", "if", "none", "match", ")", "and", "a", "program", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L789-L801
proycon/clam
clam/common/data.py
shellsafe
def shellsafe(s, quote='', doescape=True): """Returns the value string, wrapped in the specified quotes (if not empty), but checks and raises an Exception if the string is at risk of causing code injection""" if sys.version[0] == '2' and not isinstance(s,unicode): #pylint: disable=undefined-variable s =...
python
def shellsafe(s, quote='', doescape=True): """Returns the value string, wrapped in the specified quotes (if not empty), but checks and raises an Exception if the string is at risk of causing code injection""" if sys.version[0] == '2' and not isinstance(s,unicode): #pylint: disable=undefined-variable s =...
[ "def", "shellsafe", "(", "s", ",", "quote", "=", "''", ",", "doescape", "=", "True", ")", ":", "if", "sys", ".", "version", "[", "0", "]", "==", "'2'", "and", "not", "isinstance", "(", "s", ",", "unicode", ")", ":", "#pylint: disable=undefined-variable...
Returns the value string, wrapped in the specified quotes (if not empty), but checks and raises an Exception if the string is at risk of causing code injection
[ "Returns", "the", "value", "string", "wrapped", "in", "the", "specified", "quotes", "(", "if", "not", "empty", ")", "but", "checks", "and", "raises", "an", "Exception", "if", "the", "string", "is", "at", "risk", "of", "causing", "code", "injection" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L2417-L2434
proycon/clam
clam/common/data.py
CLAMFile.attachviewers
def attachviewers(self, profiles): """Attach viewers *and converters* to file, automatically scan all profiles for outputtemplate or inputtemplate""" if self.metadata: template = None for profile in profiles: if isinstance(self, CLAMInputFile): ...
python
def attachviewers(self, profiles): """Attach viewers *and converters* to file, automatically scan all profiles for outputtemplate or inputtemplate""" if self.metadata: template = None for profile in profiles: if isinstance(self, CLAMInputFile): ...
[ "def", "attachviewers", "(", "self", ",", "profiles", ")", ":", "if", "self", ".", "metadata", ":", "template", "=", "None", "for", "profile", "in", "profiles", ":", "if", "isinstance", "(", "self", ",", "CLAMInputFile", ")", ":", "for", "t", "in", "pr...
Attach viewers *and converters* to file, automatically scan all profiles for outputtemplate or inputtemplate
[ "Attach", "viewers", "*", "and", "converters", "*", "to", "file", "automatically", "scan", "all", "profiles", "for", "outputtemplate", "or", "inputtemplate" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L204-L228
proycon/clam
clam/common/data.py
CLAMFile.metafilename
def metafilename(self): """Returns the filename for the metadata file (not full path). Only used for local files.""" metafilename = os.path.dirname(self.filename) if metafilename: metafilename += '/' metafilename += '.' + os.path.basename(self.filename) + '.METADATA' return metaf...
python
def metafilename(self): """Returns the filename for the metadata file (not full path). Only used for local files.""" metafilename = os.path.dirname(self.filename) if metafilename: metafilename += '/' metafilename += '.' + os.path.basename(self.filename) + '.METADATA' return metaf...
[ "def", "metafilename", "(", "self", ")", ":", "metafilename", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "filename", ")", "if", "metafilename", ":", "metafilename", "+=", "'/'", "metafilename", "+=", "'.'", "+", "os", ".", "path", ".", "...
Returns the filename for the metadata file (not full path). Only used for local files.
[ "Returns", "the", "filename", "for", "the", "metadata", "file", "(", "not", "full", "path", ")", ".", "Only", "used", "for", "local", "files", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L230-L235
proycon/clam
clam/common/data.py
CLAMFile.loadmetadata
def loadmetadata(self): """Load metadata for this file. This is usually called automatically upon instantiation, except if explicitly disabled. Works both locally as well as for clients connecting to a CLAM service.""" if not self.remote: metafile = self.projectpath + self.basedir + '/' + se...
python
def loadmetadata(self): """Load metadata for this file. This is usually called automatically upon instantiation, except if explicitly disabled. Works both locally as well as for clients connecting to a CLAM service.""" if not self.remote: metafile = self.projectpath + self.basedir + '/' + se...
[ "def", "loadmetadata", "(", "self", ")", ":", "if", "not", "self", ".", "remote", ":", "metafile", "=", "self", ".", "projectpath", "+", "self", ".", "basedir", "+", "'/'", "+", "self", ".", "metafilename", "(", ")", "if", "os", ".", "path", ".", "...
Load metadata for this file. This is usually called automatically upon instantiation, except if explicitly disabled. Works both locally as well as for clients connecting to a CLAM service.
[ "Load", "metadata", "for", "this", "file", ".", "This", "is", "usually", "called", "automatically", "upon", "instantiation", "except", "if", "explicitly", "disabled", ".", "Works", "both", "locally", "as", "well", "as", "for", "clients", "connecting", "to", "a...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L237-L264
proycon/clam
clam/common/data.py
CLAMFile.delete
def delete(self): """Delete this file""" if not self.remote: if not os.path.exists(self.projectpath + self.basedir + '/' + self.filename): return False else: os.unlink(self.projectpath + self.basedir + '/' + self.filename) #Remove meta...
python
def delete(self): """Delete this file""" if not self.remote: if not os.path.exists(self.projectpath + self.basedir + '/' + self.filename): return False else: os.unlink(self.projectpath + self.basedir + '/' + self.filename) #Remove meta...
[ "def", "delete", "(", "self", ")", ":", "if", "not", "self", ".", "remote", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "projectpath", "+", "self", ".", "basedir", "+", "'/'", "+", "self", ".", "filename", ")", ":", "ret...
Delete this file
[ "Delete", "this", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L300-L325
proycon/clam
clam/common/data.py
CLAMFile.read
def read(self): """Loads all lines in memory""" lines = self.readlines() if self.metadata and 'encoding' in self.metadata: encoding = self.metadata['encoding'] else: encoding = 'utf-8' if sys.version < '3': return "\n".join( unicode(line, 'utf-...
python
def read(self): """Loads all lines in memory""" lines = self.readlines() if self.metadata and 'encoding' in self.metadata: encoding = self.metadata['encoding'] else: encoding = 'utf-8' if sys.version < '3': return "\n".join( unicode(line, 'utf-...
[ "def", "read", "(", "self", ")", ":", "lines", "=", "self", ".", "readlines", "(", ")", "if", "self", ".", "metadata", "and", "'encoding'", "in", "self", ".", "metadata", ":", "encoding", "=", "self", ".", "metadata", "[", "'encoding'", "]", "else", ...
Loads all lines in memory
[ "Loads", "all", "lines", "in", "memory" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L332-L342
proycon/clam
clam/common/data.py
CLAMFile.copy
def copy(self, target, timeout=500): """Copy or download this file to a new local file""" if self.metadata and 'encoding' in self.metadata: with io.open(target,'w', encoding=self.metadata['encoding']) as f: for line in self: f.write(line) else: ...
python
def copy(self, target, timeout=500): """Copy or download this file to a new local file""" if self.metadata and 'encoding' in self.metadata: with io.open(target,'w', encoding=self.metadata['encoding']) as f: for line in self: f.write(line) else: ...
[ "def", "copy", "(", "self", ",", "target", ",", "timeout", "=", "500", ")", ":", "if", "self", ".", "metadata", "and", "'encoding'", "in", "self", ".", "metadata", ":", "with", "io", ".", "open", "(", "target", ",", "'w'", ",", "encoding", "=", "se...
Copy or download this file to a new local file
[ "Copy", "or", "download", "this", "file", "to", "a", "new", "local", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L345-L360
proycon/clam
clam/common/data.py
CLAMData.parseresponse
def parseresponse(self, xml, localroot = False): """Parses CLAM XML, there's usually no need to call this directly""" root = parsexmlstring(xml) if root.tag != 'clam': raise FormatError("CLAM root tag not found") self.system_id = root.attrib['id'] self.system_name = ...
python
def parseresponse(self, xml, localroot = False): """Parses CLAM XML, there's usually no need to call this directly""" root = parsexmlstring(xml) if root.tag != 'clam': raise FormatError("CLAM root tag not found") self.system_id = root.attrib['id'] self.system_name = ...
[ "def", "parseresponse", "(", "self", ",", "xml", ",", "localroot", "=", "False", ")", ":", "root", "=", "parsexmlstring", "(", "xml", ")", "if", "root", ".", "tag", "!=", "'clam'", ":", "raise", "FormatError", "(", "\"CLAM root tag not found\"", ")", "self...
Parses CLAM XML, there's usually no need to call this directly
[ "Parses", "CLAM", "XML", "there", "s", "usually", "no", "need", "to", "call", "this", "directly" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L560-L654
proycon/clam
clam/common/data.py
CLAMData.outputtemplate
def outputtemplate(self, template_id): """Get an output template by ID""" for profile in self.profiles: for outputtemplate in profile.outputtemplates(): if outputtemplate.id == template_id: return outputtemplate return KeyError("Outputtemplate " + ...
python
def outputtemplate(self, template_id): """Get an output template by ID""" for profile in self.profiles: for outputtemplate in profile.outputtemplates(): if outputtemplate.id == template_id: return outputtemplate return KeyError("Outputtemplate " + ...
[ "def", "outputtemplate", "(", "self", ",", "template_id", ")", ":", "for", "profile", "in", "self", ".", "profiles", ":", "for", "outputtemplate", "in", "profile", ".", "outputtemplates", "(", ")", ":", "if", "outputtemplate", ".", "id", "==", "template_id",...
Get an output template by ID
[ "Get", "an", "output", "template", "by", "ID" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L656-L662
proycon/clam
clam/common/data.py
CLAMData.commandlineargs
def commandlineargs(self): """Obtain a string of all parameters, using the paramater flags they were defined with, in order to pass to an external command. This is shell-safe by definition.""" commandlineargs = [] for parametergroup, parameters in self.parameters: #pylint: disable=unused-variabl...
python
def commandlineargs(self): """Obtain a string of all parameters, using the paramater flags they were defined with, in order to pass to an external command. This is shell-safe by definition.""" commandlineargs = [] for parametergroup, parameters in self.parameters: #pylint: disable=unused-variabl...
[ "def", "commandlineargs", "(", "self", ")", ":", "commandlineargs", "=", "[", "]", "for", "parametergroup", ",", "parameters", "in", "self", ".", "parameters", ":", "#pylint: disable=unused-variable", "for", "parameter", "in", "parameters", ":", "p", "=", "param...
Obtain a string of all parameters, using the paramater flags they were defined with, in order to pass to an external command. This is shell-safe by definition.
[ "Obtain", "a", "string", "of", "all", "parameters", "using", "the", "paramater", "flags", "they", "were", "defined", "with", "in", "order", "to", "pass", "to", "an", "external", "command", ".", "This", "is", "shell", "-", "safe", "by", "definition", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L665-L673
proycon/clam
clam/common/data.py
CLAMData.parameter
def parameter(self, parameter_id): """Return the specified global parameter (the entire object, not just the value)""" for parametergroup, parameters in self.parameters: #pylint: disable=unused-variable for parameter in parameters: if parameter.id == parameter_id: ...
python
def parameter(self, parameter_id): """Return the specified global parameter (the entire object, not just the value)""" for parametergroup, parameters in self.parameters: #pylint: disable=unused-variable for parameter in parameters: if parameter.id == parameter_id: ...
[ "def", "parameter", "(", "self", ",", "parameter_id", ")", ":", "for", "parametergroup", ",", "parameters", "in", "self", ".", "parameters", ":", "#pylint: disable=unused-variable", "for", "parameter", "in", "parameters", ":", "if", "parameter", ".", "id", "==",...
Return the specified global parameter (the entire object, not just the value)
[ "Return", "the", "specified", "global", "parameter", "(", "the", "entire", "object", "not", "just", "the", "value", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L676-L682
proycon/clam
clam/common/data.py
CLAMData.parametererror
def parametererror(self): """Return the first parameter error, or False if there is none""" for parametergroup, parameters in self.parameters: #pylint: disable=unused-variable for parameter in parameters: if parameter.error: return parameter.error ...
python
def parametererror(self): """Return the first parameter error, or False if there is none""" for parametergroup, parameters in self.parameters: #pylint: disable=unused-variable for parameter in parameters: if parameter.error: return parameter.error ...
[ "def", "parametererror", "(", "self", ")", ":", "for", "parametergroup", ",", "parameters", "in", "self", ".", "parameters", ":", "#pylint: disable=unused-variable", "for", "parameter", "in", "parameters", ":", "if", "parameter", ".", "error", ":", "return", "pa...
Return the first parameter error, or False if there is none
[ "Return", "the", "first", "parameter", "error", "or", "False", "if", "there", "is", "none" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L714-L720
proycon/clam
clam/common/data.py
CLAMData.passparameters
def passparameters(self): """Return all parameters as {id: value} dictionary""" paramdict = {} for parametergroup, params in self.parameters: #pylint: disable=unused-variable for parameter in params: if parameter.value: if isinstance(parameter.valu...
python
def passparameters(self): """Return all parameters as {id: value} dictionary""" paramdict = {} for parametergroup, params in self.parameters: #pylint: disable=unused-variable for parameter in params: if parameter.value: if isinstance(parameter.valu...
[ "def", "passparameters", "(", "self", ")", ":", "paramdict", "=", "{", "}", "for", "parametergroup", ",", "params", "in", "self", ".", "parameters", ":", "#pylint: disable=unused-variable", "for", "parameter", "in", "params", ":", "if", "parameter", ".", "valu...
Return all parameters as {id: value} dictionary
[ "Return", "all", "parameters", "as", "{", "id", ":", "value", "}", "dictionary" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L722-L732
proycon/clam
clam/common/data.py
CLAMData.inputtemplates
def inputtemplates(self): """Return all input templates as a list (of InputTemplate instances)""" l = [] for profile in self.profiles: l += profile.input return l
python
def inputtemplates(self): """Return all input templates as a list (of InputTemplate instances)""" l = [] for profile in self.profiles: l += profile.input return l
[ "def", "inputtemplates", "(", "self", ")", ":", "l", "=", "[", "]", "for", "profile", "in", "self", ".", "profiles", ":", "l", "+=", "profile", ".", "input", "return", "l" ]
Return all input templates as a list (of InputTemplate instances)
[ "Return", "all", "input", "templates", "as", "a", "list", "(", "of", "InputTemplate", "instances", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L735-L740
proycon/clam
clam/common/data.py
CLAMData.inputtemplate
def inputtemplate(self,template_id): """Return the inputtemplate with the specified ID. This is used to resolve a inputtemplate ID to an InputTemplate object instance""" for profile in self.profiles: for inputtemplate in profile.input: if inputtemplate.id == template_id: ...
python
def inputtemplate(self,template_id): """Return the inputtemplate with the specified ID. This is used to resolve a inputtemplate ID to an InputTemplate object instance""" for profile in self.profiles: for inputtemplate in profile.input: if inputtemplate.id == template_id: ...
[ "def", "inputtemplate", "(", "self", ",", "template_id", ")", ":", "for", "profile", "in", "self", ".", "profiles", ":", "for", "inputtemplate", "in", "profile", ".", "input", ":", "if", "inputtemplate", ".", "id", "==", "template_id", ":", "return", "inpu...
Return the inputtemplate with the specified ID. This is used to resolve a inputtemplate ID to an InputTemplate object instance
[ "Return", "the", "inputtemplate", "with", "the", "specified", "ID", ".", "This", "is", "used", "to", "resolve", "a", "inputtemplate", "ID", "to", "an", "InputTemplate", "object", "instance" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L742-L748
proycon/clam
clam/common/data.py
CLAMData.inputfile
def inputfile(self, inputtemplate=None): """Return the inputfile for the specified inputtemplate, if ``inputtemplate=None``, inputfile is returned regardless of inputtemplate. This function may only return 1 and returns an error when multiple input files can be returned, use ``inputfiles()`` instead.""" ...
python
def inputfile(self, inputtemplate=None): """Return the inputfile for the specified inputtemplate, if ``inputtemplate=None``, inputfile is returned regardless of inputtemplate. This function may only return 1 and returns an error when multiple input files can be returned, use ``inputfiles()`` instead.""" ...
[ "def", "inputfile", "(", "self", ",", "inputtemplate", "=", "None", ")", ":", "inputfiles", "=", "list", "(", "self", ".", "inputfiles", "(", "inputtemplate", ")", ")", "if", "len", "(", "inputfiles", ")", "<", "1", ":", "raise", "Exception", "(", "\"N...
Return the inputfile for the specified inputtemplate, if ``inputtemplate=None``, inputfile is returned regardless of inputtemplate. This function may only return 1 and returns an error when multiple input files can be returned, use ``inputfiles()`` instead.
[ "Return", "the", "inputfile", "for", "the", "specified", "inputtemplate", "if", "inputtemplate", "=", "None", "inputfile", "is", "returned", "regardless", "of", "inputtemplate", ".", "This", "function", "may", "only", "return", "1", "and", "returns", "an", "erro...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L750-L757
proycon/clam
clam/common/data.py
CLAMData.inputfiles
def inputfiles(self, inputtemplate=None): """Generator yielding all inputfiles for the specified inputtemplate, if ``inputtemplate=None``, inputfiles are returned regardless of inputtemplate.""" if isinstance(inputtemplate, InputTemplate): #ID suffices: inputtemplate = inputtempl...
python
def inputfiles(self, inputtemplate=None): """Generator yielding all inputfiles for the specified inputtemplate, if ``inputtemplate=None``, inputfiles are returned regardless of inputtemplate.""" if isinstance(inputtemplate, InputTemplate): #ID suffices: inputtemplate = inputtempl...
[ "def", "inputfiles", "(", "self", ",", "inputtemplate", "=", "None", ")", ":", "if", "isinstance", "(", "inputtemplate", ",", "InputTemplate", ")", ":", "#ID suffices:", "inputtemplate", "=", "inputtemplate", ".", "id", "for", "inputfile", "in", "self", ".", ...
Generator yielding all inputfiles for the specified inputtemplate, if ``inputtemplate=None``, inputfiles are returned regardless of inputtemplate.
[ "Generator", "yielding", "all", "inputfiles", "for", "the", "specified", "inputtemplate", "if", "inputtemplate", "=", "None", "inputfiles", "are", "returned", "regardless", "of", "inputtemplate", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L764-L771
proycon/clam
clam/common/data.py
Profile.match
def match(self, projectpath, parameters): """Check if the profile matches all inputdata *and* produces output given the set parameters. Returns a boolean""" parameters = sanitizeparameters(parameters) mandatory_absent = [] #list of input templates that are missing but mandatory optional...
python
def match(self, projectpath, parameters): """Check if the profile matches all inputdata *and* produces output given the set parameters. Returns a boolean""" parameters = sanitizeparameters(parameters) mandatory_absent = [] #list of input templates that are missing but mandatory optional...
[ "def", "match", "(", "self", ",", "projectpath", ",", "parameters", ")", ":", "parameters", "=", "sanitizeparameters", "(", "parameters", ")", "mandatory_absent", "=", "[", "]", "#list of input templates that are missing but mandatory", "optional_absent", "=", "[", "]...
Check if the profile matches all inputdata *and* produces output given the set parameters. Returns a boolean
[ "Check", "if", "the", "profile", "matches", "all", "inputdata", "*", "and", "*", "produces", "output", "given", "the", "set", "parameters", ".", "Returns", "a", "boolean" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L857-L889
proycon/clam
clam/common/data.py
Profile.matchingfiles
def matchingfiles(self, projectpath): """Return a list of all inputfiles matching the profile (filenames)""" l = [] for inputtemplate in self.input: l += inputtemplate.matchingfiles(projectpath) return l
python
def matchingfiles(self, projectpath): """Return a list of all inputfiles matching the profile (filenames)""" l = [] for inputtemplate in self.input: l += inputtemplate.matchingfiles(projectpath) return l
[ "def", "matchingfiles", "(", "self", ",", "projectpath", ")", ":", "l", "=", "[", "]", "for", "inputtemplate", "in", "self", ".", "input", ":", "l", "+=", "inputtemplate", ".", "matchingfiles", "(", "projectpath", ")", "return", "l" ]
Return a list of all inputfiles matching the profile (filenames)
[ "Return", "a", "list", "of", "all", "inputfiles", "matching", "the", "profile", "(", "filenames", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L891-L896
proycon/clam
clam/common/data.py
Profile.outputtemplates
def outputtemplates(self): """Returns all outputtemplates, resolving ParameterConditions to all possibilities""" outputtemplates = [] for o in self.output: if isinstance(o, ParameterCondition): outputtemplates += o.allpossibilities() else: ...
python
def outputtemplates(self): """Returns all outputtemplates, resolving ParameterConditions to all possibilities""" outputtemplates = [] for o in self.output: if isinstance(o, ParameterCondition): outputtemplates += o.allpossibilities() else: ...
[ "def", "outputtemplates", "(", "self", ")", ":", "outputtemplates", "=", "[", "]", "for", "o", "in", "self", ".", "output", ":", "if", "isinstance", "(", "o", ",", "ParameterCondition", ")", ":", "outputtemplates", "+=", "o", ".", "allpossibilities", "(", ...
Returns all outputtemplates, resolving ParameterConditions to all possibilities
[ "Returns", "all", "outputtemplates", "resolving", "ParameterConditions", "to", "all", "possibilities" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L898-L907
proycon/clam
clam/common/data.py
Profile.generate
def generate(self, projectpath, parameters, serviceid, servicename,serviceurl): """Generate output metadata on the basis of input files and parameters. Projectpath must be absolute. Returns a Program instance. """ #Make dictionary of parameters parameters = sanitizeparameters(parameters) ...
python
def generate(self, projectpath, parameters, serviceid, servicename,serviceurl): """Generate output metadata on the basis of input files and parameters. Projectpath must be absolute. Returns a Program instance. """ #Make dictionary of parameters parameters = sanitizeparameters(parameters) ...
[ "def", "generate", "(", "self", ",", "projectpath", ",", "parameters", ",", "serviceid", ",", "servicename", ",", "serviceurl", ")", ":", "#Make dictionary of parameters", "parameters", "=", "sanitizeparameters", "(", "parameters", ")", "program", "=", "Program", ...
Generate output metadata on the basis of input files and parameters. Projectpath must be absolute. Returns a Program instance.
[ "Generate", "output", "metadata", "on", "the", "basis", "of", "input", "files", "and", "parameters", ".", "Projectpath", "must", "be", "absolute", ".", "Returns", "a", "Program", "instance", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L910-L956
proycon/clam
clam/common/data.py
Profile.xml
def xml(self, indent = ""): """Produce XML output for the profile""" xml = "\n" + indent + "<profile>\n" xml += indent + " <input>\n" for inputtemplate in self.input: xml += inputtemplate.xml(indent +" ") + "\n" xml += indent + " </input>\n" xml += indent +...
python
def xml(self, indent = ""): """Produce XML output for the profile""" xml = "\n" + indent + "<profile>\n" xml += indent + " <input>\n" for inputtemplate in self.input: xml += inputtemplate.xml(indent +" ") + "\n" xml += indent + " </input>\n" xml += indent +...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "\"\\n\"", "+", "indent", "+", "\"<profile>\\n\"", "xml", "+=", "indent", "+", "\" <input>\\n\"", "for", "inputtemplate", "in", "self", ".", "input", ":", "xml", "+=", "inputtem...
Produce XML output for the profile
[ "Produce", "XML", "output", "for", "the", "profile" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L959-L971
proycon/clam
clam/common/data.py
Profile.fromxml
def fromxml(node): """Return a profile instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) args = [] if node.tag == 'profile': ...
python
def fromxml(node): """Return a profile instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) args = [] if node.tag == 'profile': ...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "args", "=", "[", "]", "if", "node", ".", ...
Return a profile instance from the given XML description. Node can be a string or an etree._Element.
[ "Return", "a", "profile", "instance", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L985-L1004
proycon/clam
clam/common/data.py
Program.add
def add(self, outputfilename, outputtemplate, inputfilename=None, inputtemplate=None): """Add a new path to the program""" if isinstance(outputtemplate,OutputTemplate): outputtemplate = outputtemplate.id if isinstance(inputtemplate,InputTemplate): inputtemplate = inputtem...
python
def add(self, outputfilename, outputtemplate, inputfilename=None, inputtemplate=None): """Add a new path to the program""" if isinstance(outputtemplate,OutputTemplate): outputtemplate = outputtemplate.id if isinstance(inputtemplate,InputTemplate): inputtemplate = inputtem...
[ "def", "add", "(", "self", ",", "outputfilename", ",", "outputtemplate", ",", "inputfilename", "=", "None", ",", "inputtemplate", "=", "None", ")", ":", "if", "isinstance", "(", "outputtemplate", ",", "OutputTemplate", ")", ":", "outputtemplate", "=", "outputt...
Add a new path to the program
[ "Add", "a", "new", "path", "to", "the", "program" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1023-L1037
proycon/clam
clam/common/data.py
Program.getoutputfiles
def getoutputfiles(self, loadmetadata=True, client=None,requiremetadata=False): """Iterates over all output files and their output template. Yields (CLAMOutputFile, str:outputtemplate_id) tuples. The last three arguments are passed to its constructor.""" for outputfilename, outputtemplate in self.output...
python
def getoutputfiles(self, loadmetadata=True, client=None,requiremetadata=False): """Iterates over all output files and their output template. Yields (CLAMOutputFile, str:outputtemplate_id) tuples. The last three arguments are passed to its constructor.""" for outputfilename, outputtemplate in self.output...
[ "def", "getoutputfiles", "(", "self", ",", "loadmetadata", "=", "True", ",", "client", "=", "None", ",", "requiremetadata", "=", "False", ")", ":", "for", "outputfilename", ",", "outputtemplate", "in", "self", ".", "outputpairs", "(", ")", ":", "yield", "C...
Iterates over all output files and their output template. Yields (CLAMOutputFile, str:outputtemplate_id) tuples. The last three arguments are passed to its constructor.
[ "Iterates", "over", "all", "output", "files", "and", "their", "output", "template", ".", "Yields", "(", "CLAMOutputFile", "str", ":", "outputtemplate_id", ")", "tuples", ".", "The", "last", "three", "arguments", "are", "passed", "to", "its", "constructor", "."...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1049-L1052
proycon/clam
clam/common/data.py
Program.getinputfiles
def getinputfiles(self, outputfile, loadmetadata=True, client=None,requiremetadata=False): """Iterates over all input files for the specified outputfile (you may pass a CLAMOutputFile instance or a filename string). Yields (CLAMInputFile,str:inputtemplate_id) tuples. The last three arguments are passed to its c...
python
def getinputfiles(self, outputfile, loadmetadata=True, client=None,requiremetadata=False): """Iterates over all input files for the specified outputfile (you may pass a CLAMOutputFile instance or a filename string). Yields (CLAMInputFile,str:inputtemplate_id) tuples. The last three arguments are passed to its c...
[ "def", "getinputfiles", "(", "self", ",", "outputfile", ",", "loadmetadata", "=", "True", ",", "client", "=", "None", ",", "requiremetadata", "=", "False", ")", ":", "if", "isinstance", "(", "outputfile", ",", "CLAMOutputFile", ")", ":", "outputfilename", "=...
Iterates over all input files for the specified outputfile (you may pass a CLAMOutputFile instance or a filename string). Yields (CLAMInputFile,str:inputtemplate_id) tuples. The last three arguments are passed to its constructor.
[ "Iterates", "over", "all", "input", "files", "for", "the", "specified", "outputfile", "(", "you", "may", "pass", "a", "CLAMOutputFile", "instance", "or", "a", "filename", "string", ")", ".", "Yields", "(", "CLAMInputFile", "str", ":", "inputtemplate_id", ")", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1054-L1062
proycon/clam
clam/common/data.py
Program.getinputfile
def getinputfile(self, outputfile, loadmetadata=True, client=None,requiremetadata=False): """Grabs one input file for the specified output filename (raises a KeyError exception if there is no such output, StopIteration if there are no input files for it). Shortcut for getinputfiles()""" if isinstance(ou...
python
def getinputfile(self, outputfile, loadmetadata=True, client=None,requiremetadata=False): """Grabs one input file for the specified output filename (raises a KeyError exception if there is no such output, StopIteration if there are no input files for it). Shortcut for getinputfiles()""" if isinstance(ou...
[ "def", "getinputfile", "(", "self", ",", "outputfile", ",", "loadmetadata", "=", "True", ",", "client", "=", "None", ",", "requiremetadata", "=", "False", ")", ":", "if", "isinstance", "(", "outputfile", ",", "CLAMOutputFile", ")", ":", "outputfilename", "="...
Grabs one input file for the specified output filename (raises a KeyError exception if there is no such output, StopIteration if there are no input files for it). Shortcut for getinputfiles()
[ "Grabs", "one", "input", "file", "for", "the", "specified", "output", "filename", "(", "raises", "a", "KeyError", "exception", "if", "there", "is", "no", "such", "output", "StopIteration", "if", "there", "are", "no", "input", "files", "for", "it", ")", "."...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1064-L1075
proycon/clam
clam/common/data.py
Program.getoutputfile
def getoutputfile(self, loadmetadata=True, client=None,requiremetadata=False): """Grabs one output file (raises a StopIteration exception if there is none). Shortcut for getoutputfiles()""" return next(self.getoutputfiles(loadmetadata,client,requiremetadata))
python
def getoutputfile(self, loadmetadata=True, client=None,requiremetadata=False): """Grabs one output file (raises a StopIteration exception if there is none). Shortcut for getoutputfiles()""" return next(self.getoutputfiles(loadmetadata,client,requiremetadata))
[ "def", "getoutputfile", "(", "self", ",", "loadmetadata", "=", "True", ",", "client", "=", "None", ",", "requiremetadata", "=", "False", ")", ":", "return", "next", "(", "self", ".", "getoutputfiles", "(", "loadmetadata", ",", "client", ",", "requiremetadata...
Grabs one output file (raises a StopIteration exception if there is none). Shortcut for getoutputfiles()
[ "Grabs", "one", "output", "file", "(", "raises", "a", "StopIteration", "exception", "if", "there", "is", "none", ")", ".", "Shortcut", "for", "getoutputfiles", "()" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1077-L1079
proycon/clam
clam/common/data.py
CLAMProvenanceData.xml
def xml(self, indent = ""): """Serialise provenance data to XML. This is included in CLAM Metadata files""" xml = indent + "<provenance type=\"clam\" id=\""+self.serviceid+"\" name=\"" +self.servicename+"\" url=\"" + self.serviceurl+"\" outputtemplate=\""+self.outputtemplate_id+"\" outputtemplatelabel=\...
python
def xml(self, indent = ""): """Serialise provenance data to XML. This is included in CLAM Metadata files""" xml = indent + "<provenance type=\"clam\" id=\""+self.serviceid+"\" name=\"" +self.servicename+"\" url=\"" + self.serviceurl+"\" outputtemplate=\""+self.outputtemplate_id+"\" outputtemplatelabel=\...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<provenance type=\\\"clam\\\" id=\\\"\"", "+", "self", ".", "serviceid", "+", "\"\\\" name=\\\"\"", "+", "self", ".", "servicename", "+", "\"\\\" url=\\\"\"", "+", "...
Serialise provenance data to XML. This is included in CLAM Metadata files
[ "Serialise", "provenance", "data", "to", "XML", ".", "This", "is", "included", "in", "CLAM", "Metadata", "files" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1123-L1140
proycon/clam
clam/common/data.py
CLAMProvenanceData.fromxml
def fromxml(node): """Return a CLAMProvenanceData instance from the given XML description. Node can be a string or an lxml.etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) if node.tag == 'provenance': #pyli...
python
def fromxml(node): """Return a CLAMProvenanceData instance from the given XML description. Node can be a string or an lxml.etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) if node.tag == 'provenance': #pyli...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "if", "node", ".", "tag", "==", "'provenance...
Return a CLAMProvenanceData instance from the given XML description. Node can be a string or an lxml.etree._Element.
[ "Return", "a", "CLAMProvenanceData", "instance", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "lxml", ".", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1143-L1174
proycon/clam
clam/common/data.py
CLAMMetaData.xml
def xml(self, indent = ""): """Render an XML representation of the metadata""" #(independent of web.py for support in CLAM API) if not indent: xml = '<?xml version="1.0" encoding="UTF-8"?>\n' else: xml = "" xml += indent + "<CLAMMetaData format=\"" + self.__class_...
python
def xml(self, indent = ""): """Render an XML representation of the metadata""" #(independent of web.py for support in CLAM API) if not indent: xml = '<?xml version="1.0" encoding="UTF-8"?>\n' else: xml = "" xml += indent + "<CLAMMetaData format=\"" + self.__class_...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "#(independent of web.py for support in CLAM API)", "if", "not", "indent", ":", "xml", "=", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n'", "else", ":", "xml", "=", "\"\"", "xml", "+=", "indent", ...
Render an XML representation of the metadata
[ "Render", "an", "XML", "representation", "of", "the", "metadata" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1283-L1305
proycon/clam
clam/common/data.py
CLAMMetaData.save
def save(self, filename): """Save metadata to XML file""" with io.open(filename,'w',encoding='utf-8') as f: f.write(self.xml())
python
def save(self, filename): """Save metadata to XML file""" with io.open(filename,'w',encoding='utf-8') as f: f.write(self.xml())
[ "def", "save", "(", "self", ",", "filename", ")", ":", "with", "io", ".", "open", "(", "filename", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "f", ".", "write", "(", "self", ".", "xml", "(", ")", ")" ]
Save metadata to XML file
[ "Save", "metadata", "to", "XML", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1307-L1310
proycon/clam
clam/common/data.py
CLAMMetaData.fromxml
def fromxml(node, file=None): """Read metadata from XML. Static method returning an CLAMMetaData instance (or rather; the appropriate subclass of CLAMMetaData) from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=pro...
python
def fromxml(node, file=None): """Read metadata from XML. Static method returning an CLAMMetaData instance (or rather; the appropriate subclass of CLAMMetaData) from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=pro...
[ "def", "fromxml", "(", "node", ",", "file", "=", "None", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "if", "node", "....
Read metadata from XML. Static method returning an CLAMMetaData instance (or rather; the appropriate subclass of CLAMMetaData) from the given XML description. Node can be a string or an etree._Element.
[ "Read", "metadata", "from", "XML", ".", "Static", "method", "returning", "an", "CLAMMetaData", "instance", "(", "or", "rather", ";", "the", "appropriate", "subclass", "of", "CLAMMetaData", ")", "from", "the", "given", "XML", "description", ".", "Node", "can", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1328-L1362
proycon/clam
clam/common/data.py
InputTemplate.xml
def xml(self, indent = ""): """Produce Template XML""" xml = indent + "<InputTemplate id=\""+self.id+"\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\"" if self.formatclass.mimetype: xml +=" mimetype=\""+self.formatclass.mimetype+"\"" if self.f...
python
def xml(self, indent = ""): """Produce Template XML""" xml = indent + "<InputTemplate id=\""+self.id+"\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\"" if self.formatclass.mimetype: xml +=" mimetype=\""+self.formatclass.mimetype+"\"" if self.f...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<InputTemplate id=\\\"\"", "+", "self", ".", "id", "+", "\"\\\" format=\\\"\"", "+", "self", ".", "formatclass", ".", "__name__", "+", "\"\\\"\"", "+", "\" label...
Produce Template XML
[ "Produce", "Template", "XML" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1440-L1473
proycon/clam
clam/common/data.py
InputTemplate.json
def json(self): """Produce a JSON representation for the web interface""" d = { 'id': self.id, 'format': self.formatclass.__name__,'label': self.label, 'mimetype': self.formatclass.mimetype, 'schema': self.formatclass.schema } if self.unique: d['unique'] = True if self.filen...
python
def json(self): """Produce a JSON representation for the web interface""" d = { 'id': self.id, 'format': self.formatclass.__name__,'label': self.label, 'mimetype': self.formatclass.mimetype, 'schema': self.formatclass.schema } if self.unique: d['unique'] = True if self.filen...
[ "def", "json", "(", "self", ")", ":", "d", "=", "{", "'id'", ":", "self", ".", "id", ",", "'format'", ":", "self", ".", "formatclass", ".", "__name__", ",", "'label'", ":", "self", ".", "label", ",", "'mimetype'", ":", "self", ".", "formatclass", "...
Produce a JSON representation for the web interface
[ "Produce", "a", "JSON", "representation", "for", "the", "web", "interface" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1524-L1545
proycon/clam
clam/common/data.py
InputTemplate.match
def match(self, metadata, user = None): """Does the specified metadata match this template? returns (success,metadata,parameters)""" assert isinstance(metadata, self.formatclass) return self.generate(metadata,user)
python
def match(self, metadata, user = None): """Does the specified metadata match this template? returns (success,metadata,parameters)""" assert isinstance(metadata, self.formatclass) return self.generate(metadata,user)
[ "def", "match", "(", "self", ",", "metadata", ",", "user", "=", "None", ")", ":", "assert", "isinstance", "(", "metadata", ",", "self", ".", "formatclass", ")", "return", "self", ".", "generate", "(", "metadata", ",", "user", ")" ]
Does the specified metadata match this template? returns (success,metadata,parameters)
[ "Does", "the", "specified", "metadata", "match", "this", "template?", "returns", "(", "success", "metadata", "parameters", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1553-L1556
proycon/clam
clam/common/data.py
InputTemplate.matchingfiles
def matchingfiles(self, projectpath): """Checks if the input conditions are satisfied, i.e the required input files are present. We use the symbolic links .*.INPUTTEMPLATE.id.seqnr to determine this. Returns a list of matching results (seqnr, filename, inputtemplate).""" results = [] if project...
python
def matchingfiles(self, projectpath): """Checks if the input conditions are satisfied, i.e the required input files are present. We use the symbolic links .*.INPUTTEMPLATE.id.seqnr to determine this. Returns a list of matching results (seqnr, filename, inputtemplate).""" results = [] if project...
[ "def", "matchingfiles", "(", "self", ",", "projectpath", ")", ":", "results", "=", "[", "]", "if", "projectpath", "[", "-", "1", "]", "==", "'/'", ":", "inputpath", "=", "projectpath", "+", "'input/'", "else", ":", "inputpath", "=", "projectpath", "+", ...
Checks if the input conditions are satisfied, i.e the required input files are present. We use the symbolic links .*.INPUTTEMPLATE.id.seqnr to determine this. Returns a list of matching results (seqnr, filename, inputtemplate).
[ "Checks", "if", "the", "input", "conditions", "are", "satisfied", "i", ".", "e", "the", "required", "input", "files", "are", "present", ".", "We", "use", "the", "symbolic", "links", ".", "*", ".", "INPUTTEMPLATE", ".", "id", ".", "seqnr", "to", "determin...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1558-L1574
proycon/clam
clam/common/data.py
InputTemplate.validate
def validate(self, postdata, user = None): """Validate posted data against the inputtemplate""" clam.common.util.printdebug("Validating inputtemplate " + self.id + "...") errors, parameters, _ = processparameters(postdata, self.parameters, user) return errors, parameters
python
def validate(self, postdata, user = None): """Validate posted data against the inputtemplate""" clam.common.util.printdebug("Validating inputtemplate " + self.id + "...") errors, parameters, _ = processparameters(postdata, self.parameters, user) return errors, parameters
[ "def", "validate", "(", "self", ",", "postdata", ",", "user", "=", "None", ")", ":", "clam", ".", "common", ".", "util", ".", "printdebug", "(", "\"Validating inputtemplate \"", "+", "self", ".", "id", "+", "\"...\"", ")", "errors", ",", "parameters", ",...
Validate posted data against the inputtemplate
[ "Validate", "posted", "data", "against", "the", "inputtemplate" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1578-L1582
proycon/clam
clam/common/data.py
InputTemplate.generate
def generate(self, file, validatedata = None, inputdata=None, user = None): """Convert the template into instantiated metadata, validating the data in the process and returning errors otherwise. inputdata is a dictionary-compatible structure, such as the relevant postdata. Return (success, metadata, parameters...
python
def generate(self, file, validatedata = None, inputdata=None, user = None): """Convert the template into instantiated metadata, validating the data in the process and returning errors otherwise. inputdata is a dictionary-compatible structure, such as the relevant postdata. Return (success, metadata, parameters...
[ "def", "generate", "(", "self", ",", "file", ",", "validatedata", "=", "None", ",", "inputdata", "=", "None", ",", "user", "=", "None", ")", ":", "metadata", "=", "{", "}", "if", "not", "validatedata", ":", "assert", "inputdata", "errors", ",", "parame...
Convert the template into instantiated metadata, validating the data in the process and returning errors otherwise. inputdata is a dictionary-compatible structure, such as the relevant postdata. Return (success, metadata, parameters), error messages can be extracted from parameters[].error. Validatedata is a (errors,pa...
[ "Convert", "the", "template", "into", "instantiated", "metadata", "validating", "the", "data", "in", "the", "process", "and", "returning", "errors", "otherwise", ".", "inputdata", "is", "a", "dictionary", "-", "compatible", "structure", "such", "as", "the", "rel...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1587-L1615
proycon/clam
clam/common/data.py
AbstractMetaField.xml
def xml(self, operator='set', indent = ""): """Serialize the metadata field to XML""" xml = indent + "<meta id=\"" + self.key + "\"" if operator != 'set': xml += " operator=\"" + operator + "\"" if not self.value: xml += " />" else: xml += ">" ...
python
def xml(self, operator='set', indent = ""): """Serialize the metadata field to XML""" xml = indent + "<meta id=\"" + self.key + "\"" if operator != 'set': xml += " operator=\"" + operator + "\"" if not self.value: xml += " />" else: xml += ">" ...
[ "def", "xml", "(", "self", ",", "operator", "=", "'set'", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<meta id=\\\"\"", "+", "self", ".", "key", "+", "\"\\\"\"", "if", "operator", "!=", "'set'", ":", "xml", "+=", "\" operator=\\...
Serialize the metadata field to XML
[ "Serialize", "the", "metadata", "field", "to", "XML" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1625-L1634
proycon/clam
clam/common/data.py
AbstractMetaField.fromxml
def fromxml(node): """Static method returning an MetaField instance (any subclass of AbstractMetaField) from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) ...
python
def fromxml(node): """Static method returning an MetaField instance (any subclass of AbstractMetaField) from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) ...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "if", "node", ".", "tag", ".", "lower", "(...
Static method returning an MetaField instance (any subclass of AbstractMetaField) from the given XML description. Node can be a string or an etree._Element.
[ "Static", "method", "returning", "an", "MetaField", "instance", "(", "any", "subclass", "of", "AbstractMetaField", ")", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1637-L1660
proycon/clam
clam/common/data.py
OutputTemplate.xml
def xml(self, indent = ""): """Produce Template XML""" xml = indent + "<OutputTemplate id=\"" + self.id + "\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\"" if self.formatclass.mimetype: xml +=" mimetype=\""+self.formatclass.mimetype+"\"" if s...
python
def xml(self, indent = ""): """Produce Template XML""" xml = indent + "<OutputTemplate id=\"" + self.id + "\" format=\"" + self.formatclass.__name__ + "\"" + " label=\"" + self.label + "\"" if self.formatclass.mimetype: xml +=" mimetype=\""+self.formatclass.mimetype+"\"" if s...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<OutputTemplate id=\\\"\"", "+", "self", ".", "id", "+", "\"\\\" format=\\\"\"", "+", "self", ".", "formatclass", ".", "__name__", "+", "\"\\\"\"", "+", "\" labe...
Produce Template XML
[ "Produce", "Template", "XML" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1800-L1822
proycon/clam
clam/common/data.py
OutputTemplate.fromxml
def fromxml(node): """Static method return an OutputTemplate instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower() == '...
python
def fromxml(node): """Static method return an OutputTemplate instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower() == '...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "assert", "node", ".", "tag", ".", "lower", ...
Static method return an OutputTemplate instance from the given XML description. Node can be a string or an etree._Element.
[ "Static", "method", "return", "an", "OutputTemplate", "instance", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1825-L1867
proycon/clam
clam/common/data.py
OutputTemplate.findparent
def findparent(self, inputtemplates): """Find the most suitable parent, that is: the first matching unique/multi inputtemplate""" for inputtemplate in inputtemplates: if self.unique == inputtemplate.unique: return inputtemplate.id return None
python
def findparent(self, inputtemplates): """Find the most suitable parent, that is: the first matching unique/multi inputtemplate""" for inputtemplate in inputtemplates: if self.unique == inputtemplate.unique: return inputtemplate.id return None
[ "def", "findparent", "(", "self", ",", "inputtemplates", ")", ":", "for", "inputtemplate", "in", "inputtemplates", ":", "if", "self", ".", "unique", "==", "inputtemplate", ".", "unique", ":", "return", "inputtemplate", ".", "id", "return", "None" ]
Find the most suitable parent, that is: the first matching unique/multi inputtemplate
[ "Find", "the", "most", "suitable", "parent", "that", "is", ":", "the", "first", "matching", "unique", "/", "multi", "inputtemplate" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1874-L1879
proycon/clam
clam/common/data.py
OutputTemplate.getparent
def getparent(self, profile): """Resolve a parent ID""" assert self.parent for inputtemplate in profile.input: if inputtemplate == self.parent: return inputtemplate raise Exception("Parent InputTemplate '"+self.parent+"' not found!")
python
def getparent(self, profile): """Resolve a parent ID""" assert self.parent for inputtemplate in profile.input: if inputtemplate == self.parent: return inputtemplate raise Exception("Parent InputTemplate '"+self.parent+"' not found!")
[ "def", "getparent", "(", "self", ",", "profile", ")", ":", "assert", "self", ".", "parent", "for", "inputtemplate", "in", "profile", ".", "input", ":", "if", "inputtemplate", "==", "self", ".", "parent", ":", "return", "inputtemplate", "raise", "Exception", ...
Resolve a parent ID
[ "Resolve", "a", "parent", "ID" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1881-L1887
proycon/clam
clam/common/data.py
OutputTemplate.generate
def generate(self, profile, parameters, projectpath, inputfiles, provenancedata=None): """Yields (inputtemplate, inputfilename, outputfilename, metadata) tuples""" project = os.path.basename(projectpath) if self.parent: #pylint: disable=too-many-nested-blocks #We have a parent, inf...
python
def generate(self, profile, parameters, projectpath, inputfiles, provenancedata=None): """Yields (inputtemplate, inputfilename, outputfilename, metadata) tuples""" project = os.path.basename(projectpath) if self.parent: #pylint: disable=too-many-nested-blocks #We have a parent, inf...
[ "def", "generate", "(", "self", ",", "profile", ",", "parameters", ",", "projectpath", ",", "inputfiles", ",", "provenancedata", "=", "None", ")", ":", "project", "=", "os", ".", "path", ".", "basename", "(", "projectpath", ")", "if", "self", ".", "paren...
Yields (inputtemplate, inputfilename, outputfilename, metadata) tuples
[ "Yields", "(", "inputtemplate", "inputfilename", "outputfilename", "metadata", ")", "tuples" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1889-L1963
proycon/clam
clam/common/data.py
OutputTemplate.generatemetadata
def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None): """Generate metadata, given a filename, parameters and a dictionary of inputdata (necessary in case we copy from it)""" assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None d...
python
def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None): """Generate metadata, given a filename, parameters and a dictionary of inputdata (necessary in case we copy from it)""" assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None d...
[ "def", "generatemetadata", "(", "self", ",", "parameters", ",", "parentfile", ",", "relevantinputfiles", ",", "provenancedata", "=", "None", ")", ":", "assert", "isinstance", "(", "provenancedata", ",", "CLAMProvenanceData", ")", "or", "provenancedata", "is", "Non...
Generate metadata, given a filename, parameters and a dictionary of inputdata (necessary in case we copy from it)
[ "Generate", "metadata", "given", "a", "filename", "parameters", "and", "a", "dictionary", "of", "inputdata", "(", "necessary", "in", "case", "we", "copy", "from", "it", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L1966-L1988
proycon/clam
clam/common/data.py
ParameterCondition.allpossibilities
def allpossibilities(self): """Returns all possible outputtemplates that may occur (recusrively applied)""" l = [] if isinstance(self.then, ParameterCondition): #recursive parametercondition l += self.then.allpossibilities() elif self.then: l.append(se...
python
def allpossibilities(self): """Returns all possible outputtemplates that may occur (recusrively applied)""" l = [] if isinstance(self.then, ParameterCondition): #recursive parametercondition l += self.then.allpossibilities() elif self.then: l.append(se...
[ "def", "allpossibilities", "(", "self", ")", ":", "l", "=", "[", "]", "if", "isinstance", "(", "self", ".", "then", ",", "ParameterCondition", ")", ":", "#recursive parametercondition", "l", "+=", "self", ".", "then", ".", "allpossibilities", "(", ")", "el...
Returns all possible outputtemplates that may occur (recusrively applied)
[ "Returns", "all", "possible", "outputtemplates", "that", "may", "occur", "(", "recusrively", "applied", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L2064-L2077
proycon/clam
clam/common/data.py
ParameterCondition.evaluate
def evaluate(self, parameters): """Returns False if there's no match, or whatever the ParameterCondition evaluates to (recursively applied!)""" if self.match(parameters): if isinstance(self.then, ParameterCondition): #recursive parametercondition return self.t...
python
def evaluate(self, parameters): """Returns False if there's no match, or whatever the ParameterCondition evaluates to (recursively applied!)""" if self.match(parameters): if isinstance(self.then, ParameterCondition): #recursive parametercondition return self.t...
[ "def", "evaluate", "(", "self", ",", "parameters", ")", ":", "if", "self", ".", "match", "(", "parameters", ")", ":", "if", "isinstance", "(", "self", ".", "then", ",", "ParameterCondition", ")", ":", "#recursive parametercondition", "return", "self", ".", ...
Returns False if there's no match, or whatever the ParameterCondition evaluates to (recursively applied!)
[ "Returns", "False", "if", "there", "s", "no", "match", "or", "whatever", "the", "ParameterCondition", "evaluates", "to", "(", "recursively", "applied!", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L2079-L2093
proycon/clam
clam/common/data.py
ParameterCondition.fromxml
def fromxml(node): """Static method returning a ParameterCondition instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower(...
python
def fromxml(node): """Static method returning a ParameterCondition instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower(...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "assert", "node", ".", "tag", ".", "lower", ...
Static method returning a ParameterCondition instance from the given XML description. Node can be a string or an etree._Element.
[ "Static", "method", "returning", "a", "ParameterCondition", "instance", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L2110-L2140
proycon/clam
clam/common/data.py
Action.fromxml
def fromxml(node): """Static method returning an Action instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower() == 'actio...
python
def fromxml(node): """Static method returning an Action instance from the given XML description. Node can be a string or an etree._Element.""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = parsexmlstring(node) assert node.tag.lower() == 'actio...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "parsexmlstring", "(", "node", ")", "assert", "node", ".", "tag", ".", "lower", ...
Static method returning an Action instance from the given XML description. Node can be a string or an etree._Element.
[ "Static", "method", "returning", "an", "Action", "instance", "from", "the", "given", "XML", "description", ".", "Node", "can", "be", "a", "string", "or", "an", "etree", ".", "_Element", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/data.py#L2294-L2324
proycon/clam
clam/wrappers/textstats.py
crude_tokenizer
def crude_tokenizer(line): """This is a very crude tokenizer from pynlpl""" tokens = [] buffer = '' for c in line.strip(): if c == ' ' or c in string.punctuation: if buffer: tokens.append(buffer) buffer = '' else: buffer += c if...
python
def crude_tokenizer(line): """This is a very crude tokenizer from pynlpl""" tokens = [] buffer = '' for c in line.strip(): if c == ' ' or c in string.punctuation: if buffer: tokens.append(buffer) buffer = '' else: buffer += c if...
[ "def", "crude_tokenizer", "(", "line", ")", ":", "tokens", "=", "[", "]", "buffer", "=", "''", "for", "c", "in", "line", ".", "strip", "(", ")", ":", "if", "c", "==", "' '", "or", "c", "in", "string", ".", "punctuation", ":", "if", "buffer", ":",...
This is a very crude tokenizer from pynlpl
[ "This", "is", "a", "very", "crude", "tokenizer", "from", "pynlpl" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/wrappers/textstats.py#L43-L55
proycon/clam
clam/wrappers/textstats.py
dicttotext
def dicttotext(d, sort=False, max = 0): """Function for converting dictionary to plaintext output, optionally with some (reverse) sorting""" if sort: f = lambda x: sorted(x, key=lambda y: -1 * y[1]) else: f = lambda x: x output = "" for i, (key, value) in enumerate(f(d.items())): ...
python
def dicttotext(d, sort=False, max = 0): """Function for converting dictionary to plaintext output, optionally with some (reverse) sorting""" if sort: f = lambda x: sorted(x, key=lambda y: -1 * y[1]) else: f = lambda x: x output = "" for i, (key, value) in enumerate(f(d.items())): ...
[ "def", "dicttotext", "(", "d", ",", "sort", "=", "False", ",", "max", "=", "0", ")", ":", "if", "sort", ":", "f", "=", "lambda", "x", ":", "sorted", "(", "x", ",", "key", "=", "lambda", "y", ":", "-", "1", "*", "y", "[", "1", "]", ")", "e...
Function for converting dictionary to plaintext output, optionally with some (reverse) sorting
[ "Function", "for", "converting", "dictionary", "to", "plaintext", "output", "optionally", "with", "some", "(", "reverse", ")", "sorting" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/wrappers/textstats.py#L105-L117
proycon/clam
clam/common/client.py
CLAMClient.initauth
def initauth(self): """Initialise authentication, for internal use""" headers = {'User-agent': 'CLAMClientAPI-' + clam.common.data.VERSION} if self.oauth: if not self.oauth_access_token: r = requests.get(self.url,headers=headers, verify=self.verify) if...
python
def initauth(self): """Initialise authentication, for internal use""" headers = {'User-agent': 'CLAMClientAPI-' + clam.common.data.VERSION} if self.oauth: if not self.oauth_access_token: r = requests.get(self.url,headers=headers, verify=self.verify) if...
[ "def", "initauth", "(", "self", ")", ":", "headers", "=", "{", "'User-agent'", ":", "'CLAMClientAPI-'", "+", "clam", ".", "common", ".", "data", ".", "VERSION", "}", "if", "self", ".", "oauth", ":", "if", "not", "self", ".", "oauth_access_token", ":", ...
Initialise authentication, for internal use
[ "Initialise", "authentication", "for", "internal", "use" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L91-L112
proycon/clam
clam/common/client.py
CLAMClient.request
def request(self, url='', method = 'GET', data = None, parse=True, encoding=None): """Issue a HTTP request and parse CLAM XML response, this is a low-level function called by all of the higher-level communication methods in this class, use those instead""" requestparams = self.initrequest(data) ...
python
def request(self, url='', method = 'GET', data = None, parse=True, encoding=None): """Issue a HTTP request and parse CLAM XML response, this is a low-level function called by all of the higher-level communication methods in this class, use those instead""" requestparams = self.initrequest(data) ...
[ "def", "request", "(", "self", ",", "url", "=", "''", ",", "method", "=", "'GET'", ",", "data", "=", "None", ",", "parse", "=", "True", ",", "encoding", "=", "None", ")", ":", "requestparams", "=", "self", ".", "initrequest", "(", "data", ")", "if"...
Issue a HTTP request and parse CLAM XML response, this is a low-level function called by all of the higher-level communication methods in this class, use those instead
[ "Issue", "a", "HTTP", "request", "and", "parse", "CLAM", "XML", "response", "this", "is", "a", "low", "-", "level", "function", "called", "by", "all", "of", "the", "higher", "-", "level", "communication", "methods", "in", "this", "class", "use", "those", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L132-L188
proycon/clam
clam/common/client.py
CLAMClient._parse
def _parse(self, content): """Parses CLAM XML data and returns a ``CLAMData`` object. For internal use. Raises `ParameterError` exception on parameter errors.""" if content.find('<clam') != -1: data = clam.common.data.CLAMData(content,self, loadmetadata=self.loadmetadata) if data...
python
def _parse(self, content): """Parses CLAM XML data and returns a ``CLAMData`` object. For internal use. Raises `ParameterError` exception on parameter errors.""" if content.find('<clam') != -1: data = clam.common.data.CLAMData(content,self, loadmetadata=self.loadmetadata) if data...
[ "def", "_parse", "(", "self", ",", "content", ")", ":", "if", "content", ".", "find", "(", "'<clam'", ")", "!=", "-", "1", ":", "data", "=", "clam", ".", "common", ".", "data", ".", "CLAMData", "(", "content", ",", "self", ",", "loadmetadata", "=",...
Parses CLAM XML data and returns a ``CLAMData`` object. For internal use. Raises `ParameterError` exception on parameter errors.
[ "Parses", "CLAM", "XML", "data", "and", "returns", "a", "CLAMData", "object", ".", "For", "internal", "use", ".", "Raises", "ParameterError", "exception", "on", "parameter", "errors", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L191-L201
proycon/clam
clam/common/client.py
CLAMClient.get
def get(self, project): """Query the project status. Returns a ``CLAMData`` instance or raises an exception according to the returned HTTP Status code""" try: data = self.request(project + '/') except: raise if not isinstance(data, clam.common.data.CLAMData): ...
python
def get(self, project): """Query the project status. Returns a ``CLAMData`` instance or raises an exception according to the returned HTTP Status code""" try: data = self.request(project + '/') except: raise if not isinstance(data, clam.common.data.CLAMData): ...
[ "def", "get", "(", "self", ",", "project", ")", ":", "try", ":", "data", "=", "self", ".", "request", "(", "project", "+", "'/'", ")", "except", ":", "raise", "if", "not", "isinstance", "(", "data", ",", "clam", ".", "common", ".", "data", ".", "...
Query the project status. Returns a ``CLAMData`` instance or raises an exception according to the returned HTTP Status code
[ "Query", "the", "project", "status", ".", "Returns", "a", "CLAMData", "instance", "or", "raises", "an", "exception", "according", "to", "the", "returned", "HTTP", "Status", "code" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L207-L216
proycon/clam
clam/common/client.py
CLAMClient.action
def action(self, action_id, **kwargs): """Query an action, specify the parameters for the action as keyword parameters. An optional keyword parameter method='GET' (default) or method='POST' can be set. The character set encoding of the response can be configured using the encoding keyword parameter (defaults to...
python
def action(self, action_id, **kwargs): """Query an action, specify the parameters for the action as keyword parameters. An optional keyword parameter method='GET' (default) or method='POST' can be set. The character set encoding of the response can be configured using the encoding keyword parameter (defaults to...
[ "def", "action", "(", "self", ",", "action_id", ",", "*", "*", "kwargs", ")", ":", "if", "'method'", "in", "kwargs", ":", "method", "=", "kwargs", "[", "'method'", "]", "del", "kwargs", "[", "'method'", "]", "else", ":", "method", "=", "'GET'", "if",...
Query an action, specify the parameters for the action as keyword parameters. An optional keyword parameter method='GET' (default) or method='POST' can be set. The character set encoding of the response can be configured using the encoding keyword parameter (defaults to utf-8 by default)
[ "Query", "an", "action", "specify", "the", "parameters", "for", "the", "action", "as", "keyword", "parameters", ".", "An", "optional", "keyword", "parameter", "method", "=", "GET", "(", "default", ")", "or", "method", "=", "POST", "can", "be", "set", ".", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L228-L242
proycon/clam
clam/common/client.py
CLAMClient.start
def start(self, project, **parameters): """Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. Note that no exceptions are raised on parameter errors, you have to check for those manual...
python
def start(self, project, **parameters): """Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. Note that no exceptions are raised on parameter errors, you have to check for those manual...
[ "def", "start", "(", "self", ",", "project", ",", "*", "*", "parameters", ")", ":", "#auth = None", "#if 'auth' in parameters:", "# auth = parameters['auth']", "# del parameters['auth']", "for", "key", "in", "parameters", ":", "if", "isinstance", "(", "parameter...
Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. Note that no exceptions are raised on parameter errors, you have to check for those manually! (Use startsafe instead if want Exceptions on pa...
[ "Start", "a", "run", ".", "project", "is", "the", "ID", "of", "the", "project", "and", "parameters", "are", "keyword", "arguments", "for", "the", "global", "parameters", ".", "Returns", "a", "CLAMData", "object", "or", "raises", "exceptions", ".", "Note", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L246-L261
proycon/clam
clam/common/client.py
CLAMClient.startsafe
def startsafe(self, project, **parameters): """Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. This version, unlike ``start()``, raises Exceptions (``ParameterError``) on parameter ...
python
def startsafe(self, project, **parameters): """Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. This version, unlike ``start()``, raises Exceptions (``ParameterError``) on parameter ...
[ "def", "startsafe", "(", "self", ",", "project", ",", "*", "*", "parameters", ")", ":", "try", ":", "data", "=", "self", ".", "start", "(", "project", ",", "*", "*", "parameters", ")", "for", "parametergroup", ",", "paramlist", "in", "data", ".", "pa...
Start a run. ``project`` is the ID of the project, and ``parameters`` are keyword arguments for the global parameters. Returns a ``CLAMData`` object or raises exceptions. This version, unlike ``start()``, raises Exceptions (``ParameterError``) on parameter errors. response = client.startsafe("mypro...
[ "Start", "a", "run", ".", "project", "is", "the", "ID", "of", "the", "project", "and", "parameters", "are", "keyword", "arguments", "for", "the", "global", "parameters", ".", "Returns", "a", "CLAMData", "object", "or", "raises", "exceptions", ".", "This", ...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L263-L279
proycon/clam
clam/common/client.py
CLAMClient.downloadarchive
def downloadarchive(self, project, targetfile, archiveformat = 'zip'): """Download all output files as a single archive: * *targetfile* - path for the new local file to be written * *archiveformat* - the format of the archive, can be 'zip','gz','bz2' Example:: client.downl...
python
def downloadarchive(self, project, targetfile, archiveformat = 'zip'): """Download all output files as a single archive: * *targetfile* - path for the new local file to be written * *archiveformat* - the format of the archive, can be 'zip','gz','bz2' Example:: client.downl...
[ "def", "downloadarchive", "(", "self", ",", "project", ",", "targetfile", ",", "archiveformat", "=", "'zip'", ")", ":", "if", "isinstance", "(", "targetfile", ",", "str", ")", "or", "(", "sys", ".", "version", "<", "'3'", "and", "isinstance", "(", "targe...
Download all output files as a single archive: * *targetfile* - path for the new local file to be written * *archiveformat* - the format of the archive, can be 'zip','gz','bz2' Example:: client.downloadarchive("myproject","allresults.zip","zip")
[ "Download", "all", "output", "files", "as", "a", "single", "archive", ":" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L297-L316
proycon/clam
clam/common/client.py
CLAMClient.getinputfilename
def getinputfilename(self, inputtemplate, filename): """Determine the final filename for an input file given an inputtemplate and a given filename. Example:: filenameonserver = client.getinputfilename("someinputtemplate","/path/to/local/file") """ if inputtemplate.filename...
python
def getinputfilename(self, inputtemplate, filename): """Determine the final filename for an input file given an inputtemplate and a given filename. Example:: filenameonserver = client.getinputfilename("someinputtemplate","/path/to/local/file") """ if inputtemplate.filename...
[ "def", "getinputfilename", "(", "self", ",", "inputtemplate", ",", "filename", ")", ":", "if", "inputtemplate", ".", "filename", ":", "filename", "=", "inputtemplate", ".", "filename", "elif", "inputtemplate", ".", "extension", ":", "if", "filename", ".", "low...
Determine the final filename for an input file given an inputtemplate and a given filename. Example:: filenameonserver = client.getinputfilename("someinputtemplate","/path/to/local/file")
[ "Determine", "the", "final", "filename", "for", "an", "input", "file", "given", "an", "inputtemplate", "and", "a", "given", "filename", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L318-L336
proycon/clam
clam/common/client.py
CLAMClient._parseupload
def _parseupload(self, node): """Parse CLAM Upload XML Responses. For internal use""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access try: node = clam.common.data.parsexmlstring(node) except: raise Exception(node) ...
python
def _parseupload(self, node): """Parse CLAM Upload XML Responses. For internal use""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access try: node = clam.common.data.parsexmlstring(node) except: raise Exception(node) ...
[ "def", "_parseupload", "(", "self", ",", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "try", ":", "node", "=", "clam", ".", "common", ".", "data", ".", "parsex...
Parse CLAM Upload XML Responses. For internal use
[ "Parse", "CLAM", "Upload", "XML", "Responses", ".", "For", "internal", "use" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L338-L360
proycon/clam
clam/common/client.py
CLAMClient.addinputfile
def addinputfile(self, project, inputtemplate, sourcefile, **kwargs): """Add/upload an input file to the CLAM service. Supports proper file upload streaming. project - the ID of the project you want to add the file to. inputtemplate - The input template you want to use to add this file (InputTe...
python
def addinputfile(self, project, inputtemplate, sourcefile, **kwargs): """Add/upload an input file to the CLAM service. Supports proper file upload streaming. project - the ID of the project you want to add the file to. inputtemplate - The input template you want to use to add this file (InputTe...
[ "def", "addinputfile", "(", "self", ",", "project", ",", "inputtemplate", ",", "sourcefile", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "inputtemplate", ",", "str", ")", "or", "(", "sys", ".", "version", "<", "'3'", "and", "isinstance", ...
Add/upload an input file to the CLAM service. Supports proper file upload streaming. project - the ID of the project you want to add the file to. inputtemplate - The input template you want to use to add this file (InputTemplate instance) sourcefile - The file you want to add: string containing...
[ "Add", "/", "upload", "an", "input", "file", "to", "the", "CLAM", "service", ".", "Supports", "proper", "file", "upload", "streaming", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L363-L450
proycon/clam
clam/common/client.py
CLAMClient.addinput
def addinput(self, project, inputtemplate, contents, **kwargs): """Add an input file to the CLAM service. Explictly providing the contents as a string. This is not suitable for large files as the contents are kept in memory! Use ``addinputfile()`` instead for large files. project - the ID of the projec...
python
def addinput(self, project, inputtemplate, contents, **kwargs): """Add an input file to the CLAM service. Explictly providing the contents as a string. This is not suitable for large files as the contents are kept in memory! Use ``addinputfile()`` instead for large files. project - the ID of the projec...
[ "def", "addinput", "(", "self", ",", "project", ",", "inputtemplate", ",", "contents", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "inputtemplate", ",", "str", ")", "or", "(", "sys", ".", "version", "<", "'3'", "and", "isinstance", "(",...
Add an input file to the CLAM service. Explictly providing the contents as a string. This is not suitable for large files as the contents are kept in memory! Use ``addinputfile()`` instead for large files. project - the ID of the project you want to add the file to. inputtemplate - The input template y...
[ "Add", "an", "input", "file", "to", "the", "CLAM", "service", ".", "Explictly", "providing", "the", "contents", "as", "a", "string", ".", "This", "is", "not", "suitable", "for", "large", "files", "as", "the", "contents", "are", "kept", "in", "memory!", "...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L454-L526
proycon/clam
clam/common/client.py
CLAMClient.upload
def upload(self,project, inputtemplate, sourcefile, **kwargs): """Alias for ``addinputfile()``""" return self.addinputfile(project, inputtemplate,sourcefile, **kwargs)
python
def upload(self,project, inputtemplate, sourcefile, **kwargs): """Alias for ``addinputfile()``""" return self.addinputfile(project, inputtemplate,sourcefile, **kwargs)
[ "def", "upload", "(", "self", ",", "project", ",", "inputtemplate", ",", "sourcefile", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "addinputfile", "(", "project", ",", "inputtemplate", ",", "sourcefile", ",", "*", "*", "kwargs", ")" ]
Alias for ``addinputfile()``
[ "Alias", "for", "addinputfile", "()" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L530-L532
proycon/clam
clam/common/client.py
CLAMClient.download
def download(self, project, filename, targetfilename, loadmetadata=None): """Download an output file""" if loadmetadata is None: loadmetadata = self.loadmetadata f = clam.common.data.CLAMOutputFile(self.url + project, filename, loadmetadata, self) f.copy(targetfilename)
python
def download(self, project, filename, targetfilename, loadmetadata=None): """Download an output file""" if loadmetadata is None: loadmetadata = self.loadmetadata f = clam.common.data.CLAMOutputFile(self.url + project, filename, loadmetadata, self) f.copy(targetfilename)
[ "def", "download", "(", "self", ",", "project", ",", "filename", ",", "targetfilename", ",", "loadmetadata", "=", "None", ")", ":", "if", "loadmetadata", "is", "None", ":", "loadmetadata", "=", "self", ".", "loadmetadata", "f", "=", "clam", ".", "common", ...
Download an output file
[ "Download", "an", "output", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/client.py#L534-L538
proycon/clam
clam/common/parameters.py
AbstractParameter.validate
def validate(self,value): """Validate the parameter""" if self.validator is not None: try: valid = self.validator(value) except Exception as e: import pdb; pdb.set_trace() if isinstance(valid, tuple) and len(valid) == 2: ...
python
def validate(self,value): """Validate the parameter""" if self.validator is not None: try: valid = self.validator(value) except Exception as e: import pdb; pdb.set_trace() if isinstance(valid, tuple) and len(valid) == 2: ...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "if", "self", ".", "validator", "is", "not", "None", ":", "try", ":", "valid", "=", "self", ".", "validator", "(", "value", ")", "except", "Exception", "as", "e", ":", "import", "pdb", "pdb", ...
Validate the parameter
[ "Validate", "the", "parameter" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L96-L116
proycon/clam
clam/common/parameters.py
AbstractParameter.compilearg
def compilearg(self): """This method compiles the parameter into syntax that can be used on the shell, such as for example: --paramflag=value""" if self.paramflag and self.paramflag[-1] == '=' or self.nospace: sep = '' elif self.paramflag: sep = ' ' else: ...
python
def compilearg(self): """This method compiles the parameter into syntax that can be used on the shell, such as for example: --paramflag=value""" if self.paramflag and self.paramflag[-1] == '=' or self.nospace: sep = '' elif self.paramflag: sep = ' ' else: ...
[ "def", "compilearg", "(", "self", ")", ":", "if", "self", ".", "paramflag", "and", "self", ".", "paramflag", "[", "-", "1", "]", "==", "'='", "or", "self", ".", "nospace", ":", "sep", "=", "''", "elif", "self", ".", "paramflag", ":", "sep", "=", ...
This method compiles the parameter into syntax that can be used on the shell, such as for example: --paramflag=value
[ "This", "method", "compiles", "the", "parameter", "into", "syntax", "that", "can", "be", "used", "on", "the", "shell", "such", "as", "for", "example", ":", "--", "paramflag", "=", "value" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L118-L126
proycon/clam
clam/common/parameters.py
AbstractParameter.xml
def xml(self, indent = ""): """This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors""" xml = indent + "<" + self.__class__.__name__ xml += ' id="'+self.id + '"' xml += ' name="'+xmlescape(self.name) + '"' ...
python
def xml(self, indent = ""): """This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors""" xml = indent + "<" + self.__class__.__name__ xml += ' id="'+self.id + '"' xml += ' name="'+xmlescape(self.name) + '"' ...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<\"", "+", "self", ".", "__class__", ".", "__name__", "xml", "+=", "' id=\"'", "+", "self", ".", "id", "+", "'\"'", "xml", "+=", "' name=\"'", "+", "xmle...
This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors
[ "This", "methods", "renders", "an", "XML", "representation", "of", "this", "parameter", "along", "with", "its", "selected", "value", "and", "feedback", "on", "validation", "errors" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L128-L155
proycon/clam
clam/common/parameters.py
AbstractParameter.set
def set(self, value): """This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter""" if self.validate(value): #print "Parameter " + self.id + " ...
python
def set(self, value): """This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter""" if self.validate(value): #print "Parameter " + self.id + " ...
[ "def", "set", "(", "self", ",", "value", ")", ":", "if", "self", ".", "validate", "(", "value", ")", ":", "#print \"Parameter \" + self.id + \" successfully set to \" + repr(value)", "self", ".", "hasvalue", "=", "True", "self", ".", "value", "=", "value", "retu...
This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter
[ "This", "parameter", "method", "attempts", "to", "set", "a", "specific", "value", "for", "this", "parameter", ".", "The", "value", "will", "be", "validated", "first", "and", "if", "it", "can", "not", "be", "set", ".", "An", "error", "message", "will", "b...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L182-L191
proycon/clam
clam/common/parameters.py
AbstractParameter.access
def access(self, user): """This method checks if the given user has access to see/set this parameter, based on the denyusers and/or allowusers option.""" if self.denyusers: if user in self.denyusers: return False if self.allowusers: if not user in self.all...
python
def access(self, user): """This method checks if the given user has access to see/set this parameter, based on the denyusers and/or allowusers option.""" if self.denyusers: if user in self.denyusers: return False if self.allowusers: if not user in self.all...
[ "def", "access", "(", "self", ",", "user", ")", ":", "if", "self", ".", "denyusers", ":", "if", "user", "in", "self", ".", "denyusers", ":", "return", "False", "if", "self", ".", "allowusers", ":", "if", "not", "user", "in", "self", ".", "allowusers"...
This method checks if the given user has access to see/set this parameter, based on the denyusers and/or allowusers option.
[ "This", "method", "checks", "if", "the", "given", "user", "has", "access", "to", "see", "/", "set", "this", "parameter", "based", "on", "the", "denyusers", "and", "/", "or", "allowusers", "option", "." ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L201-L209
proycon/clam
clam/common/parameters.py
AbstractParameter.fromxml
def fromxml(node): """Create a Parameter instance (of any class derived from AbstractParameter!) given its XML description. Node can be a string containing XML or an lxml _Element""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = ElementTree.parse(Stri...
python
def fromxml(node): """Create a Parameter instance (of any class derived from AbstractParameter!) given its XML description. Node can be a string containing XML or an lxml _Element""" if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access node = ElementTree.parse(Stri...
[ "def", "fromxml", "(", "node", ")", ":", "if", "not", "isinstance", "(", "node", ",", "ElementTree", ".", "_Element", ")", ":", "#pylint: disable=protected-access", "node", "=", "ElementTree", ".", "parse", "(", "StringIO", "(", "node", ")", ")", ".", "get...
Create a Parameter instance (of any class derived from AbstractParameter!) given its XML description. Node can be a string containing XML or an lxml _Element
[ "Create", "a", "Parameter", "instance", "(", "of", "any", "class", "derived", "from", "AbstractParameter!", ")", "given", "its", "XML", "description", ".", "Node", "can", "be", "a", "string", "containing", "XML", "or", "an", "lxml", "_Element" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L212-L256
proycon/clam
clam/common/parameters.py
BooleanParameter.set
def set(self, value = True): """Set the boolean parameter""" value = value in (True,1) or ( (isinstance(value, str) or (sys.version < '3' and isinstance(value, unicode))) and (value.lower() in ("1","yes","true","enabled"))) #pylint: disable=undefined-variable return super(BooleanParameter,self)....
python
def set(self, value = True): """Set the boolean parameter""" value = value in (True,1) or ( (isinstance(value, str) or (sys.version < '3' and isinstance(value, unicode))) and (value.lower() in ("1","yes","true","enabled"))) #pylint: disable=undefined-variable return super(BooleanParameter,self)....
[ "def", "set", "(", "self", ",", "value", "=", "True", ")", ":", "value", "=", "value", "in", "(", "True", ",", "1", ")", "or", "(", "(", "isinstance", "(", "value", ",", "str", ")", "or", "(", "sys", ".", "version", "<", "'3'", "and", "isinstan...
Set the boolean parameter
[ "Set", "the", "boolean", "parameter" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L280-L283
proycon/clam
clam/common/parameters.py
BooleanParameter.valuefrompostdata
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set(). It typically returns the default None when something is left unset (but that de...
python
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set(). It typically returns the default None when something is left unset (but that de...
[ "def", "valuefrompostdata", "(", "self", ",", "postdata", ")", ":", "if", "self", ".", "id", "in", "postdata", ":", "if", "(", "(", "isinstance", "(", "postdata", "[", "self", ".", "id", "]", ",", "bool", ")", "and", "postdata", "[", "self", ".", "...
This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set(). It typically returns the default None when something is left unset (but that default can be overridden)
[ "This", "parameter", "method", "searches", "the", "POST", "data", "and", "retrieves", "the", "values", "it", "needs", ".", "It", "does", "not", "set", "the", "value", "yet", "though", "but", "simply", "returns", "it", ".", "Needs", "to", "be", "explicitly"...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L298-L306
proycon/clam
clam/common/parameters.py
ChoiceParameter.compilearg
def compilearg(self): """This method compiles the parameter into syntax that can be used on the shell, such as -paramflag=value""" if isinstance(self.value,list): value = self.delimiter.join(self.value) else: value = self.value if value.find(" ") >= 0: ...
python
def compilearg(self): """This method compiles the parameter into syntax that can be used on the shell, such as -paramflag=value""" if isinstance(self.value,list): value = self.delimiter.join(self.value) else: value = self.value if value.find(" ") >= 0: ...
[ "def", "compilearg", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "value", ",", "list", ")", ":", "value", "=", "self", ".", "delimiter", ".", "join", "(", "self", ".", "value", ")", "else", ":", "value", "=", "self", ".", "value", ...
This method compiles the parameter into syntax that can be used on the shell, such as -paramflag=value
[ "This", "method", "compiles", "the", "parameter", "into", "syntax", "that", "can", "be", "used", "on", "the", "shell", "such", "as", "-", "paramflag", "=", "value" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L438-L457
proycon/clam
clam/common/parameters.py
ChoiceParameter.xml
def xml(self, indent = ""): """This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors""" xml = indent + "<" + self.__class__.__name__ xml += ' id="'+self.id + '"' xml += ' name="'+xmlescape(self.name) + '"' ...
python
def xml(self, indent = ""): """This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors""" xml = indent + "<" + self.__class__.__name__ xml += ' id="'+self.id + '"' xml += ' name="'+xmlescape(self.name) + '"' ...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<\"", "+", "self", ".", "__class__", ".", "__name__", "xml", "+=", "' id=\"'", "+", "self", ".", "id", "+", "'\"'", "xml", "+=", "' name=\"'", "+", "xmle...
This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors
[ "This", "methods", "renders", "an", "XML", "representation", "of", "this", "parameter", "along", "with", "its", "selected", "value", "and", "feedback", "on", "validation", "errors" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L459-L487