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
robinandeer/puzzle
puzzle/server/blueprints/variants/views.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/variants/views.py#L16-L54
def variants(case_id): """Show all variants for a case.""" filters = parse_filters() values = [value for key, value in iteritems(filters) if not isinstance(value, dict) and key != 'skip'] is_active = any(values) variants, nr_of_variants = app.db.variants( case_id, skip=...
[ "def", "variants", "(", "case_id", ")", ":", "filters", "=", "parse_filters", "(", ")", "values", "=", "[", "value", "for", "key", ",", "value", "in", "iteritems", "(", "filters", ")", "if", "not", "isinstance", "(", "value", ",", "dict", ")", "and", ...
Show all variants for a case.
[ "Show", "all", "variants", "for", "a", "case", "." ]
python
train
nerox8664/pytorch2keras
pytorch2keras/activation_layers.py
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/activation_layers.py#L9-L32
def convert_relu(params, w_name, scope_name, inputs, layers, weights, names): """ Convert relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "def", "convert_relu", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting relu ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'RELU'", "+", ...
Convert relu layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras ...
[ "Convert", "relu", "layer", "." ]
python
valid
jtwhite79/pyemu
pyemu/utils/helpers.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/helpers.py#L4002-L4087
def setup_fake_forward_run(pst,new_pst_name,org_cwd='.',bak_suffix="._bak",new_cwd='.'): """setup a fake forward run for a pst. The fake forward run simply copies existing backup versions of model output files to the outfiles pest(pp) is looking for. This is really a development option for debugging ...
[ "def", "setup_fake_forward_run", "(", "pst", ",", "new_pst_name", ",", "org_cwd", "=", "'.'", ",", "bak_suffix", "=", "\"._bak\"", ",", "new_cwd", "=", "'.'", ")", ":", "if", "new_cwd", "!=", "org_cwd", "and", "not", "os", ".", "path", ".", "exists", "("...
setup a fake forward run for a pst. The fake forward run simply copies existing backup versions of model output files to the outfiles pest(pp) is looking for. This is really a development option for debugging Parameters ---------- pst : pyemu.Pst new_pst_name : str org_cwd : str ...
[ "setup", "a", "fake", "forward", "run", "for", "a", "pst", ".", "The", "fake", "forward", "run", "simply", "copies", "existing", "backup", "versions", "of", "model", "output", "files", "to", "the", "outfiles", "pest", "(", "pp", ")", "is", "looking", "fo...
python
train
ashmastaflash/kal-wrapper
kalibrate/fn.py
https://github.com/ashmastaflash/kal-wrapper/blob/80ee03ab7bd3172ac26b769d6b442960f3424b0e/kalibrate/fn.py#L81-L90
def determine_device(kal_out): """Extract and return device from scan results.""" device = "" while device == "": for line in kal_out.splitlines(): if "Using device " in line: device = str(line.split(' ', 2)[-1]) if device == "": device = None retu...
[ "def", "determine_device", "(", "kal_out", ")", ":", "device", "=", "\"\"", "while", "device", "==", "\"\"", ":", "for", "line", "in", "kal_out", ".", "splitlines", "(", ")", ":", "if", "\"Using device \"", "in", "line", ":", "device", "=", "str", "(", ...
Extract and return device from scan results.
[ "Extract", "and", "return", "device", "from", "scan", "results", "." ]
python
train
Yubico/python-yubico
yubico/yubikey_frame.py
https://github.com/Yubico/python-yubico/blob/a72e8eddb90da6ee96e29f60912ca1f2872c9aea/yubico/yubikey_frame.py#L93-L134
def _debug_string(self, debug, data): """ Annotate a frames data, if debug is True. """ if not debug: return data if self.command in [ SLOT.CONFIG, SLOT.CONFIG2, SLOT.UPDATE1, SLOT.UPDATE2, SLOT.SWAP, ...
[ "def", "_debug_string", "(", "self", ",", "debug", ",", "data", ")", ":", "if", "not", "debug", ":", "return", "data", "if", "self", ".", "command", "in", "[", "SLOT", ".", "CONFIG", ",", "SLOT", ".", "CONFIG2", ",", "SLOT", ".", "UPDATE1", ",", "S...
Annotate a frames data, if debug is True.
[ "Annotate", "a", "frames", "data", "if", "debug", "is", "True", "." ]
python
train
saltstack/salt
salt/modules/postgres.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1858-L1880
def group_remove(groupname, user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): ''' Removes a group from the Postgres server. CLI Example: .. code-block:: bash s...
[ "def", "group_remove", "(", "groupname", ",", "user", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ",", "maintenance_db", "=", "None", ",", "password", "=", "None", ",", "runas", "=", "None", ")", ":", "return", "_role_remove", "(",...
Removes a group from the Postgres server. CLI Example: .. code-block:: bash salt '*' postgres.group_remove 'groupname'
[ "Removes", "a", "group", "from", "the", "Postgres", "server", "." ]
python
train
google/grr
grr/server/grr_response_server/hunts/implementation.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L366-L384
def _GetSubFlowNetworkLimit(self): """Get current network limit for subflows.""" subflow_network_limit = None if self.runner_args.per_client_network_limit_bytes: subflow_network_limit = self.runner_args.per_client_network_limit_bytes if self.runner_args.network_bytes_limit: remaining_netw...
[ "def", "_GetSubFlowNetworkLimit", "(", "self", ")", ":", "subflow_network_limit", "=", "None", "if", "self", ".", "runner_args", ".", "per_client_network_limit_bytes", ":", "subflow_network_limit", "=", "self", ".", "runner_args", ".", "per_client_network_limit_bytes", ...
Get current network limit for subflows.
[ "Get", "current", "network", "limit", "for", "subflows", "." ]
python
train
markovmodel/PyEMMA
pyemma/msm/api.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/msm/api.py#L322-L625
def estimate_markov_model(dtrajs, lag, reversible=True, statdist=None, count_mode='sliding', weights='empirical', sparse=False, connectivity='largest', dt_traj='1 step', maxiter=1000000, maxerr=1e-8, score_method='VA...
[ "def", "estimate_markov_model", "(", "dtrajs", ",", "lag", ",", "reversible", "=", "True", ",", "statdist", "=", "None", ",", "count_mode", "=", "'sliding'", ",", "weights", "=", "'empirical'", ",", "sparse", "=", "False", ",", "connectivity", "=", "'largest...
r""" Estimates a Markov model from discrete trajectories Returns a :class:`MaximumLikelihoodMSM` that contains the estimated transition matrix and allows to compute a large number of quantities related to Markov models. Parameters ---------- dtrajs : list containing ndarrays(dtype=int) or ndar...
[ "r", "Estimates", "a", "Markov", "model", "from", "discrete", "trajectories" ]
python
train
python-openxml/python-docx
docx/opc/package.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L165-L172
def save(self, pkg_file): """ Save this package to *pkg_file*, where *file* can be either a path to a file (a string) or a file-like object. """ for part in self.parts: part.before_marshal() PackageWriter.write(pkg_file, self.rels, self.parts)
[ "def", "save", "(", "self", ",", "pkg_file", ")", ":", "for", "part", "in", "self", ".", "parts", ":", "part", ".", "before_marshal", "(", ")", "PackageWriter", ".", "write", "(", "pkg_file", ",", "self", ".", "rels", ",", "self", ".", "parts", ")" ]
Save this package to *pkg_file*, where *file* can be either a path to a file (a string) or a file-like object.
[ "Save", "this", "package", "to", "*", "pkg_file", "*", "where", "*", "file", "*", "can", "be", "either", "a", "path", "to", "a", "file", "(", "a", "string", ")", "or", "a", "file", "-", "like", "object", "." ]
python
train
timstaley/voeventdb
voeventdb/server/restapi/v1/filter_base.py
https://github.com/timstaley/voeventdb/blob/e37b176d65fced4ca4f059109a95d6974bb8a091/voeventdb/server/restapi/v1/filter_base.py#L76-L89
def apply_filters(query, args): """ Apply all QueryFilters, validating the querystring in the process. """ pre_joins = [] for querystring_key, filter_value in args.items(multi=True): if querystring_key in filter_registry: cls_inst = filter_registry[querystring_key] qu...
[ "def", "apply_filters", "(", "query", ",", "args", ")", ":", "pre_joins", "=", "[", "]", "for", "querystring_key", ",", "filter_value", "in", "args", ".", "items", "(", "multi", "=", "True", ")", ":", "if", "querystring_key", "in", "filter_registry", ":", ...
Apply all QueryFilters, validating the querystring in the process.
[ "Apply", "all", "QueryFilters", "validating", "the", "querystring", "in", "the", "process", "." ]
python
train
simonvh/norns
norns/cfg.py
https://github.com/simonvh/norns/blob/81db0004c558f91479176daf1918b8c9473b5ee2/norns/cfg.py#L75-L80
def save(self): """ Save current state of config dictionary. """ with open(self.config_file, "w") as f: f.write(dump(self.config, default_flow_style=False))
[ "def", "save", "(", "self", ")", ":", "with", "open", "(", "self", ".", "config_file", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "dump", "(", "self", ".", "config", ",", "default_flow_style", "=", "False", ")", ")" ]
Save current state of config dictionary.
[ "Save", "current", "state", "of", "config", "dictionary", "." ]
python
train
Clivern/PyLogging
pylogging/mailer.py
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/mailer.py#L25-L43
def send(self, me, to, subject, msg): """ Send Message """ msg = MIMEText(msg) msg['Subject'] = subject msg['From'] = me msg['To'] = to server = smtplib.SMTP(self.host, self.port) server.starttls() # Check if user and password defined if self._usr ...
[ "def", "send", "(", "self", ",", "me", ",", "to", ",", "subject", ",", "msg", ")", ":", "msg", "=", "MIMEText", "(", "msg", ")", "msg", "[", "'Subject'", "]", "=", "subject", "msg", "[", "'From'", "]", "=", "me", "msg", "[", "'To'", "]", "=", ...
Send Message
[ "Send", "Message" ]
python
train
OpenHumans/open-humans-api
ohapi/api.py
https://github.com/OpenHumans/open-humans-api/blob/ca2a28cf5d55cfdae13dd222ba58c25565bdb86e/ohapi/api.py#L358-L385
def upload_file(target_filepath, metadata, access_token, base_url=OH_BASE_URL, remote_file_info=None, project_member_id=None, max_bytes=MAX_FILE_DEFAULT): """ Upload a file from a local filepath using the "direct upload" API. To learn more about this API endpoint see: * h...
[ "def", "upload_file", "(", "target_filepath", ",", "metadata", ",", "access_token", ",", "base_url", "=", "OH_BASE_URL", ",", "remote_file_info", "=", "None", ",", "project_member_id", "=", "None", ",", "max_bytes", "=", "MAX_FILE_DEFAULT", ")", ":", "with", "op...
Upload a file from a local filepath using the "direct upload" API. To learn more about this API endpoint see: * https://www.openhumans.org/direct-sharing/on-site-data-upload/ * https://www.openhumans.org/direct-sharing/oauth2-data-upload/ :param target_filepath: This field is the filepath of the file t...
[ "Upload", "a", "file", "from", "a", "local", "filepath", "using", "the", "direct", "upload", "API", ".", "To", "learn", "more", "about", "this", "API", "endpoint", "see", ":", "*", "https", ":", "//", "www", ".", "openhumans", ".", "org", "/", "direct"...
python
train
dropbox/pyannotate
pyannotate_tools/annotations/infer.py
https://github.com/dropbox/pyannotate/blob/d128c76b8a86f208e5c78716f2a917003650cebc/pyannotate_tools/annotations/infer.py#L194-L210
def merge_items(items): # type: (List[AbstractType]) -> List[AbstractType] """Merge union items that can be merged.""" result = [] while items: item = items.pop() merged = None for i, other in enumerate(items): merged = merged_type(item, other) if merged: ...
[ "def", "merge_items", "(", "items", ")", ":", "# type: (List[AbstractType]) -> List[AbstractType]", "result", "=", "[", "]", "while", "items", ":", "item", "=", "items", ".", "pop", "(", ")", "merged", "=", "None", "for", "i", ",", "other", "in", "enumerate"...
Merge union items that can be merged.
[ "Merge", "union", "items", "that", "can", "be", "merged", "." ]
python
train
mattiaslinnap/django-partial-index
partial_index/mixins.py
https://github.com/mattiaslinnap/django-partial-index/blob/6e60fd9484f95499587365fda34a881050bcd804/partial_index/mixins.py#L41-L89
def validate_partial_unique(self): """Check partial unique constraints on the model and raise ValidationError if any failed. We want to check if another instance already exists with the fields mentioned in idx.fields, but only if idx.where matches. But can't just check for the fields in idx.fie...
[ "def", "validate_partial_unique", "(", "self", ")", ":", "# Find PartialIndexes with unique=True defined on model.", "unique_idxs", "=", "[", "idx", "for", "idx", "in", "self", ".", "_meta", ".", "indexes", "if", "isinstance", "(", "idx", ",", "PartialIndex", ")", ...
Check partial unique constraints on the model and raise ValidationError if any failed. We want to check if another instance already exists with the fields mentioned in idx.fields, but only if idx.where matches. But can't just check for the fields in idx.fields - idx.where may refer to other fields on t...
[ "Check", "partial", "unique", "constraints", "on", "the", "model", "and", "raise", "ValidationError", "if", "any", "failed", "." ]
python
train
edx/edx-enterprise
enterprise/admin/views.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L487-L501
def get_users_by_email(cls, emails): """ Accept a list of emails, and separate them into users that exist on OpenEdX and users who don't. Args: emails: An iterable of email addresses to split between existing and nonexisting Returns: users: Queryset of users who...
[ "def", "get_users_by_email", "(", "cls", ",", "emails", ")", ":", "users", "=", "User", ".", "objects", ".", "filter", "(", "email__in", "=", "emails", ")", "present_emails", "=", "users", ".", "values_list", "(", "'email'", ",", "flat", "=", "True", ")"...
Accept a list of emails, and separate them into users that exist on OpenEdX and users who don't. Args: emails: An iterable of email addresses to split between existing and nonexisting Returns: users: Queryset of users who exist in the OpenEdX platform and who were in the list o...
[ "Accept", "a", "list", "of", "emails", "and", "separate", "them", "into", "users", "that", "exist", "on", "OpenEdX", "and", "users", "who", "don", "t", "." ]
python
valid
googleapis/google-cloud-python
datastore/google/cloud/datastore/batch.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/batch.py#L107-L116
def _add_partial_key_entity_pb(self): """Adds a new mutation for an entity with a partial key. :rtype: :class:`.entity_pb2.Entity` :returns: The newly created entity protobuf that will be updated and sent with a commit. """ new_mutation = _datastore_pb2.Mutatio...
[ "def", "_add_partial_key_entity_pb", "(", "self", ")", ":", "new_mutation", "=", "_datastore_pb2", ".", "Mutation", "(", ")", "self", ".", "_mutations", ".", "append", "(", "new_mutation", ")", "return", "new_mutation", ".", "insert" ]
Adds a new mutation for an entity with a partial key. :rtype: :class:`.entity_pb2.Entity` :returns: The newly created entity protobuf that will be updated and sent with a commit.
[ "Adds", "a", "new", "mutation", "for", "an", "entity", "with", "a", "partial", "key", "." ]
python
train
behave/behave-django
behave_django/environment.py
https://github.com/behave/behave-django/blob/7b56c8f38dede3601e31c72b5921785c148434d4/behave_django/environment.py#L71-L85
def setup_fixtures(self, context): """ Sets up fixtures """ if getattr(context, 'fixtures', None): context.test.fixtures = copy(context.fixtures) if getattr(context, 'reset_sequences', None): context.test.reset_sequences = context.reset_sequences ...
[ "def", "setup_fixtures", "(", "self", ",", "context", ")", ":", "if", "getattr", "(", "context", ",", "'fixtures'", ",", "None", ")", ":", "context", ".", "test", ".", "fixtures", "=", "copy", "(", "context", ".", "fixtures", ")", "if", "getattr", "(",...
Sets up fixtures
[ "Sets", "up", "fixtures" ]
python
train
pyroscope/pyrocore
src/pyrocore/torrent/engine.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/torrent/engine.py#L214-L225
def lookup(cls, name): """ Try to find field C{name}. @return: Field descriptions, see C{matching.ConditionParser} for details. """ try: field = cls.FIELDS[name] except KeyError: # Is it a custom attribute? field = TorrentProxy.add_manifol...
[ "def", "lookup", "(", "cls", ",", "name", ")", ":", "try", ":", "field", "=", "cls", ".", "FIELDS", "[", "name", "]", "except", "KeyError", ":", "# Is it a custom attribute?", "field", "=", "TorrentProxy", ".", "add_manifold_attribute", "(", "name", ")", "...
Try to find field C{name}. @return: Field descriptions, see C{matching.ConditionParser} for details.
[ "Try", "to", "find", "field", "C", "{", "name", "}", "." ]
python
train
ericmjl/nxviz
nxviz/plots.py
https://github.com/ericmjl/nxviz/blob/6ea5823a8030a686f165fbe37d7a04d0f037ecc9/nxviz/plots.py#L594-L650
def compute_node_label_positions(self): """ Uses the get_cartesian function to compute the positions of each node label in the Circos plot. This method is always called after the compute_node_positions method, so that the plot_radius is pre-computed. This will also add a...
[ "def", "compute_node_label_positions", "(", "self", ")", ":", "self", ".", "init_node_label_meta", "(", ")", "for", "node", "in", "self", ".", "nodes", ":", "# Define radius 'radius' and circumference 'theta'", "theta", "=", "node_theta", "(", "self", ".", "nodes", ...
Uses the get_cartesian function to compute the positions of each node label in the Circos plot. This method is always called after the compute_node_positions method, so that the plot_radius is pre-computed. This will also add a new attribute, `node_label_rotation` to the object ...
[ "Uses", "the", "get_cartesian", "function", "to", "compute", "the", "positions", "of", "each", "node", "label", "in", "the", "Circos", "plot", "." ]
python
train
aliyun/aliyun-odps-python-sdk
odps/df/expr/strings.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/df/expr/strings.py#L405-L420
def _replace(expr, pat, repl, n=-1, case=True, flags=0, regex=True): """ Replace occurrence of pattern/regex in the sequence or scalar with some other string. Equivalent to str.replace() :param expr: :param pat: Character sequence or regular expression :param repl: Replacement :param n: Num...
[ "def", "_replace", "(", "expr", ",", "pat", ",", "repl", ",", "n", "=", "-", "1", ",", "case", "=", "True", ",", "flags", "=", "0", ",", "regex", "=", "True", ")", ":", "return", "_string_op", "(", "expr", ",", "Replace", ",", "_pat", "=", "pat...
Replace occurrence of pattern/regex in the sequence or scalar with some other string. Equivalent to str.replace() :param expr: :param pat: Character sequence or regular expression :param repl: Replacement :param n: Number of replacements to make from start :param case: if True, case sensitive ...
[ "Replace", "occurrence", "of", "pattern", "/", "regex", "in", "the", "sequence", "or", "scalar", "with", "some", "other", "string", ".", "Equivalent", "to", "str", ".", "replace", "()" ]
python
train
Azure/azure-cli-extensions
src/alias/azext_alias/util.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/alias/azext_alias/util.py#L210-L225
def filter_alias_create_namespace(namespace): """ Filter alias name and alias command inside alias create namespace to appropriate strings. Args namespace: The alias create namespace. Returns: Filtered namespace where excessive whitespaces are removed in strings. """ def filter...
[ "def", "filter_alias_create_namespace", "(", "namespace", ")", ":", "def", "filter_string", "(", "s", ")", ":", "return", "' '", ".", "join", "(", "s", ".", "strip", "(", ")", ".", "split", "(", ")", ")", "namespace", ".", "alias_name", "=", "filter_stri...
Filter alias name and alias command inside alias create namespace to appropriate strings. Args namespace: The alias create namespace. Returns: Filtered namespace where excessive whitespaces are removed in strings.
[ "Filter", "alias", "name", "and", "alias", "command", "inside", "alias", "create", "namespace", "to", "appropriate", "strings", "." ]
python
train
INM-6/hybridLFPy
examples/Hagen_et_al_2016_cercor/figure_06.py
https://github.com/INM-6/hybridLFPy/blob/c38bdf38982c4624c2f70caeb50c40f1d5980abd/examples/Hagen_et_al_2016_cercor/figure_06.py#L284-L394
def plot_multi_scale_output_b(fig, X='L5E'): '''docstring me''' show_ax_labels = True show_insets = False show_images = False T=[800, 1000] T_inset=[900, 920] left = 0.075 bottom = 0.05 top = 0.475 right = 0.95 axwidth = 0.16 numcols = 4 insetwidth = axwidth/2...
[ "def", "plot_multi_scale_output_b", "(", "fig", ",", "X", "=", "'L5E'", ")", ":", "show_ax_labels", "=", "True", "show_insets", "=", "False", "show_images", "=", "False", "T", "=", "[", "800", ",", "1000", "]", "T_inset", "=", "[", "900", ",", "920", "...
docstring me
[ "docstring", "me" ]
python
train
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L71-L122
def load_constants(): """Load physical constants to simulate the earth-sun system""" # The universal gravitational constant # https://en.wikipedia.org/wiki/Gravitational_constant G: float = 6.67408E-11 # The names of the celestial bodies body_name = \ ['sun', 'moon', ...
[ "def", "load_constants", "(", ")", ":", "# The universal gravitational constant", "# https://en.wikipedia.org/wiki/Gravitational_constant", "G", ":", "float", "=", "6.67408E-11", "# The names of the celestial bodies", "body_name", "=", "[", "'sun'", ",", "'moon'", ",", "'merc...
Load physical constants to simulate the earth-sun system
[ "Load", "physical", "constants", "to", "simulate", "the", "earth", "-", "sun", "system" ]
python
train
eandersson/amqpstorm
amqpstorm/basic.py
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L143-L160
def cancel(self, consumer_tag=''): """Cancel a queue consumer. :param str consumer_tag: Consumer tag :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection ...
[ "def", "cancel", "(", "self", ",", "consumer_tag", "=", "''", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "consumer_tag", ")", ":", "raise", "AMQPInvalidArgument", "(", "'consumer_tag should be a string'", ")", "cancel_frame", "=", "specificatio...
Cancel a queue consumer. :param str consumer_tag: Consumer tag :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an...
[ "Cancel", "a", "queue", "consumer", "." ]
python
train
rochacbruno/manage
manage/cli.py
https://github.com/rochacbruno/manage/blob/e904c451862f036f4be8723df5704a9844103c74/manage/cli.py#L95-L100
def debug(version=False): """Shows the parsed manage file -V shows version""" if version: print(__version__) return print(json.dumps(MANAGE_DICT, indent=2))
[ "def", "debug", "(", "version", "=", "False", ")", ":", "if", "version", ":", "print", "(", "__version__", ")", "return", "print", "(", "json", ".", "dumps", "(", "MANAGE_DICT", ",", "indent", "=", "2", ")", ")" ]
Shows the parsed manage file -V shows version
[ "Shows", "the", "parsed", "manage", "file", "-", "V", "shows", "version" ]
python
train
KushalP/serfclient-py
serfclient/connection.py
https://github.com/KushalP/serfclient-py/blob/6892fb0a4497d1033bea6f625d57959b818b6964/serfclient/connection.py#L139-L146
def handshake(self): """ Sets up the connection with the Serf agent and does the initial handshake. """ if self._socket is None: self._socket = self._connect() return self.call('handshake', {"Version": 1}, expect_body=False)
[ "def", "handshake", "(", "self", ")", ":", "if", "self", ".", "_socket", "is", "None", ":", "self", ".", "_socket", "=", "self", ".", "_connect", "(", ")", "return", "self", ".", "call", "(", "'handshake'", ",", "{", "\"Version\"", ":", "1", "}", "...
Sets up the connection with the Serf agent and does the initial handshake.
[ "Sets", "up", "the", "connection", "with", "the", "Serf", "agent", "and", "does", "the", "initial", "handshake", "." ]
python
train
rmohr/static3
static.py
https://github.com/rmohr/static3/blob/e5f88c5e91789bd4db7fde0cf59e4a15c3326f11/static.py#L212-L215
def _conditions(self, full_path, environ): """Return a tuple of etag, last_modified by mtime from stat.""" mtime = stat(full_path).st_mtime return str(mtime), rfc822.formatdate(mtime)
[ "def", "_conditions", "(", "self", ",", "full_path", ",", "environ", ")", ":", "mtime", "=", "stat", "(", "full_path", ")", ".", "st_mtime", "return", "str", "(", "mtime", ")", ",", "rfc822", ".", "formatdate", "(", "mtime", ")" ]
Return a tuple of etag, last_modified by mtime from stat.
[ "Return", "a", "tuple", "of", "etag", "last_modified", "by", "mtime", "from", "stat", "." ]
python
train
AguaClara/aguaclara
aguaclara/core/physchem.py
https://github.com/AguaClara/aguaclara/blob/8dd4e734768b166a7fc2b60388a24df2f93783fc/aguaclara/core/physchem.py#L689-L698
def headloss_kozeny(Length, Diam, Vel, Porosity, Nu): """Return the Carmen Kozeny Sand Bed head loss.""" #Checking input validity ut.check_range([Length, ">0", "Length"], [Diam, ">0", "Diam"], [Vel, ">0", "Velocity"], [Nu, ">0", "Nu"], [Porosity, "0-1", "Porosity"]) ...
[ "def", "headloss_kozeny", "(", "Length", ",", "Diam", ",", "Vel", ",", "Porosity", ",", "Nu", ")", ":", "#Checking input validity", "ut", ".", "check_range", "(", "[", "Length", ",", "\">0\"", ",", "\"Length\"", "]", ",", "[", "Diam", ",", "\">0\"", ",",...
Return the Carmen Kozeny Sand Bed head loss.
[ "Return", "the", "Carmen", "Kozeny", "Sand", "Bed", "head", "loss", "." ]
python
train
fabric-bolt/fabric-bolt
fabric_bolt/web_hooks/tasks.py
https://github.com/fabric-bolt/fabric-bolt/blob/0f434783026f1b9ce16a416fa496d76921fe49ca/fabric_bolt/web_hooks/tasks.py#L23-L30
def run(self, target, payload, instance=None, hook_id=None, **kwargs): """ target: the url to receive the payload. payload: a python primitive data structure instance: a possibly null "trigger" instance hook: the defining Hook object (useful for removing) "...
[ "def", "run", "(", "self", ",", "target", ",", "payload", ",", "instance", "=", "None", ",", "hook_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "post_data", "(", "target", ",", "payload", ",", "hook_id", ")" ]
target: the url to receive the payload. payload: a python primitive data structure instance: a possibly null "trigger" instance hook: the defining Hook object (useful for removing)
[ "target", ":", "the", "url", "to", "receive", "the", "payload", ".", "payload", ":", "a", "python", "primitive", "data", "structure", "instance", ":", "a", "possibly", "null", "trigger", "instance", "hook", ":", "the", "defining", "Hook", "object", "(", "u...
python
train
mdgoldberg/sportsref
sportsref/nba/players.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/players.py#L185-L187
def stats_shooting(self, kind='R', summary=False): """Returns a DataFrame of shooting stats.""" return self._get_stats_table('shooting', kind=kind, summary=summary)
[ "def", "stats_shooting", "(", "self", ",", "kind", "=", "'R'", ",", "summary", "=", "False", ")", ":", "return", "self", ".", "_get_stats_table", "(", "'shooting'", ",", "kind", "=", "kind", ",", "summary", "=", "summary", ")" ]
Returns a DataFrame of shooting stats.
[ "Returns", "a", "DataFrame", "of", "shooting", "stats", "." ]
python
test
andrey-git/pysensibo
pysensibo/__init__.py
https://github.com/andrey-git/pysensibo/blob/c471c99ee64bbcc78f3a10aabc0e3b326a1f64f8/pysensibo/__init__.py#L58-L62
def async_get_ac_state_log(self, uid, log_id, fields='*'): """Get a specific log entry.""" return ( yield from self._get('/pods/{}/acStates/{}'.format(uid, log_id), fields=fields))
[ "def", "async_get_ac_state_log", "(", "self", ",", "uid", ",", "log_id", ",", "fields", "=", "'*'", ")", ":", "return", "(", "yield", "from", "self", ".", "_get", "(", "'/pods/{}/acStates/{}'", ".", "format", "(", "uid", ",", "log_id", ")", ",", "fields"...
Get a specific log entry.
[ "Get", "a", "specific", "log", "entry", "." ]
python
train
RRZE-HPC/kerncraft
kerncraft/kernel.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L454-L465
def global_iterator(self): """ Return global iterator sympy expression """ global_iterator = sympy.Integer(0) total_length = sympy.Integer(1) for var_name, start, end, incr in reversed(self._loop_stack): loop_var = symbol_pos_int(var_name) length =...
[ "def", "global_iterator", "(", "self", ")", ":", "global_iterator", "=", "sympy", ".", "Integer", "(", "0", ")", "total_length", "=", "sympy", ".", "Integer", "(", "1", ")", "for", "var_name", ",", "start", ",", "end", ",", "incr", "in", "reversed", "(...
Return global iterator sympy expression
[ "Return", "global", "iterator", "sympy", "expression" ]
python
test
SiLab-Bonn/basil
basil/utils/sim/Protocol.py
https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/basil/utils/sim/Protocol.py#L80-L86
def _get_next_obj(self, length): """Assumes we've already read the object length""" data = b'' while len(data) < length: data += self.sock.recv(length - len(data)) return pickle.loads(data)
[ "def", "_get_next_obj", "(", "self", ",", "length", ")", ":", "data", "=", "b''", "while", "len", "(", "data", ")", "<", "length", ":", "data", "+=", "self", ".", "sock", ".", "recv", "(", "length", "-", "len", "(", "data", ")", ")", "return", "p...
Assumes we've already read the object length
[ "Assumes", "we", "ve", "already", "read", "the", "object", "length" ]
python
train
pandas-dev/pandas
pandas/core/series.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L1940-L2009
def idxmax(self, axis=0, skipna=True, *args, **kwargs): """ Return the row label of the maximum value. If multiple values equal the maximum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA...
[ "def", "idxmax", "(", "self", ",", "axis", "=", "0", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "skipna", "=", "nv", ".", "validate_argmax_with_skipna", "(", "skipna", ",", "args", ",", "kwargs", ")", "i", "=",...
Return the row label of the maximum value. If multiple values equal the maximum, the first row label with that value is returned. Parameters ---------- skipna : bool, default True Exclude NA/null values. If the entire Series is NA, the result will be NA....
[ "Return", "the", "row", "label", "of", "the", "maximum", "value", "." ]
python
train
ReFirmLabs/binwalk
src/binwalk/core/settings.py
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L187-L201
def _system_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/b...
[ "def", "_system_path", "(", "self", ",", "subdir", ",", "basename", "=", "''", ")", ":", "try", ":", "return", "self", ".", "_file_path", "(", "os", ".", "path", ".", "join", "(", "self", ".", "system_dir", ",", "subdir", ")", ",", "basename", ")", ...
Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basename' file.
[ "Gets", "the", "full", "path", "to", "the", "subdir", "/", "basename", "file", "in", "the", "system", "binwalk", "directory", "." ]
python
train
malramsay64/experi
src/experi/run.py
https://github.com/malramsay64/experi/blob/7159644df0420e4a395c87c0c08e11567f401443/src/experi/run.py#L289-L295
def read_file(filename: PathLike = "experiment.yml") -> Dict[str, Any]: """Read and parse yaml file.""" logger.debug("Input file: %s", filename) with open(filename, "r") as stream: structure = yaml.safe_load(stream) return structure
[ "def", "read_file", "(", "filename", ":", "PathLike", "=", "\"experiment.yml\"", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "logger", ".", "debug", "(", "\"Input file: %s\"", ",", "filename", ")", "with", "open", "(", "filename", ",", "\"r\"", ...
Read and parse yaml file.
[ "Read", "and", "parse", "yaml", "file", "." ]
python
train
tomer8007/kik-bot-api-unofficial
kik_unofficial/client.py
https://github.com/tomer8007/kik-bot-api-unofficial/blob/2ae5216bc05e7099a41895382fc8e428a7a5c3ac/kik_unofficial/client.py#L399-L407
def change_display_name(self, first_name, last_name): """ Changes the display name :param first_name: The first name :param last_name: The last name """ log.info("[+] Changing the display name to '{} {}'".format(first_name, last_name)) return self._send_xmpp_elem...
[ "def", "change_display_name", "(", "self", ",", "first_name", ",", "last_name", ")", ":", "log", ".", "info", "(", "\"[+] Changing the display name to '{} {}'\"", ".", "format", "(", "first_name", ",", "last_name", ")", ")", "return", "self", ".", "_send_xmpp_elem...
Changes the display name :param first_name: The first name :param last_name: The last name
[ "Changes", "the", "display", "name" ]
python
train
saltstack/salt
salt/modules/openvswitch.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openvswitch.py#L147-L165
def bridge_list(): ''' Lists all existing real and fake bridges. Returns: List of bridges (or empty list), False on failure. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.bridge_list ''' cmd = 'ovs-vsctl list-br' result = __salt...
[ "def", "bridge_list", "(", ")", ":", "cmd", "=", "'ovs-vsctl list-br'", "result", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "result", "[", "'retcode'", "]", "stdout", "=", "result", "[", "'stdout'", "]", "return", "_stdou...
Lists all existing real and fake bridges. Returns: List of bridges (or empty list), False on failure. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.bridge_list
[ "Lists", "all", "existing", "real", "and", "fake", "bridges", "." ]
python
train
jilljenn/tryalgo
tryalgo/skip_list.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/skip_list.py#L55-L67
def getkth(self, k): "starts from 0" if k >= len(self): raise IndexError k += 1 # self has index -1 h = len(self.next) - 1 x = self while k: while x.next[h] is None or x.count[h] > k: h -= 1 k -= x.count[h] ...
[ "def", "getkth", "(", "self", ",", "k", ")", ":", "if", "k", ">=", "len", "(", "self", ")", ":", "raise", "IndexError", "k", "+=", "1", "# self has index -1", "h", "=", "len", "(", "self", ".", "next", ")", "-", "1", "x", "=", "self", "while", ...
starts from 0
[ "starts", "from", "0" ]
python
train
RedFantom/ttkthemes
ttkthemes/themed_tk.py
https://github.com/RedFantom/ttkthemes/blob/e7fc354c02faf0e3eb4842d7f44131a1c43dd299/ttkthemes/themed_tk.py#L105-L113
def cget(self, k): """cget redirect to support additional options""" if k == "themebg": return self._themebg elif k == "toplevel": return self._toplevel elif k == "theme": return self.current_theme return tk.Tk.cget(self, k)
[ "def", "cget", "(", "self", ",", "k", ")", ":", "if", "k", "==", "\"themebg\"", ":", "return", "self", ".", "_themebg", "elif", "k", "==", "\"toplevel\"", ":", "return", "self", ".", "_toplevel", "elif", "k", "==", "\"theme\"", ":", "return", "self", ...
cget redirect to support additional options
[ "cget", "redirect", "to", "support", "additional", "options" ]
python
train
pywbem/pywbem
pywbem/mof_compiler.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/mof_compiler.py#L1261-L1268
def p_stringValueList(p): """stringValueList : stringValue | stringValueList stringValue """ if len(p) == 2: p[0] = _fixStringValue(p[1], p) else: p[0] = p[1] + _fixStringValue(p[2], p)
[ "def", "p_stringValueList", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "_fixStringValue", "(", "p", "[", "1", "]", ",", "p", ")", "else", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+",...
stringValueList : stringValue | stringValueList stringValue
[ "stringValueList", ":", "stringValue", "|", "stringValueList", "stringValue" ]
python
train
odlgroup/odl
odl/util/graphics.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/util/graphics.py#L102-L482
def show_discrete_data(values, grid, title=None, method='', force_show=False, fig=None, **kwargs): """Display a discrete 1d or 2d function. Parameters ---------- values : `numpy.ndarray` The values to visualize. grid : `RectGrid` or `RectPartition` Grid of th...
[ "def", "show_discrete_data", "(", "values", ",", "grid", ",", "title", "=", "None", ",", "method", "=", "''", ",", "force_show", "=", "False", ",", "fig", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Importing pyplot takes ~2 sec, only import when needed...
Display a discrete 1d or 2d function. Parameters ---------- values : `numpy.ndarray` The values to visualize. grid : `RectGrid` or `RectPartition` Grid of the values. title : string, optional Set the title of the figure. method : string, optional 1d methods: ...
[ "Display", "a", "discrete", "1d", "or", "2d", "function", "." ]
python
train
user-cont/conu
conu/apidefs/filesystem.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/apidefs/filesystem.py#L87-L104
def copy_from(self, src, dest): """ copy a file or a directory from container or image to host system. If you are copying directories, the target directory must not exist (this function is using `shutil.copytree` to copy directories and that's a requirement of the function). In case the ...
[ "def", "copy_from", "(", "self", ",", "src", ",", "dest", ")", ":", "p", "=", "self", ".", "p", "(", "src", ")", "if", "os", ".", "path", ".", "isfile", "(", "p", ")", ":", "logger", ".", "info", "(", "\"copying file %s to %s\"", ",", "p", ",", ...
copy a file or a directory from container or image to host system. If you are copying directories, the target directory must not exist (this function is using `shutil.copytree` to copy directories and that's a requirement of the function). In case the directory exists, OSError on python 2 or Fil...
[ "copy", "a", "file", "or", "a", "directory", "from", "container", "or", "image", "to", "host", "system", ".", "If", "you", "are", "copying", "directories", "the", "target", "directory", "must", "not", "exist", "(", "this", "function", "is", "using", "shuti...
python
train
BoboTiG/python-mss
mss/screenshot.py
https://github.com/BoboTiG/python-mss/blob/56347f781edb38a0e7a5104080bd683f49c6f074/mss/screenshot.py#L142-L157
def pixel(self, coord_x, coord_y): # type: (int, int) -> Pixel """ Returns the pixel value at a given position. :param int coord_x: The x coordinate. :param int coord_y: The y coordinate. :return tuple: The pixel value as (R, G, B). """ try: ...
[ "def", "pixel", "(", "self", ",", "coord_x", ",", "coord_y", ")", ":", "# type: (int, int) -> Pixel", "try", ":", "return", "self", ".", "pixels", "[", "coord_y", "]", "[", "coord_x", "]", "# type: ignore", "except", "IndexError", ":", "raise", "ScreenShotErro...
Returns the pixel value at a given position. :param int coord_x: The x coordinate. :param int coord_y: The y coordinate. :return tuple: The pixel value as (R, G, B).
[ "Returns", "the", "pixel", "value", "at", "a", "given", "position", "." ]
python
train
samjabrahams/anchorhub
anchorhub/lib/lazyregex.py
https://github.com/samjabrahams/anchorhub/blob/5ade359b08297d4003a5f477389c01de9e634b54/anchorhub/lib/lazyregex.py#L74-L80
def _create_regex_if_none(self): """ Private function. Checks to see if the local regular expression object has been created yet """ if self._regex is None: self._regex = re.compile(self._pattern, re.UNICODE)
[ "def", "_create_regex_if_none", "(", "self", ")", ":", "if", "self", ".", "_regex", "is", "None", ":", "self", ".", "_regex", "=", "re", ".", "compile", "(", "self", ".", "_pattern", ",", "re", ".", "UNICODE", ")" ]
Private function. Checks to see if the local regular expression object has been created yet
[ "Private", "function", ".", "Checks", "to", "see", "if", "the", "local", "regular", "expression", "object", "has", "been", "created", "yet" ]
python
train
isislovecruft/python-gnupg
pretty_bad_protocol/_parsers.py
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/_parsers.py#L143-L154
def _hyphenate(input, add_prefix=False): """Change underscores to hyphens so that object attributes can be easily tranlated to GPG option names. :param str input: The attribute to hyphenate. :param bool add_prefix: If True, add leading hyphens to the input. :rtype: str :return: The ``input`` wi...
[ "def", "_hyphenate", "(", "input", ",", "add_prefix", "=", "False", ")", ":", "ret", "=", "'--'", "if", "add_prefix", "else", "''", "ret", "+=", "input", ".", "replace", "(", "'_'", ",", "'-'", ")", "return", "ret" ]
Change underscores to hyphens so that object attributes can be easily tranlated to GPG option names. :param str input: The attribute to hyphenate. :param bool add_prefix: If True, add leading hyphens to the input. :rtype: str :return: The ``input`` with underscores changed to hyphens.
[ "Change", "underscores", "to", "hyphens", "so", "that", "object", "attributes", "can", "be", "easily", "tranlated", "to", "GPG", "option", "names", "." ]
python
train
inasafe/inasafe
safe/gui/widgets/dock.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L501-L545
def save_auxiliary_files(self, layer, destination): """Save auxiliary files when using the 'save as' function. If some auxiliary files (.xml, .json) exist, this function will copy them when the 'save as' function is used on the layer. :param layer: The layer which has been saved as. ...
[ "def", "save_auxiliary_files", "(", "self", ",", "layer", ",", "destination", ")", ":", "enable_busy_cursor", "(", ")", "auxiliary_files", "=", "[", "'xml'", ",", "'json'", "]", "for", "auxiliary_file", "in", "auxiliary_files", ":", "source_basename", "=", "os",...
Save auxiliary files when using the 'save as' function. If some auxiliary files (.xml, .json) exist, this function will copy them when the 'save as' function is used on the layer. :param layer: The layer which has been saved as. :type layer: QgsMapLayer :param destination: The...
[ "Save", "auxiliary", "files", "when", "using", "the", "save", "as", "function", "." ]
python
train
glomex/gcdt
gcdt/kumo_start_stop.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L110-L136
def _stop_ecs_services(awsclient, services, template, parameters, wait=True): """Helper to change desiredCount of ECS services to zero. By default it waits for this to complete. Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html :param awsclient: :param services: ...
[ "def", "_stop_ecs_services", "(", "awsclient", ",", "services", ",", "template", ",", "parameters", ",", "wait", "=", "True", ")", ":", "if", "len", "(", "services", ")", "==", "0", ":", "return", "client_ecs", "=", "awsclient", ".", "get_client", "(", "...
Helper to change desiredCount of ECS services to zero. By default it waits for this to complete. Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html :param awsclient: :param services: :param template: the cloudformation template :param parameters: the parameters u...
[ "Helper", "to", "change", "desiredCount", "of", "ECS", "services", "to", "zero", ".", "By", "default", "it", "waits", "for", "this", "to", "complete", ".", "Docs", "here", ":", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "c...
python
train
lincolnloop/django-dynamic-raw-id
dynamic_raw_id/widgets.py
https://github.com/lincolnloop/django-dynamic-raw-id/blob/4bf234f4a9d99daf44141205c0948222442f4957/dynamic_raw_id/widgets.py#L23-L76
def render(self, name, value, attrs=None, multi=False, renderer=None): """ Django <= 1.10 variant. """ DJANGO_111_OR_UP = (VERSION[0] == 1 and VERSION[1] >= 11) or ( VERSION[0] >= 2 ) if DJANGO_111_OR_UP: return super(DynamicRawIDWidget, self).rend...
[ "def", "render", "(", "self", ",", "name", ",", "value", ",", "attrs", "=", "None", ",", "multi", "=", "False", ",", "renderer", "=", "None", ")", ":", "DJANGO_111_OR_UP", "=", "(", "VERSION", "[", "0", "]", "==", "1", "and", "VERSION", "[", "1", ...
Django <= 1.10 variant.
[ "Django", "<", "=", "1", ".", "10", "variant", "." ]
python
train
dask/dask-ml
dask_ml/naive_bayes.py
https://github.com/dask/dask-ml/blob/cc4837c2c2101f9302cac38354b55754263cd1f3/dask_ml/naive_bayes.py#L78-L94
def predict_log_proba(self, X): """ Return log-probability estimates for the test vector X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- C : array-like, shape = [n_samples, n_classes] Returns the log-pro...
[ "def", "predict_log_proba", "(", "self", ",", "X", ")", ":", "jll", "=", "self", ".", "_joint_log_likelihood", "(", "X", ")", "# normalize by P(x) = P(f_1, ..., f_n)", "log_prob_x", "=", "logsumexp", "(", "jll", ",", "axis", "=", "1", ")", "return", "jll", "...
Return log-probability estimates for the test vector X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- C : array-like, shape = [n_samples, n_classes] Returns the log-probability of the samples for each class in ...
[ "Return", "log", "-", "probability", "estimates", "for", "the", "test", "vector", "X", ".", "Parameters", "----------", "X", ":", "array", "-", "like", "shape", "=", "[", "n_samples", "n_features", "]", "Returns", "-------", "C", ":", "array", "-", "like",...
python
train
lago-project/lago
lago/prefix.py
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/prefix.py#L133-L141
def _save_metadata(self): """ Write this prefix metadata to disk Returns: None """ with open(self.paths.metadata(), 'w') as metadata_fd: utils.json_dump(self.metadata, metadata_fd)
[ "def", "_save_metadata", "(", "self", ")", ":", "with", "open", "(", "self", ".", "paths", ".", "metadata", "(", ")", ",", "'w'", ")", "as", "metadata_fd", ":", "utils", ".", "json_dump", "(", "self", ".", "metadata", ",", "metadata_fd", ")" ]
Write this prefix metadata to disk Returns: None
[ "Write", "this", "prefix", "metadata", "to", "disk" ]
python
train
gwastro/pycbc
pycbc/io/record.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/io/record.py#L1840-L1843
def spin1_a(self): """Returns the dimensionless spin magnitude of mass 1.""" return coordinates.cartesian_to_spherical_rho( self.spin1x, self.spin1y, self.spin1z)
[ "def", "spin1_a", "(", "self", ")", ":", "return", "coordinates", ".", "cartesian_to_spherical_rho", "(", "self", ".", "spin1x", ",", "self", ".", "spin1y", ",", "self", ".", "spin1z", ")" ]
Returns the dimensionless spin magnitude of mass 1.
[ "Returns", "the", "dimensionless", "spin", "magnitude", "of", "mass", "1", "." ]
python
train
radujica/baloo
baloo/weld/weld_joins.py
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/weld/weld_joins.py#L110-L156
def weld_merge_join(arrays_self, weld_types_self, arrays_other, weld_types_other, how, is_on_sorted, is_on_unique, readable_text): """Applies merge-join on the arrays returning indices from each to keep in the resulting Parameters ---------- arrays_self : list of (numpy.ndarray or W...
[ "def", "weld_merge_join", "(", "arrays_self", ",", "weld_types_self", ",", "arrays_other", ",", "weld_types_other", ",", "how", ",", "is_on_sorted", ",", "is_on_unique", ",", "readable_text", ")", ":", "assert", "is_on_unique", "weld_obj_vec_of_struct_self", "=", "wel...
Applies merge-join on the arrays returning indices from each to keep in the resulting Parameters ---------- arrays_self : list of (numpy.ndarray or WeldObject) Columns from the self DataFrame on which to join. weld_types_self : list of WeldType Corresponding Weld types. arrays_other...
[ "Applies", "merge", "-", "join", "on", "the", "arrays", "returning", "indices", "from", "each", "to", "keep", "in", "the", "resulting" ]
python
train
saltstack/salt
salt/states/win_dism.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_dism.py#L368-L443
def package_removed(name, image=None, restart=False): ''' Uninstall a package Args: name (str): The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. This can also be the n...
[ "def", "package_removed", "(", "name", ",", "image", "=", "None", ",", "restart", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "# Fa...
Uninstall a package Args: name (str): The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. This can also be the name of a package as listed in ``dism.installed_package...
[ "Uninstall", "a", "package" ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/wheel.py#L193-L206
def root_is_purelib(name, wheeldir): """ Return True if the extracted wheel in wheeldir should go into purelib. """ name_folded = name.replace("-", "_") for item in os.listdir(wheeldir): match = dist_info_re.match(item) if match and match.group('name') == name_folded: wit...
[ "def", "root_is_purelib", "(", "name", ",", "wheeldir", ")", ":", "name_folded", "=", "name", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "for", "item", "in", "os", ".", "listdir", "(", "wheeldir", ")", ":", "match", "=", "dist_info_re", ".", "mat...
Return True if the extracted wheel in wheeldir should go into purelib.
[ "Return", "True", "if", "the", "extracted", "wheel", "in", "wheeldir", "should", "go", "into", "purelib", "." ]
python
test
bram85/topydo
topydo/lib/Todo.py
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Todo.py#L58-L64
def is_active(self): """ Returns True when the start date is today or in the past and the task has not yet been completed. """ start = self.start_date() return not self.is_completed() and (not start or start <= date.today())
[ "def", "is_active", "(", "self", ")", ":", "start", "=", "self", ".", "start_date", "(", ")", "return", "not", "self", ".", "is_completed", "(", ")", "and", "(", "not", "start", "or", "start", "<=", "date", ".", "today", "(", ")", ")" ]
Returns True when the start date is today or in the past and the task has not yet been completed.
[ "Returns", "True", "when", "the", "start", "date", "is", "today", "or", "in", "the", "past", "and", "the", "task", "has", "not", "yet", "been", "completed", "." ]
python
train
ncolony/ncolony
ncolony/directory_monitor.py
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/directory_monitor.py#L15-L52
def checker(location, receiver): """Construct a function that checks a directory for process configuration The function checks for additions or removals of JSON process configuration files and calls the appropriate receiver methods. :param location: string, the directory to monitor :param rece...
[ "def", "checker", "(", "location", ",", "receiver", ")", ":", "path", "=", "filepath", ".", "FilePath", "(", "location", ")", "files", "=", "set", "(", ")", "filesContents", "=", "{", "}", "def", "_check", "(", "path", ")", ":", "currentFiles", "=", ...
Construct a function that checks a directory for process configuration The function checks for additions or removals of JSON process configuration files and calls the appropriate receiver methods. :param location: string, the directory to monitor :param receiver: IEventReceiver :returns: a fun...
[ "Construct", "a", "function", "that", "checks", "a", "directory", "for", "process", "configuration" ]
python
test
ghcollin/multitables
multitables.py
https://github.com/ghcollin/multitables/blob/9654a45800289a20e66d2b0e0666149f0d370f93/multitables.py#L345-L348
def close(self): """Close the queue, signalling that no more data can be put into the queue.""" self.read_queue.put(QueueClosed) self.write_queue.put(QueueClosed)
[ "def", "close", "(", "self", ")", ":", "self", ".", "read_queue", ".", "put", "(", "QueueClosed", ")", "self", ".", "write_queue", ".", "put", "(", "QueueClosed", ")" ]
Close the queue, signalling that no more data can be put into the queue.
[ "Close", "the", "queue", "signalling", "that", "no", "more", "data", "can", "be", "put", "into", "the", "queue", "." ]
python
test
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/work_item_tracking_comments/work_item_tracking_comments_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/work_item_tracking_comments/work_item_tracking_comments_client.py#L28-L47
def add_comment(self, request, project, work_item_id): """AddComment. [Preview API] Add a comment on a work item. :param :class:`<WorkItemCommentCreateRequest> <azure.devops.v5_1.work_item_tracking_comments.models.WorkItemCommentCreateRequest>` request: Comment create request. :param str...
[ "def", "add_comment", "(", "self", ",", "request", ",", "project", ",", "work_item_id", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ".", "url",...
AddComment. [Preview API] Add a comment on a work item. :param :class:`<WorkItemCommentCreateRequest> <azure.devops.v5_1.work_item_tracking_comments.models.WorkItemCommentCreateRequest>` request: Comment create request. :param str project: Project ID or project name :param int work_item_...
[ "AddComment", ".", "[", "Preview", "API", "]", "Add", "a", "comment", "on", "a", "work", "item", ".", ":", "param", ":", "class", ":", "<WorkItemCommentCreateRequest", ">", "<azure", ".", "devops", ".", "v5_1", ".", "work_item_tracking_comments", ".", "model...
python
train
secdev/scapy
scapy/main.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L152-L158
def load_module(name, globals_dict=None, symb_list=None): """Loads a Scapy module to make variables, objects and functions available globally. """ _load("scapy.modules." + name, globals_dict=globals_dict, symb_list=symb_list)
[ "def", "load_module", "(", "name", ",", "globals_dict", "=", "None", ",", "symb_list", "=", "None", ")", ":", "_load", "(", "\"scapy.modules.\"", "+", "name", ",", "globals_dict", "=", "globals_dict", ",", "symb_list", "=", "symb_list", ")" ]
Loads a Scapy module to make variables, objects and functions available globally.
[ "Loads", "a", "Scapy", "module", "to", "make", "variables", "objects", "and", "functions", "available", "globally", "." ]
python
train
JarryShaw/PyPCAPKit
src/const/ftp/return_code.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ftp/return_code.py#L89-L97
def _missing_(cls, value): """Lookup function used when value is not found.""" if not (isinstance(value, int) and 100 <= value <= 659): raise ValueError('%r is not a valid %s' % (value, cls.__name__)) code = str(value) kind = KIND.get(code[0], 'Reserved') info = INFO....
[ "def", "_missing_", "(", "cls", ",", "value", ")", ":", "if", "not", "(", "isinstance", "(", "value", ",", "int", ")", "and", "100", "<=", "value", "<=", "659", ")", ":", "raise", "ValueError", "(", "'%r is not a valid %s'", "%", "(", "value", ",", "...
Lookup function used when value is not found.
[ "Lookup", "function", "used", "when", "value", "is", "not", "found", "." ]
python
train
ejeschke/ginga
ginga/rv/Control.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L1758-L1764
def get_menu(self, name): """Get the menu with name `name` from the global menu bar. Returns a menu widget. """ if self.menubar is None: raise ValueError("No menu bar configured") return self.menubar.get_menu(name)
[ "def", "get_menu", "(", "self", ",", "name", ")", ":", "if", "self", ".", "menubar", "is", "None", ":", "raise", "ValueError", "(", "\"No menu bar configured\"", ")", "return", "self", ".", "menubar", ".", "get_menu", "(", "name", ")" ]
Get the menu with name `name` from the global menu bar. Returns a menu widget.
[ "Get", "the", "menu", "with", "name", "name", "from", "the", "global", "menu", "bar", ".", "Returns", "a", "menu", "widget", "." ]
python
train
OSSOS/MOP
src/ossos/core/ossos/storage.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1159-L1183
def get_zeropoint(expnum, ccd, prefix=None, version='p'): """Get the zeropoint for this exposure using the zeropoint.used file created during source planting.. This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint. @param expnum: exposure to get zeropoint ...
[ "def", "get_zeropoint", "(", "expnum", ",", "ccd", ",", "prefix", "=", "None", ",", "version", "=", "'p'", ")", ":", "uri", "=", "get_uri", "(", "expnum", ",", "ccd", ",", "version", ",", "ext", "=", "'zeropoint.used'", ",", "prefix", "=", "prefix", ...
Get the zeropoint for this exposure using the zeropoint.used file created during source planting.. This command expects that there is a file called #######p##.zeropoint.used which contains the zeropoint. @param expnum: exposure to get zeropoint of @param ccd: which ccd (extension - 1) to get zp @param...
[ "Get", "the", "zeropoint", "for", "this", "exposure", "using", "the", "zeropoint", ".", "used", "file", "created", "during", "source", "planting", ".." ]
python
train
numenta/htmresearch
projects/l2_pooling/ideal_classifier_experiment.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/l2_pooling/ideal_classifier_experiment.py#L85-L94
def classifierPredict(testVector, storedVectors): """ Return overlap of the testVector with stored representations for each object. """ numClasses = storedVectors.shape[0] output = np.zeros((numClasses,)) for i in range(numClasses): output[i] = np.sum(np.minimum(testVector, storedVectors[i, :])) retu...
[ "def", "classifierPredict", "(", "testVector", ",", "storedVectors", ")", ":", "numClasses", "=", "storedVectors", ".", "shape", "[", "0", "]", "output", "=", "np", ".", "zeros", "(", "(", "numClasses", ",", ")", ")", "for", "i", "in", "range", "(", "n...
Return overlap of the testVector with stored representations for each object.
[ "Return", "overlap", "of", "the", "testVector", "with", "stored", "representations", "for", "each", "object", "." ]
python
train
cuescience/goat
goat/matcher.py
https://github.com/cuescience/goat/blob/d76f44b9ec5dc40ad33abca50830c0d7492ef152/goat/matcher.py#L76-L91
def convert(self, pattern: str) -> str: """Convert the goat step string to CFParse String""" parameters = OrderedDict() for parameter in self.signature.parameters.values(): annotation = self.convert_type_to_parse_type(parameter) parameters[parameter.name] = "{%s:%s}" % (p...
[ "def", "convert", "(", "self", ",", "pattern", ":", "str", ")", "->", "str", ":", "parameters", "=", "OrderedDict", "(", ")", "for", "parameter", "in", "self", ".", "signature", ".", "parameters", ".", "values", "(", ")", ":", "annotation", "=", "self"...
Convert the goat step string to CFParse String
[ "Convert", "the", "goat", "step", "string", "to", "CFParse", "String" ]
python
train
cdgriffith/Box
box.py
https://github.com/cdgriffith/Box/blob/5f09df824022127e7e335e3d993f7ddc1ed97fce/box.py#L196-L236
def _conversion_checks(item, keys, box_config, check_only=False, pre_check=False): """ Internal use for checking if a duplicate safe attribute already exists :param item: Item to see if a dup exists :param keys: Keys to check against :param box_config: Easier to pass in than ...
[ "def", "_conversion_checks", "(", "item", ",", "keys", ",", "box_config", ",", "check_only", "=", "False", ",", "pre_check", "=", "False", ")", ":", "if", "box_config", "[", "'box_duplicates'", "]", "!=", "'ignore'", ":", "if", "pre_check", ":", "keys", "=...
Internal use for checking if a duplicate safe attribute already exists :param item: Item to see if a dup exists :param keys: Keys to check against :param box_config: Easier to pass in than ask for specfic items :param check_only: Don't bother doing the conversion work :param pre_check: Need to add ...
[ "Internal", "use", "for", "checking", "if", "a", "duplicate", "safe", "attribute", "already", "exists" ]
python
train
vertexproject/synapse
synapse/lib/cell.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/cell.py#L70-L87
def setCellUser(self, iden): ''' Switch to another user (admin only). This API allows remote admin/service accounts to impersonate a user. Used mostly by services that manage their own authentication/sessions. ''' if not self.user.admin: mesg = 'setC...
[ "def", "setCellUser", "(", "self", ",", "iden", ")", ":", "if", "not", "self", ".", "user", ".", "admin", ":", "mesg", "=", "'setCellUser() caller must be admin.'", "raise", "s_exc", ".", "AuthDeny", "(", "mesg", "=", "mesg", ")", "user", "=", "self", "....
Switch to another user (admin only). This API allows remote admin/service accounts to impersonate a user. Used mostly by services that manage their own authentication/sessions.
[ "Switch", "to", "another", "user", "(", "admin", "only", ")", "." ]
python
train
mdgoldberg/sportsref
sportsref/nba/teams.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nba/teams.py#L67-L76
def schedule(self, year): """Gets schedule information for a team-season. :year: The year for which we want the schedule. :returns: DataFrame of schedule information. """ doc = self.get_year_doc('{}_games'.format(year)) table = doc('table#games') df = sportsref.u...
[ "def", "schedule", "(", "self", ",", "year", ")", ":", "doc", "=", "self", ".", "get_year_doc", "(", "'{}_games'", ".", "format", "(", "year", ")", ")", "table", "=", "doc", "(", "'table#games'", ")", "df", "=", "sportsref", ".", "utils", ".", "parse...
Gets schedule information for a team-season. :year: The year for which we want the schedule. :returns: DataFrame of schedule information.
[ "Gets", "schedule", "information", "for", "a", "team", "-", "season", "." ]
python
test
wmayner/pyphi
pyphi/models/fmt.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/models/fmt.py#L195-L199
def labels(indices, node_labels=None): """Get the labels for a tuple of mechanism indices.""" if node_labels is None: return tuple(map(str, indices)) return node_labels.indices2labels(indices)
[ "def", "labels", "(", "indices", ",", "node_labels", "=", "None", ")", ":", "if", "node_labels", "is", "None", ":", "return", "tuple", "(", "map", "(", "str", ",", "indices", ")", ")", "return", "node_labels", ".", "indices2labels", "(", "indices", ")" ]
Get the labels for a tuple of mechanism indices.
[ "Get", "the", "labels", "for", "a", "tuple", "of", "mechanism", "indices", "." ]
python
train
dddomodossola/remi
remi/gui.py
https://github.com/dddomodossola/remi/blob/85206f62220662bb7ecd471042268def71ccad28/remi/gui.py#L2041-L2050
def new_from_list(cls, items, **kwargs): """Populates the ListView with a string list. Args: items (list): list of strings to fill the widget with. """ obj = cls(**kwargs) for item in items: obj.append(ListItem(item)) return obj
[ "def", "new_from_list", "(", "cls", ",", "items", ",", "*", "*", "kwargs", ")", ":", "obj", "=", "cls", "(", "*", "*", "kwargs", ")", "for", "item", "in", "items", ":", "obj", ".", "append", "(", "ListItem", "(", "item", ")", ")", "return", "obj"...
Populates the ListView with a string list. Args: items (list): list of strings to fill the widget with.
[ "Populates", "the", "ListView", "with", "a", "string", "list", "." ]
python
train
openstack/hacking
hacking/checks/docstrings.py
https://github.com/openstack/hacking/blob/10e58f907181cac91d3b2af422c2458b04a1ec79/hacking/checks/docstrings.py#L46-L73
def hacking_docstring_multiline_end(physical_line, previous_logical, tokens): r"""Check multi line docstring end. OpenStack HACKING guide recommendation for docstring: Docstring should end on a new line Okay: '''foobar\nfoo\nbar\n''' Okay: def foo():\n '''foobar\n\nfoo\nbar\n''' Okay: class...
[ "def", "hacking_docstring_multiline_end", "(", "physical_line", ",", "previous_logical", ",", "tokens", ")", ":", "docstring", "=", "is_docstring", "(", "tokens", ",", "previous_logical", ")", "if", "docstring", ":", "if", "'\\n'", "not", "in", "docstring", ":", ...
r"""Check multi line docstring end. OpenStack HACKING guide recommendation for docstring: Docstring should end on a new line Okay: '''foobar\nfoo\nbar\n''' Okay: def foo():\n '''foobar\n\nfoo\nbar\n''' Okay: class Foo(object):\n '''foobar\n\nfoo\nbar\n''' Okay: def foo():\n a = '''not...
[ "r", "Check", "multi", "line", "docstring", "end", "." ]
python
train
openstax/cnx-epub
cnxepub/adapters.py
https://github.com/openstax/cnx-epub/blob/f648a309eff551b0a68a115a98ddf7858149a2ea/cnxepub/adapters.py#L94-L99
def make_epub(binders, file): """Creates an EPUB file from a binder(s).""" if not isinstance(binders, (list, set, tuple,)): binders = [binders] epub = EPUB([_make_package(binder) for binder in binders]) epub.to_file(epub, file)
[ "def", "make_epub", "(", "binders", ",", "file", ")", ":", "if", "not", "isinstance", "(", "binders", ",", "(", "list", ",", "set", ",", "tuple", ",", ")", ")", ":", "binders", "=", "[", "binders", "]", "epub", "=", "EPUB", "(", "[", "_make_package...
Creates an EPUB file from a binder(s).
[ "Creates", "an", "EPUB", "file", "from", "a", "binder", "(", "s", ")", "." ]
python
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L104-L132
def deletephysicalnetwork(check_processor = default_physicalnetwork_delete_check, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(physicalnetwork, physicalnetworkmap, walk, write, \*, parameters) """ def walker(walk, write, timestamp, par...
[ "def", "deletephysicalnetwork", "(", "check_processor", "=", "default_physicalnetwork_delete_check", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "def", "walker", "(", "walk", ",", "write", ",", "timestamp", ",", "parameters_dict", ")", ":", "for", "k...
:param check_processor: check_processor(physicalnetwork, physicalnetworkmap, walk, write, \*, parameters)
[ ":", "param", "check_processor", ":", "check_processor", "(", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
python
train
incf-nidash/nidmresults
nidmresults/objects/modelfitting.py
https://github.com/incf-nidash/nidmresults/blob/438f7cce6abc4a4379b629bd76f4d427891e033f/nidmresults/objects/modelfitting.py#L959-L983
def export(self, nidm_version, export_dir): """ Create prov entities and activities. """ if self.masked_median is None: grand_mean_file = self.file.path grand_mean_img = nib.load(grand_mean_file) grand_mean_data = grand_mean_img.get_data() ...
[ "def", "export", "(", "self", ",", "nidm_version", ",", "export_dir", ")", ":", "if", "self", ".", "masked_median", "is", "None", ":", "grand_mean_file", "=", "self", ".", "file", ".", "path", "grand_mean_img", "=", "nib", ".", "load", "(", "grand_mean_fil...
Create prov entities and activities.
[ "Create", "prov", "entities", "and", "activities", "." ]
python
train
jleinonen/pytmatrix
pytmatrix/scatter.py
https://github.com/jleinonen/pytmatrix/blob/8803507fe5332786feab105fa74acf63e7121718/pytmatrix/scatter.py#L46-L64
def ldr(scatterer, h_pol=True): """ Linear depolarizarion ratio (LDR) for the current setup. Args: scatterer: a Scatterer instance. h_pol: If True (default), return LDR_h. If False, return LDR_v. Returns: The LDR. """ Z = scatterer.get_Z() if h_pol: r...
[ "def", "ldr", "(", "scatterer", ",", "h_pol", "=", "True", ")", ":", "Z", "=", "scatterer", ".", "get_Z", "(", ")", "if", "h_pol", ":", "return", "(", "Z", "[", "0", ",", "0", "]", "-", "Z", "[", "0", ",", "1", "]", "+", "Z", "[", "1", ",...
Linear depolarizarion ratio (LDR) for the current setup. Args: scatterer: a Scatterer instance. h_pol: If True (default), return LDR_h. If False, return LDR_v. Returns: The LDR.
[ "Linear", "depolarizarion", "ratio", "(", "LDR", ")", "for", "the", "current", "setup", "." ]
python
train
SylvanasSun/FishFishJump
fish_dashboard/scrapyd/scrapyd_agent.py
https://github.com/SylvanasSun/FishFishJump/blob/696212d242d8d572f3f1b43925f3d8ab8acc6a2d/fish_dashboard/scrapyd/scrapyd_agent.py#L50-L67
def init_command_set(self, scrapyd_url): """ Initialize command set by scrapyd_url,each element is a list such as ['command','supported http method type'] """ if scrapyd_url[-1:] != '/': scrapyd_url = scrapyd_url + '/' self['daemonstatus'] = [scrapyd_url + 'daemonst...
[ "def", "init_command_set", "(", "self", ",", "scrapyd_url", ")", ":", "if", "scrapyd_url", "[", "-", "1", ":", "]", "!=", "'/'", ":", "scrapyd_url", "=", "scrapyd_url", "+", "'/'", "self", "[", "'daemonstatus'", "]", "=", "[", "scrapyd_url", "+", "'daemo...
Initialize command set by scrapyd_url,each element is a list such as ['command','supported http method type']
[ "Initialize", "command", "set", "by", "scrapyd_url", "each", "element", "is", "a", "list", "such", "as", "[", "command", "supported", "http", "method", "type", "]" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/glow_ops.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/glow_ops.py#L300-L331
def actnorm_scale(name, x, logscale_factor=3., reverse=False, init=False): """Per-channel scaling of x.""" x_shape = common_layers.shape_list(x) with tf.variable_scope(name, reuse=tf.AUTO_REUSE): # Variance initialization logic. assert len(x_shape) == 2 or len(x_shape) == 4 if len(x_shape) == 2: ...
[ "def", "actnorm_scale", "(", "name", ",", "x", ",", "logscale_factor", "=", "3.", ",", "reverse", "=", "False", ",", "init", "=", "False", ")", ":", "x_shape", "=", "common_layers", ".", "shape_list", "(", "x", ")", "with", "tf", ".", "variable_scope", ...
Per-channel scaling of x.
[ "Per", "-", "channel", "scaling", "of", "x", "." ]
python
train
SBRG/ssbio
ssbio/pipeline/atlas2.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas2.py#L560-L583
def _align_orthologous_gene_pairwise(self, g_id, gapopen=10, gapextend=0.5, engine='needle', parse=True, force_rerun=False): """Align orthologous strain sequences to representative Protein sequence, save as new pickle""" protein_seqs_aln_pickle_path = op.join(self.sequences_by_gene_dir, '{}_protein_with...
[ "def", "_align_orthologous_gene_pairwise", "(", "self", ",", "g_id", ",", "gapopen", "=", "10", ",", "gapextend", "=", "0.5", ",", "engine", "=", "'needle'", ",", "parse", "=", "True", ",", "force_rerun", "=", "False", ")", ":", "protein_seqs_aln_pickle_path",...
Align orthologous strain sequences to representative Protein sequence, save as new pickle
[ "Align", "orthologous", "strain", "sequences", "to", "representative", "Protein", "sequence", "save", "as", "new", "pickle" ]
python
train
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L54-L58
def pic_loggedrequiredremoterelease_v1(self): """Update the receiver link sequence.""" log = self.sequences.logs.fastaccess rec = self.sequences.receivers.fastaccess log.loggedrequiredremoterelease[0] = rec.d[0]
[ "def", "pic_loggedrequiredremoterelease_v1", "(", "self", ")", ":", "log", "=", "self", ".", "sequences", ".", "logs", ".", "fastaccess", "rec", "=", "self", ".", "sequences", ".", "receivers", ".", "fastaccess", "log", ".", "loggedrequiredremoterelease", "[", ...
Update the receiver link sequence.
[ "Update", "the", "receiver", "link", "sequence", "." ]
python
train
Kozea/pygal
pygal/svg.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/svg.py#L495-L525
def get_strokes(self): """Return a css snippet containing all stroke style options""" def stroke_dict_to_css(stroke, i=None): """Return a css style for the given option""" css = [ '%s.series%s {\n' % (self.id, '.serie-%d' % i if i is not None else...
[ "def", "get_strokes", "(", "self", ")", ":", "def", "stroke_dict_to_css", "(", "stroke", ",", "i", "=", "None", ")", ":", "\"\"\"Return a css style for the given option\"\"\"", "css", "=", "[", "'%s.series%s {\\n'", "%", "(", "self", ".", "id", ",", "'.serie-%d'...
Return a css snippet containing all stroke style options
[ "Return", "a", "css", "snippet", "containing", "all", "stroke", "style", "options" ]
python
train
rmax/scrapydo
scrapydo/api.py
https://github.com/rmax/scrapydo/blob/b0f9e6d50a5ea9d2ba8335bffa877003109c3af5/scrapydo/api.py#L180-L216
def _run_spider_in_reactor(spider_cls, capture_items=True, return_crawler=False, settings=None, **kwargs): """Runs given spider inside the twisted reactdor. Parameters ---------- spider_cls : scrapy.Spider Spider to run. capture_items : bool (default: True) ...
[ "def", "_run_spider_in_reactor", "(", "spider_cls", ",", "capture_items", "=", "True", ",", "return_crawler", "=", "False", ",", "settings", "=", "None", ",", "*", "*", "kwargs", ")", ":", "settings", "=", "settings", "or", "{", "}", "crawler_settings", "=",...
Runs given spider inside the twisted reactdor. Parameters ---------- spider_cls : scrapy.Spider Spider to run. capture_items : bool (default: True) If enabled, the scraped items are captured and returned. return_crawler : bool (default: False) If enabled, the crawler instanc...
[ "Runs", "given", "spider", "inside", "the", "twisted", "reactdor", "." ]
python
train
MartinThoma/mpu
mpu/__init__.py
https://github.com/MartinThoma/mpu/blob/61bc36d0192ca90c0bcf9b8a5d7d0d8520e20ff6/mpu/__init__.py#L40-L63
def clip(number, lowest=None, highest=None): """ Clip a number to a given lowest / highest value. Parameters ---------- number : number lowest : number, optional highest : number, optional Returns ------- clipped_number : number Examples -------- >>> clip(42, lowes...
[ "def", "clip", "(", "number", ",", "lowest", "=", "None", ",", "highest", "=", "None", ")", ":", "if", "lowest", "is", "not", "None", ":", "number", "=", "max", "(", "number", ",", "lowest", ")", "if", "highest", "is", "not", "None", ":", "number",...
Clip a number to a given lowest / highest value. Parameters ---------- number : number lowest : number, optional highest : number, optional Returns ------- clipped_number : number Examples -------- >>> clip(42, lowest=0, highest=10) 10
[ "Clip", "a", "number", "to", "a", "given", "lowest", "/", "highest", "value", "." ]
python
train
pygobject/pgi
pgi/codegen/utils.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/utils.py#L94-L102
def add_dependency(self, name, obj): """Add a code dependency so it gets inserted into globals""" if name in self._deps: if self._deps[name] is obj: return raise ValueError( "There exists a different dep with the same name : %r" % name) se...
[ "def", "add_dependency", "(", "self", ",", "name", ",", "obj", ")", ":", "if", "name", "in", "self", ".", "_deps", ":", "if", "self", ".", "_deps", "[", "name", "]", "is", "obj", ":", "return", "raise", "ValueError", "(", "\"There exists a different dep ...
Add a code dependency so it gets inserted into globals
[ "Add", "a", "code", "dependency", "so", "it", "gets", "inserted", "into", "globals" ]
python
train
allenai/allennlp
allennlp/training/metrics/metric.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/training/metrics/metric.py#L29-L33
def get_metric(self, reset: bool) -> Union[float, Tuple[float, ...], Dict[str, float], Dict[str, List[float]]]: """ Compute and return the metric. Optionally also call :func:`self.reset`. """ raise NotImplementedError
[ "def", "get_metric", "(", "self", ",", "reset", ":", "bool", ")", "->", "Union", "[", "float", ",", "Tuple", "[", "float", ",", "...", "]", ",", "Dict", "[", "str", ",", "float", "]", ",", "Dict", "[", "str", ",", "List", "[", "float", "]", "]"...
Compute and return the metric. Optionally also call :func:`self.reset`.
[ "Compute", "and", "return", "the", "metric", ".", "Optionally", "also", "call", ":", "func", ":", "self", ".", "reset", "." ]
python
train
sci-bots/mpm
mpm/api.py
https://github.com/sci-bots/mpm/blob/a69651cda4b37ee6b17df4fe0809249e7f4dc536/mpm/api.py#L646-L721
def enabled_plugins(installed_only=True): ''' .. versionadded:: 0.21 Parameters ---------- installed_only : bool, optional Only consider enabled plugins that are installed in the Conda environment. Returns ------- list List of properties corresponding to each pl...
[ "def", "enabled_plugins", "(", "installed_only", "=", "True", ")", ":", "enabled_path", "=", "MICRODROP_CONDA_PLUGINS", ".", "joinpath", "(", "'enabled'", ")", "if", "not", "enabled_path", ".", "isdir", "(", ")", ":", "return", "[", "]", "# Construct list of pro...
.. versionadded:: 0.21 Parameters ---------- installed_only : bool, optional Only consider enabled plugins that are installed in the Conda environment. Returns ------- list List of properties corresponding to each plugin that is **enabled**. If :data:`installed...
[ "..", "versionadded", "::", "0", ".", "21" ]
python
train
pyviz/holoviews
holoviews/core/element.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/element.py#L261-L272
def table(self, datatype=None): "Deprecated method to convert any Element to a Table." if config.future_deprecations: self.param.warning( "The table method is deprecated and should no " "longer be used. Instead cast the %s to a " "a Table direc...
[ "def", "table", "(", "self", ",", "datatype", "=", "None", ")", ":", "if", "config", ".", "future_deprecations", ":", "self", ".", "param", ".", "warning", "(", "\"The table method is deprecated and should no \"", "\"longer be used. Instead cast the %s to a \"", "\"a Ta...
Deprecated method to convert any Element to a Table.
[ "Deprecated", "method", "to", "convert", "any", "Element", "to", "a", "Table", "." ]
python
train
fredRos/pypmc
pypmc/mix_adapt/hierarchical.py
https://github.com/fredRos/pypmc/blob/9138b67c976f0d58edd080353d16769a47794d09/pypmc/mix_adapt/hierarchical.py#L153-L219
def run(self, eps=1e-4, kill=True, max_steps=50, verbose=False): r"""Perform the clustering on the input components updating the initial guess. The result is available in the member ``self.g``. Return the number of iterations at convergence, or None. :param eps: If relativ...
[ "def", "run", "(", "self", ",", "eps", "=", "1e-4", ",", "kill", "=", "True", ",", "max_steps", "=", "50", ",", "verbose", "=", "False", ")", ":", "old_distance", "=", "np", ".", "finfo", "(", "np", ".", "float64", ")", ".", "max", "new_distance", ...
r"""Perform the clustering on the input components updating the initial guess. The result is available in the member ``self.g``. Return the number of iterations at convergence, or None. :param eps: If relative change of distance between current and last step falls below ``eps``, ...
[ "r", "Perform", "the", "clustering", "on", "the", "input", "components", "updating", "the", "initial", "guess", ".", "The", "result", "is", "available", "in", "the", "member", "self", ".", "g", "." ]
python
train
vmware/pyvmomi
pyVmomi/Differ.py
https://github.com/vmware/pyvmomi/blob/3ffcb23bf77d757175c0d5216ba9a25345d824cd/pyVmomi/Differ.py#L31-L40
def IsPrimitiveType(obj): """See if the passed in type is a Primitive Type""" return (isinstance(obj, types.bool) or isinstance(obj, types.byte) or isinstance(obj, types.short) or isinstance(obj, six.integer_types) or isinstance(obj, types.double) or isinstance(obj, types.float) or isinstance(ob...
[ "def", "IsPrimitiveType", "(", "obj", ")", ":", "return", "(", "isinstance", "(", "obj", ",", "types", ".", "bool", ")", "or", "isinstance", "(", "obj", ",", "types", ".", "byte", ")", "or", "isinstance", "(", "obj", ",", "types", ".", "short", ")", ...
See if the passed in type is a Primitive Type
[ "See", "if", "the", "passed", "in", "type", "is", "a", "Primitive", "Type" ]
python
train
lrq3000/pyFileFixity
pyFileFixity/structural_adaptive_ecc.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/structural_adaptive_ecc.py#L97-L135
def entry_fields(file, entry_pos, field_delim="\xFF"): '''From an ecc entry position (a list with starting and ending positions), extract the metadata fields (filename, filesize, ecc for both), and the starting/ending positions of the ecc stream (containing variably encoded blocks of hash and ecc per blocks of the ...
[ "def", "entry_fields", "(", "file", ",", "entry_pos", ",", "field_delim", "=", "\"\\xFF\"", ")", ":", "# Read the the beginning of the ecc entry", "blocksize", "=", "65535", "file", ".", "seek", "(", "entry_pos", "[", "0", "]", ")", "entry", "=", "file", ".", ...
From an ecc entry position (a list with starting and ending positions), extract the metadata fields (filename, filesize, ecc for both), and the starting/ending positions of the ecc stream (containing variably encoded blocks of hash and ecc per blocks of the original file's header)
[ "From", "an", "ecc", "entry", "position", "(", "a", "list", "with", "starting", "and", "ending", "positions", ")", "extract", "the", "metadata", "fields", "(", "filename", "filesize", "ecc", "for", "both", ")", "and", "the", "starting", "/", "ending", "pos...
python
train
SciTools/biggus
biggus/_init.py
https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2728-L2754
def min(a, axis=None): """ Request the minimum of an Array over any number of axes. .. note:: Currently limited to operating on a single axis. Parameters ---------- a : Array object The object whose minimum is to be found. axis : None, or int, or iterable of ints Axis or ax...
[ "def", "min", "(", "a", ",", "axis", "=", "None", ")", ":", "axes", "=", "_normalise_axis", "(", "axis", ",", "a", ")", "assert", "axes", "is", "not", "None", "and", "len", "(", "axes", ")", "==", "1", "return", "_Aggregation", "(", "a", ",", "ax...
Request the minimum of an Array over any number of axes. .. note:: Currently limited to operating on a single axis. Parameters ---------- a : Array object The object whose minimum is to be found. axis : None, or int, or iterable of ints Axis or axes along which the operation is per...
[ "Request", "the", "minimum", "of", "an", "Array", "over", "any", "number", "of", "axes", "." ]
python
train
funilrys/PyFunceble
PyFunceble/helpers.py
https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L654-L690
def fix_path(self, splited_path=None): """ Fix the path of the given path. :param splited_path: A list to convert to the right path. :type splited_path: list :return: The fixed path. :rtype: str """ if not splited_path: # A splited path is p...
[ "def", "fix_path", "(", "self", ",", "splited_path", "=", "None", ")", ":", "if", "not", "splited_path", ":", "# A splited path is parsed.", "# We initate a variable which will save the splited path.", "split_path", "=", "[", "]", "if", "self", ".", "directory", ":", ...
Fix the path of the given path. :param splited_path: A list to convert to the right path. :type splited_path: list :return: The fixed path. :rtype: str
[ "Fix", "the", "path", "of", "the", "given", "path", "." ]
python
test
pylast/pylast
src/pylast/__init__.py
https://github.com/pylast/pylast/blob/a52f66d316797fc819b5f1d186d77f18ba97b4ff/src/pylast/__init__.py#L496-L503
def get_track_by_mbid(self, mbid): """Looks up a track by its MusicBrainz ID""" params = {"mbid": mbid} doc = _Request(self, "track.getInfo", params).execute(True) return Track(_extract(doc, "name", 1), _extract(doc, "name"), self)
[ "def", "get_track_by_mbid", "(", "self", ",", "mbid", ")", ":", "params", "=", "{", "\"mbid\"", ":", "mbid", "}", "doc", "=", "_Request", "(", "self", ",", "\"track.getInfo\"", ",", "params", ")", ".", "execute", "(", "True", ")", "return", "Track", "(...
Looks up a track by its MusicBrainz ID
[ "Looks", "up", "a", "track", "by", "its", "MusicBrainz", "ID" ]
python
train
mamikonyana/cryptotools
cryptotools/language_score.py
https://github.com/mamikonyana/cryptotools/blob/65c8d9b9ad225817db0be31c5845a000e911f238/cryptotools/language_score.py#L5-L15
def score_meaning(text): """ Returns a score in [0,1] range if the text makes any sense in English. """ #all_characters = re.findall('[ -~]', text) # match 32-126 in ASCII table all_characters = re.findall('[a-zA-Z ]', text) # match 32-126 in ASCII table if len(all_characters) == 0: re...
[ "def", "score_meaning", "(", "text", ")", ":", "#all_characters = re.findall('[ -~]', text) # match 32-126 in ASCII table", "all_characters", "=", "re", ".", "findall", "(", "'[a-zA-Z ]'", ",", "text", ")", "# match 32-126 in ASCII table", "if", "len", "(", "all_characters...
Returns a score in [0,1] range if the text makes any sense in English.
[ "Returns", "a", "score", "in", "[", "0", "1", "]", "range", "if", "the", "text", "makes", "any", "sense", "in", "English", "." ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/sqlalchemy/schema.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sqlalchemy/schema.py#L1116-L1128
def column_lists_equal(a: List[Column], b: List[Column]) -> bool: """ Are all columns in list ``a`` equal to their counterparts in list ``b``, as per :func:`columns_equal`? """ n = len(a) if len(b) != n: return False for i in range(n): if not columns_equal(a[i], b[i]): ...
[ "def", "column_lists_equal", "(", "a", ":", "List", "[", "Column", "]", ",", "b", ":", "List", "[", "Column", "]", ")", "->", "bool", ":", "n", "=", "len", "(", "a", ")", "if", "len", "(", "b", ")", "!=", "n", ":", "return", "False", "for", "...
Are all columns in list ``a`` equal to their counterparts in list ``b``, as per :func:`columns_equal`?
[ "Are", "all", "columns", "in", "list", "a", "equal", "to", "their", "counterparts", "in", "list", "b", "as", "per", ":", "func", ":", "columns_equal", "?" ]
python
train
saltstack/salt
salt/utils/jinja.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L577-L594
def intersect(lst1, lst2): ''' Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4] ''' if isinstance(lst1, collections.Hashable) and isin...
[ "def", "intersect", "(", "lst1", ",", "lst2", ")", ":", "if", "isinstance", "(", "lst1", ",", "collections", ".", "Hashable", ")", "and", "isinstance", "(", "lst2", ",", "collections", ".", "Hashable", ")", ":", "return", "set", "(", "lst1", ")", "&", ...
Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4]
[ "Returns", "the", "intersection", "of", "two", "lists", "." ]
python
train
aiidateam/aiida-codtools
aiida_codtools/parsers/cif_split_primitive.py
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/parsers/cif_split_primitive.py#L18-L47
def parse_stdout(self, filelike): """Parse the content written by the script to standard out. The standard output will contain a list of relative filepaths where the generated CIF files have been written. :param filelike: filelike object of stdout :returns: an exit code in case of an e...
[ "def", "parse_stdout", "(", "self", ",", "filelike", ")", ":", "from", "aiida", ".", "orm", "import", "CifData", "content", "=", "filelike", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "not", "content", ":", "return", "self", ".", "exit_codes"...
Parse the content written by the script to standard out. The standard output will contain a list of relative filepaths where the generated CIF files have been written. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise
[ "Parse", "the", "content", "written", "by", "the", "script", "to", "standard", "out", "." ]
python
train
twisted/mantissa
xmantissa/people.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L2054-L2062
def getContactItems(self, person): """ Return an iterable of L{PhoneNumber} items that are associated with C{person}. @type person: L{Person} """ return person.store.query( PhoneNumber, PhoneNumber.person == person)
[ "def", "getContactItems", "(", "self", ",", "person", ")", ":", "return", "person", ".", "store", ".", "query", "(", "PhoneNumber", ",", "PhoneNumber", ".", "person", "==", "person", ")" ]
Return an iterable of L{PhoneNumber} items that are associated with C{person}. @type person: L{Person}
[ "Return", "an", "iterable", "of", "L", "{", "PhoneNumber", "}", "items", "that", "are", "associated", "with", "C", "{", "person", "}", "." ]
python
train
fboender/ansible-cmdb
lib/mako/codegen.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/lib/mako/codegen.py#L24-L66
def compile(node, uri, filename=None, default_filters=None, buffer_filters=None, imports=None, future_imports=None, source_encoding=None, generate_magic_comment=True, disable_u...
[ "def", "compile", "(", "node", ",", "uri", ",", "filename", "=", "None", ",", "default_filters", "=", "None", ",", "buffer_filters", "=", "None", ",", "imports", "=", "None", ",", "future_imports", "=", "None", ",", "source_encoding", "=", "None", ",", "...
Generate module source code given a parsetree node, uri, and optional source filename
[ "Generate", "module", "source", "code", "given", "a", "parsetree", "node", "uri", "and", "optional", "source", "filename" ]
python
train
bertrandvidal/parse_this
parse_this/core.py
https://github.com/bertrandvidal/parse_this/blob/aa2e3737f19642300ef1ca65cae21c90049718a2/parse_this/core.py#L302-L311
def _get_args_name_from_parser(parser): """Retrieve the name of the function argument linked to the given parser. Args: parser: a function parser """ # Retrieve the 'action' destination of the method parser i.e. its # argument name. The HelpAction is ignored. return [action.dest for act...
[ "def", "_get_args_name_from_parser", "(", "parser", ")", ":", "# Retrieve the 'action' destination of the method parser i.e. its", "# argument name. The HelpAction is ignored.", "return", "[", "action", ".", "dest", "for", "action", "in", "parser", ".", "_actions", "if", "not...
Retrieve the name of the function argument linked to the given parser. Args: parser: a function parser
[ "Retrieve", "the", "name", "of", "the", "function", "argument", "linked", "to", "the", "given", "parser", "." ]
python
train