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
elastic/elasticsearch-py
elasticsearch/client/xpack/rollup.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/xpack/rollup.py#L57-L69
def put_job(self, id, body, params=None): """ `<>`_ :arg id: The ID of the job to create :arg body: The job configuration """ for param in (id, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") ...
[ "def", "put_job", "(", "self", ",", "id", ",", "body", ",", "params", "=", "None", ")", ":", "for", "param", "in", "(", "id", ",", "body", ")", ":", "if", "param", "in", "SKIP_IN_PATH", ":", "raise", "ValueError", "(", "\"Empty value passed for a require...
`<>`_ :arg id: The ID of the job to create :arg body: The job configuration
[ "<", ">", "_" ]
python
train
33.846154
svenkreiss/pysparkling
pysparkling/streaming/dstream.py
https://github.com/svenkreiss/pysparkling/blob/596d0ef2793100f7115efe228ff9bfc17beaa08d/pysparkling/streaming/dstream.py#L157-L166
def flatMap(self, f, preservesPartitioning=False): """Apply function f and flatten. :param f: mapping function :rtype: DStream """ return self.mapPartitions( lambda p: (e for pp in p for e in f(pp)), preservesPartitioning, )
[ "def", "flatMap", "(", "self", ",", "f", ",", "preservesPartitioning", "=", "False", ")", ":", "return", "self", ".", "mapPartitions", "(", "lambda", "p", ":", "(", "e", "for", "pp", "in", "p", "for", "e", "in", "f", "(", "pp", ")", ")", ",", "pr...
Apply function f and flatten. :param f: mapping function :rtype: DStream
[ "Apply", "function", "f", "and", "flatten", "." ]
python
train
28.8
natea/django-deployer
django_deployer/utils.py
https://github.com/natea/django-deployer/blob/5ce7d972db2f8500ec53ad89e7eb312d3360d074/django_deployer/utils.py#L26-L52
def get_template_filelist(repo_path, ignore_files=[], ignore_folders=[]): """ input: local repo path output: path list of files which need to be rendered """ default_ignore_files = ['.gitignore'] default_ignore_folders = ['.git'] ignore_files += default_ignore_files ignore_folders += d...
[ "def", "get_template_filelist", "(", "repo_path", ",", "ignore_files", "=", "[", "]", ",", "ignore_folders", "=", "[", "]", ")", ":", "default_ignore_files", "=", "[", "'.gitignore'", "]", "default_ignore_folders", "=", "[", "'.git'", "]", "ignore_files", "+=", ...
input: local repo path output: path list of files which need to be rendered
[ "input", ":", "local", "repo", "path", "output", ":", "path", "list", "of", "files", "which", "need", "to", "be", "rendered" ]
python
train
27.851852
labstreaminglayer/liblsl-Python
pylsl/pylsl.py
https://github.com/labstreaminglayer/liblsl-Python/blob/1ff6fe2794f8dba286b7491d1f7a4c915b8a0605/pylsl/pylsl.py#L430-L455
def push_sample(self, x, timestamp=0.0, pushthrough=True): """Push a sample into the outlet. Each entry in the list corresponds to one channel. Keyword arguments: x -- A list of values to push (one per channel). timestamp -- Optionally the capture time of the sample, in agreeme...
[ "def", "push_sample", "(", "self", ",", "x", ",", "timestamp", "=", "0.0", ",", "pushthrough", "=", "True", ")", ":", "if", "len", "(", "x", ")", "==", "self", ".", "channel_count", ":", "if", "self", ".", "channel_format", "==", "cf_string", ":", "x...
Push a sample into the outlet. Each entry in the list corresponds to one channel. Keyword arguments: x -- A list of values to push (one per channel). timestamp -- Optionally the capture time of the sample, in agreement with local_clock(); if omitted, the current ...
[ "Push", "a", "sample", "into", "the", "outlet", "." ]
python
test
48.538462
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refgraph.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refgraph.py#L92-L104
def _eliminate_leafs(self, graph): """ Eliminate leaf objects - that are objects not referencing any other objects in the list `graph`. Returns the list of objects without the objects identified as leafs. """ result = [] idset = set([id(x) for x in graph]) ...
[ "def", "_eliminate_leafs", "(", "self", ",", "graph", ")", ":", "result", "=", "[", "]", "idset", "=", "set", "(", "[", "id", "(", "x", ")", "for", "x", "in", "graph", "]", ")", "for", "n", "in", "graph", ":", "refset", "=", "set", "(", "[", ...
Eliminate leaf objects - that are objects not referencing any other objects in the list `graph`. Returns the list of objects without the objects identified as leafs.
[ "Eliminate", "leaf", "objects", "-", "that", "are", "objects", "not", "referencing", "any", "other", "objects", "in", "the", "list", "graph", ".", "Returns", "the", "list", "of", "objects", "without", "the", "objects", "identified", "as", "leafs", "." ]
python
train
37.076923
GaretJax/lancet
lancet/commands/repository.py
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/repository.py#L26-L105
def pull_request(ctx, base_branch, open_pr, stop_timer): """Create a new pull request for this issue.""" lancet = ctx.obj review_status = lancet.config.get("tracker", "review_status") remote_name = lancet.config.get("repository", "remote_name") if not base_branch: base_branch = lancet.conf...
[ "def", "pull_request", "(", "ctx", ",", "base_branch", ",", "open_pr", ",", "stop_timer", ")", ":", "lancet", "=", "ctx", ".", "obj", "review_status", "=", "lancet", ".", "config", ".", "get", "(", "\"tracker\"", ",", "\"review_status\"", ")", "remote_name",...
Create a new pull request for this issue.
[ "Create", "a", "new", "pull", "request", "for", "this", "issue", "." ]
python
train
31.4
RPi-Distro/python-gpiozero
gpiozero/tools.py
https://github.com/RPi-Distro/python-gpiozero/blob/7b67374fd0c8c4fde5586d9bad9531f076db9c0c/gpiozero/tools.py#L437-L470
def queued(values, qsize): """ Queues up readings from *values* (the number of readings queued is determined by *qsize*) and begins yielding values only when the queue is full. For example, to "cascade" values along a sequence of LEDs:: from gpiozero import LEDBoard, Button from gpiozer...
[ "def", "queued", "(", "values", ",", "qsize", ")", ":", "values", "=", "[", "_normalize", "(", "v", ")", "for", "v", "in", "values", "]", "if", "qsize", "<", "1", ":", "raise", "ValueError", "(", "\"qsize must be 1 or larger\"", ")", "q", "=", "[", "...
Queues up readings from *values* (the number of readings queued is determined by *qsize*) and begins yielding values only when the queue is full. For example, to "cascade" values along a sequence of LEDs:: from gpiozero import LEDBoard, Button from gpiozero.tools import queued from sign...
[ "Queues", "up", "readings", "from", "*", "values", "*", "(", "the", "number", "of", "readings", "queued", "is", "determined", "by", "*", "qsize", "*", ")", "and", "begins", "yielding", "values", "only", "when", "the", "queue", "is", "full", ".", "For", ...
python
train
27.441176
OSSOS/MOP
src/ossos/core/ossos/storage.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/storage.py#L1207-L1218
def vofile(filename, **kwargs): """ Open and return a handle on a VOSpace data connection @param filename: @param kwargs: @return: """ basename = os.path.basename(filename) if os.access(basename, os.R_OK): return open(basename, 'r') kwargs['view'] = kwargs.get('view', 'data')...
[ "def", "vofile", "(", "filename", ",", "*", "*", "kwargs", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "if", "os", ".", "access", "(", "basename", ",", "os", ".", "R_OK", ")", ":", "return", "open", "(", "...
Open and return a handle on a VOSpace data connection @param filename: @param kwargs: @return:
[ "Open", "and", "return", "a", "handle", "on", "a", "VOSpace", "data", "connection" ]
python
train
29.333333
oceanprotocol/squid-py
squid_py/keeper/conditions/condition_base.py
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/condition_base.py#L16-L29
def generate_id(self, agreement_id, types, values): """ Generate id for the condition. :param agreement_id: id of the agreement, hex str :param types: list of types :param values: list of values :return: id, str """ values_hash = utils.generate_multi_valu...
[ "def", "generate_id", "(", "self", ",", "agreement_id", ",", "types", ",", "values", ")", ":", "values_hash", "=", "utils", ".", "generate_multi_value_hash", "(", "types", ",", "values", ")", "return", "utils", ".", "generate_multi_value_hash", "(", "[", "'byt...
Generate id for the condition. :param agreement_id: id of the agreement, hex str :param types: list of types :param values: list of values :return: id, str
[ "Generate", "id", "for", "the", "condition", "." ]
python
train
34.785714
codeinn/vcs
vcs/backends/git/repository.py
https://github.com/codeinn/vcs/blob/e6cd94188e9c36d273411bf3adc0584ac6ab92a0/vcs/backends/git/repository.py#L454-L524
def get_changesets(self, start=None, end=None, start_date=None, end_date=None, branch_name=None, reverse=False): """ Returns iterator of ``GitChangeset`` objects from start to end (both are inclusive), in ascending date order (unless ``reverse`` is set). :param start: changes...
[ "def", "get_changesets", "(", "self", ",", "start", "=", "None", ",", "end", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "branch_name", "=", "None", ",", "reverse", "=", "False", ")", ":", "if", "branch_name", "and",...
Returns iterator of ``GitChangeset`` objects from start to end (both are inclusive), in ascending date order (unless ``reverse`` is set). :param start: changeset ID, as str; first returned changeset :param end: changeset ID, as str; last returned changeset :param start_date: if specifie...
[ "Returns", "iterator", "of", "GitChangeset", "objects", "from", "start", "to", "end", "(", "both", "are", "inclusive", ")", "in", "ascending", "date", "order", "(", "unless", "reverse", "is", "set", ")", "." ]
python
train
41.394366
waqasbhatti/astrobase
astrobase/astrokep.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/astrokep.py#L1269-L1472
def epd_kepler_lightcurve(lcdict, xccol='mom_centr1', yccol='mom_centr2', timestoignore=None, filterflags=True, writetodict=True, epdsmooth=5): '''This runs EPD...
[ "def", "epd_kepler_lightcurve", "(", "lcdict", ",", "xccol", "=", "'mom_centr1'", ",", "yccol", "=", "'mom_centr2'", ",", "timestoignore", "=", "None", ",", "filterflags", "=", "True", ",", "writetodict", "=", "True", ",", "epdsmooth", "=", "5", ")", ":", ...
This runs EPD on the Kepler light curve. Following Huang et al. 2015, we fit the following EPD function to a smoothed light curve, and then subtract it to obtain EPD corrected magnitudes:: f = c0 + c1*sin(2*pi*x) + c2*cos(2*pi*x) + c3*sin(2*pi*y) + c4*cos(2*pi*y) + c5*sin(4*pi*...
[ "This", "runs", "EPD", "on", "the", "Kepler", "light", "curve", "." ]
python
valid
31.617647
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treebuilders/etree_lxml.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/etree_lxml.py#L134-L172
def tostring(element): """Serialize an element and its child nodes to a string""" rv = [] def serializeElement(element): if not hasattr(element, "tag"): if element.docinfo.internalDTD: if element.docinfo.doctype: dtd_str = element.docinfo.doctype ...
[ "def", "tostring", "(", "element", ")", ":", "rv", "=", "[", "]", "def", "serializeElement", "(", "element", ")", ":", "if", "not", "hasattr", "(", "element", ",", "\"tag\"", ")", ":", "if", "element", ".", "docinfo", ".", "internalDTD", ":", "if", "...
Serialize an element and its child nodes to a string
[ "Serialize", "an", "element", "and", "its", "child", "nodes", "to", "a", "string" ]
python
train
32.384615
Nukesor/pueue
pueue/daemon/process_handler.py
https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/process_handler.py#L240-L247
def pause_process(self, key): """Pause a specific processes.""" if key in self.processes and key not in self.paused: os.killpg(os.getpgid(self.processes[key].pid), signal.SIGSTOP) self.queue[key]['status'] = 'paused' self.paused.append(key) return True ...
[ "def", "pause_process", "(", "self", ",", "key", ")", ":", "if", "key", "in", "self", ".", "processes", "and", "key", "not", "in", "self", ".", "paused", ":", "os", ".", "killpg", "(", "os", ".", "getpgid", "(", "self", ".", "processes", "[", "key"...
Pause a specific processes.
[ "Pause", "a", "specific", "processes", "." ]
python
train
41.25
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/dataframeeditor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L170-L177
def _axis_levels(self, axis): """ Return the number of levels in the labels taking into account the axis. Get the number of levels for the columns (0) or rows (1). """ ax = self._axis(axis) return 1 if not hasattr(ax, 'levels') else len(ax.levels)
[ "def", "_axis_levels", "(", "self", ",", "axis", ")", ":", "ax", "=", "self", ".", "_axis", "(", "axis", ")", "return", "1", "if", "not", "hasattr", "(", "ax", ",", "'levels'", ")", "else", "len", "(", "ax", ".", "levels", ")" ]
Return the number of levels in the labels taking into account the axis. Get the number of levels for the columns (0) or rows (1).
[ "Return", "the", "number", "of", "levels", "in", "the", "labels", "taking", "into", "account", "the", "axis", ".", "Get", "the", "number", "of", "levels", "for", "the", "columns", "(", "0", ")", "or", "rows", "(", "1", ")", "." ]
python
train
37
libyal/dtfabric
dtfabric/reader.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L439-L488
def _ReadFixedSizeDataTypeDefinition( self, definitions_registry, definition_values, data_type_definition_class, definition_name, supported_attributes, default_size=definitions.SIZE_NATIVE, default_units='bytes', is_member=False, supported_size_values=None): """Reads a fixed-size data type d...
[ "def", "_ReadFixedSizeDataTypeDefinition", "(", "self", ",", "definitions_registry", ",", "definition_values", ",", "data_type_definition_class", ",", "definition_name", ",", "supported_attributes", ",", "default_size", "=", "definitions", ".", "SIZE_NATIVE", ",", "default_...
Reads a fixed-size data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): definition values. data_type_definition_class (str): data type definition class. definition_name (str): name of...
[ "Reads", "a", "fixed", "-", "size", "data", "type", "definition", "." ]
python
train
42.56
QUANTAXIS/QUANTAXIS
QUANTAXIS/QASU/save_tdx_parallelism.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx_parallelism.py#L118-L193
def QA_SU_save_stock_day(client=DATABASE, ui_log=None, ui_progress=None): ''' save stock_day 保存日线数据 :param client: :param ui_log: 给GUI qt 界面使用 :param ui_progress: 给GUI qt 界面使用 :param ui_progress_int_value: 给GUI qt 界面使用 ''' stock_list = QA_fetch_get_stock_list().code.unique().tolist...
[ "def", "QA_SU_save_stock_day", "(", "client", "=", "DATABASE", ",", "ui_log", "=", "None", ",", "ui_progress", "=", "None", ")", ":", "stock_list", "=", "QA_fetch_get_stock_list", "(", ")", ".", "code", ".", "unique", "(", ")", ".", "tolist", "(", ")", "...
save stock_day 保存日线数据 :param client: :param ui_log: 给GUI qt 界面使用 :param ui_progress: 给GUI qt 界面使用 :param ui_progress_int_value: 给GUI qt 界面使用
[ "save", "stock_day", "保存日线数据", ":", "param", "client", ":", ":", "param", "ui_log", ":", "给GUI", "qt", "界面使用", ":", "param", "ui_progress", ":", "给GUI", "qt", "界面使用", ":", "param", "ui_progress_int_value", ":", "给GUI", "qt", "界面使用" ]
python
train
38.421053
klichukb/django-migrate-sql
migrate_sql/operations.py
https://github.com/klichukb/django-migrate-sql/blob/be48ff2c9283404e3d951128c459c3496d1ba25d/migrate_sql/operations.py#L12-L18
def get_sql_state(self, state): """ Get SQLStateGraph from state. """ if not hasattr(state, 'sql_state'): setattr(state, 'sql_state', SQLStateGraph()) return state.sql_state
[ "def", "get_sql_state", "(", "self", ",", "state", ")", ":", "if", "not", "hasattr", "(", "state", ",", "'sql_state'", ")", ":", "setattr", "(", "state", ",", "'sql_state'", ",", "SQLStateGraph", "(", ")", ")", "return", "state", ".", "sql_state" ]
Get SQLStateGraph from state.
[ "Get", "SQLStateGraph", "from", "state", "." ]
python
train
31.285714
intake/intake
intake/catalog/base.py
https://github.com/intake/intake/blob/277b96bfdee39d8a3048ea5408c6d6716d568336/intake/catalog/base.py#L177-L180
def reload(self): """Reload catalog if sufficient time has passed""" if time.time() - self.updated > self.ttl: self.force_reload()
[ "def", "reload", "(", "self", ")", ":", "if", "time", ".", "time", "(", ")", "-", "self", ".", "updated", ">", "self", ".", "ttl", ":", "self", ".", "force_reload", "(", ")" ]
Reload catalog if sufficient time has passed
[ "Reload", "catalog", "if", "sufficient", "time", "has", "passed" ]
python
train
38.75
petl-developers/petl
petl/transform/intervals.py
https://github.com/petl-developers/petl/blob/1d33ca055f7e04e0d28a772041c9fd30c8d415d6/petl/transform/intervals.py#L575-L632
def intervalleftjoin(left, right, lstart='start', lstop='stop', rstart='start', rstop='stop', lkey=None, rkey=None, include_stop=False, missing=None, lprefix=None, rprefix=None): """ Like :func:`petl.transform.intervals.intervaljoin` but rows from the left table wi...
[ "def", "intervalleftjoin", "(", "left", ",", "right", ",", "lstart", "=", "'start'", ",", "lstop", "=", "'stop'", ",", "rstart", "=", "'start'", ",", "rstop", "=", "'stop'", ",", "lkey", "=", "None", ",", "rkey", "=", "None", ",", "include_stop", "=", ...
Like :func:`petl.transform.intervals.intervaljoin` but rows from the left table without a match in the right table are also included. E.g.:: >>> import petl as etl >>> left = [['begin', 'end', 'quux'], ... [1, 2, 'a'], ... [2, 4, 'b'], ... [2, 5, 'c'...
[ "Like", ":", "func", ":", "petl", ".", "transform", ".", "intervals", ".", "intervaljoin", "but", "rows", "from", "the", "left", "table", "without", "a", "match", "in", "the", "right", "table", "are", "also", "included", ".", "E", ".", "g", ".", "::" ]
python
train
48.017241
SBRG/ssbio
ssbio/protein/structure/homology/itasser/itasserprop.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L153-L196
def copy_results(self, copy_to_dir, rename_model_to=None, force_rerun=False): """Copy the raw information from I-TASSER modeling to a new folder. Copies all files in the list _attrs_to_copy. Args: copy_to_dir (str): Directory to copy the minimal set of results per sequence. ...
[ "def", "copy_results", "(", "self", ",", "copy_to_dir", ",", "rename_model_to", "=", "None", ",", "force_rerun", "=", "False", ")", ":", "# Save path to the structure and copy it if specified", "if", "not", "rename_model_to", ":", "rename_model_to", "=", "self", ".", ...
Copy the raw information from I-TASSER modeling to a new folder. Copies all files in the list _attrs_to_copy. Args: copy_to_dir (str): Directory to copy the minimal set of results per sequence. rename_model_to (str): New file name (without extension) force_rerun (bo...
[ "Copy", "the", "raw", "information", "from", "I", "-", "TASSER", "modeling", "to", "a", "new", "folder", "." ]
python
train
49.636364
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_widget.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L390-L397
def reverseCommit(self): """ Replace the current widget content with the original text. Note that the original text has styling information available, whereas the new text does not. """ self.baseClass.setText(self.oldText) self.qteWidget.SCISetStylingEx(0, 0, self...
[ "def", "reverseCommit", "(", "self", ")", ":", "self", ".", "baseClass", ".", "setText", "(", "self", ".", "oldText", ")", "self", ".", "qteWidget", ".", "SCISetStylingEx", "(", "0", ",", "0", ",", "self", ".", "style", ")" ]
Replace the current widget content with the original text. Note that the original text has styling information available, whereas the new text does not.
[ "Replace", "the", "current", "widget", "content", "with", "the", "original", "text", ".", "Note", "that", "the", "original", "text", "has", "styling", "information", "available", "whereas", "the", "new", "text", "does", "not", "." ]
python
train
40
poppy-project/pypot
pypot/vrep/remoteApiBindings/vrep.py
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/vrep/remoteApiBindings/vrep.py#L1196-L1201
def simxGetOutMessageInfo(clientID, infoType): ''' Please have a look at the function description/documentation in the V-REP user manual ''' info = ct.c_int() return c_GetOutMessageInfo(clientID, infoType, ct.byref(info)), info.value
[ "def", "simxGetOutMessageInfo", "(", "clientID", ",", "infoType", ")", ":", "info", "=", "ct", ".", "c_int", "(", ")", "return", "c_GetOutMessageInfo", "(", "clientID", ",", "infoType", ",", "ct", ".", "byref", "(", "info", ")", ")", ",", "info", ".", ...
Please have a look at the function description/documentation in the V-REP user manual
[ "Please", "have", "a", "look", "at", "the", "function", "description", "/", "documentation", "in", "the", "V", "-", "REP", "user", "manual" ]
python
train
41.333333
gtaylor/python-route53
route53/xml_generators/change_resource_record_set.py
https://github.com/gtaylor/python-route53/blob/b9fc7e258a79551c9ed61e4a71668b7f06f9e774/route53/xml_generators/change_resource_record_set.py#L98-L134
def change_resource_record_set_writer(connection, change_set, comment=None): """ Forms an XML string that we'll send to Route53 in order to change record sets. :param Route53Connection connection: The connection instance used to query the API. :param change_set.ChangeSet change_set: The Cha...
[ "def", "change_resource_record_set_writer", "(", "connection", ",", "change_set", ",", "comment", "=", "None", ")", ":", "e_root", "=", "etree", ".", "Element", "(", "\"ChangeResourceRecordSetsRequest\"", ",", "xmlns", "=", "connection", ".", "_xml_namespace", ")", ...
Forms an XML string that we'll send to Route53 in order to change record sets. :param Route53Connection connection: The connection instance used to query the API. :param change_set.ChangeSet change_set: The ChangeSet object to create the XML doc from. :keyword str comment: An optional c...
[ "Forms", "an", "XML", "string", "that", "we", "ll", "send", "to", "Route53", "in", "order", "to", "change", "record", "sets", "." ]
python
test
32.162162
saltstack/salt
salt/serializers/configparser.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/configparser.py#L24-L57
def deserialize(stream_or_string, **options): ''' Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower configparser module. ''' if six.PY3: cp = configparser.ConfigPar...
[ "def", "deserialize", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "if", "six", ".", "PY3", ":", "cp", "=", "configparser", ".", "ConfigParser", "(", "*", "*", "options", ")", "else", ":", "cp", "=", "configparser", ".", "SafeConfigParser...
Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower configparser module.
[ "Deserialize", "any", "string", "or", "stream", "like", "object", "into", "a", "Python", "data", "structure", "." ]
python
train
33.617647
ChaosinaCan/pyvswhere
vswhere/__init__.py
https://github.com/ChaosinaCan/pyvswhere/blob/e1b0acc92b851c7ada23ed6415406d688dc6bfce/vswhere/__init__.py#L208-L220
def _download_vswhere(): """ Download vswhere to DOWNLOAD_PATH. """ print('downloading from', _get_latest_release_url()) try: from urllib.request import urlopen with urlopen(_get_latest_release_url()) as response, open(DOWNLOAD_PATH, 'wb') as outfile: shutil.copyfileobj(r...
[ "def", "_download_vswhere", "(", ")", ":", "print", "(", "'downloading from'", ",", "_get_latest_release_url", "(", ")", ")", "try", ":", "from", "urllib", ".", "request", "import", "urlopen", "with", "urlopen", "(", "_get_latest_release_url", "(", ")", ")", "...
Download vswhere to DOWNLOAD_PATH.
[ "Download", "vswhere", "to", "DOWNLOAD_PATH", "." ]
python
train
35.307692
sorgerlab/indra
indra/sources/ndex_cx/processor.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/ndex_cx/processor.py#L166-L173
def get_pmids(self): """Get list of all PMIDs associated with edges in the network.""" pmids = [] for ea in self._edge_attributes.values(): edge_pmids = ea.get('pmids') if edge_pmids: pmids += edge_pmids return list(set(pmids))
[ "def", "get_pmids", "(", "self", ")", ":", "pmids", "=", "[", "]", "for", "ea", "in", "self", ".", "_edge_attributes", ".", "values", "(", ")", ":", "edge_pmids", "=", "ea", ".", "get", "(", "'pmids'", ")", "if", "edge_pmids", ":", "pmids", "+=", "...
Get list of all PMIDs associated with edges in the network.
[ "Get", "list", "of", "all", "PMIDs", "associated", "with", "edges", "in", "the", "network", "." ]
python
train
36.5
senaite/senaite.core
bika/lims/content/abstractroutineanalysis.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/abstractroutineanalysis.py#L455-L469
def getPrioritySortkey(self): """ Returns the key that will be used to sort the current Analysis, from most prioritary to less prioritary. :return: string used for sorting """ analysis_request = self.getRequest() if analysis_request is None: return Non...
[ "def", "getPrioritySortkey", "(", "self", ")", ":", "analysis_request", "=", "self", ".", "getRequest", "(", ")", "if", "analysis_request", "is", "None", ":", "return", "None", "ar_sort_key", "=", "analysis_request", ".", "getPrioritySortkey", "(", ")", "ar_id",...
Returns the key that will be used to sort the current Analysis, from most prioritary to less prioritary. :return: string used for sorting
[ "Returns", "the", "key", "that", "will", "be", "used", "to", "sort", "the", "current", "Analysis", "from", "most", "prioritary", "to", "less", "prioritary", ".", ":", "return", ":", "string", "used", "for", "sorting" ]
python
train
37.933333
trevorstephens/gplearn
gplearn/genetic.py
https://github.com/trevorstephens/gplearn/blob/5c0465f2ecdcd5abcdf3fe520688d24cd59e4a52/gplearn/genetic.py#L1429-L1457
def transform(self, X): """Transform X according to the fitted transformer. Parameters ---------- X : array-like, shape = [n_samples, n_features] Input vectors, where n_samples is the number of samples and n_features is the number of features. Returns ...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_best_programs'", ")", ":", "raise", "NotFittedError", "(", "'SymbolicTransformer not fitted.'", ")", "X", "=", "check_array", "(", "X", ")", "_", ",", "n_feat...
Transform X according to the fitted transformer. Parameters ---------- X : array-like, shape = [n_samples, n_features] Input vectors, where n_samples is the number of samples and n_features is the number of features. Returns ------- X_new : array...
[ "Transform", "X", "according", "to", "the", "fitted", "transformer", "." ]
python
train
34.137931
skoczen/will
will/plugins/fun/googlepoem.py
https://github.com/skoczen/will/blob/778a6a78571e3ae4656b307f9e5d4d184b25627d/will/plugins/fun/googlepoem.py#L9-L15
def google_poem(self, message, topic): """make a poem about __: show a google poem about __""" r = requests.get("http://www.google.com/complete/search?output=toolbar&q=" + topic + "%20") xmldoc = minidom.parseString(r.text) item_list = xmldoc.getElementsByTagName("suggestion") co...
[ "def", "google_poem", "(", "self", ",", "message", ",", "topic", ")", ":", "r", "=", "requests", ".", "get", "(", "\"http://www.google.com/complete/search?output=toolbar&q=\"", "+", "topic", "+", "\"%20\"", ")", "xmldoc", "=", "minidom", ".", "parseString", "(",...
make a poem about __: show a google poem about __
[ "make", "a", "poem", "about", "__", ":", "show", "a", "google", "poem", "about", "__" ]
python
train
68.428571
adamalton/django-csp-reports
cspreports/summary.py
https://github.com/adamalton/django-csp-reports/blob/867992c6f535cf6afbf911f92af7eea4c61e4b73/cspreports/summary.py#L35-L40
def append(self, report): """Append a new CSP report.""" assert report not in self.examples self.count += 1 if len(self.examples) < self.top: self.examples.append(report)
[ "def", "append", "(", "self", ",", "report", ")", ":", "assert", "report", "not", "in", "self", ".", "examples", "self", ".", "count", "+=", "1", "if", "len", "(", "self", ".", "examples", ")", "<", "self", ".", "top", ":", "self", ".", "examples",...
Append a new CSP report.
[ "Append", "a", "new", "CSP", "report", "." ]
python
train
34.833333
senaite/senaite.core
bika/lims/exportimport/instruments/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/__init__.py#L245-L249
def getExim(exim_id): """Returns the instrument interface for the exim_id passed in """ interfaces = filter(lambda i: i[0]==exim_id, get_instrument_interfaces()) return interfaces and interfaces[0][1] or None
[ "def", "getExim", "(", "exim_id", ")", ":", "interfaces", "=", "filter", "(", "lambda", "i", ":", "i", "[", "0", "]", "==", "exim_id", ",", "get_instrument_interfaces", "(", ")", ")", "return", "interfaces", "and", "interfaces", "[", "0", "]", "[", "1"...
Returns the instrument interface for the exim_id passed in
[ "Returns", "the", "instrument", "interface", "for", "the", "exim_id", "passed", "in" ]
python
train
44
PyGithub/PyGithub
github/Organization.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Organization.py#L489-L499
def delete_hook(self, id): """ :calls: `DELETE /orgs/:owner/hooks/:id <http://developer.github.com/v3/orgs/hooks>`_ :param id: integer :rtype: None` """ assert isinstance(id, (int, long)), id headers, data = self._requester.requestJsonAndCheck( "DELETE...
[ "def", "delete_hook", "(", "self", ",", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "(", "int", ",", "long", ")", ")", ",", "id", "headers", ",", "data", "=", "self", ".", "_requester", ".", "requestJsonAndCheck", "(", "\"DELETE\"", ",", ...
:calls: `DELETE /orgs/:owner/hooks/:id <http://developer.github.com/v3/orgs/hooks>`_ :param id: integer :rtype: None`
[ ":", "calls", ":", "DELETE", "/", "orgs", "/", ":", "owner", "/", "hooks", "/", ":", "id", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", "/", "hooks", ">", "_", ":", "param", "id", ":", "integer", ":", "rty...
python
train
33.181818
odlgroup/odl
odl/space/weighting.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/space/weighting.py#L555-L560
def repr_part(self): """String usable in a space's ``__repr__`` method.""" optargs = [('weighting', array_str(self.array, nprint=10), ''), ('exponent', self.exponent, 2.0)] return signature_string([], optargs, sep=',\n', mod=[[], ['!s', ':.4']])
[ "def", "repr_part", "(", "self", ")", ":", "optargs", "=", "[", "(", "'weighting'", ",", "array_str", "(", "self", ".", "array", ",", "nprint", "=", "10", ")", ",", "''", ")", ",", "(", "'exponent'", ",", "self", ".", "exponent", ",", "2.0", ")", ...
String usable in a space's ``__repr__`` method.
[ "String", "usable", "in", "a", "space", "s", "__repr__", "method", "." ]
python
train
52.5
openstack/quark
quark/billing.py
https://github.com/openstack/quark/blob/1112e6a66917d3e98e44cb7b33b107fd5a74bb2e/quark/billing.py#L256-L288
def calc_periods(hour=0, minute=0): """Returns a tuple of start_period and end_period. Assumes that the period is 24-hrs. Parameters: - `hour`: the hour from 0 to 23 when the period ends - `minute`: the minute from 0 to 59 when the period ends This method will calculate the end of the p...
[ "def", "calc_periods", "(", "hour", "=", "0", ",", "minute", "=", "0", ")", ":", "# Calculate the time intervals in a usable form", "period_end", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "replace", "(", "hour", "=", "hour", ",", "minut...
Returns a tuple of start_period and end_period. Assumes that the period is 24-hrs. Parameters: - `hour`: the hour from 0 to 23 when the period ends - `minute`: the minute from 0 to 59 when the period ends This method will calculate the end of the period as the closest hour/minute going ...
[ "Returns", "a", "tuple", "of", "start_period", "and", "end_period", "." ]
python
valid
44.121212
dls-controls/pymalcolm
malcolm/modules/web/controllers/websocketclientcomms.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/modules/web/controllers/websocketclientcomms.py#L234-L255
def send_post(self, mri, method_name, **params): """Abstract method to dispatch a Post to the server Args: mri (str): The mri of the Block method_name (str): The name of the Method within the Block params: The parameters to send Returns: The retu...
[ "def", "send_post", "(", "self", ",", "mri", ",", "method_name", ",", "*", "*", "params", ")", ":", "q", "=", "Queue", "(", ")", "request", "=", "Post", "(", "path", "=", "[", "mri", ",", "method_name", "]", ",", "parameters", "=", "params", ")", ...
Abstract method to dispatch a Post to the server Args: mri (str): The mri of the Block method_name (str): The name of the Method within the Block params: The parameters to send Returns: The return results from the server
[ "Abstract", "method", "to", "dispatch", "a", "Post", "to", "the", "server" ]
python
train
31.363636
petrjasek/eve-elastic
eve_elastic/elastic.py
https://github.com/petrjasek/eve-elastic/blob/f146f31b348d22ac5559cf78717b3bb02efcb2d7/eve_elastic/elastic.py#L695-L721
def put_settings(self, app=None, index=None, settings=None, es=None): """Modify index settings. Index must exist already. """ if not index: index = self.index if not app: app = self.app if not es: es = self.es if not setting...
[ "def", "put_settings", "(", "self", ",", "app", "=", "None", ",", "index", "=", "None", ",", "settings", "=", "None", ",", "es", "=", "None", ")", ":", "if", "not", "index", ":", "index", "=", "self", ".", "index", "if", "not", "app", ":", "app",...
Modify index settings. Index must exist already.
[ "Modify", "index", "settings", "." ]
python
train
27.074074
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L595-L598
def create_serv_obj(self, tenant_id): """Creates and stores the service object associated with a tenant. """ self.service_attr[tenant_id] = ServiceIpSegTenantMap() self.store_tenant_obj(tenant_id, self.service_attr[tenant_id])
[ "def", "create_serv_obj", "(", "self", ",", "tenant_id", ")", ":", "self", ".", "service_attr", "[", "tenant_id", "]", "=", "ServiceIpSegTenantMap", "(", ")", "self", ".", "store_tenant_obj", "(", "tenant_id", ",", "self", ".", "service_attr", "[", "tenant_id"...
Creates and stores the service object associated with a tenant.
[ "Creates", "and", "stores", "the", "service", "object", "associated", "with", "a", "tenant", "." ]
python
train
61.75
gwastro/pycbc-glue
pycbc_glue/pipeline.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/pipeline.py#L1466-L1474
def write_output_files(self, fh): """ Write as a comment into the DAG file the list of output files for this DAG node. @param fh: descriptor of open DAG file. """ for f in self.__output_files: print >>fh, "## Job %s generates output file %s" % (self.__name, f)
[ "def", "write_output_files", "(", "self", ",", "fh", ")", ":", "for", "f", "in", "self", ".", "__output_files", ":", "print", ">>", "fh", ",", "\"## Job %s generates output file %s\"", "%", "(", "self", ".", "__name", ",", "f", ")" ]
Write as a comment into the DAG file the list of output files for this DAG node. @param fh: descriptor of open DAG file.
[ "Write", "as", "a", "comment", "into", "the", "DAG", "file", "the", "list", "of", "output", "files", "for", "this", "DAG", "node", "." ]
python
train
31.666667
wright-group/WrightTools
WrightTools/data/_constant.py
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_constant.py#L61-L81
def label(self) -> str: """A latex formatted label representing constant expression and united value.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (sym...
[ "def", "label", "(", "self", ")", "->", "str", ":", "label", "=", "self", ".", "expression", ".", "replace", "(", "\"_\"", ",", "\"\\\\;\"", ")", "if", "self", ".", "units_kind", ":", "symbol", "=", "wt_units", ".", "get_symbol", "(", "self", ".", "u...
A latex formatted label representing constant expression and united value.
[ "A", "latex", "formatted", "label", "representing", "constant", "expression", "and", "united", "value", "." ]
python
train
44.904762
openstack/horizon
horizon/base.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L853-L886
def _urls(self): """Constructs the URLconf for Horizon from registered Dashboards.""" urlpatterns = self._get_default_urlpatterns() self._autodiscover() # Discover each dashboard's panels. for dash in self._registry.values(): dash._autodiscover() # Load the ...
[ "def", "_urls", "(", "self", ")", ":", "urlpatterns", "=", "self", ".", "_get_default_urlpatterns", "(", ")", "self", ".", "_autodiscover", "(", ")", "# Discover each dashboard's panels.", "for", "dash", "in", "self", ".", "_registry", ".", "values", "(", ")",...
Constructs the URLconf for Horizon from registered Dashboards.
[ "Constructs", "the", "URLconf", "for", "Horizon", "from", "registered", "Dashboards", "." ]
python
train
39.352941
RudolfCardinal/pythonlib
cardinal_pythonlib/nhs.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/nhs.py#L116-L128
def generate_random_nhs_number() -> int: """ Returns a random valid NHS number, as an ``int``. """ check_digit = 10 # NHS numbers with this check digit are all invalid while check_digit == 10: digits = [random.randint(1, 9)] # don't start with a zero digits.extend([random.randint(0...
[ "def", "generate_random_nhs_number", "(", ")", "->", "int", ":", "check_digit", "=", "10", "# NHS numbers with this check digit are all invalid", "while", "check_digit", "==", "10", ":", "digits", "=", "[", "random", ".", "randint", "(", "1", ",", "9", ")", "]",...
Returns a random valid NHS number, as an ``int``.
[ "Returns", "a", "random", "valid", "NHS", "number", "as", "an", "int", "." ]
python
train
40.615385
openvax/datacache
datacache/download.py
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/download.py#L159-L214
def fetch_file( download_url, filename=None, decompress=False, subdir=None, force=False, timeout=None, use_wget_if_available=False): """ Download a remote file and store it locally in a cache directory. Don't download it again if it's already present (...
[ "def", "fetch_file", "(", "download_url", ",", "filename", "=", "None", ",", "decompress", "=", "False", ",", "subdir", "=", "None", ",", "force", "=", "False", ",", "timeout", "=", "None", ",", "use_wget_if_available", "=", "False", ")", ":", "filename", ...
Download a remote file and store it locally in a cache directory. Don't download it again if it's already present (unless `force` is True.) Parameters ---------- download_url : str Remote URL of file to download. filename : str, optional Local filename, used as cache key. If omitte...
[ "Download", "a", "remote", "file", "and", "store", "it", "locally", "in", "a", "cache", "directory", ".", "Don", "t", "download", "it", "again", "if", "it", "s", "already", "present", "(", "unless", "force", "is", "True", ".", ")" ]
python
train
35.232143
PyCQA/astroid
astroid/rebuilder.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/rebuilder.py#L172-L177
def _save_assignment(self, node, name=None): """save assignement situation since node.parent is not available yet""" if self._global_names and node.name in self._global_names[-1]: node.root().set_local(node.name, node) else: node.parent.set_local(node.name, node)
[ "def", "_save_assignment", "(", "self", ",", "node", ",", "name", "=", "None", ")", ":", "if", "self", ".", "_global_names", "and", "node", ".", "name", "in", "self", ".", "_global_names", "[", "-", "1", "]", ":", "node", ".", "root", "(", ")", "."...
save assignement situation since node.parent is not available yet
[ "save", "assignement", "situation", "since", "node", ".", "parent", "is", "not", "available", "yet" ]
python
train
51
pytroll/satpy
satpy/resample.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/resample.py#L720-L738
def aggregate(d, y_size, x_size): """Average every 4 elements (2x2) in a 2D array""" if d.ndim != 2: # we can't guarantee what blocks we are getting and how # it should be reshaped to do the averaging. raise ValueError("Can't aggregrate (reduce) data arrays with " ...
[ "def", "aggregate", "(", "d", ",", "y_size", ",", "x_size", ")", ":", "if", "d", ".", "ndim", "!=", "2", ":", "# we can't guarantee what blocks we are getting and how", "# it should be reshaped to do the averaging.", "raise", "ValueError", "(", "\"Can't aggregrate (reduce...
Average every 4 elements (2x2) in a 2D array
[ "Average", "every", "4", "elements", "(", "2x2", ")", "in", "a", "2D", "array" ]
python
train
55.736842
quantumlib/Cirq
cirq/google/params.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/google/params.py#L35-L47
def _to_zip_product(sweep: Sweep) -> Product: """Converts sweep to a product of zips of single sweeps, if possible.""" if not isinstance(sweep, Product): sweep = Product(sweep) if not all(isinstance(f, Zip) for f in sweep.factors): factors = [f if isinstance(f, Zip) else Zip(f) for f in swee...
[ "def", "_to_zip_product", "(", "sweep", ":", "Sweep", ")", "->", "Product", ":", "if", "not", "isinstance", "(", "sweep", ",", "Product", ")", ":", "sweep", "=", "Product", "(", "sweep", ")", "if", "not", "all", "(", "isinstance", "(", "f", ",", "Zip...
Converts sweep to a product of zips of single sweeps, if possible.
[ "Converts", "sweep", "to", "a", "product", "of", "zips", "of", "single", "sweeps", "if", "possible", "." ]
python
train
47.769231
zalando/patroni
patroni/utils.py
https://github.com/zalando/patroni/blob/f6d29081c90af52064b981cdd877a07338d86038/patroni/utils.py#L36-L58
def patch_config(config, data): """recursively 'patch' `config` with `data` :returns: `!True` if the `config` was changed""" is_changed = False for name, value in data.items(): if value is None: if config.pop(name, None) is not None: is_changed = True elif nam...
[ "def", "patch_config", "(", "config", ",", "data", ")", ":", "is_changed", "=", "False", "for", "name", ",", "value", "in", "data", ".", "items", "(", ")", ":", "if", "value", "is", "None", ":", "if", "config", ".", "pop", "(", "name", ",", "None",...
recursively 'patch' `config` with `data` :returns: `!True` if the `config` was changed
[ "recursively", "patch", "config", "with", "data", ":", "returns", ":", "!True", "if", "the", "config", "was", "changed" ]
python
train
35.73913
tornadoweb/tornado
tornado/escape.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/escape.py#L118-L144
def url_unescape( # noqa: F811 value: Union[str, bytes], encoding: Optional[str] = "utf-8", plus: bool = True ) -> Union[str, bytes]: """Decodes the given value from a URL. The argument may be either a byte or unicode string. If encoding is None, the result will be a byte string. Otherwise, the ...
[ "def", "url_unescape", "(", "# noqa: F811", "value", ":", "Union", "[", "str", ",", "bytes", "]", ",", "encoding", ":", "Optional", "[", "str", "]", "=", "\"utf-8\"", ",", "plus", ":", "bool", "=", "True", ")", "->", "Union", "[", "str", ",", "bytes"...
Decodes the given value from a URL. The argument may be either a byte or unicode string. If encoding is None, the result will be a byte string. Otherwise, the result is a unicode string in the specified encoding. If ``plus`` is true (the default), plus signs will be interpreted as spaces (litera...
[ "Decodes", "the", "given", "value", "from", "a", "URL", "." ]
python
train
40.518519
a1ezzz/wasp-general
wasp_general/network/transport.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/transport.py#L192-L198
def server_socket(self, config): """ :meth:`.WNetworkNativeTransportProto.server_socket` method implementation """ if self.__server_socket is None: self.__server_socket = self.create_server_socket(config) self.__server_socket.bind(self.bind_socket(config).pair()) return self.__server_socket
[ "def", "server_socket", "(", "self", ",", "config", ")", ":", "if", "self", ".", "__server_socket", "is", "None", ":", "self", ".", "__server_socket", "=", "self", ".", "create_server_socket", "(", "config", ")", "self", ".", "__server_socket", ".", "bind", ...
:meth:`.WNetworkNativeTransportProto.server_socket` method implementation
[ ":", "meth", ":", ".", "WNetworkNativeTransportProto", ".", "server_socket", "method", "implementation" ]
python
train
42.714286
OnroerendErfgoed/crabpy
crabpy/gateway/capakey.py
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/capakey.py#L260-L295
def list_secties_by_afdeling(self, afdeling): ''' List all `secties` in a `kadastrale afdeling`. :param afdeling: The :class:`Afdeling` for which the `secties` are \ wanted. Can also be the id of and `afdeling`. :rtype: A :class:`list` of `Sectie`. ''' try: ...
[ "def", "list_secties_by_afdeling", "(", "self", ",", "afdeling", ")", ":", "try", ":", "aid", "=", "afdeling", ".", "id", "gid", "=", "afdeling", ".", "gemeente", ".", "id", "except", "AttributeError", ":", "aid", "=", "afdeling", "afdeling", "=", "self", ...
List all `secties` in a `kadastrale afdeling`. :param afdeling: The :class:`Afdeling` for which the `secties` are \ wanted. Can also be the id of and `afdeling`. :rtype: A :class:`list` of `Sectie`.
[ "List", "all", "secties", "in", "a", "kadastrale", "afdeling", "." ]
python
train
34.027778
qubell/contrib-python-qubell-client
qubell/api/tools/__init__.py
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/tools/__init__.py#L312-L325
def get_manifest_from_meta(metaurl, name): """ Extact manifest url from metadata url :param metaurl: Url to metadata :param name: Name of application to extract :return: """ if 'http' in metaurl: kit = yaml.safe_load(requests.get(url=metaurl).content)['kit']['applications'] else:...
[ "def", "get_manifest_from_meta", "(", "metaurl", ",", "name", ")", ":", "if", "'http'", "in", "metaurl", ":", "kit", "=", "yaml", ".", "safe_load", "(", "requests", ".", "get", "(", "url", "=", "metaurl", ")", ".", "content", ")", "[", "'kit'", "]", ...
Extact manifest url from metadata url :param metaurl: Url to metadata :param name: Name of application to extract :return:
[ "Extact", "manifest", "url", "from", "metadata", "url", ":", "param", "metaurl", ":", "Url", "to", "metadata", ":", "param", "name", ":", "Name", "of", "application", "to", "extract", ":", "return", ":" ]
python
train
35.642857
python-xlib/python-xlib
Xlib/support/connect.py
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/support/connect.py#L58-L73
def get_display(display): """dname, protocol, host, dno, screen = get_display(display) Parse DISPLAY into its components. If DISPLAY is None, use the default display. The return values are: DNAME -- the full display name (string) PROTOCOL -- the protocol to use (None if automatic) H...
[ "def", "get_display", "(", "display", ")", ":", "modname", "=", "_display_mods", ".", "get", "(", "platform", ",", "_default_display_mod", ")", "mod", "=", "_relative_import", "(", "modname", ")", "return", "mod", ".", "get_display", "(", "display", ")" ]
dname, protocol, host, dno, screen = get_display(display) Parse DISPLAY into its components. If DISPLAY is None, use the default display. The return values are: DNAME -- the full display name (string) PROTOCOL -- the protocol to use (None if automatic) HOST -- the host name (string,...
[ "dname", "protocol", "host", "dno", "screen", "=", "get_display", "(", "display", ")" ]
python
train
37
samjabrahams/anchorhub
anchorhub/lib/armedcheckswitch.py
https://github.com/samjabrahams/anchorhub/blob/5ade359b08297d4003a5f477389c01de9e634b54/anchorhub/lib/armedcheckswitch.py#L39-L52
def switch(self, *args): """ Method that attempts to change the switch to the opposite of its current state. Calls either switch_on() or switch_off() to accomplish this. :param kwargs: an variable length dictionary of key-pair arguments passed through to either switc...
[ "def", "switch", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "is_switched", "(", ")", ":", "return", "self", ".", "switch_off", "(", "*", "args", ")", "else", ":", "return", "self", ".", "switch_on", "(", "*", "args", ")" ]
Method that attempts to change the switch to the opposite of its current state. Calls either switch_on() or switch_off() to accomplish this. :param kwargs: an variable length dictionary of key-pair arguments passed through to either switch_on() or switch_off() :return: Boole...
[ "Method", "that", "attempts", "to", "change", "the", "switch", "to", "the", "opposite", "of", "its", "current", "state", ".", "Calls", "either", "switch_on", "()", "or", "switch_off", "()", "to", "accomplish", "this", "." ]
python
train
38.285714
saltstack/salt
salt/cloud/clouds/dimensiondata.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/dimensiondata.py#L558-L578
def get_lb_conn(dd_driver=None): ''' Return a load-balancer conn object ''' vm_ = get_configured_provider() region = config.get_cloud_config_value( 'region', vm_, __opts__ ) user_id = config.get_cloud_config_value( 'user_id', vm_, __opts__ ) key = config.get_cloud_co...
[ "def", "get_lb_conn", "(", "dd_driver", "=", "None", ")", ":", "vm_", "=", "get_configured_provider", "(", ")", "region", "=", "config", ".", "get_cloud_config_value", "(", "'region'", ",", "vm_", ",", "__opts__", ")", "user_id", "=", "config", ".", "get_clo...
Return a load-balancer conn object
[ "Return", "a", "load", "-", "balancer", "conn", "object" ]
python
train
26.666667
saltstack/salt
salt/modules/sysmod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L677-L714
def list_runners(*args): ''' List the runners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runners Runner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_runn...
[ "def", "list_runners", "(", "*", "args", ")", ":", "run_", "=", "salt", ".", "runner", ".", "Runner", "(", "__opts__", ")", "runners", "=", "set", "(", ")", "if", "not", "args", ":", "for", "func", "in", "run_", ".", "functions", ":", "runners", "....
List the runners loaded on the minion .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' sys.list_runners Runner names can be specified as globs. .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' sys.list_runners 'm*'
[ "List", "the", "runners", "loaded", "on", "the", "minion" ]
python
train
22.605263
gwpy/gwpy
gwpy/timeseries/core.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/core.py#L1557-L1583
def coalesce(self): """Merge contiguous elements of this list into single objects This method implicitly sorts and potentially shortens this list. """ self.sort(key=lambda ts: ts.t0.value) i = j = 0 N = len(self) while j < N: this = self[j] ...
[ "def", "coalesce", "(", "self", ")", ":", "self", ".", "sort", "(", "key", "=", "lambda", "ts", ":", "ts", ".", "t0", ".", "value", ")", "i", "=", "j", "=", "0", "N", "=", "len", "(", "self", ")", "while", "j", "<", "N", ":", "this", "=", ...
Merge contiguous elements of this list into single objects This method implicitly sorts and potentially shortens this list.
[ "Merge", "contiguous", "elements", "of", "this", "list", "into", "single", "objects" ]
python
train
34.62963
b3j0f/utils
b3j0f/utils/reflect.py
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/reflect.py#L48-L145
def base_elts(elt, cls=None, depth=None): """Get bases elements of the input elt. - If elt is an instance, get class and all base classes. - If elt is a method, get all base methods. - If elt is a class, get all base classes. - In other case, get an empty list. :param elt: supposed inherited e...
[ "def", "base_elts", "(", "elt", ",", "cls", "=", "None", ",", "depth", "=", "None", ")", ":", "result", "=", "[", "]", "elt_name", "=", "getattr", "(", "elt", ",", "'__name__'", ",", "None", ")", "if", "elt_name", "is", "not", "None", ":", "cls", ...
Get bases elements of the input elt. - If elt is an instance, get class and all base classes. - If elt is a method, get all base methods. - If elt is a class, get all base classes. - In other case, get an empty list. :param elt: supposed inherited elt. :param cls: cls from where find attribute...
[ "Get", "bases", "elements", "of", "the", "input", "elt", "." ]
python
train
33.540816
aconrad/pycobertura
pycobertura/cobertura.py
https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L137-L152
def line_statuses(self, filename): """ Return a list of tuples `(lineno, status)` of all the lines found in the Cobertura report for the given file `filename` where `lineno` is the line number and `status` is coverage status of the line which can be either `True` (line hit) or `F...
[ "def", "line_statuses", "(", "self", ",", "filename", ")", ":", "line_elements", "=", "self", ".", "_get_lines_by_filename", "(", "filename", ")", "lines_w_status", "=", "[", "]", "for", "line", "in", "line_elements", ":", "lineno", "=", "int", "(", "line", ...
Return a list of tuples `(lineno, status)` of all the lines found in the Cobertura report for the given file `filename` where `lineno` is the line number and `status` is coverage status of the line which can be either `True` (line hit) or `False` (line miss).
[ "Return", "a", "list", "of", "tuples", "(", "lineno", "status", ")", "of", "all", "the", "lines", "found", "in", "the", "Cobertura", "report", "for", "the", "given", "file", "filename", "where", "lineno", "is", "the", "line", "number", "and", "status", "...
python
train
40
pybel/pybel
src/pybel/parser/parse_control.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/parser/parse_control.py#L372-L377
def clear(self): """Clear the statement_group, citation, evidence, and annotations.""" self.statement_group = None self.citation.clear() self.evidence = None self.annotations.clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "statement_group", "=", "None", "self", ".", "citation", ".", "clear", "(", ")", "self", ".", "evidence", "=", "None", "self", ".", "annotations", ".", "clear", "(", ")" ]
Clear the statement_group, citation, evidence, and annotations.
[ "Clear", "the", "statement_group", "citation", "evidence", "and", "annotations", "." ]
python
train
36.166667
HPENetworking/PYHPEIMC
pyhpeimc/plat/termaccess.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L443-L486
def remove_scope_ip(hostid, auth, url): """ Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au...
[ "def", "remove_scope_ip", "(", "hostid", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "'/imcrs/res/access/assignedIpScope/ip/'", "+", "str", "(", "hostid", ")", "response", "=", "requests", ".", "delete", "(", "f_url", ",", "auth", "=", "au...
Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: String of HTTP response c...
[ "Function", "to", "add", "remove", "IP", "address", "allocation" ]
python
train
34.727273
fastai/fastai
fastai/vision/image.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L41-L47
def _draw_rect(ax:plt.Axes, b:Collection[int], color:str='white', text=None, text_size=14): "Draw bounding box on `ax`." patch = ax.add_patch(patches.Rectangle(b[:2], *b[-2:], fill=False, edgecolor=color, lw=2)) _draw_outline(patch, 4) if text is not None: patch = ax.text(*b[:2], text, verticala...
[ "def", "_draw_rect", "(", "ax", ":", "plt", ".", "Axes", ",", "b", ":", "Collection", "[", "int", "]", ",", "color", ":", "str", "=", "'white'", ",", "text", "=", "None", ",", "text_size", "=", "14", ")", ":", "patch", "=", "ax", ".", "add_patch"...
Draw bounding box on `ax`.
[ "Draw", "bounding", "box", "on", "ax", "." ]
python
train
58.285714
cloudera/cm_api
python/src/cm_api/endpoints/types.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_api/endpoints/types.py#L1285-L1296
def config_to_api_list(dic): """ Converts a python dictionary into a list containing the proper ApiConfig encoding for configuration data. @param dic: Key-value pairs to convert. @return: JSON dictionary of an ApiConfig list (*not* an ApiList). """ config = [ ] for k, v in dic.iteritems(): config.a...
[ "def", "config_to_api_list", "(", "dic", ")", ":", "config", "=", "[", "]", "for", "k", ",", "v", "in", "dic", ".", "iteritems", "(", ")", ":", "config", ".", "append", "(", "{", "'name'", ":", "k", ",", "'value'", ":", "v", "}", ")", "return", ...
Converts a python dictionary into a list containing the proper ApiConfig encoding for configuration data. @param dic: Key-value pairs to convert. @return: JSON dictionary of an ApiConfig list (*not* an ApiList).
[ "Converts", "a", "python", "dictionary", "into", "a", "list", "containing", "the", "proper", "ApiConfig", "encoding", "for", "configuration", "data", "." ]
python
train
31.75
flatironinstitute/mlprocessors
mlprocessors/core.py
https://github.com/flatironinstitute/mlprocessors/blob/28d55542bbd02b9ddfe429db260f0be58f3820d3/mlprocessors/core.py#L386-L458
def invoke(proc, args=None, *, _instance = None, **kwargs): """ Executes the processor passing given arguments. :param args: a list of parameters in --key=value format. """ if args is None: args=[] for kwargname in kwargs: args.append('--'+kwargna...
[ "def", "invoke", "(", "proc", ",", "args", "=", "None", ",", "*", ",", "_instance", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "args", "is", "None", ":", "args", "=", "[", "]", "for", "kwargname", "in", "kwargs", ":", "args", ".", "a...
Executes the processor passing given arguments. :param args: a list of parameters in --key=value format.
[ "Executes", "the", "processor", "passing", "given", "arguments", "." ]
python
train
45.547945
gwpy/gwpy
gwpy/timeseries/io/losc.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/io/losc.py#L229-L271
def read_losc_hdf5_state(f, path='quality/simple', start=None, end=None, copy=False): """Read a `StateVector` from a LOSC-format HDF file. Parameters ---------- f : `str`, `h5py.HLObject` path of HDF5 file, or open `H5File` path : `str` path of HDF5 dataset...
[ "def", "read_losc_hdf5_state", "(", "f", ",", "path", "=", "'quality/simple'", ",", "start", "=", "None", ",", "end", "=", "None", ",", "copy", "=", "False", ")", ":", "# find data", "dataset", "=", "io_hdf5", ".", "find_dataset", "(", "f", ",", "'%s/DQm...
Read a `StateVector` from a LOSC-format HDF file. Parameters ---------- f : `str`, `h5py.HLObject` path of HDF5 file, or open `H5File` path : `str` path of HDF5 dataset to read. start : `Time`, `~gwpy.time.LIGOTimeGPS`, optional start GPS time of desired data end : `T...
[ "Read", "a", "StateVector", "from", "a", "LOSC", "-", "format", "HDF", "file", "." ]
python
train
31.232558
twisted/mantissa
xmantissa/websession.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/websession.py#L381-L396
def getCredentials(self, request): """ Derive credentials from an HTTP request. Override SessionWrapper.getCredentials to add the Host: header to the credentials. This will make web-based virtual hosting work. @type request: L{nevow.inevow.IRequest} @param request: The...
[ "def", "getCredentials", "(", "self", ",", "request", ")", ":", "username", "=", "usernameFromRequest", "(", "request", ")", "password", "=", "request", ".", "args", ".", "get", "(", "'password'", ",", "[", "''", "]", ")", "[", "0", "]", "return", "cre...
Derive credentials from an HTTP request. Override SessionWrapper.getCredentials to add the Host: header to the credentials. This will make web-based virtual hosting work. @type request: L{nevow.inevow.IRequest} @param request: The request being handled. @rtype: L{twisted.cred...
[ "Derive", "credentials", "from", "an", "HTTP", "request", "." ]
python
train
39.25
bitesofcode/projexui
projexui/dialogs/xconfigdialog/xconfigdialog.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/dialogs/xconfigdialog/xconfigdialog.py#L152-L168
def setCurrentPlugin( self, plugin ): """ Sets the current plugin item to the inputed plugin. :param plugin | <XConfigPlugin> || None """ if ( not plugin ): self.uiPluginTREE.setCurrentItem(None) return for i in range(sel...
[ "def", "setCurrentPlugin", "(", "self", ",", "plugin", ")", ":", "if", "(", "not", "plugin", ")", ":", "self", ".", "uiPluginTREE", ".", "setCurrentItem", "(", "None", ")", "return", "for", "i", "in", "range", "(", "self", ".", "uiPluginTREE", ".", "to...
Sets the current plugin item to the inputed plugin. :param plugin | <XConfigPlugin> || None
[ "Sets", "the", "current", "plugin", "item", "to", "the", "inputed", "plugin", ".", ":", "param", "plugin", "|", "<XConfigPlugin", ">", "||", "None" ]
python
train
35.529412
cmheisel/basecampreporting
src/basecampreporting/basecamp.py
https://github.com/cmheisel/basecampreporting/blob/88ecfc6e835608650ff6be23cbf2421d224c122b/src/basecampreporting/basecamp.py#L427-L439
def update_todo_item(self, item_id, content, party_id=None, notify=False): """ Modifies an existing item. The values work much like the "create item" operation, so you should refer to that for a more detailed explanation. """ path = '/todos/update_item/%u' % item_id req =...
[ "def", "update_todo_item", "(", "self", ",", "item_id", ",", "content", ",", "party_id", "=", "None", ",", "notify", "=", "False", ")", ":", "path", "=", "'/todos/update_item/%u'", "%", "item_id", "req", "=", "ET", ".", "Element", "(", "'request'", ")", ...
Modifies an existing item. The values work much like the "create item" operation, so you should refer to that for a more detailed explanation.
[ "Modifies", "an", "existing", "item", ".", "The", "values", "work", "much", "like", "the", "create", "item", "operation", "so", "you", "should", "refer", "to", "that", "for", "a", "more", "detailed", "explanation", "." ]
python
train
49.692308
aws/aws-xray-sdk-python
aws_xray_sdk/core/models/entity.py
https://github.com/aws/aws-xray-sdk-python/blob/707358cd3a516d51f2ebf71cf34f00e8d906a667/aws_xray_sdk/core/models/entity.py#L258-L279
def _delete_empty_properties(self, properties): """ Delete empty properties before serialization to avoid extra keys with empty values in the output json. """ if not self.parent_id: del properties['parent_id'] if not self.subsegments: del propertie...
[ "def", "_delete_empty_properties", "(", "self", ",", "properties", ")", ":", "if", "not", "self", ".", "parent_id", ":", "del", "properties", "[", "'parent_id'", "]", "if", "not", "self", ".", "subsegments", ":", "del", "properties", "[", "'subsegments'", "]...
Delete empty properties before serialization to avoid extra keys with empty values in the output json.
[ "Delete", "empty", "properties", "before", "serialization", "to", "avoid", "extra", "keys", "with", "empty", "values", "in", "the", "output", "json", "." ]
python
train
33.454545
mailgun/expiringdict
expiringdict/__init__.py
https://github.com/mailgun/expiringdict/blob/750048022cde40d35721253a88fbaa2df1781e94/expiringdict/__init__.py#L84-L95
def pop(self, key, default=None): """ Get item from the dict and remove it. Return default if expired or does not exist. Never raise KeyError. """ with self.lock: try: item = OrderedDict.__getitem__(self, key) del self[key] ret...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "with", "self", ".", "lock", ":", "try", ":", "item", "=", "OrderedDict", ".", "__getitem__", "(", "self", ",", "key", ")", "del", "self", "[", "key", "]", "return", "i...
Get item from the dict and remove it. Return default if expired or does not exist. Never raise KeyError.
[ "Get", "item", "from", "the", "dict", "and", "remove", "it", "." ]
python
train
31.666667
dnanexus/dx-toolkit
src/python/dxpy/utils/resolver.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1087-L1118
def check_folder_exists(project, path, folder_name): ''' :param project: project id :type project: string :param path: path to where we should look for the folder in question :type path: string :param folder_name: name of the folder in question :type folder_name: string :returns: A boole...
[ "def", "check_folder_exists", "(", "project", ",", "path", ",", "folder_name", ")", ":", "if", "folder_name", "is", "None", "or", "path", "is", "None", ":", "return", "False", "try", ":", "folder_list", "=", "dxpy", ".", "api", ".", "container_list_folder", ...
:param project: project id :type project: string :param path: path to where we should look for the folder in question :type path: string :param folder_name: name of the folder in question :type folder_name: string :returns: A boolean True or False whether the folder exists at the specified path ...
[ ":", "param", "project", ":", "project", "id", ":", "type", "project", ":", "string", ":", "param", "path", ":", "path", "to", "where", "we", "should", "look", "for", "the", "folder", "in", "question", ":", "type", "path", ":", "string", ":", "param", ...
python
train
40.125
CI-WATER/gsshapy
gsshapy/orm/cmt.py
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/cmt.py#L366-L395
def _writeMapTable(self, session, fileObject, mapTable, replaceParamFile): """ Write Generic Map Table Method This method writes a mapping table in the generic format to file. The method will handle both empty and filled cases of generic formatted mapping tables. session = SQLA...
[ "def", "_writeMapTable", "(", "self", ",", "session", ",", "fileObject", ",", "mapTable", ",", "replaceParamFile", ")", ":", "# Write mapping name", "fileObject", ".", "write", "(", "'%s \"%s\"\\n'", "%", "(", "mapTable", ".", "name", ",", "mapTable", ".", "in...
Write Generic Map Table Method This method writes a mapping table in the generic format to file. The method will handle both empty and filled cases of generic formatted mapping tables. session = SQLAlchemy session object for retrieving data from the database fileObject = The file objec...
[ "Write", "Generic", "Map", "Table", "Method" ]
python
train
38.566667
qubell/contrib-python-qubell-client
qubell/api/private/organization.py
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/private/organization.py#L513-L522
def get_user(self, id=None, name=None, email=None): """ Get user object by email or id. """ log.info("Picking user: %s (%s) (%s)" % (name, email, id)) from qubell.api.private.user import User if email: user = User.get(self._router, organization=self, email=email) ...
[ "def", "get_user", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "email", "=", "None", ")", ":", "log", ".", "info", "(", "\"Picking user: %s (%s) (%s)\"", "%", "(", "name", ",", "email", ",", "id", ")", ")", "from", "qubell", ...
Get user object by email or id.
[ "Get", "user", "object", "by", "email", "or", "id", "." ]
python
train
38.2
diefans/objective
src/objective/fields.py
https://github.com/diefans/objective/blob/e2de37f1cd4f5ad147ab3a5dee7dffd6806f2f88/src/objective/fields.py#L125-L159
def _deserialize(self, value, environment=None): """A collection traverses over something to deserialize its value. :param value: a ``dict`` wich contains mapped values """ if not isinstance(value, MappingABC): raise exc.Invalid(self) # traverse items and match aga...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "environment", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "MappingABC", ")", ":", "raise", "exc", ".", "Invalid", "(", "self", ")", "# traverse items and match against validated s...
A collection traverses over something to deserialize its value. :param value: a ``dict`` wich contains mapped values
[ "A", "collection", "traverses", "over", "something", "to", "deserialize", "its", "value", "." ]
python
train
30.057143
MLAB-project/pymlab
src/pymlab/sensors/lioncell.py
https://github.com/MLAB-project/pymlab/blob/d18d858ae83b203defcf2aead0dbd11b3c444658/src/pymlab/sensors/lioncell.py#L75-L77
def StateOfCharge(self): """ % of Full Charge """ return (self.bus.read_byte_data(self.address, 0x02) + self.bus.read_byte_data(self.address, 0x03) * 256)
[ "def", "StateOfCharge", "(", "self", ")", ":", "return", "(", "self", ".", "bus", ".", "read_byte_data", "(", "self", ".", "address", ",", "0x02", ")", "+", "self", ".", "bus", ".", "read_byte_data", "(", "self", ".", "address", ",", "0x03", ")", "*"...
% of Full Charge
[ "%", "of", "Full", "Charge" ]
python
train
56
biocore/burrito-fillings
bfillings/pplacer.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/pplacer.py#L153-L201
def insert_sequences_into_tree(aln, moltype, params={}, write_log=True): """Returns a tree from Alignment object aln. aln: an xxx.Alignment object, or data that can be used to build one. moltype: cogent.core.moltype.MolType object params: dict of parameters ...
[ "def", "insert_sequences_into_tree", "(", "aln", ",", "moltype", ",", "params", "=", "{", "}", ",", "write_log", "=", "True", ")", ":", "# convert aln to phy since seq_names need fixed to run through pplacer", "new_aln", "=", "get_align_for_phylip", "(", "StringIO", "("...
Returns a tree from Alignment object aln. aln: an xxx.Alignment object, or data that can be used to build one. moltype: cogent.core.moltype.MolType object params: dict of parameters to pass in to the RAxML app controller. The result will be an xxx.Alignment object, or None if tree fails.
[ "Returns", "a", "tree", "from", "Alignment", "object", "aln", "." ]
python
train
31.959184
spyder-ide/spyder
spyder/widgets/mixins.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L712-L767
def find_text(self, text, changed=True, forward=True, case=False, words=False, regexp=False): """Find text""" cursor = self.textCursor() findflag = QTextDocument.FindFlag() if not forward: findflag = findflag | QTextDocument.FindBackward i...
[ "def", "find_text", "(", "self", ",", "text", ",", "changed", "=", "True", ",", "forward", "=", "True", ",", "case", "=", "False", ",", "words", "=", "False", ",", "regexp", "=", "False", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")"...
Find text
[ "Find", "text" ]
python
train
39.857143
tensorflow/probability
tensorflow_probability/examples/disentangled_vae.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/disentangled_vae.py#L929-L962
def sample_dynamic_posterior(self, inputs, samples, static_sample=None): """Sample the static latent posterior. Args: inputs: A batch of intermediate representations of image frames across all timesteps, of shape [..., batch_size, timesteps, hidden_size]. samples: Number of samples ...
[ "def", "sample_dynamic_posterior", "(", "self", ",", "inputs", ",", "samples", ",", "static_sample", "=", "None", ")", ":", "if", "self", ".", "latent_posterior", "==", "\"factorized\"", ":", "dist", "=", "self", ".", "dynamic_encoder", "(", "inputs", ")", "...
Sample the static latent posterior. Args: inputs: A batch of intermediate representations of image frames across all timesteps, of shape [..., batch_size, timesteps, hidden_size]. samples: Number of samples to draw from the latent distribution. static_sample: A tensor sample of th...
[ "Sample", "the", "static", "latent", "posterior", "." ]
python
test
43.5
PlaidWeb/Publ
publ/image/local.py
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/image/local.py#L282-L330
def get_rendition_fit_size(spec, input_w, input_h, output_scale): """ Determine the scaled size based on the provided spec """ width = input_w height = input_h scale = spec.get('scale') if scale: width = width / scale height = height / scale min...
[ "def", "get_rendition_fit_size", "(", "spec", ",", "input_w", ",", "input_h", ",", "output_scale", ")", ":", "width", "=", "input_w", "height", "=", "input_h", "scale", "=", "spec", ".", "get", "(", "'scale'", ")", "if", "scale", ":", "width", "=", "widt...
Determine the scaled size based on the provided spec
[ "Determine", "the", "scaled", "size", "based", "on", "the", "provided", "spec" ]
python
train
31.020408
deep-compute/deeputil
deeputil/misc.py
https://github.com/deep-compute/deeputil/blob/9af5702bc3fd990688bf2aed16c20fa104be66df/deeputil/misc.py#L592-L611
def load_object(imp_path): ''' Given a python import path, load the object For dynamic imports in a program >>> isdir = load_object('os.path.isdir') >>> isdir('/tmp') True >>> num = load_object('numbers.Number') >>> isinstance('x', num) False >>> isinstance(777, num) True ...
[ "def", "load_object", "(", "imp_path", ")", ":", "module_name", ",", "obj_name", "=", "imp_path", ".", "split", "(", "'.'", ",", "1", ")", "module", "=", "__import__", "(", "module_name", ")", "obj", "=", "attrgetter", "(", "obj_name", ")", "(", "module"...
Given a python import path, load the object For dynamic imports in a program >>> isdir = load_object('os.path.isdir') >>> isdir('/tmp') True >>> num = load_object('numbers.Number') >>> isinstance('x', num) False >>> isinstance(777, num) True
[ "Given", "a", "python", "import", "path", "load", "the", "object", "For", "dynamic", "imports", "in", "a", "program" ]
python
train
22.5
marrow/mongo
marrow/mongo/query/query.py
https://github.com/marrow/mongo/blob/2066dc73e281b8a46cb5fc965267d6b8e1b18467/marrow/mongo/query/query.py#L531-L567
def near(self, center, sphere=False, min=None, max=None): """Order results by their distance from the given point, optionally with range limits in meters. Geospatial operator: {$near: {...}} Documentation: https://docs.mongodb.com/manual/reference/operator/query/near/#op._S_near { $near: { $geom...
[ "def", "near", "(", "self", ",", "center", ",", "sphere", "=", "False", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "from", "marrow", ".", "mongo", ".", "geo", "import", "Point", "near", "=", "{", "'$geometry'", ":", "Point", "(", ...
Order results by their distance from the given point, optionally with range limits in meters. Geospatial operator: {$near: {...}} Documentation: https://docs.mongodb.com/manual/reference/operator/query/near/#op._S_near { $near: { $geometry: <center; Point or (long, lat)>, $minDistance: <min; ...
[ "Order", "results", "by", "their", "distance", "from", "the", "given", "point", "optionally", "with", "range", "limits", "in", "meters", ".", "Geospatial", "operator", ":", "{", "$near", ":", "{", "...", "}}", "Documentation", ":", "https", ":", "//", "doc...
python
train
27.486486
pvlib/pvlib-python
pvlib/pvsystem.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/pvsystem.py#L202-L220
def get_aoi(self, solar_zenith, solar_azimuth): """Get the angle of incidence on the system. Parameters ---------- solar_zenith : float or Series. Solar zenith angle. solar_azimuth : float or Series. Solar azimuth angle. Returns ------- ...
[ "def", "get_aoi", "(", "self", ",", "solar_zenith", ",", "solar_azimuth", ")", ":", "aoi", "=", "irradiance", ".", "aoi", "(", "self", ".", "surface_tilt", ",", "self", ".", "surface_azimuth", ",", "solar_zenith", ",", "solar_azimuth", ")", "return", "aoi" ]
Get the angle of incidence on the system. Parameters ---------- solar_zenith : float or Series. Solar zenith angle. solar_azimuth : float or Series. Solar azimuth angle. Returns ------- aoi : Series The angle of incidence
[ "Get", "the", "angle", "of", "incidence", "on", "the", "system", "." ]
python
train
27.157895
rehandalal/therapist
therapist/runner/runner.py
https://github.com/rehandalal/therapist/blob/1995a7e396eea2ec8685bb32a779a4110b459b1f/therapist/runner/runner.py#L47-L90
def run_process(self, process): """Runs a single action.""" message = u'#{bright}' message += u'{} '.format(str(process)[:68]).ljust(69, '.') stashed = False if self.unstaged_changes and not self.include_unstaged_changes: out, err, code = self.git.stash(keep_index=Tr...
[ "def", "run_process", "(", "self", ",", "process", ")", ":", "message", "=", "u'#{bright}'", "message", "+=", "u'{} '", ".", "format", "(", "str", "(", "process", ")", "[", ":", "68", "]", ")", ".", "ljust", "(", "69", ",", "'.'", ")", "stashed", "...
Runs a single action.
[ "Runs", "a", "single", "action", "." ]
python
train
39.454545
hydraplatform/hydra-base
hydra_base/lib/template.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/template.py#L1692-L1705
def add_typeattr(typeattr,**kwargs): """ Add an typeattr to an existing type. """ tmpltype = get_templatetype(typeattr.type_id, user_id=kwargs.get('user_id')) ta = _set_typeattr(typeattr) tmpltype.typeattrs.append(ta) db.DBSession.flush() return ta
[ "def", "add_typeattr", "(", "typeattr", ",", "*", "*", "kwargs", ")", ":", "tmpltype", "=", "get_templatetype", "(", "typeattr", ".", "type_id", ",", "user_id", "=", "kwargs", ".", "get", "(", "'user_id'", ")", ")", "ta", "=", "_set_typeattr", "(", "type...
Add an typeattr to an existing type.
[ "Add", "an", "typeattr", "to", "an", "existing", "type", "." ]
python
train
19.714286
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autogender.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autogender.py#L149-L186
def genderize(name, api_token=None): """Fetch gender from genderize.io""" GENDERIZE_API_URL = "https://api.genderize.io/" TOTAL_RETRIES = 10 MAX_RETRIES = 5 SLEEP_TIME = 0.25 STATUS_FORCELIST = [502] params = { 'name': name } if api_token: params['apikey'] = api_to...
[ "def", "genderize", "(", "name", ",", "api_token", "=", "None", ")", ":", "GENDERIZE_API_URL", "=", "\"https://api.genderize.io/\"", "TOTAL_RETRIES", "=", "10", "MAX_RETRIES", "=", "5", "SLEEP_TIME", "=", "0.25", "STATUS_FORCELIST", "=", "[", "502", "]", "params...
Fetch gender from genderize.io
[ "Fetch", "gender", "from", "genderize", ".", "io" ]
python
train
28.263158
codeinn/vcs
vcs/backends/git/changeset.py
https://github.com/codeinn/vcs/blob/e6cd94188e9c36d273411bf3adc0584ac6ab92a0/vcs/backends/git/changeset.py#L341-L394
def fill_archive(self, stream=None, kind='tgz', prefix=None, subrepos=False): """ Fills up given stream. :param stream: file like object. :param kind: one of following: ``zip``, ``tgz`` or ``tbz2``. Default: ``tgz``. :param prefix: name of root d...
[ "def", "fill_archive", "(", "self", ",", "stream", "=", "None", ",", "kind", "=", "'tgz'", ",", "prefix", "=", "None", ",", "subrepos", "=", "False", ")", ":", "allowed_kinds", "=", "settings", ".", "ARCHIVE_SPECS", ".", "keys", "(", ")", "if", "kind",...
Fills up given stream. :param stream: file like object. :param kind: one of following: ``zip``, ``tgz`` or ``tbz2``. Default: ``tgz``. :param prefix: name of root directory in archive. Default is repository name and changeset's raw_id joined with dash (``repo...
[ "Fills", "up", "given", "stream", "." ]
python
train
37.277778
usc-isi-i2/etk
etk/extractors/spacy_ner_extractor.py
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/extractors/spacy_ner_extractor.py#L29-L49
def extract(self, text: str, get_attr=['PERSON', 'ORG', 'GPE']) -> List[Extraction]: """ Args: text (str): the text to extract from. get_attr (List[str]): The spaCy NER attributes we're interested in. Returns: List(Extraction): the list of extraction or the e...
[ "def", "extract", "(", "self", ",", "text", ":", "str", ",", "get_attr", "=", "[", "'PERSON'", ",", "'ORG'", ",", "'GPE'", "]", ")", "->", "List", "[", "Extraction", "]", ":", "doc", "=", "self", ".", "__nlp", "(", "text", ")", "attr_list", "=", ...
Args: text (str): the text to extract from. get_attr (List[str]): The spaCy NER attributes we're interested in. Returns: List(Extraction): the list of extraction or the empty list if there are no matches.
[ "Args", ":", "text", "(", "str", ")", ":", "the", "text", "to", "extract", "from", ".", "get_attr", "(", "List", "[", "str", "]", ")", ":", "The", "spaCy", "NER", "attributes", "we", "re", "interested", "in", "." ]
python
train
46
JarryShaw/PyPCAPKit
src/protocols/internet/ipv6_route.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv6_route.py#L258-L295
def _read_data_type_2(self, length): """Read IPv6-Route Type 2 data. Structure of IPv6-Route Type 2 data [RFC 6275]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len=2 | Routing Type=2|Segments Left=1| +-+-+-+-+-+-+-+-+-...
[ "def", "_read_data_type_2", "(", "self", ",", "length", ")", ":", "if", "length", "!=", "20", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Typeno 2] invalid format'", ")", "_resv", "=", "self", ".", "_read_fileng", "(", "4", ")", "_home", "=", "self",...
Read IPv6-Route Type 2 data. Structure of IPv6-Route Type 2 data [RFC 6275]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len=2 | Routing Type=2|Segments Left=1| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ...
[ "Read", "IPv6", "-", "Route", "Type", "2", "data", "." ]
python
train
49.763158
pytroll/satpy
satpy/readers/sar_c_safe.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/sar_c_safe.py#L428-L455
def get_lonlatalts(self): """Obtain GCPs and construct latitude and longitude arrays. Args: band (gdal band): Measurement band which comes with GCP's array_shape (tuple) : The size of the data array Returns: coordinates (tuple): A tuple with longitude and latitu...
[ "def", "get_lonlatalts", "(", "self", ")", ":", "band", "=", "self", ".", "filehandle", "(", "xpoints", ",", "ypoints", ")", ",", "(", "gcp_lons", ",", "gcp_lats", ",", "gcp_alts", ")", ",", "(", "gcps", ",", "crs", ")", "=", "self", ".", "get_gcps",...
Obtain GCPs and construct latitude and longitude arrays. Args: band (gdal band): Measurement band which comes with GCP's array_shape (tuple) : The size of the data array Returns: coordinates (tuple): A tuple with longitude and latitude arrays
[ "Obtain", "GCPs", "and", "construct", "latitude", "and", "longitude", "arrays", "." ]
python
train
37.607143
RudolfCardinal/pythonlib
cardinal_pythonlib/rnc_db.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/rnc_db.py#L1931-L1949
def ping(self) -> None: """Pings a database connection, reconnecting if necessary.""" if self.db is None or self.db_pythonlib not in [PYTHONLIB_MYSQLDB, PYTHONLIB_PYMYSQL]: return try: self.db.ping(True) # test conn...
[ "def", "ping", "(", "self", ")", "->", "None", ":", "if", "self", ".", "db", "is", "None", "or", "self", ".", "db_pythonlib", "not", "in", "[", "PYTHONLIB_MYSQLDB", ",", "PYTHONLIB_PYMYSQL", "]", ":", "return", "try", ":", "self", ".", "db", ".", "pi...
Pings a database connection, reconnecting if necessary.
[ "Pings", "a", "database", "connection", "reconnecting", "if", "necessary", "." ]
python
train
51.947368
dwavesystems/dimod
dimod/roof_duality/fix_variables.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/roof_duality/fix_variables.py#L19-L103
def fix_variables(bqm, sampling_mode=True): """Determine assignments for some variables of a binary quadratic model. Roof duality finds a lower bound for the minimum of a quadratic polynomial. It can also find minimizing assignments for some of the polynomial's variables; these fixed variables take the...
[ "def", "fix_variables", "(", "bqm", ",", "sampling_mode", "=", "True", ")", ":", "try", ":", "from", "dimod", ".", "roof_duality", ".", "_fix_variables", "import", "fix_variables_wrapper", "except", "ImportError", ":", "raise", "ImportError", "(", "\"c++ extension...
Determine assignments for some variables of a binary quadratic model. Roof duality finds a lower bound for the minimum of a quadratic polynomial. It can also find minimizing assignments for some of the polynomial's variables; these fixed variables take the same values in all optimal solutions [BHT]_ [BH]_....
[ "Determine", "assignments", "for", "some", "variables", "of", "a", "binary", "quadratic", "model", "." ]
python
train
41.776471
CitrineInformatics/pif-dft
dfttopif/parsers/vasp.py
https://github.com/CitrineInformatics/pif-dft/blob/d5411dc1f6c6e8d454b132977ca7ab3bb8131a80/dfttopif/parsers/vasp.py#L354-L380
def _get_bandgap_doscar(filename): """Get the bandgap from the DOSCAR file""" with open(filename) as fp: for i in range(6): l = fp.readline() efermi = float(l.split()[3]) step1 = fp.readline().split()[0] step2 = fp.readline().split()[0] ...
[ "def", "_get_bandgap_doscar", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "fp", ":", "for", "i", "in", "range", "(", "6", ")", ":", "l", "=", "fp", ".", "readline", "(", ")", "efermi", "=", "float", "(", "l", ".", "spli...
Get the bandgap from the DOSCAR file
[ "Get", "the", "bandgap", "from", "the", "DOSCAR", "file" ]
python
train
34.62963
acutesoftware/AIKIF
aikif/toolbox/cls_grid.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/cls_grid.py#L119-L124
def replace_row(self, line, ndx): """ replace a grids row at index 'ndx' with 'line' """ for col in range(len(line)): self.set_tile(ndx, col, line[col])
[ "def", "replace_row", "(", "self", ",", "line", ",", "ndx", ")", ":", "for", "col", "in", "range", "(", "len", "(", "line", ")", ")", ":", "self", ".", "set_tile", "(", "ndx", ",", "col", ",", "line", "[", "col", "]", ")" ]
replace a grids row at index 'ndx' with 'line'
[ "replace", "a", "grids", "row", "at", "index", "ndx", "with", "line" ]
python
train
32.166667
h2non/pook
pook/mock.py
https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/mock.py#L170-L185
def path(self, path): """ Defines a URL path to match. Only call this method if the URL has no path already defined. Arguments: path (str): URL path value to match. E.g: ``/api/users``. Returns: self: current Mock instance. """ url = fur...
[ "def", "path", "(", "self", ",", "path", ")", ":", "url", "=", "furl", "(", "self", ".", "_request", ".", "rawurl", ")", "url", ".", "path", "=", "path", "self", ".", "_request", ".", "url", "=", "url", ".", "url", "self", ".", "add_matcher", "("...
Defines a URL path to match. Only call this method if the URL has no path already defined. Arguments: path (str): URL path value to match. E.g: ``/api/users``. Returns: self: current Mock instance.
[ "Defines", "a", "URL", "path", "to", "match", "." ]
python
test
27.6875
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/work_item_tracking/work_item_tracking_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/work_item_tracking/work_item_tracking_client.py#L189-L207
def get_root_nodes(self, project, depth=None): """GetRootNodes. [Preview API] Gets root classification nodes under the project. :param str project: Project ID or project name :param int depth: Depth of children to fetch. :rtype: [WorkItemClassificationNode] """ ro...
[ "def", "get_root_nodes", "(", "self", ",", "project", ",", "depth", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ".", "url", "(",...
GetRootNodes. [Preview API] Gets root classification nodes under the project. :param str project: Project ID or project name :param int depth: Depth of children to fetch. :rtype: [WorkItemClassificationNode]
[ "GetRootNodes", ".", "[", "Preview", "API", "]", "Gets", "root", "classification", "nodes", "under", "the", "project", ".", ":", "param", "str", "project", ":", "Project", "ID", "or", "project", "name", ":", "param", "int", "depth", ":", "Depth", "of", "...
python
train
52
duniter/duniter-python-api
duniterpy/api/bma/wot.py
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/api/bma/wot.py#L328-L336
async def certify(client: Client, certification_signed_raw: str) -> ClientResponse: """ POST certification raw document :param client: Client to connect to the api :param certification_signed_raw: Certification raw document :return: """ return await client.post(MODULE + '/certify', {'cert':...
[ "async", "def", "certify", "(", "client", ":", "Client", ",", "certification_signed_raw", ":", "str", ")", "->", "ClientResponse", ":", "return", "await", "client", ".", "post", "(", "MODULE", "+", "'/certify'", ",", "{", "'cert'", ":", "certification_signed_r...
POST certification raw document :param client: Client to connect to the api :param certification_signed_raw: Certification raw document :return:
[ "POST", "certification", "raw", "document" ]
python
train
40.333333
airysen/caimcaim
caimcaim/caimcaim.py
https://github.com/airysen/caimcaim/blob/82e3ce700da8c23ab6199524f646c790cce0b460/caimcaim/caimcaim.py#L63-L133
def fit(self, X, y): """ Fit CAIM Parameters ---------- X : array-like, pandas dataframe, shape [n_samples, n_feature] Input array can contain missing values y: array-like, pandas dataframe, shape [n_samples] Target variable. Must be categorical. ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ")", ":", "self", ".", "split_scheme", "=", "dict", "(", ")", "if", "isinstance", "(", "X", ",", "pd", ".", "DataFrame", ")", ":", "# self.indx = X.index", "# self.columns = X.columns", "if", "isinstance", "...
Fit CAIM Parameters ---------- X : array-like, pandas dataframe, shape [n_samples, n_feature] Input array can contain missing values y: array-like, pandas dataframe, shape [n_samples] Target variable. Must be categorical. Returns ------- s...
[ "Fit", "CAIM", "Parameters", "----------", "X", ":", "array", "-", "like", "pandas", "dataframe", "shape", "[", "n_samples", "n_feature", "]", "Input", "array", "can", "contain", "missing", "values", "y", ":", "array", "-", "like", "pandas", "dataframe", "sh...
python
train
37.633803
pyparsing/pyparsing
examples/pymicko.py
https://github.com/pyparsing/pyparsing/blob/f0264bd8d1a548a50b3e5f7d99cfefd577942d14/examples/pymicko.py#L1192-L1206
def if_body_action(self, text, loc, arg): """Code executed after recognising if statement's body""" exshared.setpos(loc, text) if DEBUG > 0: print("IF_BODY:",arg) if DEBUG == 2: self.symtab.display() if DEBUG > 2: return #generate conditional ju...
[ "def", "if_body_action", "(", "self", ",", "text", ",", "loc", ",", "arg", ")", ":", "exshared", ".", "setpos", "(", "loc", ",", "text", ")", "if", "DEBUG", ">", "0", ":", "print", "(", "\"IF_BODY:\"", ",", "arg", ")", "if", "DEBUG", "==", "2", "...
Code executed after recognising if statement's body
[ "Code", "executed", "after", "recognising", "if", "statement", "s", "body" ]
python
train
54.4
pycampers/zproc
zproc/state/server.py
https://github.com/pycampers/zproc/blob/352a3c7166e2ccc3597c28385a8354b5a22afdc2/zproc/state/server.py#L83-L88
def run_fn_atomically(self, request): """Execute a function, atomically and reply with the result.""" fn = serializer.loads_fn(request[Msgs.info]) args, kwargs = request[Msgs.args], request[Msgs.kwargs] with self.mutate_safely(): self.reply(fn(self.state, *args, **kwargs))
[ "def", "run_fn_atomically", "(", "self", ",", "request", ")", ":", "fn", "=", "serializer", ".", "loads_fn", "(", "request", "[", "Msgs", ".", "info", "]", ")", "args", ",", "kwargs", "=", "request", "[", "Msgs", ".", "args", "]", ",", "request", "["...
Execute a function, atomically and reply with the result.
[ "Execute", "a", "function", "atomically", "and", "reply", "with", "the", "result", "." ]
python
train
52
Azure/azure-sdk-for-python
azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1625-L1663
def capture_role(self, service_name, deployment_name, role_name, post_capture_action, target_image_name, target_image_label, provisioning_configuration=None): ''' The Capture Role operation captures a virtual machine image to your image gallery. From the...
[ "def", "capture_role", "(", "self", ",", "service_name", ",", "deployment_name", ",", "role_name", ",", "post_capture_action", ",", "target_image_name", ",", "target_image_label", ",", "provisioning_configuration", "=", "None", ")", ":", "_validate_not_none", "(", "'s...
The Capture Role operation captures a virtual machine image to your image gallery. From the captured image, you can create additional customized virtual machines. service_name: The name of the service. deployment_name: The name of the deployment. role_nam...
[ "The", "Capture", "Role", "operation", "captures", "a", "virtual", "machine", "image", "to", "your", "image", "gallery", ".", "From", "the", "captured", "image", "you", "can", "create", "additional", "customized", "virtual", "machines", "." ]
python
test
45.384615
apache/airflow
airflow/contrib/hooks/bigquery_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L923-L994
def run_copy(self, source_project_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED', labels=None): """ Executes a BigQuery copy command to copy dat...
[ "def", "run_copy", "(", "self", ",", "source_project_dataset_tables", ",", "destination_project_dataset_table", ",", "write_disposition", "=", "'WRITE_EMPTY'", ",", "create_disposition", "=", "'CREATE_IF_NEEDED'", ",", "labels", "=", "None", ")", ":", "source_project_data...
Executes a BigQuery copy command to copy data from one BigQuery table to another. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy For more details about these parameters. :param source_project_dataset_tables: One or more dotted ``(proj...
[ "Executes", "a", "BigQuery", "copy", "command", "to", "copy", "data", "from", "one", "BigQuery", "table", "to", "another", ".", "See", "here", ":" ]
python
test
42.944444
numenta/htmresearch
htmresearch/frameworks/location/location_network_creation.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/location/location_network_creation.py#L645-L649
def getL2Representations(self): """ Returns the active representation in L2. """ return [set(L2.getSelf()._pooler.getActiveCells()) for L2 in self.L2Regions]
[ "def", "getL2Representations", "(", "self", ")", ":", "return", "[", "set", "(", "L2", ".", "getSelf", "(", ")", ".", "_pooler", ".", "getActiveCells", "(", ")", ")", "for", "L2", "in", "self", ".", "L2Regions", "]" ]
Returns the active representation in L2.
[ "Returns", "the", "active", "representation", "in", "L2", "." ]
python
train
33.8