repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
Contraz/demosys-py
demosys/opengl/projection.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/opengl/projection.py#L17-L32
def update(self, aspect_ratio=None, fov=None, near=None, far=None): """ Update the internal projection matrix based on current values or values passed in if specified. :param aspect_ratio: New aspect ratio :param fov: New field of view :param near: New near value ...
[ "def", "update", "(", "self", ",", "aspect_ratio", "=", "None", ",", "fov", "=", "None", ",", "near", "=", "None", ",", "far", "=", "None", ")", ":", "self", ".", "aspect_ratio", "=", "aspect_ratio", "or", "self", ".", "aspect_ratio", "self", ".", "f...
Update the internal projection matrix based on current values or values passed in if specified. :param aspect_ratio: New aspect ratio :param fov: New field of view :param near: New near value :param far: New far value
[ "Update", "the", "internal", "projection", "matrix", "based", "on", "current", "values", "or", "values", "passed", "in", "if", "specified", "." ]
python
valid
38.625
trivago/Protector
protector/parser/subparsers/datapoints.py
https://github.com/trivago/Protector/blob/7ebe7bde965e27737b961a0cb5740724d174fdc7/protector/parser/subparsers/datapoints.py#L11-L31
def parse(duration_seconds, resolution_seconds=Resolution.MAX_RESOLUTION, limit=None): """ num_datapoints = min(duration/resolution, limit) :param duration_seconds: Time duration (in seconds) for which datapoints should be returned :param resolution_seconds: Time interval (in seconds) b...
[ "def", "parse", "(", "duration_seconds", ",", "resolution_seconds", "=", "Resolution", ".", "MAX_RESOLUTION", ",", "limit", "=", "None", ")", ":", "if", "not", "duration_seconds", "or", "duration_seconds", "<", "0", ":", "return", "0", "if", "not", "resolution...
num_datapoints = min(duration/resolution, limit) :param duration_seconds: Time duration (in seconds) for which datapoints should be returned :param resolution_seconds: Time interval (in seconds) between data points :param limit: Maximum number of datapoints to return
[ "num_datapoints", "=", "min", "(", "duration", "/", "resolution", "limit", ")" ]
python
valid
35.619048
google/mobly
mobly/controllers/attenuator_lib/minicircuits.py
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/controllers/attenuator_lib/minicircuits.py#L50-L65
def open(self, host, port=23): """Opens a telnet connection to the desired AttenuatorDevice and queries basic information. Args: host: A valid hostname (IP address or DNS-resolvable name) to an MC-DAT attenuator instrument. port: An optional port number (...
[ "def", "open", "(", "self", ",", "host", ",", "port", "=", "23", ")", ":", "self", ".", "_telnet_client", ".", "open", "(", "host", ",", "port", ")", "config_str", "=", "self", ".", "_telnet_client", ".", "cmd", "(", "\"MN?\"", ")", "if", "config_str...
Opens a telnet connection to the desired AttenuatorDevice and queries basic information. Args: host: A valid hostname (IP address or DNS-resolvable name) to an MC-DAT attenuator instrument. port: An optional port number (defaults to telnet default 23)
[ "Opens", "a", "telnet", "connection", "to", "the", "desired", "AttenuatorDevice", "and", "queries", "basic", "information", "." ]
python
train
44.125
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/GraphStat.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/GraphStat.py#L36-L73
def _binning(values, limits=(0,0), bin_num=10): ''' Bins data that falls between certain limits, if the limits are (0, 0) the minimum and maximum values are used. Returns a list of tuples where the first element of the tuple is the center of the bin and the second element of the tuple are the count...
[ "def", "_binning", "(", "values", ",", "limits", "=", "(", "0", ",", "0", ")", ",", "bin_num", "=", "10", ")", ":", "if", "limits", "==", "(", "0", ",", "0", ")", ":", "eps", "=", "1.0", "/", "sys", ".", "maxint", "min_val", ",", "max_val", "...
Bins data that falls between certain limits, if the limits are (0, 0) the minimum and maximum values are used. Returns a list of tuples where the first element of the tuple is the center of the bin and the second element of the tuple are the counts.
[ "Bins", "data", "that", "falls", "between", "certain", "limits", "if", "the", "limits", "are", "(", "0", "0", ")", "the", "minimum", "and", "maximum", "values", "are", "used", "." ]
python
train
28.842105
pyviz/holoviews
holoviews/plotting/bokeh/sankey.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/sankey.py#L180-L194
def _patch_hover(self, element, data): """ Replace edge start and end hover data with label_index data. """ if not (self.inspection_policy == 'edges' and 'hover' in self.handles): return lidx = element.nodes.get_dimension(self.label_index) src, tgt = [dimensio...
[ "def", "_patch_hover", "(", "self", ",", "element", ",", "data", ")", ":", "if", "not", "(", "self", ".", "inspection_policy", "==", "'edges'", "and", "'hover'", "in", "self", ".", "handles", ")", ":", "return", "lidx", "=", "element", ".", "nodes", "....
Replace edge start and end hover data with label_index data.
[ "Replace", "edge", "start", "and", "end", "hover", "data", "with", "label_index", "data", "." ]
python
train
50.066667
opencobra/cobrapy
cobra/core/gene.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/core/gene.py#L143-L168
def parse_gpr(str_expr): """parse gpr into AST Parameters ---------- str_expr : string string with the gene reaction rule to parse Returns ------- tuple elements ast_tree and gene_ids as a set """ str_expr = str_expr.strip() if len(str_expr) == 0: return...
[ "def", "parse_gpr", "(", "str_expr", ")", ":", "str_expr", "=", "str_expr", ".", "strip", "(", ")", "if", "len", "(", "str_expr", ")", "==", "0", ":", "return", "None", ",", "set", "(", ")", "for", "char", ",", "escaped", "in", "replacements", ":", ...
parse gpr into AST Parameters ---------- str_expr : string string with the gene reaction rule to parse Returns ------- tuple elements ast_tree and gene_ids as a set
[ "parse", "gpr", "into", "AST" ]
python
valid
29.423077
Gandi/gandi.cli
gandi/cli/modules/network.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/network.py#L180-L185
def resource_list(cls): """ Get the possible list of resources (name, id). """ items = cls.list() ret = [vlan['name'] for vlan in items] ret.extend([str(vlan['id']) for vlan in items]) return ret
[ "def", "resource_list", "(", "cls", ")", ":", "items", "=", "cls", ".", "list", "(", ")", "ret", "=", "[", "vlan", "[", "'name'", "]", "for", "vlan", "in", "items", "]", "ret", ".", "extend", "(", "[", "str", "(", "vlan", "[", "'id'", "]", ")",...
Get the possible list of resources (name, id).
[ "Get", "the", "possible", "list", "of", "resources", "(", "name", "id", ")", "." ]
python
train
38.333333
bitesofcode/projexui
projexui/widgets/xserialedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xserialedit.py#L315-L322
def selectAll(self): """ Selects the text within all the editors. """ self.blockEditorHandling(True) for editor in self.editors(): editor.selectAll() self.blockEditorHandling(False)
[ "def", "selectAll", "(", "self", ")", ":", "self", ".", "blockEditorHandling", "(", "True", ")", "for", "editor", "in", "self", ".", "editors", "(", ")", ":", "editor", ".", "selectAll", "(", ")", "self", ".", "blockEditorHandling", "(", "False", ")" ]
Selects the text within all the editors.
[ "Selects", "the", "text", "within", "all", "the", "editors", "." ]
python
train
30.125
Microsoft/nni
tools/nni_cmd/nnictl_utils.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/nnictl_utils.py#L275-L292
def list_experiment(args): '''Get experiment information''' nni_config = Config(get_config_filename(args)) rest_port = nni_config.get_config('restServerPort') rest_pid = nni_config.get_config('restServerPid') if not detect_process(rest_pid): print_error('Experiment is not running...') ...
[ "def", "list_experiment", "(", "args", ")", ":", "nni_config", "=", "Config", "(", "get_config_filename", "(", "args", ")", ")", "rest_port", "=", "nni_config", ".", "get_config", "(", "'restServerPort'", ")", "rest_pid", "=", "nni_config", ".", "get_config", ...
Get experiment information
[ "Get", "experiment", "information" ]
python
train
44.222222
tensorflow/tensor2tensor
tensor2tensor/layers/common_attention.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_attention.py#L3964-L4299
def multihead_attention(query_antecedent, memory_antecedent, bias, total_key_depth, total_value_depth, output_depth, num_heads, dropout_rate, ...
[ "def", "multihead_attention", "(", "query_antecedent", ",", "memory_antecedent", ",", "bias", ",", "total_key_depth", ",", "total_value_depth", ",", "output_depth", ",", "num_heads", ",", "dropout_rate", ",", "attention_type", "=", "\"dot_product\"", ",", "max_relative_...
Multihead scaled-dot-product attention with input/output transformations. Args: query_antecedent: a Tensor with shape [batch, length_q, channels] memory_antecedent: a Tensor with shape [batch, length_m, channels] or None bias: bias Tensor (see attention_bias()) total_key_depth: an integer total_v...
[ "Multihead", "scaled", "-", "dot", "-", "product", "attention", "with", "input", "/", "output", "transformations", "." ]
python
train
45.616071
apache/incubator-heron
heron/tools/cli/src/python/main.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L78-L92
def get_command_handlers(): ''' Create a map of command names and handlers ''' return { 'activate': activate, 'config': hconfig, 'deactivate': deactivate, 'help': cli_help, 'kill': kill, 'restart': restart, 'submit': submit, 'update': update, 'version': vers...
[ "def", "get_command_handlers", "(", ")", ":", "return", "{", "'activate'", ":", "activate", ",", "'config'", ":", "hconfig", ",", "'deactivate'", ":", "deactivate", ",", "'help'", ":", "cli_help", ",", "'kill'", ":", "kill", ",", "'restart'", ":", "restart",...
Create a map of command names and handlers
[ "Create", "a", "map", "of", "command", "names", "and", "handlers" ]
python
valid
20.866667
mapmyfitness/jtime
jtime/jtime.py
https://github.com/mapmyfitness/jtime/blob/402fb6b40ac7a78c23fd02fac50c6dbe49e5ebfd/jtime/jtime.py#L40-L56
def configure(): """ Update config """ jira_url = utils.get_input(raw_input, "Jira url") username = utils.get_input(raw_input, "username") password = utils.get_input(getpass.getpass, "password") error_reporting = True \ if 'n' not in raw_input("Would you like to automatically report ...
[ "def", "configure", "(", ")", ":", "jira_url", "=", "utils", ".", "get_input", "(", "raw_input", ",", "\"Jira url\"", ")", "username", "=", "utils", ".", "get_input", "(", "raw_input", ",", "\"username\"", ")", "password", "=", "utils", ".", "get_input", "...
Update config
[ "Update", "config" ]
python
train
49.882353
ellmetha/django-machina
machina/apps/forum_member/views.py
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_member/views.py#L145-L150
def subscribe(self, request, *args, **kwargs): """ Performs the subscribe action. """ self.object = self.get_object() self.object.subscribers.add(request.user) messages.success(self.request, self.success_message) return HttpResponseRedirect(self.get_success_url())
[ "def", "subscribe", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "object", "=", "self", ".", "get_object", "(", ")", "self", ".", "object", ".", "subscribers", ".", "add", "(", "request", ".", "user...
Performs the subscribe action.
[ "Performs", "the", "subscribe", "action", "." ]
python
train
49.833333
google/prettytensor
prettytensor/pretty_tensor_loss_methods.py
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_loss_methods.py#L793-L797
def _compute_average_correct(input_, labels, per_example_weights, topk=1): """Returns the numerator and denominator of classifier accuracy.""" return _compute_sparse_average_correct( input_, tf.reshape(tf.argmax(labels, 1), [-1, 1]), per_example_weights, topk=topk)
[ "def", "_compute_average_correct", "(", "input_", ",", "labels", ",", "per_example_weights", ",", "topk", "=", "1", ")", ":", "return", "_compute_sparse_average_correct", "(", "input_", ",", "tf", ".", "reshape", "(", "tf", ".", "argmax", "(", "labels", ",", ...
Returns the numerator and denominator of classifier accuracy.
[ "Returns", "the", "numerator", "and", "denominator", "of", "classifier", "accuracy", "." ]
python
train
55.4
google/apitools
apitools/base/py/credentials_lib.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/credentials_lib.py#L508-L530
def _GetRunFlowFlags(args=None): """Retrieves command line flags based on gflags module.""" # There's one rare situation where gsutil will not have argparse # available, but doesn't need anything depending on argparse anyway, # since they're bringing their own credentials. So we just allow this # to...
[ "def", "_GetRunFlowFlags", "(", "args", "=", "None", ")", ":", "# There's one rare situation where gsutil will not have argparse", "# available, but doesn't need anything depending on argparse anyway,", "# since they're bringing their own credentials. So we just allow this", "# to fail with an...
Retrieves command line flags based on gflags module.
[ "Retrieves", "command", "line", "flags", "based", "on", "gflags", "module", "." ]
python
train
44.391304
Aperture-py/aperture-lib
aperturelib/resize.py
https://github.com/Aperture-py/aperture-lib/blob/5c54af216319f297ddf96181a16f088cf1ba23f3/aperturelib/resize.py#L1-L23
def resize_image(image, tuple_wh, preserve_aspect=True): """Resizes an instance of a PIL Image. In order to prevent un-intended side effects, this function always returns a copy of the image, as the resize function from PIL returns a copy but the thumbnail function does not. Args: ima...
[ "def", "resize_image", "(", "image", ",", "tuple_wh", ",", "preserve_aspect", "=", "True", ")", ":", "if", "preserve_aspect", ":", "img_cpy", "=", "image", ".", "copy", "(", ")", "img_cpy", ".", "thumbnail", "(", "tuple_wh", ")", "return", "img_cpy", "else...
Resizes an instance of a PIL Image. In order to prevent un-intended side effects, this function always returns a copy of the image, as the resize function from PIL returns a copy but the thumbnail function does not. Args: image: An instance of a PIL Image. tuple_wh: A tuple contai...
[ "Resizes", "an", "instance", "of", "a", "PIL", "Image", "." ]
python
train
33.043478
tensorflow/tensor2tensor
tensor2tensor/models/slicenet.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/slicenet.py#L296-L334
def slicenet_params1(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.batch_size = 1024 hparams.hidden_size = 768 hparams.dropout = 0.5 hparams.symbol_dropout = 0.2 hparams.label_smoothing = 0.1 hparams.clip_grad_norm = 2.0 hparams.num_hidden_layers = 4 hparams.kerne...
[ "def", "slicenet_params1", "(", ")", ":", "hparams", "=", "common_hparams", ".", "basic_params1", "(", ")", "hparams", ".", "batch_size", "=", "1024", "hparams", ".", "hidden_size", "=", "768", "hparams", ".", "dropout", "=", "0.5", "hparams", ".", "symbol_d...
Set of hyperparameters.
[ "Set", "of", "hyperparameters", "." ]
python
train
38.897436
ojii/django-multilingual-ng
multilingual/translation.py
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/translation.py#L22-L36
def translation_save_translated_fields(instance, **kwargs): """ Save all the translations of instance in post_save signal handler. """ if not hasattr(instance, '_translation_cache'): return for l_id, translation in instance._translation_cache.iteritems(): # set the translation ID jus...
[ "def", "translation_save_translated_fields", "(", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "not", "hasattr", "(", "instance", ",", "'_translation_cache'", ")", ":", "return", "for", "l_id", ",", "translation", "in", "instance", ".", "_translation_cac...
Save all the translations of instance in post_save signal handler.
[ "Save", "all", "the", "translations", "of", "instance", "in", "post_save", "signal", "handler", "." ]
python
train
44.8
pantsbuild/pants
src/python/pants/java/jar/jar_dependency_utils.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/java/jar/jar_dependency_utils.py#L89-L99
def unversioned(cls, coord): """The coordinate without the version. :param M2Coordinate coord: an M2Coordinate or JarDependency. :return: the coordinate without the version. :rtype: M2Coordinate """ coord = cls.create(coord) if coord.rev is None: return coord return M2Coordinate(o...
[ "def", "unversioned", "(", "cls", ",", "coord", ")", ":", "coord", "=", "cls", ".", "create", "(", "coord", ")", "if", "coord", ".", "rev", "is", "None", ":", "return", "coord", "return", "M2Coordinate", "(", "org", "=", "coord", ".", "org", ",", "...
The coordinate without the version. :param M2Coordinate coord: an M2Coordinate or JarDependency. :return: the coordinate without the version. :rtype: M2Coordinate
[ "The", "coordinate", "without", "the", "version", "." ]
python
train
34.909091
libyal/dtfabric
dtfabric/runtime/data_maps.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L733-L755
def _GetElementDataTypeDefinition(self, data_type_definition): """Retrieves the element data type definition. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: DataTypeDefinition: element data type definition. Raises: FormatError: if the element data ty...
[ "def", "_GetElementDataTypeDefinition", "(", "self", ",", "data_type_definition", ")", ":", "if", "not", "data_type_definition", ":", "raise", "errors", ".", "FormatError", "(", "'Missing data type definition'", ")", "element_data_type_definition", "=", "getattr", "(", ...
Retrieves the element data type definition. Args: data_type_definition (DataTypeDefinition): data type definition. Returns: DataTypeDefinition: element data type definition. Raises: FormatError: if the element data type cannot be determined from the data type definition.
[ "Retrieves", "the", "element", "data", "type", "definition", "." ]
python
train
32.652174
allenai/allennlp
allennlp/semparse/worlds/world.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/semparse/worlds/world.py#L184-L204
def get_multi_match_mapping(self) -> Dict[Type, List[Type]]: """ Returns a mapping from each `MultiMatchNamedBasicType` to all the `NamedBasicTypes` that it matches. """ if self._multi_match_mapping is None: self._multi_match_mapping = {} basic_types = sel...
[ "def", "get_multi_match_mapping", "(", "self", ")", "->", "Dict", "[", "Type", ",", "List", "[", "Type", "]", "]", ":", "if", "self", ".", "_multi_match_mapping", "is", "None", ":", "self", ".", "_multi_match_mapping", "=", "{", "}", "basic_types", "=", ...
Returns a mapping from each `MultiMatchNamedBasicType` to all the `NamedBasicTypes` that it matches.
[ "Returns", "a", "mapping", "from", "each", "MultiMatchNamedBasicType", "to", "all", "the", "NamedBasicTypes", "that", "it", "matches", "." ]
python
train
57.285714
iotile/coretools
iotile_ext_cloud/iotile/cloud/config.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/config.py#L14-L65
def link_cloud(self, username=None, password=None, device_id=None): """Create and store a token for interacting with the IOTile Cloud API. You will need to call link_cloud once for each virtualenv that you create and want to use with any api calls that touch iotile cloud. Note that this method is call...
[ "def", "link_cloud", "(", "self", ",", "username", "=", "None", ",", "password", "=", "None", ",", "device_id", "=", "None", ")", ":", "reg", "=", "ComponentRegistry", "(", ")", "domain", "=", "self", ".", "get", "(", "'cloud:server'", ")", "if", "user...
Create and store a token for interacting with the IOTile Cloud API. You will need to call link_cloud once for each virtualenv that you create and want to use with any api calls that touch iotile cloud. Note that this method is called on a ConfigManager instance If you do not pass your username or pas...
[ "Create", "and", "store", "a", "token", "for", "interacting", "with", "the", "IOTile", "Cloud", "API", "." ]
python
train
34.788462
xtuml/pyxtuml
bridgepoint/oal.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1663-L1667
def p_operation_invocation_1(self, p): '''instance_invocation : structure DOT identifier LPAREN parameter_list RPAREN''' p[0] = InstanceInvocationNode(handle=p[1], action_name=p[3], parameter_list=p[5])
[ "def", "p_operation_invocation_1", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "InstanceInvocationNode", "(", "handle", "=", "p", "[", "1", "]", ",", "action_name", "=", "p", "[", "3", "]", ",", "parameter_list", "=", "p", "[", "5", "...
instance_invocation : structure DOT identifier LPAREN parameter_list RPAREN
[ "instance_invocation", ":", "structure", "DOT", "identifier", "LPAREN", "parameter_list", "RPAREN" ]
python
test
58
peshay/tpm
tpm.py
https://github.com/peshay/tpm/blob/8e64a4d8b89d54bdd2c92d965463a7508aa3d0bc/tpm.py#L238-L243
def collection(self, path): """To return all items generated by get collection.""" data = [] for item in self.get_collection(path): data.append(item) return data
[ "def", "collection", "(", "self", ",", "path", ")", ":", "data", "=", "[", "]", "for", "item", "in", "self", ".", "get_collection", "(", "path", ")", ":", "data", ".", "append", "(", "item", ")", "return", "data" ]
To return all items generated by get collection.
[ "To", "return", "all", "items", "generated", "by", "get", "collection", "." ]
python
train
33.333333
xtuml/pyxtuml
xtuml/load.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/load.py#L381-L422
def populate_connections(self, metamodel): ''' Populate links in a *metamodel* with connections between them. ''' storage = dict() for ass in metamodel.associations: source_class = ass.source_link.to_metaclass target_class = ass.target_link.to_metaclass ...
[ "def", "populate_connections", "(", "self", ",", "metamodel", ")", ":", "storage", "=", "dict", "(", ")", "for", "ass", "in", "metamodel", ".", "associations", ":", "source_class", "=", "ass", ".", "source_link", ".", "to_metaclass", "target_class", "=", "as...
Populate links in a *metamodel* with connections between them.
[ "Populate", "links", "in", "a", "*", "metamodel", "*", "with", "connections", "between", "them", "." ]
python
test
42.761905
StackStorm/pybind
pybind/slxos/v17r_1_01a/brocade_mpls_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/brocade_mpls_rpc/__init__.py#L915-L936
def _set_show_mpls_policy(self, v, load=False): """ Setter method for show_mpls_policy, mapped from YANG variable /brocade_mpls_rpc/show_mpls_policy (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_show_mpls_policy is considered as a private method. Backends loo...
[ "def", "_set_show_mpls_policy", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for show_mpls_policy, mapped from YANG variable /brocade_mpls_rpc/show_mpls_policy (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_show_mpls_policy is considered as a private method. Backends looking to populate this variable should do so via calling ...
[ "Setter", "method", "for", "show_mpls_policy", "mapped", "from", "YANG", "variable", "/", "brocade_mpls_rpc", "/", "show_mpls_policy", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "sourc...
python
train
73.590909
voxpupuli/pypuppetdb
pypuppetdb/api.py
https://github.com/voxpupuli/pypuppetdb/blob/cedeecf48014b4ad5b8e2513ca8230c814f45603/pypuppetdb/api.py#L189-L201
def base_url(self): """A base_url that will be used to construct the final URL we're going to query against. :returns: A URL of the form: ``proto://host:port``. :rtype: :obj:`string` """ return '{proto}://{host}:{port}{url_path}'.format( proto=self.protocol, ...
[ "def", "base_url", "(", "self", ")", ":", "return", "'{proto}://{host}:{port}{url_path}'", ".", "format", "(", "proto", "=", "self", ".", "protocol", ",", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "url_path", "=", "sel...
A base_url that will be used to construct the final URL we're going to query against. :returns: A URL of the form: ``proto://host:port``. :rtype: :obj:`string`
[ "A", "base_url", "that", "will", "be", "used", "to", "construct", "the", "final", "URL", "we", "re", "going", "to", "query", "against", "." ]
python
valid
31.461538
stanfordnlp/stanza
stanza/text/dataset.py
https://github.com/stanfordnlp/stanza/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/text/dataset.py#L122-L138
def write_conll(self, fname): """ Serializes the dataset in CONLL format to fname """ if 'label' not in self.fields: raise InvalidFieldsException("dataset is not in CONLL format: missing label field") def instance_to_conll(inst): tab = [v for k, v in inst...
[ "def", "write_conll", "(", "self", ",", "fname", ")", ":", "if", "'label'", "not", "in", "self", ".", "fields", ":", "raise", "InvalidFieldsException", "(", "\"dataset is not in CONLL format: missing label field\"", ")", "def", "instance_to_conll", "(", "inst", ")",...
Serializes the dataset in CONLL format to fname
[ "Serializes", "the", "dataset", "in", "CONLL", "format", "to", "fname" ]
python
train
45.294118
sanoma/django-arctic
arctic/generics.py
https://github.com/sanoma/django-arctic/blob/c81b092c2643ca220708bf3c586017d9175161f5/arctic/generics.py#L126-L149
def get_breadcrumbs(self): """ Breadcrumb format: (('name', 'url'), ...) or None if not used. """ if not self.breadcrumbs: return None else: allowed_breadcrumbs = [] for breadcrumb in self.breadcrumbs: # check permission based ...
[ "def", "get_breadcrumbs", "(", "self", ")", ":", "if", "not", "self", ".", "breadcrumbs", ":", "return", "None", "else", ":", "allowed_breadcrumbs", "=", "[", "]", "for", "breadcrumb", "in", "self", ".", "breadcrumbs", ":", "# check permission based on named_url...
Breadcrumb format: (('name', 'url'), ...) or None if not used.
[ "Breadcrumb", "format", ":", "((", "name", "url", ")", "...", ")", "or", "None", "if", "not", "used", "." ]
python
train
35.541667
brbsix/subsystem
subsystem/subsystem.py
https://github.com/brbsix/subsystem/blob/57705bc20d71ceaed9e22e21246265d717e98eb8/subsystem/subsystem.py#L276-L289
def multithreader(args, paths): """Execute multiple processes at once.""" def shellprocess(path): """Return a ready-to-use subprocess.""" import subprocess return subprocess.Popen(args + [path], stderr=subprocess.DEVNULL, s...
[ "def", "multithreader", "(", "args", ",", "paths", ")", ":", "def", "shellprocess", "(", "path", ")", ":", "\"\"\"Return a ready-to-use subprocess.\"\"\"", "import", "subprocess", "return", "subprocess", ".", "Popen", "(", "args", "+", "[", "path", "]", ",", "...
Execute multiple processes at once.
[ "Execute", "multiple", "processes", "at", "once", "." ]
python
train
31.571429
pallets/werkzeug
src/werkzeug/utils.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L669-L707
def bind_arguments(func, args, kwargs): """Bind the arguments provided into a dict. When passed a function, a tuple of arguments and a dict of keyword arguments `bind_arguments` returns a dict of names as the function would see it. This can be useful to implement a cache decorator that uses the functi...
[ "def", "bind_arguments", "(", "func", ",", "args", ",", "kwargs", ")", ":", "(", "args", ",", "kwargs", ",", "missing", ",", "extra", ",", "extra_positional", ",", "arg_spec", ",", "vararg_var", ",", "kwarg_var", ",", ")", "=", "_parse_signature", "(", "...
Bind the arguments provided into a dict. When passed a function, a tuple of arguments and a dict of keyword arguments `bind_arguments` returns a dict of names as the function would see it. This can be useful to implement a cache decorator that uses the function arguments to build the cache key based o...
[ "Bind", "the", "arguments", "provided", "into", "a", "dict", ".", "When", "passed", "a", "function", "a", "tuple", "of", "arguments", "and", "a", "dict", "of", "keyword", "arguments", "bind_arguments", "returns", "a", "dict", "of", "names", "as", "the", "f...
python
train
37.461538
letuananh/chirptext
chirptext/texttaglib.py
https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L234-L236
def get_tags(self, tagtype): ''' Get all tags of a type ''' return [t for t in self.__tags if t.tagtype == tagtype]
[ "def", "get_tags", "(", "self", ",", "tagtype", ")", ":", "return", "[", "t", "for", "t", "in", "self", ".", "__tags", "if", "t", ".", "tagtype", "==", "tagtype", "]" ]
Get all tags of a type
[ "Get", "all", "tags", "of", "a", "type" ]
python
train
43
square/pylink
pylink/__main__.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/__main__.py#L379-L398
def add_arguments(self, parser): """Adds the arguments for the emulator command. Args: self (EmulatorCommand): the ``EmulatorCommand`` instance parser (argparse.ArgumentParser): parser to add the commands to Returns: ``None`` """ group = parser.add...
[ "def", "add_arguments", "(", "self", ",", "parser", ")", ":", "group", "=", "parser", ".", "add_mutually_exclusive_group", "(", "required", "=", "True", ")", "group", ".", "add_argument", "(", "'-l'", ",", "'--list'", ",", "nargs", "=", "'?'", ",", "type",...
Adds the arguments for the emulator command. Args: self (EmulatorCommand): the ``EmulatorCommand`` instance parser (argparse.ArgumentParser): parser to add the commands to Returns: ``None``
[ "Adds", "the", "arguments", "for", "the", "emulator", "command", "." ]
python
train
41.8
alpacahq/pylivetrader
pylivetrader/data/bardata.py
https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/data/bardata.py#L333-L357
def _get_current_minute(self): """ Internal utility method to get the current simulation time. Possible answers are: - whatever the algorithm's get_datetime() method returns (this is what `self.simulation_dt_func()` points to) - sometimes we're knowingly not in a mar...
[ "def", "_get_current_minute", "(", "self", ")", ":", "dt", "=", "self", ".", "datetime", "if", "self", ".", "_adjust_minutes", ":", "dt", "=", "self", ".", "data_portal", ".", "trading_calendar", ".", "previous_minute", "(", "dt", ")", "if", "self", ".", ...
Internal utility method to get the current simulation time. Possible answers are: - whatever the algorithm's get_datetime() method returns (this is what `self.simulation_dt_func()` points to) - sometimes we're knowingly not in a market minute, like if we're in before_tra...
[ "Internal", "utility", "method", "to", "get", "the", "current", "simulation", "time", "." ]
python
train
38.64
faroit/stempeg
stempeg/read.py
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/read.py#L80-L176
def read_stems( filename, out_type=np.float_, stem_id=None, start=0, duration=None, info=None ): """Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. ...
[ "def", "read_stems", "(", "filename", ",", "out_type", "=", "np", ".", "float_", ",", "stem_id", "=", "None", ",", "start", "=", "0", ",", "duration", "=", "None", ",", "info", "=", "None", ")", ":", "if", "info", "is", "None", ":", "FFinfo", "=", ...
Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. Defaults to 32bit float aka `np.float32`. stem_id : int Stem ID (Stream ID) to read. Defaults to `None`, which reads...
[ "Read", "STEMS", "format", "into", "numpy", "Tensor" ]
python
train
27.43299
onicagroup/runway
runway/module/terraform.py
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/module/terraform.py#L180-L217
def run_terraform_init(tf_bin, # pylint: disable=too-many-arguments module_path, backend_options, env_name, env_region, env_vars): """Run Terraform init.""" init_cmd = [tf_bin, 'init'] cmd_opts = {'env_vars': env_vars, 'exit_on_error': False} if backend_op...
[ "def", "run_terraform_init", "(", "tf_bin", ",", "# pylint: disable=too-many-arguments", "module_path", ",", "backend_options", ",", "env_name", ",", "env_region", ",", "env_vars", ")", ":", "init_cmd", "=", "[", "tf_bin", ",", "'init'", "]", "cmd_opts", "=", "{",...
Run Terraform init.
[ "Run", "Terraform", "init", "." ]
python
train
49.289474
enkore/i3pystatus
i3pystatus/core/io.py
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/core/io.py#L127-L156
def refresh_signal_handler(self, signo, frame): """ This callback is called when SIGUSR1 signal is received. It updates outputs of all modules by calling their `run` method. Interval modules are updated in separate threads if their interval is above a certain treshold value. ...
[ "def", "refresh_signal_handler", "(", "self", ",", "signo", ",", "frame", ")", ":", "if", "signo", "!=", "signal", ".", "SIGUSR1", ":", "return", "for", "module", "in", "self", ".", "modules", ":", "if", "hasattr", "(", "module", ",", "\"interval\"", ")"...
This callback is called when SIGUSR1 signal is received. It updates outputs of all modules by calling their `run` method. Interval modules are updated in separate threads if their interval is above a certain treshold value. This treshold is computed by :func:`compute_treshold_interval`...
[ "This", "callback", "is", "called", "when", "SIGUSR1", "signal", "is", "received", "." ]
python
train
35.6
Diviyan-Kalainathan/CausalDiscoveryToolbox
cdt/causality/graph/SAM.py
https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/graph/SAM.py#L147-L150
def forward(self, x): """Feed-forward the model.""" return self.layers(x * (self._filter * self.fs_filter).expand_as(x))
[ "def", "forward", "(", "self", ",", "x", ")", ":", "return", "self", ".", "layers", "(", "x", "*", "(", "self", ".", "_filter", "*", "self", ".", "fs_filter", ")", ".", "expand_as", "(", "x", ")", ")" ]
Feed-forward the model.
[ "Feed", "-", "forward", "the", "model", "." ]
python
valid
41.25
zomux/deepy
deepy/trainers/trainers.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/trainers/trainers.py#L65-L72
def optimization_updates(self, params, gradients): """ Return updates from optimization. """ updates, free_parameters = optimize_updates(params, gradients, self.config) self.network.free_parameters.extend(free_parameters) logging.info("Added %d free parameters for optimiz...
[ "def", "optimization_updates", "(", "self", ",", "params", ",", "gradients", ")", ":", "updates", ",", "free_parameters", "=", "optimize_updates", "(", "params", ",", "gradients", ",", "self", ".", "config", ")", "self", ".", "network", ".", "free_parameters",...
Return updates from optimization.
[ "Return", "updates", "from", "optimization", "." ]
python
test
45.75
VisualOps/cli
visualops/utils/db.py
https://github.com/VisualOps/cli/blob/e9ee9a804df0de3cce54be4c623528fd658838dc/visualops/utils/db.py#L58-L71
def app_update_state(app_id,state): """ update app state """ try: create_at = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') conn = get_conn() c = conn.cursor() c.execute("UPDATE app SET state='{0}',change_at='{1}' WHERE id='{2}'".format(state, create_at, app_id)) ...
[ "def", "app_update_state", "(", "app_id", ",", "state", ")", ":", "try", ":", "create_at", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%Y-%m-%d %H:%M:%S'", ")", "conn", "=", "get_conn", "(", ")", "c", "=", "conn", "....
update app state
[ "update", "app", "state" ]
python
train
37.857143
hhatto/autopep8
update_readme.py
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/update_readme.py#L54-L58
def check(source): """Check code.""" compile(source, '<string>', 'exec', dont_inherit=True) reporter = pyflakes.reporter.Reporter(sys.stderr, sys.stderr) pyflakes.api.check(source, filename='<string>', reporter=reporter)
[ "def", "check", "(", "source", ")", ":", "compile", "(", "source", ",", "'<string>'", ",", "'exec'", ",", "dont_inherit", "=", "True", ")", "reporter", "=", "pyflakes", ".", "reporter", ".", "Reporter", "(", "sys", ".", "stderr", ",", "sys", ".", "stde...
Check code.
[ "Check", "code", "." ]
python
train
46.4
log2timeline/dfvfs
dfvfs/helpers/source_scanner.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/helpers/source_scanner.py#L778-L832
def ScanForVolumeSystem(self, source_path_spec): """Scans the path specification for a supported volume system format. Args: source_path_spec (PathSpec): source path specification. Returns: PathSpec: volume system path specification or None if no supported volume system type was foun...
[ "def", "ScanForVolumeSystem", "(", "self", ",", "source_path_spec", ")", ":", "if", "source_path_spec", ".", "type_indicator", "==", "definitions", ".", "TYPE_INDICATOR_VSHADOW", ":", "# It is technically possible to scan for VSS-in-VSS but makes no sense", "# to do so.", "retu...
Scans the path specification for a supported volume system format. Args: source_path_spec (PathSpec): source path specification. Returns: PathSpec: volume system path specification or None if no supported volume system type was found. Raises: BackEndError: if the source cannot...
[ "Scans", "the", "path", "specification", "for", "a", "supported", "volume", "system", "format", "." ]
python
train
36.763636
Jajcus/pyxmpp2
pyxmpp2/streamsasl.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streamsasl.py#L299-L331
def _process_sasl_success(self, stream, element): """Process incoming <sasl:success/> element. [initiating entity only] """ if not self.authenticator: logger.debug("Unexpected SASL response") return False content = element.text if content: ...
[ "def", "_process_sasl_success", "(", "self", ",", "stream", ",", "element", ")", ":", "if", "not", "self", ".", "authenticator", ":", "logger", ".", "debug", "(", "\"Unexpected SASL response\"", ")", "return", "False", "content", "=", "element", ".", "text", ...
Process incoming <sasl:success/> element. [initiating entity only]
[ "Process", "incoming", "<sasl", ":", "success", "/", ">", "element", "." ]
python
valid
34.212121
NeuroML/pyNeuroML
pyneuroml/povray/MakeMovie.py
https://github.com/NeuroML/pyNeuroML/blob/aeba2e3040b360bb26556f643cccbfb3dac3b8fb/pyneuroml/povray/MakeMovie.py#L27-L92
def process_args(): """ Parse command-line arguments. """ parser = argparse.ArgumentParser(description="A file for overlaying POVRay files generated from NeuroML by NeuroML1ToPOVRay.py with cell activity (e.g. as generated from a neuroConstruct simulation)") parser.add_argument('prefix', ...
[ "def", "process_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"A file for overlaying POVRay files generated from NeuroML by NeuroML1ToPOVRay.py with cell activity (e.g. as generated from a neuroConstruct simulation)\"", ")", "parser"...
Parse command-line arguments.
[ "Parse", "command", "-", "line", "arguments", "." ]
python
train
39.984848
signaturit/python-sdk
signaturit_sdk/signaturit_client.py
https://github.com/signaturit/python-sdk/blob/2419c6d9675d901244f807ae360dc58aa46109a9/signaturit_sdk/signaturit_client.py#L583-L592
def get_group(self, group_id): """ Get a single group """ url = self.TEAM_GROUPS_ID_URL % group_id connection = Connection(self.token) connection.set_url(self.production, url) return connection.get_request()
[ "def", "get_group", "(", "self", ",", "group_id", ")", ":", "url", "=", "self", ".", "TEAM_GROUPS_ID_URL", "%", "group_id", "connection", "=", "Connection", "(", "self", ".", "token", ")", "connection", ".", "set_url", "(", "self", ".", "production", ",", ...
Get a single group
[ "Get", "a", "single", "group" ]
python
train
25.6
capless/warrant
warrant/__init__.py
https://github.com/capless/warrant/blob/ff2e4793d8479e770f2461ef7cbc0c15ee784395/warrant/__init__.py#L245-L263
def check_token(self, renew=True): """ Checks the exp attribute of the access_token and either refreshes the tokens by calling the renew_access_tokens method or does nothing :param renew: bool indicating whether to refresh on expiration :return: bool indicating whether access_tok...
[ "def", "check_token", "(", "self", ",", "renew", "=", "True", ")", ":", "if", "not", "self", ".", "access_token", ":", "raise", "AttributeError", "(", "'Access Token Required to Check Token'", ")", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")...
Checks the exp attribute of the access_token and either refreshes the tokens by calling the renew_access_tokens method or does nothing :param renew: bool indicating whether to refresh on expiration :return: bool indicating whether access_token has expired
[ "Checks", "the", "exp", "attribute", "of", "the", "access_token", "and", "either", "refreshes", "the", "tokens", "by", "calling", "the", "renew_access_tokens", "method", "or", "does", "nothing", ":", "param", "renew", ":", "bool", "indicating", "whether", "to", ...
python
train
40.894737
goose3/goose3
goose3/__init__.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/__init__.py#L94-L101
def close(self): ''' Close the network connection and perform any other required cleanup Note: Auto closed when using goose as a context manager or when garbage collected ''' if self.fetcher is not None: self.shutdown_network() self.finalizer.atexit = Fal...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "fetcher", "is", "not", "None", ":", "self", ".", "shutdown_network", "(", ")", "self", ".", "finalizer", ".", "atexit", "=", "False" ]
Close the network connection and perform any other required cleanup Note: Auto closed when using goose as a context manager or when garbage collected
[ "Close", "the", "network", "connection", "and", "perform", "any", "other", "required", "cleanup" ]
python
valid
39.375
bokeh/bokeh
bokeh/server/views/ws.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L243-L257
def send_message(self, message): ''' Send a Bokeh Server protocol message to the connected client. Args: message (Message) : a message to send ''' try: if _message_test_port is not None: _message_test_port.sent.append(message) yield m...
[ "def", "send_message", "(", "self", ",", "message", ")", ":", "try", ":", "if", "_message_test_port", "is", "not", "None", ":", "_message_test_port", ".", "sent", ".", "append", "(", "message", ")", "yield", "message", ".", "send", "(", "self", ")", "exc...
Send a Bokeh Server protocol message to the connected client. Args: message (Message) : a message to send
[ "Send", "a", "Bokeh", "Server", "protocol", "message", "to", "the", "connected", "client", "." ]
python
train
38.733333
fbcotter/py3nvml
py3nvml/py3nvml.py
https://github.com/fbcotter/py3nvml/blob/47f0f2c0eee56dec4e4beebec26b734e01d357b7/py3nvml/py3nvml.py#L2095-L2126
def nvmlDeviceGetBoardId(handle): r""" /** * Retrieves the device boardId from 0-N. * Devices with the same boardId indicate GPUs connected to the same PLX. Use in conjunction with * \ref nvmlDeviceGetMultiGpuBoard() to decide if they are on the same board as well. * The boardId returned ...
[ "def", "nvmlDeviceGetBoardId", "(", "handle", ")", ":", "c_id", "=", "c_uint", "(", ")", "fn", "=", "_nvmlGetFunctionPointer", "(", "\"nvmlDeviceGetBoardId\"", ")", "ret", "=", "fn", "(", "handle", ",", "byref", "(", "c_id", ")", ")", "_nvmlCheckReturn", "("...
r""" /** * Retrieves the device boardId from 0-N. * Devices with the same boardId indicate GPUs connected to the same PLX. Use in conjunction with * \ref nvmlDeviceGetMultiGpuBoard() to decide if they are on the same board as well. * The boardId returned is a unique ID for the current configu...
[ "r", "/", "**", "*", "Retrieves", "the", "device", "boardId", "from", "0", "-", "N", ".", "*", "Devices", "with", "the", "same", "boardId", "indicate", "GPUs", "connected", "to", "the", "same", "PLX", ".", "Use", "in", "conjunction", "with", "*", "\\",...
python
train
54.59375
undertherain/pycontextfree
setup_boilerplate.py
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L249-L254
def try_fields(cls, *names) -> t.Optional[t.Any]: """Return first existing of given class field names.""" for name in names: if hasattr(cls, name): return getattr(cls, name) raise AttributeError((cls, names))
[ "def", "try_fields", "(", "cls", ",", "*", "names", ")", "->", "t", ".", "Optional", "[", "t", ".", "Any", "]", ":", "for", "name", "in", "names", ":", "if", "hasattr", "(", "cls", ",", "name", ")", ":", "return", "getattr", "(", "cls", ",", "n...
Return first existing of given class field names.
[ "Return", "first", "existing", "of", "given", "class", "field", "names", "." ]
python
train
42.5
google/grr
grr/client/grr_response_client/client_utils_common.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_utils_common.py#L242-L256
def HashFile(self, fd, byte_count): """Updates underlying hashers with a given file. Args: fd: A file object that is going to be fed to the hashers. byte_count: A maximum number of bytes that are going to be processed. """ while byte_count > 0: buf_size = min(byte_count, constants.CLI...
[ "def", "HashFile", "(", "self", ",", "fd", ",", "byte_count", ")", ":", "while", "byte_count", ">", "0", ":", "buf_size", "=", "min", "(", "byte_count", ",", "constants", ".", "CLIENT_MAX_BUFFER_SIZE", ")", "buf", "=", "fd", ".", "read", "(", "buf_size",...
Updates underlying hashers with a given file. Args: fd: A file object that is going to be fed to the hashers. byte_count: A maximum number of bytes that are going to be processed.
[ "Updates", "underlying", "hashers", "with", "a", "given", "file", "." ]
python
train
29.666667
pdkit/pdkit
pdkit/updrs.py
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/updrs.py#L91-L140
def __train(self, n_clusters=4): """ Calculate cluster's centroids and standard deviations. If there are at least the number of threshold rows \ then: * Observations will be normalised. * Standard deviations will be returned. * Clusters will be retu...
[ "def", "__train", "(", "self", ",", "n_clusters", "=", "4", ")", ":", "try", ":", "for", "obs", "in", "self", ".", "observations", ":", "features", ",", "ids", "=", "self", ".", "__get_features_for_observation", "(", "observation", "=", "obs", ",", "last...
Calculate cluster's centroids and standard deviations. If there are at least the number of threshold rows \ then: * Observations will be normalised. * Standard deviations will be returned. * Clusters will be returned. * Centroids are ordered based on their...
[ "Calculate", "cluster", "s", "centroids", "and", "standard", "deviations", ".", "If", "there", "are", "at", "least", "the", "number", "of", "threshold", "rows", "\\", "then", ":" ]
python
train
42.82
hazelcast/hazelcast-python-client
hazelcast/protocol/codec/client_authentication_codec.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/protocol/codec/client_authentication_codec.py#L31-L49
def encode_request(username, password, uuid, owner_uuid, is_owner_connection, client_type, serialization_version, client_hazelcast_version): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(username, password, uuid, owner_uuid, is_owner_connection, client_type...
[ "def", "encode_request", "(", "username", ",", "password", ",", "uuid", ",", "owner_uuid", ",", "is_owner_connection", ",", "client_type", ",", "serialization_version", ",", "client_hazelcast_version", ")", ":", "client_message", "=", "ClientMessage", "(", "payload_si...
Encode request into client_message
[ "Encode", "request", "into", "client_message" ]
python
train
54.578947
bcbio/bcbio-nextgen
bcbio/illumina/samplesheet.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/illumina/samplesheet.py#L70-L79
def _generate_barcode_ids(info_iter): """Create unique barcode IDs assigned to sequences """ bc_type = "SampleSheet" barcodes = list(set([x[-1] for x in info_iter])) barcodes.sort() barcode_ids = {} for i, bc in enumerate(barcodes): barcode_ids[bc] = (bc_type, i+1) return barcode...
[ "def", "_generate_barcode_ids", "(", "info_iter", ")", ":", "bc_type", "=", "\"SampleSheet\"", "barcodes", "=", "list", "(", "set", "(", "[", "x", "[", "-", "1", "]", "for", "x", "in", "info_iter", "]", ")", ")", "barcodes", ".", "sort", "(", ")", "b...
Create unique barcode IDs assigned to sequences
[ "Create", "unique", "barcode", "IDs", "assigned", "to", "sequences" ]
python
train
31.5
kwikteam/phy
phy/plot/transform.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/plot/transform.py#L284-L289
def add_on_gpu(self, transforms): """Add some transforms.""" if not isinstance(transforms, list): transforms = [transforms] self.gpu_transforms.extend(transforms or []) return self
[ "def", "add_on_gpu", "(", "self", ",", "transforms", ")", ":", "if", "not", "isinstance", "(", "transforms", ",", "list", ")", ":", "transforms", "=", "[", "transforms", "]", "self", ".", "gpu_transforms", ".", "extend", "(", "transforms", "or", "[", "]"...
Add some transforms.
[ "Add", "some", "transforms", "." ]
python
train
36.5
saltstack/salt
salt/states/boto_vpc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1296-L1374
def nat_gateway_present(name, subnet_name=None, subnet_id=None, region=None, key=None, keyid=None, profile=None, allocation_id=None): ''' Ensure a nat gateway exists within the specified subnet This function requires boto3. .. versionadded:: 2016.11.0 Example: .. code...
[ "def", "nat_gateway_present", "(", "name", ",", "subnet_name", "=", "None", ",", "subnet_id", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "allocation_id", "=", "None", "...
Ensure a nat gateway exists within the specified subnet This function requires boto3. .. versionadded:: 2016.11.0 Example: .. code-block:: yaml boto_vpc.nat_gateway_present: - subnet_name: my-subnet name Name of the state subnet_name Name of the subnet wi...
[ "Ensure", "a", "nat", "gateway", "exists", "within", "the", "specified", "subnet" ]
python
train
31.772152
tensorflow/tensor2tensor
tensor2tensor/models/research/lm_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/lm_experiments.py#L45-L60
def lmx_base(): """Transformer on languagemodel_lm1b32k_packed. 50M Params.""" hparams = transformer.transformer_tpu() # sharing is counterproductive when underparameterized hparams.shared_embedding_and_softmax_weights = False # we judge by log-ppl, so label smoothing hurts. hparams.label_smoothing = 0.0 ...
[ "def", "lmx_base", "(", ")", ":", "hparams", "=", "transformer", ".", "transformer_tpu", "(", ")", "# sharing is counterproductive when underparameterized", "hparams", ".", "shared_embedding_and_softmax_weights", "=", "False", "# we judge by log-ppl, so label smoothing hurts.", ...
Transformer on languagemodel_lm1b32k_packed. 50M Params.
[ "Transformer", "on", "languagemodel_lm1b32k_packed", ".", "50M", "Params", "." ]
python
train
42.6875
brews/snakebacon
snakebacon/mcmcbackends/__init__.py
https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/mcmcbackends/__init__.py#L73-L92
def prior_sediment_memory(*args, **kwargs): """Get the prior density of sediment memory Returns ------- y : ndarray Array giving the density. x : ndarray Array of Memory (ratio) values over which the density was evaluated. """ # "plot the ...
[ "def", "prior_sediment_memory", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# \"plot the prior for the memory (= accumulation rate varibility between neighbouring depths)\"", "# PlotMemPrior @ Bacon.R ln 114 -> ln 1119 - 1141", "# w_a = mem_strength * mem_mean, w_b = mem_strength...
Get the prior density of sediment memory Returns ------- y : ndarray Array giving the density. x : ndarray Array of Memory (ratio) values over which the density was evaluated.
[ "Get", "the", "prior", "density", "of", "sediment", "memory" ]
python
train
44.05
Azure/msrest-for-python
msrest/universal_http/requests.py
https://github.com/Azure/msrest-for-python/blob/0732bc90bdb290e5f58c675ffdd7dbfa9acefc93/msrest/universal_http/requests.py#L120-L142
def send(self, request, **kwargs): # type: (ClientRequest, Any) -> ClientResponse """Send request object according to configuration. Allowed kwargs are: - session : will override the driver session and use yours. Should NOT be done unless really required. - anything else is sent...
[ "def", "send", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "# type: (ClientRequest, Any) -> ClientResponse", "# It's not recommended to provide its own session, and is mostly", "# to enable some legacy code to plug correctly", "session", "=", "kwargs", ".", ...
Send request object according to configuration. Allowed kwargs are: - session : will override the driver session and use yours. Should NOT be done unless really required. - anything else is sent straight to requests. :param ClientRequest request: The request object to be sent.
[ "Send", "request", "object", "according", "to", "configuration", "." ]
python
train
40.913043
tensorflow/lucid
lucid/misc/gl/glcontext.py
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/gl/glcontext.py#L79-L120
def create_opengl_context(surface_size=(640, 480)): """Create offscreen OpenGL context and make it current. Users are expected to directly use EGL API in case more advanced context management is required. Args: surface_size: (width, height), size of the offscreen rendering surface. """ egl_display = e...
[ "def", "create_opengl_context", "(", "surface_size", "=", "(", "640", ",", "480", ")", ")", ":", "egl_display", "=", "egl", ".", "eglGetDisplay", "(", "egl", ".", "EGL_DEFAULT_DISPLAY", ")", "major", ",", "minor", "=", "egl", ".", "EGLint", "(", ")", ","...
Create offscreen OpenGL context and make it current. Users are expected to directly use EGL API in case more advanced context management is required. Args: surface_size: (width, height), size of the offscreen rendering surface.
[ "Create", "offscreen", "OpenGL", "context", "and", "make", "it", "current", "." ]
python
train
34.285714
has2k1/mizani
mizani/transforms.py
https://github.com/has2k1/mizani/blob/312d0550ee0136fd1b0384829b33f3b2065f47c8/mizani/transforms.py#L525-L534
def transform(x): """ Transform from Timeddelta to numerical format """ # microseconds try: x = np.array([_x.total_seconds()*10**6 for _x in x]) except TypeError: x = x.total_seconds()*10**6 return x
[ "def", "transform", "(", "x", ")", ":", "# microseconds", "try", ":", "x", "=", "np", ".", "array", "(", "[", "_x", ".", "total_seconds", "(", ")", "*", "10", "**", "6", "for", "_x", "in", "x", "]", ")", "except", "TypeError", ":", "x", "=", "x...
Transform from Timeddelta to numerical format
[ "Transform", "from", "Timeddelta", "to", "numerical", "format" ]
python
valid
27
twilio/twilio-python
twilio/rest/preview/deployed_devices/fleet/device.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/preview/deployed_devices/fleet/device.py#L38-L67
def create(self, unique_name=values.unset, friendly_name=values.unset, identity=values.unset, deployment_sid=values.unset, enabled=values.unset): """ Create a new DeviceInstance :param unicode unique_name: A unique, addressable name of this Device. :param u...
[ "def", "create", "(", "self", ",", "unique_name", "=", "values", ".", "unset", ",", "friendly_name", "=", "values", ".", "unset", ",", "identity", "=", "values", ".", "unset", ",", "deployment_sid", "=", "values", ".", "unset", ",", "enabled", "=", "valu...
Create a new DeviceInstance :param unicode unique_name: A unique, addressable name of this Device. :param unicode friendly_name: A human readable description for this Device. :param unicode identity: An identifier of the Device user. :param unicode deployment_sid: The unique SID of the ...
[ "Create", "a", "new", "DeviceInstance" ]
python
train
37.666667
tcalmant/ipopo
pelix/ipopo/core.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L597-L604
def _unregister_all_factories(self): """ Unregisters all factories. This method should be called only after the iPOPO service has been unregistered (that's why it's not locked) """ factories = list(self.__factories.keys()) for factory_name in factories: self.u...
[ "def", "_unregister_all_factories", "(", "self", ")", ":", "factories", "=", "list", "(", "self", ".", "__factories", ".", "keys", "(", ")", ")", "for", "factory_name", "in", "factories", ":", "self", ".", "unregister_factory", "(", "factory_name", ")" ]
Unregisters all factories. This method should be called only after the iPOPO service has been unregistered (that's why it's not locked)
[ "Unregisters", "all", "factories", ".", "This", "method", "should", "be", "called", "only", "after", "the", "iPOPO", "service", "has", "been", "unregistered", "(", "that", "s", "why", "it", "s", "not", "locked", ")" ]
python
train
43
althonos/pronto
pronto/ontology.py
https://github.com/althonos/pronto/blob/a768adcba19fb34f26f67cde4a03d317f932c274/pronto/ontology.py#L467-L484
def _empty_cache(self, termlist=None): """Empty the cache associated with each `Term` instance. This method is called when merging Ontologies or including new terms in the Ontology to make sure the cache of each term is cleaned and avoid returning wrong memoized values (such as ...
[ "def", "_empty_cache", "(", "self", ",", "termlist", "=", "None", ")", ":", "if", "termlist", "is", "None", ":", "for", "term", "in", "six", ".", "itervalues", "(", "self", ".", "terms", ")", ":", "term", ".", "_empty_cache", "(", ")", "else", ":", ...
Empty the cache associated with each `Term` instance. This method is called when merging Ontologies or including new terms in the Ontology to make sure the cache of each term is cleaned and avoid returning wrong memoized values (such as Term.rchildren() TermLists, which get memoized for...
[ "Empty", "the", "cache", "associated", "with", "each", "Term", "instance", "." ]
python
train
40.388889
log2timeline/dfvfs
dfvfs/vfs/gzip_file_system.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/gzip_file_system.py#L29-L36
def GetRootFileEntry(self): """Retrieves the root file entry. Returns: GzipFileEntry: a file entry or None if not available. """ path_spec = gzip_path_spec.GzipPathSpec(parent=self._path_spec.parent) return self.GetFileEntryByPathSpec(path_spec)
[ "def", "GetRootFileEntry", "(", "self", ")", ":", "path_spec", "=", "gzip_path_spec", ".", "GzipPathSpec", "(", "parent", "=", "self", ".", "_path_spec", ".", "parent", ")", "return", "self", ".", "GetFileEntryByPathSpec", "(", "path_spec", ")" ]
Retrieves the root file entry. Returns: GzipFileEntry: a file entry or None if not available.
[ "Retrieves", "the", "root", "file", "entry", "." ]
python
train
33.125
justquick/django-activity-stream
actstream/views.py
https://github.com/justquick/django-activity-stream/blob/a1e06f2e6429cc5fc321e7801440dd7c5b9d5a35/actstream/views.py#L101-L116
def user(request, username): """ ``User`` focused activity stream. (Eg: Profile page twitter.com/justquick) """ instance = get_object_or_404( USER_MODEL, **{'is_active': True, username_field: username} ) return render( request, 'actstream/actor.html', cont...
[ "def", "user", "(", "request", ",", "username", ")", ":", "instance", "=", "get_object_or_404", "(", "USER_MODEL", ",", "*", "*", "{", "'is_active'", ":", "True", ",", "username_field", ":", "username", "}", ")", "return", "render", "(", "request", ",", ...
``User`` focused activity stream. (Eg: Profile page twitter.com/justquick)
[ "User", "focused", "activity", "stream", ".", "(", "Eg", ":", "Profile", "page", "twitter", ".", "com", "/", "justquick", ")" ]
python
train
29.3125
ArchiveTeam/wpull
wpull/url.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/url.py#L330-L349
def to_dict(self): '''Return a dict of the attributes.''' return dict( raw=self.raw, scheme=self.scheme, authority=self.authority, netloc=self.authority, path=self.path, query=self.query, fragment=self.fragment, ...
[ "def", "to_dict", "(", "self", ")", ":", "return", "dict", "(", "raw", "=", "self", ".", "raw", ",", "scheme", "=", "self", ".", "scheme", ",", "authority", "=", "self", ".", "authority", ",", "netloc", "=", "self", ".", "authority", ",", "path", "...
Return a dict of the attributes.
[ "Return", "a", "dict", "of", "the", "attributes", "." ]
python
train
30
specialunderwear/django-easymode
easymode/utils/polibext.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/utils/polibext.py#L23-L35
def po_to_unicode(po_obj): """ Turns a polib :class:`polib.PoFile` or a :class:`polib.PoEntry` into a :class:`unicode` string. :param po_obj: Either a :class:`polib.PoFile` or :class:`polib.PoEntry`. :rtype: :class:`unicode` string. """ po_text = po_obj.__str__() if type(po_text) !...
[ "def", "po_to_unicode", "(", "po_obj", ")", ":", "po_text", "=", "po_obj", ".", "__str__", "(", ")", "if", "type", "(", "po_text", ")", "!=", "types", ".", "UnicodeType", ":", "po_text", "=", "po_text", ".", "decode", "(", "'utf-8'", ")", "return", "po...
Turns a polib :class:`polib.PoFile` or a :class:`polib.PoEntry` into a :class:`unicode` string. :param po_obj: Either a :class:`polib.PoFile` or :class:`polib.PoEntry`. :rtype: :class:`unicode` string.
[ "Turns", "a", "polib", ":", "class", ":", "polib", ".", "PoFile", "or", "a", ":", "class", ":", "polib", ".", "PoEntry", "into", "a", ":", "class", ":", "unicode", "string", ".", ":", "param", "po_obj", ":", "Either", "a", ":", "class", ":", "polib...
python
train
30.307692
saltstack/salt
salt/modules/netbsd_sysctl.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbsd_sysctl.py#L106-L162
def persist(name, value, config='/etc/sysctl.conf'): ''' Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 ''' nlines = [] edited = False value = six.text_type(value) # create /e...
[ "def", "persist", "(", "name", ",", "value", ",", "config", "=", "'/etc/sysctl.conf'", ")", ":", "nlines", "=", "[", "]", "edited", "=", "False", "value", "=", "six", ".", "text_type", "(", "value", ")", "# create /etc/sysctl.conf if not present", "if", "not...
Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50
[ "Assign", "and", "persist", "a", "simple", "sysctl", "parameter", "for", "this", "minion" ]
python
train
30.508772
juju/python-libjuju
juju/application.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/application.py#L135-L158
async def scale(self, scale=None, scale_change=None): """ Set or adjust the scale of this (K8s) application. One or the other of scale or scale_change must be provided. :param int scale: Scale to which to set this application. :param int scale_change: Amount by which to adjust ...
[ "async", "def", "scale", "(", "self", ",", "scale", "=", "None", ",", "scale_change", "=", "None", ")", ":", "app_facade", "=", "client", ".", "ApplicationFacade", ".", "from_connection", "(", "self", ".", "connection", ")", "if", "(", "scale", ",", "sca...
Set or adjust the scale of this (K8s) application. One or the other of scale or scale_change must be provided. :param int scale: Scale to which to set this application. :param int scale_change: Amount by which to adjust the scale of this application (can be positive or negative).
[ "Set", "or", "adjust", "the", "scale", "of", "this", "(", "K8s", ")", "application", "." ]
python
train
40.25
globality-corp/microcosm-flask
microcosm_flask/swagger/parameters/__init__.py
https://github.com/globality-corp/microcosm-flask/blob/c2eaf57f03e7d041eea343751a4a90fcc80df418/microcosm_flask/swagger/parameters/__init__.py#L55-L63
def builder_types(cls) -> List[Type[ParameterBuilder]]: """ Define the available builder types. """ return [ entry_point.load() for entry_point in iter_entry_points(ENTRY_POINT) ]
[ "def", "builder_types", "(", "cls", ")", "->", "List", "[", "Type", "[", "ParameterBuilder", "]", "]", ":", "return", "[", "entry_point", ".", "load", "(", ")", "for", "entry_point", "in", "iter_entry_points", "(", "ENTRY_POINT", ")", "]" ]
Define the available builder types.
[ "Define", "the", "available", "builder", "types", "." ]
python
train
26.222222
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11635-L11646
def log_entry_encode(self, id, num_logs, last_log_num, time_utc, size): ''' Reply to LOG_REQUEST_LIST id : Log id (uint16_t) num_logs : Total number of logs (uint16_t) last_log_num : Hig...
[ "def", "log_entry_encode", "(", "self", ",", "id", ",", "num_logs", ",", "last_log_num", ",", "time_utc", ",", "size", ")", ":", "return", "MAVLink_log_entry_message", "(", "id", ",", "num_logs", ",", "last_log_num", ",", "time_utc", ",", "size", ")" ]
Reply to LOG_REQUEST_LIST id : Log id (uint16_t) num_logs : Total number of logs (uint16_t) last_log_num : High log number (uint16_t) time_utc : UTC timestamp of log in seconds since 19...
[ "Reply", "to", "LOG_REQUEST_LIST" ]
python
train
55.666667
ray-project/ray
python/ray/services.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1497-L1531
def start_monitor(redis_address, stdout_file=None, stderr_file=None, autoscaling_config=None, redis_password=None): """Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is li...
[ "def", "start_monitor", "(", "redis_address", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "autoscaling_config", "=", "None", ",", "redis_password", "=", "None", ")", ":", "monitor_path", "=", "os", ".", "path", ".", "join", "(", ...
Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is listening on. stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stderr_file: A file handle ...
[ "Run", "a", "process", "to", "monitor", "the", "other", "processes", "." ]
python
train
39.457143
crazy-canux/arguspy
arguspy/wmi_subprocess.py
https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/arguspy/wmi_subprocess.py#L30-L49
def query(self, wql): """Connect by wmi and run wql.""" try: self.__wql = ['wmic', '-U', self.args.domain + '\\' + self.args.user + '%' + self.args.password, '//' + self.args.host, '--namespace', self.args.namespac...
[ "def", "query", "(", "self", ",", "wql", ")", ":", "try", ":", "self", ".", "__wql", "=", "[", "'wmic'", ",", "'-U'", ",", "self", ".", "args", ".", "domain", "+", "'\\\\'", "+", "self", ".", "args", ".", "user", "+", "'%'", "+", "self", ".", ...
Connect by wmi and run wql.
[ "Connect", "by", "wmi", "and", "run", "wql", "." ]
python
valid
54.75
theonion/django-bulbs
bulbs/recirc/mixins.py
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/recirc/mixins.py#L42-L68
def get_recirc_content(self, published=True, count=3): """gets the first 3 content objects in the `included_ids` """ query = self.get_query() # check if query has included_ids & if there are any ids in it, # in case the ids have been removed from the array if not query.g...
[ "def", "get_recirc_content", "(", "self", ",", "published", "=", "True", ",", "count", "=", "3", ")", ":", "query", "=", "self", ".", "get_query", "(", ")", "# check if query has included_ids & if there are any ids in it,", "# in case the ids have been removed from the ar...
gets the first 3 content objects in the `included_ids`
[ "gets", "the", "first", "3", "content", "objects", "in", "the", "included_ids" ]
python
train
37.925926
openfisca/openfisca-core
openfisca_core/holders.py
https://github.com/openfisca/openfisca-core/blob/92ce9396e29ae5d9bac5ea604cfce88517c6b35c/openfisca_core/holders.py#L134-L140
def get_known_periods(self): """ Get the list of periods the variable value is known for. """ return list(self._memory_storage.get_known_periods()) + list(( self._disk_storage.get_known_periods() if self._disk_storage else []))
[ "def", "get_known_periods", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_memory_storage", ".", "get_known_periods", "(", ")", ")", "+", "list", "(", "(", "self", ".", "_disk_storage", ".", "get_known_periods", "(", ")", "if", "self", ".", ...
Get the list of periods the variable value is known for.
[ "Get", "the", "list", "of", "periods", "the", "variable", "value", "is", "known", "for", "." ]
python
train
38.571429
funkybob/knights-templater
astpp.py
https://github.com/funkybob/knights-templater/blob/b15cdbaae7d824d02f7f03ca04599ae94bb759dd/astpp.py#L49-L52
def parseprint(code, filename="<string>", mode="exec", **kwargs): """Parse some code from a string and pretty-print it.""" node = parse(code, mode=mode) # An ode to the code print(dump(node, **kwargs))
[ "def", "parseprint", "(", "code", ",", "filename", "=", "\"<string>\"", ",", "mode", "=", "\"exec\"", ",", "*", "*", "kwargs", ")", ":", "node", "=", "parse", "(", "code", ",", "mode", "=", "mode", ")", "# An ode to the code", "print", "(", "dump", "("...
Parse some code from a string and pretty-print it.
[ "Parse", "some", "code", "from", "a", "string", "and", "pretty", "-", "print", "it", "." ]
python
train
53
inspirehep/inspire-query-parser
inspire_query_parser/visitors/restructuring_visitor.py
https://github.com/inspirehep/inspire-query-parser/blob/9dde20d7caef89a48bb419b866f4535c88cfc00d/inspire_query_parser/visitors/restructuring_visitor.py#L48-L87
def _restructure_if_volume_follows_journal(left, right): """Remove volume node if it follows a journal logically in the tree hierarchy. Args: left (ast.ASTElement): The journal KeywordOp node. right (ast.ASTElement): The rest of the tree to be restructured. Return: (ast.ASTElement)...
[ "def", "_restructure_if_volume_follows_journal", "(", "left", ",", "right", ")", ":", "def", "_get_volume_keyword_op_and_remaining_subtree", "(", "right_subtree", ")", ":", "if", "isinstance", "(", "right_subtree", ",", "NotOp", ")", "and", "isinstance", "(", "right_s...
Remove volume node if it follows a journal logically in the tree hierarchy. Args: left (ast.ASTElement): The journal KeywordOp node. right (ast.ASTElement): The rest of the tree to be restructured. Return: (ast.ASTElement): The restructured tree, with the volume node removed. Note...
[ "Remove", "volume", "node", "if", "it", "follows", "a", "journal", "logically", "in", "the", "tree", "hierarchy", "." ]
python
train
44.125
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/LaTeX.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/LaTeX.py#L383-L431
def scan_recurse(self, node, path=()): """ do a recursive scan of the top level target file This lets us search for included files based on the directory of the main file just as latex does""" path_dict = dict(list(path)) queue = [] queue.extend( self.scan(node...
[ "def", "scan_recurse", "(", "self", ",", "node", ",", "path", "=", "(", ")", ")", ":", "path_dict", "=", "dict", "(", "list", "(", "path", ")", ")", "queue", "=", "[", "]", "queue", ".", "extend", "(", "self", ".", "scan", "(", "node", ")", ")"...
do a recursive scan of the top level target file This lets us search for included files based on the directory of the main file just as latex does
[ "do", "a", "recursive", "scan", "of", "the", "top", "level", "target", "file", "This", "lets", "us", "search", "for", "included", "files", "based", "on", "the", "directory", "of", "the", "main", "file", "just", "as", "latex", "does" ]
python
train
38.755102
evhub/coconut
coconut/compiler/compiler.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/compiler.py#L1831-L1842
def with_stmt_handle(self, tokens): """Process with statements.""" internal_assert(len(tokens) == 2, "invalid with statement tokens", tokens) withs, body = tokens if len(withs) == 1 or self.target_info >= (2, 7): return "with " + ", ".join(withs) + body else: ...
[ "def", "with_stmt_handle", "(", "self", ",", "tokens", ")", ":", "internal_assert", "(", "len", "(", "tokens", ")", "==", "2", ",", "\"invalid with statement tokens\"", ",", "tokens", ")", "withs", ",", "body", "=", "tokens", "if", "len", "(", "withs", ")"...
Process with statements.
[ "Process", "with", "statements", "." ]
python
train
42.75
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L371-L377
def container_new_folder(object_id, input_params={}, always_retry=True, **kwargs): """ Invokes the /container-xxxx/newFolder API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Folders-and-Deletion#API-method%3A-%2Fclass-xxxx%2FnewFolder """ return DXHTTPRequest('/%s/...
[ "def", "container_new_folder", "(", "object_id", ",", "input_params", "=", "{", "}", ",", "always_retry", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/%s/newFolder'", "%", "object_id", ",", "input_params", ",", "always_ret...
Invokes the /container-xxxx/newFolder API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Folders-and-Deletion#API-method%3A-%2Fclass-xxxx%2FnewFolder
[ "Invokes", "the", "/", "container", "-", "xxxx", "/", "newFolder", "API", "method", "." ]
python
train
55.428571
allenai/allennlp
allennlp/nn/util.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/nn/util.py#L1289-L1291
def clone(module: torch.nn.Module, num_copies: int) -> torch.nn.ModuleList: """Produce N identical layers.""" return torch.nn.ModuleList([copy.deepcopy(module) for _ in range(num_copies)])
[ "def", "clone", "(", "module", ":", "torch", ".", "nn", ".", "Module", ",", "num_copies", ":", "int", ")", "->", "torch", ".", "nn", ".", "ModuleList", ":", "return", "torch", ".", "nn", ".", "ModuleList", "(", "[", "copy", ".", "deepcopy", "(", "m...
Produce N identical layers.
[ "Produce", "N", "identical", "layers", "." ]
python
train
64.666667
wtsi-hgi/python-hgijson
hgijson/json_converters/automatic.py
https://github.com/wtsi-hgi/python-hgijson/blob/6e8ccb562eabcaa816a136268a16504c2e0d4664/hgijson/json_converters/automatic.py#L83-L91
def get_json_encoders_for_type(self, type_to_encode: type) -> Optional[Iterable[JSONEncoder]]: """ Gets the registered JSON encoder for the given type. :param type_to_encode: the type of object that is to be encoded :return: the encoder for the given object else `None` if unknown ...
[ "def", "get_json_encoders_for_type", "(", "self", ",", "type_to_encode", ":", "type", ")", "->", "Optional", "[", "Iterable", "[", "JSONEncoder", "]", "]", ":", "if", "type_to_encode", "not", "in", "self", ".", "_json_encoders", ":", "return", "None", "return"...
Gets the registered JSON encoder for the given type. :param type_to_encode: the type of object that is to be encoded :return: the encoder for the given object else `None` if unknown
[ "Gets", "the", "registered", "JSON", "encoder", "for", "the", "given", "type", ".", ":", "param", "type_to_encode", ":", "the", "type", "of", "object", "that", "is", "to", "be", "encoded", ":", "return", ":", "the", "encoder", "for", "the", "given", "obj...
python
train
49.444444
rmcgibbo/sphinxcontrib-lunrsearch
sphinxcontrib/lunrsearch/__init__.py
https://github.com/rmcgibbo/sphinxcontrib-lunrsearch/blob/fd24e6ab524e0a24a805eb1f9c4613646cb03291/sphinxcontrib/lunrsearch/__init__.py#L14-L50
def freeze(self): """Create a usable data structure for serializing.""" data = super(IndexBuilder, self).freeze() try: # Sphinx >= 1.5 format # Due to changes from github.com/sphinx-doc/sphinx/pull/2454 base_file_names = data['docnames'] except KeyErro...
[ "def", "freeze", "(", "self", ")", ":", "data", "=", "super", "(", "IndexBuilder", ",", "self", ")", ".", "freeze", "(", ")", "try", ":", "# Sphinx >= 1.5 format", "# Due to changes from github.com/sphinx-doc/sphinx/pull/2454", "base_file_names", "=", "data", "[", ...
Create a usable data structure for serializing.
[ "Create", "a", "usable", "data", "structure", "for", "serializing", "." ]
python
valid
38.405405
ashleysommer/sanic-cors
sanic_cors/core.py
https://github.com/ashleysommer/sanic-cors/blob/f3d68def8cf859398b3c83e4109d815f1f038ea2/sanic_cors/core.py#L318-L326
def get_app_kwarg_dict(appInstance): """Returns the dictionary of CORS specific app configurations.""" # In order to support blueprints which do not have a config attribute app_config = getattr(appInstance, 'config', {}) return dict( (k.lower().replace('cors_', ''), app_config.get(k)) fo...
[ "def", "get_app_kwarg_dict", "(", "appInstance", ")", ":", "# In order to support blueprints which do not have a config attribute", "app_config", "=", "getattr", "(", "appInstance", ",", "'config'", ",", "{", "}", ")", "return", "dict", "(", "(", "k", ".", "lower", ...
Returns the dictionary of CORS specific app configurations.
[ "Returns", "the", "dictionary", "of", "CORS", "specific", "app", "configurations", "." ]
python
test
42.222222
bheinzerling/pyrouge
pyrouge/utils/file_utils.py
https://github.com/bheinzerling/pyrouge/blob/afeb37dd2608f1399e2fb24a4ee2fe10a2a18603/pyrouge/utils/file_utils.py#L65-L77
def list_files(dir_path, recursive=True): """ Return a list of files in dir_path. """ for root, dirs, files in os.walk(dir_path): file_list = [os.path.join(root, f) for f in files] if recursive: for dir in dirs: dir = os.path.join(root, dir) ...
[ "def", "list_files", "(", "dir_path", ",", "recursive", "=", "True", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "dir_path", ")", ":", "file_list", "=", "[", "os", ".", "path", ".", "join", "(", "root", ",", ...
Return a list of files in dir_path.
[ "Return", "a", "list", "of", "files", "in", "dir_path", "." ]
python
train
29.384615
OiNutter/lean
lean/__init__.py
https://github.com/OiNutter/lean/blob/5d251f923acd44265ed401de14a9ead6752c543f/lean/__init__.py#L61-L103
def get_template(file): ''' Lookup a template class for the given filename or file extension. Return nil when no implementation is found. ''' pattern = str(file).lower() while len(pattern) and not Lean.is_registered(pattern): pattern = os.path.basename(pattern) pattern = re.sub(r'^[...
[ "def", "get_template", "(", "file", ")", ":", "pattern", "=", "str", "(", "file", ")", ".", "lower", "(", ")", "while", "len", "(", "pattern", ")", "and", "not", "Lean", ".", "is_registered", "(", "pattern", ")", ":", "pattern", "=", "os", ".", "pa...
Lookup a template class for the given filename or file extension. Return nil when no implementation is found.
[ "Lookup", "a", "template", "class", "for", "the", "given", "filename", "or", "file", "extension", ".", "Return", "nil", "when", "no", "implementation", "is", "found", "." ]
python
train
28.767442
gem/oq-engine
openquake/calculators/extract.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/extract.py#L93-L115
def parse(query_string, info={}): """ :returns: a normalized query_dict as in the following examples: >>> parse('kind=stats', {'stats': {'mean': 0, 'max': 1}}) {'kind': ['mean', 'max'], 'k': [0, 1], 'rlzs': False} >>> parse('kind=rlzs', {'stats': {}, 'num_rlzs': 3}) {'kind': ['rlz-000', 'rlz-00...
[ "def", "parse", "(", "query_string", ",", "info", "=", "{", "}", ")", ":", "qdic", "=", "parse_qs", "(", "query_string", ")", "loss_types", "=", "info", ".", "get", "(", "'loss_types'", ",", "[", "]", ")", "for", "key", ",", "val", "in", "qdic", "....
:returns: a normalized query_dict as in the following examples: >>> parse('kind=stats', {'stats': {'mean': 0, 'max': 1}}) {'kind': ['mean', 'max'], 'k': [0, 1], 'rlzs': False} >>> parse('kind=rlzs', {'stats': {}, 'num_rlzs': 3}) {'kind': ['rlz-000', 'rlz-001', 'rlz-002'], 'k': [0, 1, 2], 'rlzs': True} ...
[ ":", "returns", ":", "a", "normalized", "query_dict", "as", "in", "the", "following", "examples", ":" ]
python
train
44.043478
PyCQA/astroid
astroid/rebuilder.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/rebuilder.py#L965-L972
def visit_starred(self, node, parent): """visit a Starred node and return a new instance of it""" context = self._get_context(node) newnode = nodes.Starred( ctx=context, lineno=node.lineno, col_offset=node.col_offset, parent=parent ) newnode.postinit(self.visit(node.v...
[ "def", "visit_starred", "(", "self", ",", "node", ",", "parent", ")", ":", "context", "=", "self", ".", "_get_context", "(", "node", ")", "newnode", "=", "nodes", ".", "Starred", "(", "ctx", "=", "context", ",", "lineno", "=", "node", ".", "lineno", ...
visit a Starred node and return a new instance of it
[ "visit", "a", "Starred", "node", "and", "return", "a", "new", "instance", "of", "it" ]
python
train
43.875
dbcli/athenacli
release.py
https://github.com/dbcli/athenacli/blob/bcab59e4953145866430083e902ed4d042d4ebba/release.py#L30-L47
def run_step(*args, prompt=None): """ Prints out the command and asks if it should be run. If yes (default), runs it. :param args: list of strings (command and args) """ global DRY_RUN cmd = args print(' '.join(cmd)) if skip_step(): print('--- Skipping...') elif DRY_RUN:...
[ "def", "run_step", "(", "*", "args", ",", "prompt", "=", "None", ")", ":", "global", "DRY_RUN", "cmd", "=", "args", "print", "(", "' '", ".", "join", "(", "cmd", ")", ")", "if", "skip_step", "(", ")", ":", "print", "(", "'--- Skipping...'", ")", "e...
Prints out the command and asks if it should be run. If yes (default), runs it. :param args: list of strings (command and args)
[ "Prints", "out", "the", "command", "and", "asks", "if", "it", "should", "be", "run", ".", "If", "yes", "(", "default", ")", "runs", "it", ".", ":", "param", "args", ":", "list", "of", "strings", "(", "command", "and", "args", ")" ]
python
train
24.277778
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/feature_management/feature_management_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/feature_management/feature_management_client.py#L105-L127
def get_feature_state_for_scope(self, feature_id, user_scope, scope_name, scope_value): """GetFeatureStateForScope. [Preview API] Get the state of the specified feature for the given named scope :param str feature_id: Contribution id of the feature :param str user_scope: User-Scope at wh...
[ "def", "get_feature_state_for_scope", "(", "self", ",", "feature_id", ",", "user_scope", ",", "scope_name", ",", "scope_value", ")", ":", "route_values", "=", "{", "}", "if", "feature_id", "is", "not", "None", ":", "route_values", "[", "'featureId'", "]", "=",...
GetFeatureStateForScope. [Preview API] Get the state of the specified feature for the given named scope :param str feature_id: Contribution id of the feature :param str user_scope: User-Scope at which to get the value. Should be "me" for the current user or "host" for all users. :param s...
[ "GetFeatureStateForScope", ".", "[", "Preview", "API", "]", "Get", "the", "state", "of", "the", "specified", "feature", "for", "the", "given", "named", "scope", ":", "param", "str", "feature_id", ":", "Contribution", "id", "of", "the", "feature", ":", "param...
python
train
67.521739
ladybug-tools/ladybug
ladybug/sunpath.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L668-L681
def _daily_suns(self, datetimes): """Get sun curve for multiple days of the year.""" for dt in datetimes: # calculate sunrise sunset and noon nss = self.calculate_sunrise_sunset(dt.month, dt.day) dts = tuple(nss[k] for k in ('sunrise', 'noon', 'sunset')) i...
[ "def", "_daily_suns", "(", "self", ",", "datetimes", ")", ":", "for", "dt", "in", "datetimes", ":", "# calculate sunrise sunset and noon", "nss", "=", "self", ".", "calculate_sunrise_sunset", "(", "dt", ".", "month", ",", "dt", ".", "day", ")", "dts", "=", ...
Get sun curve for multiple days of the year.
[ "Get", "sun", "curve", "for", "multiple", "days", "of", "the", "year", "." ]
python
train
47
KartikTalwar/Duolingo
duolingo.py
https://github.com/KartikTalwar/Duolingo/blob/0f7e9a0d4bfa864ade82890fca3789679ef38bee/duolingo.py#L314-L324
def get_language_progress(self, lang): """Get informations about user's progression in a language.""" if not self._is_current_language(lang): self._switch_language(lang) fields = ['streak', 'language_string', 'level_progress', 'num_skills_learned', 'level_percent',...
[ "def", "get_language_progress", "(", "self", ",", "lang", ")", ":", "if", "not", "self", ".", "_is_current_language", "(", "lang", ")", ":", "self", ".", "_switch_language", "(", "lang", ")", "fields", "=", "[", "'streak'", ",", "'language_string'", ",", "...
Get informations about user's progression in a language.
[ "Get", "informations", "about", "user", "s", "progression", "in", "a", "language", "." ]
python
train
48.090909
mitsei/dlkit
dlkit/json_/resource/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L224-L236
def clear_group(self): """Clears the group designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceFo...
[ "def", "clear_group", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.clear_group_template", "if", "(", "self", ".", "get_group_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_group_metadata", "(", ")", "....
Clears the group designation. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Clears", "the", "group", "designation", "." ]
python
train
41
BD2KGenomics/toil-scripts
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L65-L85
def download_encrypted_file(work_dir, url, key_path, name): """ Downloads encrypted file from S3 Input1: Working directory Input2: S3 URL to be downloaded Input3: Path to key necessary for decryption Input4: name of file to be downloaded """ file_path = os.path.join(work_dir, name) ...
[ "def", "download_encrypted_file", "(", "work_dir", ",", "url", ",", "key_path", ",", "name", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "work_dir", ",", "name", ")", "key", "=", "generate_unique_key", "(", "key_path", ",", "url", ")...
Downloads encrypted file from S3 Input1: Working directory Input2: S3 URL to be downloaded Input3: Path to key necessary for decryption Input4: name of file to be downloaded
[ "Downloads", "encrypted", "file", "from", "S3" ]
python
train
44.809524
mfitzp/padua
padua/visualize.py
https://github.com/mfitzp/padua/blob/8b14bf4d2f895da6aea5d7885d409315bd303ec6/padua/visualize.py#L1495-L1605
def kegg_pathway(df, pathway, a, b=None, ids_from="Proteins", cmap=cm.PuOr_r, is_log2=False, fillna=None, z_score=1): """ Visualize data on a kegg pathway. :param df: :param pathway: :param a: :param b: :param ids_from: :param cmap: :param is_log2: :param fillna: :param z_s...
[ "def", "kegg_pathway", "(", "df", ",", "pathway", ",", "a", ",", "b", "=", "None", ",", "ids_from", "=", "\"Proteins\"", ",", "cmap", "=", "cm", ".", "PuOr_r", ",", "is_log2", "=", "False", ",", "fillna", "=", "None", ",", "z_score", "=", "1", ")",...
Visualize data on a kegg pathway. :param df: :param pathway: :param a: :param b: :param ids_from: :param cmap: :param is_log2: :param fillna: :param z_score: :return:
[ "Visualize", "data", "on", "a", "kegg", "pathway", "." ]
python
train
28.72973
atztogo/phonopy
phonopy/api_phonopy.py
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1727-L1760
def plot_projected_dos(self, pdos_indices=None, legend=None): """Plot projected DOS Parameters ---------- pdos_indices : list of list, optional Sets of indices of atoms whose projected DOS are summed over. The indices start with 0. An example is as follwos: ...
[ "def", "plot_projected_dos", "(", "self", ",", "pdos_indices", "=", "None", ",", "legend", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "fig", ",", "ax", "=", "plt", ".", "subplots", "(", ")", "ax", ".", "xaxis", ".", "s...
Plot projected DOS Parameters ---------- pdos_indices : list of list, optional Sets of indices of atoms whose projected DOS are summed over. The indices start with 0. An example is as follwos: pdos_indices=[[0, 1], [2, 3, 4, 5]] Default is No...
[ "Plot", "projected", "DOS" ]
python
train
34.617647
chaoss/grimoirelab-perceval
perceval/backends/core/groupsio.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/groupsio.py#L271-L294
def setup_cmd_parser(cls): """Returns the Groupsio argument parser.""" parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES, from_date=True, token_auth=True) # Backend token is required ...
[ "def", "setup_cmd_parser", "(", "cls", ")", ":", "parser", "=", "BackendCommandArgumentParser", "(", "cls", ".", "BACKEND", ".", "CATEGORIES", ",", "from_date", "=", "True", ",", "token_auth", "=", "True", ")", "# Backend token is required", "action", "=", "pars...
Returns the Groupsio argument parser.
[ "Returns", "the", "Groupsio", "argument", "parser", "." ]
python
test
40.791667
astropy/photutils
photutils/detection/findstars.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/detection/findstars.py#L897-L991
def find_stars(self, data, mask=None): """ Find stars in an astronomical image. Parameters ---------- data : 2D array_like The 2D image array. mask : 2D bool array, optional A boolean mask with the same shape as ``data``, where a `Tru...
[ "def", "find_stars", "(", "self", ",", "data", ",", "mask", "=", "None", ")", ":", "star_cutouts", "=", "_find_stars", "(", "data", ",", "self", ".", "kernel", ",", "self", ".", "threshold_eff", ",", "mask", "=", "mask", ",", "exclude_border", "=", "se...
Find stars in an astronomical image. Parameters ---------- data : 2D array_like The 2D image array. mask : 2D bool array, optional A boolean mask with the same shape as ``data``, where a `True` value indicates the corresponding element of ``data`` ...
[ "Find", "stars", "in", "an", "astronomical", "image", "." ]
python
train
37.031579
datacamp/pythonwhat
pythonwhat/checks/check_has_context.py
https://github.com/datacamp/pythonwhat/blob/ffbf7f8436a51f77c22f3bed75ba3bc37a5c666f/pythonwhat/checks/check_has_context.py#L64-L76
def has_context_loop(state, incorrect_msg, exact_names): """When dispatched on loops, has_context the target vars are the attribute _target_vars. Note: This is to allow people to call has_context on a node (e.g. for_loop) rather than one of its attributes (e.g. body). Purely for convenience. """ ...
[ "def", "has_context_loop", "(", "state", ",", "incorrect_msg", ",", "exact_names", ")", ":", "return", "_test", "(", "state", ",", "incorrect_msg", "or", "MSG_INCORRECT_LOOP", ",", "exact_names", ",", "tv_name", "=", "\"_target_vars\"", ",", "highlight_name", "=",...
When dispatched on loops, has_context the target vars are the attribute _target_vars. Note: This is to allow people to call has_context on a node (e.g. for_loop) rather than one of its attributes (e.g. body). Purely for convenience.
[ "When", "dispatched", "on", "loops", "has_context", "the", "target", "vars", "are", "the", "attribute", "_target_vars", "." ]
python
test
36.692308