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
Chilipp/psyplot
psyplot/plotter.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L86-L103
def is_data_dependent(fmto, data): """Check whether a formatoption is data dependent Parameters ---------- fmto: Formatoption The :class:`Formatoption` instance to check data: xarray.DataArray The data array to use if the :attr:`~Formatoption.data_dependent` attribute is a c...
[ "def", "is_data_dependent", "(", "fmto", ",", "data", ")", ":", "if", "callable", "(", "fmto", ".", "data_dependent", ")", ":", "return", "fmto", ".", "data_dependent", "(", "data", ")", "return", "fmto", ".", "data_dependent" ]
Check whether a formatoption is data dependent Parameters ---------- fmto: Formatoption The :class:`Formatoption` instance to check data: xarray.DataArray The data array to use if the :attr:`~Formatoption.data_dependent` attribute is a callable Returns ------- bool ...
[ "Check", "whether", "a", "formatoption", "is", "data", "dependent" ]
python
train
28.388889
openego/ding0
ding0/core/__init__.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1805-L1863
def metadata(self, run_id=None): """Provide metadata on a Ding0 run Parameters ---------- run_id: str, (defaults to current date) Distinguish multiple versions of Ding0 data by a `run_id`. If not set it defaults to current date in the format YYYYMMDDhhmmss ...
[ "def", "metadata", "(", "self", ",", "run_id", "=", "None", ")", ":", "# Get latest version and/or git commit hash", "try", ":", "version", "=", "subprocess", ".", "check_output", "(", "[", "\"git\"", ",", "\"describe\"", ",", "\"--tags\"", ",", "\"--always\"", ...
Provide metadata on a Ding0 run Parameters ---------- run_id: str, (defaults to current date) Distinguish multiple versions of Ding0 data by a `run_id`. If not set it defaults to current date in the format YYYYMMDDhhmmss Returns ------- dict ...
[ "Provide", "metadata", "on", "a", "Ding0", "run" ]
python
train
33.389831
mobinrg/rpi_spark_drives
JMRPiSpark/Drives/Attitude/MPU6050.py
https://github.com/mobinrg/rpi_spark_drives/blob/e1602d8268a5ef48e9e0a8b37de89e0233f946ea/JMRPiSpark/Drives/Attitude/MPU6050.py#L533-L555
def getAllData(self, temp = True, accel = True, gyro = True): """! Get all the available data. @param temp: True - Allow to return Temperature data @param accel: True - Allow to return Accelerometer data @param gyro: True - Allow to return Gyroscope data @return a dicti...
[ "def", "getAllData", "(", "self", ",", "temp", "=", "True", ",", "accel", "=", "True", ",", "gyro", "=", "True", ")", ":", "allData", "=", "{", "}", "if", "temp", ":", "allData", "[", "\"temp\"", "]", "=", "self", ".", "getTemp", "(", ")", "if", ...
! Get all the available data. @param temp: True - Allow to return Temperature data @param accel: True - Allow to return Accelerometer data @param gyro: True - Allow to return Gyroscope data @return a dictionary data @retval {} Did not read any data @retv...
[ "!", "Get", "all", "the", "available", "data", "." ]
python
train
33
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L168-L194
def file_detector_context(self, file_detector_class, *args, **kwargs): """ Overrides the current file detector (if necessary) in limited context. Ensures the original file detector is set afterwards. Example: with webdriver.file_detector_context(UselessFileDetector): ...
[ "def", "file_detector_context", "(", "self", ",", "file_detector_class", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "last_detector", "=", "None", "if", "not", "isinstance", "(", "self", ".", "file_detector", ",", "file_detector_class", ")", ":", "l...
Overrides the current file detector (if necessary) in limited context. Ensures the original file detector is set afterwards. Example: with webdriver.file_detector_context(UselessFileDetector): someinput.send_keys('/etc/hosts') :Args: - file_detector_class - Class ...
[ "Overrides", "the", "current", "file", "detector", "(", "if", "necessary", ")", "in", "limited", "context", ".", "Ensures", "the", "original", "file", "detector", "is", "set", "afterwards", "." ]
python
train
43.407407
darkfeline/animanager
animanager/animecmd.py
https://github.com/darkfeline/animanager/blob/55d92e4cbdc12aac8ebe302420d2cff3fa9fa148/animanager/animecmd.py#L86-L109
def cmdloop(self): """Start CLI REPL.""" while True: cmdline = input(self.prompt) tokens = shlex.split(cmdline) if not tokens: if self.last_cmd: tokens = self.last_cmd else: print('No previous com...
[ "def", "cmdloop", "(", "self", ")", ":", "while", "True", ":", "cmdline", "=", "input", "(", "self", ".", "prompt", ")", "tokens", "=", "shlex", ".", "split", "(", "cmdline", ")", "if", "not", "tokens", ":", "if", "self", ".", "last_cmd", ":", "tok...
Start CLI REPL.
[ "Start", "CLI", "REPL", "." ]
python
train
33.5
numenta/nupic
src/nupic/swarming/experiment_utils.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/experiment_utils.py#L154-L166
def isTemporal(inferenceType): """ Returns True if the inference type is 'temporal', i.e. requires a temporal memory in the network. """ if InferenceType.__temporalInferenceTypes is None: InferenceType.__temporalInferenceTypes = \ set([InferenceType.TemporalNextStep...
[ "def", "isTemporal", "(", "inferenceType", ")", ":", "if", "InferenceType", ".", "__temporalInferenceTypes", "is", "None", ":", "InferenceType", ".", "__temporalInferenceTypes", "=", "set", "(", "[", "InferenceType", ".", "TemporalNextStep", ",", "InferenceType", "....
Returns True if the inference type is 'temporal', i.e. requires a temporal memory in the network.
[ "Returns", "True", "if", "the", "inference", "type", "is", "temporal", "i", ".", "e", ".", "requires", "a", "temporal", "memory", "in", "the", "network", "." ]
python
valid
51.076923
ibis-project/ibis
ibis/config.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/config.py#L703-L723
def is_instance_factory(_type): """ Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which returns the True if x is an instance of `_type` """ if isinstance(_type, (tuple, list)): _t...
[ "def", "is_instance_factory", "(", "_type", ")", ":", "if", "isinstance", "(", "_type", ",", "(", "tuple", ",", "list", ")", ")", ":", "_type", "=", "tuple", "(", "_type", ")", "type_repr", "=", "\"|\"", ".", "join", "(", "map", "(", "str", ",", "_...
Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which returns the True if x is an instance of `_type`
[ "Parameters", "----------", "_type", "-", "the", "type", "to", "be", "checked", "against", "Returns", "-------", "validator", "-", "a", "function", "of", "a", "single", "argument", "x", "which", "returns", "the", "True", "if", "x", "is", "an", "instance", ...
python
train
26.619048
nok/sklearn-porter
sklearn_porter/Porter.py
https://github.com/nok/sklearn-porter/blob/04673f768310bde31f9747a68a5e070592441ef2/sklearn_porter/Porter.py#L456-L488
def _get_filename(class_name, language): """ Generate the specific filename. Parameters ---------- :param class_name : str The used class name. :param language : {'c', 'go', 'java', 'js', 'php', 'ruby'} The target programming language. R...
[ "def", "_get_filename", "(", "class_name", ",", "language", ")", ":", "name", "=", "str", "(", "class_name", ")", ".", "strip", "(", ")", "lang", "=", "str", "(", "language", ")", "# Name:", "if", "language", "in", "[", "'java'", ",", "'php'", "]", "...
Generate the specific filename. Parameters ---------- :param class_name : str The used class name. :param language : {'c', 'go', 'java', 'js', 'php', 'ruby'} The target programming language. Returns ------- filename : str ...
[ "Generate", "the", "specific", "filename", "." ]
python
train
24.878788
yandex/yandex-tank
yandextank/plugins/ResourceCheck/plugin.py
https://github.com/yandex/yandex-tank/blob/d71d63b6ab5de8b8a5ea2b728b6ab9ac0b1ba71b/yandextank/plugins/ResourceCheck/plugin.py#L72-L79
def __check_mem(self): ''' raise exception on RAM exceeded ''' mem_free = psutil.virtual_memory().available / 2**20 self.log.debug("Memory free: %s/%s", mem_free, self.mem_limit) if mem_free < self.mem_limit: raise RuntimeError( "Not enough resources: free mem...
[ "def", "__check_mem", "(", "self", ")", ":", "mem_free", "=", "psutil", ".", "virtual_memory", "(", ")", ".", "available", "/", "2", "**", "20", "self", ".", "log", ".", "debug", "(", "\"Memory free: %s/%s\"", ",", "mem_free", ",", "self", ".", "mem_limi...
raise exception on RAM exceeded
[ "raise", "exception", "on", "RAM", "exceeded" ]
python
test
48.375
matthiask/django-cte-forest
cte_forest/models.py
https://github.com/matthiask/django-cte-forest/blob/7bff29d69eddfcf214e9cf61647c91d28655619c/cte_forest/models.py#L1227-L1252
def as_tree(self, visitor=None, children=None): """ Recursively traverses each tree (starting from each root) in order to generate a dictionary-based tree structure of the entire forest. Each level of the forest/tree is a list of nodes, and each node consists of a dictionary ...
[ "def", "as_tree", "(", "self", ",", "visitor", "=", "None", ",", "children", "=", "None", ")", ":", "_parameters", "=", "{", "\"node\"", ":", "self", "}", "if", "visitor", "is", "not", "None", ":", "_parameters", "[", "\"visitor\"", "]", "=", "visitor"...
Recursively traverses each tree (starting from each root) in order to generate a dictionary-based tree structure of the entire forest. Each level of the forest/tree is a list of nodes, and each node consists of a dictionary representation, where the entry ``children`` (by...
[ "Recursively", "traverses", "each", "tree", "(", "starting", "from", "each", "root", ")", "in", "order", "to", "generate", "a", "dictionary", "-", "based", "tree", "structure", "of", "the", "entire", "forest", ".", "Each", "level", "of", "the", "forest", "...
python
train
47.653846
timothyb0912/pylogit
pylogit/estimation.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/estimation.py#L399-L421
def convenience_calc_fisher_approx(self, params): """ Calculates the BHHH approximation of the Fisher Information Matrix for this model / dataset. """ shapes, intercepts, betas = self.convenience_split_params(params) args = [betas, self.design, ...
[ "def", "convenience_calc_fisher_approx", "(", "self", ",", "params", ")", ":", "shapes", ",", "intercepts", ",", "betas", "=", "self", ".", "convenience_split_params", "(", "params", ")", "args", "=", "[", "betas", ",", "self", ".", "design", ",", "self", ...
Calculates the BHHH approximation of the Fisher Information Matrix for this model / dataset.
[ "Calculates", "the", "BHHH", "approximation", "of", "the", "Fisher", "Information", "Matrix", "for", "this", "model", "/", "dataset", "." ]
python
train
32.043478
jaraco/jaraco.windows
jaraco/windows/environ.py
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/environ.py#L172-L253
def enver(*args): """ %prog [<name>=[value]] To show all environment variables, call with no parameters: %prog To Add/Modify/Delete environment variable: %prog <name>=[value] If <name> is PATH or PATHEXT, %prog will by default append the value using a semicolon as a separator. Use -r to disable this behavio...
[ "def", "enver", "(", "*", "args", ")", ":", "from", "optparse", "import", "OptionParser", "parser", "=", "OptionParser", "(", "usage", "=", "trim", "(", "enver", ".", "__doc__", ")", ")", "parser", ".", "add_option", "(", "'-U'", ",", "'--user-environment'...
%prog [<name>=[value]] To show all environment variables, call with no parameters: %prog To Add/Modify/Delete environment variable: %prog <name>=[value] If <name> is PATH or PATHEXT, %prog will by default append the value using a semicolon as a separator. Use -r to disable this behavior or -a to force it for...
[ "%prog", "[", "<name", ">", "=", "[", "value", "]]" ]
python
train
30.195122
Opentrons/opentrons
api/src/opentrons/protocol_api/labware.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/protocol_api/labware.py#L667-L682
def save_tip_length(labware: Labware, length: float): """ Function to be used whenever an updated tip length is found for of a given tip rack. If an offset file does not exist, create the file using labware id as the filename. If the file does exist, load it and modify the length and the lastModifie...
[ "def", "save_tip_length", "(", "labware", ":", "Labware", ",", "length", ":", "float", ")", ":", "calibration_path", "=", "CONFIG", "[", "'labware_calibration_offsets_dir_v4'", "]", "if", "not", "calibration_path", ".", "exists", "(", ")", ":", "calibration_path",...
Function to be used whenever an updated tip length is found for of a given tip rack. If an offset file does not exist, create the file using labware id as the filename. If the file does exist, load it and modify the length and the lastModified fields under the "tipLength" key.
[ "Function", "to", "be", "used", "whenever", "an", "updated", "tip", "length", "is", "found", "for", "of", "a", "given", "tip", "rack", ".", "If", "an", "offset", "file", "does", "not", "exist", "create", "the", "file", "using", "labware", "id", "as", "...
python
train
50
OSSOS/MOP
src/ossos/core/scripts/step2.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/scripts/step2.py#L86-L152
def step2(expnums, ccd, version, prefix=None, dry_run=False, default="WCS"): """run the actual step2 on the given exp/ccd combo""" jmp_trans = ['step2ajmp'] jmp_args = ['step2bjmp'] matt_args = ['step2matt_jmp'] idx = 0 for expnum in expnums: jmp_args.append( storage.get_f...
[ "def", "step2", "(", "expnums", ",", "ccd", ",", "version", ",", "prefix", "=", "None", ",", "dry_run", "=", "False", ",", "default", "=", "\"WCS\"", ")", ":", "jmp_trans", "=", "[", "'step2ajmp'", "]", "jmp_args", "=", "[", "'step2bjmp'", "]", "matt_a...
run the actual step2 on the given exp/ccd combo
[ "run", "the", "actual", "step2", "on", "the", "given", "exp", "/", "ccd", "combo" ]
python
train
36.119403
luismasuelli/python-cantrips
cantrips/patterns/broadcast.py
https://github.com/luismasuelli/python-cantrips/blob/dba2742c1d1a60863bb65f4a291464f6e68eb2ee/cantrips/patterns/broadcast.py#L88-L95
def broadcast(self, command, *args, **kwargs): """ Notifies each user with a specified command. """ criterion = kwargs.pop('criterion', self.BROADCAST_FILTER_ALL) for index, user in items(self.users()): if criterion(user, command, *args, **kwargs): sel...
[ "def", "broadcast", "(", "self", ",", "command", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "criterion", "=", "kwargs", ".", "pop", "(", "'criterion'", ",", "self", ".", "BROADCAST_FILTER_ALL", ")", "for", "index", ",", "user", "in", "items",...
Notifies each user with a specified command.
[ "Notifies", "each", "user", "with", "a", "specified", "command", "." ]
python
train
44.125
goldsmith/Wikipedia
wikipedia/wikipedia.py
https://github.com/goldsmith/Wikipedia/blob/2065c568502b19b8634241b47fd96930d1bf948d/wikipedia/wikipedia.py#L254-L280
def page(title=None, pageid=None, auto_suggest=True, redirect=True, preload=False): ''' Get a WikipediaPage object for the page with title `title` or the pageid `pageid` (mutually exclusive). Keyword arguments: * title - the title of the page to load * pageid - the numeric pageid of the page to load * a...
[ "def", "page", "(", "title", "=", "None", ",", "pageid", "=", "None", ",", "auto_suggest", "=", "True", ",", "redirect", "=", "True", ",", "preload", "=", "False", ")", ":", "if", "title", "is", "not", "None", ":", "if", "auto_suggest", ":", "results...
Get a WikipediaPage object for the page with title `title` or the pageid `pageid` (mutually exclusive). Keyword arguments: * title - the title of the page to load * pageid - the numeric pageid of the page to load * auto_suggest - let Wikipedia find a valid page title for the query * redirect - allow redir...
[ "Get", "a", "WikipediaPage", "object", "for", "the", "page", "with", "title", "title", "or", "the", "pageid", "pageid", "(", "mutually", "exclusive", ")", "." ]
python
train
38.814815
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_db_v2.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L576-L606
def _lookup_vpc_allocs(query_type, session=None, order=None, **bfilter): """Look up 'query_type' Nexus VPC Allocs matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param order: select what field to order data :param bfilter: filter for mappings query :r...
[ "def", "_lookup_vpc_allocs", "(", "query_type", ",", "session", "=", "None", ",", "order", "=", "None", ",", "*", "*", "bfilter", ")", ":", "if", "session", "is", "None", ":", "session", "=", "bc", ".", "get_reader_session", "(", ")", "if", "order", ":...
Look up 'query_type' Nexus VPC Allocs matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param order: select what field to order data :param bfilter: filter for mappings query :returns: VPCs if query gave a result, else raise NexusVPCAllocNotFou...
[ "Look", "up", "query_type", "Nexus", "VPC", "Allocs", "matching", "the", "filter", "." ]
python
train
30.354839
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1213-L1217
def system_find_affiliates(input_params={}, always_retry=True, **kwargs): """ Invokes the /system/findAffiliates API method. """ return DXHTTPRequest('/system/findAffiliates', input_params, always_retry=always_retry, **kwargs)
[ "def", "system_find_affiliates", "(", "input_params", "=", "{", "}", ",", "always_retry", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/system/findAffiliates'", ",", "input_params", ",", "always_retry", "=", "always_retry", "...
Invokes the /system/findAffiliates API method.
[ "Invokes", "the", "/", "system", "/", "findAffiliates", "API", "method", "." ]
python
train
47.6
dcos/shakedown
shakedown/cli/helpers.py
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/helpers.py#L153-L178
def echo(text, **kwargs): """ Print results to the console :param text: the text string to print :type text: str :return: a string :rtype: str """ if shakedown.cli.quiet: return if not 'n' in kwargs: kwargs['n'] = True if 'd' in kwargs: te...
[ "def", "echo", "(", "text", ",", "*", "*", "kwargs", ")", ":", "if", "shakedown", ".", "cli", ".", "quiet", ":", "return", "if", "not", "'n'", "in", "kwargs", ":", "kwargs", "[", "'n'", "]", "=", "True", "if", "'d'", "in", "kwargs", ":", "text", ...
Print results to the console :param text: the text string to print :type text: str :return: a string :rtype: str
[ "Print", "results", "to", "the", "console" ]
python
train
21.461538
Crunch-io/crunch-cube
src/cr/cube/dimension.py
https://github.com/Crunch-io/crunch-cube/blob/a837840755690eb14b2ec8e8d93b4104e01c854f/src/cr/cube/dimension.py#L160-L173
def _base_type(self): """Return str like 'enum.numeric' representing dimension type. This string is a 'type.subclass' concatenation of the str keys used to identify the dimension type in the cube response JSON. The '.subclass' suffix only appears where a subtype is present. """ ...
[ "def", "_base_type", "(", "self", ")", ":", "type_class", "=", "self", ".", "_dimension_dict", "[", "\"type\"", "]", "[", "\"class\"", "]", "if", "type_class", "==", "\"categorical\"", ":", "return", "\"categorical\"", "if", "type_class", "==", "\"enum\"", ":"...
Return str like 'enum.numeric' representing dimension type. This string is a 'type.subclass' concatenation of the str keys used to identify the dimension type in the cube response JSON. The '.subclass' suffix only appears where a subtype is present.
[ "Return", "str", "like", "enum", ".", "numeric", "representing", "dimension", "type", "." ]
python
train
47.857143
franciscogarate/pyliferisk
pyliferisk/__init__.py
https://github.com/franciscogarate/pyliferisk/blob/8d906bed04df1ba00fa1cacc6f31030ce5ab6233/pyliferisk/__init__.py#L215-L218
def tpx(mt, x, t): """ tpx : Returns the probability that x will survive within t years """ """ npx : Returns n years survival probability at age x """ return mt.lx[x + t] / mt.lx[x]
[ "def", "tpx", "(", "mt", ",", "x", ",", "t", ")", ":", "\"\"\" npx : Returns n years survival probability at age x \"\"\"", "return", "mt", ".", "lx", "[", "x", "+", "t", "]", "/", "mt", ".", "lx", "[", "x", "]" ]
tpx : Returns the probability that x will survive within t years
[ "tpx", ":", "Returns", "the", "probability", "that", "x", "will", "survive", "within", "t", "years" ]
python
train
47.75
polyaxon/polyaxon
polyaxon/query/parser.py
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L240-L256
def parse_field(field: str) -> Tuple[str, Optional[str]]: """Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo """ _field = field.split('.') _field = [f.strip() for f in _field] if len(_field) == 1 and _field[0]: ...
[ "def", "parse_field", "(", "field", ":", "str", ")", "->", "Tuple", "[", "str", ",", "Optional", "[", "str", "]", "]", ":", "_field", "=", "field", ".", "split", "(", "'.'", ")", "_field", "=", "[", "f", ".", "strip", "(", ")", "for", "f", "in"...
Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo
[ "Parses", "fields", "with", "underscores", "and", "return", "field", "and", "suffix", "." ]
python
train
41.117647
rwl/pylon
pylon/opf.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/opf.py#L433-L509
def _pwl_gen_costs(self, generators, base_mva): """ Returns the basin constraints for piece-wise linear gen cost variables. CCV cost formulation expressed as Ay * x <= by. Based on makeAy.m from MATPOWER by C. E. Murillo-Sanchez, developed at PSERC Cornell. See U{http://www.pserc.corne...
[ "def", "_pwl_gen_costs", "(", "self", ",", "generators", ",", "base_mva", ")", ":", "ng", "=", "len", "(", "generators", ")", "gpwl", "=", "[", "g", "for", "g", "in", "generators", "if", "g", ".", "pcost_model", "==", "PW_LINEAR", "]", "# nq = len...
Returns the basin constraints for piece-wise linear gen cost variables. CCV cost formulation expressed as Ay * x <= by. Based on makeAy.m from MATPOWER by C. E. Murillo-Sanchez, developed at PSERC Cornell. See U{http://www.pserc.cornell.edu/matpower/} for more information.
[ "Returns", "the", "basin", "constraints", "for", "piece", "-", "wise", "linear", "gen", "cost", "variables", ".", "CCV", "cost", "formulation", "expressed", "as", "Ay", "*", "x", "<", "=", "by", "." ]
python
train
32.883117
fracpete/python-weka-wrapper3
python/weka/flow/control.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/flow/control.py#L195-L209
def index_of(self, name): """ Returns the index of the actor with the given name. :param name: the name of the Actor to find :type name: str :return: the index, -1 if not found :rtype: int """ result = -1 for index, actor in enumerate(self.actors)...
[ "def", "index_of", "(", "self", ",", "name", ")", ":", "result", "=", "-", "1", "for", "index", ",", "actor", "in", "enumerate", "(", "self", ".", "actors", ")", ":", "if", "actor", ".", "name", "==", "name", ":", "result", "=", "index", "break", ...
Returns the index of the actor with the given name. :param name: the name of the Actor to find :type name: str :return: the index, -1 if not found :rtype: int
[ "Returns", "the", "index", "of", "the", "actor", "with", "the", "given", "name", "." ]
python
train
27.8
googleapis/google-cloud-python
api_core/google/api_core/exceptions.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/exceptions.py#L447-L462
def from_grpc_error(rpc_exc): """Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`. Args: rpc_exc (grpc.RpcError): The gRPC error. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`. """ if isinstance(rpc...
[ "def", "from_grpc_error", "(", "rpc_exc", ")", ":", "if", "isinstance", "(", "rpc_exc", ",", "grpc", ".", "Call", ")", ":", "return", "from_grpc_status", "(", "rpc_exc", ".", "code", "(", ")", ",", "rpc_exc", ".", "details", "(", ")", ",", "errors", "=...
Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`. Args: rpc_exc (grpc.RpcError): The gRPC error. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`.
[ "Create", "a", ":", "class", ":", "GoogleAPICallError", "from", "a", ":", "class", ":", "grpc", ".", "RpcError", "." ]
python
train
33.9375
bitshares/python-bitshares
bitsharesapi/websocket.py
https://github.com/bitshares/python-bitshares/blob/8a3b5954a6abcaaff7c6a5c41d910e58eea3142f/bitsharesapi/websocket.py#L346-L354
def rpcexec(self, payload): """ Execute a call by sending the payload :param dict payload: Payload data :raises ValueError: if the server does not respond in proper JSON format :raises RPCError: if the server returns an error """ log.debug(json.dumps(payload)...
[ "def", "rpcexec", "(", "self", ",", "payload", ")", ":", "log", ".", "debug", "(", "json", ".", "dumps", "(", "payload", ")", ")", "self", ".", "ws", ".", "send", "(", "json", ".", "dumps", "(", "payload", ",", "ensure_ascii", "=", "False", ")", ...
Execute a call by sending the payload :param dict payload: Payload data :raises ValueError: if the server does not respond in proper JSON format :raises RPCError: if the server returns an error
[ "Execute", "a", "call", "by", "sending", "the", "payload" ]
python
train
43.333333
openstack/pyghmi
pyghmi/ipmi/oem/generic.py
https://github.com/openstack/pyghmi/blob/f710b1d30a8eed19a9e86f01f9351c737666f3e5/pyghmi/ipmi/oem/generic.py#L45-L57
def process_event(self, event, ipmicmd, seldata): """Modify an event according with OEM understanding. Given an event, allow an OEM module to augment it. For example, event data fields can have OEM bytes. Other times an OEM may wish to apply some transform to some field to suit their ...
[ "def", "process_event", "(", "self", ",", "event", ",", "ipmicmd", ",", "seldata", ")", ":", "event", "[", "'oem_handler'", "]", "=", "None", "evdata", "=", "event", "[", "'event_data_bytes'", "]", "if", "evdata", "[", "0", "]", "&", "0b11000000", "==", ...
Modify an event according with OEM understanding. Given an event, allow an OEM module to augment it. For example, event data fields can have OEM bytes. Other times an OEM may wish to apply some transform to some field to suit their conventions.
[ "Modify", "an", "event", "according", "with", "OEM", "understanding", "." ]
python
train
45.461538
Azure/azure-event-hubs-python
azure/eventprocessorhost/partition_pump.py
https://github.com/Azure/azure-event-hubs-python/blob/737c5f966557ada2cf10fa0d8f3c19671ae96348/azure/eventprocessorhost/partition_pump.py#L35-L40
def set_pump_status(self, status): """ Updates pump status and logs update to console. """ self.pump_status = status _logger.info("%r partition %r", status, self.lease.partition_id)
[ "def", "set_pump_status", "(", "self", ",", "status", ")", ":", "self", ".", "pump_status", "=", "status", "_logger", ".", "info", "(", "\"%r partition %r\"", ",", "status", ",", "self", ".", "lease", ".", "partition_id", ")" ]
Updates pump status and logs update to console.
[ "Updates", "pump", "status", "and", "logs", "update", "to", "console", "." ]
python
train
36
Cog-Creators/Red-Lavalink
lavalink/lavalink.py
https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/lavalink.py#L86-L109
async def connect(channel: discord.VoiceChannel): """ Connects to a discord voice channel. This is the publicly exposed way to connect to a discord voice channel. The :py:func:`initialize` function must be called first! Parameters ---------- channel Returns ------- Player ...
[ "async", "def", "connect", "(", "channel", ":", "discord", ".", "VoiceChannel", ")", ":", "node_", "=", "node", ".", "get_node", "(", "channel", ".", "guild", ".", "id", ")", "p", "=", "await", "node_", ".", "player_manager", ".", "create_player", "(", ...
Connects to a discord voice channel. This is the publicly exposed way to connect to a discord voice channel. The :py:func:`initialize` function must be called first! Parameters ---------- channel Returns ------- Player The created Player object. Raises ------ Inde...
[ "Connects", "to", "a", "discord", "voice", "channel", "." ]
python
train
23.583333
aws/aws-iot-device-sdk-python
AWSIoTPythonSDK/core/protocol/paho/client.py
https://github.com/aws/aws-iot-device-sdk-python/blob/f0aa2ce34b21dd2e44f4fb7e1d058656aaf2fc62/AWSIoTPythonSDK/core/protocol/paho/client.py#L1141-L1162
def loop_read(self, max_packets=1): """Process read network events. Use in place of calling loop() if you wish to handle your client reads as part of your own application. Use socket() to obtain the client socket to call select() or equivalent on. Do not use if you are using th...
[ "def", "loop_read", "(", "self", ",", "max_packets", "=", "1", ")", ":", "if", "self", ".", "_sock", "is", "None", "and", "self", ".", "_ssl", "is", "None", ":", "return", "MQTT_ERR_NO_CONN", "max_packets", "=", "len", "(", "self", ".", "_out_messages", ...
Process read network events. Use in place of calling loop() if you wish to handle your client reads as part of your own application. Use socket() to obtain the client socket to call select() or equivalent on. Do not use if you are using the threaded interface loop_start().
[ "Process", "read", "network", "events", ".", "Use", "in", "place", "of", "calling", "loop", "()", "if", "you", "wish", "to", "handle", "your", "client", "reads", "as", "part", "of", "your", "own", "application", "." ]
python
train
36.954545
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L9023-L9065
def occult(target1, shape1, frame1, target2, shape2, frame2, abcorr, observer, et): """ Determines the occultation condition (not occulted, partially, etc.) of one target relative to another target as seen by an observer at a given time. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/c...
[ "def", "occult", "(", "target1", ",", "shape1", ",", "frame1", ",", "target2", ",", "shape2", ",", "frame2", ",", "abcorr", ",", "observer", ",", "et", ")", ":", "target1", "=", "stypes", ".", "stringToCharP", "(", "target1", ")", "shape1", "=", "stype...
Determines the occultation condition (not occulted, partially, etc.) of one target relative to another target as seen by an observer at a given time. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/occult_c.html :param target1: Name or ID of first target. :type target1: str :param shap...
[ "Determines", "the", "occultation", "condition", "(", "not", "occulted", "partially", "etc", ".", ")", "of", "one", "target", "relative", "to", "another", "target", "as", "seen", "by", "an", "observer", "at", "a", "given", "time", "." ]
python
train
38.604651
python-diamond/Diamond
src/collectors/kafka_consumer_lag/kafka_consumer_lag.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/kafka_consumer_lag/kafka_consumer_lag.py#L29-L39
def get_default_config(self): """ Returns the default collector settings """ config = super(KafkaConsumerLagCollector, self).get_default_config() config.update({ 'path': 'kafka.ConsumerLag', 'bin': '/opt/kafka/bin/kafka-run-class.sh', 'zookeepe...
[ "def", "get_default_config", "(", "self", ")", ":", "config", "=", "super", "(", "KafkaConsumerLagCollector", ",", "self", ")", ".", "get_default_config", "(", ")", "config", ".", "update", "(", "{", "'path'", ":", "'kafka.ConsumerLag'", ",", "'bin'", ":", "...
Returns the default collector settings
[ "Returns", "the", "default", "collector", "settings" ]
python
train
33
quantopian/zipline
zipline/pipeline/factors/basic.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/basic.py#L198-L240
def from_span(cls, inputs, window_length, span, **kwargs): """ Convenience constructor for passing `decay_rate` in terms of `span`. Forwards `decay_rate` as `1 - (2.0 / (1 + span))`. This provides the behavior equivalent to passing `span` to pandas.ewma. Examples -----...
[ "def", "from_span", "(", "cls", ",", "inputs", ",", "window_length", ",", "span", ",", "*", "*", "kwargs", ")", ":", "if", "span", "<=", "1", ":", "raise", "ValueError", "(", "\"`span` must be a positive number. %s was passed.\"", "%", "span", ")", "decay_rate...
Convenience constructor for passing `decay_rate` in terms of `span`. Forwards `decay_rate` as `1 - (2.0 / (1 + span))`. This provides the behavior equivalent to passing `span` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # ...
[ "Convenience", "constructor", "for", "passing", "decay_rate", "in", "terms", "of", "span", "." ]
python
train
29.209302
gwpy/gwpy
gwpy/plot/bode.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/plot/bode.py#L169-L226
def add_filter(self, filter_, frequencies=None, dB=True, analog=False, sample_rate=None, **kwargs): """Add a linear time-invariant filter to this BodePlot Parameters ---------- filter_ : `~scipy.signal.lti`, `tuple` the filter to plot, either as a `~scipy....
[ "def", "add_filter", "(", "self", ",", "filter_", ",", "frequencies", "=", "None", ",", "dB", "=", "True", ",", "analog", "=", "False", ",", "sample_rate", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "analog", ":", "if", "not", "sa...
Add a linear time-invariant filter to this BodePlot Parameters ---------- filter_ : `~scipy.signal.lti`, `tuple` the filter to plot, either as a `~scipy.signal.lti`, or a `tuple` with the following number and meaning of elements - 2: (numerator, denomin...
[ "Add", "a", "linear", "time", "-", "invariant", "filter", "to", "this", "BodePlot" ]
python
train
35.172414
quodlibet/mutagen
mutagen/mp4/__init__.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/mp4/__init__.py#L543-L556
def __update_offsets(self, fileobj, atoms, delta, offset): """Update offset tables in all 'stco' and 'co64' atoms.""" if delta == 0: return moov = atoms[b"moov"] for atom in moov.findall(b'stco', True): self.__update_offset_table(fileobj, ">%dI", atom, delta, offs...
[ "def", "__update_offsets", "(", "self", ",", "fileobj", ",", "atoms", ",", "delta", ",", "offset", ")", ":", "if", "delta", "==", "0", ":", "return", "moov", "=", "atoms", "[", "b\"moov\"", "]", "for", "atom", "in", "moov", ".", "findall", "(", "b'st...
Update offset tables in all 'stco' and 'co64' atoms.
[ "Update", "offset", "tables", "in", "all", "stco", "and", "co64", "atoms", "." ]
python
train
44.214286
intel-analytics/BigDL
pyspark/bigdl/keras/converter.py
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L351-L359
def from_hdf5_path(cls, hdf5_path): """ :param hdf5_path: hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model """ from keras.models import load_model hdf5_local_path = BCommon.get_local_file(hdf5_path) ...
[ "def", "from_hdf5_path", "(", "cls", ",", "hdf5_path", ")", ":", "from", "keras", ".", "models", "import", "load_model", "hdf5_local_path", "=", "BCommon", ".", "get_local_file", "(", "hdf5_path", ")", "kmodel", "=", "load_model", "(", "hdf5_local_path", ")", ...
:param hdf5_path: hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model
[ ":", "param", "hdf5_path", ":", "hdf5", "path", "which", "can", "be", "stored", "in", "a", "local", "file", "system", "HDFS", "S3", "or", "any", "Hadoop", "-", "supported", "file", "system", ".", ":", "return", ":", "BigDL", "Model" ]
python
test
46.222222
zetaops/pyoko
pyoko/db/queryset.py
https://github.com/zetaops/pyoko/blob/236c509ad85640933ac0f89ad8f7ed95f62adf07/pyoko/db/queryset.py#L561-L567
def data(self): """ return (data_dict, key) tuple instead of models instances """ clone = copy.deepcopy(self) clone._cfg['rtype'] = ReturnType.Object return clone
[ "def", "data", "(", "self", ")", ":", "clone", "=", "copy", ".", "deepcopy", "(", "self", ")", "clone", ".", "_cfg", "[", "'rtype'", "]", "=", "ReturnType", ".", "Object", "return", "clone" ]
return (data_dict, key) tuple instead of models instances
[ "return", "(", "data_dict", "key", ")", "tuple", "instead", "of", "models", "instances" ]
python
train
29.142857
jssimporter/python-jss
jss/jssobjects.py
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L438-L456
def save(self): """POST the object to the JSS.""" try: response = requests.post(self._upload_url, auth=self.jss.session.auth, verify=self.jss.session.verify, files=self.resource) ...
[ "def", "save", "(", "self", ")", ":", "try", ":", "response", "=", "requests", ".", "post", "(", "self", ".", "_upload_url", ",", "auth", "=", "self", ".", "jss", ".", "session", ".", "auth", ",", "verify", "=", "self", ".", "jss", ".", "session", ...
POST the object to the JSS.
[ "POST", "the", "object", "to", "the", "JSS", "." ]
python
train
40.315789
jazzband/django-authority
authority/templatetags/permissions.py
https://github.com/jazzband/django-authority/blob/58e08483cdd91a6a69e8019dd2a2edf68531ae97/authority/templatetags/permissions.py#L376-L398
def get_permission_request(parser, token): """ Performs a permission request check with the given signature, user and objects and assigns the result to a context variable. Syntax:: {% get_permission_request PERMISSION_LABEL.CHECK_NAME for USER and *OBJS [as VARNAME] %} {% get_permissi...
[ "def", "get_permission_request", "(", "parser", ",", "token", ")", ":", "return", "PermissionForObjectNode", ".", "handle_token", "(", "parser", ",", "token", ",", "approved", "=", "False", ",", "name", "=", "'\"permission_request\"'", ")" ]
Performs a permission request check with the given signature, user and objects and assigns the result to a context variable. Syntax:: {% get_permission_request PERMISSION_LABEL.CHECK_NAME for USER and *OBJS [as VARNAME] %} {% get_permission_request "poll_permission.change_poll" fo...
[ "Performs", "a", "permission", "request", "check", "with", "the", "given", "signature", "user", "and", "objects", "and", "assigns", "the", "result", "to", "a", "context", "variable", "." ]
python
train
37.652174
mikhaildubov/AST-text-analysis
east/applications.py
https://github.com/mikhaildubov/AST-text-analysis/blob/055ad8d2492c100bbbaa25309ec1074bdf1dfaa5/east/applications.py#L11-L56
def keyphrases_table(keyphrases, texts, similarity_measure=None, synonimizer=None, language=consts.Language.ENGLISH): """ Constructs the keyphrases table, containing their matching scores in a set of texts. The resulting table is stored as a dictionary of dictionaries, where the en...
[ "def", "keyphrases_table", "(", "keyphrases", ",", "texts", ",", "similarity_measure", "=", "None", ",", "synonimizer", "=", "None", ",", "language", "=", "consts", ".", "Language", ".", "ENGLISH", ")", ":", "similarity_measure", "=", "similarity_measure", "or",...
Constructs the keyphrases table, containing their matching scores in a set of texts. The resulting table is stored as a dictionary of dictionaries, where the entry table["keyphrase"]["text"] corresponds to the matching score (0 <= score <= 1) of keyphrase "keyphrase" in the text named "text". ...
[ "Constructs", "the", "keyphrases", "table", "containing", "their", "matching", "scores", "in", "a", "set", "of", "texts", "." ]
python
train
39.891304
GetmeUK/MongoFrames
mongoframes/frames.py
https://github.com/GetmeUK/MongoFrames/blob/7d2bd792235dfa77a9deecab5366f5f73480823d/mongoframes/frames.py#L234-L262
def update(self, *fields): """ Update this document. Optionally a specific list of fields to update can be specified. """ from mongoframes.queries import to_refs assert '_id' in self._document, "Can't update documents without `_id`" # Send update signal ...
[ "def", "update", "(", "self", ",", "*", "fields", ")", ":", "from", "mongoframes", ".", "queries", "import", "to_refs", "assert", "'_id'", "in", "self", ".", "_document", ",", "\"Can't update documents without `_id`\"", "# Send update signal", "signal", "(", "'upd...
Update this document. Optionally a specific list of fields to update can be specified.
[ "Update", "this", "document", ".", "Optionally", "a", "specific", "list", "of", "fields", "to", "update", "can", "be", "specified", "." ]
python
train
31.724138
bitlabstudio/django-influxdb-metrics
influxdb_metrics/utils.py
https://github.com/bitlabstudio/django-influxdb-metrics/blob/c9f368e28a6072813454b6b549b4afa64aad778a/influxdb_metrics/utils.py#L13-L24
def get_client(): """Returns an ``InfluxDBClient`` instance.""" return InfluxDBClient( settings.INFLUXDB_HOST, settings.INFLUXDB_PORT, settings.INFLUXDB_USER, settings.INFLUXDB_PASSWORD, settings.INFLUXDB_DATABASE, timeout=settings.INFLUXDB_TIMEOUT, ssl=ge...
[ "def", "get_client", "(", ")", ":", "return", "InfluxDBClient", "(", "settings", ".", "INFLUXDB_HOST", ",", "settings", ".", "INFLUXDB_PORT", ",", "settings", ".", "INFLUXDB_USER", ",", "settings", ".", "INFLUXDB_PASSWORD", ",", "settings", ".", "INFLUXDB_DATABASE...
Returns an ``InfluxDBClient`` instance.
[ "Returns", "an", "InfluxDBClient", "instance", "." ]
python
train
35.166667
shaldengeki/python-mal
myanimelist/character.py
https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L250-L279
def parse_clubs(self, clubs_page): """Parses the DOM and returns character clubs attributes. :type clubs_page: :class:`bs4.BeautifulSoup` :param clubs_page: MAL character clubs page's DOM :rtype: dict :return: character clubs attributes. """ character_info = self.parse_sidebar(clubs_page)...
[ "def", "parse_clubs", "(", "self", ",", "clubs_page", ")", ":", "character_info", "=", "self", ".", "parse_sidebar", "(", "clubs_page", ")", "second_col", "=", "clubs_page", ".", "find", "(", "u'div'", ",", "{", "'id'", ":", "'content'", "}", ")", ".", "...
Parses the DOM and returns character clubs attributes. :type clubs_page: :class:`bs4.BeautifulSoup` :param clubs_page: MAL character clubs page's DOM :rtype: dict :return: character clubs attributes.
[ "Parses", "the", "DOM", "and", "returns", "character", "clubs", "attributes", "." ]
python
train
39.9
OLC-LOC-Bioinformatics/GenomeQAML
genomeqaml/extract_features.py
https://github.com/OLC-LOC-Bioinformatics/GenomeQAML/blob/2953e574c185afab23075641da4ce5392bc003e9/genomeqaml/extract_features.py#L313-L334
def find_l50(contig_lengths_dict, genome_length_dict): """ Calculate the L50 for each strain. L50 is defined as the number of contigs required to achieve the N50 :param contig_lengths_dict: dictionary of strain name: reverse-sorted list of all contig lengths :param genome_length_dict: dictionary of stra...
[ "def", "find_l50", "(", "contig_lengths_dict", ",", "genome_length_dict", ")", ":", "# Initialise the dictionary", "l50_dict", "=", "dict", "(", ")", "for", "file_name", ",", "contig_lengths", "in", "contig_lengths_dict", ".", "items", "(", ")", ":", "currentlength"...
Calculate the L50 for each strain. L50 is defined as the number of contigs required to achieve the N50 :param contig_lengths_dict: dictionary of strain name: reverse-sorted list of all contig lengths :param genome_length_dict: dictionary of strain name: total genome length :return: l50_dict: dictionary of s...
[ "Calculate", "the", "L50", "for", "each", "strain", ".", "L50", "is", "defined", "as", "the", "number", "of", "contigs", "required", "to", "achieve", "the", "N50", ":", "param", "contig_lengths_dict", ":", "dictionary", "of", "strain", "name", ":", "reverse"...
python
train
52.045455
konstantinstadler/pymrio
pymrio/core/fileio.py
https://github.com/konstantinstadler/pymrio/blob/d764aa0dd2150200e867a9713a98ddae203e12d4/pymrio/core/fileio.py#L34-L181
def load_all(path, include_core=True, subfolders=None, path_in_arc=None): """ Loads a full IO system with all extension in path Parameters ---------- path : pathlib.Path or string Path or path with para file name for the data to load. This must either point to the directory containing t...
[ "def", "load_all", "(", "path", ",", "include_core", "=", "True", ",", "subfolders", "=", "None", ",", "path_in_arc", "=", "None", ")", ":", "def", "clean", "(", "varStr", ")", ":", "\"\"\" get valid python name from folder\n \"\"\"", "return", "re", ".",...
Loads a full IO system with all extension in path Parameters ---------- path : pathlib.Path or string Path or path with para file name for the data to load. This must either point to the directory containing the uncompressed data or the location of a compressed zip file with the dat...
[ "Loads", "a", "full", "IO", "system", "with", "all", "extension", "in", "path" ]
python
train
45.452703
tomatohater/django-unfriendly
unfriendly/utils.py
https://github.com/tomatohater/django-unfriendly/blob/38eca5fb45841db331fc66571fff37bef50dfa67/unfriendly/utils.py#L65-L93
def decrypt(ciphertext, secret, inital_vector, checksum=True, lazy=True): """Decrypts ciphertext with secret ciphertext - encrypted content to decrypt secret - secret to decrypt ciphertext inital_vector - initial vector lazy - pad secret if less than legal blocksize (default: ...
[ "def", "decrypt", "(", "ciphertext", ",", "secret", ",", "inital_vector", ",", "checksum", "=", "True", ",", "lazy", "=", "True", ")", ":", "secret", "=", "_lazysecret", "(", "secret", ")", "if", "lazy", "else", "secret", "encobj", "=", "AES", ".", "ne...
Decrypts ciphertext with secret ciphertext - encrypted content to decrypt secret - secret to decrypt ciphertext inital_vector - initial vector lazy - pad secret if less than legal blocksize (default: True) checksum - verify crc32 byte encoded checksum (default: True) ...
[ "Decrypts", "ciphertext", "with", "secret", "ciphertext", "-", "encrypted", "content", "to", "decrypt", "secret", "-", "secret", "to", "decrypt", "ciphertext", "inital_vector", "-", "initial", "vector", "lazy", "-", "pad", "secret", "if", "less", "than", "legal"...
python
test
38.517241
ArduPilot/MAVProxy
MAVProxy/modules/lib/ANUGA/redfearn.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/ANUGA/redfearn.py#L45-L195
def redfearn(lat, lon, false_easting=None, false_northing=None, zone=None, central_meridian=None, scale_factor=None): """Compute UTM projection using Redfearn's formula lat, lon is latitude and longitude in decimal degrees If false easting and northing are specified they will override the...
[ "def", "redfearn", "(", "lat", ",", "lon", ",", "false_easting", "=", "None", ",", "false_northing", "=", "None", ",", "zone", "=", "None", ",", "central_meridian", "=", "None", ",", "scale_factor", "=", "None", ")", ":", "from", "math", "import", "pi", ...
Compute UTM projection using Redfearn's formula lat, lon is latitude and longitude in decimal degrees If false easting and northing are specified they will override the standard If zone is specified reproject lat and long to specified zone instead of standard zone If meridian is specified, r...
[ "Compute", "UTM", "projection", "using", "Redfearn", "s", "formula" ]
python
train
26.370861
shichao-an/115wangpan
u115/api.py
https://github.com/shichao-an/115wangpan/blob/e7cc935313f675e886bceca831fcffcdedf1e880/u115/api.py#L63-L68
def post(self, url, data, params=None): """ Initiate a POST request """ r = self.session.post(url, data=data, params=params) return self._response_parser(r, expect_json=False)
[ "def", "post", "(", "self", ",", "url", ",", "data", ",", "params", "=", "None", ")", ":", "r", "=", "self", ".", "session", ".", "post", "(", "url", ",", "data", "=", "data", ",", "params", "=", "params", ")", "return", "self", ".", "_response_p...
Initiate a POST request
[ "Initiate", "a", "POST", "request" ]
python
train
35
vpelletier/pprofile
pprofile.py
https://github.com/vpelletier/pprofile/blob/51a36896727565faf23e5abccc9204e5f935fe1e/pprofile.py#L520-L629
def callgrind(self, out, filename=None, commandline=None, relative_path=False): """ Dump statistics in callgrind format. Contains: - per-line hit count, time and time-per-hit - call associations (call tree) Note: hit count is not inclusive, in that it is not the sum of ...
[ "def", "callgrind", "(", "self", ",", "out", ",", "filename", "=", "None", ",", "commandline", "=", "None", ",", "relative_path", "=", "False", ")", ":", "print", "(", "u'# callgrind format'", ",", "file", "=", "out", ")", "print", "(", "u'version: 1'", ...
Dump statistics in callgrind format. Contains: - per-line hit count, time and time-per-hit - call associations (call tree) Note: hit count is not inclusive, in that it is not the sum of all hits inside that call. Time unit: microsecond (1e-6 second). out (file...
[ "Dump", "statistics", "in", "callgrind", "format", ".", "Contains", ":", "-", "per", "-", "line", "hit", "count", "time", "and", "time", "-", "per", "-", "hit", "-", "call", "associations", "(", "call", "tree", ")", "Note", ":", "hit", "count", "is", ...
python
train
48.954545
SmokinCaterpillar/pypet
pypet/storageservice.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L4611-L4626
def _prm_get_longest_stringsize(string_list): """ Returns the longest string size for a string entry across data.""" maxlength = 1 for stringar in string_list: if isinstance(stringar, np.ndarray): if stringar.ndim > 0: for string in stringar.ravel...
[ "def", "_prm_get_longest_stringsize", "(", "string_list", ")", ":", "maxlength", "=", "1", "for", "stringar", "in", "string_list", ":", "if", "isinstance", "(", "stringar", ",", "np", ".", "ndarray", ")", ":", "if", "stringar", ".", "ndim", ">", "0", ":", ...
Returns the longest string size for a string entry across data.
[ "Returns", "the", "longest", "string", "size", "for", "a", "string", "entry", "across", "data", "." ]
python
test
42.375
python-openxml/python-docx
docx/text/parfmt.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/parfmt.py#L114-L128
def line_spacing(self): """ |float| or |Length| value specifying the space between baselines in successive lines of the paragraph. A value of |None| indicates line spacing is inherited from the style hierarchy. A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied...
[ "def", "line_spacing", "(", "self", ")", ":", "pPr", "=", "self", ".", "_element", ".", "pPr", "if", "pPr", "is", "None", ":", "return", "None", "return", "self", ".", "_line_spacing", "(", "pPr", ".", "spacing_line", ",", "pPr", ".", "spacing_lineRule",...
|float| or |Length| value specifying the space between baselines in successive lines of the paragraph. A value of |None| indicates line spacing is inherited from the style hierarchy. A float value, e.g. ``2.0`` or ``1.75``, indicates spacing is applied in multiples of line heights. A |Le...
[ "|float|", "or", "|Length|", "value", "specifying", "the", "space", "between", "baselines", "in", "successive", "lines", "of", "the", "paragraph", ".", "A", "value", "of", "|None|", "indicates", "line", "spacing", "is", "inherited", "from", "the", "style", "hi...
python
train
50.933333
Clivern/PyLogging
pylogging/pylogging.py
https://github.com/Clivern/PyLogging/blob/46a1442ec63796302ec7fe3d49bd06a0f7a2fe70/pylogging/pylogging.py#L125-L130
def info(self, msg): """ Log Info Messages """ self._execActions('info', msg) msg = self._execFilters('info', msg) self._processMsg('info', msg) self._sendMsg('info', msg)
[ "def", "info", "(", "self", ",", "msg", ")", ":", "self", ".", "_execActions", "(", "'info'", ",", "msg", ")", "msg", "=", "self", ".", "_execFilters", "(", "'info'", ",", "msg", ")", "self", ".", "_processMsg", "(", "'info'", ",", "msg", ")", "sel...
Log Info Messages
[ "Log", "Info", "Messages" ]
python
train
34.333333
tensorflow/tensor2tensor
tensor2tensor/models/image_transformer.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer.py#L438-L451
def imagetransformerpp_base_8l_8h_big_cond_dr03_dan(): """big 1d model for conditional image generation.2.99 on cifar10.""" hparams = imagetransformerpp_sep_channels_8l_8h() hparams.hidden_size = 512 hparams.num_heads = 8 hparams.filter_size = 2048 hparams.batch_size = 4 hparams.max_length = 3075 hparam...
[ "def", "imagetransformerpp_base_8l_8h_big_cond_dr03_dan", "(", ")", ":", "hparams", "=", "imagetransformerpp_sep_channels_8l_8h", "(", ")", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "num_heads", "=", "8", "hparams", ".", "filter_size", "=", "2048", ...
big 1d model for conditional image generation.2.99 on cifar10.
[ "big", "1d", "model", "for", "conditional", "image", "generation", ".", "2", ".", "99", "on", "cifar10", "." ]
python
train
36.714286
bcbio/bcbio-nextgen
bcbio/cwl/create.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L736-L743
def _add_secondary_if_exists(secondary, out, get_retriever): """Add secondary files only if present locally or remotely. """ secondary = [_file_local_or_remote(y, get_retriever) for y in secondary] secondary = [z for z in secondary if z] if secondary: out["secondaryFiles"] = [{"class": "File...
[ "def", "_add_secondary_if_exists", "(", "secondary", ",", "out", ",", "get_retriever", ")", ":", "secondary", "=", "[", "_file_local_or_remote", "(", "y", ",", "get_retriever", ")", "for", "y", "in", "secondary", "]", "secondary", "=", "[", "z", "for", "z", ...
Add secondary files only if present locally or remotely.
[ "Add", "secondary", "files", "only", "if", "present", "locally", "or", "remotely", "." ]
python
train
45.125
twisted/mantissa
xmantissa/website.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/website.py#L194-L223
def _produceIt(self, segments, thunk): """ Underlying implmeentation of L{PrefixURLMixin.produceResource} and L{PrefixURLMixin.sessionlessProduceResource}. @param segments: the URL segments to dispatch. @param thunk: a 0-argument callable which returns an L{IResource} p...
[ "def", "_produceIt", "(", "self", ",", "segments", ",", "thunk", ")", ":", "if", "not", "self", ".", "prefixURL", ":", "needle", "=", "(", ")", "else", ":", "needle", "=", "tuple", "(", "self", ".", "prefixURL", ".", "split", "(", "'/'", ")", ")", ...
Underlying implmeentation of L{PrefixURLMixin.produceResource} and L{PrefixURLMixin.sessionlessProduceResource}. @param segments: the URL segments to dispatch. @param thunk: a 0-argument callable which returns an L{IResource} provider, or None. @return: a 2-tuple of C{(resourc...
[ "Underlying", "implmeentation", "of", "L", "{", "PrefixURLMixin", ".", "produceResource", "}", "and", "L", "{", "PrefixURLMixin", ".", "sessionlessProduceResource", "}", "." ]
python
train
37.733333
WhyNotHugo/django-afip
django_afip/models.py
https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/models.py#L343-L359
def generate_csr(self, basename='djangoafip'): """ Creates a CSR for this TaxPayer's key Creates a file-like object that contains the CSR which can be used to request a new certificate from AFIP. """ csr = BytesIO() crypto.create_csr( self.key.file, ...
[ "def", "generate_csr", "(", "self", ",", "basename", "=", "'djangoafip'", ")", ":", "csr", "=", "BytesIO", "(", ")", "crypto", ".", "create_csr", "(", "self", ".", "key", ".", "file", ",", "self", ".", "name", ",", "'{}{}'", ".", "format", "(", "base...
Creates a CSR for this TaxPayer's key Creates a file-like object that contains the CSR which can be used to request a new certificate from AFIP.
[ "Creates", "a", "CSR", "for", "this", "TaxPayer", "s", "key" ]
python
train
29.529412
benjamin-hodgson/asynqp
src/asynqp/channel.py
https://github.com/benjamin-hodgson/asynqp/blob/ea8630d1803d10d4fd64b1a0e50f3097710b34d1/src/asynqp/channel.py#L126-L153
def set_qos(self, prefetch_size=0, prefetch_count=0, apply_globally=False): """ Specify quality of service by requesting that messages be pre-fetched from the server. Pre-fetching means that the server will deliver messages to the client while the client is still processing unacknowledge...
[ "def", "set_qos", "(", "self", ",", "prefetch_size", "=", "0", ",", "prefetch_count", "=", "0", ",", "apply_globally", "=", "False", ")", ":", "self", ".", "sender", ".", "send_BasicQos", "(", "prefetch_size", ",", "prefetch_count", ",", "apply_globally", ")...
Specify quality of service by requesting that messages be pre-fetched from the server. Pre-fetching means that the server will deliver messages to the client while the client is still processing unacknowledged messages. This method is a :ref:`coroutine <coroutine>`. :param int prefetch...
[ "Specify", "quality", "of", "service", "by", "requesting", "that", "messages", "be", "pre", "-", "fetched", "from", "the", "server", ".", "Pre", "-", "fetching", "means", "that", "the", "server", "will", "deliver", "messages", "to", "the", "client", "while",...
python
train
59.214286
wonambi-python/wonambi
wonambi/attr/chan.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L427-L450
def find_channel_groups(chan): """Channels are often organized in groups (different grids / strips or channels in different brain locations), so we use a simple heuristic to get these channel groups. Parameters ---------- chan : instance of Channels channels to group Returns --...
[ "def", "find_channel_groups", "(", "chan", ")", ":", "labels", "=", "chan", ".", "return_label", "(", ")", "group_names", "=", "{", "match", "(", "'([A-Za-z ]+)\\d+'", ",", "label", ")", ".", "group", "(", "1", ")", "for", "label", "in", "labels", "}", ...
Channels are often organized in groups (different grids / strips or channels in different brain locations), so we use a simple heuristic to get these channel groups. Parameters ---------- chan : instance of Channels channels to group Returns ------- groups : dict channe...
[ "Channels", "are", "often", "organized", "in", "groups", "(", "different", "grids", "/", "strips", "or", "channels", "in", "different", "brain", "locations", ")", "so", "we", "use", "a", "simple", "heuristic", "to", "get", "these", "channel", "groups", "." ]
python
train
28.875
Duke-GCB/DukeDSClient
ddsc/core/localstore.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/localstore.py#L77-L87
def _update_remote_children(remote_parent, children): """ Update remote_ids based on on parent matching up the names of children. :param remote_parent: RemoteProject/RemoteFolder who has children :param children: [LocalFolder,LocalFile] children to set remote_ids based on remote children """ nam...
[ "def", "_update_remote_children", "(", "remote_parent", ",", "children", ")", ":", "name_to_child", "=", "_name_to_child_map", "(", "children", ")", "for", "remote_child", "in", "remote_parent", ".", "children", ":", "local_child", "=", "name_to_child", ".", "get", ...
Update remote_ids based on on parent matching up the names of children. :param remote_parent: RemoteProject/RemoteFolder who has children :param children: [LocalFolder,LocalFile] children to set remote_ids based on remote children
[ "Update", "remote_ids", "based", "on", "on", "parent", "matching", "up", "the", "names", "of", "children", ".", ":", "param", "remote_parent", ":", "RemoteProject", "/", "RemoteFolder", "who", "has", "children", ":", "param", "children", ":", "[", "LocalFolder...
python
train
48.909091
pazz/alot
alot/account.py
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/account.py#L82-L93
def from_string(cls, address, case_sensitive=False): """Alternate constructor for building from a string. :param str address: An email address in <user>@<domain> form :param bool case_sensitive: passed directly to the constructor argument of the same name. :returns: An accou...
[ "def", "from_string", "(", "cls", ",", "address", ",", "case_sensitive", "=", "False", ")", ":", "assert", "isinstance", "(", "address", ",", "str", ")", ",", "'address must be str'", "username", ",", "domainname", "=", "address", ".", "split", "(", "'@'", ...
Alternate constructor for building from a string. :param str address: An email address in <user>@<domain> form :param bool case_sensitive: passed directly to the constructor argument of the same name. :returns: An account from the given arguments :rtype: :class:`Account`
[ "Alternate", "constructor", "for", "building", "from", "a", "string", "." ]
python
train
47.166667
galactics/beyond
beyond/frames/iau2010.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau2010.py#L135-L185
def _xysxy2(date): """Here we deviate from what has been done everywhere else. Instead of taking the formulas available in the Vallado, we take those described in the files tab5.2{a,b,d}.txt. The result should be equivalent, but they are the last iteration of the IAU2000A as of June 2016 Args: ...
[ "def", "_xysxy2", "(", "date", ")", ":", "planets", "=", "_planets", "(", "date", ")", "x_tab", ",", "y_tab", ",", "s_tab", "=", "_tab", "(", "'X'", ")", ",", "_tab", "(", "'Y'", ")", ",", "_tab", "(", "'s'", ")", "ttt", "=", "date", ".", "chan...
Here we deviate from what has been done everywhere else. Instead of taking the formulas available in the Vallado, we take those described in the files tab5.2{a,b,d}.txt. The result should be equivalent, but they are the last iteration of the IAU2000A as of June 2016 Args: date (Date) Return: ...
[ "Here", "we", "deviate", "from", "what", "has", "been", "done", "everywhere", "else", ".", "Instead", "of", "taking", "the", "formulas", "available", "in", "the", "Vallado", "we", "take", "those", "described", "in", "the", "files", "tab5", ".", "2", "{", ...
python
train
33.196078
keon/algorithms
algorithms/dfs/all_factors.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/dfs/all_factors.py#L87-L111
def get_factors_iterative2(n): """[summary] analog as above Arguments: n {[int]} -- [description] Returns: [list of lists] -- [all factors of n] """ ans, stack, x = [], [], 2 while True: if x > n // x: if not stack: return ans ...
[ "def", "get_factors_iterative2", "(", "n", ")", ":", "ans", ",", "stack", ",", "x", "=", "[", "]", ",", "[", "]", ",", "2", "while", "True", ":", "if", "x", ">", "n", "//", "x", ":", "if", "not", "stack", ":", "return", "ans", "ans", ".", "ap...
[summary] analog as above Arguments: n {[int]} -- [description] Returns: [list of lists] -- [all factors of n]
[ "[", "summary", "]", "analog", "as", "above" ]
python
train
19.88
gem/oq-engine
openquake/hmtk/seismicity/smoothing/utils.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/seismicity/smoothing/utils.py#L75-L93
def incremental_a_value(bval, min_mag, mag_inc): ''' Incremental a-value from cumulative - using the version of the Hermann (1979) formula described in Wesson et al. (2003) :param float bval: Gutenberg & Richter (1944) b-value :param np.ndarray min_mag: Minimum magnitude of complet...
[ "def", "incremental_a_value", "(", "bval", ",", "min_mag", ",", "mag_inc", ")", ":", "a_cum", "=", "10.", "**", "(", "bval", "*", "min_mag", ")", "a_inc", "=", "a_cum", "+", "np", ".", "log10", "(", "(", "10.", "**", "(", "bval", "*", "mag_inc", ")...
Incremental a-value from cumulative - using the version of the Hermann (1979) formula described in Wesson et al. (2003) :param float bval: Gutenberg & Richter (1944) b-value :param np.ndarray min_mag: Minimum magnitude of completeness table :param float mag_inc: Magnitude incr...
[ "Incremental", "a", "-", "value", "from", "cumulative", "-", "using", "the", "version", "of", "the", "Hermann", "(", "1979", ")", "formula", "described", "in", "Wesson", "et", "al", ".", "(", "2003", ")" ]
python
train
30
StanfordVL/robosuite
robosuite/wrappers/ik_wrapper.py
https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/wrappers/ik_wrapper.py#L116-L126
def _make_input(self, action, old_quat): """ Helper function that returns a dictionary with keys dpos, rotation from a raw input array. The first three elements are taken to be displacement in position, and a quaternion indicating the change in rotation with respect to @old_quat. ...
[ "def", "_make_input", "(", "self", ",", "action", ",", "old_quat", ")", ":", "return", "{", "\"dpos\"", ":", "action", "[", ":", "3", "]", ",", "# IK controller takes an absolute orientation in robot base frame", "\"rotation\"", ":", "T", ".", "quat2mat", "(", "...
Helper function that returns a dictionary with keys dpos, rotation from a raw input array. The first three elements are taken to be displacement in position, and a quaternion indicating the change in rotation with respect to @old_quat.
[ "Helper", "function", "that", "returns", "a", "dictionary", "with", "keys", "dpos", "rotation", "from", "a", "raw", "input", "array", ".", "The", "first", "three", "elements", "are", "taken", "to", "be", "displacement", "in", "position", "and", "a", "quatern...
python
train
47.909091
RockFeng0/rtsf-web
webuidriver/actions.py
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L221-L232
def _elements(cls): ''' find the elements with controls ''' if not cls.__is_selector(): raise Exception("Invalid selector[%s]." %cls.__control["by"]) driver = Web.driver try: elements = WebDriverWait(driver, cls.__control["timeout"])....
[ "def", "_elements", "(", "cls", ")", ":", "if", "not", "cls", ".", "__is_selector", "(", ")", ":", "raise", "Exception", "(", "\"Invalid selector[%s].\"", "%", "cls", ".", "__control", "[", "\"by\"", "]", ")", "driver", "=", "Web", ".", "driver", "try", ...
find the elements with controls
[ "find", "the", "elements", "with", "controls" ]
python
train
50
binux/pyspider
pyspider/libs/utils.py
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/libs/utils.py#L38-L51
def hide_me(tb, g=globals()): """Hide stack traceback of given stack""" base_tb = tb try: while tb and tb.tb_frame.f_globals is not g: tb = tb.tb_next while tb and tb.tb_frame.f_globals is g: tb = tb.tb_next except Exception as e: logging.exception(e) ...
[ "def", "hide_me", "(", "tb", ",", "g", "=", "globals", "(", ")", ")", ":", "base_tb", "=", "tb", "try", ":", "while", "tb", "and", "tb", ".", "tb_frame", ".", "f_globals", "is", "not", "g", ":", "tb", "=", "tb", ".", "tb_next", "while", "tb", "...
Hide stack traceback of given stack
[ "Hide", "stack", "traceback", "of", "given", "stack" ]
python
train
26.642857
matiasb/python-unrar
unrar/rarfile.py
https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/rarfile.py#L247-L252
def namelist(self): """Return a list of file names in the archive.""" names = [] for member in self.filelist: names.append(member.filename) return names
[ "def", "namelist", "(", "self", ")", ":", "names", "=", "[", "]", "for", "member", "in", "self", ".", "filelist", ":", "names", ".", "append", "(", "member", ".", "filename", ")", "return", "names" ]
Return a list of file names in the archive.
[ "Return", "a", "list", "of", "file", "names", "in", "the", "archive", "." ]
python
valid
31.833333
suds-community/suds
suds/sax/element.py
https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/element.py#L299-L310
def namespace(self): """ Get the element's namespace. @return: The element's namespace by resolving the prefix, the explicit namespace or the inherited namespace. @rtype: (I{prefix}, I{name}) """ if self.prefix is None: return self.defaultNamespa...
[ "def", "namespace", "(", "self", ")", ":", "if", "self", ".", "prefix", "is", "None", ":", "return", "self", ".", "defaultNamespace", "(", ")", "return", "self", ".", "resolvePrefix", "(", "self", ".", "prefix", ")" ]
Get the element's namespace. @return: The element's namespace by resolving the prefix, the explicit namespace or the inherited namespace. @rtype: (I{prefix}, I{name})
[ "Get", "the", "element", "s", "namespace", "." ]
python
train
30
vertexproject/synapse
synapse/lib/migrate.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/migrate.py#L53-L75
async def delayNdefProps(self): ''' Hold this during a series of renames to delay ndef secondary property processing until the end.... ''' async with self.getTempSlab() as slab: seqn = s_slabseqn.SlabSeqn(slab, 'ndef') self.ndefdelay = seqn ...
[ "async", "def", "delayNdefProps", "(", "self", ")", ":", "async", "with", "self", ".", "getTempSlab", "(", ")", "as", "slab", ":", "seqn", "=", "s_slabseqn", ".", "SlabSeqn", "(", "slab", ",", "'ndef'", ")", "self", ".", "ndefdelay", "=", "seqn", "yiel...
Hold this during a series of renames to delay ndef secondary property processing until the end....
[ "Hold", "this", "during", "a", "series", "of", "renames", "to", "delay", "ndef", "secondary", "property", "processing", "until", "the", "end", "...." ]
python
train
28.782609
zxylvlp/PingPHP
pingphp/grammar.py
https://github.com/zxylvlp/PingPHP/blob/2e9a5f1ef4b5b13310e3f8ff350fa91032357bc5/pingphp/grammar.py#L1225-L1229
def p_FuncDef(p): ''' FuncDef : DEF RefModifier INDENTIFIER LPARENT ParamList RPARENT COLON ReturnTypeModifier Terminator Block ''' p[0] = FuncDef(p[2], p[3], p[5], p[8], p[9], p[10])
[ "def", "p_FuncDef", "(", "p", ")", ":", "p", "[", "0", "]", "=", "FuncDef", "(", "p", "[", "2", "]", ",", "p", "[", "3", "]", ",", "p", "[", "5", "]", ",", "p", "[", "8", "]", ",", "p", "[", "9", "]", ",", "p", "[", "10", "]", ")" ]
FuncDef : DEF RefModifier INDENTIFIER LPARENT ParamList RPARENT COLON ReturnTypeModifier Terminator Block
[ "FuncDef", ":", "DEF", "RefModifier", "INDENTIFIER", "LPARENT", "ParamList", "RPARENT", "COLON", "ReturnTypeModifier", "Terminator", "Block" ]
python
train
39
ThreatConnect-Inc/tcex
tcex/tcex_cache.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_cache.py#L62-L92
def get(self, rid, data_callback=None, raise_on_error=True): """Get cached data from the data store. Args: rid (str): The record identifier. data_callback (callable): A method that will return the data. raise_on_error (bool): If True and not r.ok this method will rai...
[ "def", "get", "(", "self", ",", "rid", ",", "data_callback", "=", "None", ",", "raise_on_error", "=", "True", ")", ":", "cached_data", "=", "None", "ds_data", "=", "self", ".", "ds", ".", "get", "(", "rid", ",", "raise_on_error", "=", "False", ")", "...
Get cached data from the data store. Args: rid (str): The record identifier. data_callback (callable): A method that will return the data. raise_on_error (bool): If True and not r.ok this method will raise a RunTimeError. Returns: object : Python request...
[ "Get", "cached", "data", "from", "the", "data", "store", "." ]
python
train
47
saltstack/salt
salt/utils/aws.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L543-L579
def get_region_from_metadata(): ''' Try to get region from instance identity document and cache it .. versionadded:: 2015.5.6 ''' global __Location__ if __Location__ == 'do-not-get-from-metadata': log.debug('Previously failed to get AWS region from metadata. Not trying again.') ...
[ "def", "get_region_from_metadata", "(", ")", ":", "global", "__Location__", "if", "__Location__", "==", "'do-not-get-from-metadata'", ":", "log", ".", "debug", "(", "'Previously failed to get AWS region from metadata. Not trying again.'", ")", "return", "None", "# Cached regi...
Try to get region from instance identity document and cache it .. versionadded:: 2015.5.6
[ "Try", "to", "get", "region", "from", "instance", "identity", "document", "and", "cache", "it" ]
python
train
30.540541
saltstack/salt
salt/modules/inspectlib/kiwiproc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/kiwiproc.py#L247-L257
def _create_doc(self): ''' Create document. :return: ''' root = etree.Element('image') root.set('schemaversion', '6.3') root.set('name', self.name) return root
[ "def", "_create_doc", "(", "self", ")", ":", "root", "=", "etree", ".", "Element", "(", "'image'", ")", "root", ".", "set", "(", "'schemaversion'", ",", "'6.3'", ")", "root", ".", "set", "(", "'name'", ",", "self", ".", "name", ")", "return", "root" ...
Create document. :return:
[ "Create", "document", "." ]
python
train
19.545455
mkouhei/bootstrap-py
bootstrap_py/classifiers.py
https://github.com/mkouhei/bootstrap-py/blob/95d56ed98ef409fd9f019dc352fd1c3711533275/bootstrap_py/classifiers.py#L43-L46
def licenses(self): """OSI Approved license.""" return {self._acronym_lic(l): l for l in self.resp_text.split('\n') if l.startswith(self.prefix_lic)}
[ "def", "licenses", "(", "self", ")", ":", "return", "{", "self", ".", "_acronym_lic", "(", "l", ")", ":", "l", "for", "l", "in", "self", ".", "resp_text", ".", "split", "(", "'\\n'", ")", "if", "l", ".", "startswith", "(", "self", ".", "prefix_lic"...
OSI Approved license.
[ "OSI", "Approved", "license", "." ]
python
train
44.5
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L908-L920
def as_proto(self): """Returns this shape as a `TensorShapeProto`.""" if self._dims is None: return tensor_shape_pb2.TensorShapeProto(unknown_rank=True) else: return tensor_shape_pb2.TensorShapeProto( dim=[ tensor_shape_pb2.TensorShapeP...
[ "def", "as_proto", "(", "self", ")", ":", "if", "self", ".", "_dims", "is", "None", ":", "return", "tensor_shape_pb2", ".", "TensorShapeProto", "(", "unknown_rank", "=", "True", ")", "else", ":", "return", "tensor_shape_pb2", ".", "TensorShapeProto", "(", "d...
Returns this shape as a `TensorShapeProto`.
[ "Returns", "this", "shape", "as", "a", "TensorShapeProto", "." ]
python
train
36.538462
klen/flask-pw
flask_pw/__init__.py
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L147-L158
def cmd_rollback(self, name): """Rollback migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], ...
[ "def", "cmd_rollback", "(", "self", ",", "name", ")", ":", "from", "peewee_migrate", ".", "router", "import", "Router", ",", "LOGGER", "LOGGER", ".", "setLevel", "(", "'INFO'", ")", "LOGGER", ".", "propagate", "=", "0", "router", "=", "Router", "(", "sel...
Rollback migrations.
[ "Rollback", "migrations", "." ]
python
train
33.083333
lambdamusic/Ontospy
ontospy/core/sparqlHelper.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/core/sparqlHelper.py#L331-L349
def getPropAllSupers(self, aURI): """ note: requires SPARQL 1.1 2015-06-04: currenlty not used, inferred from above """ aURI = aURI try: qres = self.rdflib_graph.query("""SELECT DISTINCT ?x WHERE { { <%s> rdfs:subP...
[ "def", "getPropAllSupers", "(", "self", ",", "aURI", ")", ":", "aURI", "=", "aURI", "try", ":", "qres", "=", "self", ".", "rdflib_graph", ".", "query", "(", "\"\"\"SELECT DISTINCT ?x\n WHERE {\n { <%s> rdfs:subPropertyOf+ ?x }\n ...
note: requires SPARQL 1.1 2015-06-04: currenlty not used, inferred from above
[ "note", ":", "requires", "SPARQL", "1", ".", "1", "2015", "-", "06", "-", "04", ":", "currenlty", "not", "used", "inferred", "from", "above" ]
python
train
33
Kozea/pygal
pygal/graph/map.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/map.py#L53-L60
def _value_format(self, value): """ Format value for map value display. """ return '%s: %s' % ( self.area_names.get(self.adapt_code(value[0]), '?'), self._y_format(value[1]) )
[ "def", "_value_format", "(", "self", ",", "value", ")", ":", "return", "'%s: %s'", "%", "(", "self", ".", "area_names", ".", "get", "(", "self", ".", "adapt_code", "(", "value", "[", "0", "]", ")", ",", "'?'", ")", ",", "self", ".", "_y_format", "(...
Format value for map value display.
[ "Format", "value", "for", "map", "value", "display", "." ]
python
train
29
gabstopper/smc-python
smc/core/interfaces.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1750-L1765
def delete(self): """ Delete this Vlan interface from the parent interface. This will also remove stale routes if the interface has networks associated with it. :return: None """ if self in self._parent.vlan_interface: self._parent.data['vlanI...
[ "def", "delete", "(", "self", ")", ":", "if", "self", "in", "self", ".", "_parent", ".", "vlan_interface", ":", "self", ".", "_parent", ".", "data", "[", "'vlanInterfaces'", "]", "=", "[", "v", "for", "v", "in", "self", ".", "_parent", ".", "vlan_int...
Delete this Vlan interface from the parent interface. This will also remove stale routes if the interface has networks associated with it. :return: None
[ "Delete", "this", "Vlan", "interface", "from", "the", "parent", "interface", ".", "This", "will", "also", "remove", "stale", "routes", "if", "the", "interface", "has", "networks", "associated", "with", "it", ".", ":", "return", ":", "None" ]
python
train
34.8125
numenta/nupic
src/nupic/database/client_jobs_dao.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L618-L643
def connect(self, deleteOldVersions=False, recreate=False): """ Locate the current version of the jobs DB or create a new one, and optionally delete old versions laying around. If desired, this method can be called at any time to re-create the tables from scratch, delete old versions of the database, et...
[ "def", "connect", "(", "self", ",", "deleteOldVersions", "=", "False", ",", "recreate", "=", "False", ")", ":", "# Initialize tables, if needed", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "# Initialize tables", "self", ".", "_initTabl...
Locate the current version of the jobs DB or create a new one, and optionally delete old versions laying around. If desired, this method can be called at any time to re-create the tables from scratch, delete old versions of the database, etc. Parameters: --------------------------------------------...
[ "Locate", "the", "current", "version", "of", "the", "jobs", "DB", "or", "create", "a", "new", "one", "and", "optionally", "delete", "old", "versions", "laying", "around", ".", "If", "desired", "this", "method", "can", "be", "called", "at", "any", "time", ...
python
valid
41.423077
stevearc/dql
dql/engine.py
https://github.com/stevearc/dql/blob/e9d3aa22873076dae5ebd02e35318aa996b1e56a/dql/engine.py#L77-L94
def iter_insert_items(tree): """ Iterate over the items to insert from an INSERT statement """ if tree.list_values: keys = tree.attrs for values in tree.list_values: if len(keys) != len(values): raise SyntaxError( "Values '%s' do not match attribut...
[ "def", "iter_insert_items", "(", "tree", ")", ":", "if", "tree", ".", "list_values", ":", "keys", "=", "tree", ".", "attrs", "for", "values", "in", "tree", ".", "list_values", ":", "if", "len", "(", "keys", ")", "!=", "len", "(", "values", ")", ":", ...
Iterate over the items to insert from an INSERT statement
[ "Iterate", "over", "the", "items", "to", "insert", "from", "an", "INSERT", "statement" ]
python
train
36.111111
pyca/pynacl
src/nacl/hash.py
https://github.com/pyca/pynacl/blob/0df0c2c7693fa5d316846111ce510702756f5feb/src/nacl/hash.py#L60-L70
def sha256(message, encoder=nacl.encoding.HexEncoder): """ Hashes ``message`` with SHA256. :param message: The message to hash. :type message: bytes :param encoder: A class that is able to encode the hashed message. :returns: The hashed message. :rtype: bytes """ return encoder.enco...
[ "def", "sha256", "(", "message", ",", "encoder", "=", "nacl", ".", "encoding", ".", "HexEncoder", ")", ":", "return", "encoder", ".", "encode", "(", "nacl", ".", "bindings", ".", "crypto_hash_sha256", "(", "message", ")", ")" ]
Hashes ``message`` with SHA256. :param message: The message to hash. :type message: bytes :param encoder: A class that is able to encode the hashed message. :returns: The hashed message. :rtype: bytes
[ "Hashes", "message", "with", "SHA256", "." ]
python
train
32.272727
saltstack/salt
salt/beacons/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/__init__.py#L186-L192
def _remove_list_item(self, beacon_config, label): ''' Remove an item from a beacon config list ''' index = self._get_index(beacon_config, label) del beacon_config[index]
[ "def", "_remove_list_item", "(", "self", ",", "beacon_config", ",", "label", ")", ":", "index", "=", "self", ".", "_get_index", "(", "beacon_config", ",", "label", ")", "del", "beacon_config", "[", "index", "]" ]
Remove an item from a beacon config list
[ "Remove", "an", "item", "from", "a", "beacon", "config", "list" ]
python
train
29.285714
mabuchilab/QNET
src/qnet/algebra/pattern_matching/__init__.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/pattern_matching/__init__.py#L232-L246
def extended_arg_patterns(self): """Iterator over patterns for positional arguments to be matched This yields the elements of :attr:`args`, extended by their `mode` value """ for arg in self._arg_iterator(self.args): if isinstance(arg, Pattern): if ar...
[ "def", "extended_arg_patterns", "(", "self", ")", ":", "for", "arg", "in", "self", ".", "_arg_iterator", "(", "self", ".", "args", ")", ":", "if", "isinstance", "(", "arg", ",", "Pattern", ")", ":", "if", "arg", ".", "mode", ">", "self", ".", "single...
Iterator over patterns for positional arguments to be matched This yields the elements of :attr:`args`, extended by their `mode` value
[ "Iterator", "over", "patterns", "for", "positional", "arguments", "to", "be", "matched" ]
python
train
32.6
ytjia/utils-py
utils_py/time_seg_util.py
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/time_seg_util.py#L53-L64
def get_still_seg_belonged(dt_str, seg_duration, fmt='%Y-%m-%d %H:%M:%S'): """ 获取该时刻所属的非滑动时间片 :param dt_str: datetime string, eg: 2016-10-31 12:22:11 :param seg_duration: 时间片长度, unit: minute :param fmt: datetime string format :return: """ dt = time_util.str_to_datetime(dt_str, fmt) m...
[ "def", "get_still_seg_belonged", "(", "dt_str", ",", "seg_duration", ",", "fmt", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "dt", "=", "time_util", ".", "str_to_datetime", "(", "dt_str", ",", "fmt", ")", "minutes_of_day", "=", "time_util", ".", "get_minutes_of_day", ...
获取该时刻所属的非滑动时间片 :param dt_str: datetime string, eg: 2016-10-31 12:22:11 :param seg_duration: 时间片长度, unit: minute :param fmt: datetime string format :return:
[ "获取该时刻所属的非滑动时间片", ":", "param", "dt_str", ":", "datetime", "string", "eg", ":", "2016", "-", "10", "-", "31", "12", ":", "22", ":", "11", ":", "param", "seg_duration", ":", "时间片长度", "unit", ":", "minute", ":", "param", "fmt", ":", "datetime", "string",...
python
train
38.25
ioos/compliance-checker
compliance_checker/cf/cf.py
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L1969-L2044
def check_calendar(self, ds): ''' Check the calendar attribute for variables defining time and ensure it is a valid calendar prescribed by CF. CF §4.4.1 In order to calculate a new date and time given a base date, base time and a time increment one must know what calendar to use...
[ "def", "check_calendar", "(", "self", ",", "ds", ")", ":", "valid_calendars", "=", "[", "'gregorian'", ",", "'standard'", ",", "'proleptic_gregorian'", ",", "'noleap'", ",", "'365_day'", ",", "'all_leap'", ",", "'366_day'", ",", "'360_day'", ",", "'julian'", "...
Check the calendar attribute for variables defining time and ensure it is a valid calendar prescribed by CF. CF §4.4.1 In order to calculate a new date and time given a base date, base time and a time increment one must know what calendar to use. The values currently defined for calend...
[ "Check", "the", "calendar", "attribute", "for", "variables", "defining", "time", "and", "ensure", "it", "is", "a", "valid", "calendar", "prescribed", "by", "CF", "." ]
python
train
35.855263
jeffh/describe
describe/matchers/core.py
https://github.com/jeffh/describe/blob/6a33ffecc3340b57e60bc8a7095521882ff9a156/describe/matchers/core.py#L28-L34
def asserts(self, *args, **kwargs): """Wraps match method and places under an assertion. Override this for higher-level control, such as returning a custom object for additional validation (e.g. expect().to.change()) """ result = self.match(*args, **kwargs) self.expect(resul...
[ "def", "asserts", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "self", ".", "match", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "expect", "(", "result", ")", "return", "result" ]
Wraps match method and places under an assertion. Override this for higher-level control, such as returning a custom object for additional validation (e.g. expect().to.change())
[ "Wraps", "match", "method", "and", "places", "under", "an", "assertion", ".", "Override", "this", "for", "higher", "-", "level", "control", "such", "as", "returning", "a", "custom", "object", "for", "additional", "validation", "(", "e", ".", "g", ".", "exp...
python
train
48.428571
envi-idl/envipyengine
envipyengine/taskengine/engine.py
https://github.com/envi-idl/envipyengine/blob/567b639d6592deec3289f6122a9e3d18f2f98432/envipyengine/taskengine/engine.py#L37-L45
def tasks(self): """ Returns a list of all tasks known to the engine. :return: A list of task names. """ task_input = {'taskName': 'QueryTaskCatalog'} output = taskengine.execute(task_input, self._engine_name, cwd=self._cwd) return output['outputParameters']['TAS...
[ "def", "tasks", "(", "self", ")", ":", "task_input", "=", "{", "'taskName'", ":", "'QueryTaskCatalog'", "}", "output", "=", "taskengine", ".", "execute", "(", "task_input", ",", "self", ".", "_engine_name", ",", "cwd", "=", "self", ".", "_cwd", ")", "ret...
Returns a list of all tasks known to the engine. :return: A list of task names.
[ "Returns", "a", "list", "of", "all", "tasks", "known", "to", "the", "engine", "." ]
python
train
35.111111
danilobellini/audiolazy
examples/save_and_memoize_synth.py
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/examples/save_and_memoize_synth.py#L147-L166
def unpitched_low(dur, idx): """ Non-harmonic bass/lower frequency sound as a list (due to memoization). Parameters ---------- dur: Duration, in samples. idx: Zero or one (integer), for a small difference to the sound played. Returns ------- A list with the synthesized note. """ env = s...
[ "def", "unpitched_low", "(", "dur", ",", "idx", ")", ":", "env", "=", "sinusoid", "(", "lag2freq", "(", "dur", "*", "2", ")", ")", ".", "limit", "(", "dur", ")", "**", "2", "freq", "=", "40", "+", "20", "*", "sinusoid", "(", "1000", "*", "Hz", ...
Non-harmonic bass/lower frequency sound as a list (due to memoization). Parameters ---------- dur: Duration, in samples. idx: Zero or one (integer), for a small difference to the sound played. Returns ------- A list with the synthesized note.
[ "Non", "-", "harmonic", "bass", "/", "lower", "frequency", "sound", "as", "a", "list", "(", "due", "to", "memoization", ")", "." ]
python
train
25.35
tk0miya/tk.phpautodoc
src/phply/phpparse.py
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phpparse.py#L402-L411
def p_case_list(p): '''case_list : empty | case_list CASE expr case_separator inner_statement_list | case_list DEFAULT case_separator inner_statement_list''' if len(p) == 6: p[0] = p[1] + [ast.Case(p[3], p[5], lineno=p.lineno(2))] elif len(p) == 5: p[0] = p[...
[ "def", "p_case_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "6", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+", "[", "ast", ".", "Case", "(", "p", "[", "3", "]", ",", "p", "[", "5", "]", ",", "lineno", "=", "p"...
case_list : empty | case_list CASE expr case_separator inner_statement_list | case_list DEFAULT case_separator inner_statement_list
[ "case_list", ":", "empty", "|", "case_list", "CASE", "expr", "case_separator", "inner_statement_list", "|", "case_list", "DEFAULT", "case_separator", "inner_statement_list" ]
python
train
38.3
xzased/lvm2py
lvm2py/vg.py
https://github.com/xzased/lvm2py/blob/34ce69304531a474c2fe4a4009ca445a8c103cd6/lvm2py/vg.py#L446-L485
def create_lv(self, name, length, units): """ Creates a logical volume and returns the LogicalVolume instance associated with the lv_t handle:: from lvm2py import * lvm = LVM() vg = lvm.get_vg("myvg", "w") lv = vg.create_lv("mylv", 40, "MiB") ...
[ "def", "create_lv", "(", "self", ",", "name", ",", "length", ",", "units", ")", ":", "if", "units", "!=", "\"%\"", ":", "size", "=", "size_units", "[", "units", "]", "*", "length", "else", ":", "if", "not", "(", "0", "<", "length", "<=", "100", "...
Creates a logical volume and returns the LogicalVolume instance associated with the lv_t handle:: from lvm2py import * lvm = LVM() vg = lvm.get_vg("myvg", "w") lv = vg.create_lv("mylv", 40, "MiB") *Args:* * name (str): The des...
[ "Creates", "a", "logical", "volume", "and", "returns", "the", "LogicalVolume", "instance", "associated", "with", "the", "lv_t", "handle", "::" ]
python
train
30.85
quantopian/zipline
zipline/__main__.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/__main__.py#L383-L391
def clean(bundle, before, after, keep_last): """Clean up data downloaded with the ingest command. """ bundles_module.clean( bundle, before, after, keep_last, )
[ "def", "clean", "(", "bundle", ",", "before", ",", "after", ",", "keep_last", ")", ":", "bundles_module", ".", "clean", "(", "bundle", ",", "before", ",", "after", ",", "keep_last", ",", ")" ]
Clean up data downloaded with the ingest command.
[ "Clean", "up", "data", "downloaded", "with", "the", "ingest", "command", "." ]
python
train
22.111111
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/exportxml.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/exportxml.py#L242-L245
def parse_child_elements(self, element): '''parses all children of an etree element''' for child in element.iterchildren(): self.parsers[child.tag](child)
[ "def", "parse_child_elements", "(", "self", ",", "element", ")", ":", "for", "child", "in", "element", ".", "iterchildren", "(", ")", ":", "self", ".", "parsers", "[", "child", ".", "tag", "]", "(", "child", ")" ]
parses all children of an etree element
[ "parses", "all", "children", "of", "an", "etree", "element" ]
python
train
44.75
trailofbits/protofuzz
protofuzz/gen.py
https://github.com/trailofbits/protofuzz/blob/589492d34de9a0da6cc5554094e2588b893b2fd8/protofuzz/gen.py#L130-L152
def make_dependent(self, source, target, action): ''' Create a dependency between path 'source' and path 'target' via the callable 'action'. >>> permuter._generators [IterValueGenerator(one), IterValueGenerator(two)] >>> permuter.make_dependent('one', 'two', lambda x: x ...
[ "def", "make_dependent", "(", "self", ",", "source", ",", "target", ",", "action", ")", ":", "if", "not", "self", ".", "_generators", ":", "return", "src_permuter", ",", "src", "=", "self", ".", "_resolve_child", "(", "source", ")", "dest", "=", "self", ...
Create a dependency between path 'source' and path 'target' via the callable 'action'. >>> permuter._generators [IterValueGenerator(one), IterValueGenerator(two)] >>> permuter.make_dependent('one', 'two', lambda x: x + 1) Going forward, 'two' will only contain values that are (...
[ "Create", "a", "dependency", "between", "path", "source", "and", "path", "target", "via", "the", "callable", "action", "." ]
python
train
34.217391
jbloomlab/phydms
phydmslib/models.py
https://github.com/jbloomlab/phydms/blob/9cdebc10bafbe543c552d79486c7f950780ed3c0/phydmslib/models.py#L1068-L1088
def _update_dPrxy(self): """Update `dPrxy`.""" super(ExpCM_fitprefs, self)._update_dPrxy() if 'zeta' in self.freeparams: tildeFrxyQxy = self.tildeFrxy * self.Qxy j = 0 zetaxterm = scipy.ndarray((self.nsites, N_CODON, N_CODON), dtype='float') zetay...
[ "def", "_update_dPrxy", "(", "self", ")", ":", "super", "(", "ExpCM_fitprefs", ",", "self", ")", ".", "_update_dPrxy", "(", ")", "if", "'zeta'", "in", "self", ".", "freeparams", ":", "tildeFrxyQxy", "=", "self", ".", "tildeFrxy", "*", "self", ".", "Qxy",...
Update `dPrxy`.
[ "Update", "dPrxy", "." ]
python
train
50
bitcraze/crazyflie-lib-python
examples/basicparam.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/examples/basicparam.py#L99-L125
def _param_callback(self, name, value): """Generic callback registered for all the groups""" print('{0}: {1}'.format(name, value)) # Remove each parameter from the list and close the link when # all are fetched self._param_check_list.remove(name) if len(self._param_check...
[ "def", "_param_callback", "(", "self", ",", "name", ",", "value", ")", ":", "print", "(", "'{0}: {1}'", ".", "format", "(", "name", ",", "value", ")", ")", "# Remove each parameter from the list and close the link when", "# all are fetched", "self", ".", "_param_che...
Generic callback registered for all the groups
[ "Generic", "callback", "registered", "for", "all", "the", "groups" ]
python
train
48.259259
cloud9ers/gurumate
environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/pkg_resources.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/pkg_resources.py#L1736-L1743
def StringIO(*args, **kw): """Thunk to load the real StringIO on demand""" global StringIO try: from cStringIO import StringIO except ImportError: from StringIO import StringIO return StringIO(*args,**kw)
[ "def", "StringIO", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "global", "StringIO", "try", ":", "from", "cStringIO", "import", "StringIO", "except", "ImportError", ":", "from", "StringIO", "import", "StringIO", "return", "StringIO", "(", "*", "args",...
Thunk to load the real StringIO on demand
[ "Thunk", "to", "load", "the", "real", "StringIO", "on", "demand" ]
python
test
29.125
facundobatista/logassert
logassert/logassert.py
https://github.com/facundobatista/logassert/blob/79dc3d22a402fa0fb91cf3b046c63f039aa71890/logassert/logassert.py#L84-L97
def _check_neg(self, level, *tokens): """Check that the different tokens were NOT logged in one record, assert by level.""" for record in self.records: if level is not None and record.levelno != level: continue if all(token in record.message for token in tokens): ...
[ "def", "_check_neg", "(", "self", ",", "level", ",", "*", "tokens", ")", ":", "for", "record", "in", "self", ".", "records", ":", "if", "level", "is", "not", "None", "and", "record", ".", "levelno", "!=", "level", ":", "continue", "if", "all", "(", ...
Check that the different tokens were NOT logged in one record, assert by level.
[ "Check", "that", "the", "different", "tokens", "were", "NOT", "logged", "in", "one", "record", "assert", "by", "level", "." ]
python
train
41.928571
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_vswitch_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_vswitch_rpc/__init__.py#L109-L132
def _set_get_vnetwork_hosts(self, v, load=False): """ Setter method for get_vnetwork_hosts, mapped from YANG variable /brocade_vswitch_rpc/get_vnetwork_hosts (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_vnetwork_hosts is considered as a private method. B...
[ "def", "_set_get_vnetwork_hosts", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ","...
Setter method for get_vnetwork_hosts, mapped from YANG variable /brocade_vswitch_rpc/get_vnetwork_hosts (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_vnetwork_hosts is considered as a private method. Backends looking to populate this variable should do so via...
[ "Setter", "method", "for", "get_vnetwork_hosts", "mapped", "from", "YANG", "variable", "/", "brocade_vswitch_rpc", "/", "get_vnetwork_hosts", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", ...
python
train
71.416667
mbedmicro/pyOCD
pyocd/probe/cmsis_dap_probe.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/probe/cmsis_dap_probe.py#L219-L225
def assert_reset(self, asserted): """Assert or de-assert target reset line""" try: self._invalidate_cached_registers() self._link.assert_reset(asserted) except DAPAccess.Error as exc: six.raise_from(self._convert_exception(exc), exc)
[ "def", "assert_reset", "(", "self", ",", "asserted", ")", ":", "try", ":", "self", ".", "_invalidate_cached_registers", "(", ")", "self", ".", "_link", ".", "assert_reset", "(", "asserted", ")", "except", "DAPAccess", ".", "Error", "as", "exc", ":", "six",...
Assert or de-assert target reset line
[ "Assert", "or", "de", "-", "assert", "target", "reset", "line" ]
python
train
41