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
codeinn/vcs
vcs/utils/__init__.py
https://github.com/codeinn/vcs/blob/e6cd94188e9c36d273411bf3adc0584ac6ab92a0/vcs/utils/__init__.py#L51-L65
def safe_int(val, default=None): """ Returns int() of val if val is not convertable to int use default instead :param val: :param default: """ try: val = int(val) except (ValueError, TypeError): val = default return val
[ "def", "safe_int", "(", "val", ",", "default", "=", "None", ")", ":", "try", ":", "val", "=", "int", "(", "val", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "val", "=", "default", "return", "val" ]
Returns int() of val if val is not convertable to int use default instead :param val: :param default:
[ "Returns", "int", "()", "of", "val", "if", "val", "is", "not", "convertable", "to", "int", "use", "default", "instead" ]
python
train
17.333333
facelessuser/pyspelling
pyspelling/filters/xml.py
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/xml.py#L123-L127
def is_break_tag(self, el): """Check if tag is an element we should break on.""" name = el.name return name in self.break_tags or name in self.user_break_tags
[ "def", "is_break_tag", "(", "self", ",", "el", ")", ":", "name", "=", "el", ".", "name", "return", "name", "in", "self", ".", "break_tags", "or", "name", "in", "self", ".", "user_break_tags" ]
Check if tag is an element we should break on.
[ "Check", "if", "tag", "is", "an", "element", "we", "should", "break", "on", "." ]
python
train
35.8
jobovy/galpy
galpy/orbit/Orbit.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/Orbit.py#L1217-L1245
def resetaA(self,pot=None,type=None): """ NAME: resetaA PURPOSE: re-set up an actionAngle module for this Orbit INPUT: (none) OUTPUT: True if reset happened, False otherwise HISTORY: 2014-01-06 - Written - Bo...
[ "def", "resetaA", "(", "self", ",", "pot", "=", "None", ",", "type", "=", "None", ")", ":", "try", ":", "delattr", "(", "self", ".", "_orb", ",", "'_aA'", ")", "except", "AttributeError", ":", "return", "False", "else", ":", "return", "True" ]
NAME: resetaA PURPOSE: re-set up an actionAngle module for this Orbit INPUT: (none) OUTPUT: True if reset happened, False otherwise HISTORY: 2014-01-06 - Written - Bovy (IAS)
[ "NAME", ":" ]
python
train
15.758621
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L2648-L2668
def hrs_84_and_db12_8_or_20_6(self, value=None): """ Corresponds to IDD Field `hrs_84_and_db12_8_or_20_6` Number of hours between 8 AM and 4 PM (inclusive) with dry-bulb temperature between 12.8 and 20.6 C Args: value (float): value for IDD Field `hrs_84_and_db12_8_or_20_6` ...
[ "def", "hrs_84_and_db12_8_or_20_6", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to...
Corresponds to IDD Field `hrs_84_and_db12_8_or_20_6` Number of hours between 8 AM and 4 PM (inclusive) with dry-bulb temperature between 12.8 and 20.6 C Args: value (float): value for IDD Field `hrs_84_and_db12_8_or_20_6` if `value` is None it will not be checked against the...
[ "Corresponds", "to", "IDD", "Field", "hrs_84_and_db12_8_or_20_6", "Number", "of", "hours", "between", "8", "AM", "and", "4", "PM", "(", "inclusive", ")", "with", "dry", "-", "bulb", "temperature", "between", "12", ".", "8", "and", "20", ".", "6", "C" ]
python
train
40.190476
phoebe-project/phoebe2
phoebe/backend/universe.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L74-L86
def _value(obj): """ make sure to get a float """ # TODO: this is ugly and makes everything ugly # can we handle this with a clean decorator or just requiring that only floats be passed?? if hasattr(obj, 'value'): return obj.value elif isinstance(obj, np.ndarray): return np.a...
[ "def", "_value", "(", "obj", ")", ":", "# TODO: this is ugly and makes everything ugly", "# can we handle this with a clean decorator or just requiring that only floats be passed??", "if", "hasattr", "(", "obj", ",", "'value'", ")", ":", "return", "obj", ".", "value", "elif",...
make sure to get a float
[ "make", "sure", "to", "get", "a", "float" ]
python
train
32.769231
libtcod/python-tcod
tcod/image.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L231-L252
def blit_rect( self, console: tcod.console.Console, x: int, y: int, width: int, height: int, bg_blend: int, ) -> None: """Blit onto a Console without scaling or rotation. Args: console (Console): Blit destination Console. ...
[ "def", "blit_rect", "(", "self", ",", "console", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ",", "bg_blend", ":", "int", ",", ")", "->", "None", ...
Blit onto a Console without scaling or rotation. Args: console (Console): Blit destination Console. x (int): Console tile X position starting from the left at 0. y (int): Console tile Y position starting from the top at 0. width (int): Use -1 for Image width. ...
[ "Blit", "onto", "a", "Console", "without", "scaling", "or", "rotation", "." ]
python
train
33.090909
GiulioRossetti/DEMON
demon/alg/Demon.py
https://github.com/GiulioRossetti/DEMON/blob/b075716b3903e388562b4ac0ae93c2f1f71c9af8/demon/alg/Demon.py#L13-L30
def timeit(method): """ Decorator: Compute the execution time of a function :param method: the function :return: the method runtime """ def timed(*arguments, **kw): ts = time.time() result = method(*arguments, **kw) te = time.time() sys.stdout.write('Time: %r %...
[ "def", "timeit", "(", "method", ")", ":", "def", "timed", "(", "*", "arguments", ",", "*", "*", "kw", ")", ":", "ts", "=", "time", ".", "time", "(", ")", "result", "=", "method", "(", "*", "arguments", ",", "*", "*", "kw", ")", "te", "=", "ti...
Decorator: Compute the execution time of a function :param method: the function :return: the method runtime
[ "Decorator", ":", "Compute", "the", "execution", "time", "of", "a", "function", ":", "param", "method", ":", "the", "function", ":", "return", ":", "the", "method", "runtime" ]
python
train
27.166667
Archived-Object/ligament
ligament/helpers.py
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L142-L203
def indent_text(*strs, **kwargs): """ indents text according to an operater string and a global indentation level. returns a tuple of all passed args, indented according to the operator string indent: [defaults to +0] The operator string, of the form ++n : increment...
[ "def", "indent_text", "(", "*", "strs", ",", "*", "*", "kwargs", ")", ":", "# python 2.7 workaround", "indent", "=", "kwargs", "[", "\"indent\"", "]", "if", "\"indent\"", "in", "kwargs", "else", "\"+0\"", "autobreak", "=", "kwargs", ".", "get", "(", "\"aut...
indents text according to an operater string and a global indentation level. returns a tuple of all passed args, indented according to the operator string indent: [defaults to +0] The operator string, of the form ++n : increments the global indentation level by n and in...
[ "indents", "text", "according", "to", "an", "operater", "string", "and", "a", "global", "indentation", "level", ".", "returns", "a", "tuple", "of", "all", "passed", "args", "indented", "according", "to", "the", "operator", "string" ]
python
train
39.370968
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L592-L652
def splitLines0(frags, widths): """ given a list of ParaFrags we return a list of ParaLines each ParaLine has 1) ExtraSpace 2) blankCount 3) [textDefns....] each text definition is a (ParaFrag, start, limit) triplet """ #initialise the algorithm lineNum = 0 maxW = wi...
[ "def", "splitLines0", "(", "frags", ",", "widths", ")", ":", "#initialise the algorithm", "lineNum", "=", "0", "maxW", "=", "widths", "[", "lineNum", "]", "i", "=", "-", "1", "l", "=", "len", "(", "frags", ")", "lim", "=", "start", "=", "0", "text", ...
given a list of ParaFrags we return a list of ParaLines each ParaLine has 1) ExtraSpace 2) blankCount 3) [textDefns....] each text definition is a (ParaFrag, start, limit) triplet
[ "given", "a", "list", "of", "ParaFrags", "we", "return", "a", "list", "of", "ParaLines" ]
python
train
26.377049
SheffieldML/GPy
GPy/util/mocap.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/mocap.py#L93-L115
def swap_vertices(self, i, j): """ Swap two vertices in the tree structure array. swap_vertex swaps the location of two vertices in a tree structure array. :param tree: the tree for which two vertices are to be swapped. :param i: the index of the first vertex to be swapped. ...
[ "def", "swap_vertices", "(", "self", ",", "i", ",", "j", ")", ":", "store_vertex_i", "=", "self", ".", "vertices", "[", "i", "]", "store_vertex_j", "=", "self", ".", "vertices", "[", "j", "]", "self", ".", "vertices", "[", "j", "]", "=", "store_verte...
Swap two vertices in the tree structure array. swap_vertex swaps the location of two vertices in a tree structure array. :param tree: the tree for which two vertices are to be swapped. :param i: the index of the first vertex to be swapped. :param j: the index of the second vertex to be...
[ "Swap", "two", "vertices", "in", "the", "tree", "structure", "array", ".", "swap_vertex", "swaps", "the", "location", "of", "two", "vertices", "in", "a", "tree", "structure", "array", "." ]
python
train
44.130435
tkarabela/pysubs2
pysubs2/ssafile.py
https://github.com/tkarabela/pysubs2/blob/6439eb5159e6aa6b47e0f8e1d950e8bdd7c5341f/pysubs2/ssafile.py#L192-L204
def to_string(self, format_, fps=None, **kwargs): """ Get subtitle file as a string. See :meth:`SSAFile.save()` for full description. Returns: str """ fp = io.StringIO() self.to_file(fp, format_, fps=fps, **kwargs) return fp.getvalue()
[ "def", "to_string", "(", "self", ",", "format_", ",", "fps", "=", "None", ",", "*", "*", "kwargs", ")", ":", "fp", "=", "io", ".", "StringIO", "(", ")", "self", ".", "to_file", "(", "fp", ",", "format_", ",", "fps", "=", "fps", ",", "*", "*", ...
Get subtitle file as a string. See :meth:`SSAFile.save()` for full description. Returns: str
[ "Get", "subtitle", "file", "as", "a", "string", "." ]
python
train
23.230769
adafruit/Adafruit_Python_VCNL40xx
Adafruit_VCNL40xx/VCNL40xx.py
https://github.com/adafruit/Adafruit_Python_VCNL40xx/blob/f88ec755fd23017028b6dec1be0607ff4a018e10/Adafruit_VCNL40xx/VCNL40xx.py#L66-L82
def _wait_response(self, ready, timeout_sec): """Wait for a response to be ready (the provided ready bits are set). If the specified timeout (in seconds) is exceeded and error will be thrown. """ # Wait for the measurement to be ready (or a timeout elapses). start = time....
[ "def", "_wait_response", "(", "self", ",", "ready", ",", "timeout_sec", ")", ":", "# Wait for the measurement to be ready (or a timeout elapses).", "start", "=", "time", ".", "time", "(", ")", "while", "True", ":", "# Check if the timeout has elapsed.", "if", "(", "ti...
Wait for a response to be ready (the provided ready bits are set). If the specified timeout (in seconds) is exceeded and error will be thrown.
[ "Wait", "for", "a", "response", "to", "be", "ready", "(", "the", "provided", "ready", "bits", "are", "set", ")", ".", "If", "the", "specified", "timeout", "(", "in", "seconds", ")", "is", "exceeded", "and", "error", "will", "be", "thrown", "." ]
python
train
47.176471
goose3/goose3
goose3/extractors/videos.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/videos.py#L67-L78
def get_video(self, node): """ Create a video object from a video embed """ video = Video() video._embed_code = self.get_embed_code(node) video._embed_type = self.get_embed_type(node) video._width = self.get_width(node) video._height = self.get_height(node...
[ "def", "get_video", "(", "self", ",", "node", ")", ":", "video", "=", "Video", "(", ")", "video", ".", "_embed_code", "=", "self", ".", "get_embed_code", "(", "node", ")", "video", ".", "_embed_type", "=", "self", ".", "get_embed_type", "(", "node", ")...
Create a video object from a video embed
[ "Create", "a", "video", "object", "from", "a", "video", "embed" ]
python
valid
35.5
pantsbuild/pants
src/python/pants/option/parser.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/option/parser.py#L231-L265
def option_registrations_iter(self): """Returns an iterator over the normalized registration arguments of each option in this parser. Useful for generating help and other documentation. Each yielded item is an (args, kwargs) pair, as passed to register(), except that kwargs will be normalized in the f...
[ "def", "option_registrations_iter", "(", "self", ")", ":", "def", "normalize_kwargs", "(", "args", ",", "orig_kwargs", ")", ":", "nkwargs", "=", "copy", ".", "copy", "(", "orig_kwargs", ")", "dest", "=", "self", ".", "parse_dest", "(", "*", "args", ",", ...
Returns an iterator over the normalized registration arguments of each option in this parser. Useful for generating help and other documentation. Each yielded item is an (args, kwargs) pair, as passed to register(), except that kwargs will be normalized in the following ways: - It will always have '...
[ "Returns", "an", "iterator", "over", "the", "normalized", "registration", "arguments", "of", "each", "option", "in", "this", "parser", "." ]
python
train
48.542857
crate/crate-python
src/crate/client/http.py
https://github.com/crate/crate-python/blob/68e39c95f5bbe88b74bbfa26de4347fc644636a8/src/crate/client/http.py#L397-L440
def _request(self, method, path, server=None, **kwargs): """Execute a request to the cluster A server is selected from the server pool. """ while True: next_server = server or self._get_server() try: response = self.server_pool[next_server].reques...
[ "def", "_request", "(", "self", ",", "method", ",", "path", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "next_server", "=", "server", "or", "self", ".", "_get_server", "(", ")", "try", ":", "response", "=", ...
Execute a request to the cluster A server is selected from the server pool.
[ "Execute", "a", "request", "to", "the", "cluster" ]
python
train
48.840909
peri-source/peri
peri/util.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/util.py#L359-L373
def corners(self): """ Iterate the vector of all corners of the hyperrectangles >>> Tile(3, dim=2).corners array([[0, 0], [0, 3], [3, 0], [3, 3]]) """ corners = [] for ind in itertools.product(*((0,1),)*self.dim): ...
[ "def", "corners", "(", "self", ")", ":", "corners", "=", "[", "]", "for", "ind", "in", "itertools", ".", "product", "(", "*", "(", "(", "0", ",", "1", ")", ",", ")", "*", "self", ".", "dim", ")", ":", "ind", "=", "np", ".", "array", "(", "i...
Iterate the vector of all corners of the hyperrectangles >>> Tile(3, dim=2).corners array([[0, 0], [0, 3], [3, 0], [3, 3]])
[ "Iterate", "the", "vector", "of", "all", "corners", "of", "the", "hyperrectangles" ]
python
valid
27.6
log2timeline/plaso
plaso/parsers/android_app_usage.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/android_app_usage.py#L46-L100
def ParseFileObject(self, parser_mediator, file_object): """Parses an Android usage-history file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): file-like object. R...
[ "def", "ParseFileObject", "(", "self", ",", "parser_mediator", ",", "file_object", ")", ":", "data", "=", "file_object", ".", "read", "(", "self", ".", "_HEADER_READ_SIZE", ")", "if", "not", "data", ".", "startswith", "(", "b'<?xml'", ")", ":", "raise", "e...
Parses an Android usage-history file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): file-like object. Raises: UnableToParseFile: when the file cannot be parsed.
[ "Parses", "an", "Android", "usage", "-", "history", "file", "-", "like", "object", "." ]
python
train
36.690909
kislyuk/aegea
aegea/packages/github3/github.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/github.py#L410-L426
def iter_all_repos(self, number=-1, since=None, etag=None, per_page=None): """Iterate over every repository in the order they were created. :param int number: (optional), number of repositories to return. Default: -1, returns all of them :param int since: (optional), last repository...
[ "def", "iter_all_repos", "(", "self", ",", "number", "=", "-", "1", ",", "since", "=", "None", ",", "etag", "=", "None", ",", "per_page", "=", "None", ")", ":", "url", "=", "self", ".", "_build_url", "(", "'repositories'", ")", "return", "self", ".",...
Iterate over every repository in the order they were created. :param int number: (optional), number of repositories to return. Default: -1, returns all of them :param int since: (optional), last repository id seen (allows restarting this iteration) :param str etag: (opti...
[ "Iterate", "over", "every", "repository", "in", "the", "order", "they", "were", "created", "." ]
python
train
50.352941
autokey/autokey
lib/autokey/scripting.py
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/scripting.py#L1138-L1150
def get_folder(self, title): """ Retrieve a folder by its title Usage: C{engine.get_folder(title)} Note that if more than one folder has the same title, only the first match will be returned. """ for folder in self.configManager.allFolders: ...
[ "def", "get_folder", "(", "self", ",", "title", ")", ":", "for", "folder", "in", "self", ".", "configManager", ".", "allFolders", ":", "if", "folder", ".", "title", "==", "title", ":", "return", "folder", "return", "None" ]
Retrieve a folder by its title Usage: C{engine.get_folder(title)} Note that if more than one folder has the same title, only the first match will be returned.
[ "Retrieve", "a", "folder", "by", "its", "title", "Usage", ":", "C", "{", "engine", ".", "get_folder", "(", "title", ")", "}", "Note", "that", "if", "more", "than", "one", "folder", "has", "the", "same", "title", "only", "the", "first", "match", "will",...
python
train
30
twilio/twilio-python
twilio/rest/messaging/v1/service/alpha_sender.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/service/alpha_sender.py#L189-L198
def get_instance(self, payload): """ Build an instance of AlphaSenderInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "AlphaSenderInstance", "(", "self", ".", "_version", ",", "payload", ",", "service_sid", "=", "self", ".", "_solution", "[", "'service_sid'", "]", ",", ")" ]
Build an instance of AlphaSenderInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance
[ "Build", "an", "instance", "of", "AlphaSenderInstance" ]
python
train
42.7
SectorLabs/django-postgres-extra
psqlextra/backend/base.py
https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/backend/base.py#L97-L109
def alter_db_table(self, model, old_db_table, new_db_table): """Ran when the name of a model is changed.""" super(SchemaEditor, self).alter_db_table( model, old_db_table, new_db_table ) for mixin in self.post_processing_mixins: mixin.alter_db_table( ...
[ "def", "alter_db_table", "(", "self", ",", "model", ",", "old_db_table", ",", "new_db_table", ")", ":", "super", "(", "SchemaEditor", ",", "self", ")", ".", "alter_db_table", "(", "model", ",", "old_db_table", ",", "new_db_table", ")", "for", "mixin", "in", ...
Ran when the name of a model is changed.
[ "Ran", "when", "the", "name", "of", "a", "model", "is", "changed", "." ]
python
test
30.076923
fermiPy/fermipy
fermipy/diffuse/name_policy.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L152-L160
def irfs(self, **kwargs): """ Get the name of IFRs associted with a particular dataset """ dsval = kwargs.get('dataset', self.dataset(**kwargs)) tokens = dsval.split('_') irf_name = "%s_%s_%s" % (DATASET_DICTIONARY['%s_%s' % (tokens[0], tokens[1])], ...
[ "def", "irfs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "dsval", "=", "kwargs", ".", "get", "(", "'dataset'", ",", "self", ".", "dataset", "(", "*", "*", "kwargs", ")", ")", "tokens", "=", "dsval", ".", "split", "(", "'_'", ")", "irf_name"...
Get the name of IFRs associted with a particular dataset
[ "Get", "the", "name", "of", "IFRs", "associted", "with", "a", "particular", "dataset" ]
python
train
47.777778
inasafe/inasafe
safe/gui/tools/options_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/options_dialog.py#L858-L907
def default_field_to_parameter(self, default_field): """Obtain parameter from default field. :param default_field: A default field definition. :type default_field: dict :returns: A parameter object. :rtype: FloatParameter, IntegerParameter """ if default_field.g...
[ "def", "default_field_to_parameter", "(", "self", ",", "default_field", ")", ":", "if", "default_field", ".", "get", "(", "'type'", ")", "==", "QVariant", ".", "Double", ":", "parameter", "=", "FloatParameter", "(", ")", "elif", "default_field", ".", "get", ...
Obtain parameter from default field. :param default_field: A default field definition. :type default_field: dict :returns: A parameter object. :rtype: FloatParameter, IntegerParameter
[ "Obtain", "parameter", "from", "default", "field", "." ]
python
train
40.7
h2oai/h2o-3
h2o-py/h2o/utils/shared_utils.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/shared_utils.py#L220-L244
def _locate(path): """Search for a relative path and turn it into an absolute path. This is handy when hunting for data files to be passed into h2o and used by import file. Note: This function is for unit testing purposes only. Parameters ---------- path : str Path to search for :ret...
[ "def", "_locate", "(", "path", ")", ":", "tmp_dir", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "getcwd", "(", ")", ")", "possible_result", "=", "os", ".", "path", ".", "join", "(", "tmp_dir", ",", "path", ")", "while", "True", ":", ...
Search for a relative path and turn it into an absolute path. This is handy when hunting for data files to be passed into h2o and used by import file. Note: This function is for unit testing purposes only. Parameters ---------- path : str Path to search for :return: Absolute path if it i...
[ "Search", "for", "a", "relative", "path", "and", "turn", "it", "into", "an", "absolute", "path", ".", "This", "is", "handy", "when", "hunting", "for", "data", "files", "to", "be", "passed", "into", "h2o", "and", "used", "by", "import", "file", ".", "No...
python
test
30.88
tensorflow/tensorboard
tensorboard/notebook.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L292-L369
def _display_colab(port, height, display_handle): """Display a TensorBoard instance in a Colab output frame. The Colab VM is not directly exposed to the network, so the Colab runtime provides a service worker tunnel to proxy requests from the end user's browser through to servers running on the Colab VM: the ...
[ "def", "_display_colab", "(", "port", ",", "height", ",", "display_handle", ")", ":", "import", "IPython", ".", "display", "shell", "=", "\"\"\"\n <div id=\"root\"></div>\n <script>\n (function() {\n window.TENSORBOARD_ENV = window.TENSORBOARD_ENV || {};\n wi...
Display a TensorBoard instance in a Colab output frame. The Colab VM is not directly exposed to the network, so the Colab runtime provides a service worker tunnel to proxy requests from the end user's browser through to servers running on the Colab VM: the output frame may issue requests to https://localhost:<...
[ "Display", "a", "TensorBoard", "instance", "in", "a", "Colab", "output", "frame", "." ]
python
train
47.551282
DMSC-Instrument-Data/lewis
src/lewis/devices/julabo/devices/device.py
https://github.com/DMSC-Instrument-Data/lewis/blob/931d96b8c761550a6a58f6e61e202690db04233a/src/lewis/devices/julabo/devices/device.py#L84-L97
def set_circulating(self, param): """ Sets whether to circulate - in effect whether the heater is on. :param param: The mode to set, must be 0 or 1. :return: Empty string. """ if param == 0: self.is_circulating = param self.circulate_commanded = F...
[ "def", "set_circulating", "(", "self", ",", "param", ")", ":", "if", "param", "==", "0", ":", "self", ".", "is_circulating", "=", "param", "self", ".", "circulate_commanded", "=", "False", "elif", "param", "==", "1", ":", "self", ".", "is_circulating", "...
Sets whether to circulate - in effect whether the heater is on. :param param: The mode to set, must be 0 or 1. :return: Empty string.
[ "Sets", "whether", "to", "circulate", "-", "in", "effect", "whether", "the", "heater", "is", "on", "." ]
python
train
31.285714
googlefonts/glyphsLib
Lib/glyphsLib/builder/anchors.py
https://github.com/googlefonts/glyphsLib/blob/9c12dc70c8d13f08d92b824e6710f6e3bb5037bb/Lib/glyphsLib/builder/anchors.py#L37-L77
def _propagate_glyph_anchors(self, ufo, parent, processed): """Propagate anchors for a single parent glyph.""" if parent.name in processed: return processed.add(parent.name) base_components = [] mark_components = [] anchor_names = set() to_add = {} for component in parent.compo...
[ "def", "_propagate_glyph_anchors", "(", "self", ",", "ufo", ",", "parent", ",", "processed", ")", ":", "if", "parent", ".", "name", "in", "processed", ":", "return", "processed", ".", "add", "(", "parent", ".", "name", ")", "base_components", "=", "[", "...
Propagate anchors for a single parent glyph.
[ "Propagate", "anchors", "for", "a", "single", "parent", "glyph", "." ]
python
train
37.926829
aestrivex/bctpy
bct/algorithms/reference.py
https://github.com/aestrivex/bctpy/blob/4cb0e759eb4a038750b07e23bd29958c400684b8/bct/algorithms/reference.py#L753-L805
def makeringlatticeCIJ(n, k, seed=None): ''' This function generates a directed lattice network with toroidal boundary counditions (i.e. with ring-like "wrapping around"). Parameters ---------- N : int number of vertices K : int number of edges seed : hashable, optional ...
[ "def", "makeringlatticeCIJ", "(", "n", ",", "k", ",", "seed", "=", "None", ")", ":", "rng", "=", "get_rng", "(", "seed", ")", "# initialize", "CIJ", "=", "np", ".", "zeros", "(", "(", "n", ",", "n", ")", ")", "CIJ1", "=", "np", ".", "ones", "("...
This function generates a directed lattice network with toroidal boundary counditions (i.e. with ring-like "wrapping around"). Parameters ---------- N : int number of vertices K : int number of edges seed : hashable, optional If None (default), use the np.random's global...
[ "This", "function", "generates", "a", "directed", "lattice", "network", "with", "toroidal", "boundary", "counditions", "(", "i", ".", "e", ".", "with", "ring", "-", "like", "wrapping", "around", ")", "." ]
python
train
27.716981
nandilugio/pepython
pepython/task_def.py
https://github.com/nandilugio/pepython/blob/c991b571b66fac7918499e292212f598b5c7b758/pepython/task_def.py#L28-L87
def s(command, verbose=False, fail_fast=True, interactive=False): """ Run a shell command. """ completed_process = None output = None if interactive: completed_process = subprocess.run( command, shell=True, stdin=sys.stdin, stdout=sys.stdo...
[ "def", "s", "(", "command", ",", "verbose", "=", "False", ",", "fail_fast", "=", "True", ",", "interactive", "=", "False", ")", ":", "completed_process", "=", "None", "output", "=", "None", "if", "interactive", ":", "completed_process", "=", "subprocess", ...
Run a shell command.
[ "Run", "a", "shell", "command", "." ]
python
train
25.45
csurfer/gitsuggest
gitsuggest/suggest.py
https://github.com/csurfer/gitsuggest/blob/02efdbf50acb094e502aef9c139dde62676455ee/gitsuggest/suggest.py#L74-L87
def get_unique_repositories(repo_list): """Method to create unique list of repositories from the list of repositories given. :param repo_list: List of repositories which might contain duplicates. :return: List of repositories with no duplicate in them. """ unique_list = ...
[ "def", "get_unique_repositories", "(", "repo_list", ")", ":", "unique_list", "=", "list", "(", ")", "included", "=", "defaultdict", "(", "lambda", ":", "False", ")", "for", "repo", "in", "repo_list", ":", "if", "not", "included", "[", "repo", ".", "full_na...
Method to create unique list of repositories from the list of repositories given. :param repo_list: List of repositories which might contain duplicates. :return: List of repositories with no duplicate in them.
[ "Method", "to", "create", "unique", "list", "of", "repositories", "from", "the", "list", "of", "repositories", "given", "." ]
python
train
39.357143
geophysics-ubonn/crtomo_tools
lib/crtomo/plotManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/plotManager.py#L63-L152
def plot_nodes_pcolor_to_ax(self, ax, nid, **kwargs): """Plot node data to an axes object Parameters ---------- ax : axes object axes to plot to nid : int node id pointing to the respective data set cmap : string, optional color map to...
[ "def", "plot_nodes_pcolor_to_ax", "(", "self", ",", "ax", ",", "nid", ",", "*", "*", "kwargs", ")", ":", "fig", "=", "ax", ".", "get_figure", "(", ")", "x", "=", "self", ".", "grid", ".", "nodes", "[", "'presort'", "]", "[", ":", ",", "1", "]", ...
Plot node data to an axes object Parameters ---------- ax : axes object axes to plot to nid : int node id pointing to the respective data set cmap : string, optional color map to use. Default: jet vmin : float, optional Min...
[ "Plot", "node", "data", "to", "an", "axes", "object" ]
python
train
29.622222
carpedm20/fbchat
fbchat/_client.py
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L2124-L2143
def setTypingStatus(self, status, thread_id=None, thread_type=None): """ Sets users typing status in a thread :param status: Specify the typing status :param thread_id: User/Group ID to change status in. See :ref:`intro_threads` :param thread_type: See :ref:`intro_threads` ...
[ "def", "setTypingStatus", "(", "self", ",", "status", ",", "thread_id", "=", "None", ",", "thread_type", "=", "None", ")", ":", "thread_id", ",", "thread_type", "=", "self", ".", "_getThread", "(", "thread_id", ",", "thread_type", ")", "data", "=", "{", ...
Sets users typing status in a thread :param status: Specify the typing status :param thread_id: User/Group ID to change status in. See :ref:`intro_threads` :param thread_type: See :ref:`intro_threads` :type status: models.TypingStatus :type thread_type: models.ThreadType ...
[ "Sets", "users", "typing", "status", "in", "a", "thread" ]
python
train
40.15
bokeh/bokeh
bokeh/client/session.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L377-L408
def push(self, document=None): ''' Push the given document to the server and record it as session.document. If this is called more than once, the Document has to be the same (or None to mean "session.document"). .. note:: Automatically calls :func:`~connect` before pushing....
[ "def", "push", "(", "self", ",", "document", "=", "None", ")", ":", "if", "self", ".", "document", "is", "None", ":", "if", "document", "is", "None", ":", "doc", "=", "Document", "(", ")", "else", ":", "doc", "=", "document", "else", ":", "if", "...
Push the given document to the server and record it as session.document. If this is called more than once, the Document has to be the same (or None to mean "session.document"). .. note:: Automatically calls :func:`~connect` before pushing. Args: document (:clas...
[ "Push", "the", "given", "document", "to", "the", "server", "and", "record", "it", "as", "session", ".", "document", "." ]
python
train
37.90625
readbeyond/aeneas
aeneas/validator.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/validator.py#L482-L491
def _failed(self, msg): """ Log a validation failure. :param string msg: the error message """ self.log(msg) self.result.passed = False self.result.add_error(msg) self.log(u"Failed")
[ "def", "_failed", "(", "self", ",", "msg", ")", ":", "self", ".", "log", "(", "msg", ")", "self", ".", "result", ".", "passed", "=", "False", "self", ".", "result", ".", "add_error", "(", "msg", ")", "self", ".", "log", "(", "u\"Failed\"", ")" ]
Log a validation failure. :param string msg: the error message
[ "Log", "a", "validation", "failure", "." ]
python
train
23.8
johntruckenbrodt/spatialist
spatialist/envi.py
https://github.com/johntruckenbrodt/spatialist/blob/007f49296a156de8d7168ad235b5a5b8e8d3633d/spatialist/envi.py#L128-L137
def write(self, filename='same'): """ write object to an ENVI header file """ if filename == 'same': filename = self.filename if not filename.endswith('.hdr'): filename += '.hdr' with open(filename, 'w') as out: out.write(self.__str__()...
[ "def", "write", "(", "self", ",", "filename", "=", "'same'", ")", ":", "if", "filename", "==", "'same'", ":", "filename", "=", "self", ".", "filename", "if", "not", "filename", ".", "endswith", "(", "'.hdr'", ")", ":", "filename", "+=", "'.hdr'", "with...
write object to an ENVI header file
[ "write", "object", "to", "an", "ENVI", "header", "file" ]
python
train
31.2
kwikteam/phy
phy/cluster/views/trace.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/views/trace.py#L307-L333
def attach(self, gui): """Attach the view to the GUI.""" super(TraceView, self).attach(gui) self.actions.add(self.go_to, alias='tg') self.actions.separator() self.actions.add(self.shift, alias='ts') self.actions.add(self.go_right) self.actions.add(self.go_left) ...
[ "def", "attach", "(", "self", ",", "gui", ")", ":", "super", "(", "TraceView", ",", "self", ")", ".", "attach", "(", "gui", ")", "self", ".", "actions", ".", "add", "(", "self", ".", "go_to", ",", "alias", "=", "'tg'", ")", "self", ".", "actions"...
Attach the view to the GUI.
[ "Attach", "the", "view", "to", "the", "GUI", "." ]
python
train
38.555556
saltstack/salt
salt/pillar/ec2_pillar.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/ec2_pillar.py#L108-L254
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 use_grain=False, minion_ids=None, tag_match_key=None, tag_match_value='asis', tag_list_key=None, tag_list_sep=';'): ''' Execute a command and read t...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "use_grain", "=", "False", ",", "minion_ids", "=", "None", ",", "tag_match_key", "=", "None", ",", "tag_match_value", "=", "'asis'", ",", "tag_list_key", "=", "None", ",", "t...
Execute a command and read the output as YAML
[ "Execute", "a", "command", "and", "read", "the", "output", "as", "YAML" ]
python
train
43.204082
Josef-Friedrich/phrydy
phrydy/utils.py
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/utils.py#L61-L92
def syspath(path, prefix=True): """Convert a path for use by the operating system. In particular, paths on Windows must receive a magic prefix and must be converted to Unicode before they are sent to the OS. To disable the magic prefix on Windows, set `prefix` to False---but only do this if you *rea...
[ "def", "syspath", "(", "path", ",", "prefix", "=", "True", ")", ":", "# Don't do anything if we're not on windows", "if", "os", ".", "path", ".", "__name__", "!=", "'ntpath'", ":", "return", "path", "if", "not", "isinstance", "(", "path", ",", "six", ".", ...
Convert a path for use by the operating system. In particular, paths on Windows must receive a magic prefix and must be converted to Unicode before they are sent to the OS. To disable the magic prefix on Windows, set `prefix` to False---but only do this if you *really* know what you're doing.
[ "Convert", "a", "path", "for", "use", "by", "the", "operating", "system", ".", "In", "particular", "paths", "on", "Windows", "must", "receive", "a", "magic", "prefix", "and", "must", "be", "converted", "to", "Unicode", "before", "they", "are", "sent", "to"...
python
train
43.1875
J535D165/recordlinkage
recordlinkage/base.py
https://github.com/J535D165/recordlinkage/blob/87a5f4af904e0834047cd07ff1c70146b1e6d693/recordlinkage/base.py#L1075-L1103
def _return_result(self, result, comparison_vectors=None): """Return different formatted classification results. """ return_type = cf.get_option('classification.return_type') if type(result) != np.ndarray: raise ValueError("numpy.ndarray expected.") # return the pa...
[ "def", "_return_result", "(", "self", ",", "result", ",", "comparison_vectors", "=", "None", ")", ":", "return_type", "=", "cf", ".", "get_option", "(", "'classification.return_type'", ")", "if", "type", "(", "result", ")", "!=", "np", ".", "ndarray", ":", ...
Return different formatted classification results.
[ "Return", "different", "formatted", "classification", "results", "." ]
python
train
31.586207
holtjma/msbwt
MUS/MSBWTGen.py
https://github.com/holtjma/msbwt/blob/7503346ec072ddb89520db86fef85569a9ba093a/MUS/MSBWTGen.py#L1169-L1203
def decompressBWT(inputDir, outputDir, numProcs, logger): ''' This is called for taking a BWT and decompressing it back out to it's original form. While unusual to do, it's included in this package for completion purposes. @param inputDir - the directory of the compressed BWT we plan on decompressing ...
[ "def", "decompressBWT", "(", "inputDir", ",", "outputDir", ",", "numProcs", ",", "logger", ")", ":", "#load it, force it to be a compressed bwt also", "msbwt", "=", "MultiStringBWT", ".", "CompressedMSBWT", "(", ")", "msbwt", ".", "loadMsbwt", "(", "inputDir", ",", ...
This is called for taking a BWT and decompressing it back out to it's original form. While unusual to do, it's included in this package for completion purposes. @param inputDir - the directory of the compressed BWT we plan on decompressing @param outputFN - the directory for the output decompressed BWT, it...
[ "This", "is", "called", "for", "taking", "a", "BWT", "and", "decompressing", "it", "back", "out", "to", "it", "s", "original", "form", ".", "While", "unusual", "to", "do", "it", "s", "included", "in", "this", "package", "for", "completion", "purposes", "...
python
train
41.457143
KE-works/pykechain
pykechain/models/service.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L117-L126
def delete(self): # type: () -> None """Delete this service. :raises APIError: if delete was not succesfull. """ response = self._client._request('DELETE', self._client._build_url('service', service_id=self.id)) if response.status_code != requests.codes.no_content: # p...
[ "def", "delete", "(", "self", ")", ":", "# type: () -> None", "response", "=", "self", ".", "_client", ".", "_request", "(", "'DELETE'", ",", "self", ".", "_client", ".", "_build_url", "(", "'service'", ",", "service_id", "=", "self", ".", "id", ")", ")"...
Delete this service. :raises APIError: if delete was not succesfull.
[ "Delete", "this", "service", "." ]
python
train
42.3
jantman/awslimitchecker
awslimitchecker/services/ebs.py
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ebs.py#L155-L168
def get_limits(self): """ Return all known limits for this service, as a dict of their names to :py:class:`~.AwsLimit` objects. :returns: dict of limit names to :py:class:`~.AwsLimit` objects :rtype: dict """ if self.limits != {}: return self.limits ...
[ "def", "get_limits", "(", "self", ")", ":", "if", "self", ".", "limits", "!=", "{", "}", ":", "return", "self", ".", "limits", "limits", "=", "{", "}", "limits", ".", "update", "(", "self", ".", "_get_limits_ebs", "(", ")", ")", "self", ".", "limit...
Return all known limits for this service, as a dict of their names to :py:class:`~.AwsLimit` objects. :returns: dict of limit names to :py:class:`~.AwsLimit` objects :rtype: dict
[ "Return", "all", "known", "limits", "for", "this", "service", "as", "a", "dict", "of", "their", "names", "to", ":", "py", ":", "class", ":", "~", ".", "AwsLimit", "objects", "." ]
python
train
30.142857
tensorflow/lucid
lucid/misc/io/loading.py
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/loading.py#L47-L78
def _load_img(handle, target_dtype=np.float32, size=None, **kwargs): """Load image file as numpy array.""" image_pil = PIL.Image.open(handle, **kwargs) # resize the image to the requested size, if one was specified if size is not None: if len(size) > 2: size = size[:2] ...
[ "def", "_load_img", "(", "handle", ",", "target_dtype", "=", "np", ".", "float32", ",", "size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "image_pil", "=", "PIL", ".", "Image", ".", "open", "(", "handle", ",", "*", "*", "kwargs", ")", "# resi...
Load image file as numpy array.
[ "Load", "image", "file", "as", "numpy", "array", "." ]
python
train
38.375
Karaage-Cluster/karaage
karaage/people/managers.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/people/managers.py#L58-L66
def create_superuser( self, username, email, short_name, full_name, institute, password, **extra_fields): """ Creates a new person with super powers. """ return self._create_user( username=username, email=email, institute=institute, password=password, ...
[ "def", "create_superuser", "(", "self", ",", "username", ",", "email", ",", "short_name", ",", "full_name", ",", "institute", ",", "password", ",", "*", "*", "extra_fields", ")", ":", "return", "self", ".", "_create_user", "(", "username", "=", "username", ...
Creates a new person with super powers.
[ "Creates", "a", "new", "person", "with", "super", "powers", "." ]
python
train
45.111111
ajenhl/tacl
tacl/lifetime_report.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/lifetime_report.py#L136-L154
def _save_results(self, output_dir, label, results, ngrams, type_label): """Saves `results` filtered by `label` and `ngram` to `output_dir`. :param output_dir: directory to save results to :type output_dir: `str` :param label: catalogue label of results, used in saved filename :...
[ "def", "_save_results", "(", "self", ",", "output_dir", ",", "label", ",", "results", ",", "ngrams", ",", "type_label", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "'{}-{}.csv'", ".", "format", "(", "label", ",", "typ...
Saves `results` filtered by `label` and `ngram` to `output_dir`. :param output_dir: directory to save results to :type output_dir: `str` :param label: catalogue label of results, used in saved filename :type label: `str` :param results: results to filter and save :type r...
[ "Saves", "results", "filtered", "by", "label", "and", "ngram", "to", "output_dir", "." ]
python
train
45.789474
stevearc/dynamo3
dynamo3/connection.py
https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/connection.py#L354-L376
def describe_table(self, tablename): """ Get the details about a table Parameters ---------- tablename : str Name of the table Returns ------- table : :class:`~dynamo3.fields.Table` """ try: response = self.call( ...
[ "def", "describe_table", "(", "self", ",", "tablename", ")", ":", "try", ":", "response", "=", "self", ".", "call", "(", "'describe_table'", ",", "TableName", "=", "tablename", ")", "[", "'Table'", "]", "return", "Table", ".", "from_response", "(", "respon...
Get the details about a table Parameters ---------- tablename : str Name of the table Returns ------- table : :class:`~dynamo3.fields.Table`
[ "Get", "the", "details", "about", "a", "table" ]
python
train
25.956522
saltstack/salt
salt/fileserver/hgfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L132-L139
def _get_bookmark(repo, name): ''' Find the requested bookmark in the specified repo ''' try: return [x for x in _all_bookmarks(repo) if x[0] == name][0] except IndexError: return False
[ "def", "_get_bookmark", "(", "repo", ",", "name", ")", ":", "try", ":", "return", "[", "x", "for", "x", "in", "_all_bookmarks", "(", "repo", ")", "if", "x", "[", "0", "]", "==", "name", "]", "[", "0", "]", "except", "IndexError", ":", "return", "...
Find the requested bookmark in the specified repo
[ "Find", "the", "requested", "bookmark", "in", "the", "specified", "repo" ]
python
train
26.75
saltstack/salt
salt/modules/data.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L61-L86
def dump(new_data): ''' Replace the entire datastore with a passed data structure CLI Example: .. code-block:: bash salt '*' data.dump '{'eggs': 'spam'}' ''' if not isinstance(new_data, dict): if isinstance(ast.literal_eval(new_data), dict): new_data = ast.literal_...
[ "def", "dump", "(", "new_data", ")", ":", "if", "not", "isinstance", "(", "new_data", ",", "dict", ")", ":", "if", "isinstance", "(", "ast", ".", "literal_eval", "(", "new_data", ")", ",", "dict", ")", ":", "new_data", "=", "ast", ".", "literal_eval", ...
Replace the entire datastore with a passed data structure CLI Example: .. code-block:: bash salt '*' data.dump '{'eggs': 'spam'}'
[ "Replace", "the", "entire", "datastore", "with", "a", "passed", "data", "structure" ]
python
train
25.884615
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L2137-L2140
def getTypedValueNoExceptions(self, row): '''Returns the properly-typed value for the given row at this column. Returns the type's default value if either the getter or the type conversion fails.''' return wrapply(self.type, wrapply(self.getValue, row))
[ "def", "getTypedValueNoExceptions", "(", "self", ",", "row", ")", ":", "return", "wrapply", "(", "self", ".", "type", ",", "wrapply", "(", "self", ".", "getValue", ",", "row", ")", ")" ]
Returns the properly-typed value for the given row at this column. Returns the type's default value if either the getter or the type conversion fails.
[ "Returns", "the", "properly", "-", "typed", "value", "for", "the", "given", "row", "at", "this", "column", ".", "Returns", "the", "type", "s", "default", "value", "if", "either", "the", "getter", "or", "the", "type", "conversion", "fails", "." ]
python
train
69.25
cltrudeau/wrench
wrench/logtools/utils.py
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/utils.py#L96-L108
def silence_logging(method): """Disables logging for the duration of what is being wrapped. This is particularly useful when testing if a test method is supposed to issue an error message which is confusing that the error shows for a successful test. """ @wraps(method) def wrapper(*args, **...
[ "def", "silence_logging", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "disable", "(", "logging", ".", "ERROR", ")", "result", "=", "method", "(", ...
Disables logging for the duration of what is being wrapped. This is particularly useful when testing if a test method is supposed to issue an error message which is confusing that the error shows for a successful test.
[ "Disables", "logging", "for", "the", "duration", "of", "what", "is", "being", "wrapped", ".", "This", "is", "particularly", "useful", "when", "testing", "if", "a", "test", "method", "is", "supposed", "to", "issue", "an", "error", "message", "which", "is", ...
python
train
36.692308
google/grr
grr/server/grr_response_server/rdfvalues/objects.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/rdfvalues/objects.py#L511-L523
def ParseCategorizedPath(path): """Parses a categorized path string into type and list of components.""" components = tuple(component for component in path.split("/") if component) if components[0:2] == ("fs", "os"): return PathInfo.PathType.OS, components[2:] elif components[0:2] == ("fs", "tsk"): retu...
[ "def", "ParseCategorizedPath", "(", "path", ")", ":", "components", "=", "tuple", "(", "component", "for", "component", "in", "path", ".", "split", "(", "\"/\"", ")", "if", "component", ")", "if", "components", "[", "0", ":", "2", "]", "==", "(", "\"fs...
Parses a categorized path string into type and list of components.
[ "Parses", "a", "categorized", "path", "string", "into", "type", "and", "list", "of", "components", "." ]
python
train
45.384615
fermiPy/fermipy
fermipy/stats_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L53-L78
def lgauss(x, mu, sigma=1.0, logpdf=False): """ Log10 normal distribution... x : Parameter of interest for scanning the pdf mu : Peak of the lognormal distribution (mean of the underlying normal distribution is log10(mu) sigma : Standard deviation of the underlying normal distributio...
[ "def", "lgauss", "(", "x", ",", "mu", ",", "sigma", "=", "1.0", ",", "logpdf", "=", "False", ")", ":", "x", "=", "np", ".", "array", "(", "x", ",", "ndmin", "=", "1", ")", "lmu", "=", "np", ".", "log10", "(", "mu", ")", "s2", "=", "sigma", ...
Log10 normal distribution... x : Parameter of interest for scanning the pdf mu : Peak of the lognormal distribution (mean of the underlying normal distribution is log10(mu) sigma : Standard deviation of the underlying normal distribution
[ "Log10", "normal", "distribution", "..." ]
python
train
24.384615
KrzyHonk/bpmn-python
bpmn_python/bpmn_diagram_export.py
https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_export.py#L310-L355
def export_node_data(bpmn_diagram, process_id, params, process): """ Creates a new XML element (depends on node type) for given node parameters and adds it to 'process' element. :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram, :param process_id...
[ "def", "export_node_data", "(", "bpmn_diagram", ",", "process_id", ",", "params", ",", "process", ")", ":", "node_type", "=", "params", "[", "consts", ".", "Consts", ".", "type", "]", "output_element", "=", "eTree", ".", "SubElement", "(", "process", ",", ...
Creates a new XML element (depends on node type) for given node parameters and adds it to 'process' element. :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram, :param process_id: string representing ID of given flow node, :param params: dictionary with n...
[ "Creates", "a", "new", "XML", "element", "(", "depends", "on", "node", "type", ")", "for", "given", "node", "parameters", "and", "adds", "it", "to", "process", "element", "." ]
python
train
65.23913
mgedmin/findimports
findimports.py
https://github.com/mgedmin/findimports/blob/c20a50b497390fed15aa3835476f4fad57313e8a/findimports.py#L483-L511
def findModuleOfName(self, dotted_name, level, filename, extrapath=None): """Given a fully qualified name, find what module contains it.""" if dotted_name.endswith('.*'): return dotted_name[:-2] name = dotted_name # extrapath is None only in a couple of test cases; in real l...
[ "def", "findModuleOfName", "(", "self", ",", "dotted_name", ",", "level", ",", "filename", ",", "extrapath", "=", "None", ")", ":", "if", "dotted_name", ".", "endswith", "(", "'.*'", ")", ":", "return", "dotted_name", "[", ":", "-", "2", "]", "name", "...
Given a fully qualified name, find what module contains it.
[ "Given", "a", "fully", "qualified", "name", "find", "what", "module", "contains", "it", "." ]
python
train
46.034483
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L2763-L2788
def fetch_object(self, container, obj, include_meta=False, chunk_size=None, size=None, extra_info=None): """ Fetches the object from storage. If 'include_meta' is False, only the bytes representing the stored object are returned. Note: if 'chunk_size' is defined, yo...
[ "def", "fetch_object", "(", "self", ",", "container", ",", "obj", ",", "include_meta", "=", "False", ",", "chunk_size", "=", "None", ",", "size", "=", "None", ",", "extra_info", "=", "None", ")", ":", "return", "self", ".", "_manager", ".", "fetch_object...
Fetches the object from storage. If 'include_meta' is False, only the bytes representing the stored object are returned. Note: if 'chunk_size' is defined, you must fully read the object's contents before making another request. If 'size' is specified, only the first 'size' byt...
[ "Fetches", "the", "object", "from", "storage", "." ]
python
train
44.269231
CivicSpleen/ambry
ambry/orm/partition.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L78-L94
def time_description(self): """String description of the year or year range""" tc = [t for t in self._p.time_coverage if t] if not tc: return '' mn = min(tc) mx = max(tc) if not mn and not mx: return '' elif mn == mx: return...
[ "def", "time_description", "(", "self", ")", ":", "tc", "=", "[", "t", "for", "t", "in", "self", ".", "_p", ".", "time_coverage", "if", "t", "]", "if", "not", "tc", ":", "return", "''", "mn", "=", "min", "(", "tc", ")", "mx", "=", "max", "(", ...
String description of the year or year range
[ "String", "description", "of", "the", "year", "or", "year", "range" ]
python
train
21.529412
openstack/monasca-common
monasca_common/expression_parser/alarm_expr_parser.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/expression_parser/alarm_expr_parser.py#L55-L74
def fmtd_sub_expr_str(self): """Get the entire sub expressions as a string with spaces.""" result = u"{}({}".format(self.normalized_func, self._metric_name) if self._dimensions is not None: result += "{" + self.dimensions_str + "}" if self._...
[ "def", "fmtd_sub_expr_str", "(", "self", ")", ":", "result", "=", "u\"{}({}\"", ".", "format", "(", "self", ".", "normalized_func", ",", "self", ".", "_metric_name", ")", "if", "self", ".", "_dimensions", "is", "not", "None", ":", "result", "+=", "\"{\"", ...
Get the entire sub expressions as a string with spaces.
[ "Get", "the", "entire", "sub", "expressions", "as", "a", "string", "with", "spaces", "." ]
python
train
31.4
numenta/nupic
src/nupic/algorithms/backtracking_tm.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L2384-L2439
def _learnPhase2(self, readOnly=False): """ Compute the predicted segments given the current set of active cells. :param readOnly True if being called from backtracking logic. This tells us not to increment any segment duty cycles or queue up any up...
[ "def", "_learnPhase2", "(", "self", ",", "readOnly", "=", "False", ")", ":", "# Clear out predicted state to start with", "self", ".", "lrnPredictedState", "[", "'t'", "]", ".", "fill", "(", "0", ")", "# Compute new predicted state. When computing predictions for", "# p...
Compute the predicted segments given the current set of active cells. :param readOnly True if being called from backtracking logic. This tells us not to increment any segment duty cycles or queue up any updates. This computes the lrnPredictedState['t']...
[ "Compute", "the", "predicted", "segments", "given", "the", "current", "set", "of", "active", "cells", "." ]
python
valid
40.178571
Erotemic/utool
utool/util_iter.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_iter.py#L552-L616
def random_combinations(items, size, num=None, rng=None): """ Yields `num` combinations of length `size` from items in random order Args: items (?): size (?): num (None): (default = None) rng (RandomState): random number generator(default = None) Yields: tuple:...
[ "def", "random_combinations", "(", "items", ",", "size", ",", "num", "=", "None", ",", "rng", "=", "None", ")", ":", "import", "scipy", ".", "misc", "import", "numpy", "as", "np", "import", "utool", "as", "ut", "rng", "=", "ut", ".", "ensure_rng", "(...
Yields `num` combinations of length `size` from items in random order Args: items (?): size (?): num (None): (default = None) rng (RandomState): random number generator(default = None) Yields: tuple: combo CommandLine: python -m utool.util_iter random_comb...
[ "Yields", "num", "combinations", "of", "length", "size", "from", "items", "in", "random", "order" ]
python
train
32.584615
Chilipp/sphinx-nbexamples
sphinx_nbexamples/__init__.py
https://github.com/Chilipp/sphinx-nbexamples/blob/08e0319ff3c70f8a931dfa8890caf48add4d0470/sphinx_nbexamples/__init__.py#L88-L97
def nbviewer_link(url): """Return the link to the Jupyter nbviewer for the given notebook url""" if six.PY2: from urlparse import urlparse as urlsplit else: from urllib.parse import urlsplit info = urlsplit(url) domain = info.netloc url_type = 'github' if domain == 'github.com' e...
[ "def", "nbviewer_link", "(", "url", ")", ":", "if", "six", ".", "PY2", ":", "from", "urlparse", "import", "urlparse", "as", "urlsplit", "else", ":", "from", "urllib", ".", "parse", "import", "urlsplit", "info", "=", "urlsplit", "(", "url", ")", "domain",...
Return the link to the Jupyter nbviewer for the given notebook url
[ "Return", "the", "link", "to", "the", "Jupyter", "nbviewer", "for", "the", "given", "notebook", "url" ]
python
test
39.1
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L2134-L2141
def IsIconic(handle: int) -> bool: """ IsIconic from Win32. Determine whether a native window is minimized. handle: int, the handle of a native window. Return bool. """ return bool(ctypes.windll.user32.IsIconic(ctypes.c_void_p(handle)))
[ "def", "IsIconic", "(", "handle", ":", "int", ")", "->", "bool", ":", "return", "bool", "(", "ctypes", ".", "windll", ".", "user32", ".", "IsIconic", "(", "ctypes", ".", "c_void_p", "(", "handle", ")", ")", ")" ]
IsIconic from Win32. Determine whether a native window is minimized. handle: int, the handle of a native window. Return bool.
[ "IsIconic", "from", "Win32", ".", "Determine", "whether", "a", "native", "window", "is", "minimized", ".", "handle", ":", "int", "the", "handle", "of", "a", "native", "window", ".", "Return", "bool", "." ]
python
valid
32.125
quasipedia/swaggery
swaggery/appinit.py
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/appinit.py#L10-L26
def init(): '''Initialise a WSGI application to be loaded by uWSGI.''' # Load values from config file config_file = os.path.realpath(os.path.join(os.getcwd(), 'swaggery.ini')) config = configparser.RawConfigParser(allow_no_value=True) config.read(config_file) log_level = config.get('application'...
[ "def", "init", "(", ")", ":", "# Load values from config file", "config_file", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "'swaggery.ini'", ")", ")", "config", "=", "configparser...
Initialise a WSGI application to be loaded by uWSGI.
[ "Initialise", "a", "WSGI", "application", "to", "be", "loaded", "by", "uWSGI", "." ]
python
train
45.882353
radjkarl/imgProcessor
imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/uncertainty/simulateUncertDependencyOnExpTime.py#L116-L131
def _capture(f, t, t0, factor): ''' capture signal and return its standard deviation #TODO: more detail ''' n_per_sec = len(t) / t[-1] # len of one split: n = int(t0 * factor * n_per_sec) s = len(f) // n m = s * n f = f[:m] ff = np.split(f, s) m = np.mean(ff...
[ "def", "_capture", "(", "f", ",", "t", ",", "t0", ",", "factor", ")", ":", "n_per_sec", "=", "len", "(", "t", ")", "/", "t", "[", "-", "1", "]", "# len of one split:\r", "n", "=", "int", "(", "t0", "*", "factor", "*", "n_per_sec", ")", "s", "="...
capture signal and return its standard deviation #TODO: more detail
[ "capture", "signal", "and", "return", "its", "standard", "deviation", "#TODO", ":", "more", "detail" ]
python
train
21.125
UncleRus/regnupg
regnupg.py
https://github.com/UncleRus/regnupg/blob/c1acb5d459107c70e45967ec554831a5f2cd1aaf/regnupg.py#L862-L875
def gen_key_input(self, key_params={}): ''' Generate --gen-key input per gpg doc/DETAILS. :param key_params: Key parameters :rtype: str :return: Control input for :func:`regnupg.gen_key` ''' params = self.default_key_params.copy() params.update(key_params...
[ "def", "gen_key_input", "(", "self", ",", "key_params", "=", "{", "}", ")", ":", "params", "=", "self", ".", "default_key_params", ".", "copy", "(", ")", "params", ".", "update", "(", "key_params", ")", "result", "=", "[", "'Key-Type: %s'", "%", "params"...
Generate --gen-key input per gpg doc/DETAILS. :param key_params: Key parameters :rtype: str :return: Control input for :func:`regnupg.gen_key`
[ "Generate", "--", "gen", "-", "key", "input", "per", "gpg", "doc", "/", "DETAILS", "." ]
python
train
36.857143
Parsl/parsl
parsl/executors/ipp_controller.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/ipp_controller.py#L111-L121
def engine_file(self): """Specify path to the ipcontroller-engine.json file. This file is stored in in the ipython_dir/profile folders. Returns : - str, File path to engine file """ return os.path.join(self.ipython_dir, 'profile_{0}'.fo...
[ "def", "engine_file", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "ipython_dir", ",", "'profile_{0}'", ".", "format", "(", "self", ".", "profile", ")", ",", "'security/ipcontroller-engine.json'", ")" ]
Specify path to the ipcontroller-engine.json file. This file is stored in in the ipython_dir/profile folders. Returns : - str, File path to engine file
[ "Specify", "path", "to", "the", "ipcontroller", "-", "engine", ".", "json", "file", "." ]
python
valid
35.818182
pyhys/minimalmodbus
minimalmodbus.py
https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L299-L325
def read_long(self, registeraddress, functioncode=3, signed=False): """Read a long integer (32 bits) from the slave. Long integers (32 bits = 4 bytes) are stored in two consecutive 16-bit registers in the slave. Args: * registeraddress (int): The slave register start address (use d...
[ "def", "read_long", "(", "self", ",", "registeraddress", ",", "functioncode", "=", "3", ",", "signed", "=", "False", ")", ":", "_checkFunctioncode", "(", "functioncode", ",", "[", "3", ",", "4", "]", ")", "_checkBool", "(", "signed", ",", "description", ...
Read a long integer (32 bits) from the slave. Long integers (32 bits = 4 bytes) are stored in two consecutive 16-bit registers in the slave. Args: * registeraddress (int): The slave register start address (use decimal numbers, not hex). * functioncode (int): Modbus function cod...
[ "Read", "a", "long", "integer", "(", "32", "bits", ")", "from", "the", "slave", "." ]
python
train
48.814815
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L51-L67
def license_from_trove(trove): """Finds out license from list of trove classifiers. Args: trove: list of trove classifiers Returns: Fedora name of the package license or empty string, if no licensing information is found in trove classifiers. """ license = [] for classifi...
[ "def", "license_from_trove", "(", "trove", ")", ":", "license", "=", "[", "]", "for", "classifier", "in", "trove", ":", "if", "'License'", "in", "classifier", ":", "stripped", "=", "classifier", ".", "strip", "(", ")", "# if taken from EGG-INFO, begins with Clas...
Finds out license from list of trove classifiers. Args: trove: list of trove classifiers Returns: Fedora name of the package license or empty string, if no licensing information is found in trove classifiers.
[ "Finds", "out", "license", "from", "list", "of", "trove", "classifiers", ".", "Args", ":", "trove", ":", "list", "of", "trove", "classifiers", "Returns", ":", "Fedora", "name", "of", "the", "package", "license", "or", "empty", "string", "if", "no", "licens...
python
train
39.176471
project-rig/rig
rig/bitfield.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/bitfield.py#L396-L417
def get_tags(self, field): """Get the set of tags for a given field. .. note:: The named field must be accessible given the current set of values defined. Parameters ---------- field : str The field whose tag should be read. Returns ...
[ "def", "get_tags", "(", "self", ",", "field", ")", ":", "return", "self", ".", "fields", ".", "get_field", "(", "field", ",", "self", ".", "field_values", ")", ".", "tags", ".", "copy", "(", ")" ]
Get the set of tags for a given field. .. note:: The named field must be accessible given the current set of values defined. Parameters ---------- field : str The field whose tag should be read. Returns ------- set([tag, ...]...
[ "Get", "the", "set", "of", "tags", "for", "a", "given", "field", "." ]
python
train
24.863636
chaoss/grimoirelab-perceval
perceval/backends/core/git.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L345-L377
def setup_cmd_parser(cls): """Returns the Git argument parser.""" parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES, from_date=True, to_date=True) # Optional arguments group = parser....
[ "def", "setup_cmd_parser", "(", "cls", ")", ":", "parser", "=", "BackendCommandArgumentParser", "(", "cls", ".", "BACKEND", ".", "CATEGORIES", ",", "from_date", "=", "True", ",", "to_date", "=", "True", ")", "# Optional arguments", "group", "=", "parser", ".",...
Returns the Git argument parser.
[ "Returns", "the", "Git", "argument", "parser", "." ]
python
test
46.818182
pydata/xarray
xarray/core/utils.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L538-L548
def decode_numpy_dict_values(attrs: Mapping[K, V]) -> Dict[K, V]: """Convert attribute values from numpy objects to native Python objects, for use in to_dict """ attrs = dict(attrs) for k, v in attrs.items(): if isinstance(v, np.ndarray): attrs[k] = v.tolist() elif isinst...
[ "def", "decode_numpy_dict_values", "(", "attrs", ":", "Mapping", "[", "K", ",", "V", "]", ")", "->", "Dict", "[", "K", ",", "V", "]", ":", "attrs", "=", "dict", "(", "attrs", ")", "for", "k", ",", "v", "in", "attrs", ".", "items", "(", ")", ":"...
Convert attribute values from numpy objects to native Python objects, for use in to_dict
[ "Convert", "attribute", "values", "from", "numpy", "objects", "to", "native", "Python", "objects", "for", "use", "in", "to_dict" ]
python
train
34.454545
cebel/pyuniprot
src/pyuniprot/manager/database.py
https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/database.py#L488-L500
def get_alternative_short_names(cls, entry): """ get list of models.AlternativeShortName objects from XML node entry :param entry: XML node entry :return: list of :class:`pyuniprot.manager.models.AlternativeShortName` objects """ names = [] query = "./protein/alt...
[ "def", "get_alternative_short_names", "(", "cls", ",", "entry", ")", ":", "names", "=", "[", "]", "query", "=", "\"./protein/alternativeName/shortName\"", "for", "name", "in", "entry", ".", "iterfind", "(", "query", ")", ":", "names", ".", "append", "(", "mo...
get list of models.AlternativeShortName objects from XML node entry :param entry: XML node entry :return: list of :class:`pyuniprot.manager.models.AlternativeShortName` objects
[ "get", "list", "of", "models", ".", "AlternativeShortName", "objects", "from", "XML", "node", "entry" ]
python
train
35.846154
numenta/nupic
src/nupic/frameworks/viz/network_visualization.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/frameworks/viz/network_visualization.py#L53-L78
def export(self): """ Exports a network as a networkx MultiDiGraph intermediate representation suitable for visualization. :return: networkx MultiDiGraph """ graph = nx.MultiDiGraph() # Add regions to graph as nodes, annotated by name regions = self.network.getRegions() for idx in...
[ "def", "export", "(", "self", ")", ":", "graph", "=", "nx", ".", "MultiDiGraph", "(", ")", "# Add regions to graph as nodes, annotated by name", "regions", "=", "self", ".", "network", ".", "getRegions", "(", ")", "for", "idx", "in", "xrange", "(", "regions", ...
Exports a network as a networkx MultiDiGraph intermediate representation suitable for visualization. :return: networkx MultiDiGraph
[ "Exports", "a", "network", "as", "a", "networkx", "MultiDiGraph", "intermediate", "representation", "suitable", "for", "visualization", "." ]
python
valid
31.038462
spotify/snakebite
snakebite/client.py
https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/client.py#L220-L243
def chown(self, paths, owner, recurse=False): ''' Change the owner for paths. The owner can be specified as `user` or `user:group` :param paths: List of paths to chmod :type paths: list :param owner: New owner :type owner: string :param recurse: Recursive chown :...
[ "def", "chown", "(", "self", ",", "paths", ",", "owner", ",", "recurse", "=", "False", ")", ":", "if", "not", "isinstance", "(", "paths", ",", "list", ")", ":", "raise", "InvalidInputException", "(", "\"Paths should be a list\"", ")", "if", "not", "paths",...
Change the owner for paths. The owner can be specified as `user` or `user:group` :param paths: List of paths to chmod :type paths: list :param owner: New owner :type owner: string :param recurse: Recursive chown :type recurse: boolean :returns: a generator that y...
[ "Change", "the", "owner", "for", "paths", ".", "The", "owner", "can", "be", "specified", "as", "user", "or", "user", ":", "group" ]
python
train
42.041667
the01/paps-settings
app/restAPI.py
https://github.com/the01/paps-settings/blob/48fb65eb0fa7929a0bb381c6dad28d0197b44c83/app/restAPI.py#L33-L51
def save_resource(plugin_name, resource_name, resource_data): """ Save a resource in local cache :param plugin_name: Name of plugin this resource belongs to :type plugin_name: str :param resource_name: Name of resource :type resource_name: str :param resource_data: Resource content - base64...
[ "def", "save_resource", "(", "plugin_name", ",", "resource_name", ",", "resource_data", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "resource_dir_path", ",", "plugin_name", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ...
Save a resource in local cache :param plugin_name: Name of plugin this resource belongs to :type plugin_name: str :param resource_name: Name of resource :type resource_name: str :param resource_data: Resource content - base64 encoded :type resource_data: str :rtype: None
[ "Save", "a", "resource", "in", "local", "cache" ]
python
train
34.105263
ioos/cc-plugin-ncei
cc_plugin_ncei/util.py
https://github.com/ioos/cc-plugin-ncei/blob/963fefd7fa43afd32657ac4c36aad4ddb4c25acf/cc_plugin_ncei/util.py#L27-L44
def get_sea_names(): ''' Returns a list of NODC sea names source of list: http://www.nodc.noaa.gov/General/NODC-Archive/seanames.xml ''' global _SEA_NAMES if _SEA_NAMES is None: resource_text = get_data("cc_plugin_ncei", "data/seanames.xml") parser = etree.XMLParser(remove_blank...
[ "def", "get_sea_names", "(", ")", ":", "global", "_SEA_NAMES", "if", "_SEA_NAMES", "is", "None", ":", "resource_text", "=", "get_data", "(", "\"cc_plugin_ncei\"", ",", "\"data/seanames.xml\"", ")", "parser", "=", "etree", ".", "XMLParser", "(", "remove_blank_text"...
Returns a list of NODC sea names source of list: http://www.nodc.noaa.gov/General/NODC-Archive/seanames.xml
[ "Returns", "a", "list", "of", "NODC", "sea", "names" ]
python
train
35.166667
alvations/lazyme
lazyme/iterate.py
https://github.com/alvations/lazyme/blob/961a8282198588ff72e15643f725ce895e51d06d/lazyme/iterate.py#L63-L88
def skipping_window(sequence, target, n=3): """ Return a sliding window with a constraint to check that target is inside the window. From http://stackoverflow.com/q/43626525/610569 >>> list(skipping_window([1,2,3,4,5], 2, 3)) [(1, 2, 3), (2, 3, 4)] """ start, stop = 0, n seq...
[ "def", "skipping_window", "(", "sequence", ",", "target", ",", "n", "=", "3", ")", ":", "start", ",", "stop", "=", "0", ",", "n", "seq", "=", "list", "(", "sequence", ")", "while", "stop", "<=", "len", "(", "seq", ")", ":", "subseq", "=", "seq", ...
Return a sliding window with a constraint to check that target is inside the window. From http://stackoverflow.com/q/43626525/610569 >>> list(skipping_window([1,2,3,4,5], 2, 3)) [(1, 2, 3), (2, 3, 4)]
[ "Return", "a", "sliding", "window", "with", "a", "constraint", "to", "check", "that", "target", "is", "inside", "the", "window", ".", "From", "http", ":", "//", "stackoverflow", ".", "com", "/", "q", "/", "43626525", "/", "610569" ]
python
train
32.461538
Microsoft/nni
src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py#L408-L442
def _request_one_trial_job(self): """get one trial job, i.e., one hyperparameter configuration. If this function is called, Command will be sent by BOHB: a. If there is a parameter need to run, will return "NewTrialJob" with a dict: { 'parameter_id': id of new hyperparamete...
[ "def", "_request_one_trial_job", "(", "self", ")", ":", "if", "not", "self", ".", "generated_hyper_configs", ":", "ret", "=", "{", "'parameter_id'", ":", "'-1_0_0'", ",", "'parameter_source'", ":", "'algorithm'", ",", "'parameters'", ":", "''", "}", "send", "(...
get one trial job, i.e., one hyperparameter configuration. If this function is called, Command will be sent by BOHB: a. If there is a parameter need to run, will return "NewTrialJob" with a dict: { 'parameter_id': id of new hyperparameter 'parameter_source': 'algorithm'...
[ "get", "one", "trial", "job", "i", ".", "e", ".", "one", "hyperparameter", "configuration", "." ]
python
train
36.885714
honmaple/flask-maple
flask_maple/captcha.py
https://github.com/honmaple/flask-maple/blob/8124de55e5e531a5cb43477944168f98608dc08f/flask_maple/captcha.py#L94-L102
def create_lines(self, draw, n_line, width, height): '''绘制干扰线''' line_num = randint(n_line[0], n_line[1]) # 干扰线条数 for i in range(line_num): # 起始点 begin = (randint(0, width), randint(0, height)) # 结束点 end = (randint(0, width), randint(0, height)) ...
[ "def", "create_lines", "(", "self", ",", "draw", ",", "n_line", ",", "width", ",", "height", ")", ":", "line_num", "=", "randint", "(", "n_line", "[", "0", "]", ",", "n_line", "[", "1", "]", ")", "# 干扰线条数", "for", "i", "in", "range", "(", "line_num...
绘制干扰线
[ "绘制干扰线" ]
python
train
40.222222
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/config/loader.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/loader.py#L437-L447
def _decode_argv(self, argv, enc=None): """decode argv if bytes, using stin.encoding, falling back on default enc""" uargv = [] if enc is None: enc = DEFAULT_ENCODING for arg in argv: if not isinstance(arg, unicode): # only decode if not already de...
[ "def", "_decode_argv", "(", "self", ",", "argv", ",", "enc", "=", "None", ")", ":", "uargv", "=", "[", "]", "if", "enc", "is", "None", ":", "enc", "=", "DEFAULT_ENCODING", "for", "arg", "in", "argv", ":", "if", "not", "isinstance", "(", "arg", ",",...
decode argv if bytes, using stin.encoding, falling back on default enc
[ "decode", "argv", "if", "bytes", "using", "stin", ".", "encoding", "falling", "back", "on", "default", "enc" ]
python
test
36.727273
trehn/termdown
termdown.py
https://github.com/trehn/termdown/blob/aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2/termdown.py#L144-L154
def graceful_ctrlc(func): """ Makes the decorated function exit with code 1 on CTRL+C. """ @wraps(func) def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except KeyboardInterrupt: exit(1) return wrapper
[ "def", "graceful_ctrlc", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Keyboa...
Makes the decorated function exit with code 1 on CTRL+C.
[ "Makes", "the", "decorated", "function", "exit", "with", "code", "1", "on", "CTRL", "+", "C", "." ]
python
train
24.545455
pymc-devs/pymc
pymc/PyMCObjects.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/PyMCObjects.py#L940-L949
def logp_gradient_contribution(self, calculation_set=None): """ Calculates the gradient of the joint log posterior with respect to self. Calculation of the log posterior is restricted to the variables in calculation_set. """ # NEED some sort of check to see if the log p calculati...
[ "def", "logp_gradient_contribution", "(", "self", ",", "calculation_set", "=", "None", ")", ":", "# NEED some sort of check to see if the log p calculation has recently", "# failed, in which case not to continue", "return", "self", ".", "logp_partial_gradient", "(", "self", ",", ...
Calculates the gradient of the joint log posterior with respect to self. Calculation of the log posterior is restricted to the variables in calculation_set.
[ "Calculates", "the", "gradient", "of", "the", "joint", "log", "posterior", "with", "respect", "to", "self", ".", "Calculation", "of", "the", "log", "posterior", "is", "restricted", "to", "the", "variables", "in", "calculation_set", "." ]
python
train
54.9
CSchoel/nolds
nolds/measures.py
https://github.com/CSchoel/nolds/blob/8a5ecc472d67ac08b571bd68967287668ca9058e/nolds/measures.py#L345-L370
def lyap_e_len(**kwargs): """ Helper function that calculates the minimum number of data points required to use lyap_e. Note that none of the required parameters may be set to None. Kwargs: kwargs(dict): arguments used for lyap_e (required: emb_dim, matrix_dim, min_nb and min_tsep) Return...
[ "def", "lyap_e_len", "(", "*", "*", "kwargs", ")", ":", "m", "=", "(", "kwargs", "[", "'emb_dim'", "]", "-", "1", ")", "//", "(", "kwargs", "[", "'matrix_dim'", "]", "-", "1", ")", "# minimum length required to find single orbit vector", "min_len", "=", "k...
Helper function that calculates the minimum number of data points required to use lyap_e. Note that none of the required parameters may be set to None. Kwargs: kwargs(dict): arguments used for lyap_e (required: emb_dim, matrix_dim, min_nb and min_tsep) Returns: minimum number of data poin...
[ "Helper", "function", "that", "calculates", "the", "minimum", "number", "of", "data", "points", "required", "to", "use", "lyap_e", "." ]
python
train
32.423077
openclimatedata/pymagicc
pymagicc/core.py
https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L105-L148
def create_copy(self): """ Initialises a temporary directory structure and copy of MAGICC configuration files and binary. """ if self.executable is None or not isfile(self.executable): raise FileNotFoundError( "Could not find MAGICC{} executable: {}".f...
[ "def", "create_copy", "(", "self", ")", ":", "if", "self", ".", "executable", "is", "None", "or", "not", "isfile", "(", "self", ".", "executable", ")", ":", "raise", "FileNotFoundError", "(", "\"Could not find MAGICC{} executable: {}\"", ".", "format", "(", "s...
Initialises a temporary directory structure and copy of MAGICC configuration files and binary.
[ "Initialises", "a", "temporary", "directory", "structure", "and", "copy", "of", "MAGICC", "configuration", "files", "and", "binary", "." ]
python
train
39.840909
SBRG/ssbio
ssbio/protein/sequence/utils/alignment.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L326-L352
def get_alignment_df_from_file(alignment_file, a_seq_id=None, b_seq_id=None): """Get a Pandas DataFrame of the Needle alignment results. Contains all positions of the sequences. Args: alignment_file: a_seq_id: Optional specification of the ID of the reference sequence b_seq_id: Optional...
[ "def", "get_alignment_df_from_file", "(", "alignment_file", ",", "a_seq_id", "=", "None", ",", "b_seq_id", "=", "None", ")", ":", "alignments", "=", "list", "(", "AlignIO", ".", "parse", "(", "alignment_file", ",", "\"emboss\"", ")", ")", "alignment_df", "=", ...
Get a Pandas DataFrame of the Needle alignment results. Contains all positions of the sequences. Args: alignment_file: a_seq_id: Optional specification of the ID of the reference sequence b_seq_id: Optional specification of the ID of the aligned sequence Returns: Pandas DataFra...
[ "Get", "a", "Pandas", "DataFrame", "of", "the", "Needle", "alignment", "results", ".", "Contains", "all", "positions", "of", "the", "sequences", "." ]
python
train
37.740741
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L1466-L1485
def conics(elts, et): """ Determine the state (position, velocity) of an orbiting body from a set of elliptic, hyperbolic, or parabolic orbital elements. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/conics_c.html :param elts: Conic elements. :type elts: 8-Element Array of floats...
[ "def", "conics", "(", "elts", ",", "et", ")", ":", "elts", "=", "stypes", ".", "toDoubleVector", "(", "elts", ")", "et", "=", "ctypes", ".", "c_double", "(", "et", ")", "state", "=", "stypes", ".", "emptyDoubleVector", "(", "6", ")", "libspice", ".",...
Determine the state (position, velocity) of an orbiting body from a set of elliptic, hyperbolic, or parabolic orbital elements. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/conics_c.html :param elts: Conic elements. :type elts: 8-Element Array of floats :param et: Input time. :t...
[ "Determine", "the", "state", "(", "position", "velocity", ")", "of", "an", "orbiting", "body", "from", "a", "set", "of", "elliptic", "hyperbolic", "or", "parabolic", "orbital", "elements", "." ]
python
train
31.25
mdsol/rwslib
rwslib/extras/local_cv.py
https://github.com/mdsol/rwslib/blob/1a86bc072d408c009ed1de8bf6e98a1769f54d18/rwslib/extras/local_cv.py#L111-L119
def _processDDL(self): """Generate and process table SQL, SQLLite version""" sql_statements = self._generateDDL() logging.info('Generating sqllite tables') for stmt in sql_statements: c = self.conn.cursor() c.execute(stmt) self.conn.commit()
[ "def", "_processDDL", "(", "self", ")", ":", "sql_statements", "=", "self", ".", "_generateDDL", "(", ")", "logging", ".", "info", "(", "'Generating sqllite tables'", ")", "for", "stmt", "in", "sql_statements", ":", "c", "=", "self", ".", "conn", ".", "cur...
Generate and process table SQL, SQLLite version
[ "Generate", "and", "process", "table", "SQL", "SQLLite", "version" ]
python
train
33.555556
GibbsConsulting/django-plotly-dash
django_plotly_dash/dash_wrapper.py
https://github.com/GibbsConsulting/django-plotly-dash/blob/773ed081fc2ea3cc7607590322a14686a7a79bc5/django_plotly_dash/dash_wrapper.py#L407-L412
def layout(self, value): 'Overloaded layout function to fix component names as needed' if self._adjust_id: self._fix_component_id(value) return Dash.layout.fset(self, value)
[ "def", "layout", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_adjust_id", ":", "self", ".", "_fix_component_id", "(", "value", ")", "return", "Dash", ".", "layout", ".", "fset", "(", "self", ",", "value", ")" ]
Overloaded layout function to fix component names as needed
[ "Overloaded", "layout", "function", "to", "fix", "component", "names", "as", "needed" ]
python
train
34.166667
kellerza/pyqwikswitch
pyqwikswitch/qwikswitch.py
https://github.com/kellerza/pyqwikswitch/blob/9d4f080048221eaee93e3eefcf641919ff1af586/pyqwikswitch/qwikswitch.py#L211-L216
def decode_door(packet, channel=1): """Decode a door sensor.""" val = str(packet.get(QSDATA, '')) if len(val) == 6 and val.startswith('46') and channel == 1: return val[-1] == '0' return None
[ "def", "decode_door", "(", "packet", ",", "channel", "=", "1", ")", ":", "val", "=", "str", "(", "packet", ".", "get", "(", "QSDATA", ",", "''", ")", ")", "if", "len", "(", "val", ")", "==", "6", "and", "val", ".", "startswith", "(", "'46'", ")...
Decode a door sensor.
[ "Decode", "a", "door", "sensor", "." ]
python
train
35
bloomreach/s4cmd
s4cmd.py
https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1042-L1055
def size(self, source): '''Get the size component of the given s3url. If it is a directory, combine the sizes of all the files under that directory. Subdirectories will not be counted unless --recursive option is set. ''' result = [] for src in self.source_expand(source): size...
[ "def", "size", "(", "self", ",", "source", ")", ":", "result", "=", "[", "]", "for", "src", "in", "self", ".", "source_expand", "(", "source", ")", ":", "size", "=", "0", "for", "f", "in", "self", ".", "s3walk", "(", "src", ")", ":", "size", "+...
Get the size component of the given s3url. If it is a directory, combine the sizes of all the files under that directory. Subdirectories will not be counted unless --recursive option is set.
[ "Get", "the", "size", "component", "of", "the", "given", "s3url", ".", "If", "it", "is", "a", "directory", "combine", "the", "sizes", "of", "all", "the", "files", "under", "that", "directory", ".", "Subdirectories", "will", "not", "be", "counted", "unless"...
python
test
30.142857
umap-project/umap
umap/decorators.py
https://github.com/umap-project/umap/blob/0b2f9b5c12fcf67e24b7a674e01a7b7efd3ba607/umap/decorators.py#L27-L43
def map_permissions_check(view_func): """ Used for URLs dealing with the map. """ @wraps(view_func) def wrapper(request, *args, **kwargs): map_inst = get_object_or_404(Map, pk=kwargs['map_id']) user = request.user kwargs['map_inst'] = map_inst # Avoid rerequesting the map in...
[ "def", "map_permissions_check", "(", "view_func", ")", ":", "@", "wraps", "(", "view_func", ")", "def", "wrapper", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "map_inst", "=", "get_object_or_404", "(", "Map", ",", "pk", "=", "k...
Used for URLs dealing with the map.
[ "Used", "for", "URLs", "dealing", "with", "the", "map", "." ]
python
train
42.647059
apache/incubator-mxnet
python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L291-L294
def _prelu(attrs, inputs, proto_obj): """PRelu function""" new_attrs = translation_utils._add_extra_attributes(attrs, {'act_type': 'prelu'}) return 'LeakyReLU', new_attrs, inputs
[ "def", "_prelu", "(", "attrs", ",", "inputs", ",", "proto_obj", ")", ":", "new_attrs", "=", "translation_utils", ".", "_add_extra_attributes", "(", "attrs", ",", "{", "'act_type'", ":", "'prelu'", "}", ")", "return", "'LeakyReLU'", ",", "new_attrs", ",", "in...
PRelu function
[ "PRelu", "function" ]
python
train
46.75
PmagPy/PmagPy
programs/demag_gui.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L6155-L6164
def update_warning_box(self): """ updates the warning box with whatever the warning_text variable contains for this specimen """ self.warning_box.Clear() if self.warning_text == "": self.warning_box.AppendText("No Problems") else: self.warn...
[ "def", "update_warning_box", "(", "self", ")", ":", "self", ".", "warning_box", ".", "Clear", "(", ")", "if", "self", ".", "warning_text", "==", "\"\"", ":", "self", ".", "warning_box", ".", "AppendText", "(", "\"No Problems\"", ")", "else", ":", "self", ...
updates the warning box with whatever the warning_text variable contains for this specimen
[ "updates", "the", "warning", "box", "with", "whatever", "the", "warning_text", "variable", "contains", "for", "this", "specimen" ]
python
train
34.8
frictionlessdata/datapackage-py
datapackage/package.py
https://github.com/frictionlessdata/datapackage-py/blob/aca085ea54541b087140b58a81332f8728baeeb2/datapackage/package.py#L172-L181
def remove_resource(self, name): """https://github.com/frictionlessdata/datapackage-py#package """ resource = self.get_resource(name) if resource: predicat = lambda resource: resource.get('name') != name self.__current_descriptor['resources'] = list(filter( ...
[ "def", "remove_resource", "(", "self", ",", "name", ")", ":", "resource", "=", "self", ".", "get_resource", "(", "name", ")", "if", "resource", ":", "predicat", "=", "lambda", "resource", ":", "resource", ".", "get", "(", "'name'", ")", "!=", "name", "...
https://github.com/frictionlessdata/datapackage-py#package
[ "https", ":", "//", "github", ".", "com", "/", "frictionlessdata", "/", "datapackage", "-", "py#package" ]
python
valid
42.2
techdragon/python-check-pypi-name
src/check_pypi_name/__init__.py
https://github.com/techdragon/python-check-pypi-name/blob/2abfa98878755ed9073b4f5448f4380f88e3e8f3/src/check_pypi_name/__init__.py#L7-L86
def check_pypi_name(pypi_package_name, pypi_registry_host=None): """ Check if a package name exists on pypi. TODO: Document the Registry URL construction. It may not be obvious how pypi_package_name and pypi_registry_host are used I'm appending the simple HTTP API parts of the registry stan...
[ "def", "check_pypi_name", "(", "pypi_package_name", ",", "pypi_registry_host", "=", "None", ")", ":", "if", "pypi_registry_host", "is", "None", ":", "pypi_registry_host", "=", "'pypi.python.org'", "# Just a helpful reminder why this bytearray size was chosen.", "# ...
Check if a package name exists on pypi. TODO: Document the Registry URL construction. It may not be obvious how pypi_package_name and pypi_registry_host are used I'm appending the simple HTTP API parts of the registry standard specification. It will return True if the package name, or any equi...
[ "Check", "if", "a", "package", "name", "exists", "on", "pypi", "." ]
python
test
39.925
pyviz/holoviews
holoviews/plotting/mpl/chart3d.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart3d.py#L60-L87
def _finalize_axis(self, key, **kwargs): """ Extends the ElementPlot _finalize_axis method to set appropriate labels, and axes options for 3D Plots. """ axis = self.handles['axis'] self.handles['fig'].set_frameon(False) axis.grid(self.show_grid) axis.view_...
[ "def", "_finalize_axis", "(", "self", ",", "key", ",", "*", "*", "kwargs", ")", ":", "axis", "=", "self", ".", "handles", "[", "'axis'", "]", "self", ".", "handles", "[", "'fig'", "]", ".", "set_frameon", "(", "False", ")", "axis", ".", "grid", "("...
Extends the ElementPlot _finalize_axis method to set appropriate labels, and axes options for 3D Plots.
[ "Extends", "the", "ElementPlot", "_finalize_axis", "method", "to", "set", "appropriate", "labels", "and", "axes", "options", "for", "3D", "Plots", "." ]
python
train
35.357143
fracpete/python-weka-wrapper3
python/weka/datagenerators.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/datagenerators.py#L167-L177
def make_copy(cls, generator): """ Creates a copy of the generator. :param generator: the generator to copy :type generator: DataGenerator :return: the copy of the generator :rtype: DataGenerator """ return from_commandline( to_commandline(gen...
[ "def", "make_copy", "(", "cls", ",", "generator", ")", ":", "return", "from_commandline", "(", "to_commandline", "(", "generator", ")", ",", "classname", "=", "classes", ".", "get_classname", "(", "DataGenerator", "(", ")", ")", ")" ]
Creates a copy of the generator. :param generator: the generator to copy :type generator: DataGenerator :return: the copy of the generator :rtype: DataGenerator
[ "Creates", "a", "copy", "of", "the", "generator", "." ]
python
train
33.454545
IBMStreams/pypi.streamsx
streamsx/rest.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest.py#L271-L287
def of_definition(service_def): """Create a connection to a Streaming Analytics service. The single service is defined by `service_def` which can be one of * The `service credentials` copied from the `Service credentials` page of the service console (not the Streams console). Credentials ...
[ "def", "of_definition", "(", "service_def", ")", ":", "vcap_services", "=", "streamsx", ".", "topology", ".", "context", ".", "_vcap_from_service_definition", "(", "service_def", ")", "service_name", "=", "streamsx", ".", "topology", ".", "context", ".", "_name_fr...
Create a connection to a Streaming Analytics service. The single service is defined by `service_def` which can be one of * The `service credentials` copied from the `Service credentials` page of the service console (not the Streams console). Credentials are provided in JSON format. They contain ...
[ "Create", "a", "connection", "to", "a", "Streaming", "Analytics", "service", "." ]
python
train
63.411765
andreikop/python-ws-discovery
wsdiscovery/daemon.py
https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L547-L553
def clearLocalServices(self): 'send Bye messages for the services and remove them' for service in list(self._localServices.values()): self._sendBye(service) self._localServices.clear()
[ "def", "clearLocalServices", "(", "self", ")", ":", "for", "service", "in", "list", "(", "self", ".", "_localServices", ".", "values", "(", ")", ")", ":", "self", ".", "_sendBye", "(", "service", ")", "self", ".", "_localServices", ".", "clear", "(", "...
send Bye messages for the services and remove them
[ "send", "Bye", "messages", "for", "the", "services", "and", "remove", "them" ]
python
test
30.857143
saltstack/salt
salt/modules/boto_vpc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2975-L3033
def delete_vpc_peering_connection(conn_id=None, conn_name=None, region=None, key=None, keyid=None, profile=None, dry_run=False): ''' Delete a VPC peering connection. .. versionadded:: 2016.11.0 conn_id The connection ID to check. Exclusive with conn_name. ...
[ "def", "delete_vpc_peering_connection", "(", "conn_id", "=", "None", ",", "conn_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "dry_run", "=", "False", ")", ":", "if...
Delete a VPC peering connection. .. versionadded:: 2016.11.0 conn_id The connection ID to check. Exclusive with conn_name. conn_name The connection name to check. Exclusive with conn_id. region Region to connect to. key Secret key to be used. keyid ...
[ "Delete", "a", "VPC", "peering", "connection", "." ]
python
train
34.40678
PGower/petl_django
petl_django/django_view.py
https://github.com/PGower/petl_django/blob/463144eeb38ca2da30644f53c247bfbc15702bb2/petl_django/django_view.py#L67-L124
def todjango(table, model, update=True, create=True, use_bulk_create=True, *args, **kwargs): ''' Given a table with appropriate headings create Django models. ''' assert issubclass(model, Model), 'Must be supplied a valid Django model class' table_iterator = iter(table) table_headers = tab...
[ "def", "todjango", "(", "table", ",", "model", ",", "update", "=", "True", ",", "create", "=", "True", ",", "use_bulk_create", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "issubclass", "(", "model", ",", "Model", ")", ...
Given a table with appropriate headings create Django models.
[ "Given", "a", "table", "with", "appropriate", "headings", "create", "Django", "models", "." ]
python
train
42.310345