repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
DLR-RM/RAFCON
source/rafcon/gui/clipboard.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/clipboard.py#L375-L450
def do_smart_selection_adaption(selection, parent_m): """ Reduce and extend transition and data flow element selection if already enclosed by selection The smart selection adaptation checks and ignores directly data flows and transitions which are selected without selected related origin or t...
[ "def", "do_smart_selection_adaption", "(", "selection", ",", "parent_m", ")", ":", "def", "get_ports_related_to_data_flow", "(", "data_flow", ")", ":", "from_port", "=", "data_flow", ".", "parent", ".", "get_data_port", "(", "data_flow", ".", "from_state", ",", "d...
Reduce and extend transition and data flow element selection if already enclosed by selection The smart selection adaptation checks and ignores directly data flows and transitions which are selected without selected related origin or targets elements. Additional the linkage (data flows and transition...
[ "Reduce", "and", "extend", "transition", "and", "data", "flow", "element", "selection", "if", "already", "enclosed", "by", "selection" ]
python
train
Naresh1318/crystal
crystal/app.py
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/app.py#L213-L226
def delete_project(): """ Delete the selected run from the database. :return: """ assert request.method == "POST", "POST request expected received {}".format(request.method) if request.method == "POST": try: selections = json.loads(request.form["selections"]) util...
[ "def", "delete_project", "(", ")", ":", "assert", "request", ".", "method", "==", "\"POST\"", ",", "\"POST request expected received {}\"", ".", "format", "(", "request", ".", "method", ")", "if", "request", ".", "method", "==", "\"POST\"", ":", "try", ":", ...
Delete the selected run from the database. :return:
[ "Delete", "the", "selected", "run", "from", "the", "database", ".", ":", "return", ":" ]
python
train
brechtm/rinohtype
src/rinoh/backend/pdf/xobject/purepng.py
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/backend/pdf/xobject/purepng.py#L443-L453
def popdict(src, keys): """ Extract all keys (with values) from `src` dictionary as new dictionary values are removed from source dictionary. """ new = {} for key in keys: if key in src: new[key] = src.pop(key) return new
[ "def", "popdict", "(", "src", ",", "keys", ")", ":", "new", "=", "{", "}", "for", "key", "in", "keys", ":", "if", "key", "in", "src", ":", "new", "[", "key", "]", "=", "src", ".", "pop", "(", "key", ")", "return", "new" ]
Extract all keys (with values) from `src` dictionary as new dictionary values are removed from source dictionary.
[ "Extract", "all", "keys", "(", "with", "values", ")", "from", "src", "dictionary", "as", "new", "dictionary" ]
python
train
Chilipp/docrep
docrep/__init__.py
https://github.com/Chilipp/docrep/blob/637971f76e1a6e1c70e36dcd1b02bbc37ba02487/docrep/__init__.py#L439-L465
def with_indents(self, s, indent=0, stacklevel=3): """ Substitute a string with the indented :attr:`params` Parameters ---------- s: str The string in which to substitute indent: int The number of spaces that the substitution should be indented ...
[ "def", "with_indents", "(", "self", ",", "s", ",", "indent", "=", "0", ",", "stacklevel", "=", "3", ")", ":", "# we make a new dictionary with objects that indent the original", "# strings if necessary. Note that the first line is not indented", "d", "=", "{", "key", ":",...
Substitute a string with the indented :attr:`params` Parameters ---------- s: str The string in which to substitute indent: int The number of spaces that the substitution should be indented stacklevel: int The stacklevel for the warning raised...
[ "Substitute", "a", "string", "with", "the", "indented", ":", "attr", ":", "params" ]
python
train
tjcsl/ion
intranet/apps/dashboard/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/dashboard/views.py#L340-L374
def paginate_announcements_list(request, context, items): """ ***TODO*** Migrate to django Paginator (see lostitems) """ # pagination if "start" in request.GET: try: start_num = int(request.GET.get("start")) except ValueError: start_num = 0 else: ...
[ "def", "paginate_announcements_list", "(", "request", ",", "context", ",", "items", ")", ":", "# pagination", "if", "\"start\"", "in", "request", ".", "GET", ":", "try", ":", "start_num", "=", "int", "(", "request", ".", "GET", ".", "get", "(", "\"start\""...
***TODO*** Migrate to django Paginator (see lostitems)
[ "***", "TODO", "***", "Migrate", "to", "django", "Paginator", "(", "see", "lostitems", ")" ]
python
train
bapakode/OmMongo
ommongo/fields/fields.py
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/fields/fields.py#L285-L294
def unwrap(self, value, session=None): ''' Validate and then unwrap ``value`` for object creation. :param value: list returned from the database. ''' self.validate_unwrap(value) ret = [] for field, value in izip(self.types, value): ret.append(field.unwrap...
[ "def", "unwrap", "(", "self", ",", "value", ",", "session", "=", "None", ")", ":", "self", ".", "validate_unwrap", "(", "value", ")", "ret", "=", "[", "]", "for", "field", ",", "value", "in", "izip", "(", "self", ".", "types", ",", "value", ")", ...
Validate and then unwrap ``value`` for object creation. :param value: list returned from the database.
[ "Validate", "and", "then", "unwrap", "value", "for", "object", "creation", "." ]
python
train
ibis-project/ibis
ibis/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/client.py#L226-L252
def explain(self, expr, params=None): """ Query for and return the query plan associated with the indicated expression or SQL query. Returns ------- plan : string """ if isinstance(expr, ir.Expr): context = self.dialect.make_context(params=par...
[ "def", "explain", "(", "self", ",", "expr", ",", "params", "=", "None", ")", ":", "if", "isinstance", "(", "expr", ",", "ir", ".", "Expr", ")", ":", "context", "=", "self", ".", "dialect", ".", "make_context", "(", "params", "=", "params", ")", "qu...
Query for and return the query plan associated with the indicated expression or SQL query. Returns ------- plan : string
[ "Query", "for", "and", "return", "the", "query", "plan", "associated", "with", "the", "indicated", "expression", "or", "SQL", "query", "." ]
python
train
inasafe/inasafe
safe/gis/tools.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L90-L130
def reclassify_value(one_value, ranges): """This function will return the classified value according to ranges. The algorithm will return None if the continuous value has not any class. :param one_value: The continuous value to classify. :type one_value: float :param ranges: Classes, following th...
[ "def", "reclassify_value", "(", "one_value", ",", "ranges", ")", ":", "if", "(", "one_value", "is", "None", "or", "(", "hasattr", "(", "one_value", ",", "'isNull'", ")", "and", "one_value", ".", "isNull", "(", ")", ")", ")", ":", "return", "None", "for...
This function will return the classified value according to ranges. The algorithm will return None if the continuous value has not any class. :param one_value: The continuous value to classify. :type one_value: float :param ranges: Classes, following the hazard classification definitions. :type r...
[ "This", "function", "will", "return", "the", "classified", "value", "according", "to", "ranges", "." ]
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/serializer/xml.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/xml.py#L193-L206
def serialize_operator_equal(self, op): """ Serializer for :meth:`SpiffWorkflow.operators.Equal`. Example:: <equals> <value>text</value> <value><attribute>foobar</attribute></value> <value><path>foobar</path></value> </equ...
[ "def", "serialize_operator_equal", "(", "self", ",", "op", ")", ":", "elem", "=", "etree", ".", "Element", "(", "'equals'", ")", "return", "self", ".", "serialize_value_list", "(", "elem", ",", "op", ".", "args", ")" ]
Serializer for :meth:`SpiffWorkflow.operators.Equal`. Example:: <equals> <value>text</value> <value><attribute>foobar</attribute></value> <value><path>foobar</path></value> </equals>
[ "Serializer", "for", ":", "meth", ":", "SpiffWorkflow", ".", "operators", ".", "Equal", "." ]
python
valid
klis87/django-cloudinary-storage
cloudinary_storage/management/commands/deleteorphanedmedia.py
https://github.com/klis87/django-cloudinary-storage/blob/b8cabd2ebbf67b9cfbbf4defee1a750fea5950a9/cloudinary_storage/management/commands/deleteorphanedmedia.py#L71-L82
def get_files_to_remove(self): """ Returns orphaned media files to be removed grouped by resource type. All files which paths start with any of exclude paths are ignored. """ files_to_remove = {} needful_files = self.get_needful_files() for resources_type, resourc...
[ "def", "get_files_to_remove", "(", "self", ")", ":", "files_to_remove", "=", "{", "}", "needful_files", "=", "self", ".", "get_needful_files", "(", ")", "for", "resources_type", ",", "resources", "in", "self", ".", "get_uploaded_resources", "(", ")", ":", "exc...
Returns orphaned media files to be removed grouped by resource type. All files which paths start with any of exclude paths are ignored.
[ "Returns", "orphaned", "media", "files", "to", "be", "removed", "grouped", "by", "resource", "type", ".", "All", "files", "which", "paths", "start", "with", "any", "of", "exclude", "paths", "are", "ignored", "." ]
python
train
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1532-L1568
def interactive_merge_conflict_handler(self, exception): """ Give the operator a chance to interactively resolve merge conflicts. :param exception: An :exc:`~executor.ExternalCommandFailed` object. :returns: :data:`True` if the operator has interactively resolved any m...
[ "def", "interactive_merge_conflict_handler", "(", "self", ",", "exception", ")", ":", "if", "connected_to_terminal", "(", "sys", ".", "stdin", ")", ":", "logger", ".", "info", "(", "compact", "(", "\"\"\"\n It seems that I'm connected to a terminal so I'll ...
Give the operator a chance to interactively resolve merge conflicts. :param exception: An :exc:`~executor.ExternalCommandFailed` object. :returns: :data:`True` if the operator has interactively resolved any merge conflicts (and as such the merge error doesn't need to ...
[ "Give", "the", "operator", "a", "chance", "to", "interactively", "resolve", "merge", "conflicts", "." ]
python
train
mattja/distob
distob/arrays.py
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L917-L923
def _valid_distaxis(shapes, ax): """`ax` is a valid candidate for a distributed axis if the given subarray shapes are all the same when ignoring axis `ax`""" compare_shapes = np.vstack(shapes) if ax < compare_shapes.shape[1]: compare_shapes[:, ax] = -1 return np.count...
[ "def", "_valid_distaxis", "(", "shapes", ",", "ax", ")", ":", "compare_shapes", "=", "np", ".", "vstack", "(", "shapes", ")", "if", "ax", "<", "compare_shapes", ".", "shape", "[", "1", "]", ":", "compare_shapes", "[", ":", ",", "ax", "]", "=", "-", ...
`ax` is a valid candidate for a distributed axis if the given subarray shapes are all the same when ignoring axis `ax`
[ "ax", "is", "a", "valid", "candidate", "for", "a", "distributed", "axis", "if", "the", "given", "subarray", "shapes", "are", "all", "the", "same", "when", "ignoring", "axis", "ax" ]
python
valid
saltstack/salt
salt/modules/cp.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L63-L89
def recv(files, dest): ''' Used with salt-cp, pass the files dict, and the destination. This function receives small fast copy files from the master via salt-cp. It does not work via the CLI. ''' ret = {} for path, data in six.iteritems(files): if os.path.basename(path) == os.path.b...
[ "def", "recv", "(", "files", ",", "dest", ")", ":", "ret", "=", "{", "}", "for", "path", ",", "data", "in", "six", ".", "iteritems", "(", "files", ")", ":", "if", "os", ".", "path", ".", "basename", "(", "path", ")", "==", "os", ".", "path", ...
Used with salt-cp, pass the files dict, and the destination. This function receives small fast copy files from the master via salt-cp. It does not work via the CLI.
[ "Used", "with", "salt", "-", "cp", "pass", "the", "files", "dict", "and", "the", "destination", "." ]
python
train
KelSolaar/Manager
manager/components_manager.py
https://github.com/KelSolaar/Manager/blob/39c8153fc021fc8a76e345a6e336ec2644f089d1/manager/components_manager.py#L1217-L1238
def list_components(self, dependency_order=True): """ Lists the Components by dependency resolving. Usage:: >>> manager = Manager(("./manager/tests/tests_manager/resources/components/core",)) >>> manager.register_components() True >>> manager.lis...
[ "def", "list_components", "(", "self", ",", "dependency_order", "=", "True", ")", ":", "if", "dependency_order", ":", "return", "list", "(", "itertools", ".", "chain", ".", "from_iterable", "(", "[", "sorted", "(", "list", "(", "batch", ")", ")", "for", ...
Lists the Components by dependency resolving. Usage:: >>> manager = Manager(("./manager/tests/tests_manager/resources/components/core",)) >>> manager.register_components() True >>> manager.list_components() [u'core.tests_component_a', u'core.tests_co...
[ "Lists", "the", "Components", "by", "dependency", "resolving", "." ]
python
train
SuperCowPowers/workbench
workbench/server/workbench_server.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/server/workbench_server.py#L659-L666
def _help_workers(self): """ Help on all the available workers """ help = 'Workbench Workers:' for worker in self.list_all_workers(): full_help = self.work_request('help_formatter', worker)['help_formatter']['help'] compact_help = full_help.split('\n')[:4] he...
[ "def", "_help_workers", "(", "self", ")", ":", "help", "=", "'Workbench Workers:'", "for", "worker", "in", "self", ".", "list_all_workers", "(", ")", ":", "full_help", "=", "self", ".", "work_request", "(", "'help_formatter'", ",", "worker", ")", "[", "'help...
Help on all the available workers
[ "Help", "on", "all", "the", "available", "workers" ]
python
train
xflr6/concepts
concepts/tools.py
https://github.com/xflr6/concepts/blob/2801b27b05fa02cccee7d549451810ffcbf5c942/concepts/tools.py#L101-L107
def issuperset(self, items): """Return whether this collection contains all items. >>> Unique(['spam', 'eggs']).issuperset(['spam', 'spam', 'spam']) True """ return all(_compat.map(self._seen.__contains__, items))
[ "def", "issuperset", "(", "self", ",", "items", ")", ":", "return", "all", "(", "_compat", ".", "map", "(", "self", ".", "_seen", ".", "__contains__", ",", "items", ")", ")" ]
Return whether this collection contains all items. >>> Unique(['spam', 'eggs']).issuperset(['spam', 'spam', 'spam']) True
[ "Return", "whether", "this", "collection", "contains", "all", "items", "." ]
python
train
SeattleTestbed/seash
seash_modules.py
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/seash_modules.py#L103-L162
def ensure_no_conflicts_in_commanddicts(originaldict, comparedict): """ <Purpose> Recursively compares two commanddicts to see if they have conflicting commands. <Arguments> originaldict: A commanddict to compare. comparedict: A commanddict to compare. <Side Effects> None <Excep...
[ "def", "ensure_no_conflicts_in_commanddicts", "(", "originaldict", ",", "comparedict", ")", ":", "\"\"\"\n Child nodes are identical if they all of the following are identical: \n helptext/callback/summary.\n \n There are 3 cases we have to worry about.\n > Shared child node.\n > Child ...
<Purpose> Recursively compares two commanddicts to see if they have conflicting commands. <Arguments> originaldict: A commanddict to compare. comparedict: A commanddict to compare. <Side Effects> None <Exceptions> ModuleConflictError - A command was conflicting. The er...
[ "<Purpose", ">", "Recursively", "compares", "two", "commanddicts", "to", "see", "if", "they", "have", "conflicting", "commands", ".", "<Arguments", ">", "originaldict", ":", "A", "commanddict", "to", "compare", ".", "comparedict", ":", "A", "commanddict", "to", ...
python
train
OnroerendErfgoed/language-tags
language_tags/tags.py
https://github.com/OnroerendErfgoed/language-tags/blob/acb91e5458d22617f344e2eefaba9a9865373fdd/language_tags/tags.py#L134-L154
def languages(macrolanguage): """ Get a list of :class:`language_tags.Subtag.Subtag` objects given the string macrolanguage. :param string macrolanguage: subtag macrolanguage. :return: a list of the macrolanguage :class:`language_tags.Subtag.Subtag` objects. :raise Exception: if...
[ "def", "languages", "(", "macrolanguage", ")", ":", "results", "=", "[", "]", "macrolanguage", "=", "macrolanguage", ".", "lower", "(", ")", "macrolanguage_data", "=", "data", ".", "get", "(", "'macrolanguage'", ")", "if", "macrolanguage", "not", "in", "macr...
Get a list of :class:`language_tags.Subtag.Subtag` objects given the string macrolanguage. :param string macrolanguage: subtag macrolanguage. :return: a list of the macrolanguage :class:`language_tags.Subtag.Subtag` objects. :raise Exception: if the macrolanguage does not exists.
[ "Get", "a", "list", "of", ":", "class", ":", "language_tags", ".", "Subtag", ".", "Subtag", "objects", "given", "the", "string", "macrolanguage", "." ]
python
train
gabstopper/smc-python
smc/routing/route_map.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/route_map.py#L447-L456
def search_rule(self, search): """ Search the RouteMap policy using a search string :param str search: search string for a contains match against the rule name and comments field :rtype: list(RouteMapRule) """ return [RouteMapRule(**rule) for rule in ...
[ "def", "search_rule", "(", "self", ",", "search", ")", ":", "return", "[", "RouteMapRule", "(", "*", "*", "rule", ")", "for", "rule", "in", "self", ".", "make_request", "(", "resource", "=", "'search_rule'", ",", "params", "=", "{", "'filter'", ":", "s...
Search the RouteMap policy using a search string :param str search: search string for a contains match against the rule name and comments field :rtype: list(RouteMapRule)
[ "Search", "the", "RouteMap", "policy", "using", "a", "search", "string", ":", "param", "str", "search", ":", "search", "string", "for", "a", "contains", "match", "against", "the", "rule", "name", "and", "comments", "field", ":", "rtype", ":", "list", "(", ...
python
train
Clinical-Genomics/scout
scout/adapter/mongo/query.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/query.py#L11-L50
def build_variant_query(self, query=None, category='snv', variant_type=['clinical']): """Build a mongo query across multiple cases. Translate query options from a form into a complete mongo query dictionary. Beware that unindexed queries against a large variant collection will be extrem...
[ "def", "build_variant_query", "(", "self", ",", "query", "=", "None", ",", "category", "=", "'snv'", ",", "variant_type", "=", "[", "'clinical'", "]", ")", ":", "query", "=", "query", "or", "{", "}", "mongo_variant_query", "=", "{", "}", "LOG", ".", "d...
Build a mongo query across multiple cases. Translate query options from a form into a complete mongo query dictionary. Beware that unindexed queries against a large variant collection will be extremely slow. Currently indexed query options: hgnc_symbols rank_sco...
[ "Build", "a", "mongo", "query", "across", "multiple", "cases", ".", "Translate", "query", "options", "from", "a", "form", "into", "a", "complete", "mongo", "query", "dictionary", "." ]
python
test
ethereum/eth-account
eth_account/_utils/signing.py
https://github.com/ethereum/eth-account/blob/335199b815ae34fea87f1523e2f29777fd52946e/eth_account/_utils/signing.py#L96-L117
def hash_of_signed_transaction(txn_obj): ''' Regenerate the hash of the signed transaction object. 1. Infer the chain ID from the signature 2. Strip out signature from transaction 3. Annotate the transaction with that ID, if available 4. Take the hash of the serialized, unsigned, chain-aware tr...
[ "def", "hash_of_signed_transaction", "(", "txn_obj", ")", ":", "(", "chain_id", ",", "_v", ")", "=", "extract_chain_id", "(", "txn_obj", ".", "v", ")", "unsigned_parts", "=", "strip_signature", "(", "txn_obj", ")", "if", "chain_id", "is", "None", ":", "signa...
Regenerate the hash of the signed transaction object. 1. Infer the chain ID from the signature 2. Strip out signature from transaction 3. Annotate the transaction with that ID, if available 4. Take the hash of the serialized, unsigned, chain-aware transaction Chain ID inference and annotation is a...
[ "Regenerate", "the", "hash", "of", "the", "signed", "transaction", "object", "." ]
python
train
HPENetworking/topology_lib_ip
lib/topology_lib_ip/library.py
https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L99-L146
def _parse_ip_stats_link_show(raw_result): """ Parse the 'ip -s link show dev <dev>' command raw output. :param str raw_result: vtysh raw result string. :rtype: dict :return: The parsed result of the show interface command in a \ dictionary of the form: :: { 'rx_b...
[ "def", "_parse_ip_stats_link_show", "(", "raw_result", ")", ":", "show_re", "=", "(", "r'.+?RX:.*?\\n'", "r'\\s*(?P<rx_bytes>\\d+)\\s+(?P<rx_packets>\\d+)\\s+(?P<rx_errors>\\d+)\\s+'", "r'(?P<rx_dropped>\\d+)\\s+(?P<rx_overrun>\\d+)\\s+(?P<rx_mcast>\\d+)'", "r'.+?TX:.*?\\n'", "r'\\s*(?P<tx...
Parse the 'ip -s link show dev <dev>' command raw output. :param str raw_result: vtysh raw result string. :rtype: dict :return: The parsed result of the show interface command in a \ dictionary of the form: :: { 'rx_bytes': 0, 'rx_packets': 0, 'rx_...
[ "Parse", "the", "ip", "-", "s", "link", "show", "dev", "<dev", ">", "command", "raw", "output", "." ]
python
train
zarr-developers/zarr
zarr/hierarchy.py
https://github.com/zarr-developers/zarr/blob/fb8e6d5ea6bc26e451e5cf0eaaee36977556d5b5/zarr/hierarchy.py#L667-L669
def create_groups(self, *names, **kwargs): """Convenience method to create multiple groups in a single call.""" return tuple(self.create_group(name, **kwargs) for name in names)
[ "def", "create_groups", "(", "self", ",", "*", "names", ",", "*", "*", "kwargs", ")", ":", "return", "tuple", "(", "self", ".", "create_group", "(", "name", ",", "*", "*", "kwargs", ")", "for", "name", "in", "names", ")" ]
Convenience method to create multiple groups in a single call.
[ "Convenience", "method", "to", "create", "multiple", "groups", "in", "a", "single", "call", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9055-L9073
def raw_imu_send(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, force_mavlink1=False): ''' The RAW IMU readings for the usual 9DOF sensor setup. This message should always contain the true raw values without any scaling to allow ...
[ "def", "raw_imu_send", "(", "self", ",", "time_usec", ",", "xacc", ",", "yacc", ",", "zacc", ",", "xgyro", ",", "ygyro", ",", "zgyro", ",", "xmag", ",", "ymag", ",", "zmag", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send"...
The RAW IMU readings for the usual 9DOF sensor setup. This message should always contain the true raw values without any scaling to allow data capture and system debugging. time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system ...
[ "The", "RAW", "IMU", "readings", "for", "the", "usual", "9DOF", "sensor", "setup", ".", "This", "message", "should", "always", "contain", "the", "true", "raw", "values", "without", "any", "scaling", "to", "allow", "data", "capture", "and", "system", "debuggi...
python
train
rwl/godot
godot/ui/graph_editor.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_editor.py#L187-L193
def init ( self, parent ): """ Finishes initialising the editor by creating the underlying toolkit widget. """ self._graph = graph = Graph() ui = graph.edit_traits(parent=parent, kind="panel") self.control = ui.control
[ "def", "init", "(", "self", ",", "parent", ")", ":", "self", ".", "_graph", "=", "graph", "=", "Graph", "(", ")", "ui", "=", "graph", ".", "edit_traits", "(", "parent", "=", "parent", ",", "kind", "=", "\"panel\"", ")", "self", ".", "control", "=",...
Finishes initialising the editor by creating the underlying toolkit widget.
[ "Finishes", "initialising", "the", "editor", "by", "creating", "the", "underlying", "toolkit", "widget", "." ]
python
test
cimm-kzn/CGRtools
CGRtools/algorithms/morgan.py
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/algorithms/morgan.py#L88-L105
def _eratosthenes(): """Yields the sequence of prime numbers via the Sieve of Eratosthenes.""" d = {} # map each composite integer to its first-found prime factor for q in count(2): # q gets 2, 3, 4, 5, ... ad infinitum p = d.pop(q, None) if p is None: # q not a key in D, so q ...
[ "def", "_eratosthenes", "(", ")", ":", "d", "=", "{", "}", "# map each composite integer to its first-found prime factor", "for", "q", "in", "count", "(", "2", ")", ":", "# q gets 2, 3, 4, 5, ... ad infinitum", "p", "=", "d", ".", "pop", "(", "q", ",", "None", ...
Yields the sequence of prime numbers via the Sieve of Eratosthenes.
[ "Yields", "the", "sequence", "of", "prime", "numbers", "via", "the", "Sieve", "of", "Eratosthenes", "." ]
python
train
dronekit/dronekit-python
dronekit/__init__.py
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L542-L590
def add_attribute_listener(self, attr_name, observer): """ Add an attribute listener callback. The callback function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are upd...
[ "def", "add_attribute_listener", "(", "self", ",", "attr_name", ",", "observer", ")", ":", "listeners_for_attr", "=", "self", ".", "_attribute_listeners", ".", "get", "(", "attr_name", ")", "if", "listeners_for_attr", "is", "None", ":", "listeners_for_attr", "=", ...
Add an attribute listener callback. The callback function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are updated whenever a message is received from the vehicle. Attributes wh...
[ "Add", "an", "attribute", "listener", "callback", "." ]
python
train
Jammy2211/PyAutoLens
autolens/data/array/grids.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L668-L679
def scaled_array_2d_with_sub_dimensions_from_sub_array_1d(self, sub_array_1d): """ Map a 1D sub-array the same dimension as the sub-grid to its original masked 2D sub-array and return it as a scaled array. Parameters ----------- sub_array_1d : ndarray The 1D sub-arra...
[ "def", "scaled_array_2d_with_sub_dimensions_from_sub_array_1d", "(", "self", ",", "sub_array_1d", ")", ":", "return", "scaled_array", ".", "ScaledSquarePixelArray", "(", "array", "=", "self", ".", "sub_array_2d_from_sub_array_1d", "(", "sub_array_1d", "=", "sub_array_1d", ...
Map a 1D sub-array the same dimension as the sub-grid to its original masked 2D sub-array and return it as a scaled array. Parameters ----------- sub_array_1d : ndarray The 1D sub-array of which is mapped to a 2D scaled sub-array the dimensions.
[ "Map", "a", "1D", "sub", "-", "array", "the", "same", "dimension", "as", "the", "sub", "-", "grid", "to", "its", "original", "masked", "2D", "sub", "-", "array", "and", "return", "it", "as", "a", "scaled", "array", "." ]
python
valid
numenta/htmresearch
htmresearch/frameworks/location/location_network_creation.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/location/location_network_creation.py#L645-L649
def getL2Representations(self): """ Returns the active representation in L2. """ return [set(L2.getSelf()._pooler.getActiveCells()) for L2 in self.L2Regions]
[ "def", "getL2Representations", "(", "self", ")", ":", "return", "[", "set", "(", "L2", ".", "getSelf", "(", ")", ".", "_pooler", ".", "getActiveCells", "(", ")", ")", "for", "L2", "in", "self", ".", "L2Regions", "]" ]
Returns the active representation in L2.
[ "Returns", "the", "active", "representation", "in", "L2", "." ]
python
train
ksbg/sparklanes
sparklanes/_framework/task.py
https://github.com/ksbg/sparklanes/blob/62e70892e6ae025be2f4c419f4afc34714d6884c/sparklanes/_framework/task.py#L121-L140
def cache(self, name, val, overwrite=True): """Assigns an attribute reference to all subsequent tasks. For example, if a task caches a DataFrame `df` using `self.cache('some_df', df)`, all tasks that follow can access the DataFrame using `self.some_df`. Note that manually assigned attributes tha...
[ "def", "cache", "(", "self", ",", "name", ",", "val", ",", "overwrite", "=", "True", ")", ":", "if", "name", "in", "TaskCache", ".", "cached", "and", "not", "overwrite", ":", "raise", "CacheError", "(", "'Object with name `%s` already in cache.'", "%", "name...
Assigns an attribute reference to all subsequent tasks. For example, if a task caches a DataFrame `df` using `self.cache('some_df', df)`, all tasks that follow can access the DataFrame using `self.some_df`. Note that manually assigned attributes that share the same name have precedence over cach...
[ "Assigns", "an", "attribute", "reference", "to", "all", "subsequent", "tasks", ".", "For", "example", "if", "a", "task", "caches", "a", "DataFrame", "df", "using", "self", ".", "cache", "(", "some_df", "df", ")", "all", "tasks", "that", "follow", "can", ...
python
train
rocky/python3-trepan
trepan/processor/parse/scanner.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/parse/scanner.py#L81-L86
def t_single_quote_file(self, s): r"'[^'].+'" # Pick out text inside of singe-quoted string base = s[1:-1] self.add_token('FILENAME', base) self.pos += len(s)
[ "def", "t_single_quote_file", "(", "self", ",", "s", ")", ":", "# Pick out text inside of singe-quoted string", "base", "=", "s", "[", "1", ":", "-", "1", "]", "self", ".", "add_token", "(", "'FILENAME'", ",", "base", ")", "self", ".", "pos", "+=", "len", ...
r"'[^'].+
[ "r", "[", "^", "]", ".", "+" ]
python
test
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L905-L927
def do_help(self, arg): """Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help """ cmds = arg.split() if cmds: func = getattr(self, 'do_{}'.format(cmds[0])) if func: ...
[ "def", "do_help", "(", "self", ",", "arg", ")", ":", "cmds", "=", "arg", ".", "split", "(", ")", "if", "cmds", ":", "func", "=", "getattr", "(", "self", ",", "'do_{}'", ".", "format", "(", "cmds", "[", "0", "]", ")", ")", "if", "func", ":", "...
Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help
[ "Help", "command", "." ]
python
train
AtteqCom/zsl
src/zsl/router/task.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/router/task.py#L238-L247
def _create_result(self, cls): # type:(Callable)->Tuple[Any, Callable] """ Create the task using the injector initialization. :param cls: :return: """ task = instantiate(cls) logging.getLogger(__name__).debug("Task object {0} created [{1}].".format(cls.__n...
[ "def", "_create_result", "(", "self", ",", "cls", ")", ":", "# type:(Callable)->Tuple[Any, Callable]", "task", "=", "instantiate", "(", "cls", ")", "logging", ".", "getLogger", "(", "__name__", ")", ".", "debug", "(", "\"Task object {0} created [{1}].\"", ".", "fo...
Create the task using the injector initialization. :param cls: :return:
[ "Create", "the", "task", "using", "the", "injector", "initialization", ".", ":", "param", "cls", ":", ":", "return", ":" ]
python
train
reingart/pyafipws
wsremcarne.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/wsremcarne.py#L143-L148
def __analizar_evento(self, ret): "Comprueba y extrae el wvento informativo si existen en la respuesta XML" evt = ret.get('evento') if evt: self.Eventos = [evt] self.Evento = "%(codigo)s: %(descripcion)s" % evt
[ "def", "__analizar_evento", "(", "self", ",", "ret", ")", ":", "evt", "=", "ret", ".", "get", "(", "'evento'", ")", "if", "evt", ":", "self", ".", "Eventos", "=", "[", "evt", "]", "self", ".", "Evento", "=", "\"%(codigo)s: %(descripcion)s\"", "%", "evt...
Comprueba y extrae el wvento informativo si existen en la respuesta XML
[ "Comprueba", "y", "extrae", "el", "wvento", "informativo", "si", "existen", "en", "la", "respuesta", "XML" ]
python
train
NuGrid/NuGridPy
nugridpy/utils.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/utils.py#L1512-L1919
def stable_specie(): ''' provide the list of stable species, and decay path feeding stables ''' #import numpy as np stable_raw=[] stable_raw = ['H 1', 'H 2',\ 'HE 3', 'HE 4',\ 'LI 6', 'LI 7',\ 'BE 9',\ 'B 10', 'B 11',\ 'C 12', 'C 13',\ 'N 14', 'N 15',\ 'O ...
[ "def", "stable_specie", "(", ")", ":", "#import numpy as np", "stable_raw", "=", "[", "]", "stable_raw", "=", "[", "'H 1'", ",", "'H 2'", ",", "'HE 3'", ",", "'HE 4'", ",", "'LI 6'", ",", "'LI 7'", ",", "'BE 9'", ",", "'B 10'", ",", "'B 11'", ",...
provide the list of stable species, and decay path feeding stables
[ "provide", "the", "list", "of", "stable", "species", "and", "decay", "path", "feeding", "stables" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L431-L482
def command(self, dbname, spec, slave_ok=False, read_preference=ReadPreference.PRIMARY, codec_options=DEFAULT_CODEC_OPTIONS, check=True, allowable_errors=None, check_keys=False, read_concern=DEFAULT_READ_CONCERN, write_concern=None, ...
[ "def", "command", "(", "self", ",", "dbname", ",", "spec", ",", "slave_ok", "=", "False", ",", "read_preference", "=", "ReadPreference", ".", "PRIMARY", ",", "codec_options", "=", "DEFAULT_CODEC_OPTIONS", ",", "check", "=", "True", ",", "allowable_errors", "="...
Execute a command or raise ConnectionFailure or OperationFailure. :Parameters: - `dbname`: name of the database on which to run the command - `spec`: a command document as a dict, SON, or mapping object - `slave_ok`: whether to set the SlaveOkay wire protocol bit - `read...
[ "Execute", "a", "command", "or", "raise", "ConnectionFailure", "or", "OperationFailure", "." ]
python
train
erikrose/nose-progressive
noseprogressive/utils.py
https://github.com/erikrose/nose-progressive/blob/42853f11290cfaac8aa3d204714b71e27cc4ec07/noseprogressive/utils.py#L121-L132
def human_path(path, cwd): """Return the most human-readable representation of the given path. If an absolute path is given that's within the current directory, convert it to a relative path to shorten it. Otherwise, return the absolute path. """ # TODO: Canonicalize the path to remove /kitsune/.....
[ "def", "human_path", "(", "path", ",", "cwd", ")", ":", "# TODO: Canonicalize the path to remove /kitsune/../kitsune nonsense.", "path", "=", "abspath", "(", "path", ")", "if", "cwd", "and", "path", ".", "startswith", "(", "cwd", ")", ":", "path", "=", "path", ...
Return the most human-readable representation of the given path. If an absolute path is given that's within the current directory, convert it to a relative path to shorten it. Otherwise, return the absolute path.
[ "Return", "the", "most", "human", "-", "readable", "representation", "of", "the", "given", "path", "." ]
python
train
log2timeline/dfvfs
dfvfs/lib/gzipfile.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/lib/gzipfile.py#L270-L278
def GetCacheSize(self): """Determines the size of the uncompressed cached data. Returns: int: number of cached bytes. """ if not self._cache_start_offset or not self._cache_end_offset: return 0 return self._cache_end_offset - self._cache_start_offset
[ "def", "GetCacheSize", "(", "self", ")", ":", "if", "not", "self", ".", "_cache_start_offset", "or", "not", "self", ".", "_cache_end_offset", ":", "return", "0", "return", "self", ".", "_cache_end_offset", "-", "self", ".", "_cache_start_offset" ]
Determines the size of the uncompressed cached data. Returns: int: number of cached bytes.
[ "Determines", "the", "size", "of", "the", "uncompressed", "cached", "data", "." ]
python
train
AmesCornish/buttersink
buttersink/SSHStore.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/SSHStore.py#L586-L589
def send(self, diffTo, diffFrom): """ Do a btrfs send. """ diff = self.toObj.diff(diffTo, diffFrom) self._open(self.butterStore.send(diff))
[ "def", "send", "(", "self", ",", "diffTo", ",", "diffFrom", ")", ":", "diff", "=", "self", ".", "toObj", ".", "diff", "(", "diffTo", ",", "diffFrom", ")", "self", ".", "_open", "(", "self", ".", "butterStore", ".", "send", "(", "diff", ")", ")" ]
Do a btrfs send.
[ "Do", "a", "btrfs", "send", "." ]
python
train
marrow/package
marrow/package/loader.py
https://github.com/marrow/package/blob/133d4bf67cc857d1b2423695938a00ff2dfa8af2/marrow/package/loader.py#L57-L104
def load(target:str, namespace:str=None, default=nodefault, executable:bool=False, separators:Sequence[str]=('.', ':'), protect:bool=True): """This helper function loads an object identified by a dotted-notation string. For example:: # Load class Foo from example.objects load('example.objects:Foo') # L...
[ "def", "load", "(", "target", ":", "str", ",", "namespace", ":", "str", "=", "None", ",", "default", "=", "nodefault", ",", "executable", ":", "bool", "=", "False", ",", "separators", ":", "Sequence", "[", "str", "]", "=", "(", "'.'", ",", "':'", "...
This helper function loads an object identified by a dotted-notation string. For example:: # Load class Foo from example.objects load('example.objects:Foo') # Load the result of the class method ``new`` of the Foo object load('example.objects:Foo.new', executable=True) If a plugin namespace is provid...
[ "This", "helper", "function", "loads", "an", "object", "identified", "by", "a", "dotted", "-", "notation", "string", ".", "For", "example", "::", "#", "Load", "class", "Foo", "from", "example", ".", "objects", "load", "(", "example", ".", "objects", ":", ...
python
test
dschep/lambda-decorators
lambda_decorators.py
https://github.com/dschep/lambda-decorators/blob/9195914c8afe26843de9968d96dae6a89f061e8a/lambda_decorators.py#L492-L546
def json_schema_validator(request_schema=None, response_schema=None): """ Validate your request & response payloads against a JSONSchema. *NOTE: depends on the* `jsonschema <https://github.com/Julian/jsonschema>`_ *package. If you're using* `serverless-python-requirements <https://github.com/UnitedInco...
[ "def", "json_schema_validator", "(", "request_schema", "=", "None", ",", "response_schema", "=", "None", ")", ":", "def", "wrapper_wrapper", "(", "handler", ")", ":", "@", "wraps", "(", "handler", ")", "def", "wrapper", "(", "event", ",", "context", ")", "...
Validate your request & response payloads against a JSONSchema. *NOTE: depends on the* `jsonschema <https://github.com/Julian/jsonschema>`_ *package. If you're using* `serverless-python-requirements <https://github.com/UnitedIncome/serverless-python-requirements>`_ *you're all set. If you cURLed* ``lambda_...
[ "Validate", "your", "request", "&", "response", "payloads", "against", "a", "JSONSchema", "." ]
python
train
ktbyers/netmiko
netmiko/_textfsm/_texttable.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L444-L478
def sort(self, cmp=None, key=None, reverse=False): """Sorts rows in the texttable. Args: cmp: func, non default sort algorithm to use. key: func, applied to each element before sorting. reverse: bool, reverse order of sort. """ def _DefaultKey(value): """Default k...
[ "def", "sort", "(", "self", ",", "cmp", "=", "None", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "def", "_DefaultKey", "(", "value", ")", ":", "\"\"\"Default key func is to create a list of all fields.\"\"\"", "result", "=", "[", "]", "f...
Sorts rows in the texttable. Args: cmp: func, non default sort algorithm to use. key: func, applied to each element before sorting. reverse: bool, reverse order of sort.
[ "Sorts", "rows", "in", "the", "texttable", "." ]
python
train
seung-lab/cloud-volume
cloudvolume/cloudvolume.py
https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L911-L938
def delete(self, bbox_or_slices): """ Delete the files within the bounding box. bbox_or_slices: accepts either a Bbox or a tuple of slices representing the requested volume. """ if type(bbox_or_slices) is Bbox: requested_bbox = bbox_or_slices else: (requested_bbox, _, _) = se...
[ "def", "delete", "(", "self", ",", "bbox_or_slices", ")", ":", "if", "type", "(", "bbox_or_slices", ")", "is", "Bbox", ":", "requested_bbox", "=", "bbox_or_slices", "else", ":", "(", "requested_bbox", ",", "_", ",", "_", ")", "=", "self", ".", "__interpr...
Delete the files within the bounding box. bbox_or_slices: accepts either a Bbox or a tuple of slices representing the requested volume.
[ "Delete", "the", "files", "within", "the", "bounding", "box", "." ]
python
train
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L1438-L1492
def release_apply(ui, repo, clname, **opts): """apply a CL to the release branch Creates a new CL copying a previously committed change from the main branch to the release branch. The current client must either be clean or already be in the release branch. The release branch must be created by starting with a ...
[ "def", "release_apply", "(", "ui", ",", "repo", ",", "clname", ",", "*", "*", "opts", ")", ":", "c", "=", "repo", "[", "None", "]", "if", "not", "releaseBranch", ":", "raise", "hg_util", ".", "Abort", "(", "\"no active release branches\"", ")", "if", "...
apply a CL to the release branch Creates a new CL copying a previously committed change from the main branch to the release branch. The current client must either be clean or already be in the release branch. The release branch must be created by starting with a clean client, disabling the code review plugin, ...
[ "apply", "a", "CL", "to", "the", "release", "branch" ]
python
train
argaen/aiocache
aiocache/base.py
https://github.com/argaen/aiocache/blob/fdd282f37283ca04e22209f4d2ae4900f29e1688/aiocache/base.py#L417-L431
async def clear(self, namespace=None, _conn=None): """ Clears the cache in the cache namespace. If an alternative namespace is given, it will clear those ones instead. :param namespace: str alternative namespace to use :param timeout: int or float in seconds specifying maximum t...
[ "async", "def", "clear", "(", "self", ",", "namespace", "=", "None", ",", "_conn", "=", "None", ")", ":", "start", "=", "time", ".", "monotonic", "(", ")", "ret", "=", "await", "self", ".", "_clear", "(", "namespace", ",", "_conn", "=", "_conn", ")...
Clears the cache in the cache namespace. If an alternative namespace is given, it will clear those ones instead. :param namespace: str alternative namespace to use :param timeout: int or float in seconds specifying maximum timeout for the operations to last :returns: True ...
[ "Clears", "the", "cache", "in", "the", "cache", "namespace", ".", "If", "an", "alternative", "namespace", "is", "given", "it", "will", "clear", "those", "ones", "instead", "." ]
python
train
pyviz/imagen
imagen/__init__.py
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/__init__.py#L546-L549
def get_current_generator(self): """Return the current generator (as specified by self.index).""" int_index=int(len(self.generators)*wrap(0,1.0,self.inspect_value('index'))) return self.generators[int_index]
[ "def", "get_current_generator", "(", "self", ")", ":", "int_index", "=", "int", "(", "len", "(", "self", ".", "generators", ")", "*", "wrap", "(", "0", ",", "1.0", ",", "self", ".", "inspect_value", "(", "'index'", ")", ")", ")", "return", "self", "....
Return the current generator (as specified by self.index).
[ "Return", "the", "current", "generator", "(", "as", "specified", "by", "self", ".", "index", ")", "." ]
python
train
MartijnBraam/pyElectronics
electronics/devices/mpu6050.py
https://github.com/MartijnBraam/pyElectronics/blob/a20878c9fa190135f1e478e9ea0b54ca43ff308e/electronics/devices/mpu6050.py#L120-L144
def acceleration(self): """Return the acceleration in G's :returns: Acceleration for every axis as a tuple :Example: >>> sensor = MPU6050I2C(gw) >>> sensor.wakeup() >>> sensor.acceleration() (0.6279296875, 0.87890625, 1.1298828125) """ if not se...
[ "def", "acceleration", "(", "self", ")", ":", "if", "not", "self", ".", "awake", ":", "raise", "Exception", "(", "\"MPU6050 is in sleep mode, use wakeup()\"", ")", "raw", "=", "self", ".", "i2c_read_register", "(", "0x3B", ",", "6", ")", "x", ",", "y", ","...
Return the acceleration in G's :returns: Acceleration for every axis as a tuple :Example: >>> sensor = MPU6050I2C(gw) >>> sensor.wakeup() >>> sensor.acceleration() (0.6279296875, 0.87890625, 1.1298828125)
[ "Return", "the", "acceleration", "in", "G", "s" ]
python
train
specialunderwear/django-easymode
easymode/views.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/views.py#L9-L32
def preview(request, content_type_id, object_id): """ This is an override for django.views.default.shortcut. It assumes that get_absolute_url returns an absolute url, so it does not do any of the very elaborate link checking that shortcut does. This version adds the language code to the url. (/...
[ "def", "preview", "(", "request", ",", "content_type_id", ",", "object_id", ")", ":", "try", ":", "content_type", "=", "ContentType", ".", "objects", ".", "get", "(", "pk", "=", "content_type_id", ")", "obj", "=", "content_type", ".", "get_object_for_this_type...
This is an override for django.views.default.shortcut. It assumes that get_absolute_url returns an absolute url, so it does not do any of the very elaborate link checking that shortcut does. This version adds the language code to the url. (/en/blaat/).
[ "This", "is", "an", "override", "for", "django", ".", "views", ".", "default", ".", "shortcut", ".", "It", "assumes", "that", "get_absolute_url", "returns", "an", "absolute", "url", "so", "it", "does", "not", "do", "any", "of", "the", "very", "elaborate", ...
python
train
Kortemme-Lab/klab
klab/bio/bonsai.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/bonsai.py#L231-L305
def parse(self, lines = None): '''Parses the PDB file into a indexed representation (a tagged list of lines, see constructor docstring). A set of Atoms is created, including x, y, z coordinates when applicable. These atoms are grouped into Residues. Finally, the limits of the 3D space are ...
[ "def", "parse", "(", "self", ",", "lines", "=", "None", ")", ":", "indexed_lines", "=", "[", "]", "MODEL_count", "=", "0", "records_types_with_atom_serial_numbers", "=", "set", "(", "[", "'ATOM'", ",", "'HETATM'", ",", "'TER'", ",", "'ANISOU'", "]", ")", ...
Parses the PDB file into a indexed representation (a tagged list of lines, see constructor docstring). A set of Atoms is created, including x, y, z coordinates when applicable. These atoms are grouped into Residues. Finally, the limits of the 3D space are calculated to be used for Atom binning. ...
[ "Parses", "the", "PDB", "file", "into", "a", "indexed", "representation", "(", "a", "tagged", "list", "of", "lines", "see", "constructor", "docstring", ")", ".", "A", "set", "of", "Atoms", "is", "created", "including", "x", "y", "z", "coordinates", "when",...
python
train
spyder-ide/spyder
spyder/plugins/workingdirectory/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L203-L205
def parent_directory(self): """Change working directory to parent directory""" self.chdir(os.path.join(getcwd_or_home(), os.path.pardir))
[ "def", "parent_directory", "(", "self", ")", ":", "self", ".", "chdir", "(", "os", ".", "path", ".", "join", "(", "getcwd_or_home", "(", ")", ",", "os", ".", "path", ".", "pardir", ")", ")" ]
Change working directory to parent directory
[ "Change", "working", "directory", "to", "parent", "directory" ]
python
train
CalebBell/thermo
thermo/safety.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/safety.py#L1022-L1071
def Suzuki_LFL(Hc=None): r'''Calculates lower flammability limit, using the Suzuki [1]_ correlation. Uses heat of combustion only. The lower flammability limit of a gas is air is: .. math:: \text{LFL} = \frac{-3.42}{\Delta H_c^{\circ}} + 0.569 \Delta H_c^{\circ} + 0.0538\Delta H_c^{\ci...
[ "def", "Suzuki_LFL", "(", "Hc", "=", "None", ")", ":", "Hc", "=", "Hc", "/", "1E6", "LFL", "=", "-", "3.42", "/", "Hc", "+", "0.569", "*", "Hc", "+", "0.0538", "*", "Hc", "*", "Hc", "+", "1.80", "return", "LFL", "/", "100." ]
r'''Calculates lower flammability limit, using the Suzuki [1]_ correlation. Uses heat of combustion only. The lower flammability limit of a gas is air is: .. math:: \text{LFL} = \frac{-3.42}{\Delta H_c^{\circ}} + 0.569 \Delta H_c^{\circ} + 0.0538\Delta H_c^{\circ 2} + 1.80 Parameters ...
[ "r", "Calculates", "lower", "flammability", "limit", "using", "the", "Suzuki", "[", "1", "]", "_", "correlation", ".", "Uses", "heat", "of", "combustion", "only", "." ]
python
valid
jayclassless/tidypy
src/tidypy/util.py
https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/util.py#L221-L236
def read_file(filepath): """ Retrieves the contents of the specified file. This function performs simple caching so that the same file isn't read more than once per process. :param filepath: the file to read :type filepath: str :returns: str """ with _FILE_CACHE_LOCK: if f...
[ "def", "read_file", "(", "filepath", ")", ":", "with", "_FILE_CACHE_LOCK", ":", "if", "filepath", "not", "in", "_FILE_CACHE", ":", "_FILE_CACHE", "[", "filepath", "]", "=", "_read_file", "(", "filepath", ")", "return", "_FILE_CACHE", "[", "filepath", "]" ]
Retrieves the contents of the specified file. This function performs simple caching so that the same file isn't read more than once per process. :param filepath: the file to read :type filepath: str :returns: str
[ "Retrieves", "the", "contents", "of", "the", "specified", "file", "." ]
python
valid
edeposit/marcxml_parser
src/marcxml_parser/query.py
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L373-L383
def get_authors(self): """ Returns: list: Authors represented as :class:`.Person` objects. """ authors = self._parse_persons("100", "a") authors += self._parse_persons("600", "a") authors += self._parse_persons("700", "a") authors += self._parse_person...
[ "def", "get_authors", "(", "self", ")", ":", "authors", "=", "self", ".", "_parse_persons", "(", "\"100\"", ",", "\"a\"", ")", "authors", "+=", "self", ".", "_parse_persons", "(", "\"600\"", ",", "\"a\"", ")", "authors", "+=", "self", ".", "_parse_persons"...
Returns: list: Authors represented as :class:`.Person` objects.
[ "Returns", ":", "list", ":", "Authors", "represented", "as", ":", "class", ":", ".", "Person", "objects", "." ]
python
valid
MLAB-project/pymlab
src/pymlab/sensors/gpio.py
https://github.com/MLAB-project/pymlab/blob/d18d858ae83b203defcf2aead0dbd11b3c444658/src/pymlab/sensors/gpio.py#L242-L246
def set_ports(self, port0 = 0x00, port1 = 0x00): 'Writes specified value to the pins defined as output by method. Writing to input pins has no effect.' self.bus.write_byte_data(self.address, self.CONTROL_PORT0, port0) self.bus.write_byte_data(self.address, self.CONTROL_PORT0, port1) retu...
[ "def", "set_ports", "(", "self", ",", "port0", "=", "0x00", ",", "port1", "=", "0x00", ")", ":", "self", ".", "bus", ".", "write_byte_data", "(", "self", ".", "address", ",", "self", ".", "CONTROL_PORT0", ",", "port0", ")", "self", ".", "bus", ".", ...
Writes specified value to the pins defined as output by method. Writing to input pins has no effect.
[ "Writes", "specified", "value", "to", "the", "pins", "defined", "as", "output", "by", "method", ".", "Writing", "to", "input", "pins", "has", "no", "effect", "." ]
python
train
Unity-Technologies/ml-agents
ml-agents/mlagents/trainers/models.py
https://github.com/Unity-Technologies/ml-agents/blob/37d139af636e4a2351751fbf0f2fca5a9ed7457f/ml-agents/mlagents/trainers/models.py#L158-L175
def create_discrete_action_masking_layer(all_logits, action_masks, action_size): """ Creates a masking layer for the discrete actions :param all_logits: The concatenated unnormalized action probabilities for all branches :param action_masks: The mask for the logits. Must be of dimension ...
[ "def", "create_discrete_action_masking_layer", "(", "all_logits", ",", "action_masks", ",", "action_size", ")", ":", "action_idx", "=", "[", "0", "]", "+", "list", "(", "np", ".", "cumsum", "(", "action_size", ")", ")", "branches_logits", "=", "[", "all_logits...
Creates a masking layer for the discrete actions :param all_logits: The concatenated unnormalized action probabilities for all branches :param action_masks: The mask for the logits. Must be of dimension [None x total_number_of_action] :param action_size: A list containing the number of possible ...
[ "Creates", "a", "masking", "layer", "for", "the", "discrete", "actions", ":", "param", "all_logits", ":", "The", "concatenated", "unnormalized", "action", "probabilities", "for", "all", "branches", ":", "param", "action_masks", ":", "The", "mask", "for", "the", ...
python
train
dfm/george
george/modeling.py
https://github.com/dfm/george/blob/44819680036387625ee89f81c55104f3c1600759/george/modeling.py#L268-L277
def freeze_parameter(self, name): """ Freeze a parameter by name Args: name: The name of the parameter """ i = self.get_parameter_names(include_frozen=True).index(name) self.unfrozen_mask[i] = False
[ "def", "freeze_parameter", "(", "self", ",", "name", ")", ":", "i", "=", "self", ".", "get_parameter_names", "(", "include_frozen", "=", "True", ")", ".", "index", "(", "name", ")", "self", ".", "unfrozen_mask", "[", "i", "]", "=", "False" ]
Freeze a parameter by name Args: name: The name of the parameter
[ "Freeze", "a", "parameter", "by", "name" ]
python
train
FutunnOpen/futuquant
futuquant/examples/TinyQuant/TinyQuantBase.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/TinyQuant/TinyQuantBase.py#L122-L127
def sma(self, n, array=False): """简单均线""" result = talib.SMA(self.close, n) if array: return result return result[-1]
[ "def", "sma", "(", "self", ",", "n", ",", "array", "=", "False", ")", ":", "result", "=", "talib", ".", "SMA", "(", "self", ".", "close", ",", "n", ")", "if", "array", ":", "return", "result", "return", "result", "[", "-", "1", "]" ]
简单均线
[ "简单均线" ]
python
train
quintusdias/glymur
glymur/jp2box.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3309-L3323
def _parse_raw_data(self): """ Private function for parsing UUID payloads if possible. """ if self.uuid == _XMP_UUID: txt = self.raw_data.decode('utf-8') elt = ET.fromstring(txt) self.data = ET.ElementTree(elt) elif self.uuid == _GEOTIFF_UUID: ...
[ "def", "_parse_raw_data", "(", "self", ")", ":", "if", "self", ".", "uuid", "==", "_XMP_UUID", ":", "txt", "=", "self", ".", "raw_data", ".", "decode", "(", "'utf-8'", ")", "elt", "=", "ET", ".", "fromstring", "(", "txt", ")", "self", ".", "data", ...
Private function for parsing UUID payloads if possible.
[ "Private", "function", "for", "parsing", "UUID", "payloads", "if", "possible", "." ]
python
train
gitpython-developers/GitPython
git/refs/log.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/refs/log.py#L295-L302
def write(self): """Write this instance's data to the file we are originating from :return: self""" if self._path is None: raise ValueError("Instance was not initialized with a path, use to_file(...) instead") # END assert path self.to_file(self._path) return ...
[ "def", "write", "(", "self", ")", ":", "if", "self", ".", "_path", "is", "None", ":", "raise", "ValueError", "(", "\"Instance was not initialized with a path, use to_file(...) instead\"", ")", "# END assert path", "self", ".", "to_file", "(", "self", ".", "_path", ...
Write this instance's data to the file we are originating from :return: self
[ "Write", "this", "instance", "s", "data", "to", "the", "file", "we", "are", "originating", "from", ":", "return", ":", "self" ]
python
train
derpferd/little-python
littlepython/parser.py
https://github.com/derpferd/little-python/blob/3f89c74cffb6532c12c5b40843bd8ff8605638ba/littlepython/parser.py#L99-L116
def control(self): """ control : 'if' ctrl_exp block ('elif' ctrl_exp block)* ('else' block) """ self.eat(TokenTypes.IF) ctrl = self.expression() block = self.block() ifs = [If(ctrl, block)] else_block = Block() while self.cur_token.type == Toke...
[ "def", "control", "(", "self", ")", ":", "self", ".", "eat", "(", "TokenTypes", ".", "IF", ")", "ctrl", "=", "self", ".", "expression", "(", ")", "block", "=", "self", ".", "block", "(", ")", "ifs", "=", "[", "If", "(", "ctrl", ",", "block", ")...
control : 'if' ctrl_exp block ('elif' ctrl_exp block)* ('else' block)
[ "control", ":", "if", "ctrl_exp", "block", "(", "elif", "ctrl_exp", "block", ")", "*", "(", "else", "block", ")" ]
python
train
mapillary/mapillary_tools
mapillary_tools/exif_write.py
https://github.com/mapillary/mapillary_tools/blob/816785e90c589cae6e8e34a5530ce8417d29591c/mapillary_tools/exif_write.py#L40-L46
def add_date_time_original(self, date_time, time_format='%Y:%m:%d %H:%M:%S.%f'): """Add date time original.""" try: DateTimeOriginal = date_time.strftime(time_format)[:-3] self._ef['Exif'][piexif.ExifIFD.DateTimeOriginal] = DateTimeOriginal except Exception as e: ...
[ "def", "add_date_time_original", "(", "self", ",", "date_time", ",", "time_format", "=", "'%Y:%m:%d %H:%M:%S.%f'", ")", ":", "try", ":", "DateTimeOriginal", "=", "date_time", ".", "strftime", "(", "time_format", ")", "[", ":", "-", "3", "]", "self", ".", "_e...
Add date time original.
[ "Add", "date", "time", "original", "." ]
python
train
alephdata/memorious
memorious/helpers/__init__.py
https://github.com/alephdata/memorious/blob/b4033c5064447ed5f696f9c2bbbc6c12062d2fa4/memorious/helpers/__init__.py#L42-L46
def search_results_last_url(html, xpath, label): """ Get the URL of the 'last' button in a search results listing. """ for container in html.findall(xpath): if container.text_content().strip() == label: return container.find('.//a').get('href')
[ "def", "search_results_last_url", "(", "html", ",", "xpath", ",", "label", ")", ":", "for", "container", "in", "html", ".", "findall", "(", "xpath", ")", ":", "if", "container", ".", "text_content", "(", ")", ".", "strip", "(", ")", "==", "label", ":",...
Get the URL of the 'last' button in a search results listing.
[ "Get", "the", "URL", "of", "the", "last", "button", "in", "a", "search", "results", "listing", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L90-L130
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
[ "def", "_get_summary_struct", "(", "self", ")", ":", "g", "=", "self", ".", "graph", "section_titles", "=", "[", "'Graph'", "]", "graph_summary", "=", "[", "(", "k", ",", "_precomputed_field", "(", "v", ")", ")", "for", "k", ",", "v", "in", "six", "....
Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections...
[ "Returns", "a", "structured", "description", "of", "the", "model", "including", "(", "where", "relevant", ")", "the", "schema", "of", "the", "training", "data", "description", "of", "the", "training", "data", "training", "statistics", "and", "model", "hyperparam...
python
train
alex-kostirin/pyatomac
atomac/AXClasses.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L384-L393
def _holdModifierKeys(self, modifiers): """Hold given modifier keys (provided in list form). Parameters: modifiers list Returns: Unsigned int representing flags to set """ modFlags = self._pressModifiers(modifiers) # Post the queued keypresses: self._postQueuedEv...
[ "def", "_holdModifierKeys", "(", "self", ",", "modifiers", ")", ":", "modFlags", "=", "self", ".", "_pressModifiers", "(", "modifiers", ")", "# Post the queued keypresses:", "self", ".", "_postQueuedEvents", "(", ")", "return", "modFlags" ]
Hold given modifier keys (provided in list form). Parameters: modifiers list Returns: Unsigned int representing flags to set
[ "Hold", "given", "modifier", "keys", "(", "provided", "in", "list", "form", ")", "." ]
python
valid
jobovy/galpy
galpy/potential/planarPotential.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/planarPotential.py#L867-L882
def _phiforce(self,R,phi=0.,t=0.): """ NAME: _phiforce PURPOSE: evaluate the azimuthal force INPUT: R phi t OUTPUT: F_phi(R(,\phi,t)) HISTORY: 2016-06-02 - Written - Bovy (UofT) """ ...
[ "def", "_phiforce", "(", "self", ",", "R", ",", "phi", "=", "0.", ",", "t", "=", "0.", ")", ":", "return", "self", ".", "_Pot", ".", "phiforce", "(", "R", ",", "0.", ",", "phi", "=", "phi", ",", "t", "=", "t", ",", "use_physical", "=", "False...
NAME: _phiforce PURPOSE: evaluate the azimuthal force INPUT: R phi t OUTPUT: F_phi(R(,\phi,t)) HISTORY: 2016-06-02 - Written - Bovy (UofT)
[ "NAME", ":", "_phiforce", "PURPOSE", ":", "evaluate", "the", "azimuthal", "force", "INPUT", ":", "R", "phi", "t", "OUTPUT", ":", "F_phi", "(", "R", "(", "\\", "phi", "t", "))", "HISTORY", ":", "2016", "-", "06", "-", "02", "-", "Written", "-", "Bov...
python
train
klen/muffin-metrics
muffin_metrics.py
https://github.com/klen/muffin-metrics/blob/b62fc25172e3e1e9fc6dc6c8da3170935ee69f01/muffin_metrics.py#L185-L189
def connect(self): """Connect to socket.""" self.transport, _ = yield from self.parent.app.loop.create_datagram_endpoint( DatagramProtocol, remote_addr=(self.hostname, self.port)) return self
[ "def", "connect", "(", "self", ")", ":", "self", ".", "transport", ",", "_", "=", "yield", "from", "self", ".", "parent", ".", "app", ".", "loop", ".", "create_datagram_endpoint", "(", "DatagramProtocol", ",", "remote_addr", "=", "(", "self", ".", "hostn...
Connect to socket.
[ "Connect", "to", "socket", "." ]
python
train
wonambi-python/wonambi
wonambi/ioeeg/wonambi.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/wonambi.py#L50-L102
def return_dat(self, chan, begsam, endsam): """Return the data as 2D numpy.ndarray. Parameters ---------- chan : int or list index (indices) of the channels to read begsam : int index of the first sample endsam : int index of the last ...
[ "def", "return_dat", "(", "self", ",", "chan", ",", "begsam", ",", "endsam", ")", ":", "memmap_file", "=", "Path", "(", "self", ".", "filename", ")", ".", "with_suffix", "(", "'.dat'", ")", "if", "not", "memmap_file", ".", "exists", "(", ")", ":", "r...
Return the data as 2D numpy.ndarray. Parameters ---------- chan : int or list index (indices) of the channels to read begsam : int index of the first sample endsam : int index of the last sample Returns ------- numpy.n...
[ "Return", "the", "data", "as", "2D", "numpy", ".", "ndarray", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_attention.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_attention.py#L3572-L3582
def scatter_blocks_2d(x, indices, shape): """scatters blocks from x into shape with indices.""" x_shape = common_layers.shape_list(x) # [length, batch, heads, dim] x_t = tf.transpose( tf.reshape(x, [x_shape[0], x_shape[1], -1, x_shape[-1]]), [2, 0, 1, 3]) x_t_shape = common_layers.shape_list(x_t) indi...
[ "def", "scatter_blocks_2d", "(", "x", ",", "indices", ",", "shape", ")", ":", "x_shape", "=", "common_layers", ".", "shape_list", "(", "x", ")", "# [length, batch, heads, dim]", "x_t", "=", "tf", ".", "transpose", "(", "tf", ".", "reshape", "(", "x", ",", ...
scatters blocks from x into shape with indices.
[ "scatters", "blocks", "from", "x", "into", "shape", "with", "indices", "." ]
python
train
fabioz/PyDev.Debugger
third_party/pep8/pycodestyle.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/pycodestyle.py#L1688-L1701
def generate_tokens(self): """Tokenize the file, run physical line checks and yield tokens.""" if self._io_error: self.report_error(1, 0, 'E902 %s' % self._io_error, readlines) tokengen = tokenize.generate_tokens(self.readline) try: for token in tokengen: ...
[ "def", "generate_tokens", "(", "self", ")", ":", "if", "self", ".", "_io_error", ":", "self", ".", "report_error", "(", "1", ",", "0", ",", "'E902 %s'", "%", "self", ".", "_io_error", ",", "readlines", ")", "tokengen", "=", "tokenize", ".", "generate_tok...
Tokenize the file, run physical line checks and yield tokens.
[ "Tokenize", "the", "file", "run", "physical", "line", "checks", "and", "yield", "tokens", "." ]
python
train
ShenggaoZhu/midict
midict/__init__.py
https://github.com/ShenggaoZhu/midict/blob/2fad2edcfb753035b443a70fe15852affae1b5bb/midict/__init__.py#L456-L603
def MI_parse_args(self, args, ingore_index2=False, allow_new=False): ''' Parse the arguments for indexing in MIDict. Full syntax: ``d[index1:key, index2]``. ``index2`` can be flexible indexing (int, list, slice etc.) as in ``IndexDict``. Short syntax: * d[key] <==> d[key,] <==> d[first_index...
[ "def", "MI_parse_args", "(", "self", ",", "args", ",", "ingore_index2", "=", "False", ",", "allow_new", "=", "False", ")", ":", "empty", "=", "len", "(", "self", ".", "indices", ")", "==", "0", "if", "empty", "and", "not", "allow_new", ":", "raise", ...
Parse the arguments for indexing in MIDict. Full syntax: ``d[index1:key, index2]``. ``index2`` can be flexible indexing (int, list, slice etc.) as in ``IndexDict``. Short syntax: * d[key] <==> d[key,] <==> d[first_index:key, all_indice_except_first] * d[:key] <==> d[:key,] <==> d[None:key] <==> ...
[ "Parse", "the", "arguments", "for", "indexing", "in", "MIDict", "." ]
python
train
StackStorm/pybind
pybind/nos/v7_2_0/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v7_2_0/__init__.py#L9506-L9527
def _set_police_priority_map(self, v, load=False): """ Setter method for police_priority_map, mapped from YANG variable /police_priority_map (list) If this variable is read-only (config: false) in the source YANG file, then _set_police_priority_map is considered as a private method. Backends looking...
[ "def", "_set_police_priority_map", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",...
Setter method for police_priority_map, mapped from YANG variable /police_priority_map (list) If this variable is read-only (config: false) in the source YANG file, then _set_police_priority_map is considered as a private method. Backends looking to populate this variable should do so via calling thisObj...
[ "Setter", "method", "for", "police_priority_map", "mapped", "from", "YANG", "variable", "/", "police_priority_map", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file"...
python
train
twisted/txaws
txaws/ec2/client.py
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L1099-L1105
def old_signing_text(self): """Return the text needed for signing using SignatureVersion 1.""" result = [] lower_cmp = lambda x, y: cmp(x[0].lower(), y[0].lower()) for key, value in sorted(self.params.items(), cmp=lower_cmp): result.append("%s%s" % (key, value)) retur...
[ "def", "old_signing_text", "(", "self", ")", ":", "result", "=", "[", "]", "lower_cmp", "=", "lambda", "x", ",", "y", ":", "cmp", "(", "x", "[", "0", "]", ".", "lower", "(", ")", ",", "y", "[", "0", "]", ".", "lower", "(", ")", ")", "for", ...
Return the text needed for signing using SignatureVersion 1.
[ "Return", "the", "text", "needed", "for", "signing", "using", "SignatureVersion", "1", "." ]
python
train
raiden-network/raiden
raiden/api/python.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L357-L447
def channel_open( self, registry_address: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, settle_timeout: BlockTimeout = None, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ) -> ChannelID: """ Open a ch...
[ "def", "channel_open", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "settle_timeout", ":", "BlockTimeout", "=", "None", ",", "retry_timeout", ":", "NetworkTimeo...
Open a channel with the peer at `partner_address` with the given `token_address`.
[ "Open", "a", "channel", "with", "the", "peer", "at", "partner_address", "with", "the", "given", "token_address", "." ]
python
train
quantopian/zipline
zipline/data/minute_bars.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/minute_bars.py#L991-L1013
def _minutes_to_exclude(self): """ Calculate the minutes which should be excluded when a window occurs on days which had an early close, i.e. days where the close based on the regular period of minutes per day and the market close do not match. Returns ------- ...
[ "def", "_minutes_to_exclude", "(", "self", ")", ":", "market_opens", "=", "self", ".", "_market_opens", ".", "values", ".", "astype", "(", "'datetime64[m]'", ")", "market_closes", "=", "self", ".", "_market_closes", ".", "values", ".", "astype", "(", "'datetim...
Calculate the minutes which should be excluded when a window occurs on days which had an early close, i.e. days where the close based on the regular period of minutes per day and the market close do not match. Returns ------- List of DatetimeIndex representing the minute...
[ "Calculate", "the", "minutes", "which", "should", "be", "excluded", "when", "a", "window", "occurs", "on", "days", "which", "had", "an", "early", "close", "i", ".", "e", ".", "days", "where", "the", "close", "based", "on", "the", "regular", "period", "of...
python
train
senaite/senaite.core
bika/lims/setuphandlers.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/setuphandlers.py#L389-L407
def reindex_content_structure(portal): """Reindex contents generated by Generic Setup """ logger.info("*** Reindex content structure ***") def reindex(obj, recurse=False): # skip catalog tools etc. if api.is_object(obj): obj.reindexObject() if recurse and hasattr(aq_...
[ "def", "reindex_content_structure", "(", "portal", ")", ":", "logger", ".", "info", "(", "\"*** Reindex content structure ***\"", ")", "def", "reindex", "(", "obj", ",", "recurse", "=", "False", ")", ":", "# skip catalog tools etc.", "if", "api", ".", "is_object",...
Reindex contents generated by Generic Setup
[ "Reindex", "contents", "generated", "by", "Generic", "Setup" ]
python
train
inveniosoftware-contrib/json-merger
json_merger/contrib/inspirehep/match.py
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/contrib/inspirehep/match.py#L79-L138
def _match_by_norm_func(l1, l2, norm_fn, dist_fn, thresh): """Matches elements in l1 and l2 using normalization functions. Splits the elements in each list into buckets given by the normalization function. If the same normalization value points to a bucket from the first list and a bucket from the seco...
[ "def", "_match_by_norm_func", "(", "l1", ",", "l2", ",", "norm_fn", ",", "dist_fn", ",", "thresh", ")", ":", "common", "=", "[", "]", "l1_only_idx", "=", "set", "(", "range", "(", "len", "(", "l1", ")", ")", ")", "l2_only_idx", "=", "set", "(", "ra...
Matches elements in l1 and l2 using normalization functions. Splits the elements in each list into buckets given by the normalization function. If the same normalization value points to a bucket from the first list and a bucket from the second list, both with a single element we consider the elements i...
[ "Matches", "elements", "in", "l1", "and", "l2", "using", "normalization", "functions", "." ]
python
train
materialsproject/pymatgen
pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.py#L700-L715
def edges(self, sites, permutation=None, input='sites'): """ Returns the list of edges of this coordination geometry. Each edge is given as a list of its end vertices coordinates. """ if input == 'sites': coords = [site.coords for site in sites] elif input == ...
[ "def", "edges", "(", "self", ",", "sites", ",", "permutation", "=", "None", ",", "input", "=", "'sites'", ")", ":", "if", "input", "==", "'sites'", ":", "coords", "=", "[", "site", ".", "coords", "for", "site", "in", "sites", "]", "elif", "input", ...
Returns the list of edges of this coordination geometry. Each edge is given as a list of its end vertices coordinates.
[ "Returns", "the", "list", "of", "edges", "of", "this", "coordination", "geometry", ".", "Each", "edge", "is", "given", "as", "a", "list", "of", "its", "end", "vertices", "coordinates", "." ]
python
train
spyder-ide/spyder
spyder/widgets/findreplace.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/findreplace.py#L251-L257
def toggle_highlighting(self, state): """Toggle the 'highlight all results' feature""" if self.editor is not None: if state: self.highlight_matches() else: self.clear_matches()
[ "def", "toggle_highlighting", "(", "self", ",", "state", ")", ":", "if", "self", ".", "editor", "is", "not", "None", ":", "if", "state", ":", "self", ".", "highlight_matches", "(", ")", "else", ":", "self", ".", "clear_matches", "(", ")" ]
Toggle the 'highlight all results' feature
[ "Toggle", "the", "highlight", "all", "results", "feature" ]
python
train
Azure/azure-storage-python
azure-storage-file/azure/storage/file/_deserialization.py
https://github.com/Azure/azure-storage-python/blob/52327354b192cbcf6b7905118ec6b5d57fa46275/azure-storage-file/azure/storage/file/_deserialization.py#L82-L142
def _convert_xml_to_shares(response): ''' <?xml version="1.0" encoding="utf-8"?> <EnumerationResults AccountName="https://myaccount.file.core.windows.net"> <Prefix>string-value</Prefix> <Marker>string-value</Marker> <MaxResults>int-value</MaxResults> <Shares> <Share> ...
[ "def", "_convert_xml_to_shares", "(", "response", ")", ":", "if", "response", "is", "None", "or", "response", ".", "body", "is", "None", ":", "return", "None", "shares", "=", "_list", "(", ")", "list_element", "=", "ETree", ".", "fromstring", "(", "respons...
<?xml version="1.0" encoding="utf-8"?> <EnumerationResults AccountName="https://myaccount.file.core.windows.net"> <Prefix>string-value</Prefix> <Marker>string-value</Marker> <MaxResults>int-value</MaxResults> <Shares> <Share> <Name>share-name</Name> <Snapshot>date...
[ "<?xml", "version", "=", "1", ".", "0", "encoding", "=", "utf", "-", "8", "?", ">", "<EnumerationResults", "AccountName", "=", "https", ":", "//", "myaccount", ".", "file", ".", "core", ".", "windows", ".", "net", ">", "<Prefix", ">", "string", "-", ...
python
train
wright-group/WrightTools
WrightTools/units.py
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/units.py#L96-L135
def converter(val, current_unit, destination_unit): """Convert from one unit to another. Parameters ---------- val : number Number to convert. current_unit : string Current unit. destination_unit : string Destination unit. Returns ------- number Conv...
[ "def", "converter", "(", "val", ",", "current_unit", ",", "destination_unit", ")", ":", "x", "=", "val", "for", "dic", "in", "dicts", ".", "values", "(", ")", ":", "if", "current_unit", "in", "dic", ".", "keys", "(", ")", "and", "destination_unit", "in...
Convert from one unit to another. Parameters ---------- val : number Number to convert. current_unit : string Current unit. destination_unit : string Destination unit. Returns ------- number Converted value.
[ "Convert", "from", "one", "unit", "to", "another", "." ]
python
train
michael-lazar/rtv
rtv/terminal.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/terminal.py#L414-L423
def get_link_page_text(link_page): """ Construct the dialog box to display a list of links to the user. """ text = '' for i, link in enumerate(link_page): capped_link_text = (link['text'] if len(link['text']) <= 20 else link['text'][:19...
[ "def", "get_link_page_text", "(", "link_page", ")", ":", "text", "=", "''", "for", "i", ",", "link", "in", "enumerate", "(", "link_page", ")", ":", "capped_link_text", "=", "(", "link", "[", "'text'", "]", "if", "len", "(", "link", "[", "'text'", "]", ...
Construct the dialog box to display a list of links to the user.
[ "Construct", "the", "dialog", "box", "to", "display", "a", "list", "of", "links", "to", "the", "user", "." ]
python
train
gtaylor/EVE-Market-Data-Structures
emds/data_structures.py
https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/data_structures.py#L474-L500
def set_empty_region(self, region_id, type_id, generated_at, error_if_entries_present=True): """ Prepares for the given region+item combo by instantiating a :py:class:`HistoryItemsInRegionList` instance, which will track region ID, type ID, and generated time. Th...
[ "def", "set_empty_region", "(", "self", ",", "region_id", ",", "type_id", ",", "generated_at", ",", "error_if_entries_present", "=", "True", ")", ":", "key", "=", "'%s_%s'", "%", "(", "region_id", ",", "type_id", ")", "if", "error_if_entries_present", "and", "...
Prepares for the given region+item combo by instantiating a :py:class:`HistoryItemsInRegionList` instance, which will track region ID, type ID, and generated time. This is mostly used for the JSON deserialization process in case there are no orders for the given region+item combo. ...
[ "Prepares", "for", "the", "given", "region", "+", "item", "combo", "by", "instantiating", "a", ":", "py", ":", "class", ":", "HistoryItemsInRegionList", "instance", "which", "will", "track", "region", "ID", "type", "ID", "and", "generated", "time", ".", "Thi...
python
train
projectshift/shift-boiler
boiler/timer/restart_timer.py
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/timer/restart_timer.py#L6-L22
def time_restarts(data_path): """ When called will create a file and measure its mtime on restarts """ path = os.path.join(data_path, 'last_restarted') if not os.path.isfile(path): with open(path, 'a'): os.utime(path, None) last_modified = os.stat(path).st_mtime with open(path,...
[ "def", "time_restarts", "(", "data_path", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "data_path", ",", "'last_restarted'", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "with", "open", "(", "path", ",", ...
When called will create a file and measure its mtime on restarts
[ "When", "called", "will", "create", "a", "file", "and", "measure", "its", "mtime", "on", "restarts" ]
python
train
PGower/PyCanvas
pycanvas/apis/modules.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/modules.py#L19-L61
def list_modules(self, course_id, include=None, search_term=None, student_id=None): """ List modules. List the modules in a course """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = ...
[ "def", "list_modules", "(", "self", ",", "course_id", ",", "include", "=", "None", ",", "search_term", "=", "None", ",", "student_id", "=", "None", ")", ":", "path", "=", "{", "}", "data", "=", "{", "}", "params", "=", "{", "}", "# REQUIRED - PATH - co...
List modules. List the modules in a course
[ "List", "modules", ".", "List", "the", "modules", "in", "a", "course" ]
python
train
clinicedc/edc-form-label
edc_form_label/custom_label_condition.py
https://github.com/clinicedc/edc-form-label/blob/9d90807ddf784045b3867d676bee6e384a8e9d71/edc_form_label/custom_label_condition.py#L64-L78
def previous_obj(self): """Returns a model obj that is the first occurrence of a previous obj relative to this object's appointment. Override this method if not am EDC subject model / CRF. """ previous_obj = None if self.previous_visit: try: p...
[ "def", "previous_obj", "(", "self", ")", ":", "previous_obj", "=", "None", "if", "self", ".", "previous_visit", ":", "try", ":", "previous_obj", "=", "self", ".", "model", ".", "objects", ".", "get", "(", "*", "*", "{", "f\"{self.model.visit_model_attr()}\""...
Returns a model obj that is the first occurrence of a previous obj relative to this object's appointment. Override this method if not am EDC subject model / CRF.
[ "Returns", "a", "model", "obj", "that", "is", "the", "first", "occurrence", "of", "a", "previous", "obj", "relative", "to", "this", "object", "s", "appointment", "." ]
python
train
mswart/pyopenmensa
feed.py
https://github.com/mswart/pyopenmensa/blob/c651da6ace33e2278349636daaa709d043dee6ff/feed.py#L627-L630
def setLegendData(self, *args, **kwargs): """ Set or genernate the legend data from this canteen. Uses :py:func:`.buildLegend` for genernating """ self.legendData = buildLegend(*args, key=self.legendKeyFunc, **kwargs)
[ "def", "setLegendData", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "legendData", "=", "buildLegend", "(", "*", "args", ",", "key", "=", "self", ".", "legendKeyFunc", ",", "*", "*", "kwargs", ")" ]
Set or genernate the legend data from this canteen. Uses :py:func:`.buildLegend` for genernating
[ "Set", "or", "genernate", "the", "legend", "data", "from", "this", "canteen", ".", "Uses", ":", "py", ":", "func", ":", ".", "buildLegend", "for", "genernating" ]
python
train
ncclient/ncclient
ncclient/xml_.py
https://github.com/ncclient/ncclient/blob/2b75f2c6a06bd2a5d1be67b01bb65c5ffd2e2d7a/ncclient/xml_.py#L116-L123
def parse_root(raw): "Efficiently parses the root element of a *raw* XML document, returning a tuple of its qualified name and attribute dictionary." if sys.version < '3': fp = StringIO(raw) else: fp = BytesIO(raw.encode('UTF-8')) for event, element in etree.iterparse(fp, events=('start'...
[ "def", "parse_root", "(", "raw", ")", ":", "if", "sys", ".", "version", "<", "'3'", ":", "fp", "=", "StringIO", "(", "raw", ")", "else", ":", "fp", "=", "BytesIO", "(", "raw", ".", "encode", "(", "'UTF-8'", ")", ")", "for", "event", ",", "element...
Efficiently parses the root element of a *raw* XML document, returning a tuple of its qualified name and attribute dictionary.
[ "Efficiently", "parses", "the", "root", "element", "of", "a", "*", "raw", "*", "XML", "document", "returning", "a", "tuple", "of", "its", "qualified", "name", "and", "attribute", "dictionary", "." ]
python
train
matllubos/django-is-core
is_core/filters/default_filters.py
https://github.com/matllubos/django-is-core/blob/3f87ec56a814738683c732dce5f07e0328c2300d/is_core/filters/default_filters.py#L76-L87
def get_widget(self, request): """ Table view is not able to get form field from reverse relation. Therefore this widget returns similar form field as direct relation (ModelChoiceField). Because there is used "RestrictedSelectWidget" it is returned textarea or selectox with choices accor...
[ "def", "get_widget", "(", "self", ",", "request", ")", ":", "return", "self", ".", "_update_widget_choices", "(", "forms", ".", "ModelChoiceField", "(", "widget", "=", "RestrictedSelectWidget", ",", "queryset", "=", "self", ".", "field", ".", "related_model", ...
Table view is not able to get form field from reverse relation. Therefore this widget returns similar form field as direct relation (ModelChoiceField). Because there is used "RestrictedSelectWidget" it is returned textarea or selectox with choices according to count objects in the queryset.
[ "Table", "view", "is", "not", "able", "to", "get", "form", "field", "from", "reverse", "relation", ".", "Therefore", "this", "widget", "returns", "similar", "form", "field", "as", "direct", "relation", "(", "ModelChoiceField", ")", ".", "Because", "there", "...
python
train
DarkEnergySurvey/ugali
ugali/scratch/simulation/survey_selection_function.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/scratch/simulation/survey_selection_function.py#L282-L371
def validateClassifier(self, cut_detect, cut_train, cut_geometry, y_pred): """ Make some diagnostic plots """ color = {'detect': 'Red', 'nondetect': 'Gold', 'why_not': 'none', 'actual': 'DodgerBlue', 'hsc': 'lime'} ...
[ "def", "validateClassifier", "(", "self", ",", "cut_detect", ",", "cut_train", ",", "cut_geometry", ",", "y_pred", ")", ":", "color", "=", "{", "'detect'", ":", "'Red'", ",", "'nondetect'", ":", "'Gold'", ",", "'why_not'", ":", "'none'", ",", "'actual'", "...
Make some diagnostic plots
[ "Make", "some", "diagnostic", "plots" ]
python
train
modin-project/modin
modin/experimental/engines/pandas_on_ray/sql.py
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L34-L46
def is_table(engine, sql): """ Check with the given sql arg is query or table Args: engine: SQLAlchemy connection engine sql: SQL query or table name Returns: True for table or False if not """ if engine.dialect.has_table(engine, sql): return True return False
[ "def", "is_table", "(", "engine", ",", "sql", ")", ":", "if", "engine", ".", "dialect", ".", "has_table", "(", "engine", ",", "sql", ")", ":", "return", "True", "return", "False" ]
Check with the given sql arg is query or table Args: engine: SQLAlchemy connection engine sql: SQL query or table name Returns: True for table or False if not
[ "Check", "with", "the", "given", "sql", "arg", "is", "query", "or", "table" ]
python
train
mattloper/chumpy
chumpy/ch.py
https://github.com/mattloper/chumpy/blob/a3cfdb1be3c8265c369c507b22f6f3f89414c772/chumpy/ch.py#L275-L280
def compute_dr_wrt(self,wrt): """Default method for objects that just contain a number or ndarray""" if wrt is self: # special base case return sp.eye(self.x.size, self.x.size) #return np.array([[1]]) return None
[ "def", "compute_dr_wrt", "(", "self", ",", "wrt", ")", ":", "if", "wrt", "is", "self", ":", "# special base case ", "return", "sp", ".", "eye", "(", "self", ".", "x", ".", "size", ",", "self", ".", "x", ".", "size", ")", "#return np.array([[1]])", "re...
Default method for objects that just contain a number or ndarray
[ "Default", "method", "for", "objects", "that", "just", "contain", "a", "number", "or", "ndarray" ]
python
train
ibis-project/ibis
ibis/mapd/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/mapd/client.py#L768-L781
def exists_table(self, name, database=None): """ Determine if the indicated table or view exists Parameters ---------- name : string database : string, default None Returns ------- if_exists : boolean """ return bool(self.list_tab...
[ "def", "exists_table", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "return", "bool", "(", "self", ".", "list_tables", "(", "like", "=", "name", ",", "database", "=", "database", ")", ")" ]
Determine if the indicated table or view exists Parameters ---------- name : string database : string, default None Returns ------- if_exists : boolean
[ "Determine", "if", "the", "indicated", "table", "or", "view", "exists" ]
python
train
saltstack/salt
salt/modules/runit.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/runit.py#L690-L722
def remove(name): ''' Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name> ''' if not enabled(name): ...
[ "def", "remove", "(", "name", ")", ":", "if", "not", "enabled", "(", "name", ")", ":", "return", "False", "svc_path", "=", "_service_path", "(", "name", ")", "if", "not", "os", ".", "path", ".", "islink", "(", "svc_path", ")", ":", "log", ".", "err...
Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name>
[ "Remove", "the", "service", "<name", ">", "from", "system", ".", "Returns", "True", "if", "operation", "is", "successful", ".", "The", "service", "will", "be", "also", "stopped", "." ]
python
train
Fizzadar/pyinfra
pyinfra/api/connectors/local.py
https://github.com/Fizzadar/pyinfra/blob/006f751f7db2e07d32522c0285160783de2feb79/pyinfra/api/connectors/local.py#L39-L110
def run_shell_command( state, host, command, get_pty=False, timeout=None, print_output=False, **command_kwargs ): ''' Execute a command on the local machine. Args: state (``pyinfra.api.State`` obj): state object for this command hostname (string): hostname of the target ...
[ "def", "run_shell_command", "(", "state", ",", "host", ",", "command", ",", "get_pty", "=", "False", ",", "timeout", "=", "None", ",", "print_output", "=", "False", ",", "*", "*", "command_kwargs", ")", ":", "command", "=", "make_command", "(", "command", ...
Execute a command on the local machine. Args: state (``pyinfra.api.State`` obj): state object for this command hostname (string): hostname of the target command (string): actual command to execute sudo (boolean): whether to wrap the command with sudo sudo_user (string): user...
[ "Execute", "a", "command", "on", "the", "local", "machine", "." ]
python
train
awslabs/serverless-application-model
samtranslator/model/api/api_generator.py
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/model/api/api_generator.py#L251-L281
def _add_auth(self): """ Add Auth configuration to the Swagger file, if necessary """ if not self.auth: return if self.auth and not self.definition_body: raise InvalidResourceException(self.logical_id, "Auth wor...
[ "def", "_add_auth", "(", "self", ")", ":", "if", "not", "self", ".", "auth", ":", "return", "if", "self", ".", "auth", "and", "not", "self", ".", "definition_body", ":", "raise", "InvalidResourceException", "(", "self", ".", "logical_id", ",", "\"Auth work...
Add Auth configuration to the Swagger file, if necessary
[ "Add", "Auth", "configuration", "to", "the", "Swagger", "file", "if", "necessary" ]
python
train
saltstack/salt
salt/modules/chocolatey.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chocolatey.py#L890-L945
def version(name, check_remote=False, source=None, pre_versions=False): ''' Instructs Chocolatey to check an installed package version, and optionally compare it to one available from a remote feed. Args: name (str): The name of the package to check. Required. check_remote...
[ "def", "version", "(", "name", ",", "check_remote", "=", "False", ",", "source", "=", "None", ",", "pre_versions", "=", "False", ")", ":", "installed", "=", "list_", "(", "narrow", "=", "name", ",", "local_only", "=", "True", ")", "installed", "=", "{"...
Instructs Chocolatey to check an installed package version, and optionally compare it to one available from a remote feed. Args: name (str): The name of the package to check. Required. check_remote (bool): Get the version number of the latest package from the remote fe...
[ "Instructs", "Chocolatey", "to", "check", "an", "installed", "package", "version", "and", "optionally", "compare", "it", "to", "one", "available", "from", "a", "remote", "feed", "." ]
python
train
bitshares/python-bitshares
bitsharesapi/bitsharesnoderpc.py
https://github.com/bitshares/python-bitshares/blob/8a3b5954a6abcaaff7c6a5c41d910e58eea3142f/bitsharesapi/bitsharesnoderpc.py#L30-L41
def get_network(self): """ Identify the connected network. This call returns a dictionary with keys chain_id, core_symbol and prefix """ props = self.get_chain_properties() chain_id = props["chain_id"] for k, v in known_chains.items(): if v["chain_id"] == ...
[ "def", "get_network", "(", "self", ")", ":", "props", "=", "self", ".", "get_chain_properties", "(", ")", "chain_id", "=", "props", "[", "\"chain_id\"", "]", "for", "k", ",", "v", "in", "known_chains", ".", "items", "(", ")", ":", "if", "v", "[", "\"...
Identify the connected network. This call returns a dictionary with keys chain_id, core_symbol and prefix
[ "Identify", "the", "connected", "network", ".", "This", "call", "returns", "a", "dictionary", "with", "keys", "chain_id", "core_symbol", "and", "prefix" ]
python
train
ShenggaoZhu/midict
midict/__init__.py
https://github.com/ShenggaoZhu/midict/blob/2fad2edcfb753035b443a70fe15852affae1b5bb/midict/__init__.py#L739-L830
def _MI_setitem(self, args, value): 'Separate __setitem__ function of MIMapping' indices = self.indices N = len(indices) empty = N == 0 if empty: # init the dict index1, key, index2, index1_last = MI_parse_args(self, args, allow_new=True) exist_names = [index1] item = [key] ...
[ "def", "_MI_setitem", "(", "self", ",", "args", ",", "value", ")", ":", "indices", "=", "self", ".", "indices", "N", "=", "len", "(", "indices", ")", "empty", "=", "N", "==", "0", "if", "empty", ":", "# init the dict", "index1", ",", "key", ",", "i...
Separate __setitem__ function of MIMapping
[ "Separate", "__setitem__", "function", "of", "MIMapping" ]
python
train
petl-developers/petl
petl/util/misc.py
https://github.com/petl-developers/petl/blob/1d33ca055f7e04e0d28a772041c9fd30c8d415d6/petl/util/misc.py#L68-L90
def diffvalues(t1, t2, f): """ Return the difference between the values under the given field in the two tables, e.g.:: >>> import petl as etl >>> table1 = [['foo', 'bar'], ... ['a', 1], ... ['b', 3]] >>> table2 = [['bar', 'foo'], ... ...
[ "def", "diffvalues", "(", "t1", ",", "t2", ",", "f", ")", ":", "t1v", "=", "set", "(", "values", "(", "t1", ",", "f", ")", ")", "t2v", "=", "set", "(", "values", "(", "t2", ",", "f", ")", ")", "return", "t2v", "-", "t1v", ",", "t1v", "-", ...
Return the difference between the values under the given field in the two tables, e.g.:: >>> import petl as etl >>> table1 = [['foo', 'bar'], ... ['a', 1], ... ['b', 3]] >>> table2 = [['bar', 'foo'], ... [1, 'a'], ... [...
[ "Return", "the", "difference", "between", "the", "values", "under", "the", "given", "field", "in", "the", "two", "tables", "e", ".", "g", ".", "::" ]
python
train
linkedin/naarad
src/naarad/utils.py
https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/utils.py#L671-L701
def detect_timestamp_format(timestamp): """ Given an input timestamp string, determine what format is it likely in. :param string timestamp: the timestamp string for which we need to determine format :return: best guess timestamp format """ time_formats = { 'epoch': re.compile(r'^[0-9]{10}$'), ...
[ "def", "detect_timestamp_format", "(", "timestamp", ")", ":", "time_formats", "=", "{", "'epoch'", ":", "re", ".", "compile", "(", "r'^[0-9]{10}$'", ")", ",", "'epoch_ms'", ":", "re", ".", "compile", "(", "r'^[0-9]{13}$'", ")", ",", "'epoch_fraction'", ":", ...
Given an input timestamp string, determine what format is it likely in. :param string timestamp: the timestamp string for which we need to determine format :return: best guess timestamp format
[ "Given", "an", "input", "timestamp", "string", "determine", "what", "format", "is", "it", "likely", "in", "." ]
python
valid