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
Vagrants/blackbird
blackbird/plugins/base.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/plugins/base.py#L97-L111
def __set_timestamp(self, clock): """ If "clock" is None, set the time now. This function is called self.__init__() """ if clock is None: unix_timestamp = time.mktime( datetime.datetime.now().utctimetuple() ) timestamp = int(uni...
[ "def", "__set_timestamp", "(", "self", ",", "clock", ")", ":", "if", "clock", "is", "None", ":", "unix_timestamp", "=", "time", ".", "mktime", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "utctimetuple", "(", ")", ")", "timestamp", "=",...
If "clock" is None, set the time now. This function is called self.__init__()
[ "If", "clock", "is", "None", "set", "the", "time", "now", ".", "This", "function", "is", "called", "self", ".", "__init__", "()" ]
python
train
25.866667
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/utils/path.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/path.py#L79-L85
def unquote_filename(name, win32=(sys.platform=='win32')): """ On Windows, remove leading and trailing quotes from filenames. """ if win32: if name.startswith(("'", '"')) and name.endswith(("'", '"')): name = name[1:-1] return name
[ "def", "unquote_filename", "(", "name", ",", "win32", "=", "(", "sys", ".", "platform", "==", "'win32'", ")", ")", ":", "if", "win32", ":", "if", "name", ".", "startswith", "(", "(", "\"'\"", ",", "'\"'", ")", ")", "and", "name", ".", "endswith", "...
On Windows, remove leading and trailing quotes from filenames.
[ "On", "Windows", "remove", "leading", "and", "trailing", "quotes", "from", "filenames", "." ]
python
test
37.285714
SoCo/SoCo
soco/core.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/core.py#L1070-L1086
def switch_to_line_in(self, source=None): """ Switch the speaker's input to line-in. Args: source (SoCo): The speaker whose line-in should be played. Default is line-in from the speaker itself. """ if source: uid = source.uid else: ...
[ "def", "switch_to_line_in", "(", "self", ",", "source", "=", "None", ")", ":", "if", "source", ":", "uid", "=", "source", ".", "uid", "else", ":", "uid", "=", "self", ".", "uid", "self", ".", "avTransport", ".", "SetAVTransportURI", "(", "[", "(", "'...
Switch the speaker's input to line-in. Args: source (SoCo): The speaker whose line-in should be played. Default is line-in from the speaker itself.
[ "Switch", "the", "speaker", "s", "input", "to", "line", "-", "in", "." ]
python
train
30.176471
LudovicRousseau/PyKCS11
PyKCS11/__init__.py
https://github.com/LudovicRousseau/PyKCS11/blob/76ccd8741af2ea193aaf1ca29dfedfa412c134fe/PyKCS11/__init__.py#L466-L483
def load(self, pkcs11dll_filename=None, *init_string): """ load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a...
[ "def", "load", "(", "self", ",", "pkcs11dll_filename", "=", "None", ",", "*", "init_string", ")", ":", "if", "pkcs11dll_filename", "is", "None", ":", "pkcs11dll_filename", "=", "os", ".", "getenv", "(", "\"PYKCS11LIB\"", ")", "if", "pkcs11dll_filename", "is", ...
load a PKCS#11 library :type pkcs11dll_filename: string :param pkcs11dll_filename: the library name. If this parameter is not set then the environment variable `PYKCS11LIB` is used instead :returns: a :class:`PyKCS11Lib` object :raises: :class:`PyKCS11Error` (-1): wh...
[ "load", "a", "PKCS#11", "library" ]
python
test
42.666667
BerkeleyAutomation/perception
perception/primesense_sensor.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L160-L175
def _read_depth_image(self): """ Reads a depth image from the device """ # read raw uint16 buffer im_arr = self._depth_stream.read_frame() raw_buf = im_arr.get_buffer_as_uint16() buf_array = np.array([raw_buf[i] for i in range(PrimesenseSensor.DEPTH_IM_WIDTH * PrimesenseSensor.DE...
[ "def", "_read_depth_image", "(", "self", ")", ":", "# read raw uint16 buffer", "im_arr", "=", "self", ".", "_depth_stream", ".", "read_frame", "(", ")", "raw_buf", "=", "im_arr", ".", "get_buffer_as_uint16", "(", ")", "buf_array", "=", "np", ".", "array", "(",...
Reads a depth image from the device
[ "Reads", "a", "depth", "image", "from", "the", "device" ]
python
train
48.4375
amzn/ion-python
amazon/ion/reader_text.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_text.py#L598-L612
def _number_zero_start_handler(c, ctx): """Handles numeric values that start with zero or negative zero. Branches to delegate co-routines according to _ZERO_START_TABLE. """ assert c == _ZERO assert len(ctx.value) == 0 or (len(ctx.value) == 1 and ctx.value[0] == _MINUS) ctx.set_ion_type(IonType....
[ "def", "_number_zero_start_handler", "(", "c", ",", "ctx", ")", ":", "assert", "c", "==", "_ZERO", "assert", "len", "(", "ctx", ".", "value", ")", "==", "0", "or", "(", "len", "(", "ctx", ".", "value", ")", "==", "1", "and", "ctx", ".", "value", ...
Handles numeric values that start with zero or negative zero. Branches to delegate co-routines according to _ZERO_START_TABLE.
[ "Handles", "numeric", "values", "that", "start", "with", "zero", "or", "negative", "zero", ".", "Branches", "to", "delegate", "co", "-", "routines", "according", "to", "_ZERO_START_TABLE", "." ]
python
train
45.866667
horazont/aioxmpp
aioxmpp/stream.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2359-L2434
def resume_sm(self, xmlstream): """ Resume an SM-enabled stream using the given `xmlstream`. If the server rejects the attempt to resume stream management, a :class:`.errors.StreamNegotiationFailure` is raised. The stream is then in stopped state and stream management has been s...
[ "def", "resume_sm", "(", "self", ",", "xmlstream", ")", ":", "if", "self", ".", "running", ":", "raise", "RuntimeError", "(", "\"Cannot resume Stream Management while\"", "\" StanzaStream is running\"", ")", "self", ".", "_start_prepare", "(", "xmlstream", ",", "sel...
Resume an SM-enabled stream using the given `xmlstream`. If the server rejects the attempt to resume stream management, a :class:`.errors.StreamNegotiationFailure` is raised. The stream is then in stopped state and stream management has been stopped. .. warning:: This metho...
[ "Resume", "an", "SM", "-", "enabled", "stream", "using", "the", "given", "xmlstream", "." ]
python
train
38.986842
timothydmorton/isochrones
isochrones/isochrone.py
https://github.com/timothydmorton/isochrones/blob/d84495573044c66db2fd6b959fe69e370757ea14/isochrones/isochrone.py#L376-L445
def isochrone(self,age,feh=0.0,minm=None,maxm=None,dm=0.02, return_df=True,distance=None,AV=0.0): """ Returns stellar models at constant age and feh, for a range of masses :param age: log10(age) of desired isochrone. :param feh: (optional) Meta...
[ "def", "isochrone", "(", "self", ",", "age", ",", "feh", "=", "0.0", ",", "minm", "=", "None", ",", "maxm", "=", "None", ",", "dm", "=", "0.02", ",", "return_df", "=", "True", ",", "distance", "=", "None", ",", "AV", "=", "0.0", ")", ":", "if",...
Returns stellar models at constant age and feh, for a range of masses :param age: log10(age) of desired isochrone. :param feh: (optional) Metallicity of desired isochrone (default = 0.0) :param minm, maxm: (optional) Mass range of desired isochrone (will de...
[ "Returns", "stellar", "models", "at", "constant", "age", "and", "feh", "for", "a", "range", "of", "masses" ]
python
train
32.742857
mdickinson/bigfloat
bigfloat/core.py
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1104-L1117
def div(x, y, context=None): """ Return ``x`` divided by ``y``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_div, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ), context, )
[ "def", "div", "(", "x", ",", "y", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_div", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", "BigFloat", ".", "...
Return ``x`` divided by ``y``.
[ "Return", "x", "divided", "by", "y", "." ]
python
train
20.357143
polyaxon/polyaxon-cli
polyaxon_cli/cli/project.py
https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/project.py#L140-L170
def get(ctx): """Get info for current project, by project_name, or user/project_name. Uses [Caching](/references/polyaxon-cli/#caching) Examples: To get current project: \b ```bash $ polyaxon project get ``` To get a project by name \b ```bash $ polyaxon project get...
[ "def", "get", "(", "ctx", ")", ":", "user", ",", "project_name", "=", "get_project_or_local", "(", "ctx", ".", "obj", ".", "get", "(", "'project'", ")", ")", "try", ":", "response", "=", "PolyaxonClient", "(", ")", ".", "project", ".", "get_project", "...
Get info for current project, by project_name, or user/project_name. Uses [Caching](/references/polyaxon-cli/#caching) Examples: To get current project: \b ```bash $ polyaxon project get ``` To get a project by name \b ```bash $ polyaxon project get user/project ```
[ "Get", "info", "for", "current", "project", "by", "project_name", "or", "user", "/", "project_name", "." ]
python
valid
24.451613
nerdvegas/rez
src/rez/packages_.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/packages_.py#L228-L235
def parent(self): """Get the parent package family. Returns: `PackageFamily`. """ family = self.repository.get_parent_package_family(self.resource) return PackageFamily(family) if family else None
[ "def", "parent", "(", "self", ")", ":", "family", "=", "self", ".", "repository", ".", "get_parent_package_family", "(", "self", ".", "resource", ")", "return", "PackageFamily", "(", "family", ")", "if", "family", "else", "None" ]
Get the parent package family. Returns: `PackageFamily`.
[ "Get", "the", "parent", "package", "family", "." ]
python
train
30.25
thiagopbueno/pyrddl
pyrddl/domain.py
https://github.com/thiagopbueno/pyrddl/blob/3bcfa850b1a7532c7744358f3c6b9e0f8ab978c9/pyrddl/domain.py#L206-L214
def interm_fluent_ordering(self) -> List[str]: '''The list of intermediate-fluent names in canonical order. Returns: List[str]: A list of fluent names. ''' interm_fluents = self.intermediate_fluents.values() key = lambda pvar: (pvar.level, pvar.name) return [...
[ "def", "interm_fluent_ordering", "(", "self", ")", "->", "List", "[", "str", "]", ":", "interm_fluents", "=", "self", ".", "intermediate_fluents", ".", "values", "(", ")", "key", "=", "lambda", "pvar", ":", "(", "pvar", ".", "level", ",", "pvar", ".", ...
The list of intermediate-fluent names in canonical order. Returns: List[str]: A list of fluent names.
[ "The", "list", "of", "intermediate", "-", "fluent", "names", "in", "canonical", "order", "." ]
python
train
40.666667
graphistry/pygraphistry
graphistry/pygraphistry.py
https://github.com/graphistry/pygraphistry/blob/3dfc50e60232c6f5fedd6e5fa9d3048b606944b8/graphistry/pygraphistry.py#L84-L93
def authenticate(): """Authenticate via already provided configuration. This is called once automatically per session when uploading and rendering a visualization.""" key = PyGraphistry.api_key() #Mocks may set to True, so bypass in that case if (key is None) and PyGraphistry._is...
[ "def", "authenticate", "(", ")", ":", "key", "=", "PyGraphistry", ".", "api_key", "(", ")", "#Mocks may set to True, so bypass in that case", "if", "(", "key", "is", "None", ")", "and", "PyGraphistry", ".", "_is_authenticated", "==", "False", ":", "util", ".", ...
Authenticate via already provided configuration. This is called once automatically per session when uploading and rendering a visualization.
[ "Authenticate", "via", "already", "provided", "configuration", ".", "This", "is", "called", "once", "automatically", "per", "session", "when", "uploading", "and", "rendering", "a", "visualization", "." ]
python
train
59.3
twisted/mantissa
xmantissa/sharing.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/sharing.py#L202-L223
def allRoles(self, memo=None): """ Identify all the roles that this role is authorized to act as. @param memo: used only for recursion. Do not pass this. @return: an iterator of all roles that this role is a member of, including itself. """ if memo is None: ...
[ "def", "allRoles", "(", "self", ",", "memo", "=", "None", ")", ":", "if", "memo", "is", "None", ":", "memo", "=", "set", "(", ")", "elif", "self", "in", "memo", ":", "# this is bad, but we have successfully detected and prevented the", "# only really bad symptom, ...
Identify all the roles that this role is authorized to act as. @param memo: used only for recursion. Do not pass this. @return: an iterator of all roles that this role is a member of, including itself.
[ "Identify", "all", "the", "roles", "that", "this", "role", "is", "authorized", "to", "act", "as", "." ]
python
train
38.363636
panzarino/mlbgame
mlbgame/__init__.py
https://github.com/panzarino/mlbgame/blob/0a2d10540de793fdc3b8476aa18f5cf3b53d0b54/mlbgame/__init__.py#L261-L268
def standings(date=datetime.now()): """Return Standings object that contains standings info date should be a datetime object, leave empty to get current standings """ data = mlbgame.info.standings(date) return mlbgame.info.Standings(data)
[ "def", "standings", "(", "date", "=", "datetime", ".", "now", "(", ")", ")", ":", "data", "=", "mlbgame", ".", "info", ".", "standings", "(", "date", ")", "return", "mlbgame", ".", "info", ".", "Standings", "(", "data", ")" ]
Return Standings object that contains standings info date should be a datetime object, leave empty to get current standings
[ "Return", "Standings", "object", "that", "contains", "standings", "info" ]
python
train
32
ralphbean/bugwarrior
bugwarrior/services/github.py
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/github.py#L389-L394
def _reqs(self, tag): """ Grab all the pull requests """ return [ (tag, i) for i in self.client.get_pulls(*tag.split('/')) ]
[ "def", "_reqs", "(", "self", ",", "tag", ")", ":", "return", "[", "(", "tag", ",", "i", ")", "for", "i", "in", "self", ".", "client", ".", "get_pulls", "(", "*", "tag", ".", "split", "(", "'/'", ")", ")", "]" ]
Grab all the pull requests
[ "Grab", "all", "the", "pull", "requests" ]
python
test
27.833333
JohnVinyard/zounds
zounds/basic/audiograph.py
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/basic/audiograph.py#L179-L260
def audio_graph( chunksize_bytes=DEFAULT_CHUNK_SIZE, resample_to=SR44100(), store_fft=False): """ Produce a base class suitable as a starting point for many audio processing pipelines. This class resamples all audio to a common sampling rate, and produces a bark band spectrogram...
[ "def", "audio_graph", "(", "chunksize_bytes", "=", "DEFAULT_CHUNK_SIZE", ",", "resample_to", "=", "SR44100", "(", ")", ",", "store_fft", "=", "False", ")", ":", "band", "=", "FrequencyBand", "(", "20", ",", "resample_to", ".", "nyquist", ")", "class", "Audio...
Produce a base class suitable as a starting point for many audio processing pipelines. This class resamples all audio to a common sampling rate, and produces a bark band spectrogram from overlapping short-time fourier transform frames. It also compresses the audio into ogg vorbis format for compact st...
[ "Produce", "a", "base", "class", "suitable", "as", "a", "starting", "point", "for", "many", "audio", "processing", "pipelines", ".", "This", "class", "resamples", "all", "audio", "to", "a", "common", "sampling", "rate", "and", "produces", "a", "bark", "band"...
python
train
24.914634
xtuml/pyxtuml
bridgepoint/oal.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1090-L1093
def t_LESSTHAN(self, t): r"\<" t.endlexpos = t.lexpos + len(t.value) return t
[ "def", "t_LESSTHAN", "(", "self", ",", "t", ")", ":", "t", ".", "endlexpos", "=", "t", ".", "lexpos", "+", "len", "(", "t", ".", "value", ")", "return", "t" ]
r"\<
[ "r", "\\", "<" ]
python
test
24.5
fitnr/censusgeocode
censusgeocode/censusgeocode.py
https://github.com/fitnr/censusgeocode/blob/9414c331a63fbcfff6b7295cd8935c40ce54c88c/censusgeocode/censusgeocode.py#L195-L213
def addressbatch(self, data, **kwargs): ''' Send either a CSV file or data to the addressbatch API. According to the Census, "there is currently an upper limit of 1000 records per batch file." If a file, must have no header and fields id,street,city,state,zip If data, should be a...
[ "def", "addressbatch", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "# Does data quack like a file handle?", "if", "hasattr", "(", "data", ",", "'read'", ")", ":", "return", "self", ".", "_post_batch", "(", "f", "=", "data", ",", "*", "*"...
Send either a CSV file or data to the addressbatch API. According to the Census, "there is currently an upper limit of 1000 records per batch file." If a file, must have no header and fields id,street,city,state,zip If data, should be a list of dicts with the above fields (although ID is optiona...
[ "Send", "either", "a", "CSV", "file", "or", "data", "to", "the", "addressbatch", "API", ".", "According", "to", "the", "Census", "there", "is", "currently", "an", "upper", "limit", "of", "1000", "records", "per", "batch", "file", ".", "If", "a", "file", ...
python
train
42.578947
alpha-xone/xbbg
xbbg/core/conn.py
https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/core/conn.py#L128-L134
def delete_connection(): """ Stop and destroy Bloomberg connection """ if _CON_SYM_ in globals(): con = globals().pop(_CON_SYM_) if not getattr(con, '_session').start(): con.stop()
[ "def", "delete_connection", "(", ")", ":", "if", "_CON_SYM_", "in", "globals", "(", ")", ":", "con", "=", "globals", "(", ")", ".", "pop", "(", "_CON_SYM_", ")", "if", "not", "getattr", "(", "con", ",", "'_session'", ")", ".", "start", "(", ")", ":...
Stop and destroy Bloomberg connection
[ "Stop", "and", "destroy", "Bloomberg", "connection" ]
python
valid
29.428571
OpenKMIP/PyKMIP
kmip/core/secrets.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/secrets.py#L95-L113
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Certificate object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. ...
[ "def", "write", "(", "self", ",", "ostream", ",", "kmip_version", "=", "enums", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "tstream", "=", "BytearrayStream", "(", ")", "self", ".", "certificate_type", ".", "write", "(", "tstream", ",", "kmip_version", ...
Write the data encoding the Certificate object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the KMIP ver...
[ "Write", "the", "data", "encoding", "the", "Certificate", "object", "to", "a", "stream", "." ]
python
test
43.526316
lambdamusic/Ontospy
ontospy/extras/shell_lib.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/extras/shell_lib.py#L207-L223
def _print_entity_intro(self, g=None, entity=None, first_time=True): """after a selection, prints on screen basic info about onto or entity, plus change prompt 2015-10-18: removed the sound 2016-01-18: entity is the shell wrapper around the ontospy entity """ if entity: ...
[ "def", "_print_entity_intro", "(", "self", ",", "g", "=", "None", ",", "entity", "=", "None", ",", "first_time", "=", "True", ")", ":", "if", "entity", ":", "self", ".", "_clear_screen", "(", ")", "obj", "=", "entity", "[", "'object'", "]", "self", "...
after a selection, prints on screen basic info about onto or entity, plus change prompt 2015-10-18: removed the sound 2016-01-18: entity is the shell wrapper around the ontospy entity
[ "after", "a", "selection", "prints", "on", "screen", "basic", "info", "about", "onto", "or", "entity", "plus", "change", "prompt", "2015", "-", "10", "-", "18", ":", "removed", "the", "sound", "2016", "-", "01", "-", "18", ":", "entity", "is", "the", ...
python
train
48.588235
bcbio/bcbio-nextgen
bcbio/cwl/defs.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/defs.py#L145-L249
def _variant_vc(checkpoints): """Add variant calling to workflow, if configured. """ if not checkpoints.get("vc"): return [], [] vc_wf = [s("get_parallel_regions", "batch-split", [["batch_rec"]], [cwlout(["region_block"], {"type": "array", "items": "string"})], ...
[ "def", "_variant_vc", "(", "checkpoints", ")", ":", "if", "not", "checkpoints", ".", "get", "(", "\"vc\"", ")", ":", "return", "[", "]", ",", "[", "]", "vc_wf", "=", "[", "s", "(", "\"get_parallel_regions\"", ",", "\"batch-split\"", ",", "[", "[", "\"b...
Add variant calling to workflow, if configured.
[ "Add", "variant", "calling", "to", "workflow", "if", "configured", "." ]
python
train
62.219048
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_agg.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_agg.py#L406-L416
def new_figure_manager(num, *args, **kwargs): """ Create a new figure manager instance """ if __debug__: verbose.report('backend_agg.new_figure_manager', 'debug-annoying') FigureClass = kwargs.pop('FigureClass', Figure) thisFig = FigureClass(*args, **kwargs) ...
[ "def", "new_figure_manager", "(", "num", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "__debug__", ":", "verbose", ".", "report", "(", "'backend_agg.new_figure_manager'", ",", "'debug-annoying'", ")", "FigureClass", "=", "kwargs", ".", "pop", "...
Create a new figure manager instance
[ "Create", "a", "new", "figure", "manager", "instance" ]
python
train
33.090909
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L10582-L10599
def ahrs3_encode(self, roll, pitch, yaw, altitude, lat, lng, v1, v2, v3, v4): ''' Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch ...
[ "def", "ahrs3_encode", "(", "self", ",", "roll", ",", "pitch", ",", "yaw", ",", "altitude", ",", "lat", ",", "lng", ",", "v1", ",", "v2", ",", "v3", ",", "v4", ")", ":", "return", "MAVLink_ahrs3_message", "(", "roll", ",", "pitch", ",", "yaw", ",",...
Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) ...
[ "Status", "of", "third", "AHRS", "filter", "if", "available", ".", "This", "is", "for", "ANU", "research", "group", "(", "Ali", "and", "Sean", ")" ]
python
train
56.888889
google/grr
grr/core/grr_response_core/lib/config_lib.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/config_lib.py#L1485-L1489
def DEFINE_bool(self, name, default, help, constant=False): """A helper for defining boolean options.""" self.AddOption( type_info.Bool(name=name, default=default, description=help), constant=constant)
[ "def", "DEFINE_bool", "(", "self", ",", "name", ",", "default", ",", "help", ",", "constant", "=", "False", ")", ":", "self", ".", "AddOption", "(", "type_info", ".", "Bool", "(", "name", "=", "name", ",", "default", "=", "default", ",", "description",...
A helper for defining boolean options.
[ "A", "helper", "for", "defining", "boolean", "options", "." ]
python
train
44.2
rootpy/rootpy
rootpy/plotting/hist.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/hist.py#L844-L858
def lowerbound(self, axis=0): """ Get the lower bound of the binning along an axis """ if not 0 <= axis < self.GetDimension(): raise ValueError( "axis must be a non-negative integer less than " "the dimensionality of the histogram") if ...
[ "def", "lowerbound", "(", "self", ",", "axis", "=", "0", ")", ":", "if", "not", "0", "<=", "axis", "<", "self", ".", "GetDimension", "(", ")", ":", "raise", "ValueError", "(", "\"axis must be a non-negative integer less than \"", "\"the dimensionality of the histo...
Get the lower bound of the binning along an axis
[ "Get", "the", "lower", "bound", "of", "the", "binning", "along", "an", "axis" ]
python
train
34.2
PythonCharmers/python-future
src/future/backports/urllib/request.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/request.py#L2122-L2145
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None, retry=False): """Error 401 -- authentication required. This function supports Basic authentication only.""" if 'www-authenticate' not in headers: URLopener.http_error_default(self, url, fp, ...
[ "def", "http_error_401", "(", "self", ",", "url", ",", "fp", ",", "errcode", ",", "errmsg", ",", "headers", ",", "data", "=", "None", ",", "retry", "=", "False", ")", ":", "if", "'www-authenticate'", "not", "in", "headers", ":", "URLopener", ".", "http...
Error 401 -- authentication required. This function supports Basic authentication only.
[ "Error", "401", "--", "authentication", "required", ".", "This", "function", "supports", "Basic", "authentication", "only", "." ]
python
train
47.25
basho/riak-python-client
riak/transports/tcp/connection.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/transports/tcp/connection.py#L180-L208
def _recv_msg(self, mid_stream=False): """ :param mid_stream: are we receiving in a streaming operation? :type mid_stream: boolean """ try: msgbuf = self._recv_pkt() except BadResource as e: e.mid_stream = mid_stream raise excep...
[ "def", "_recv_msg", "(", "self", ",", "mid_stream", "=", "False", ")", ":", "try", ":", "msgbuf", "=", "self", ".", "_recv_pkt", "(", ")", "except", "BadResource", "as", "e", ":", "e", ".", "mid_stream", "=", "mid_stream", "raise", "except", "socket", ...
:param mid_stream: are we receiving in a streaming operation? :type mid_stream: boolean
[ ":", "param", "mid_stream", ":", "are", "we", "receiving", "in", "a", "streaming", "operation?", ":", "type", "mid_stream", ":", "boolean" ]
python
train
37.103448
mitsei/dlkit
dlkit/json_/authorization/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/sessions.py#L2113-L2134
def unassign_authorization_from_vault(self, authorization_id, vault_id): """Removes an ``Authorization`` from a ``Vault``. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` raise: NotFou...
[ "def", "unassign_authorization_from_vault", "(", "self", ",", "authorization_id", ",", "vault_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'AUTH...
Removes an ``Authorization`` from a ``Vault``. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` raise: NotFound - ``authorization_id`` or ``vault_id`` not found or ``authorizati...
[ "Removes", "an", "Authorization", "from", "a", "Vault", "." ]
python
train
51.272727
gwastro/pycbc
pycbc/results/legacy_grb.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/results/legacy_grb.py#L515-L564
def write_loudest_events(page, bins, onsource=False): """ Write injection chisq plots to markup.page object page """ th = ['']+['Mchirp %s - %s' % tuple(bin) for bin in bins] td = [] plots = ['BestNR','SNR'] if onsource: trial = 'ONSOURCE' else: trial = 'OFFTRIAL_...
[ "def", "write_loudest_events", "(", "page", ",", "bins", ",", "onsource", "=", "False", ")", ":", "th", "=", "[", "''", "]", "+", "[", "'Mchirp %s - %s'", "%", "tuple", "(", "bin", ")", "for", "bin", "in", "bins", "]", "td", "=", "[", "]", "plots",...
Write injection chisq plots to markup.page object page
[ "Write", "injection", "chisq", "plots", "to", "markup", ".", "page", "object", "page" ]
python
train
25.32
astropy/photutils
photutils/aperture/core.py
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L526-L568
def _to_sky_params(self, wcs, mode='all'): """ Convert the pixel aperture parameters to those for a sky aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional ...
[ "def", "_to_sky_params", "(", "self", ",", "wcs", ",", "mode", "=", "'all'", ")", ":", "sky_params", "=", "{", "}", "x", ",", "y", "=", "np", ".", "transpose", "(", "self", ".", "positions", ")", "sky_params", "[", "'positions'", "]", "=", "pixel_to_...
Convert the pixel aperture parameters to those for a sky aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional Whether to do the transformation including distorti...
[ "Convert", "the", "pixel", "aperture", "parameters", "to", "those", "for", "a", "sky", "aperture", "." ]
python
train
36.465116
openstax/cnx-publishing
cnxpublishing/views/admin/content_status.py
https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/admin/content_status.py#L43-L139
def get_baking_statuses_sql(get_request): """ Creates SQL to get info on baking books filtered from GET request. All books that have ever attempted to bake will be retured if they pass the filters in the GET request. If a single book has been requested to bake multiple times there will be a row for...
[ "def", "get_baking_statuses_sql", "(", "get_request", ")", ":", "args", "=", "{", "}", "sort", "=", "get_request", ".", "get", "(", "'sort'", ",", "'bpsa.created DESC'", ")", "if", "(", "len", "(", "sort", ".", "split", "(", "\" \"", ")", ")", "!=", "2...
Creates SQL to get info on baking books filtered from GET request. All books that have ever attempted to bake will be retured if they pass the filters in the GET request. If a single book has been requested to bake multiple times there will be a row for each of the baking attempts. By default the r...
[ "Creates", "SQL", "to", "get", "info", "on", "baking", "books", "filtered", "from", "GET", "request", "." ]
python
valid
47.298969
stanfordnlp/stanza
stanza/research/codalab.py
https://github.com/stanfordnlp/stanza/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/research/codalab.py#L48-L53
def get_uuids(): """List all bundle UUIDs in the worksheet.""" result = shell('cl ls -w {} -u'.format(worksheet)) uuids = result.split('\n') uuids = uuids[1:-1] # trim non uuids return uuids
[ "def", "get_uuids", "(", ")", ":", "result", "=", "shell", "(", "'cl ls -w {} -u'", ".", "format", "(", "worksheet", ")", ")", "uuids", "=", "result", ".", "split", "(", "'\\n'", ")", "uuids", "=", "uuids", "[", "1", ":", "-", "1", "]", "# trim non u...
List all bundle UUIDs in the worksheet.
[ "List", "all", "bundle", "UUIDs", "in", "the", "worksheet", "." ]
python
train
34.333333
wbond/oscrypto
oscrypto/_osx/_core_foundation_ctypes.py
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L470-L486
def cf_number_from_integer(integer): """ Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber """ integer_as_long = c_long(integer) return CoreFoundation.CFNumberCreate( ...
[ "def", "cf_number_from_integer", "(", "integer", ")", ":", "integer_as_long", "=", "c_long", "(", "integer", ")", "return", "CoreFoundation", ".", "CFNumberCreate", "(", "CoreFoundation", ".", "kCFAllocatorDefault", ",", "kCFNumberCFIndexType", ",", "byref", "(", "i...
Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber
[ "Creates", "a", "CFNumber", "object", "from", "an", "integer" ]
python
valid
25.117647
PSPC-SPAC-buyandsell/von_anchor
von_anchor/cache.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/cache.py#L169-L179
def schemata(self) -> list: """ Return list with schemata in cache. :return: list of schemata """ LOGGER.debug('SchemaCache.schemata >>>') LOGGER.debug('SchemaCache.schemata <<<') return [self._schema_key2schema[seq_no] for seq_no in self._schema_key2schema]
[ "def", "schemata", "(", "self", ")", "->", "list", ":", "LOGGER", ".", "debug", "(", "'SchemaCache.schemata >>>'", ")", "LOGGER", ".", "debug", "(", "'SchemaCache.schemata <<<'", ")", "return", "[", "self", ".", "_schema_key2schema", "[", "seq_no", "]", "for",...
Return list with schemata in cache. :return: list of schemata
[ "Return", "list", "with", "schemata", "in", "cache", "." ]
python
train
27.909091
adrn/gala
gala/dynamics/_genfunc/genfunc_3d.py
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/dynamics/_genfunc/genfunc_3d.py#L191-L210
def assess_angmom(X): """ Checks for change of sign in each component of the angular momentum. Returns an array with ith entry 1 if no sign change in i component and 0 if sign change. Box = (0,0,0) S.A loop = (0,0,1) L.A loop = (1,0,0) """ L=angmom(X[0]) l...
[ "def", "assess_angmom", "(", "X", ")", ":", "L", "=", "angmom", "(", "X", "[", "0", "]", ")", "loop", "=", "np", ".", "array", "(", "[", "1", ",", "1", ",", "1", "]", ")", "for", "i", "in", "X", "[", "1", ":", "]", ":", "L0", "=", "angm...
Checks for change of sign in each component of the angular momentum. Returns an array with ith entry 1 if no sign change in i component and 0 if sign change. Box = (0,0,0) S.A loop = (0,0,1) L.A loop = (1,0,0)
[ "Checks", "for", "change", "of", "sign", "in", "each", "component", "of", "the", "angular", "momentum", ".", "Returns", "an", "array", "with", "ith", "entry", "1", "if", "no", "sign", "change", "in", "i", "component", "and", "0", "if", "sign", "change", ...
python
train
26.8
dshean/pygeotools
pygeotools/lib/geolib.py
https://github.com/dshean/pygeotools/blob/5ac745717c0098d01eb293ff1fe32fd7358c76ab/pygeotools/lib/geolib.py#L280-L325
def scale_ps(lat): """ This function calculates the scaling factor for a polar stereographic projection (ie. SSM/I grid) to correct area calculations. The scaling factor is defined (from Snyder, 1982, Map Projections used by the U.S. Geological Survey) as: k = (mc/m)*(t/tc), where: m = cos...
[ "def", "scale_ps", "(", "lat", ")", ":", "lat", "=", "np", ".", "array", "(", "lat", ")", "if", "np", ".", "any", "(", "lat", ">", "0", ")", ":", "m70_t70", "=", "1.9332279", "#Hack to deal with pole", "lat", "[", "lat", ">=", "90.0", "]", "=", "...
This function calculates the scaling factor for a polar stereographic projection (ie. SSM/I grid) to correct area calculations. The scaling factor is defined (from Snyder, 1982, Map Projections used by the U.S. Geological Survey) as: k = (mc/m)*(t/tc), where: m = cos(lat)/sqrt(1 - e2*sin(lat)^2) ...
[ "This", "function", "calculates", "the", "scaling", "factor", "for", "a", "polar", "stereographic", "projection", "(", "ie", ".", "SSM", "/", "I", "grid", ")", "to", "correct", "area", "calculations", ".", "The", "scaling", "factor", "is", "defined", "(", ...
python
train
31.326087
geophysics-ubonn/reda
lib/reda/importers/legacy/eit160.py
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/legacy/eit160.py#L284-L445
def _extract_emd(mat, filename): """Extract the data from the EMD substruct, given a medusa-created MNU0-mat file Parameters ---------- mat: matlab-imported struct """ emd = mat['EMD'].squeeze() # Labview epoch epoch = datetime.datetime(1904, 1, 1) def convert_epoch(x): ...
[ "def", "_extract_emd", "(", "mat", ",", "filename", ")", ":", "emd", "=", "mat", "[", "'EMD'", "]", ".", "squeeze", "(", ")", "# Labview epoch", "epoch", "=", "datetime", ".", "datetime", "(", "1904", ",", "1", ",", "1", ")", "def", "convert_epoch", ...
Extract the data from the EMD substruct, given a medusa-created MNU0-mat file Parameters ---------- mat: matlab-imported struct
[ "Extract", "the", "data", "from", "the", "EMD", "substruct", "given", "a", "medusa", "-", "created", "MNU0", "-", "mat", "file" ]
python
train
30.45679
trustar/trustar-python
trustar/report_client.py
https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L223-L240
def get_correlated_report_ids(self, indicators): """ DEPRECATED! Retrieves a list of the IDs of all TruSTAR reports that contain the searched indicators. :param indicators: A list of indicator values to retrieve correlated reports for. :return: The list of IDs of reports that co...
[ "def", "get_correlated_report_ids", "(", "self", ",", "indicators", ")", ":", "params", "=", "{", "'indicators'", ":", "indicators", "}", "resp", "=", "self", ".", "_client", ".", "get", "(", "\"reports/correlate\"", ",", "params", "=", "params", ")", "retur...
DEPRECATED! Retrieves a list of the IDs of all TruSTAR reports that contain the searched indicators. :param indicators: A list of indicator values to retrieve correlated reports for. :return: The list of IDs of reports that correlated. Example: >>> report_ids = ts.get_correlat...
[ "DEPRECATED!", "Retrieves", "a", "list", "of", "the", "IDs", "of", "all", "TruSTAR", "reports", "that", "contain", "the", "searched", "indicators", "." ]
python
train
38.111111
cloudera/impyla
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
https://github.com/cloudera/impyla/blob/547fa2ba3b6151e2a98b3544301471a643212dc3/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L2265-L2273
def get_table_names_by_filter(self, dbname, filter, max_tables): """ Parameters: - dbname - filter - max_tables """ self.send_get_table_names_by_filter(dbname, filter, max_tables) return self.recv_get_table_names_by_filter()
[ "def", "get_table_names_by_filter", "(", "self", ",", "dbname", ",", "filter", ",", "max_tables", ")", ":", "self", ".", "send_get_table_names_by_filter", "(", "dbname", ",", "filter", ",", "max_tables", ")", "return", "self", ".", "recv_get_table_names_by_filter", ...
Parameters: - dbname - filter - max_tables
[ "Parameters", ":", "-", "dbname", "-", "filter", "-", "max_tables" ]
python
train
27.888889
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L287-L301
def process_delimiter(self, char): '''Process chars while not in a part''' if char in self.whitespace: return if char in self.quote_chars: # Store the quote type (' or ") and switch to quote processing. self.inquote = char self.process_char = self....
[ "def", "process_delimiter", "(", "self", ",", "char", ")", ":", "if", "char", "in", "self", ".", "whitespace", ":", "return", "if", "char", "in", "self", ".", "quote_chars", ":", "# Store the quote type (' or \") and switch to quote processing.", "self", ".", "inq...
Process chars while not in a part
[ "Process", "chars", "while", "not", "in", "a", "part" ]
python
train
36.066667
wikimedia/editquality
editquality/utilities/autolabel.py
https://github.com/wikimedia/editquality/blob/73bab7bdd0ef3dba9a000f91f2fd810b1772d1f0/editquality/utilities/autolabel.py#L306-L313
def get_user_blocks(session, user_text): """ Returns a list of blocks for a single user """ logger.debug("Getting user_blocks for {0}".format(user_text)) doc = session.get(action='query', list='blocks', bkusers=user_text, bkprop=['id']) return doc['query']['blocks']
[ "def", "get_user_blocks", "(", "session", ",", "user_text", ")", ":", "logger", ".", "debug", "(", "\"Getting user_blocks for {0}\"", ".", "format", "(", "user_text", ")", ")", "doc", "=", "session", ".", "get", "(", "action", "=", "'query'", ",", "list", ...
Returns a list of blocks for a single user
[ "Returns", "a", "list", "of", "blocks", "for", "a", "single", "user" ]
python
train
38.125
thespacedoctor/qubits
qubits/universe.py
https://github.com/thespacedoctor/qubits/blob/3c02ace7226389841c6bb838d045c11bed61a3c2/qubits/universe.py#L439-L478
def random_peak_magnitudes( log, peakMagnitudeDistributions, snTypesArray, plot=True): """ *Generate a numpy array of random (distribution weighted) peak magnitudes for the given sn types.* **Key Arguments:** - ``log`` -- logger - ``peakMagnitudeDistributions...
[ "def", "random_peak_magnitudes", "(", "log", ",", "peakMagnitudeDistributions", ",", "snTypesArray", ",", "plot", "=", "True", ")", ":", "################ > IMPORTS ################", "## STANDARD LIB ##", "## THIRD PARTY ##", "import", "matplotlib", ".", "pyplot", "as", ...
*Generate a numpy array of random (distribution weighted) peak magnitudes for the given sn types.* **Key Arguments:** - ``log`` -- logger - ``peakMagnitudeDistributions`` -- yaml style dictionary of peak magnitude distributions - ``snTypesArray`` -- the pre-generated array of random sn type...
[ "*", "Generate", "a", "numpy", "array", "of", "random", "(", "distribution", "weighted", ")", "peak", "magnitudes", "for", "the", "given", "sn", "types", ".", "*" ]
python
train
31.325
pudo/googlesheets
googlesheets/spreadsheet.py
https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/spreadsheet.py#L69-L78
def open(cls, title, conn=None, google_user=None, google_password=None): """ Open the spreadsheet named ``title``. If no spreadsheet with that name exists, a new one will be created. """ spreadsheet = cls.by_title(title, conn=conn, google_user=google_user, ...
[ "def", "open", "(", "cls", ",", "title", ",", "conn", "=", "None", ",", "google_user", "=", "None", ",", "google_password", "=", "None", ")", ":", "spreadsheet", "=", "cls", ".", "by_title", "(", "title", ",", "conn", "=", "conn", ",", "google_user", ...
Open the spreadsheet named ``title``. If no spreadsheet with that name exists, a new one will be created.
[ "Open", "the", "spreadsheet", "named", "title", ".", "If", "no", "spreadsheet", "with", "that", "name", "exists", "a", "new", "one", "will", "be", "created", "." ]
python
train
56.1
idlesign/django-sitetree
sitetree/admin.py
https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/admin.py#L357-L364
def dump_view(cls, request): """Dumps sitetrees with items using django-smuggler. :param request: :return: """ from smuggler.views import dump_to_response return dump_to_response(request, [MODEL_TREE, MODEL_TREE_ITEM], filename_prefix='sitetrees')
[ "def", "dump_view", "(", "cls", ",", "request", ")", ":", "from", "smuggler", ".", "views", "import", "dump_to_response", "return", "dump_to_response", "(", "request", ",", "[", "MODEL_TREE", ",", "MODEL_TREE_ITEM", "]", ",", "filename_prefix", "=", "'sitetrees'...
Dumps sitetrees with items using django-smuggler. :param request: :return:
[ "Dumps", "sitetrees", "with", "items", "using", "django", "-", "smuggler", "." ]
python
test
36.125
Legobot/Legobot
Legobot/Lego.py
https://github.com/Legobot/Legobot/blob/d13da172960a149681cb5151ce34b2f3a58ad32b/Legobot/Lego.py#L73-L82
def cleanup(self): """ Clean up finished children. :return: None """ self.lock.acquire() logger.debug('Acquired lock in cleanup for ' + str(self)) self.children = [child for child in self.children if child.is_alive()] self.lock.release()
[ "def", "cleanup", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "logger", ".", "debug", "(", "'Acquired lock in cleanup for '", "+", "str", "(", "self", ")", ")", "self", ".", "children", "=", "[", "child", "for", "child", "in",...
Clean up finished children. :return: None
[ "Clean", "up", "finished", "children", "." ]
python
train
29.3
adammhaile/gitdata
gitdata/__init__.py
https://github.com/adammhaile/gitdata/blob/93112899737d63855655d438e3027192abd76a37/gitdata/__init__.py#L224-L231
def commit(self, msg): """ Commit outstanding data changes """ self.logger.info('Commit config: {}'.format(msg)) with Dir(self.data_path): self.cmd.check_assert('git add .') self.cmd.check_assert('git commit --allow-empty -m "{}"'.format(msg))
[ "def", "commit", "(", "self", ",", "msg", ")", ":", "self", ".", "logger", ".", "info", "(", "'Commit config: {}'", ".", "format", "(", "msg", ")", ")", "with", "Dir", "(", "self", ".", "data_path", ")", ":", "self", ".", "cmd", ".", "check_assert", ...
Commit outstanding data changes
[ "Commit", "outstanding", "data", "changes" ]
python
train
37.5
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#L1395-L1408
def create_dcnm_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False): """Create the DCNM OUT Network and update the result. """ tenant_name = fw_dict.get('tenant_name') ret = self._create_service_nwk(tenant_id, tenant_name, 'out') if ret: res = fw_const.DCNM_OUT_NETWORK_CREATE...
[ "def", "create_dcnm_out_nwk", "(", "self", ",", "tenant_id", ",", "fw_dict", ",", "is_fw_virt", "=", "False", ")", ":", "tenant_name", "=", "fw_dict", ".", "get", "(", "'tenant_name'", ")", "ret", "=", "self", ".", "_create_service_nwk", "(", "tenant_id", ",...
Create the DCNM OUT Network and update the result.
[ "Create", "the", "DCNM", "OUT", "Network", "and", "update", "the", "result", "." ]
python
train
47.642857
welbornprod/fmtblock
fmtblock/formatters.py
https://github.com/welbornprod/fmtblock/blob/92a5529235d557170ed21e058e3c5995197facbe/fmtblock/formatters.py#L238-L337
def iter_format_block( self, text=None, width=60, chars=False, fill=False, newlines=False, append=None, prepend=None, strip_first=False, strip_last=False, lstrip=False): """ Iterate over lines in a formatted block of text. This iterator allows you to p...
[ "def", "iter_format_block", "(", "self", ",", "text", "=", "None", ",", "width", "=", "60", ",", "chars", "=", "False", ",", "fill", "=", "False", ",", "newlines", "=", "False", ",", "append", "=", "None", ",", "prepend", "=", "None", ",", "strip_fir...
Iterate over lines in a formatted block of text. This iterator allows you to prepend to each line. For basic blocks see iter_block(). Arguments: text : String to format. width : Maximum width for each line. The prepend string ...
[ "Iterate", "over", "lines", "in", "a", "formatted", "block", "of", "text", ".", "This", "iterator", "allows", "you", "to", "prepend", "to", "each", "line", ".", "For", "basic", "blocks", "see", "iter_block", "()", "." ]
python
valid
39.26
SoCo/SoCo
soco/events.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/events.py#L293-L303
def run(self): """Start the server on the local IP at port 1400 (default). Handling of requests is delegated to an instance of the `EventNotifyHandler` class. """ listener = EventServer(self.address, EventNotifyHandler) log.info("Event listener running on %s", listener.s...
[ "def", "run", "(", "self", ")", ":", "listener", "=", "EventServer", "(", "self", ".", "address", ",", "EventNotifyHandler", ")", "log", ".", "info", "(", "\"Event listener running on %s\"", ",", "listener", ".", "server_address", ")", "# Listen for events until t...
Start the server on the local IP at port 1400 (default). Handling of requests is delegated to an instance of the `EventNotifyHandler` class.
[ "Start", "the", "server", "on", "the", "local", "IP", "at", "port", "1400", "(", "default", ")", "." ]
python
train
41.090909
matthew-brett/delocate
delocate/libsana.py
https://github.com/matthew-brett/delocate/blob/ed48de15fce31c3f52f1a9f32cae1b02fc55aa60/delocate/libsana.py#L145-L175
def stripped_lib_dict(lib_dict, strip_prefix): """ Return `lib_dict` with `strip_prefix` removed from start of paths Use to give form of `lib_dict` that appears relative to some base path given by `strip_prefix`. Particularly useful for analyzing wheels where we unpack to a temporary path before analy...
[ "def", "stripped_lib_dict", "(", "lib_dict", ",", "strip_prefix", ")", ":", "relative_dict", "=", "{", "}", "stripper", "=", "get_prefix_stripper", "(", "strip_prefix", ")", "for", "lib_path", ",", "dependings_dict", "in", "lib_dict", ".", "items", "(", ")", "...
Return `lib_dict` with `strip_prefix` removed from start of paths Use to give form of `lib_dict` that appears relative to some base path given by `strip_prefix`. Particularly useful for analyzing wheels where we unpack to a temporary path before analyzing. Parameters ---------- lib_dict : dic...
[ "Return", "lib_dict", "with", "strip_prefix", "removed", "from", "start", "of", "paths" ]
python
train
36.741935
paramiko/paramiko
paramiko/sftp_client.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_client.py#L425-L445
def posix_rename(self, oldpath, newpath): """ Rename a file or folder from ``oldpath`` to ``newpath``, following posix conventions. :param str oldpath: existing name of the file or folder :param str newpath: new name for the file or folder, will be overwritten if it ...
[ "def", "posix_rename", "(", "self", ",", "oldpath", ",", "newpath", ")", ":", "oldpath", "=", "self", ".", "_adjust_cwd", "(", "oldpath", ")", "newpath", "=", "self", ".", "_adjust_cwd", "(", "newpath", ")", "self", ".", "_log", "(", "DEBUG", ",", "\"p...
Rename a file or folder from ``oldpath`` to ``newpath``, following posix conventions. :param str oldpath: existing name of the file or folder :param str newpath: new name for the file or folder, will be overwritten if it already exists :raises: ``IOError`` -- if...
[ "Rename", "a", "file", "or", "folder", "from", "oldpath", "to", "newpath", "following", "posix", "conventions", "." ]
python
train
37.238095
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L220-L238
def _url_parts(self, url_suffix, data, content_type): """ Format the url data based on config_type. :param url_suffix: str URL path we are sending a GET/POST/PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the...
[ "def", "_url_parts", "(", "self", ",", "url_suffix", ",", "data", ",", "content_type", ")", ":", "url", "=", "self", ".", "base_url", "+", "url_suffix", "send_data", "=", "data", "if", "content_type", "==", "ContentType", ".", "json", ":", "send_data", "="...
Format the url data based on config_type. :param url_suffix: str URL path we are sending a GET/POST/PUT to :param data: object data we are sending :param content_type: str from ContentType that determines how we format the data :return: complete url, formatted data, and headers for sendi...
[ "Format", "the", "url", "data", "based", "on", "config_type", ".", ":", "param", "url_suffix", ":", "str", "URL", "path", "we", "are", "sending", "a", "GET", "/", "POST", "/", "PUT", "to", ":", "param", "data", ":", "object", "data", "we", "are", "se...
python
train
41.157895
sixty-north/cosmic-ray
src/cosmic_ray/operators/zero_iteration_for_loop.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/operators/zero_iteration_for_loop.py#L17-L24
def mutate(self, node, index): """Modify the For loop to evaluate to None""" assert index == 0 assert isinstance(node, ForStmt) empty_list = parso.parse(' []') node.children[3] = empty_list return node
[ "def", "mutate", "(", "self", ",", "node", ",", "index", ")", ":", "assert", "index", "==", "0", "assert", "isinstance", "(", "node", ",", "ForStmt", ")", "empty_list", "=", "parso", ".", "parse", "(", "' []'", ")", "node", ".", "children", "[", "3",...
Modify the For loop to evaluate to None
[ "Modify", "the", "For", "loop", "to", "evaluate", "to", "None" ]
python
train
30.375
andreikop/python-ws-discovery
wsdiscovery/daemon.py
https://github.com/andreikop/python-ws-discovery/blob/a7b852cf43115c6f986e509b1870d6963e76687f/wsdiscovery/daemon.py#L126-L135
def addSourceAddr(self, addr): """None means 'system default'""" try: self._multiInSocket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, self._makeMreq(addr)) except socket.error: # if 1 interface has more than 1 address, exception is raised for the second pass ...
[ "def", "addSourceAddr", "(", "self", ",", "addr", ")", ":", "try", ":", "self", ".", "_multiInSocket", ".", "setsockopt", "(", "socket", ".", "IPPROTO_IP", ",", "socket", ".", "IP_ADD_MEMBERSHIP", ",", "self", ".", "_makeMreq", "(", "addr", ")", ")", "ex...
None means 'system default
[ "None", "means", "system", "default" ]
python
test
48
nyaruka/python-librato-bg
librato_bg/client.py
https://github.com/nyaruka/python-librato-bg/blob/e541092838694de31d256becea8391a9cfe086c7/librato_bg/client.py#L38-L48
def _enqueue(self, msg): """Push a new `msg` onto the queue, return `(success, msg)`""" self.log.debug('queueing: %s', msg) if self.queue.full(): self.log.warn('librato_bg queue is full') return False, msg self.queue.put(msg) self.log.debug('enqueued %s....
[ "def", "_enqueue", "(", "self", ",", "msg", ")", ":", "self", ".", "log", ".", "debug", "(", "'queueing: %s'", ",", "msg", ")", "if", "self", ".", "queue", ".", "full", "(", ")", ":", "self", ".", "log", ".", "warn", "(", "'librato_bg queue is full'"...
Push a new `msg` onto the queue, return `(success, msg)`
[ "Push", "a", "new", "msg", "onto", "the", "queue", "return", "(", "success", "msg", ")" ]
python
valid
31.090909
PythonCharmers/python-future
src/future/backports/http/cookiejar.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/http/cookiejar.py#L1657-L1669
def extract_cookies(self, response, request): """Extract cookies from response, where allowable given the request.""" _debug("extract_cookies: %s", response.info()) self._cookies_lock.acquire() try: self._policy._now = self._now = int(time.time()) for cookie in s...
[ "def", "extract_cookies", "(", "self", ",", "response", ",", "request", ")", ":", "_debug", "(", "\"extract_cookies: %s\"", ",", "response", ".", "info", "(", ")", ")", "self", ".", "_cookies_lock", ".", "acquire", "(", ")", "try", ":", "self", ".", "_po...
Extract cookies from response, where allowable given the request.
[ "Extract", "cookies", "from", "response", "where", "allowable", "given", "the", "request", "." ]
python
train
43.153846
roboogle/gtkmvc3
gtkmvco/examples/converter/main1.py
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/converter/main1.py#L26-L34
def setup_path(): """Sets up the python include paths to include src""" import os.path; import sys if sys.argv[0]: top_dir = os.path.dirname(os.path.abspath(sys.argv[0])) sys.path = [os.path.join(top_dir, "src")] + sys.path pass return
[ "def", "setup_path", "(", ")", ":", "import", "os", ".", "path", "import", "sys", "if", "sys", ".", "argv", "[", "0", "]", ":", "top_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "sys", ".", "argv", ...
Sets up the python include paths to include src
[ "Sets", "up", "the", "python", "include", "paths", "to", "include", "src" ]
python
train
29.777778
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/application.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/application.py#L159-L165
def init_crash_handler(self): """Create a crash handler, typically setting sys.excepthook to it.""" self.crash_handler = self.crash_handler_class(self) sys.excepthook = self.excepthook def unset_crashhandler(): sys.excepthook = sys.__excepthook__ atexit.register(unset...
[ "def", "init_crash_handler", "(", "self", ")", ":", "self", ".", "crash_handler", "=", "self", ".", "crash_handler_class", "(", "self", ")", "sys", ".", "excepthook", "=", "self", ".", "excepthook", "def", "unset_crashhandler", "(", ")", ":", "sys", ".", "...
Create a crash handler, typically setting sys.excepthook to it.
[ "Create", "a", "crash", "handler", "typically", "setting", "sys", ".", "excepthook", "to", "it", "." ]
python
test
46.857143
facelessuser/wcmatch
wcmatch/_wcparse.py
https://github.com/facelessuser/wcmatch/blob/d153e7007cc73b994ae1ba553dc4584039f5c212/wcmatch/_wcparse.py#L256-L259
def _compile(pattern, flags): """Compile the pattern to regex.""" return re.compile(WcParse(pattern, flags & FLAG_MASK).parse())
[ "def", "_compile", "(", "pattern", ",", "flags", ")", ":", "return", "re", ".", "compile", "(", "WcParse", "(", "pattern", ",", "flags", "&", "FLAG_MASK", ")", ".", "parse", "(", ")", ")" ]
Compile the pattern to regex.
[ "Compile", "the", "pattern", "to", "regex", "." ]
python
train
33.5
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L117-L174
def get_codeblock_node(self, code, language): """this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self """ # type: () -> List[nodes.Node] document = self.state.document ...
[ "def", "get_codeblock_node", "(", "self", ",", "code", ",", "language", ")", ":", "# type: () -> List[nodes.Node]", "document", "=", "self", ".", "state", ".", "document", "location", "=", "self", ".", "state_machine", ".", "get_source_and_line", "(", "self", "....
this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self
[ "this", "is", "copied", "from", "sphinx", ".", "directives", ".", "code", ".", "CodeBlock", ".", "run" ]
python
train
40.258621
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L311-L363
def create_dataset(self, dataset, exists_ok=False, retry=DEFAULT_RETRY): """API call: create the dataset via a POST request. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/insert Args: dataset (Union[ \ :class:`~google.cloud.bigquery.dat...
[ "def", "create_dataset", "(", "self", ",", "dataset", ",", "exists_ok", "=", "False", ",", "retry", "=", "DEFAULT_RETRY", ")", ":", "if", "isinstance", "(", "dataset", ",", "str", ")", ":", "dataset", "=", "DatasetReference", ".", "from_string", "(", "data...
API call: create the dataset via a POST request. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/insert Args: dataset (Union[ \ :class:`~google.cloud.bigquery.dataset.Dataset`, \ :class:`~google.cloud.bigquery.dataset.DatasetRefer...
[ "API", "call", ":", "create", "the", "dataset", "via", "a", "POST", "request", "." ]
python
train
38.528302
LonamiWebs/Telethon
readthedocs/custom_roles.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/readthedocs/custom_roles.py#L5-L28
def make_link_node(rawtext, app, name, options): """ Create a link to the TL reference. :param rawtext: Text being replaced with link node. :param app: Sphinx application context :param name: Name of the object to link to :param options: Options dictionary passed to role func. """ try: ...
[ "def", "make_link_node", "(", "rawtext", ",", "app", ",", "name", ",", "options", ")", ":", "try", ":", "base", "=", "app", ".", "config", ".", "tl_ref_url", "if", "not", "base", ":", "raise", "AttributeError", "except", "AttributeError", "as", "e", ":",...
Create a link to the TL reference. :param rawtext: Text being replaced with link node. :param app: Sphinx application context :param name: Name of the object to link to :param options: Options dictionary passed to role func.
[ "Create", "a", "link", "to", "the", "TL", "reference", "." ]
python
train
30.666667
aganezov/bg
bg/grimm.py
https://github.com/aganezov/bg/blob/1ec758193441e49e7b34e0da09571480f4c24455/bg/grimm.py#L191-L253
def get_edges_from_parsed_data(parsed_data): """ Taking into account fragment type (circular|linear) and retrieved gene order information translates adjacencies between blocks into edges for addition to the :class:`bg.breakpoint_graph.BreakpointGraph` In case supplied fragment is linear (``$``) special...
[ "def", "get_edges_from_parsed_data", "(", "parsed_data", ")", ":", "chr_type", ",", "blocks", "=", "parsed_data", "vertices", "=", "[", "]", "for", "block", "in", "blocks", ":", "###############################################################################################",...
Taking into account fragment type (circular|linear) and retrieved gene order information translates adjacencies between blocks into edges for addition to the :class:`bg.breakpoint_graph.BreakpointGraph` In case supplied fragment is linear (``$``) special artificial vertices (with ``__infinity`` suffix) are int...
[ "Taking", "into", "account", "fragment", "type", "(", "circular|linear", ")", "and", "retrieved", "gene", "order", "information", "translates", "adjacencies", "between", "blocks", "into", "edges", "for", "addition", "to", "the", ":", "class", ":", "bg", ".", "...
python
train
63.31746
RealTimeWeb/datasets
preprocess/billionaires/groomer.py
https://github.com/RealTimeWeb/datasets/blob/2fe5befd251c783744d000bd4763e277616a152f/preprocess/billionaires/groomer.py#L16-L30
def _byteify(input): """ Force the given input to only use `str` instead of `bytes` or `unicode`. This works even if the input is a dict, list, """ if isinstance(input, dict): return {_byteify(key): _byteify(value) for key, value in input.items()} elif isinstance(input, list): re...
[ "def", "_byteify", "(", "input", ")", ":", "if", "isinstance", "(", "input", ",", "dict", ")", ":", "return", "{", "_byteify", "(", "key", ")", ":", "_byteify", "(", "value", ")", "for", "key", ",", "value", "in", "input", ".", "items", "(", ")", ...
Force the given input to only use `str` instead of `bytes` or `unicode`. This works even if the input is a dict, list,
[ "Force", "the", "given", "input", "to", "only", "use", "str", "instead", "of", "bytes", "or", "unicode", ".", "This", "works", "even", "if", "the", "input", "is", "a", "dict", "list" ]
python
train
41.466667
limpyd/redis-limpyd-extensions
limpyd_extensions/dynamic/model.py
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/dynamic/model.py#L102-L127
def _add_dynamic_field_to_model(cls, field, field_name): """ Add a copy of the DynamicField "field" to the current class and its subclasses using the "field_name" name """ # create the new field new_field = field._create_dynamic_version() new_field.name = field_na...
[ "def", "_add_dynamic_field_to_model", "(", "cls", ",", "field", ",", "field_name", ")", ":", "# create the new field", "new_field", "=", "field", ".", "_create_dynamic_version", "(", ")", "new_field", ".", "name", "=", "field_name", "new_field", ".", "_attach_to_mod...
Add a copy of the DynamicField "field" to the current class and its subclasses using the "field_name" name
[ "Add", "a", "copy", "of", "the", "DynamicField", "field", "to", "the", "current", "class", "and", "its", "subclasses", "using", "the", "field_name", "name" ]
python
train
39.5
apache/incubator-heron
heron/statemgrs/src/python/zkstatemanager.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/zkstatemanager.py#L304-L328
def _get_pplan_with_watch(self, topologyName, callback, isWatching): """ Helper function to get pplan with a callback. The future watch is placed only if isWatching is True. """ path = self.get_pplan_path(topologyName) if isWatching: LOG.info("Adding data watch for path: " + path) ...
[ "def", "_get_pplan_with_watch", "(", "self", ",", "topologyName", ",", "callback", ",", "isWatching", ")", ":", "path", "=", "self", ".", "get_pplan_path", "(", "topologyName", ")", "if", "isWatching", ":", "LOG", ".", "info", "(", "\"Adding data watch for path:...
Helper function to get pplan with a callback. The future watch is placed only if isWatching is True.
[ "Helper", "function", "to", "get", "pplan", "with", "a", "callback", ".", "The", "future", "watch", "is", "placed", "only", "if", "isWatching", "is", "True", "." ]
python
valid
31.56
taskcluster/taskcluster-client.py
taskcluster/aio/index.py
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/index.py#L141-L158
async def listNamespaces(self, *args, **kwargs): """ List Namespaces List the namespaces immediately under a given namespace. This endpoint lists up to 1000 namespaces. If more namespaces are present, a `continuationToken` will be returned, which can be given in the nex...
[ "async", "def", "listNamespaces", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"listNamespaces\"", "]", ",", "*", "args", ",", "*", "*", "kwargs",...
List Namespaces List the namespaces immediately under a given namespace. This endpoint lists up to 1000 namespaces. If more namespaces are present, a `continuationToken` will be returned, which can be given in the next request. For the initial request, the payload should be an ...
[ "List", "Namespaces" ]
python
train
33.777778
pybel/pybel-tools
src/pybel_tools/utils.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L185-L198
def safe_add_edge(graph, u, v, key, attr_dict, **attr): """Adds an edge while preserving negative keys, and paying no respect to positive ones :param pybel.BELGraph graph: A BEL Graph :param tuple u: The source BEL node :param tuple v: The target BEL node :param int key: The edge key. If less than ...
[ "def", "safe_add_edge", "(", "graph", ",", "u", ",", "v", ",", "key", ",", "attr_dict", ",", "*", "*", "attr", ")", ":", "if", "key", "<", "0", ":", "graph", ".", "add_edge", "(", "u", ",", "v", ",", "key", "=", "key", ",", "attr_dict", "=", ...
Adds an edge while preserving negative keys, and paying no respect to positive ones :param pybel.BELGraph graph: A BEL Graph :param tuple u: The source BEL node :param tuple v: The target BEL node :param int key: The edge key. If less than zero, corresponds to an unqualified edge, else is disregarded ...
[ "Adds", "an", "edge", "while", "preserving", "negative", "keys", "and", "paying", "no", "respect", "to", "positive", "ones" ]
python
valid
45.928571
pymc-devs/pymc
pymc/CommonDeterministics.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/CommonDeterministics.py#L634-L655
def create_casting_method(op, klass): """ Creates a new univariate special method, such as A.__float__() <=> float(A.value), for target class. The method is called __op_name__. """ # This function will become the actual method. def new_method(self, op=op): if not check_special_methods()...
[ "def", "create_casting_method", "(", "op", ",", "klass", ")", ":", "# This function will become the actual method.", "def", "new_method", "(", "self", ",", "op", "=", "op", ")", ":", "if", "not", "check_special_methods", "(", ")", ":", "raise", "NotImplementedErro...
Creates a new univariate special method, such as A.__float__() <=> float(A.value), for target class. The method is called __op_name__.
[ "Creates", "a", "new", "univariate", "special", "method", "such", "as", "A", ".", "__float__", "()", "<", "=", ">", "float", "(", "A", ".", "value", ")", "for", "target", "class", ".", "The", "method", "is", "called", "__op_name__", "." ]
python
train
36.590909
numenta/nupic
src/nupic/database/client_jobs_dao.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1935-L1947
def getActiveJobCountForClientKey(self, clientKey): """ Return the number of jobs for the given clientKey and a status that is not completed. """ with ConnectionFactory.get() as conn: query = 'SELECT count(job_id) ' \ 'FROM %s ' \ 'WHERE client_key = %%s ' \ ...
[ "def", "getActiveJobCountForClientKey", "(", "self", ",", "clientKey", ")", ":", "with", "ConnectionFactory", ".", "get", "(", ")", "as", "conn", ":", "query", "=", "'SELECT count(job_id) '", "'FROM %s '", "'WHERE client_key = %%s '", "' AND status != %%s'", "%", "sel...
Return the number of jobs for the given clientKey and a status that is not completed.
[ "Return", "the", "number", "of", "jobs", "for", "the", "given", "clientKey", "and", "a", "status", "that", "is", "not", "completed", "." ]
python
valid
38.307692
ArchiveTeam/wpull
wpull/document/htmlparse/lxml_.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/document/htmlparse/lxml_.py#L211-L226
def detect_parser_type(cls, file, encoding=None): '''Get the suitable parser type for the document. Returns: str ''' is_xml = XMLDetector.is_file(file) doctype = cls.parse_doctype(file, encoding=encoding) or '' if not doctype and is_xml: return '...
[ "def", "detect_parser_type", "(", "cls", ",", "file", ",", "encoding", "=", "None", ")", ":", "is_xml", "=", "XMLDetector", ".", "is_file", "(", "file", ")", "doctype", "=", "cls", ".", "parse_doctype", "(", "file", ",", "encoding", "=", "encoding", ")",...
Get the suitable parser type for the document. Returns: str
[ "Get", "the", "suitable", "parser", "type", "for", "the", "document", "." ]
python
train
24.4375
markuskiller/textblob-de
textblob_de/ext/_pattern/text/tree.py
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/tree.py#L900-L916
def _do_anchor(self, anchor): """ Collects preposition anchors and attachments in a dictionary. Once the dictionary has an entry for both the anchor and the attachment, they are linked. """ if anchor: for x in anchor.split("-"): A, P = None, None ...
[ "def", "_do_anchor", "(", "self", ",", "anchor", ")", ":", "if", "anchor", ":", "for", "x", "in", "anchor", ".", "split", "(", "\"-\"", ")", ":", "A", ",", "P", "=", "None", ",", "None", "if", "x", ".", "startswith", "(", "\"A\"", ")", "and", "...
Collects preposition anchors and attachments in a dictionary. Once the dictionary has an entry for both the anchor and the attachment, they are linked.
[ "Collects", "preposition", "anchors", "and", "attachments", "in", "a", "dictionary", ".", "Once", "the", "dictionary", "has", "an", "entry", "for", "both", "the", "anchor", "and", "the", "attachment", "they", "are", "linked", "." ]
python
train
52.647059
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1436-L1446
def setModified( self, state = True ): """ Flags the scene as being modified based on the inputed value. :param state <bool> """ if ( state == self._modified ): return self._modified = state self.emitModifiedStateChanged()
[ "def", "setModified", "(", "self", ",", "state", "=", "True", ")", ":", "if", "(", "state", "==", "self", ".", "_modified", ")", ":", "return", "self", ".", "_modified", "=", "state", "self", ".", "emitModifiedStateChanged", "(", ")" ]
Flags the scene as being modified based on the inputed value. :param state <bool>
[ "Flags", "the", "scene", "as", "being", "modified", "based", "on", "the", "inputed", "value", ".", ":", "param", "state", "<bool", ">" ]
python
train
28.090909
androguard/androguard
androguard/core/bytecodes/dvm.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/dvm.py#L8084-L8099
def get_methods_class(self, class_name): """ Return all methods of a specific class :param class_name: the class name :type class_name: string :rtype: a list with :class:`EncodedMethod` objects """ l = [] for i in self.get_classes(): for j in...
[ "def", "get_methods_class", "(", "self", ",", "class_name", ")", ":", "l", "=", "[", "]", "for", "i", "in", "self", ".", "get_classes", "(", ")", ":", "for", "j", "in", "i", ".", "get_methods", "(", ")", ":", "if", "class_name", "==", "j", ".", "...
Return all methods of a specific class :param class_name: the class name :type class_name: string :rtype: a list with :class:`EncodedMethod` objects
[ "Return", "all", "methods", "of", "a", "specific", "class" ]
python
train
26.5625
ianmiell/shutit
shutit_class.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L607-L629
def fail(self, msg, shutit_pexpect_child=None, throw_exception=False): """Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean """ shutit_global.shutit_g...
[ "def", "fail", "(", "self", ",", "msg", ",", "shutit_pexpect_child", "=", "None", ",", "throw_exception", "=", "False", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Note: we must not default to a child here", "if", "shut...
Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean
[ "Handles", "a", "failure", "pausing", "if", "a", "pexpect", "child", "object", "is", "passed", "in", "." ]
python
train
45.913043
louib/confirm
confirm/generator.py
https://github.com/louib/confirm/blob/0acd1eccda6cd71c69d2ae33166a16a257685811/confirm/generator.py#L142-L155
def generate_schema_file(config_file): """ Generates a basic confirm schema file from a configuration file. """ config = utils.load_config_from_ini_file(config_file) schema = {} for section_name in config: for option_name in config[section_name]: schema.setdefault(section_n...
[ "def", "generate_schema_file", "(", "config_file", ")", ":", "config", "=", "utils", ".", "load_config_from_ini_file", "(", "config_file", ")", "schema", "=", "{", "}", "for", "section_name", "in", "config", ":", "for", "option_name", "in", "config", "[", "sec...
Generates a basic confirm schema file from a configuration file.
[ "Generates", "a", "basic", "confirm", "schema", "file", "from", "a", "configuration", "file", "." ]
python
train
34
collectiveacuity/labPack
labpack/databases/sql.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/sql.py#L559-L572
def exists(self, primary_key): ''' a method to determine if record exists :param primary_key: string with primary key of record :return: boolean to indicate existence of record ''' select_statement = self.table.select(self.table).where(...
[ "def", "exists", "(", "self", ",", "primary_key", ")", ":", "select_statement", "=", "self", ".", "table", ".", "select", "(", "self", ".", "table", ")", ".", "where", "(", "self", ".", "table", ".", "c", ".", "id", "==", "primary_key", ")", "record_...
a method to determine if record exists :param primary_key: string with primary key of record :return: boolean to indicate existence of record
[ "a", "method", "to", "determine", "if", "record", "exists", ":", "param", "primary_key", ":", "string", "with", "primary", "key", "of", "record", ":", "return", ":", "boolean", "to", "indicate", "existence", "of", "record" ]
python
train
34.142857
fossasia/knittingpattern
knittingpattern/Dumper/file.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Dumper/file.py#L142-L147
def _temporary_file(self, delete): """:return: a temporary file where the content is dumped to.""" file = NamedTemporaryFile("w+", delete=delete, encoding=self.__encoding) self._file(file) return file
[ "def", "_temporary_file", "(", "self", ",", "delete", ")", ":", "file", "=", "NamedTemporaryFile", "(", "\"w+\"", ",", "delete", "=", "delete", ",", "encoding", "=", "self", ".", "__encoding", ")", "self", ".", "_file", "(", "file", ")", "return", "file"...
:return: a temporary file where the content is dumped to.
[ ":", "return", ":", "a", "temporary", "file", "where", "the", "content", "is", "dumped", "to", "." ]
python
valid
43.5
rmorshea/spectate
spectate/mvc/base.py
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L24-L55
def view(model: "Model", *functions: Callable) -> Optional[Callable]: """A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc i...
[ "def", "view", "(", "model", ":", "\"Model\"", ",", "*", "functions", ":", "Callable", ")", "->", "Optional", "[", "Callable", "]", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r...
A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc items = mvc.List() @mvc.view(items) def printer(items...
[ "A", "decorator", "for", "registering", "a", "callback", "to", "a", "model" ]
python
train
24.25
tensorflow/probability
tensorflow_probability/python/layers/distribution_layer.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/layers/distribution_layer.py#L834-L855
def new(params, event_shape=(), validate_args=False, name=None): """Create the distribution instance from a `params` vector.""" with tf.compat.v1.name_scope(name, 'IndependentLogistic', [params, event_shape]): params = tf.convert_to_tensor(value=params, name='params') ...
[ "def", "new", "(", "params", ",", "event_shape", "=", "(", ")", ",", "validate_args", "=", "False", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "name", ",", "'IndependentLogistic'", ",", "[", "p...
Create the distribution instance from a `params` vector.
[ "Create", "the", "distribution", "instance", "from", "a", "params", "vector", "." ]
python
test
46.636364
wbond/asn1crypto
dev/deps.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/dev/deps.py#L204-L292
def _extract_package(deps_dir, pkg_path): """ Extract a .whl, .zip, .tar.gz or .tar.bz2 into a package path to use when running CI tasks :param deps_dir: A unicode string of the directory the package should be extracted to :param pkg_path: A unicode string of the path to the archiv...
[ "def", "_extract_package", "(", "deps_dir", ",", "pkg_path", ")", ":", "if", "pkg_path", ".", "endswith", "(", "'.exe'", ")", ":", "try", ":", "zf", "=", "None", "zf", "=", "zipfile", ".", "ZipFile", "(", "pkg_path", ",", "'r'", ")", "# Exes have a PLATL...
Extract a .whl, .zip, .tar.gz or .tar.bz2 into a package path to use when running CI tasks :param deps_dir: A unicode string of the directory the package should be extracted to :param pkg_path: A unicode string of the path to the archive
[ "Extract", "a", ".", "whl", ".", "zip", ".", "tar", ".", "gz", "or", ".", "tar", ".", "bz2", "into", "a", "package", "path", "to", "use", "when", "running", "CI", "tasks" ]
python
train
32.831461
cs01/pygdbmi
pygdbmi/gdbcontroller.py
https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/pygdbmi/gdbcontroller.py#L404-L428
def send_signal_to_gdb(self, signal_input): """Send signal name (case insensitive) or number to gdb subprocess gdbmi.send_signal_to_gdb(2) # valid gdbmi.send_signal_to_gdb('sigint') # also valid gdbmi.send_signal_to_gdb('SIGINT') # also valid raises ValueError if signal_input...
[ "def", "send_signal_to_gdb", "(", "self", ",", "signal_input", ")", ":", "try", ":", "signal", "=", "int", "(", "signal_input", ")", "except", "Exception", ":", "signal", "=", "SIGNAL_NAME_TO_NUM", ".", "get", "(", "signal_input", ".", "upper", "(", ")", "...
Send signal name (case insensitive) or number to gdb subprocess gdbmi.send_signal_to_gdb(2) # valid gdbmi.send_signal_to_gdb('sigint') # also valid gdbmi.send_signal_to_gdb('SIGINT') # also valid raises ValueError if signal_input is invalie raises NoGdbProcessError if there i...
[ "Send", "signal", "name", "(", "case", "insensitive", ")", "or", "number", "to", "gdb", "subprocess", "gdbmi", ".", "send_signal_to_gdb", "(", "2", ")", "#", "valid", "gdbmi", ".", "send_signal_to_gdb", "(", "sigint", ")", "#", "also", "valid", "gdbmi", "....
python
valid
36.44
squidsoup/muddle.py
muddle/api.py
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L138-L154
def contents(self): """ Returns entire contents of course page :returns: response object Example Usage:: >>> import muddle >>> muddle.course(10).content() """ params = self.request_params params.update({'wsfunction': 'core_course_get_contents',...
[ "def", "contents", "(", "self", ")", ":", "params", "=", "self", ".", "request_params", "params", ".", "update", "(", "{", "'wsfunction'", ":", "'core_course_get_contents'", ",", "'courseid'", ":", "self", ".", "course_id", "}", ")", "return", "requests", "....
Returns entire contents of course page :returns: response object Example Usage:: >>> import muddle >>> muddle.course(10).content()
[ "Returns", "entire", "contents", "of", "course", "page" ]
python
train
25.588235
pydanny-archive/dj-libcloud
djlibcloud/storage.py
https://github.com/pydanny-archive/dj-libcloud/blob/dc485ed56a8dec9f5f200e1effb91f6113353aa4/djlibcloud/storage.py#L126-L158
def listdir(self, path='/'): """Lists the contents of the specified path, returning a 2-tuple of lists; the first item being directories, the second item being files. """ container = self._get_bucket() objects = self.driver.list_container_objects(container) path =...
[ "def", "listdir", "(", "self", ",", "path", "=", "'/'", ")", ":", "container", "=", "self", ".", "_get_bucket", "(", ")", "objects", "=", "self", ".", "driver", ".", "list_container_objects", "(", "container", ")", "path", "=", "self", ".", "_clean_name"...
Lists the contents of the specified path, returning a 2-tuple of lists; the first item being directories, the second item being files.
[ "Lists", "the", "contents", "of", "the", "specified", "path", "returning", "a", "2", "-", "tuple", "of", "lists", ";", "the", "first", "item", "being", "directories", "the", "second", "item", "being", "files", "." ]
python
train
41.69697
DAI-Lab/Copulas
copulas/multivariate/tree.py
https://github.com/DAI-Lab/Copulas/blob/821df61c3d36a6b81ef2883935f935c2eaaa862c/copulas/multivariate/tree.py#L182-L211
def prepare_next_tree(self): """Prepare conditional U matrix for next tree.""" for edge in self.edges: copula_theta = edge.theta if self.level == 1: left_u = self.u_matrix[:, edge.L] right_u = self.u_matrix[:, edge.R] else: ...
[ "def", "prepare_next_tree", "(", "self", ")", ":", "for", "edge", "in", "self", ".", "edges", ":", "copula_theta", "=", "edge", ".", "theta", "if", "self", ".", "level", "==", "1", ":", "left_u", "=", "self", ".", "u_matrix", "[", ":", ",", "edge", ...
Prepare conditional U matrix for next tree.
[ "Prepare", "conditional", "U", "matrix", "for", "next", "tree", "." ]
python
train
45.333333
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L638-L658
def _fixed_source_line(self): """Attempt to find the line that this node appears on. We need this method since not all nodes have :attr:`lineno` set. :returns: The line number of this node, or None if this could not be determined. :rtype: int or None """ lin...
[ "def", "_fixed_source_line", "(", "self", ")", ":", "line", "=", "self", ".", "lineno", "_node", "=", "self", "try", ":", "while", "line", "is", "None", ":", "_node", "=", "next", "(", "_node", ".", "get_children", "(", ")", ")", "line", "=", "_node"...
Attempt to find the line that this node appears on. We need this method since not all nodes have :attr:`lineno` set. :returns: The line number of this node, or None if this could not be determined. :rtype: int or None
[ "Attempt", "to", "find", "the", "line", "that", "this", "node", "appears", "on", "." ]
python
train
31.666667
rdussurget/py-altimetry
altimetry/data/alti_data.py
https://github.com/rdussurget/py-altimetry/blob/57ce7f2d63c6bbc4993821af0bbe46929e3a2d98/altimetry/data/alti_data.py#L151-L196
def read(self,filename,datatype=None,slaext=False,**kwargs): ''' reader method. :parameter filename: name of the file to load. :keyword datatype: choose between DT/NRT/PISTACH/CTOH or other formats to call the corresponding reader. If datatype is : * D...
[ "def", "read", "(", "self", ",", "filename", ",", "datatype", "=", "None", ",", "slaext", "=", "False", ",", "*", "*", "kwargs", ")", ":", "fname", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "os", ".", ...
reader method. :parameter filename: name of the file to load. :keyword datatype: choose between DT/NRT/PISTACH/CTOH or other formats to call the corresponding reader. If datatype is : * DT or NRT or PISTACH : calls :func:`altimetry.data.alti_data.read_sla` or :func:`alt...
[ "reader", "method", ".", ":", "parameter", "filename", ":", "name", "of", "the", "file", "to", "load", ".", ":", "keyword", "datatype", ":", "choose", "between", "DT", "/", "NRT", "/", "PISTACH", "/", "CTOH", "or", "other", "formats", "to", "call", "th...
python
train
54.847826
totalgood/pugnlp
src/pugnlp/util.py
https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/util.py#L2464-L2515
def listify(values, N=1, delim=None): """Return an N-length list, with elements values, extrapolating as necessary. >>> listify("don't split into characters") ["don't split into characters"] >>> listify("len = 3", 3) ['len = 3', 'len = 3', 'len = 3'] >>> listify("But split on a delimeter, if re...
[ "def", "listify", "(", "values", ",", "N", "=", "1", ",", "delim", "=", "None", ")", ":", "ans", "=", "[", "]", "if", "values", "is", "None", "else", "values", "# convert non-string non-list iterables into a list", "if", "hasattr", "(", "ans", ",", "'__ite...
Return an N-length list, with elements values, extrapolating as necessary. >>> listify("don't split into characters") ["don't split into characters"] >>> listify("len = 3", 3) ['len = 3', 'len = 3', 'len = 3'] >>> listify("But split on a delimeter, if requested.", delim=',') ['But split on a de...
[ "Return", "an", "N", "-", "length", "list", "with", "elements", "values", "extrapolating", "as", "necessary", "." ]
python
train
30.096154
buildbot/buildbot
worker/buildbot_worker/base.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L307-L337
def remote_getWorkerInfo(self): """This command retrieves data from the files in WORKERDIR/info/* and sends the contents to the buildmaster. These are used to describe the worker and its configuration, and should be created and maintained by the worker administrator. They will be retriev...
[ "def", "remote_getWorkerInfo", "(", "self", ")", ":", "files", "=", "{", "}", "basedir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "basedir", ",", "\"info\"", ")", "if", "os", ".", "path", ".", "isdir", "(", "basedir", ")", ":", "for",...
This command retrieves data from the files in WORKERDIR/info/* and sends the contents to the buildmaster. These are used to describe the worker and its configuration, and should be created and maintained by the worker administrator. They will be retrieved each time the master-worker conn...
[ "This", "command", "retrieves", "data", "from", "the", "files", "in", "WORKERDIR", "/", "info", "/", "*", "and", "sends", "the", "contents", "to", "the", "buildmaster", ".", "These", "are", "used", "to", "describe", "the", "worker", "and", "its", "configur...
python
train
42.483871
hydpy-dev/hydpy
hydpy/core/sequencetools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/sequencetools.py#L2036-L2058
def save_data(self, idx): """Save the internal data of all sequences with an activated flag. Write to file if the corresponding disk flag is activated; store in working memory if the corresponding ram flag is activated.""" for name in self: actual = getattr(self, name) ...
[ "def", "save_data", "(", "self", ",", "idx", ")", ":", "for", "name", "in", "self", ":", "actual", "=", "getattr", "(", "self", ",", "name", ")", "diskflag", "=", "getattr", "(", "self", ",", "'_%s_diskflag'", "%", "name", ")", "ramflag", "=", "getat...
Save the internal data of all sequences with an activated flag. Write to file if the corresponding disk flag is activated; store in working memory if the corresponding ram flag is activated.
[ "Save", "the", "internal", "data", "of", "all", "sequences", "with", "an", "activated", "flag", ".", "Write", "to", "file", "if", "the", "corresponding", "disk", "flag", "is", "activated", ";", "store", "in", "working", "memory", "if", "the", "corresponding"...
python
train
45.956522
raymondEhlers/pachyderm
pachyderm/projectors.py
https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L726-L746
def output_hist(self, output_hist: Hist, input_observable: Any, **kwargs: Dict[str, Any]) -> Union[Hist, Any]: """ Return an output object. It should store the ``output_hist``. Note: The output object could just be the raw histogram. Note: This function is just a basic ...
[ "def", "output_hist", "(", "self", ",", "output_hist", ":", "Hist", ",", "input_observable", ":", "Any", ",", "*", "*", "kwargs", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Union", "[", "Hist", ",", "Any", "]", ":", "return", "output_hist"...
Return an output object. It should store the ``output_hist``. Note: The output object could just be the raw histogram. Note: This function is just a basic placeholder which returns the given output object (a histogram) and likely should be overridden. Args:...
[ "Return", "an", "output", "object", ".", "It", "should", "store", "the", "output_hist", "." ]
python
train
44
FPGAwars/apio
apio/commands/verify.py
https://github.com/FPGAwars/apio/blob/5c6310f11a061a760764c6b5847bfb431dc3d0bc/apio/commands/verify.py#L21-L24
def cli(ctx, project_dir): """Verify the verilog code.""" exit_code = SCons(project_dir).verify() ctx.exit(exit_code)
[ "def", "cli", "(", "ctx", ",", "project_dir", ")", ":", "exit_code", "=", "SCons", "(", "project_dir", ")", ".", "verify", "(", ")", "ctx", ".", "exit", "(", "exit_code", ")" ]
Verify the verilog code.
[ "Verify", "the", "verilog", "code", "." ]
python
train
31.5
CyberReboot/vent
vent/helpers/paths.py
https://github.com/CyberReboot/vent/blob/9956a09146b11a89a0eabab3bc7ce8906d124885/vent/helpers/paths.py#L142-L183
def override_config(self, path): """ Will take a yml located in home directory titled '.plugin_config.yml'. It'll then override, using the yml, the plugin's config file """ status = (True, None) config_override = False try: # parse the yml file ...
[ "def", "override_config", "(", "self", ",", "path", ")", ":", "status", "=", "(", "True", ",", "None", ")", "config_override", "=", "False", "try", ":", "# parse the yml file", "c_dict", "=", "{", "}", "if", "exists", "(", "self", ".", "plugin_config_file"...
Will take a yml located in home directory titled '.plugin_config.yml'. It'll then override, using the yml, the plugin's config file
[ "Will", "take", "a", "yml", "located", "in", "home", "directory", "titled", ".", "plugin_config", ".", "yml", ".", "It", "ll", "then", "override", "using", "the", "yml", "the", "plugin", "s", "config", "file" ]
python
train
41.52381
jason-weirather/py-seq-tools
seqtools/errors.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/errors.py#L1025-L1050
def get_target_error(self,i): """Just get a single error characterization based on the index relative to the target :param i: list index :type i: int :returns: base-wise error :rtype: HPA group description """ x = self._target_hpas[i] h = x['hpa'] pos = x['pos'] prob = 0 be...
[ "def", "get_target_error", "(", "self", ",", "i", ")", ":", "x", "=", "self", ".", "_target_hpas", "[", "i", "]", "h", "=", "x", "[", "'hpa'", "]", "pos", "=", "x", "[", "'pos'", "]", "prob", "=", "0", "be", "=", "BaseError", "(", "'target'", "...
Just get a single error characterization based on the index relative to the target :param i: list index :type i: int :returns: base-wise error :rtype: HPA group description
[ "Just", "get", "a", "single", "error", "characterization", "based", "on", "the", "index", "relative", "to", "the", "target" ]
python
train
36.538462
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12514-L12531
def autopilot_version_send(self, capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, force_mavlink1=False): ''' Version and capability of autopilot software ...
[ "def", "autopilot_version_send", "(", "self", ",", "capabilities", ",", "flight_sw_version", ",", "middleware_sw_version", ",", "os_sw_version", ",", "board_version", ",", "flight_custom_version", ",", "middleware_custom_version", ",", "os_custom_version", ",", "vendor_id",...
Version and capability of autopilot software capabilities : bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) (uint64_t) flight_sw_version : Firmware version number (uint32_t) middleware_sw_version : Middleware version number (uint32_...
[ "Version", "and", "capability", "of", "autopilot", "software" ]
python
train
116.444444
jmbeach/KEP.py
src/keppy/tag.py
https://github.com/jmbeach/KEP.py/blob/68cda64ab649640a486534867c81274c41e39446/src/keppy/tag.py#L39-L42
def get_array_size(self): """Attempts to parse array size out of the address""" match = re.search(r"(?<=\[)\d+(?=\])", self.get_address()) return int(match.group(0))
[ "def", "get_array_size", "(", "self", ")", ":", "match", "=", "re", ".", "search", "(", "r\"(?<=\\[)\\d+(?=\\])\"", ",", "self", ".", "get_address", "(", ")", ")", "return", "int", "(", "match", ".", "group", "(", "0", ")", ")" ]
Attempts to parse array size out of the address
[ "Attempts", "to", "parse", "array", "size", "out", "of", "the", "address" ]
python
train
46.5
nicolargo/glances
glances/plugins/glances_load.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_load.py#L133-L174
def msg_curse(self, args=None, max_width=None): """Return the dict to display in the curse interface.""" # Init the return message ret = [] # Only process if stats exist, not empty (issue #871) and plugin not disabled if not self.stats or (self.stats == {}) or self.is_disable():...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist, not empty (issue #871) and plugin not disabled", "if", "not", "self", ".", "stats", ...
Return the dict to display in the curse interface.
[ "Return", "the", "dict", "to", "display", "in", "the", "curse", "interface", "." ]
python
train
37.52381
glomex/gcdt
gcdt/kumo_core.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L658-L666
def write_template_to_file(conf, template_body): """Writes the template to disk """ template_file_name = _get_stack_name(conf) + '-generated-cf-template.json' with open(template_file_name, 'w') as opened_file: opened_file.write(template_body) print('wrote cf-template for %s to disk: %s' % ( ...
[ "def", "write_template_to_file", "(", "conf", ",", "template_body", ")", ":", "template_file_name", "=", "_get_stack_name", "(", "conf", ")", "+", "'-generated-cf-template.json'", "with", "open", "(", "template_file_name", ",", "'w'", ")", "as", "opened_file", ":", ...
Writes the template to disk
[ "Writes", "the", "template", "to", "disk" ]
python
train
42.333333