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
bcbio/bcbio-nextgen
bcbio/ngsalign/rtg.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/rtg.py#L45-L54
def calculate_splits(sdf_file, split_size): """Retrieve """ counts = _sdfstats(sdf_file)["counts"] splits = [] cur = 0 for i in range(counts // split_size + (0 if counts % split_size == 0 else 1)): splits.append("%s-%s" % (cur, min(counts, cur + split_size))) cur += split_size ...
[ "def", "calculate_splits", "(", "sdf_file", ",", "split_size", ")", ":", "counts", "=", "_sdfstats", "(", "sdf_file", ")", "[", "\"counts\"", "]", "splits", "=", "[", "]", "cur", "=", "0", "for", "i", "in", "range", "(", "counts", "//", "split_size", "...
Retrieve
[ "Retrieve" ]
python
train
32.6
google/prettytensor
prettytensor/pretty_tensor_methods.py
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_methods.py#L395-L408
def _rapply(input_layer, operation, *op_args, **op_kwargs): """Applies the given operation to this after expanding op_args. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_kwargs: Keywor...
[ "def", "_rapply", "(", "input_layer", ",", "operation", ",", "*", "op_args", ",", "*", "*", "op_kwargs", ")", ":", "op_args", "=", "list", "(", "op_args", ")", "op_args", ".", "append", "(", "input_layer", ".", "tensor", ")", "return", "input_layer", "."...
Applies the given operation to this after expanding op_args. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_kwargs: Keyword arguments for the operation. Returns: A new layer with op...
[ "Applies", "the", "given", "operation", "to", "this", "after", "expanding", "op_args", "." ]
python
train
37.428571
alorence/django-modern-rpc
modernrpc/compat.py
https://github.com/alorence/django-modern-rpc/blob/6dc42857d35764b24e2c09334f4b578629a75f9e/modernrpc/compat.py#L7-L35
def _generic_convert_string(v, from_type, to_type, encoding): """ Generic method to convert any argument type (string type, list, set, tuple, dict) to an equivalent, with string values converted to given 'to_type' (str or unicode). This method must be used with Python 2 interpreter only. :param v: ...
[ "def", "_generic_convert_string", "(", "v", ",", "from_type", ",", "to_type", ",", "encoding", ")", ":", "assert", "six", ".", "PY2", ",", "\"This function should be used with Python 2 only\"", "assert", "from_type", "!=", "to_type", "if", "from_type", "==", "six", ...
Generic method to convert any argument type (string type, list, set, tuple, dict) to an equivalent, with string values converted to given 'to_type' (str or unicode). This method must be used with Python 2 interpreter only. :param v: The value to convert :param from_type: The original string type to con...
[ "Generic", "method", "to", "convert", "any", "argument", "type", "(", "string", "type", "list", "set", "tuple", "dict", ")", "to", "an", "equivalent", "with", "string", "values", "converted", "to", "given", "to_type", "(", "str", "or", "unicode", ")", ".",...
python
train
37.793103
dropbox/stone
stone/backends/python_types.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/python_types.py#L779-L822
def _generate_enumerated_subtypes_tag_mapping(self, ns, data_type): """ Generates attributes needed for serializing and deserializing structs with enumerated subtypes. These assignments are made after all the Python class definitions to ensure that all references exist. """ ...
[ "def", "_generate_enumerated_subtypes_tag_mapping", "(", "self", ",", "ns", ",", "data_type", ")", ":", "assert", "data_type", ".", "has_enumerated_subtypes", "(", ")", "# Generate _tag_to_subtype_ attribute: Map from string type tag to", "# the validator of the referenced subtype....
Generates attributes needed for serializing and deserializing structs with enumerated subtypes. These assignments are made after all the Python class definitions to ensure that all references exist.
[ "Generates", "attributes", "needed", "for", "serializing", "and", "deserializing", "structs", "with", "enumerated", "subtypes", ".", "These", "assignments", "are", "made", "after", "all", "the", "Python", "class", "definitions", "to", "ensure", "that", "all", "ref...
python
train
41.840909
Shinichi-Nakagawa/pitchpx
pitchpx/game/game.py
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/game/game.py#L47-L95
def row(self): """ Game Dataset(Row) :return: { 'retro_game_id': Retrosheet Game id 'game_type': Game Type(S/R/F/D/L/W) 'game_type_des': Game Type Description (Spring Training or Regular Season or Wild-card Game or Divisional Series or LCS or World...
[ "def", "row", "(", "self", ")", ":", "row", "=", "OrderedDict", "(", ")", "row", "[", "'retro_game_id'", "]", "=", "self", ".", "retro_game_id", "row", "[", "'game_type'", "]", "=", "self", ".", "game_type", "row", "[", "'game_type_des'", "]", "=", "se...
Game Dataset(Row) :return: { 'retro_game_id': Retrosheet Game id 'game_type': Game Type(S/R/F/D/L/W) 'game_type_des': Game Type Description (Spring Training or Regular Season or Wild-card Game or Divisional Series or LCS or World Series) 'st_fl': Sprin...
[ "Game", "Dataset", "(", "Row", ")", ":", "return", ":", "{", "retro_game_id", ":", "Retrosheet", "Game", "id", "game_type", ":", "Game", "Type", "(", "S", "/", "R", "/", "F", "/", "D", "/", "L", "/", "W", ")", "game_type_des", ":", "Game", "Type", ...
python
train
42.836735
genepattern/genepattern-notebook
genepattern/remote_widgets.py
https://github.com/genepattern/genepattern-notebook/blob/953168bd08c5332412438cbc5bb59993a07a6911/genepattern/remote_widgets.py#L53-L73
def get(self, server): """ Returns a registered GPServer object with a matching GenePattern server url or index Returns None if no matching result was found :param server: :return: """ # Handle indexes if isinstance(server, int): if server >= ...
[ "def", "get", "(", "self", ",", "server", ")", ":", "# Handle indexes", "if", "isinstance", "(", "server", ",", "int", ")", ":", "if", "server", ">=", "len", "(", "self", ".", "sessions", ")", ":", "return", "None", "else", ":", "return", "self", "."...
Returns a registered GPServer object with a matching GenePattern server url or index Returns None if no matching result was found :param server: :return:
[ "Returns", "a", "registered", "GPServer", "object", "with", "a", "matching", "GenePattern", "server", "url", "or", "index", "Returns", "None", "if", "no", "matching", "result", "was", "found", ":", "param", "server", ":", ":", "return", ":" ]
python
valid
27.714286
happyleavesaoc/gstreamer-player
gsp/__init__.py
https://github.com/happyleavesaoc/gstreamer-player/blob/750edd95d4be4d2f8eee3aa3cb86d4781758f5fb/gsp/__init__.py#L99-L124
def media(self, uri): """Play a media file.""" try: local_path, _ = urllib.request.urlretrieve(uri) metadata = mutagen.File(local_path, easy=True) if metadata.tags: self._tags = metadata.tags title = self._tags.get(TAG_TITLE, []) ...
[ "def", "media", "(", "self", ",", "uri", ")", ":", "try", ":", "local_path", ",", "_", "=", "urllib", ".", "request", ".", "urlretrieve", "(", "uri", ")", "metadata", "=", "mutagen", ".", "File", "(", "local_path", ",", "easy", "=", "True", ")", "i...
Play a media file.
[ "Play", "a", "media", "file", "." ]
python
train
45.884615
blockstack/blockstack-core
blockstack/lib/nameset/__init__.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/__init__.py#L230-L269
def state_transition(history_id_key, table_name, always_set=[], may_spend_tokens=False): """ Decorator for the check() method on state-transition operations. Make sure that: * there is a __table__ field set, which names the table in which this record is stored. * there is a __history_id_key__ field ...
[ "def", "state_transition", "(", "history_id_key", ",", "table_name", ",", "always_set", "=", "[", "]", ",", "may_spend_tokens", "=", "False", ")", ":", "def", "wrap", "(", "check", ")", ":", "def", "wrapped_check", "(", "state_engine", ",", "nameop", ",", ...
Decorator for the check() method on state-transition operations. Make sure that: * there is a __table__ field set, which names the table in which this record is stored. * there is a __history_id_key__ field set, which identifies the table record's primary key. Any fields named in @always_set will alway...
[ "Decorator", "for", "the", "check", "()", "method", "on", "state", "-", "transition", "operations", ".", "Make", "sure", "that", ":", "*", "there", "is", "a", "__table__", "field", "set", "which", "names", "the", "table", "in", "which", "this", "record", ...
python
train
48.275
edx/edx-val
edxval/api.py
https://github.com/edx/edx-val/blob/30df48061e77641edb5272895b7c7f7f25eb7aa7/edxval/api.py#L1106-L1167
def import_transcript_from_fs(edx_video_id, language_code, file_name, provider, resource_fs, static_dir): """ Imports transcript file from file system and creates transcript record in DS. Arguments: edx_video_id (str): Video id of the video. language_code (unicode): Language code of the req...
[ "def", "import_transcript_from_fs", "(", "edx_video_id", ",", "language_code", ",", "file_name", ",", "provider", ",", "resource_fs", ",", "static_dir", ")", ":", "file_format", "=", "None", "transcript_data", "=", "get_video_transcript_data", "(", "edx_video_id", ","...
Imports transcript file from file system and creates transcript record in DS. Arguments: edx_video_id (str): Video id of the video. language_code (unicode): Language code of the requested transcript. file_name (unicode): File name of the transcript file. provider (unicode): Transcri...
[ "Imports", "transcript", "file", "from", "file", "system", "and", "creates", "transcript", "record", "in", "DS", "." ]
python
train
39.532258
scott-maddox/openbandparams
src/openbandparams/iii_v_zinc_blende_strained.py
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/iii_v_zinc_blende_strained.py#L160-L166
def CBO_L(self, **kwargs): ''' Returns the strain-shifted L-valley conduction band offset (CBO), assuming the strain affects all conduction band valleys equally. ''' return (self.unstrained.CBO_L(**kwargs) + self.CBO_strain_shift(**kwargs))
[ "def", "CBO_L", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "unstrained", ".", "CBO_L", "(", "*", "*", "kwargs", ")", "+", "self", ".", "CBO_strain_shift", "(", "*", "*", "kwargs", ")", ")" ]
Returns the strain-shifted L-valley conduction band offset (CBO), assuming the strain affects all conduction band valleys equally.
[ "Returns", "the", "strain", "-", "shifted", "L", "-", "valley", "conduction", "band", "offset", "(", "CBO", ")", "assuming", "the", "strain", "affects", "all", "conduction", "band", "valleys", "equally", "." ]
python
train
41.428571
kfdm/wanikani
wanikani/core.py
https://github.com/kfdm/wanikani/blob/209f9b34b2832c2b9c9b12077f4a4382c047f710/wanikani/core.py#L202-L222
def vocabulary(self, levels=None): """ :param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http...
[ "def", "vocabulary", "(", "self", ",", "levels", "=", "None", ")", ":", "url", "=", "WANIKANI_BASE", ".", "format", "(", "self", ".", "api_key", ",", "'vocabulary'", ")", "if", "levels", ":", "url", "+=", "'/{0}'", ".", "format", "(", "levels", ")", ...
:param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http://www.wanikani.com/api/v1.2#vocabulary-list
[ ":", "param", "levels", ":", "An", "optional", "argument", "of", "declaring", "a", "single", "or", "comma", "-", "delimited", "list", "of", "levels", "is", "available", "as", "seen", "in", "the", "example", "as", "1", ".", "An", "example", "of", "a", "...
python
train
37.047619
GoogleCloudPlatform/appengine-gcs-client
python/src/cloudstorage/rest_api.py
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/python/src/cloudstorage/rest_api.py#L236-L277
def urlfetch_async(self, url, method='GET', headers=None, payload=None, deadline=None, callback=None, follow_redirects=False): """Make an async urlfetch() call. This is an async wrapper around urlfetch(). It adds an authentication header. Args: url: the ...
[ "def", "urlfetch_async", "(", "self", ",", "url", ",", "method", "=", "'GET'", ",", "headers", "=", "None", ",", "payload", "=", "None", ",", "deadline", "=", "None", ",", "callback", "=", "None", ",", "follow_redirects", "=", "False", ")", ":", "heade...
Make an async urlfetch() call. This is an async wrapper around urlfetch(). It adds an authentication header. Args: url: the url to fetch. method: the method in which to fetch. headers: the http headers. payload: the data to submit in the fetch. deadline: the deadline in which...
[ "Make", "an", "async", "urlfetch", "()", "call", "." ]
python
train
36.071429
Clinical-Genomics/scout
scout/commands/base.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/base.py#L57-L111
def cli(context, mongodb, username, password, authdb, host, port, loglevel, config, demo): """scout: manage interactions with a scout instance.""" # log_format = "%(message)s" if sys.stdout.isatty() else None log_format = None coloredlogs.install(level=loglevel, fmt=log_format) LOG.info("Running sco...
[ "def", "cli", "(", "context", ",", "mongodb", ",", "username", ",", "password", ",", "authdb", ",", "host", ",", "port", ",", "loglevel", ",", "config", ",", "demo", ")", ":", "# log_format = \"%(message)s\" if sys.stdout.isatty() else None", "log_format", "=", ...
scout: manage interactions with a scout instance.
[ "scout", ":", "manage", "interactions", "with", "a", "scout", "instance", "." ]
python
test
37.509091
tradenity/python-sdk
tradenity/resources/store_credit_payment.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/store_credit_payment.py#L424-L444
def delete_store_credit_payment_by_id(cls, store_credit_payment_id, **kwargs): """Delete StoreCreditPayment Delete an instance of StoreCreditPayment by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >...
[ "def", "delete_store_credit_payment_by_id", "(", "cls", ",", "store_credit_payment_id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", ...
Delete StoreCreditPayment Delete an instance of StoreCreditPayment by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_store_credit_payment_by_id(store_credit_payment_id, async=True) ...
[ "Delete", "StoreCreditPayment" ]
python
train
48.095238
pgmpy/pgmpy
pgmpy/models/BayesianModel.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/models/BayesianModel.py#L364-L391
def check_model(self): """ Check the model for various errors. This method checks for the following errors. * Checks if the sum of the probabilities for each state is equal to 1 (tol=0.01). * Checks if the CPDs associated with nodes are consistent with their parents. Re...
[ "def", "check_model", "(", "self", ")", ":", "for", "node", "in", "self", ".", "nodes", "(", ")", ":", "cpd", "=", "self", ".", "get_cpds", "(", "node", "=", "node", ")", "if", "cpd", "is", "None", ":", "raise", "ValueError", "(", "'No CPD associated...
Check the model for various errors. This method checks for the following errors. * Checks if the sum of the probabilities for each state is equal to 1 (tol=0.01). * Checks if the CPDs associated with nodes are consistent with their parents. Returns ------- check: boolea...
[ "Check", "the", "model", "for", "various", "errors", ".", "This", "method", "checks", "for", "the", "following", "errors", "." ]
python
train
44.25
Yipit/eventlib
eventlib/api.py
https://github.com/Yipit/eventlib/blob/0cf29e5251a59fcbfc727af5f5157a3bb03832e2/eventlib/api.py#L26-L41
def _register_handler(event, fun, external=False): """Register a function to be an event handler""" registry = core.HANDLER_REGISTRY if external: registry = core.EXTERNAL_HANDLER_REGISTRY if not isinstance(event, basestring): # If not basestring, it is a BaseEvent subclass. # Th...
[ "def", "_register_handler", "(", "event", ",", "fun", ",", "external", "=", "False", ")", ":", "registry", "=", "core", ".", "HANDLER_REGISTRY", "if", "external", ":", "registry", "=", "core", ".", "EXTERNAL_HANDLER_REGISTRY", "if", "not", "isinstance", "(", ...
Register a function to be an event handler
[ "Register", "a", "function", "to", "be", "an", "event", "handler" ]
python
train
33
kblomqvist/yasha
yasha/cmsis.py
https://github.com/kblomqvist/yasha/blob/aebda08f45458611a59497fb7505f0881b73fbd5/yasha/cmsis.py#L75-L94
def from_element(self, element, defaults={}): """Populate object variables from SVD element""" if isinstance(defaults, SvdElement): defaults = vars(defaults) for key in self.props: try: value = element.find(key).text except AttributeError: # M...
[ "def", "from_element", "(", "self", ",", "element", ",", "defaults", "=", "{", "}", ")", ":", "if", "isinstance", "(", "defaults", ",", "SvdElement", ")", ":", "defaults", "=", "vars", "(", "defaults", ")", "for", "key", "in", "self", ".", "props", "...
Populate object variables from SVD element
[ "Populate", "object", "variables", "from", "SVD", "element" ]
python
train
42.9
saltstack/salt
salt/cloud/clouds/msazure.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2549-L2573
def list_storage_containers(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 List containers associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f list_storage_containers my-azure ''' if call != 'function': raise Sal...
[ "def", "list_storage_containers", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_storage_containers function must be called with -...
.. versionadded:: 2015.8.0 List containers associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f list_storage_containers my-azure
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
python
train
25.92
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L246-L257
def restart_service(service, log=False): """ restarts a service """ with settings(): if log: bookshelf2.logging_helpers.log_yellow( 'stoping service %s' % service) sudo('service %s stop' % service) if log: bookshelf2.logging_helpers.log_yellow( ...
[ "def", "restart_service", "(", "service", ",", "log", "=", "False", ")", ":", "with", "settings", "(", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_yellow", "(", "'stoping service %s'", "%", "service", ")", "sudo", "(", "'ser...
restarts a service
[ "restarts", "a", "service" ]
python
train
34.5
kensho-technologies/graphql-compiler
graphql_compiler/schema_generation/schema_graph.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/schema_generation/schema_graph.py#L297-L311
def get_default_property_values(self, classname): """Return a dict with default values for all properties declared on this class.""" schema_element = self.get_element_by_class_name(classname) result = { property_name: property_descriptor.default for property_name, proper...
[ "def", "get_default_property_values", "(", "self", ",", "classname", ")", ":", "schema_element", "=", "self", ".", "get_element_by_class_name", "(", "classname", ")", "result", "=", "{", "property_name", ":", "property_descriptor", ".", "default", "for", "property_n...
Return a dict with default values for all properties declared on this class.
[ "Return", "a", "dict", "with", "default", "values", "for", "all", "properties", "declared", "on", "this", "class", "." ]
python
train
42
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L487-L507
def scan(self, scanner, node_list): """Scan a list of this Executor's files (targets or sources) for implicit dependencies and update all of the targets with them. This essentially short-circuits an N*M scan of the sources for each individual target, which is a hell of a lot more efficie...
[ "def", "scan", "(", "self", ",", "scanner", ",", "node_list", ")", ":", "env", "=", "self", ".", "get_build_env", "(", ")", "path", "=", "self", ".", "get_build_scanner_path", "kw", "=", "self", ".", "get_kw", "(", ")", "# TODO(batch): scan by batches)", ...
Scan a list of this Executor's files (targets or sources) for implicit dependencies and update all of the targets with them. This essentially short-circuits an N*M scan of the sources for each individual target, which is a hell of a lot more efficient.
[ "Scan", "a", "list", "of", "this", "Executor", "s", "files", "(", "targets", "or", "sources", ")", "for", "implicit", "dependencies", "and", "update", "all", "of", "the", "targets", "with", "them", ".", "This", "essentially", "short", "-", "circuits", "an"...
python
train
35.47619
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L587-L593
def file_rename(object_id, input_params={}, always_retry=True, **kwargs): """ Invokes the /file-xxxx/rename API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename """ return DXHTTPRequest('/%s/rename' % object_id, input_params, a...
[ "def", "file_rename", "(", "object_id", ",", "input_params", "=", "{", "}", ",", "always_retry", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/%s/rename'", "%", "object_id", ",", "input_params", ",", "always_retry", "=", ...
Invokes the /file-xxxx/rename API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
[ "Invokes", "the", "/", "file", "-", "xxxx", "/", "rename", "API", "method", "." ]
python
train
49.857143
fhcrc/seqmagick
seqmagick/subcommands/quality_filter.py
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/subcommands/quality_filter.py#L374-L396
def filter_records(self, records): """ Apply the filter to records """ for record in records: try: filtered = self.filter_record(record) assert (filtered) # Quick tracking whether the sequence was modified if fil...
[ "def", "filter_records", "(", "self", ",", "records", ")", ":", "for", "record", "in", "records", ":", "try", ":", "filtered", "=", "self", ".", "filter_record", "(", "record", ")", "assert", "(", "filtered", ")", "# Quick tracking whether the sequence was modif...
Apply the filter to records
[ "Apply", "the", "filter", "to", "records" ]
python
train
34.26087
dpkp/kafka-python
kafka/metrics/metrics.py
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/metrics/metrics.py#L256-L261
def close(self): """Close this metrics repository.""" for reporter in self._reporters: reporter.close() self._metrics.clear()
[ "def", "close", "(", "self", ")", ":", "for", "reporter", "in", "self", ".", "_reporters", ":", "reporter", ".", "close", "(", ")", "self", ".", "_metrics", ".", "clear", "(", ")" ]
Close this metrics repository.
[ "Close", "this", "metrics", "repository", "." ]
python
train
26.166667
morngrar/ui
ui/ui.py
https://github.com/morngrar/ui/blob/93e160b55ff7d486a53dba7a8c0f2d46e6f95ed9/ui/ui.py#L55-L71
def yn_prompt(text): ''' Takes the text prompt, and presents it, takes only "y" or "n" for answers, and returns True or False. Repeats itself on bad input. ''' text = "\n"+ text + "\n('y' or 'n'): " while True: answer = input(text).strip() if answer != 'y' and answer !...
[ "def", "yn_prompt", "(", "text", ")", ":", "text", "=", "\"\\n\"", "+", "text", "+", "\"\\n('y' or 'n'): \"", "while", "True", ":", "answer", "=", "input", "(", "text", ")", ".", "strip", "(", ")", "if", "answer", "!=", "'y'", "and", "answer", "!=", ...
Takes the text prompt, and presents it, takes only "y" or "n" for answers, and returns True or False. Repeats itself on bad input.
[ "Takes", "the", "text", "prompt", "and", "presents", "it", "takes", "only", "y", "or", "n", "for", "answers", "and", "returns", "True", "or", "False", ".", "Repeats", "itself", "on", "bad", "input", "." ]
python
train
25.647059
jxtech/wechatpy
wechatpy/pay/api/transfer.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/transfer.py#L67-L95
def transfer_bankcard(self, true_name, bank_card_no, bank_code, amount, desc=None, out_trade_no=None): """ 企业付款到银行卡接口 :param true_name: 开户人名称 :param bank_card_no: 银行卡号 :param bank_code: 银行编号 :param amount: 付款金额,单位分 :param desc: 付款说明 :param out_trade_no: 可...
[ "def", "transfer_bankcard", "(", "self", ",", "true_name", ",", "bank_card_no", ",", "bank_code", ",", "amount", ",", "desc", "=", "None", ",", "out_trade_no", "=", "None", ")", ":", "if", "not", "out_trade_no", ":", "now", "=", "datetime", ".", "now", "...
企业付款到银行卡接口 :param true_name: 开户人名称 :param bank_card_no: 银行卡号 :param bank_code: 银行编号 :param amount: 付款金额,单位分 :param desc: 付款说明 :param out_trade_no: 可选,商户订单号,需保持唯一性,默认自动生成 :return: 返回的结果信息
[ "企业付款到银行卡接口" ]
python
train
33.551724
wbond/asn1crypto
asn1crypto/x509.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/x509.py#L2647-L2657
def delta_crl_distribution_points(self): """ Returns delta CRL URLs - does not include complete CRLs :return: A list of zero or more DistributionPoint objects """ if self._delta_crl_distribution_points is None: self._delta_crl_distribution_points = self....
[ "def", "delta_crl_distribution_points", "(", "self", ")", ":", "if", "self", ".", "_delta_crl_distribution_points", "is", "None", ":", "self", ".", "_delta_crl_distribution_points", "=", "self", ".", "_get_http_crl_distribution_points", "(", "self", ".", "freshest_crl_v...
Returns delta CRL URLs - does not include complete CRLs :return: A list of zero or more DistributionPoint objects
[ "Returns", "delta", "CRL", "URLs", "-", "does", "not", "include", "complete", "CRLs" ]
python
train
38.090909
codelv/enaml-native-maps
src/googlemaps/android/android_map_view.py
https://github.com/codelv/enaml-native-maps/blob/5b6dda745cede05755dd40d29775cc0544226c29/src/googlemaps/android/android_map_view.py#L629-L635
def on_map_clicked(self, pos): """ Called when the map is clicked """ d = self.declaration d.clicked({ 'click': 'short', 'position': tuple(pos) })
[ "def", "on_map_clicked", "(", "self", ",", "pos", ")", ":", "d", "=", "self", ".", "declaration", "d", ".", "clicked", "(", "{", "'click'", ":", "'short'", ",", "'position'", ":", "tuple", "(", "pos", ")", "}", ")" ]
Called when the map is clicked
[ "Called", "when", "the", "map", "is", "clicked" ]
python
valid
28
lowandrew/OLCTools
metagenomefilter/filtermetagenome.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/metagenomefilter/filtermetagenome.py#L125-L140
def fastqfilter(self): """Filter the reads into separate files based on taxonomic assignment""" printtime('Creating filtered .fastqfiles', self.start) # Create and start threads for i in range(self.cpus): # Send the threads to the appropriate destination function ...
[ "def", "fastqfilter", "(", "self", ")", ":", "printtime", "(", "'Creating filtered .fastqfiles'", ",", "self", ".", "start", ")", "# Create and start threads", "for", "i", "in", "range", "(", "self", ".", "cpus", ")", ":", "# Send the threads to the appropriate dest...
Filter the reads into separate files based on taxonomic assignment
[ "Filter", "the", "reads", "into", "separate", "files", "based", "on", "taxonomic", "assignment" ]
python
train
45.9375
agoragames/haigha
haigha/transports/socket_transport.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/transports/socket_transport.py#L130-L156
def write(self, data): ''' Write some bytes to the transport. ''' if not hasattr(self, '_sock'): return None try: self._sock.sendall(data) if self.connection.debug > 1: self.connection.logger.debug( 'sent %...
[ "def", "write", "(", "self", ",", "data", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_sock'", ")", ":", "return", "None", "try", ":", "self", ".", "_sock", ".", "sendall", "(", "data", ")", "if", "self", ".", "connection", ".", "debug", ...
Write some bytes to the transport.
[ "Write", "some", "bytes", "to", "the", "transport", "." ]
python
train
36.703704
tensorflow/tensor2tensor
tensor2tensor/layers/discretization.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L360-L381
def vae(x, z_size, name=None): """Simple variational autoencoder without discretization. Args: x: Input to the discretization bottleneck. z_size: Number of bits, where discrete codes range from 1 to 2**z_size. name: Name for the bottleneck scope. Returns: Embedding function, latent, loss, mu and...
[ "def", "vae", "(", "x", ",", "z_size", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", "default_name", "=", "\"vae\"", ")", ":", "mu", "=", "tf", ".", "layers", ".", "dense", "(", "x", ",", "z_size", ","...
Simple variational autoencoder without discretization. Args: x: Input to the discretization bottleneck. z_size: Number of bits, where discrete codes range from 1 to 2**z_size. name: Name for the bottleneck scope. Returns: Embedding function, latent, loss, mu and log_simga.
[ "Simple", "variational", "autoencoder", "without", "discretization", "." ]
python
train
38.590909
numenta/nupic
src/nupic/regions/tm_region.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L407-L427
def initialize(self): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.initialize`. """ # Allocate appropriate temporal memory object # Retrieve the necessary extra arguments that were handled automatically autoArgs = dict((name, getattr(self, name)) for name in self._te...
[ "def", "initialize", "(", "self", ")", ":", "# Allocate appropriate temporal memory object", "# Retrieve the necessary extra arguments that were handled automatically", "autoArgs", "=", "dict", "(", "(", "name", ",", "getattr", "(", "self", ",", "name", ")", ")", "for", ...
Overrides :meth:`~nupic.bindings.regions.PyRegion.initialize`.
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "initialize", "." ]
python
valid
35.619048
ClimateImpactLab/DataFS
datafs/managers/manager.py
https://github.com/ClimateImpactLab/DataFS/blob/0d32c2b4e18d300a11b748a552f6adbc3dd8f59d/datafs/managers/manager.py#L223-L264
def create_archive( self, archive_name, authority_name, archive_path, versioned, raise_on_err=True, metadata=None, user_config=None, tags=None, helper=False): ''' Create a new data arc...
[ "def", "create_archive", "(", "self", ",", "archive_name", ",", "authority_name", ",", "archive_path", ",", "versioned", ",", "raise_on_err", "=", "True", ",", "metadata", "=", "None", ",", "user_config", "=", "None", ",", "tags", "=", "None", ",", "helper",...
Create a new data archive Returns ------- archive : object new :py:class:`~datafs.core.data_archive.DataArchive` object
[ "Create", "a", "new", "data", "archive" ]
python
train
25.857143
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L142-L146
def agents_email_show(self, email_id, **kwargs): "https://developer.zendesk.com/rest_api/docs/chat/agents#get-agent-by-email-id" api_path = "/api/v2/agents/email/{email_id}" api_path = api_path.format(email_id=email_id) return self.call(api_path, **kwargs)
[ "def", "agents_email_show", "(", "self", ",", "email_id", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/agents/email/{email_id}\"", "api_path", "=", "api_path", ".", "format", "(", "email_id", "=", "email_id", ")", "return", "self", ".", "call...
https://developer.zendesk.com/rest_api/docs/chat/agents#get-agent-by-email-id
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "chat", "/", "agents#get", "-", "agent", "-", "by", "-", "email", "-", "id" ]
python
train
56.8
mozilla/treeherder
treeherder/model/models.py
https://github.com/mozilla/treeherder/blob/cc47bdec872e5c668d0f01df89517390a164cda3/treeherder/model/models.py#L1185-L1210
def update_matches(self, other): """ Update this instance's Matches to point to the given other's Matches. Find Matches with the same TextLogError as our Matches, updating their score if less than ours and mark our matches for deletion. If there are no other matches, update our...
[ "def", "update_matches", "(", "self", ",", "other", ")", ":", "for", "match", "in", "self", ".", "error_matches", ".", "all", "(", ")", ":", "other_matches", "=", "TextLogErrorMatch", ".", "objects", ".", "filter", "(", "classified_failure", "=", "other", ...
Update this instance's Matches to point to the given other's Matches. Find Matches with the same TextLogError as our Matches, updating their score if less than ours and mark our matches for deletion. If there are no other matches, update ours to point to the other ClassifiedFailure.
[ "Update", "this", "instance", "s", "Matches", "to", "point", "to", "the", "given", "other", "s", "Matches", "." ]
python
train
37.576923
geophysics-ubonn/crtomo_tools
lib/crtomo/configManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/configManager.py#L56-L63
def clear_measurements(self): """Remove all measurements from self.measurements. Reset the measurement counter. All ID are invalidated. """ keys = list(self.measurements.keys()) for key in keys: del(self.measurements[key]) self.meas_counter = -1
[ "def", "clear_measurements", "(", "self", ")", ":", "keys", "=", "list", "(", "self", ".", "measurements", ".", "keys", "(", ")", ")", "for", "key", "in", "keys", ":", "del", "(", "self", ".", "measurements", "[", "key", "]", ")", "self", ".", "mea...
Remove all measurements from self.measurements. Reset the measurement counter. All ID are invalidated.
[ "Remove", "all", "measurements", "from", "self", ".", "measurements", ".", "Reset", "the", "measurement", "counter", ".", "All", "ID", "are", "invalidated", "." ]
python
train
37.25
cga-harvard/Hypermap-Registry
hypermap/aggregator/models.py
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/models.py#L1238-L1390
def update_layers_geonode_wm(service, num_layers=None): """ Update layers for a WorldMap instance. Sample endpoint: http://localhost:8000/ """ wm_api_url = urlparse.urljoin(service.url, 'worldmap/api/2.8/layer/?format=json') if num_layers: total = num_layers else: response =...
[ "def", "update_layers_geonode_wm", "(", "service", ",", "num_layers", "=", "None", ")", ":", "wm_api_url", "=", "urlparse", ".", "urljoin", "(", "service", ".", "url", ",", "'worldmap/api/2.8/layer/?format=json'", ")", "if", "num_layers", ":", "total", "=", "num...
Update layers for a WorldMap instance. Sample endpoint: http://localhost:8000/
[ "Update", "layers", "for", "a", "WorldMap", "instance", ".", "Sample", "endpoint", ":", "http", ":", "//", "localhost", ":", "8000", "/" ]
python
train
45.54902
pawelad/pymonzo
src/pymonzo/monzo_api.py
https://github.com/pawelad/pymonzo/blob/b5c8d4f46dcb3a2f475797a8b8ef1c15f6493fb9/src/pymonzo/monzo_api.py#L276-L303
def balance(self, account_id=None): """ Returns balance information for a specific account. Official docs: https://monzo.com/docs/#read-balance :param account_id: Monzo account ID :type account_id: str :raises: ValueError :returns: Monzo balance inst...
[ "def", "balance", "(", "self", ",", "account_id", "=", "None", ")", ":", "if", "not", "account_id", ":", "if", "len", "(", "self", ".", "accounts", "(", ")", ")", "==", "1", ":", "account_id", "=", "self", ".", "accounts", "(", ")", "[", "0", "]"...
Returns balance information for a specific account. Official docs: https://monzo.com/docs/#read-balance :param account_id: Monzo account ID :type account_id: str :raises: ValueError :returns: Monzo balance instance :rtype: MonzoBalance
[ "Returns", "balance", "information", "for", "a", "specific", "account", "." ]
python
train
28.357143
pytroll/trollimage
trollimage/image.py
https://github.com/pytroll/trollimage/blob/d35a7665ad475ff230e457085523e21f2cd3f454/trollimage/image.py#L479-L537
def _to_p(self, mode): """Convert the image to P or PA mode. """ if self.mode.endswith("A"): chans = self.channels[:-1] alpha = self.channels[-1] self._secondary_mode = self.mode[:-1] else: chans = self.channels alpha = None ...
[ "def", "_to_p", "(", "self", ",", "mode", ")", ":", "if", "self", ".", "mode", ".", "endswith", "(", "\"A\"", ")", ":", "chans", "=", "self", ".", "channels", "[", ":", "-", "1", "]", "alpha", "=", "self", ".", "channels", "[", "-", "1", "]", ...
Convert the image to P or PA mode.
[ "Convert", "the", "image", "to", "P", "or", "PA", "mode", "." ]
python
train
31.864407
PythonCharmers/python-future
src/future/backports/email/_header_value_parser.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/_header_value_parser.py#L2259-L2287
def get_group(value): """ group = display-name ":" [group-list] ";" [CFWS] """ group = Group() token, value = get_display_name(value) if not value or value[0] != ':': raise errors.HeaderParseError("expected ':' at end of group " "display name but found '{}'".format(value)) g...
[ "def", "get_group", "(", "value", ")", ":", "group", "=", "Group", "(", ")", "token", ",", "value", "=", "get_display_name", "(", "value", ")", "if", "not", "value", "or", "value", "[", "0", "]", "!=", "':'", ":", "raise", "errors", ".", "HeaderParse...
group = display-name ":" [group-list] ";" [CFWS]
[ "group", "=", "display", "-", "name", ":", "[", "group", "-", "list", "]", ";", "[", "CFWS", "]" ]
python
train
36.344828
fhamborg/news-please
newsplease/crawler/commoncrawl_extractor.py
https://github.com/fhamborg/news-please/blob/731837c2a6c223cfb3e1d7f5fdc4f4eced2310f9/newsplease/crawler/commoncrawl_extractor.py#L288-L328
def extract_from_commoncrawl(self, warc_download_url, callback_on_article_extracted, valid_hosts=None, start_date=None, end_date=None, strict_date=True, reuse_previously_downloaded_files=True, local_download_dir_warc=None, ...
[ "def", "extract_from_commoncrawl", "(", "self", ",", "warc_download_url", ",", "callback_on_article_extracted", ",", "valid_hosts", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "strict_date", "=", "True", ",", "reuse_previously_dow...
Crawl and extract articles form the news crawl provided by commoncrawl.org. For each article that was extracted successfully the callback function callback_on_article_extracted is invoked where the first parameter is the article object. :param log_pathname_fully_extracted_warcs: :param d...
[ "Crawl", "and", "extract", "articles", "form", "the", "news", "crawl", "provided", "by", "commoncrawl", ".", "org", ".", "For", "each", "article", "that", "was", "extracted", "successfully", "the", "callback", "function", "callback_on_article_extracted", "is", "in...
python
train
51.97561
gtalarico/airtable-python-wrapper
airtable/airtable.py
https://github.com/gtalarico/airtable-python-wrapper/blob/48b2d806178085b52a31817571e5a1fc3dce4045/airtable/airtable.py#L322-L352
def search(self, field_name, field_value, record=None, **options): """ Returns all matching records found in :any:`get_all` >>> airtable.search('Gender', 'Male') [{'fields': {'Name': 'John', 'Gender': 'Male'}, ... ] Args: field_name (``str``): Name of field ...
[ "def", "search", "(", "self", ",", "field_name", ",", "field_value", ",", "record", "=", "None", ",", "*", "*", "options", ")", ":", "records", "=", "[", "]", "from_name_and_value", "=", "AirtableParams", ".", "FormulaParam", ".", "from_name_and_value", "for...
Returns all matching records found in :any:`get_all` >>> airtable.search('Gender', 'Male') [{'fields': {'Name': 'John', 'Gender': 'Male'}, ... ] Args: field_name (``str``): Name of field to match (column name). field_value (``str``): Value of field to match. ...
[ "Returns", "all", "matching", "records", "found", "in", ":", "any", ":", "get_all", ">>>", "airtable", ".", "search", "(", "Gender", "Male", ")", "[", "{", "fields", ":", "{", "Name", ":", "John", "Gender", ":", "Male", "}", "...", "]", "Args", ":", ...
python
train
42.612903
PolyJIT/benchbuild
benchbuild/utils/schema.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/utils/schema.py#L351-L361
def enforce_versioning(force=False): """Install versioning on the db.""" connect_str, repo_url = get_version_data() LOG.warning("Your database uses an unversioned benchbuild schema.") if not force and not ui.ask( "Should I enforce version control on your schema?"): LOG.error("User de...
[ "def", "enforce_versioning", "(", "force", "=", "False", ")", ":", "connect_str", ",", "repo_url", "=", "get_version_data", "(", ")", "LOG", ".", "warning", "(", "\"Your database uses an unversioned benchbuild schema.\"", ")", "if", "not", "force", "and", "not", "...
Install versioning on the db.
[ "Install", "versioning", "on", "the", "db", "." ]
python
train
46.909091
rgs1/zk_shell
zk_shell/keys.py
https://github.com/rgs1/zk_shell/blob/bbf34fdfcf1f81100e2a5816fad8af6afc782a54/zk_shell/keys.py#L147-L207
def set(cls, obj, keys, value, fill_list_value=None): """ sets the value for the given keys on obj. if any of the given keys does not exist, create the intermediate containers. """ current = obj keys_list = keys.split(".") for idx, key in enumerate(keys_list, 1):...
[ "def", "set", "(", "cls", ",", "obj", ",", "keys", ",", "value", ",", "fill_list_value", "=", "None", ")", ":", "current", "=", "obj", "keys_list", "=", "keys", ".", "split", "(", "\".\"", ")", "for", "idx", ",", "key", "in", "enumerate", "(", "key...
sets the value for the given keys on obj. if any of the given keys does not exist, create the intermediate containers.
[ "sets", "the", "value", "for", "the", "given", "keys", "on", "obj", ".", "if", "any", "of", "the", "given", "keys", "does", "not", "exist", "create", "the", "intermediate", "containers", "." ]
python
train
36.098361
odlgroup/odl
odl/contrib/solvers/spdhg/misc.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/solvers/spdhg/misc.py#L239-L308
def proximal(self, sigma): """Prox operator of TV. It allows the proximal step length to be a vector of positive elements. Examples -------- Check that the proximal operator is the identity for sigma=0 >>> import odl.contrib.solvers.spdhg as spdhg, odl, numpy as np ...
[ "def", "proximal", "(", "self", ",", "sigma", ")", ":", "if", "sigma", "==", "0", ":", "return", "odl", ".", "IdentityOperator", "(", "self", ".", "domain", ")", "else", ":", "def", "tv_prox", "(", "z", ",", "out", "=", "None", ")", ":", "if", "o...
Prox operator of TV. It allows the proximal step length to be a vector of positive elements. Examples -------- Check that the proximal operator is the identity for sigma=0 >>> import odl.contrib.solvers.spdhg as spdhg, odl, numpy as np >>> space = odl.uniform_discr([0, ...
[ "Prox", "operator", "of", "TV", ".", "It", "allows", "the", "proximal", "step", "length", "to", "be", "a", "vector", "of", "positive", "elements", "." ]
python
train
32.228571
stuaxo/vext
setup.py
https://github.com/stuaxo/vext/blob/fa98a21ecfbbc1c3d1b84085d69ec42defdd2f69/setup.py#L199-L205
def depends_on(self, dependency): """ List of packages that depend on dependency :param dependency: package name, e.g. 'vext' or 'Pillow' """ packages = self.package_info() return [package for package in packages if dependency in package.get("requires", "")]
[ "def", "depends_on", "(", "self", ",", "dependency", ")", ":", "packages", "=", "self", ".", "package_info", "(", ")", "return", "[", "package", "for", "package", "in", "packages", "if", "dependency", "in", "package", ".", "get", "(", "\"requires\"", ",", ...
List of packages that depend on dependency :param dependency: package name, e.g. 'vext' or 'Pillow'
[ "List", "of", "packages", "that", "depend", "on", "dependency", ":", "param", "dependency", ":", "package", "name", "e", ".", "g", ".", "vext", "or", "Pillow" ]
python
train
43
chaoss/grimoirelab-perceval
perceval/backends/core/gerrit.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gerrit.py#L368-L388
def next_retrieve_group_item(self, last_item=None, entry=None): """Return the item to start from in next reviews group.""" next_item = None gerrit_version = self.version if gerrit_version[0] == 2 and gerrit_version[1] > 9: if last_item is None: next_item = ...
[ "def", "next_retrieve_group_item", "(", "self", ",", "last_item", "=", "None", ",", "entry", "=", "None", ")", ":", "next_item", "=", "None", "gerrit_version", "=", "self", ".", "version", "if", "gerrit_version", "[", "0", "]", "==", "2", "and", "gerrit_ve...
Return the item to start from in next reviews group.
[ "Return", "the", "item", "to", "start", "from", "in", "next", "reviews", "group", "." ]
python
test
34.571429
nerdvegas/rez
src/rez/packages_.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L305-L312
def qualified_name(self): """Get the qualified name of the variant. Returns: str: Name of the variant with version and index, eg "maya-2016.1[1]". """ idxstr = '' if self.index is None else str(self.index) return "%s[%s]" % (self.qualified_package_name, idxstr)
[ "def", "qualified_name", "(", "self", ")", ":", "idxstr", "=", "''", "if", "self", ".", "index", "is", "None", "else", "str", "(", "self", ".", "index", ")", "return", "\"%s[%s]\"", "%", "(", "self", ".", "qualified_package_name", ",", "idxstr", ")" ]
Get the qualified name of the variant. Returns: str: Name of the variant with version and index, eg "maya-2016.1[1]".
[ "Get", "the", "qualified", "name", "of", "the", "variant", "." ]
python
train
38.375
Autodesk/aomi
aomi/model/resource.py
https://github.com/Autodesk/aomi/blob/84da2dfb0424837adf9c4ddc1aa352e942bb7a4a/aomi/model/resource.py#L158-L188
def diff(self, obj=None): """Determine if something has changed or not""" if self.no_resource: return NOOP if not self.present: if self.existing: return DEL return NOOP if not obj: obj = self.obj() is_diff = NOOP...
[ "def", "diff", "(", "self", ",", "obj", "=", "None", ")", ":", "if", "self", ".", "no_resource", ":", "return", "NOOP", "if", "not", "self", ".", "present", ":", "if", "self", ".", "existing", ":", "return", "DEL", "return", "NOOP", "if", "not", "o...
Determine if something has changed or not
[ "Determine", "if", "something", "has", "changed", "or", "not" ]
python
train
26.935484
MisterY/asset-allocation
asset_allocation/stocks.py
https://github.com/MisterY/asset-allocation/blob/72239aa20762cda67c091f27b86e65d61bf3b613/asset_allocation/stocks.py#L125-L131
def __get_pricedb_session(self): """ Provides initialization and access to module-level session """ from pricedb import dal if not self.pricedb_session: self.pricedb_session = dal.get_default_session() return self.pricedb_session
[ "def", "__get_pricedb_session", "(", "self", ")", ":", "from", "pricedb", "import", "dal", "if", "not", "self", ".", "pricedb_session", ":", "self", ".", "pricedb_session", "=", "dal", ".", "get_default_session", "(", ")", "return", "self", ".", "pricedb_sessi...
Provides initialization and access to module-level session
[ "Provides", "initialization", "and", "access", "to", "module", "-", "level", "session" ]
python
train
38.285714
rosenbrockc/fortpy
fortpy/scripts/analyze.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/scripts/analyze.py#L532-L555
def do_dep(self, args): """Adds the name and attribute of a dependent variable to the list for plotting/tabulating functions.""" vals = args.split() twin = None if len(vals) > 1: if len(vals) == 2: var, plot = vals elif len(vals) == 3: ...
[ "def", "do_dep", "(", "self", ",", "args", ")", ":", "vals", "=", "args", ".", "split", "(", ")", "twin", "=", "None", "if", "len", "(", "vals", ")", ">", "1", ":", "if", "len", "(", "vals", ")", "==", "2", ":", "var", ",", "plot", "=", "va...
Adds the name and attribute of a dependent variable to the list for plotting/tabulating functions.
[ "Adds", "the", "name", "and", "attribute", "of", "a", "dependent", "variable", "to", "the", "list", "for", "plotting", "/", "tabulating", "functions", "." ]
python
train
36.625
sdonk/django-admin-ip-restrictor
admin_ip_restrictor/middleware.py
https://github.com/sdonk/django-admin-ip-restrictor/blob/29c948677e52bc416d44fff0f013d1f4ba2cb782/admin_ip_restrictor/middleware.py#L60-L71
def is_blocked(self, ip): """Determine if an IP address should be considered blocked.""" blocked = True if ip in self.allowed_admin_ips: blocked = False for allowed_range in self.allowed_admin_ip_ranges: if ipaddress.ip_address(ip) in ipaddress.ip_network(allowe...
[ "def", "is_blocked", "(", "self", ",", "ip", ")", ":", "blocked", "=", "True", "if", "ip", "in", "self", ".", "allowed_admin_ips", ":", "blocked", "=", "False", "for", "allowed_range", "in", "self", ".", "allowed_admin_ip_ranges", ":", "if", "ipaddress", "...
Determine if an IP address should be considered blocked.
[ "Determine", "if", "an", "IP", "address", "should", "be", "considered", "blocked", "." ]
python
train
31.166667
bitesofcode/projexui
projexui/widgets/xsplitbutton.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xsplitbutton.py#L149-L185
def addAction(self, action, checked=None, autoBuild=True): """ Adds the inputed action to this widget's action group. This will auto-\ create a new group if no group is already defined. :param action | <QAction> || <str> :return <QAction> ...
[ "def", "addAction", "(", "self", ",", "action", ",", "checked", "=", "None", ",", "autoBuild", "=", "True", ")", ":", "# clear the holder\r", "actions", "=", "self", ".", "_actionGroup", ".", "actions", "(", ")", "if", "actions", "and", "actions", "[", "...
Adds the inputed action to this widget's action group. This will auto-\ create a new group if no group is already defined. :param action | <QAction> || <str> :return <QAction>
[ "Adds", "the", "inputed", "action", "to", "this", "widget", "s", "action", "group", ".", "This", "will", "auto", "-", "\\", "create", "a", "new", "group", "if", "no", "group", "is", "already", "defined", ".", ":", "param", "action", "|", "<QAction", ">...
python
train
35.540541
pyblish/pyblish-lite
pyblish_lite/delegate.py
https://github.com/pyblish/pyblish-lite/blob/9172b81c7ae19a36e99c89dd16e102201992dc20/pyblish_lite/delegate.py#L50-L143
def paint(self, painter, option, index): """Paint checkbox and text _ |_| My label """ body_rect = QtCore.QRectF(option.rect) check_rect = QtCore.QRectF(body_rect) check_rect.setWidth(check_rect.height()) check_rect.adjust(6, 6, -6, -6) check...
[ "def", "paint", "(", "self", ",", "painter", ",", "option", ",", "index", ")", ":", "body_rect", "=", "QtCore", ".", "QRectF", "(", "option", ".", "rect", ")", "check_rect", "=", "QtCore", ".", "QRectF", "(", "body_rect", ")", "check_rect", ".", "setWi...
Paint checkbox and text _ |_| My label
[ "Paint", "checkbox", "and", "text", "_", "|_|", "My", "label" ]
python
train
30.255319
jdoda/sdl2hl
sdl2hl/renderer.py
https://github.com/jdoda/sdl2hl/blob/3b477e1e01cea5d8e15e9e5ef3a302ea460f5946/sdl2hl/renderer.py#L268-L298
def copy(self, texture, source_rect=None, dest_rect=None, rotation=0, center=None, flip=lib.SDL_FLIP_NONE): """Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center. Args: texture (Texture): The source texture. source_...
[ "def", "copy", "(", "self", ",", "texture", ",", "source_rect", "=", "None", ",", "dest_rect", "=", "None", ",", "rotation", "=", "0", ",", "center", "=", "None", ",", "flip", "=", "lib", ".", "SDL_FLIP_NONE", ")", ":", "if", "source_rect", "==", "No...
Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center. Args: texture (Texture): The source texture. source_rect (Rect): The source rectangle, or None for the entire texture. dest_rect (Rect): The destination rectan...
[ "Copy", "a", "portion", "of", "the", "source", "texture", "to", "the", "current", "rendering", "target", "rotating", "it", "by", "angle", "around", "the", "given", "center", "." ]
python
train
46.580645
mromanello/hucitlib
knowledge_base/__init__.py
https://github.com/mromanello/hucitlib/blob/6587d1b04eb7e5b48ad7359be845e5d3b444d6fa/knowledge_base/__init__.py#L272-L298
def get_author_label(self, urn): """Get the label corresponding to the author identified by the CTS URN. try to get an lang=en label (if multiple labels in this lang pick the shortest) try to get a lang=la label (if multiple labels in this lang exist pick the shortest) try to get a lang...
[ "def", "get_author_label", "(", "self", ",", "urn", ")", ":", "author", "=", "self", ".", "get_resource_by_urn", "(", "urn", ")", "names", "=", "author", ".", "get_names", "(", ")", "en_names", "=", "sorted", "(", "[", "name", "[", "1", "]", "for", "...
Get the label corresponding to the author identified by the CTS URN. try to get an lang=en label (if multiple labels in this lang pick the shortest) try to get a lang=la label (if multiple labels in this lang exist pick the shortest) try to get a lang=None label (if multiple labels in this lang...
[ "Get", "the", "label", "corresponding", "to", "the", "author", "identified", "by", "the", "CTS", "URN", "." ]
python
train
42.222222
wbond/asn1crypto
asn1crypto/core.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/core.py#L3523-L3617
def _make_value(self, field_name, field_spec, value_spec, field_params, value): """ Contructs an appropriate Asn1Value object for a field :param field_name: A unicode string of the field name :param field_spec: An Asn1Value class that is the field spec ...
[ "def", "_make_value", "(", "self", ",", "field_name", ",", "field_spec", ",", "value_spec", ",", "field_params", ",", "value", ")", ":", "if", "value", "is", "None", "and", "'optional'", "in", "field_params", ":", "return", "VOID", "specs_different", "=", "f...
Contructs an appropriate Asn1Value object for a field :param field_name: A unicode string of the field name :param field_spec: An Asn1Value class that is the field spec :param value_spec: An Asn1Value class that is the vaue spec :param field_params...
[ "Contructs", "an", "appropriate", "Asn1Value", "object", "for", "a", "field" ]
python
train
35.810526
joferkington/mplstereonet
mplstereonet/analysis.py
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/analysis.py#L325-L400
def kmeans(*args, **kwargs): """ Find centers of multi-modal clusters of data using a kmeans approach modified for spherical measurements. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be ``strike`` & ``dip``, both array-lik...
[ "def", "kmeans", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lon", ",", "lat", "=", "_convert_measurements", "(", "args", ",", "kwargs", ".", "get", "(", "'measurement'", ",", "'poles'", ")", ")", "num", "=", "kwargs", ".", "get", "(", "'...
Find centers of multi-modal clusters of data using a kmeans approach modified for spherical measurements. Parameters ---------- *args : 2 or 3 sequences of measurements By default, this will be expected to be ``strike`` & ``dip``, both array-like sequences representing poles to planes....
[ "Find", "centers", "of", "multi", "-", "modal", "clusters", "of", "data", "using", "a", "kmeans", "approach", "modified", "for", "spherical", "measurements", "." ]
python
train
36.328947
orbingol/NURBS-Python
geomdl/linalg.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L396-L415
def triangle_center(tri, uv=False): """ Computes the center of mass of the input triangle. :param tri: triangle object :type tri: elements.Triangle :param uv: if True, then finds parametric position of the center of mass :type uv: bool :return: center of mass of the triangle :rtype: tuple ...
[ "def", "triangle_center", "(", "tri", ",", "uv", "=", "False", ")", ":", "if", "uv", ":", "data", "=", "[", "t", ".", "uv", "for", "t", "in", "tri", "]", "mid", "=", "[", "0.0", ",", "0.0", "]", "else", ":", "data", "=", "tri", ".", "vertices...
Computes the center of mass of the input triangle. :param tri: triangle object :type tri: elements.Triangle :param uv: if True, then finds parametric position of the center of mass :type uv: bool :return: center of mass of the triangle :rtype: tuple
[ "Computes", "the", "center", "of", "mass", "of", "the", "input", "triangle", "." ]
python
train
28.95
idlesign/uwsgiconf
uwsgiconf/options/queue.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/queue.py#L15-L32
def enable(self, size, block_size=None, store=None, store_sync_interval=None): """Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int...
[ "def", "enable", "(", "self", ",", "size", ",", "block_size", "=", "None", ",", "store", "=", "None", ",", "store_sync_interval", "=", "None", ")", ":", "self", ".", "_set", "(", "'queue'", ",", "size", ")", "self", ".", "_set", "(", "'queue-blocksize'...
Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int store_sync_interval: Store sync interval in master cycles (usually seconds).
[ "Enables", "shared", "queue", "of", "the", "given", "size", "." ]
python
train
33.555556
boriel/zxbasic
arch/zx48k/backend/__parray.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__parray.py#L132-L159
def _pastore8(ins): ''' Stores 2º operand content into address of 1st operand. 1st operand is an array element. Dimensions are pushed into the stack. Use '*' for indirect store on 1st operand (A pointer to an array) ''' output = _paddr(ins.quad[1]) value = ins.quad[2] if value[0] == '*'...
[ "def", "_pastore8", "(", "ins", ")", ":", "output", "=", "_paddr", "(", "ins", ".", "quad", "[", "1", "]", ")", "value", "=", "ins", ".", "quad", "[", "2", "]", "if", "value", "[", "0", "]", "==", "'*'", ":", "value", "=", "value", "[", "1", ...
Stores 2º operand content into address of 1st operand. 1st operand is an array element. Dimensions are pushed into the stack. Use '*' for indirect store on 1st operand (A pointer to an array)
[ "Stores", "2º", "operand", "content", "into", "address", "of", "1st", "operand", ".", "1st", "operand", "is", "an", "array", "element", ".", "Dimensions", "are", "pushed", "into", "the", "stack", ".", "Use", "*", "for", "indirect", "store", "on", "1st", ...
python
train
26.392857
honzamach/pynspect
pynspect/traversers.py
https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/traversers.py#L710-L730
def evaluate_binop_math(self, operation, left, right, **kwargs): """ Evaluate given mathematical binary operation with given operands. """ if not operation in self.binops_math: raise ValueError("Invalid math binary operation '{}'".format(operation)) if left is None or...
[ "def", "evaluate_binop_math", "(", "self", ",", "operation", ",", "left", ",", "right", ",", "*", "*", "kwargs", ")", ":", "if", "not", "operation", "in", "self", ".", "binops_math", ":", "raise", "ValueError", "(", "\"Invalid math binary operation '{}'\"", "....
Evaluate given mathematical binary operation with given operands.
[ "Evaluate", "given", "mathematical", "binary", "operation", "with", "given", "operands", "." ]
python
train
35.904762
WebarchivCZ/WA-KAT
src/wa_kat/analyzers/keyword_detector.py
https://github.com/WebarchivCZ/WA-KAT/blob/16d064a3a775dc1d2713debda7847ded52dd2a06/src/wa_kat/analyzers/keyword_detector.py#L54-L73
def get_html_keywords(index_page): """ Return list of `keywords` parsed from HTML ``<meta>`` tags. Args: index_page (str): Content of the page as UTF-8 string Returns: list: List of :class:`.SourceString` objects. """ keyword_lists = ( keyword_list.split(",") fo...
[ "def", "get_html_keywords", "(", "index_page", ")", ":", "keyword_lists", "=", "(", "keyword_list", ".", "split", "(", "\",\"", ")", "for", "keyword_list", "in", "parse_meta", "(", "index_page", ",", "\"keywords\"", ",", "\"HTML\"", ")", ")", "# create SourceStr...
Return list of `keywords` parsed from HTML ``<meta>`` tags. Args: index_page (str): Content of the page as UTF-8 string Returns: list: List of :class:`.SourceString` objects.
[ "Return", "list", "of", "keywords", "parsed", "from", "HTML", "<meta", ">", "tags", "." ]
python
train
28
giffels/CloudStackAIO
CloudStackAIO/CloudStack.py
https://github.com/giffels/CloudStackAIO/blob/f9df856622eb8966a6816f8008cc16d75b0067e5/CloudStackAIO/CloudStack.py#L157-L201
async def _handle_response(self, response: aiohttp.client_reqrep.ClientResponse, await_final_result: bool) -> dict: """ Handles the response returned from the CloudStack API. Some CloudStack API are implemented asynchronous, which means that the API call returns just a job id. The actually expec...
[ "async", "def", "_handle_response", "(", "self", ",", "response", ":", "aiohttp", ".", "client_reqrep", ".", "ClientResponse", ",", "await_final_result", ":", "bool", ")", "->", "dict", ":", "try", ":", "data", "=", "await", "response", ".", "json", "(", "...
Handles the response returned from the CloudStack API. Some CloudStack API are implemented asynchronous, which means that the API call returns just a job id. The actually expected API response is postponed and a specific asyncJobResults API has to be polled using the job id to get the final result once ...
[ "Handles", "the", "response", "returned", "from", "the", "CloudStack", "API", ".", "Some", "CloudStack", "API", "are", "implemented", "asynchronous", "which", "means", "that", "the", "API", "call", "returns", "just", "a", "job", "id", ".", "The", "actually", ...
python
test
58.822222
ultradns/python_rest_api_client
ultra_rest_client/ultra_rest_client.py
https://github.com/ultradns/python_rest_api_client/blob/e4095f28f5cb5e258b768c06ef7cf8b1915aa5ec/ultra_rest_client/ultra_rest_client.py#L333-L356
def edit_rrset(self, zone_name, rtype, owner_name, ttl, rdata, profile=None): """Updates an existing RRSet in the specified zone. Arguments: zone_name -- The zone that contains the RRSet. The trailing dot is optional. rtype -- The type of the RRSet. This can be numeric (1) or ...
[ "def", "edit_rrset", "(", "self", ",", "zone_name", ",", "rtype", ",", "owner_name", ",", "ttl", ",", "rdata", ",", "profile", "=", "None", ")", ":", "if", "type", "(", "rdata", ")", "is", "not", "list", ":", "rdata", "=", "[", "rdata", "]", "rrset...
Updates an existing RRSet in the specified zone. Arguments: zone_name -- The zone that contains the RRSet. The trailing dot is optional. rtype -- The type of the RRSet. This can be numeric (1) or if a well-known name is defined for the type (A), you can use it instead. ...
[ "Updates", "an", "existing", "RRSet", "in", "the", "specified", "zone", "." ]
python
train
56.958333
trombastic/PyScada
pyscada/utils/scheduler.py
https://github.com/trombastic/PyScada/blob/c5fc348a25f0df1340336f694ee9bc1aea62516a/pyscada/utils/scheduler.py#L709-L719
def stop(self, signum=None, frame=None): """ handel's a termination signal """ BackgroundProcess.objects.filter(pk=self.process_id ).update(pid=0, last_update=now(), message='stopping..') # run the cleanup self.cleanup() Ba...
[ "def", "stop", "(", "self", ",", "signum", "=", "None", ",", "frame", "=", "None", ")", ":", "BackgroundProcess", ".", "objects", ".", "filter", "(", "pk", "=", "self", ".", "process_id", ")", ".", "update", "(", "pid", "=", "0", ",", "last_update", ...
handel's a termination signal
[ "handel", "s", "a", "termination", "signal" ]
python
train
49.818182
nickmilon/Hellas
Hellas/Sparta.py
https://github.com/nickmilon/Hellas/blob/542e4778692fbec90753942946f20100412ec9ee/Hellas/Sparta.py#L264-L288
def relations_dict(rel_lst): """constructs a relation's dictionary from a list that describes amphidromus relations between objects :param list rel_lst: a relationships list of the form [[a,b],[c, a, b]] # can include duplicates :returns: a dictionary :Example: >>> rl = [('a', 'b', 'c'), ('a'...
[ "def", "relations_dict", "(", "rel_lst", ")", ":", "dc", "=", "{", "}", "for", "c", "in", "rel_lst", ":", "for", "i", "in", "c", ":", "for", "k", "in", "c", ":", "dc", ".", "setdefault", "(", "i", ",", "[", "]", ")", "dc", "[", "i", "]", "....
constructs a relation's dictionary from a list that describes amphidromus relations between objects :param list rel_lst: a relationships list of the form [[a,b],[c, a, b]] # can include duplicates :returns: a dictionary :Example: >>> rl = [('a', 'b', 'c'), ('a', 'x', 'y'), ('x', 'y', 'z')] ...
[ "constructs", "a", "relation", "s", "dictionary", "from", "a", "list", "that", "describes", "amphidromus", "relations", "between", "objects" ]
python
train
33.16
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewpanel.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewpanel.py#L407-L418
def clear(self): """ Clears out all the items from this tab bar. """ self.blockSignals(True) items = list(self.items()) for item in items: item.close() self.blockSignals(False) self._currentIndex = -1 self.currentIndexChanged.emit(self...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "blockSignals", "(", "True", ")", "items", "=", "list", "(", "self", ".", "items", "(", ")", ")", "for", "item", "in", "items", ":", "item", ".", "close", "(", ")", "self", ".", "blockSignals", ...
Clears out all the items from this tab bar.
[ "Clears", "out", "all", "the", "items", "from", "this", "tab", "bar", "." ]
python
train
27
Telefonica/toolium
toolium/driver_wrapper.py
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/driver_wrapper.py#L108-L131
def configure_properties(self, tc_config_prop_filenames=None, behave_properties=None): """Configure selenium instance properties :param tc_config_prop_filenames: test case specific properties filenames :param behave_properties: dict with behave user data properties """ prop_file...
[ "def", "configure_properties", "(", "self", ",", "tc_config_prop_filenames", "=", "None", ",", "behave_properties", "=", "None", ")", ":", "prop_filenames", "=", "DriverWrappersPool", ".", "get_configured_value", "(", "'Config_prop_filenames'", ",", "tc_config_prop_filena...
Configure selenium instance properties :param tc_config_prop_filenames: test case specific properties filenames :param behave_properties: dict with behave user data properties
[ "Configure", "selenium", "instance", "properties" ]
python
train
53.416667
src-d/modelforge
modelforge/model.py
https://github.com/src-d/modelforge/blob/4f73c2bf0318261ac01bc8b6c0d4250a5d303418/modelforge/model.py#L504-L524
def split_strings(subtree: dict) -> List[str]: """ Produce the list of strings from the dictionary with concatenated chars \ and lengths. Opposite to :func:`merge_strings()`. :param subtree: The dict with "strings" and "lengths". :return: :class:`list` of :class:`str`-s or :class:`bytes`. """ ...
[ "def", "split_strings", "(", "subtree", ":", "dict", ")", "->", "List", "[", "str", "]", ":", "strings", "=", "subtree", "[", "\"strings\"", "]", "lengths", "=", "subtree", "[", "\"lengths\"", "]", "if", "lengths", ".", "shape", "[", "0", "]", "==", ...
Produce the list of strings from the dictionary with concatenated chars \ and lengths. Opposite to :func:`merge_strings()`. :param subtree: The dict with "strings" and "lengths". :return: :class:`list` of :class:`str`-s or :class:`bytes`.
[ "Produce", "the", "list", "of", "strings", "from", "the", "dictionary", "with", "concatenated", "chars", "\\", "and", "lengths", ".", "Opposite", "to", ":", "func", ":", "merge_strings", "()", "." ]
python
train
33.952381
coleifer/peewee
playhouse/sqlite_ext.py
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L391-L400
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls._search( term, weights, with_score, score_alias, cls.rank, ...
[ "def", "search", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weights", ...
Full-text search using selected `term`.
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
python
train
32.9
osrg/ryu
ryu/services/protocols/bgp/api/rtconf.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/api/rtconf.py#L45-L56
def _get_neighbor_conf(neigh_ip_address): """Returns neighbor configuration for given neighbor ip address. Raises exception if no neighbor with `neigh_ip_address` exists. """ neigh_conf = \ CORE_MANAGER.neighbors_conf.get_neighbor_conf(neigh_ip_address) if not neigh_conf: raise Runt...
[ "def", "_get_neighbor_conf", "(", "neigh_ip_address", ")", ":", "neigh_conf", "=", "CORE_MANAGER", ".", "neighbors_conf", ".", "get_neighbor_conf", "(", "neigh_ip_address", ")", "if", "not", "neigh_conf", ":", "raise", "RuntimeConfigError", "(", "desc", "=", "'No Ne...
Returns neighbor configuration for given neighbor ip address. Raises exception if no neighbor with `neigh_ip_address` exists.
[ "Returns", "neighbor", "configuration", "for", "given", "neighbor", "ip", "address", "." ]
python
train
41.75
pvlib/pvlib-python
pvlib/iotools/tmy.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/iotools/tmy.py#L19-L209
def read_tmy3(filename=None, coerce_year=None, recolumn=True): ''' Read a TMY3 file in to a pandas dataframe. Note that values contained in the metadata dictionary are unchanged from the TMY3 file (i.e. units are retained). In the case of any discrepencies between this documentation and the TMY3 Us...
[ "def", "read_tmy3", "(", "filename", "=", "None", ",", "coerce_year", "=", "None", ",", "recolumn", "=", "True", ")", ":", "if", "filename", "is", "None", ":", "try", ":", "filename", "=", "_interactive_load", "(", ")", "except", "ImportError", ":", "rai...
Read a TMY3 file in to a pandas dataframe. Note that values contained in the metadata dictionary are unchanged from the TMY3 file (i.e. units are retained). In the case of any discrepencies between this documentation and the TMY3 User's Manual [1], the TMY3 User's Manual takes precedence. The TMY3...
[ "Read", "a", "TMY3", "file", "in", "to", "a", "pandas", "dataframe", "." ]
python
train
60.031414
tensorflow/mesh
mesh_tensorflow/transformer/metric_utils.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/transformer/metric_utils.py#L28-L50
def get_metric_fns(metric_names, labels, outputs): """Generate a dictionary of metric name to metric function. Args: metric_names: list of strings in the format "prefix/metric_function_name". metric_function_name should refer to a function name in metrics.py. The prefix will be included in the key ...
[ "def", "get_metric_fns", "(", "metric_names", ",", "labels", ",", "outputs", ")", ":", "metric_fns", "=", "{", "}", "for", "metric_name", "in", "metric_names", ":", "metric_fn_name", "=", "metric_name", ".", "split", "(", "\"/\"", ")", "[", "-", "1", "]", ...
Generate a dictionary of metric name to metric function. Args: metric_names: list of strings in the format "prefix/metric_function_name". metric_function_name should refer to a function name in metrics.py. The prefix will be included in the key in the returned dict. labels: a tensor where batch i...
[ "Generate", "a", "dictionary", "of", "metric", "name", "to", "metric", "function", "." ]
python
train
38.782609
dcrosta/sendlib
sendlib.py
https://github.com/dcrosta/sendlib/blob/51ea5412a70cf83a62d51d5c515c0eeac725aea0/sendlib.py#L628-L680
def parse(schema): """ Parse `schema`, either a string or a file-like object, and return a :class:`MessageRegistry` with the loaded messages. """ if not isinstance(schema, basestring): # assume it is file-like schema = schema.read() message = re.compile(r'^\(([^,]+),\s*(\d+)\):\...
[ "def", "parse", "(", "schema", ")", ":", "if", "not", "isinstance", "(", "schema", ",", "basestring", ")", ":", "# assume it is file-like", "schema", "=", "schema", ".", "read", "(", ")", "message", "=", "re", ".", "compile", "(", "r'^\\(([^,]+),\\s*(\\d+)\\...
Parse `schema`, either a string or a file-like object, and return a :class:`MessageRegistry` with the loaded messages.
[ "Parse", "schema", "either", "a", "string", "or", "a", "file", "-", "like", "object", "and", "return", "a", ":", "class", ":", "MessageRegistry", "with", "the", "loaded", "messages", "." ]
python
train
31.45283
Infinidat/infi.clickhouse_orm
src/infi/clickhouse_orm/system_models.py
https://github.com/Infinidat/infi.clickhouse_orm/blob/595f2023e334e3925a5c3fbfdd6083a5992a7169/src/infi/clickhouse_orm/system_models.py#L109-L116
def fetch(self, zookeeper_path, settings=None): """ Download a partition from another server. :param zookeeper_path: Path in zookeeper to fetch from :param settings: Settings for executing request to ClickHouse over db.raw() method :return: SQL Query """ re...
[ "def", "fetch", "(", "self", ",", "zookeeper_path", ",", "settings", "=", "None", ")", ":", "return", "self", ".", "_partition_operation_sql", "(", "'FETCH'", ",", "settings", "=", "settings", ",", "from_part", "=", "zookeeper_path", ")" ]
Download a partition from another server. :param zookeeper_path: Path in zookeeper to fetch from :param settings: Settings for executing request to ClickHouse over db.raw() method :return: SQL Query
[ "Download", "a", "partition", "from", "another", "server", ".", ":", "param", "zookeeper_path", ":", "Path", "in", "zookeeper", "to", "fetch", "from", ":", "param", "settings", ":", "Settings", "for", "executing", "request", "to", "ClickHouse", "over", "db", ...
python
train
50.125
materialsproject/pymatgen
pymatgen/util/convergence.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L285-L303
def measure(function, xs, ys, popt, weights): """ measure the quality of a fit """ m = 0 n = 0 for x in xs: try: if len(popt) == 2: m += (ys[n] - function(x, popt[0], popt[1]))**2 * weights[n] elif len(popt) == 3: m += (ys[n] - func...
[ "def", "measure", "(", "function", ",", "xs", ",", "ys", ",", "popt", ",", "weights", ")", ":", "m", "=", "0", "n", "=", "0", "for", "x", "in", "xs", ":", "try", ":", "if", "len", "(", "popt", ")", "==", "2", ":", "m", "+=", "(", "ys", "[...
measure the quality of a fit
[ "measure", "the", "quality", "of", "a", "fit" ]
python
train
29.631579
assamite/creamas
creamas/logging.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/logging.py#L115-L118
def get_file(self, attr_name): '''Return absolute path to logging file for obj's attribute.''' return os.path.abspath(os.path.join(self.folder, "{}.log" .format(attr_name)))
[ "def", "get_file", "(", "self", ",", "attr_name", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "self", ".", "folder", ",", "\"{}.log\"", ".", "format", "(", "attr_name", ")", ")", ")" ]
Return absolute path to logging file for obj's attribute.
[ "Return", "absolute", "path", "to", "logging", "file", "for", "obj", "s", "attribute", "." ]
python
train
57.5
mcs07/ChemDataExtractor
chemdataextractor/nlp/tokenize.py
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/nlp/tokenize.py#L573-L766
def _subspan(self, s, span, nextspan): """Recursively subdivide spans based on a series of rules.""" text = s[span[0]:span[1]] lowertext = text.lower() # Skip if only a single character or a split sequence if span[1] - span[0] < 2 or text in self.SPLIT or text in self.SPLIT_END_...
[ "def", "_subspan", "(", "self", ",", "s", ",", "span", ",", "nextspan", ")", ":", "text", "=", "s", "[", "span", "[", "0", "]", ":", "span", "[", "1", "]", "]", "lowertext", "=", "text", ".", "lower", "(", ")", "# Skip if only a single character or a...
Recursively subdivide spans based on a series of rules.
[ "Recursively", "subdivide", "spans", "based", "on", "a", "series", "of", "rules", "." ]
python
train
56.180412
MolSSI-BSE/basis_set_exchange
basis_set_exchange/cli/bsecurate_handlers.py
https://github.com/MolSSI-BSE/basis_set_exchange/blob/e79110aaeb65f392ed5032420322dee3336948f7/basis_set_exchange/cli/bsecurate_handlers.py#L28-L41
def _bsecurate_cli_component_file_refs(args): '''Handles the component-file-refs subcommand''' data = curate.component_file_refs(args.files) s = '' for cfile, cdata in data.items(): s += cfile + '\n' rows = [] for el, refs in cdata: rows.append((' ' + el, ' '.joi...
[ "def", "_bsecurate_cli_component_file_refs", "(", "args", ")", ":", "data", "=", "curate", ".", "component_file_refs", "(", "args", ".", "files", ")", "s", "=", "''", "for", "cfile", ",", "cdata", "in", "data", ".", "items", "(", ")", ":", "s", "+=", "...
Handles the component-file-refs subcommand
[ "Handles", "the", "component", "-", "file", "-", "refs", "subcommand" ]
python
train
27.428571
indico/indico-plugins
livesync/indico_livesync/cli.py
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L37-L41
def available_backends(): """Lists the currently available backend types""" print 'The following LiveSync agents are available:' for name, backend in current_plugin.backend_classes.iteritems(): print cformat(' - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
[ "def", "available_backends", "(", ")", ":", "print", "'The following LiveSync agents are available:'", "for", "name", ",", "backend", "in", "current_plugin", ".", "backend_classes", ".", "iteritems", "(", ")", ":", "print", "cformat", "(", "' - %{white!}{}%{reset}: {} ...
Lists the currently available backend types
[ "Lists", "the", "currently", "available", "backend", "types" ]
python
train
61.6
UCL-INGI/INGInious
inginious/frontend/plugins/simple_grader/__init__.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugins/simple_grader/__init__.py#L17-L116
def init(plugin_manager, course_factory, client, config): """ Init the external grader plugin. This simple grader allows only anonymous requests, and submissions are not stored in database. Available configuration: :: plugins: - plugin_module: inginious.frontend...
[ "def", "init", "(", "plugin_manager", ",", "course_factory", ",", "client", ",", "config", ")", ":", "courseid", "=", "config", ".", "get", "(", "'courseid'", ",", "'external'", ")", "course", "=", "course_factory", ".", "get_course", "(", "courseid", ")", ...
Init the external grader plugin. This simple grader allows only anonymous requests, and submissions are not stored in database. Available configuration: :: plugins: - plugin_module: inginious.frontend.plugins.simple_grader courseid : "external" ...
[ "Init", "the", "external", "grader", "plugin", ".", "This", "simple", "grader", "allows", "only", "anonymous", "requests", "and", "submissions", "are", "not", "stored", "in", "database", "." ]
python
train
49.96
apache/airflow
airflow/contrib/hooks/gcp_vision_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L271-L294
def update_product( self, product, location=None, product_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_visi...
[ "def", "update_product", "(", "self", ",", "product", ",", "location", "=", "None", ",", "product_id", "=", "None", ",", "update_mask", "=", "None", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", ...
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductUpdateOperator`
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductUpdateOperator" ]
python
test
37.125
Mindwerks/worldengine
worldengine/basic_map_operations.py
https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/basic_map_operations.py#L10-L24
def index_of_nearest(p, hot_points, distance_f=distance): """Given a point and a set of hot points it found the hot point nearest to the given point. An arbitrary distance function can be specified :return the index of the nearest hot points, or None if the list of hot points is empty ""...
[ "def", "index_of_nearest", "(", "p", ",", "hot_points", ",", "distance_f", "=", "distance", ")", ":", "min_dist", "=", "None", "nearest_hp_i", "=", "None", "for", "i", ",", "hp", "in", "enumerate", "(", "hot_points", ")", ":", "dist", "=", "distance_f", ...
Given a point and a set of hot points it found the hot point nearest to the given point. An arbitrary distance function can be specified :return the index of the nearest hot points, or None if the list of hot points is empty
[ "Given", "a", "point", "and", "a", "set", "of", "hot", "points", "it", "found", "the", "hot", "point", "nearest", "to", "the", "given", "point", ".", "An", "arbitrary", "distance", "function", "can", "be", "specified", ":", "return", "the", "index", "of"...
python
train
36.866667
kislyuk/aegea
aegea/packages/github3/github.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/github.py#L896-L932
def markdown(self, text, mode='', context='', raw=False): """Render an arbitrary markdown document. :param str text: (required), the text of the document to render :param str mode: (optional), 'markdown' or 'gfm' :param str context: (optional), only important when using mode 'gfm', ...
[ "def", "markdown", "(", "self", ",", "text", ",", "mode", "=", "''", ",", "context", "=", "''", ",", "raw", "=", "False", ")", ":", "data", "=", "None", "json", "=", "False", "headers", "=", "{", "}", "if", "raw", ":", "url", "=", "self", ".", ...
Render an arbitrary markdown document. :param str text: (required), the text of the document to render :param str mode: (optional), 'markdown' or 'gfm' :param str context: (optional), only important when using mode 'gfm', this is the repository to use as the context for the renderin...
[ "Render", "an", "arbitrary", "markdown", "document", "." ]
python
train
32.459459
oanda/v20-python
src/v20/primitives.py
https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/primitives.py#L205-L230
def from_dict(data, ctx): """ Instantiate a new InstrumentCommission from a dict (generally from loading a JSON response). The data used to instantiate the InstrumentCommission is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. ...
[ "def", "from_dict", "(", "data", ",", "ctx", ")", ":", "data", "=", "data", ".", "copy", "(", ")", "if", "data", ".", "get", "(", "'commission'", ")", "is", "not", "None", ":", "data", "[", "'commission'", "]", "=", "ctx", ".", "convert_decimal_numbe...
Instantiate a new InstrumentCommission from a dict (generally from loading a JSON response). The data used to instantiate the InstrumentCommission is a shallow copy of the dict passed in, with any complex child types instantiated appropriately.
[ "Instantiate", "a", "new", "InstrumentCommission", "from", "a", "dict", "(", "generally", "from", "loading", "a", "JSON", "response", ")", ".", "The", "data", "used", "to", "instantiate", "the", "InstrumentCommission", "is", "a", "shallow", "copy", "of", "the"...
python
train
34
mozilla/python_moztelemetry
moztelemetry/parse_scalars.py
https://github.com/mozilla/python_moztelemetry/blob/09ddf1ec7d953a4308dfdcb0ed968f27bd5921bb/moztelemetry/parse_scalars.py#L79-L156
def validate_types(self, definition): """This function performs some basic sanity checks on the scalar definition: - Checks that all the required fields are available. - Checks that all the fields have the expected types. :param definition: the dictionary containing the scalar p...
[ "def", "validate_types", "(", "self", ",", "definition", ")", ":", "if", "not", "self", ".", "_strict_type_checks", ":", "return", "# The required and optional fields in a scalar type definition.", "REQUIRED_FIELDS", "=", "{", "'bug_numbers'", ":", "list", ",", "# This ...
This function performs some basic sanity checks on the scalar definition: - Checks that all the required fields are available. - Checks that all the fields have the expected types. :param definition: the dictionary containing the scalar properties. :raises ParserError: if a scal...
[ "This", "function", "performs", "some", "basic", "sanity", "checks", "on", "the", "scalar", "definition", ":", "-", "Checks", "that", "all", "the", "required", "fields", "are", "available", ".", "-", "Checks", "that", "all", "the", "fields", "have", "the", ...
python
train
48.24359
rsc-dev/pbd
pbd/__init__.py
https://github.com/rsc-dev/pbd/blob/16c2eed1e35df238a76a7a469c056ff9ea8ec2a2/pbd/__init__.py#L158-L174
def find_imports(self, pbds): """Find all missing imports in list of Pbd instances. """ # List of types used, but not defined imports = list(set(self.uses).difference(set(self.defines))) # Clumpsy, but enought for now for imp in imports: for p in pbd...
[ "def", "find_imports", "(", "self", ",", "pbds", ")", ":", "# List of types used, but not defined", "imports", "=", "list", "(", "set", "(", "self", ".", "uses", ")", ".", "difference", "(", "set", "(", "self", ".", "defines", ")", ")", ")", "# Clumpsy, bu...
Find all missing imports in list of Pbd instances.
[ "Find", "all", "missing", "imports", "in", "list", "of", "Pbd", "instances", "." ]
python
valid
34.823529
apache/airflow
airflow/plugins_manager.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/plugins_manager.py#L79-L98
def load_entrypoint_plugins(entry_points, airflow_plugins): """ Load AirflowPlugin subclasses from the entrypoints provided. The entry_point group should be 'airflow.plugins'. :param entry_points: A collection of entrypoints to search for plugins :type entry_points: Generator[setuptools.EntryPoint,...
[ "def", "load_entrypoint_plugins", "(", "entry_points", ",", "airflow_plugins", ")", ":", "for", "entry_point", "in", "entry_points", ":", "log", ".", "debug", "(", "'Importing entry_point plugin %s'", ",", "entry_point", ".", "name", ")", "plugin_obj", "=", "entry_p...
Load AirflowPlugin subclasses from the entrypoints provided. The entry_point group should be 'airflow.plugins'. :param entry_points: A collection of entrypoints to search for plugins :type entry_points: Generator[setuptools.EntryPoint, None, None] :param airflow_plugins: A collection of existing airflo...
[ "Load", "AirflowPlugin", "subclasses", "from", "the", "entrypoints", "provided", ".", "The", "entry_point", "group", "should", "be", "airflow", ".", "plugins", "." ]
python
test
47.45
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_fabric_service.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_fabric_service.py#L905-L919
def show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_fabric_trunk_info = ET.Element("show_fabric_trunk_info") config = show_fabric_trunk_i...
[ "def", "show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "show_fabric_trunk_info", "=", "ET", ".", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
59.266667
gem/oq-engine
openquake/baselib/parallel.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/parallel.py#L272-L291
def get_pickled_sizes(obj): """ Return the pickled sizes of an object and its direct attributes, ordered by decreasing size. Here is an example: >> total_size, partial_sizes = get_pickled_sizes(Monitor('')) >> total_size 345 >> partial_sizes [('_procs', 214), ('exc', 4), ('mem', 4), ('s...
[ "def", "get_pickled_sizes", "(", "obj", ")", ":", "sizes", "=", "[", "]", "attrs", "=", "getattr", "(", "obj", ",", "'__dict__'", ",", "{", "}", ")", "for", "name", ",", "value", "in", "attrs", ".", "items", "(", ")", ":", "sizes", ".", "append", ...
Return the pickled sizes of an object and its direct attributes, ordered by decreasing size. Here is an example: >> total_size, partial_sizes = get_pickled_sizes(Monitor('')) >> total_size 345 >> partial_sizes [('_procs', 214), ('exc', 4), ('mem', 4), ('start_time', 4), ('_start_time', 4), ...
[ "Return", "the", "pickled", "sizes", "of", "an", "object", "and", "its", "direct", "attributes", "ordered", "by", "decreasing", "size", ".", "Here", "is", "an", "example", ":" ]
python
train
33.9
jmurty/xml4h
xml4h/nodes.py
https://github.com/jmurty/xml4h/blob/adbb45e27a01a869a505aee7bc16bad2f517b511/xml4h/nodes.py#L857-L867
def attributes(self): """ Get or set this element's attributes as name/value pairs. .. note:: Setting element attributes via this accessor will **remove** any existing attributes, as opposed to the :meth:`set_attributes` method which only updates and replaces...
[ "def", "attributes", "(", "self", ")", ":", "attr_impl_nodes", "=", "self", ".", "adapter", ".", "get_node_attributes", "(", "self", ".", "impl_node", ")", "return", "AttributeDict", "(", "attr_impl_nodes", ",", "self", ".", "impl_node", ",", "self", ".", "a...
Get or set this element's attributes as name/value pairs. .. note:: Setting element attributes via this accessor will **remove** any existing attributes, as opposed to the :meth:`set_attributes` method which only updates and replaces them.
[ "Get", "or", "set", "this", "element", "s", "attributes", "as", "name", "/", "value", "pairs", "." ]
python
train
43.545455
jldantas/libmft
libmft/attribute.py
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/attribute.py#L2190-L2212
def _from_binary_acl(cls, binary_stream): """See base class.""" ''' Revision number - 1 Padding - 1 Size - 2 ACE Count - 2 Padding - 2 ''' rev_number, size, ace_len = cls._REPR.unpack(binary_stream[:cls._REPR.size]) #content = cls._REPR.unpack(binary_stream[:cls._REPR...
[ "def", "_from_binary_acl", "(", "cls", ",", "binary_stream", ")", ":", "''' Revision number - 1\n Padding - 1\n Size - 2\n ACE Count - 2\n Padding - 2\n '''", "rev_number", ",", "size", ",", "ace_len", "=", "cls", ".", "_REPR", ".", "unpack", "(...
See base class.
[ "See", "base", "class", "." ]
python
train
31.173913
hyperledger/indy-node
indy_node/server/upgrader.py
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/server/upgrader.py#L251-L334
def handleUpgradeTxn(self, txn) -> None: """ Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn: """ FINALIZING_EVENT_TYPES = [UpgradeLog.Events.succeeded, UpgradeLog.Events.failed] if ...
[ "def", "handleUpgradeTxn", "(", "self", ",", "txn", ")", "->", "None", ":", "FINALIZING_EVENT_TYPES", "=", "[", "UpgradeLog", ".", "Events", ".", "succeeded", ",", "UpgradeLog", ".", "Events", ".", "failed", "]", "if", "get_type", "(", "txn", ")", "!=", ...
Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn:
[ "Handles", "transaction", "of", "type", "POOL_UPGRADE", "Can", "schedule", "or", "cancel", "upgrade", "to", "a", "newer", "version", "at", "specified", "time" ]
python
train
38.452381
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/mwld.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/mwld.py#L38-L59
def generate(env): """Add Builders and construction variables for lib to an Environment.""" SCons.Tool.createStaticLibBuilder(env) SCons.Tool.createSharedLibBuilder(env) SCons.Tool.createProgBuilder(env) env['AR'] = 'mwld' env['ARCOM'] = '$AR $ARFLAGS -library -o $TARGET $SOURCES' env['LIB...
[ "def", "generate", "(", "env", ")", ":", "SCons", ".", "Tool", ".", "createStaticLibBuilder", "(", "env", ")", "SCons", ".", "Tool", ".", "createSharedLibBuilder", "(", "env", ")", "SCons", ".", "Tool", ".", "createProgBuilder", "(", "env", ")", "env", "...
Add Builders and construction variables for lib to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "lib", "to", "an", "Environment", "." ]
python
train
32.227273
saltstack/salt
salt/cloud/clouds/msazure.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2658-L2694
def show_storage_container_metadata(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Show a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_metadata my-azure name=myservice name: Name of container ...
[ "def", "show_storage_container_metadata", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_storage_container function must be called...
.. versionadded:: 2015.8.0 Show a storage container's metadata CLI Example: .. code-block:: bash salt-cloud -f show_storage_container_metadata my-azure name=myservice name: Name of container to show. lease_id: If specified, show_storage_container_metadata only succeeds i...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
python
train
27.540541
materialsproject/pymatgen-db
matgendb/creator.py
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/creator.py#L692-L708
def contains_vasp_input(dir_name): """ Checks if a directory contains valid VASP input. Args: dir_name: Directory name to check. Returns: True if directory contains all four VASP input files (INCAR, POSCAR, KPOINTS and POTCAR). """ for f in ["INCAR", "POSCAR...
[ "def", "contains_vasp_input", "(", "dir_name", ")", ":", "for", "f", "in", "[", "\"INCAR\"", ",", "\"POSCAR\"", ",", "\"POTCAR\"", ",", "\"KPOINTS\"", "]", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", ...
Checks if a directory contains valid VASP input. Args: dir_name: Directory name to check. Returns: True if directory contains all four VASP input files (INCAR, POSCAR, KPOINTS and POTCAR).
[ "Checks", "if", "a", "directory", "contains", "valid", "VASP", "input", "." ]
python
train
29.705882
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_genobstacles.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_genobstacles.py#L180-L189
def update(self, deltat=1.0): '''fly a square circuit''' DNFZ.update(self, deltat) self.dist_flown += self.speed * deltat if self.dist_flown > self.circuit_width: self.desired_heading = self.heading + 90 self.dist_flown = 0 if self.getalt() < self.ground_h...
[ "def", "update", "(", "self", ",", "deltat", "=", "1.0", ")", ":", "DNFZ", ".", "update", "(", "self", ",", "deltat", ")", "self", ".", "dist_flown", "+=", "self", ".", "speed", "*", "deltat", "if", "self", ".", "dist_flown", ">", "self", ".", "cir...
fly a square circuit
[ "fly", "a", "square", "circuit" ]
python
train
42
DsixTools/python-smeftrunner
smeftrunner/classes.py
https://github.com/DsixTools/python-smeftrunner/blob/4c9130e53ad4f7bbb526657a82150ca9d57c4b37/smeftrunner/classes.py#L23-L29
def set_initial(self, C_in, scale_in, scale_high): r"""Set the initial values for parameters and Wilson coefficients at the scale `scale_in`, setting the new physics scale $\Lambda$ to `scale_high`.""" self.C_in = C_in self.scale_in = scale_in self.scale_high = scale_high
[ "def", "set_initial", "(", "self", ",", "C_in", ",", "scale_in", ",", "scale_high", ")", ":", "self", ".", "C_in", "=", "C_in", "self", ".", "scale_in", "=", "scale_in", "self", ".", "scale_high", "=", "scale_high" ]
r"""Set the initial values for parameters and Wilson coefficients at the scale `scale_in`, setting the new physics scale $\Lambda$ to `scale_high`.
[ "r", "Set", "the", "initial", "values", "for", "parameters", "and", "Wilson", "coefficients", "at", "the", "scale", "scale_in", "setting", "the", "new", "physics", "scale", "$", "\\", "Lambda$", "to", "scale_high", "." ]
python
train
44.857143
python-tap/tappy
tap/parser.py
https://github.com/python-tap/tappy/blob/79a749313c61ea94ee49d67ba6a1534974bc03aa/tap/parser.py#L145-L154
def _parse_plan(self, match): """Parse a matching plan line.""" expected_tests = int(match.group("expected")) directive = Directive(match.group("directive")) # Only SKIP directives are allowed in the plan. if directive.text and not directive.skip: return Unknown() ...
[ "def", "_parse_plan", "(", "self", ",", "match", ")", ":", "expected_tests", "=", "int", "(", "match", ".", "group", "(", "\"expected\"", ")", ")", "directive", "=", "Directive", "(", "match", ".", "group", "(", "\"directive\"", ")", ")", "# Only SKIP dire...
Parse a matching plan line.
[ "Parse", "a", "matching", "plan", "line", "." ]
python
train
35.6