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
pandas-dev/pandas
pandas/core/frame.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L5978-L6039
def unstack(self, level=-1, fill_value=None): """ Pivot a level of the (necessarily hierarchical) index labels, returning a DataFrame having a new level of column labels whose inner-most level consists of the pivoted index labels. If the index is not a MultiIndex, the output wil...
[ "def", "unstack", "(", "self", ",", "level", "=", "-", "1", ",", "fill_value", "=", "None", ")", ":", "from", "pandas", ".", "core", ".", "reshape", ".", "reshape", "import", "unstack", "return", "unstack", "(", "self", ",", "level", ",", "fill_value",...
Pivot a level of the (necessarily hierarchical) index labels, returning a DataFrame having a new level of column labels whose inner-most level consists of the pivoted index labels. If the index is not a MultiIndex, the output will be a Series (the analogue of stack when the columns are ...
[ "Pivot", "a", "level", "of", "the", "(", "necessarily", "hierarchical", ")", "index", "labels", "returning", "a", "DataFrame", "having", "a", "new", "level", "of", "column", "labels", "whose", "inner", "-", "most", "level", "consists", "of", "the", "pivoted"...
python
train
29.33871
yueyoum/social-oauth
example/_bottle.py
https://github.com/yueyoum/social-oauth/blob/80600ea737355b20931c8a0b5223f5b68175d930/example/_bottle.py#L1303-L1308
def headers(self): ''' An instance of :class:`HeaderDict`, a case-insensitive dict-like view on the response headers. ''' self.__dict__['headers'] = hdict = HeaderDict() hdict.dict = self._headers return hdict
[ "def", "headers", "(", "self", ")", ":", "self", ".", "__dict__", "[", "'headers'", "]", "=", "hdict", "=", "HeaderDict", "(", ")", "hdict", ".", "dict", "=", "self", ".", "_headers", "return", "hdict" ]
An instance of :class:`HeaderDict`, a case-insensitive dict-like view on the response headers.
[ "An", "instance", "of", ":", "class", ":", "HeaderDict", "a", "case", "-", "insensitive", "dict", "-", "like", "view", "on", "the", "response", "headers", "." ]
python
train
41.333333
rene-aguirre/pywinusb
pywinusb/hid/core.py
https://github.com/rene-aguirre/pywinusb/blob/954c4b2105d9f01cb0c50e24500bb747d4ecdc43/pywinusb/hid/core.py#L184-L242
def get_devices(self, hid_filter = None): """Filter a HID device list by current object parameters. Devices must match the all of the filtering parameters """ if not hid_filter: #empty list or called without any parameters if type(hid_filter) == type(None): ...
[ "def", "get_devices", "(", "self", ",", "hid_filter", "=", "None", ")", ":", "if", "not", "hid_filter", ":", "#empty list or called without any parameters\r", "if", "type", "(", "hid_filter", ")", "==", "type", "(", "None", ")", ":", "#request to query connected d...
Filter a HID device list by current object parameters. Devices must match the all of the filtering parameters
[ "Filter", "a", "HID", "device", "list", "by", "current", "object", "parameters", ".", "Devices", "must", "match", "the", "all", "of", "the", "filtering", "parameters" ]
python
train
41.864407
secdev/scapy
scapy/contrib/isotp.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/isotp.py#L329-L340
def feed(self, can): """Attempt to feed an incoming CAN frame into the state machine""" if not isinstance(can, CAN): raise Scapy_Exception("argument is not a CAN frame") identifier = can.identifier data = bytes(can.data) if len(data) > 1 and self.use_ext_addr is not ...
[ "def", "feed", "(", "self", ",", "can", ")", ":", "if", "not", "isinstance", "(", "can", ",", "CAN", ")", ":", "raise", "Scapy_Exception", "(", "\"argument is not a CAN frame\"", ")", "identifier", "=", "can", ".", "identifier", "data", "=", "bytes", "(", ...
Attempt to feed an incoming CAN frame into the state machine
[ "Attempt", "to", "feed", "an", "incoming", "CAN", "frame", "into", "the", "state", "machine" ]
python
train
43.333333
fastai/fastai
fastai/core.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/core.py#L221-L224
def loadtxt_str(path:PathOrStr)->np.ndarray: "Return `ndarray` of `str` of lines of text from `path`." with open(path, 'r') as f: lines = f.readlines() return np.array([l.strip() for l in lines])
[ "def", "loadtxt_str", "(", "path", ":", "PathOrStr", ")", "->", "np", ".", "ndarray", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "lines", "=", "f", ".", "readlines", "(", ")", "return", "np", ".", "array", "(", "[", "l", ...
Return `ndarray` of `str` of lines of text from `path`.
[ "Return", "ndarray", "of", "str", "of", "lines", "of", "text", "from", "path", "." ]
python
train
51
nion-software/nionswift
nion/swift/Facade.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1785-L1801
def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask: """Create a record task for this hardware source. .. versionadded:: 1.0 :param frame_parameters: The frame parameters for the record. Pass None for defaults. :type frame_p...
[ "def", "create_record_task", "(", "self", ",", "frame_parameters", ":", "dict", "=", "None", ",", "channels_enabled", ":", "typing", ".", "List", "[", "bool", "]", "=", "None", ")", "->", "RecordTask", ":", "return", "RecordTask", "(", "self", ".", "__hard...
Create a record task for this hardware source. .. versionadded:: 1.0 :param frame_parameters: The frame parameters for the record. Pass None for defaults. :type frame_parameters: :py:class:`FrameParameters` :param channels_enabled: The enabled channels for the record. Pass None for def...
[ "Create", "a", "record", "task", "for", "this", "hardware", "source", "." ]
python
train
47.647059
trailofbits/manticore
manticore/platforms/linux.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/linux.py#L1242-L1265
def sys_lseek(self, fd, offset, whence): """ lseek - reposition read/write file offset The lseek() function repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive whence :param fd: a val...
[ "def", "sys_lseek", "(", "self", ",", "fd", ",", "offset", ",", "whence", ")", ":", "signed_offset", "=", "self", ".", "_to_signed_dword", "(", "offset", ")", "try", ":", "return", "self", ".", "_get_fd", "(", "fd", ")", ".", "seek", "(", "signed_offse...
lseek - reposition read/write file offset The lseek() function repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive whence :param fd: a valid file descriptor :param offset: the offset in bytes...
[ "lseek", "-", "reposition", "read", "/", "write", "file", "offset" ]
python
valid
44.416667
tanghaibao/jcvi
jcvi/graphics/base.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/graphics/base.py#L348-L413
def discrete_rainbow(N=7, cmap=cm.Set1, usepreset=True, shuffle=False, \ plot=False): """ Return a discrete colormap and the set of colors. modified from <http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations> cmap: colormap instance, eg. cm.jet. N: Number of co...
[ "def", "discrete_rainbow", "(", "N", "=", "7", ",", "cmap", "=", "cm", ".", "Set1", ",", "usepreset", "=", "True", ",", "shuffle", "=", "False", ",", "plot", "=", "False", ")", ":", "import", "random", "from", "scipy", "import", "interpolate", "if", ...
Return a discrete colormap and the set of colors. modified from <http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations> cmap: colormap instance, eg. cm.jet. N: Number of colors. Example >>> x = resize(arange(100), (5,100)) >>> djet = cmap_discretize(cm.jet, 5) >>> imshow(x,...
[ "Return", "a", "discrete", "colormap", "and", "the", "set", "of", "colors", "." ]
python
train
26.80303
f3at/feat
src/feat/common/error.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/common/error.py#L49-L62
def print_errors(function): """Prints the exceptions raised by the decorated function without interfering. For debugging purpose.""" def wrapper(*args, **kwargs): try: return function(*args, **kwargs) except BaseException as e: print ("Exception raise calling %s: %s"...
[ "def", "print_errors", "(", "function", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "BaseException", "as", "e", ":", "p...
Prints the exceptions raised by the decorated function without interfering. For debugging purpose.
[ "Prints", "the", "exceptions", "raised", "by", "the", "decorated", "function", "without", "interfering", ".", "For", "debugging", "purpose", "." ]
python
train
32.142857
radjkarl/fancyWidgets
DUMP/pyqtgraphBased/parametertree/parameterTypes.py
https://github.com/radjkarl/fancyWidgets/blob/ffe0d5747c5296c78575f0e0909af915a4a5698f/DUMP/pyqtgraphBased/parametertree/parameterTypes.py#L238-L247
def selected(self, sel): """Called when this item has been selected (sel=True) OR deselected (sel=False)""" ParameterItem.selected(self, sel) if self.widget is None: return if sel and self.param.writable(): self.showEditor() elif self.hideWidget: ...
[ "def", "selected", "(", "self", ",", "sel", ")", ":", "ParameterItem", ".", "selected", "(", "self", ",", "sel", ")", "if", "self", ".", "widget", "is", "None", ":", "return", "if", "sel", "and", "self", ".", "param", ".", "writable", "(", ")", ":"...
Called when this item has been selected (sel=True) OR deselected (sel=False)
[ "Called", "when", "this", "item", "has", "been", "selected", "(", "sel", "=", "True", ")", "OR", "deselected", "(", "sel", "=", "False", ")" ]
python
train
33.2
tornadoweb/tornado
tornado/web.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/web.py#L439-L455
def get_argument( # noqa: F811 self, name: str, default: Union[None, str, _ArgDefaultMarker] = _ARG_DEFAULT, strip: bool = True, ) -> Optional[str]: """Returns the value of the argument with the given name. If default is not provided, the argument is considered to b...
[ "def", "get_argument", "(", "# noqa: F811", "self", ",", "name", ":", "str", ",", "default", ":", "Union", "[", "None", ",", "str", ",", "_ArgDefaultMarker", "]", "=", "_ARG_DEFAULT", ",", "strip", ":", "bool", "=", "True", ",", ")", "->", "Optional", ...
Returns the value of the argument with the given name. If default is not provided, the argument is considered to be required, and we raise a `MissingArgumentError` if it is missing. If the argument appears in the request more than once, we return the last value. This method se...
[ "Returns", "the", "value", "of", "the", "argument", "with", "the", "given", "name", "." ]
python
train
37.294118
NoviceLive/intellicoder
intellicoder/synthesizers.py
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L173-L191
def c_hashes(self): """Get the hashes of the module including functions and DLLs. """ if callable(self.opts.hash_func): hashes = [ '# define {}{} {}\n'.format( self.opts.prefix, name, self.opts.hash_func(name) ) for name, dummy_args...
[ "def", "c_hashes", "(", "self", ")", ":", "if", "callable", "(", "self", ".", "opts", ".", "hash_func", ")", ":", "hashes", "=", "[", "'# define {}{} {}\\n'", ".", "format", "(", "self", ".", "opts", ".", "prefix", ",", "name", ",", "self", ".", "opt...
Get the hashes of the module including functions and DLLs.
[ "Get", "the", "hashes", "of", "the", "module", "including", "functions", "and", "DLLs", "." ]
python
train
34.842105
rocky/python-spark
example/python2/py2_scan.py
https://github.com/rocky/python-spark/blob/8899954bcf0e166726841a43e87c23790eb3441f/example/python2/py2_scan.py#L119-L124
def t_name(self, s): r'[A-Za-z_][A-Za-z_0-9]*' if s in RESERVED_WORDS: self.add_token(s.upper(), s) else: self.add_token('NAME', s)
[ "def", "t_name", "(", "self", ",", "s", ")", ":", "if", "s", "in", "RESERVED_WORDS", ":", "self", ".", "add_token", "(", "s", ".", "upper", "(", ")", ",", "s", ")", "else", ":", "self", ".", "add_token", "(", "'NAME'", ",", "s", ")" ]
r'[A-Za-z_][A-Za-z_0-9]*
[ "r", "[", "A", "-", "Za", "-", "z_", "]", "[", "A", "-", "Za", "-", "z_0", "-", "9", "]", "*" ]
python
train
29
opendns/pyinvestigate
investigate/investigate.py
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L91-L95
def post_parse(self, uri, params={}, data={}): '''Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.post, uri, params, data)
[ "def", "post_parse", "(", "self", ",", "uri", ",", "params", "=", "{", "}", ",", "data", "=", "{", "}", ")", ":", "return", "self", ".", "_request_parse", "(", "self", ".", "post", ",", "uri", ",", "params", ",", "data", ")" ]
Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status.
[ "Convenience", "method", "to", "call", "post", "()", "on", "an", "arbitrary", "URI", "and", "parse", "the", "response", "into", "a", "JSON", "object", ".", "Raises", "an", "error", "on", "non", "-", "200", "response", "status", "." ]
python
train
55.8
tkf/rash
rash/database.py
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L379-L421
def search_command_record( self, after_context, before_context, context, context_type, **kwds): """ Search command history. :rtype: [CommandRecord] """ if after_context or before_context or context: kwds['condition_as_column'] = T...
[ "def", "search_command_record", "(", "self", ",", "after_context", ",", "before_context", ",", "context", ",", "context_type", ",", "*", "*", "kwds", ")", ":", "if", "after_context", "or", "before_context", "or", "context", ":", "kwds", "[", "'condition_as_colum...
Search command history. :rtype: [CommandRecord]
[ "Search", "command", "history", "." ]
python
train
40.465116
CamDavidsonPilon/lifelines
lifelines/fitters/coxph_fitter.py
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/fitters/coxph_fitter.py#L1580-L1601
def _compute_baseline_survival(self): """ Importantly, this agrees with what the KaplanMeierFitter produces. Ex: Example ------- >>> from lifelines.datasets import load_rossi >>> from lifelines import CoxPHFitter, KaplanMeierFitter >>> rossi = load_rossi() ...
[ "def", "_compute_baseline_survival", "(", "self", ")", ":", "survival_df", "=", "np", ".", "exp", "(", "-", "self", ".", "baseline_cumulative_hazard_", ")", "if", "self", ".", "strata", "is", "None", ":", "survival_df", ".", "columns", "=", "[", "\"baseline ...
Importantly, this agrees with what the KaplanMeierFitter produces. Ex: Example ------- >>> from lifelines.datasets import load_rossi >>> from lifelines import CoxPHFitter, KaplanMeierFitter >>> rossi = load_rossi() >>> kmf = KaplanMeierFitter() >>> kmf.fit(rossi[...
[ "Importantly", "this", "agrees", "with", "what", "the", "KaplanMeierFitter", "produces", ".", "Ex", ":" ]
python
train
37.727273
scrapinghub/dateparser
dateparser/languages/dictionary.py
https://github.com/scrapinghub/dateparser/blob/11a761c99d3ee522a3c63756b70c106a579e8b5c/dateparser/languages/dictionary.py#L96-L114
def are_tokens_valid(self, tokens): """ Check if tokens are valid tokens for the locale. :param tokens: a list of string or unicode tokens. :type tokens: list :return: True if tokens are valid, False otherwise. """ match_relative_regex = self._get_ma...
[ "def", "are_tokens_valid", "(", "self", ",", "tokens", ")", ":", "match_relative_regex", "=", "self", ".", "_get_match_relative_regex_cache", "(", ")", "for", "token", "in", "tokens", ":", "if", "any", "(", "[", "match_relative_regex", ".", "match", "(", "toke...
Check if tokens are valid tokens for the locale. :param tokens: a list of string or unicode tokens. :type tokens: list :return: True if tokens are valid, False otherwise.
[ "Check", "if", "tokens", "are", "valid", "tokens", "for", "the", "locale", "." ]
python
test
30.315789
MSchnei/pyprf_feature
pyprf_feature/analysis/old/pRF_mdlCrt.py
https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/old/pRF_mdlCrt.py#L138-L175
def crtGauss2D(varSizeX, varSizeY, varPosX, varPosY, varSd): """Create 2D Gaussian kernel. Parameters ---------- varSizeX : int, positive Width of the visual field. varSizeY : int, positive Height of the visual field.. varPosX : int, positive X position of centre of 2D G...
[ "def", "crtGauss2D", "(", "varSizeX", ",", "varSizeY", ",", "varPosX", ",", "varPosY", ",", "varSd", ")", ":", "varSizeX", "=", "int", "(", "varSizeX", ")", "varSizeY", "=", "int", "(", "varSizeY", ")", "# aryX and aryY are in reversed order, this seems to be nece...
Create 2D Gaussian kernel. Parameters ---------- varSizeX : int, positive Width of the visual field. varSizeY : int, positive Height of the visual field.. varPosX : int, positive X position of centre of 2D Gauss. varPosY : int, positive Y position of centre of 2D...
[ "Create", "2D", "Gaussian", "kernel", "." ]
python
train
27.526316
apache/spark
python/pyspark/sql/dataframe.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/dataframe.py#L1941-L1962
def freqItems(self, cols, support=None): """ Finding frequent items for columns, possibly with false positives. Using the frequent element count algorithm described in "https://doi.org/10.1145/762471.762473, proposed by Karp, Schenker, and Papadimitriou". :func:`DataFrame.freqIte...
[ "def", "freqItems", "(", "self", ",", "cols", ",", "support", "=", "None", ")", ":", "if", "isinstance", "(", "cols", ",", "tuple", ")", ":", "cols", "=", "list", "(", "cols", ")", "if", "not", "isinstance", "(", "cols", ",", "list", ")", ":", "r...
Finding frequent items for columns, possibly with false positives. Using the frequent element count algorithm described in "https://doi.org/10.1145/762471.762473, proposed by Karp, Schenker, and Papadimitriou". :func:`DataFrame.freqItems` and :func:`DataFrameStatFunctions.freqItems` are aliases....
[ "Finding", "frequent", "items", "for", "columns", "possibly", "with", "false", "positives", ".", "Using", "the", "frequent", "element", "count", "algorithm", "described", "in", "https", ":", "//", "doi", ".", "org", "/", "10", ".", "1145", "/", "762471", "...
python
train
53.045455
sibirrer/lenstronomy
lenstronomy/LensModel/Profiles/cnfw.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L247-L274
def cnfwAlpha(self, R, Rs, rho0, r_core, ax_x, ax_y): """ deflection angel of NFW profile along the projection to coordinate axis :param R: radius of interest :type R: float/numpy array :param Rs: scale radius :type Rs: float :param rho0: density normalization (c...
[ "def", "cnfwAlpha", "(", "self", ",", "R", ",", "Rs", ",", "rho0", ",", "r_core", ",", "ax_x", ",", "ax_y", ")", ":", "if", "isinstance", "(", "R", ",", "int", ")", "or", "isinstance", "(", "R", ",", "float", ")", ":", "R", "=", "max", "(", "...
deflection angel of NFW profile along the projection to coordinate axis :param R: radius of interest :type R: float/numpy array :param Rs: scale radius :type Rs: float :param rho0: density normalization (characteristic density) :type rho0: float :param r200: radi...
[ "deflection", "angel", "of", "NFW", "profile", "along", "the", "projection", "to", "coordinate", "axis" ]
python
train
31.25
pszafer/epson_projector
epson_projector/main.py
https://github.com/pszafer/epson_projector/blob/b8a10ace56e0a5cf858546041819c0e7ebca208f/epson_projector/main.py#L89-L104
async def get_property(self, command): """Get property state from device.""" _LOGGER.debug("Getting property %s", command) if self.__checkLock(): return BUSY timeout = self.__get_timeout(command) response = await self.send_request( timeout=timeout, ...
[ "async", "def", "get_property", "(", "self", ",", "command", ")", ":", "_LOGGER", ".", "debug", "(", "\"Getting property %s\"", ",", "command", ")", "if", "self", ".", "__checkLock", "(", ")", ":", "return", "BUSY", "timeout", "=", "self", ".", "__get_time...
Get property state from device.
[ "Get", "property", "state", "from", "device", "." ]
python
train
34.3125
tariqdaouda/rabaDB
rabaDB/filters.py
https://github.com/tariqdaouda/rabaDB/blob/42e0d6ee65149ae4f1e4c380cc695a9e7d2d1bbc/rabaDB/filters.py#L51-L69
def reset(self, rabaClass, namespace = None) : """rabaClass can either be a raba class of a string of a raba class name. In the latter case you must provide the namespace argument. If it's a Raba Class the argument is ignored. If you fear cicular imports use strings""" if type(rabaClass) is types.StringType : ...
[ "def", "reset", "(", "self", ",", "rabaClass", ",", "namespace", "=", "None", ")", ":", "if", "type", "(", "rabaClass", ")", "is", "types", ".", "StringType", ":", "self", ".", "_raba_namespace", "=", "namespace", "self", ".", "con", "=", "stp", ".", ...
rabaClass can either be a raba class of a string of a raba class name. In the latter case you must provide the namespace argument. If it's a Raba Class the argument is ignored. If you fear cicular imports use strings
[ "rabaClass", "can", "either", "be", "a", "raba", "class", "of", "a", "string", "of", "a", "raba", "class", "name", ".", "In", "the", "latter", "case", "you", "must", "provide", "the", "namespace", "argument", ".", "If", "it", "s", "a", "Raba", "Class",...
python
train
47.368421
bokeh/bokeh
scripts/issues.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/scripts/issues.py#L123-L127
def relevent_issue(issue, after): """Returns True iff this issue is something we should show in the changelog.""" return (closed_issue(issue, after) and issue_completed(issue) and issue_section(issue))
[ "def", "relevent_issue", "(", "issue", ",", "after", ")", ":", "return", "(", "closed_issue", "(", "issue", ",", "after", ")", "and", "issue_completed", "(", "issue", ")", "and", "issue_section", "(", "issue", ")", ")" ]
Returns True iff this issue is something we should show in the changelog.
[ "Returns", "True", "iff", "this", "issue", "is", "something", "we", "should", "show", "in", "the", "changelog", "." ]
python
train
45.8
SITools2/pySitools2_1.0
sitools2/core/pySitools2.py
https://github.com/SITools2/pySitools2_1.0/blob/acd13198162456ba401a0b923af989bb29feb3b6/sitools2/core/pySitools2.py#L96-L112
def __parseResponseServer(self): """Parses the response of the server. Exception --------- A Sitools2Exception is raised when the server does not send back a success.""" self.__logger.debug(Sitools2Abstract.getBaseUrl(self) + SITools2Instance.PROJECTS_URI) ...
[ "def", "__parseResponseServer", "(", "self", ")", ":", "self", ".", "__logger", ".", "debug", "(", "Sitools2Abstract", ".", "getBaseUrl", "(", "self", ")", "+", "SITools2Instance", ".", "PROJECTS_URI", ")", "result", "=", "Util", ".", "retrieveJsonResponseFromSe...
Parses the response of the server. Exception --------- A Sitools2Exception is raised when the server does not send back a success.
[ "Parses", "the", "response", "of", "the", "server", ".", "Exception", "---------", "A", "Sitools2Exception", "is", "raised", "when", "the", "server", "does", "not", "send", "back", "a", "success", "." ]
python
train
48.705882
jepegit/cellpy
cellpy/readers/instruments/custom.py
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/readers/instruments/custom.py#L344-L356
def load(self, file_name): """Load a raw data-file Args: file_name (path) Returns: loaded test """ new_rundata = self.loader(file_name) new_rundata = self.inspect(new_rundata) return new_rundata
[ "def", "load", "(", "self", ",", "file_name", ")", ":", "new_rundata", "=", "self", ".", "loader", "(", "file_name", ")", "new_rundata", "=", "self", ".", "inspect", "(", "new_rundata", ")", "return", "new_rundata" ]
Load a raw data-file Args: file_name (path) Returns: loaded test
[ "Load", "a", "raw", "data", "-", "file" ]
python
train
20.384615
all-umass/graphs
graphs/reorder.py
https://github.com/all-umass/graphs/blob/4fbeb025dfe33340335f34300f58dd3809228822/graphs/reorder.py#L24-L30
def permute_graph(G, order): '''Reorder the graph's vertices, returning a copy of the input graph. order : integer array-like, some permutation of range(G.num_vertices()). ''' adj = G.matrix('dense') adj = adj[np.ix_(order, order)] return Graph.from_adj_matrix(adj)
[ "def", "permute_graph", "(", "G", ",", "order", ")", ":", "adj", "=", "G", ".", "matrix", "(", "'dense'", ")", "adj", "=", "adj", "[", "np", ".", "ix_", "(", "order", ",", "order", ")", "]", "return", "Graph", ".", "from_adj_matrix", "(", "adj", ...
Reorder the graph's vertices, returning a copy of the input graph. order : integer array-like, some permutation of range(G.num_vertices()).
[ "Reorder", "the", "graph", "s", "vertices", "returning", "a", "copy", "of", "the", "input", "graph", ".", "order", ":", "integer", "array", "-", "like", "some", "permutation", "of", "range", "(", "G", ".", "num_vertices", "()", ")", "." ]
python
train
38.714286
dw/mitogen
mitogen/ssh.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/ssh.py#L189-L200
def _init_create_child(self): """ Initialize the base class :attr:`create_child` and :attr:`create_child_args` according to whether we need a PTY or not. """ if self._requires_pty(): self.create_child = mitogen.parent.hybrid_tty_create_child else: ...
[ "def", "_init_create_child", "(", "self", ")", ":", "if", "self", ".", "_requires_pty", "(", ")", ":", "self", ".", "create_child", "=", "mitogen", ".", "parent", ".", "hybrid_tty_create_child", "else", ":", "self", ".", "create_child", "=", "mitogen", ".", ...
Initialize the base class :attr:`create_child` and :attr:`create_child_args` according to whether we need a PTY or not.
[ "Initialize", "the", "base", "class", ":", "attr", ":", "create_child", "and", ":", "attr", ":", "create_child_args", "according", "to", "whether", "we", "need", "a", "PTY", "or", "not", "." ]
python
train
37.166667
sibirrer/lenstronomy
lenstronomy/LensModel/Profiles/spp.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spp.py#L123-L132
def mass_3d(self, r, rho0, gamma): """ mass enclosed a 3d sphere or radius r :param r: :param a: :param s: :return: """ mass_3d = 4 * np.pi * rho0 /(-gamma + 3) * r ** (-gamma + 3) return mass_3d
[ "def", "mass_3d", "(", "self", ",", "r", ",", "rho0", ",", "gamma", ")", ":", "mass_3d", "=", "4", "*", "np", ".", "pi", "*", "rho0", "/", "(", "-", "gamma", "+", "3", ")", "*", "r", "**", "(", "-", "gamma", "+", "3", ")", "return", "mass_3...
mass enclosed a 3d sphere or radius r :param r: :param a: :param s: :return:
[ "mass", "enclosed", "a", "3d", "sphere", "or", "radius", "r", ":", "param", "r", ":", ":", "param", "a", ":", ":", "param", "s", ":", ":", "return", ":" ]
python
train
25.8
openstack/networking-cisco
networking_cisco/neutronclient/hostingdevicescheduler.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/neutronclient/hostingdevicescheduler.py#L109-L114
def disassociate_hosting_device_with_config_agent( self, client, config_agent_id, hosting_device_id): """Disassociates a hosting_device with a config agent.""" return client.delete((ConfigAgentHandlingHostingDevice.resource_path + CFG_AGENT_HOSTING_DEVICES + "/%...
[ "def", "disassociate_hosting_device_with_config_agent", "(", "self", ",", "client", ",", "config_agent_id", ",", "hosting_device_id", ")", ":", "return", "client", ".", "delete", "(", "(", "ConfigAgentHandlingHostingDevice", ".", "resource_path", "+", "CFG_AGENT_HOSTING_D...
Disassociates a hosting_device with a config agent.
[ "Disassociates", "a", "hosting_device", "with", "a", "config", "agent", "." ]
python
train
61.833333
airspeed-velocity/asv
asv/feed.py
https://github.com/airspeed-velocity/asv/blob/d23bb8b74e8adacbfa3cf5724bda55fb39d56ba6/asv/feed.py#L172-L198
def _etree_py26_write(f, tree): """ Compatibility workaround for ElementTree shipped with py2.6 """ f.write("<?xml version='1.0' encoding='utf-8'?>\n".encode('utf-8')) if etree.VERSION[:3] == '1.2': def fixtag(tag, namespaces): if tag == XML_NS + 'lang': return '...
[ "def", "_etree_py26_write", "(", "f", ",", "tree", ")", ":", "f", ".", "write", "(", "\"<?xml version='1.0' encoding='utf-8'?>\\n\"", ".", "encode", "(", "'utf-8'", ")", ")", "if", "etree", ".", "VERSION", "[", ":", "3", "]", "==", "'1.2'", ":", "def", "...
Compatibility workaround for ElementTree shipped with py2.6
[ "Compatibility", "workaround", "for", "ElementTree", "shipped", "with", "py2", ".", "6" ]
python
train
30.592593
michaelhelmick/lassie
lassie/core.py
https://github.com/michaelhelmick/lassie/blob/b929f78d7e545cff5fb42eb5edfcaf396456f1ee/lassie/core.py#L97-L223
def fetch(self, url, open_graph=None, twitter_card=None, touch_icon=None, favicon=None, all_images=None, parser=None, handle_file_content=None, canonical=None): """Retrieves content from the specified url, parses it, and returns a beautifully crafted dictionary of important i...
[ "def", "fetch", "(", "self", ",", "url", ",", "open_graph", "=", "None", ",", "twitter_card", "=", "None", ",", "touch_icon", "=", "None", ",", "favicon", "=", "None", ",", "all_images", "=", "None", ",", "parser", "=", "None", ",", "handle_file_content"...
Retrieves content from the specified url, parses it, and returns a beautifully crafted dictionary of important information about that web page. Priority tree is as follows: 1. OEmbed 2. Open Graph 3. Twitter Card 4. Other meta content (i.e. descri...
[ "Retrieves", "content", "from", "the", "specified", "url", "parses", "it", "and", "returns", "a", "beautifully", "crafted", "dictionary", "of", "important", "information", "about", "that", "web", "page", "." ]
python
train
42.76378
bitesofcode/projexui
projexui/widgets/xpopupwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xpopupwidget.py#L914-L923
def reject(self): """ Emits the accepted signal and closes the popup. """ self._result = 0 if not self.signalsBlocked(): self.rejected.emit() if self.autoCloseOnReject(): self.close()
[ "def", "reject", "(", "self", ")", ":", "self", ".", "_result", "=", "0", "if", "not", "self", ".", "signalsBlocked", "(", ")", ":", "self", ".", "rejected", ".", "emit", "(", ")", "if", "self", ".", "autoCloseOnReject", "(", ")", ":", "self", ".",...
Emits the accepted signal and closes the popup.
[ "Emits", "the", "accepted", "signal", "and", "closes", "the", "popup", "." ]
python
train
26.4
Iotic-Labs/py-IoticAgent
src/IoticAgent/IOT/RemotePoint.py
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/RemotePoint.py#L112-L123
def get_recent_async(self, count, callback): """Similar to `get_recent` except instead of returning an iterable, passes each dict to the given function which must accept a single argument. Returns the request. `callback` (mandatory) (function) instead of returning an iterable, pass each dict (a...
[ "def", "get_recent_async", "(", "self", ",", "count", ",", "callback", ")", ":", "validate_nonnegative_int", "(", "count", ",", "'count'", ")", "Validation", ".", "callable_check", "(", "callback", ",", "allow_none", "=", "True", ")", "evt", "=", "self", "."...
Similar to `get_recent` except instead of returning an iterable, passes each dict to the given function which must accept a single argument. Returns the request. `callback` (mandatory) (function) instead of returning an iterable, pass each dict (as described above) to the given function which m...
[ "Similar", "to", "get_recent", "except", "instead", "of", "returning", "an", "iterable", "passes", "each", "dict", "to", "the", "given", "function", "which", "must", "accept", "a", "single", "argument", ".", "Returns", "the", "request", "." ]
python
train
56.916667
angr/angr
angr/procedures/stubs/format_parser.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/procedures/stubs/format_parser.py#L528-L536
def _sim_strlen(self, str_addr): """ Return the result of invoking the strlen simprocedure on `str_addr`. """ from .. import SIM_PROCEDURES strlen = SIM_PROCEDURES['libc']['strlen'] return self.inline_call(strlen, str_addr).ret_expr
[ "def", "_sim_strlen", "(", "self", ",", "str_addr", ")", ":", "from", ".", ".", "import", "SIM_PROCEDURES", "strlen", "=", "SIM_PROCEDURES", "[", "'libc'", "]", "[", "'strlen'", "]", "return", "self", ".", "inline_call", "(", "strlen", ",", "str_addr", ")"...
Return the result of invoking the strlen simprocedure on `str_addr`.
[ "Return", "the", "result", "of", "invoking", "the", "strlen", "simprocedure", "on", "str_addr", "." ]
python
train
30.444444
hollenstein/maspy
maspy/xml.py
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L104-L126
def recRemoveTreeFormating(element): """Removes whitespace characters, which are leftovers from previous xml formatting. :param element: an instance of lxml.etree._Element str.strip() is applied to the "text" and the "tail" attribute of the element and recursively to all child elements. """ ...
[ "def", "recRemoveTreeFormating", "(", "element", ")", ":", "children", "=", "element", ".", "getchildren", "(", ")", "if", "len", "(", "children", ")", ">", "0", ":", "for", "child", "in", "children", ":", "recRemoveTreeFormating", "(", "child", ")", "if",...
Removes whitespace characters, which are leftovers from previous xml formatting. :param element: an instance of lxml.etree._Element str.strip() is applied to the "text" and the "tail" attribute of the element and recursively to all child elements.
[ "Removes", "whitespace", "characters", "which", "are", "leftovers", "from", "previous", "xml", "formatting", "." ]
python
train
33.521739
vinci1it2000/schedula
schedula/dispatcher.py
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L726-L903
def add_dispatcher(self, dsp, inputs, outputs, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, **kwargs): """ Add a single sub-dispatcher node to dispatcher. ...
[ "def", "add_dispatcher", "(", "self", ",", "dsp", ",", "inputs", ",", "outputs", ",", "dsp_id", "=", "None", ",", "input_domain", "=", "None", ",", "weight", "=", "None", ",", "inp_weight", "=", "None", ",", "description", "=", "None", ",", "include_defa...
Add a single sub-dispatcher node to dispatcher. :param dsp: Child dispatcher that is added as sub-dispatcher node to the parent dispatcher. :type dsp: Dispatcher | dict[str, list] :param inputs: Inputs mapping. Data node ids from parent dispatcher to child ...
[ "Add", "a", "single", "sub", "-", "dispatcher", "node", "to", "dispatcher", "." ]
python
train
36.044944
tylertreat/BigQuery-Python
bigquery/client.py
https://github.com/tylertreat/BigQuery-Python/blob/88d99de42d954d49fc281460068f0e95003da098/bigquery/client.py#L574-L599
def get_table(self, dataset, table, project_id=None): """ Retrieve a table if it exists, otherwise return an empty dict. Parameters ---------- dataset : str The dataset that the table is in table : str The name of the table project_id: str, option...
[ "def", "get_table", "(", "self", ",", "dataset", ",", "table", ",", "project_id", "=", "None", ")", ":", "project_id", "=", "self", ".", "_get_project_id", "(", "project_id", ")", "try", ":", "table", "=", "self", ".", "bigquery", ".", "tables", "(", "...
Retrieve a table if it exists, otherwise return an empty dict. Parameters ---------- dataset : str The dataset that the table is in table : str The name of the table project_id: str, optional The project that the table is in Returns ...
[ "Retrieve", "a", "table", "if", "it", "exists", "otherwise", "return", "an", "empty", "dict", "." ]
python
train
30.346154
Cymmetria/honeycomb
honeycomb/utils/config_utils.py
https://github.com/Cymmetria/honeycomb/blob/33ea91b5cf675000e4e85dd02efe580ea6e95c86/honeycomb/utils/config_utils.py#L49-L57
def validate_config_parameters(config_json, allowed_keys, allowed_types): """Validate parameters in config file.""" custom_fields = config_json.get(defs.PARAMETERS, []) for field in custom_fields: validate_field(field, allowed_keys, allowed_types) default = field.get(defs.DEFAULT) fi...
[ "def", "validate_config_parameters", "(", "config_json", ",", "allowed_keys", ",", "allowed_types", ")", ":", "custom_fields", "=", "config_json", ".", "get", "(", "defs", ".", "PARAMETERS", ",", "[", "]", ")", "for", "field", "in", "custom_fields", ":", "vali...
Validate parameters in config file.
[ "Validate", "parameters", "in", "config", "file", "." ]
python
train
49.222222
napalm-automation/napalm-junos
napalm_junos/junos.py
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1237-L1247
def get_ntp_servers(self): """Return the NTP servers configured on the device.""" ntp_table = junos_views.junos_ntp_servers_config_table(self.device) ntp_table.get() ntp_servers = ntp_table.items() if not ntp_servers: return {} return {napalm_base.helpers.i...
[ "def", "get_ntp_servers", "(", "self", ")", ":", "ntp_table", "=", "junos_views", ".", "junos_ntp_servers_config_table", "(", "self", ".", "device", ")", "ntp_table", ".", "get", "(", ")", "ntp_servers", "=", "ntp_table", ".", "items", "(", ")", "if", "not",...
Return the NTP servers configured on the device.
[ "Return", "the", "NTP", "servers", "configured", "on", "the", "device", "." ]
python
train
32.090909
RJT1990/pyflux
pyflux/garch/egarchmreg.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/garch/egarchmreg.py#L166-L223
def _mb_model(self, beta, mini_batch): """ Creates the structure of the model Parameters ---------- beta : np.array Contains untransformed starting values for latent variables Returns ---------- lambda : np.array Contains the values for t...
[ "def", "_mb_model", "(", "self", ",", "beta", ",", "mini_batch", ")", ":", "# Transform latent variables", "parm", "=", "np", ".", "array", "(", "[", "self", ".", "latent_variables", ".", "z_list", "[", "k", "]", ".", "prior", ".", "transform", "(", "bet...
Creates the structure of the model Parameters ---------- beta : np.array Contains untransformed starting values for latent variables Returns ---------- lambda : np.array Contains the values for the conditional volatility series Y : np.ar...
[ "Creates", "the", "structure", "of", "the", "model" ]
python
train
37.189655
PureStorage-OpenConnect/rest-client
purestorage/purestorage.py
https://github.com/PureStorage-OpenConnect/rest-client/blob/097d5f2bc6facf607d7e4a92567b09fb8cf5cb34/purestorage/purestorage.py#L3234-L3260
def list_certificates(self): """Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A l...
[ "def", "list_certificates", "(", "self", ")", ":", "# This call takes no parameters.", "if", "self", ".", "_rest_version", ">=", "LooseVersion", "(", "\"1.12\"", ")", ":", "return", "self", ".", "_request", "(", "\"GET\"", ",", "\"cert\"", ")", "else", ":", "#...
Get the attributes of the current array certificate. :param \*\*kwargs: See the REST API Guide on your array for the documentation on the request: **GET cert** :type \*\*kwargs: optional :returns: A list of dictionaries describing all confi...
[ "Get", "the", "attributes", "of", "the", "current", "array", "certificate", "." ]
python
train
33.888889
geoneric/starling
starling/pika/decorator.py
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/pika/decorator.py#L99-L134
def consume_message_with_notify( notifier_uri_getter): """ Decorator for methods handling requests from RabbitMQ This decorator builds on the :py:func:`consume_message` decorator. It extents it by logic for notifying a client of the result of handling the request. The *notifier_uri_get...
[ "def", "consume_message_with_notify", "(", "notifier_uri_getter", ")", ":", "def", "consume_message_with_notify_decorator", "(", "method", ")", ":", "@", "consume_message", "def", "wrapper", "(", "self", ",", "data", ")", ":", "notifier_uri", "=", "notifier_uri_getter...
Decorator for methods handling requests from RabbitMQ This decorator builds on the :py:func:`consume_message` decorator. It extents it by logic for notifying a client of the result of handling the request. The *notifier_uri_getter* argument must be a callable which accepts *self* and returns the u...
[ "Decorator", "for", "methods", "handling", "requests", "from", "RabbitMQ" ]
python
valid
29.861111
KelSolaar/Foundations
foundations/parsers.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/parsers.py#L591-L601
def preserve_order(self, value): """ Setter method for **self.__preserve_order** attribute. :param value: Attribute value. :type value: bool """ if value is not None: assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("preserve_o...
[ "def", "preserve_order", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "type", "(", "value", ")", "is", "bool", ",", "\"'{0}' attribute: '{1}' type is not 'bool'!\"", ".", "format", "(", "\"preserve_order\"", ",", "val...
Setter method for **self.__preserve_order** attribute. :param value: Attribute value. :type value: bool
[ "Setter", "method", "for", "**", "self", ".", "__preserve_order", "**", "attribute", "." ]
python
train
32.818182
aljosa/django-tinymce
tinymce/views.py
https://github.com/aljosa/django-tinymce/blob/a509fdbc6c623ddac6552199da89712c0f026c91/tinymce/views.py#L33-L69
def spell_check(request): """ Returns a HttpResponse that implements the TinyMCE spellchecker protocol. """ try: if not enchant: raise RuntimeError("install pyenchant for spellchecker functionality") raw = force_text(request.body) input = json.loads(raw) id =...
[ "def", "spell_check", "(", "request", ")", ":", "try", ":", "if", "not", "enchant", ":", "raise", "RuntimeError", "(", "\"install pyenchant for spellchecker functionality\"", ")", "raw", "=", "force_text", "(", "request", ".", "body", ")", "input", "=", "json", ...
Returns a HttpResponse that implements the TinyMCE spellchecker protocol.
[ "Returns", "a", "HttpResponse", "that", "implements", "the", "TinyMCE", "spellchecker", "protocol", "." ]
python
train
33.243243
galactics/beyond
beyond/frames/iau1980.py
https://github.com/galactics/beyond/blob/7a7590ff0fd4c0bac3e8e383ecca03caa98e5742/beyond/frames/iau1980.py#L158-L174
def equinox(date, eop_correction=True, terms=106, kinematic=True): """Equinox equation in degrees """ epsilon_bar, delta_psi, delta_eps = _nutation(date, eop_correction, terms) equin = delta_psi * 3600. * np.cos(np.deg2rad(epsilon_bar)) if date.d >= 50506 and kinematic: # Starting 1992-02-...
[ "def", "equinox", "(", "date", ",", "eop_correction", "=", "True", ",", "terms", "=", "106", ",", "kinematic", "=", "True", ")", ":", "epsilon_bar", ",", "delta_psi", ",", "delta_eps", "=", "_nutation", "(", "date", ",", "eop_correction", ",", "terms", "...
Equinox equation in degrees
[ "Equinox", "equation", "in", "degrees" ]
python
train
40.058824
brocade/pynos
pynos/versions/base/interface.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/interface.py#L471-L560
def get_ip_addresses(self, **kwargs): """ Get IP Addresses already set on an Interface. Args: int_type (str): Type of interface. (gigabitethernet, tengigabitethernet etc). name (str): Name of interface id. (For interface: 1/0/5, 1/0/10 e...
[ "def", "get_ip_addresses", "(", "self", ",", "*", "*", "kwargs", ")", ":", "int_type", "=", "str", "(", "kwargs", ".", "pop", "(", "'int_type'", ")", ".", "lower", "(", ")", ")", "name", "=", "str", "(", "kwargs", ".", "pop", "(", "'name'", ")", ...
Get IP Addresses already set on an Interface. Args: int_type (str): Type of interface. (gigabitethernet, tengigabitethernet etc). name (str): Name of interface id. (For interface: 1/0/5, 1/0/10 etc). version (int): 4 or 6 to represent IPv4 o...
[ "Get", "IP", "Addresses", "already", "set", "on", "an", "Interface", "." ]
python
train
44.577778
obulpathi/cdn-fastly-python
fastly/__init__.py
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L1005-L1008
def get_wordpress(self, service_id, version_number, name): """Get information on a specific wordpress.""" content = self._fetch("/service/%s/version/%d/wordpress/%s" % (service_id, version_number, name)) return FastlyWordpress(self, content)
[ "def", "get_wordpress", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/wordpress/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "...
Get information on a specific wordpress.
[ "Get", "information", "on", "a", "specific", "wordpress", "." ]
python
train
61
thefactory/marathon-python
marathon/client.py
https://github.com/thefactory/marathon-python/blob/592b253aa8edf2475c97ca438ad7b6936652caf2/marathon/client.py#L666-L676
def delete_event_subscription(self, url): """Deregister a callback URL as an event subscriber. :param str url: callback URL :returns: the deleted event subscription :rtype: dict """ params = {'callbackUrl': url} response = self._do_request('DELETE', '/v2/eventSu...
[ "def", "delete_event_subscription", "(", "self", ",", "url", ")", ":", "params", "=", "{", "'callbackUrl'", ":", "url", "}", "response", "=", "self", ".", "_do_request", "(", "'DELETE'", ",", "'/v2/eventSubscriptions'", ",", "params", ")", "return", "response"...
Deregister a callback URL as an event subscriber. :param str url: callback URL :returns: the deleted event subscription :rtype: dict
[ "Deregister", "a", "callback", "URL", "as", "an", "event", "subscriber", "." ]
python
train
32.909091
mrstephenneal/mysql-toolkit
mysql/toolkit/components/structure/__init__.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/structure/__init__.py#L16-L20
def count_rows(self, table, cols='*'): """Get the number of rows in a particular table.""" query = 'SELECT COUNT({0}) FROM {1}'.format(join_cols(cols), wrap(table)) result = self.fetch(query) return result if result is not None else 0
[ "def", "count_rows", "(", "self", ",", "table", ",", "cols", "=", "'*'", ")", ":", "query", "=", "'SELECT COUNT({0}) FROM {1}'", ".", "format", "(", "join_cols", "(", "cols", ")", ",", "wrap", "(", "table", ")", ")", "result", "=", "self", ".", "fetch"...
Get the number of rows in a particular table.
[ "Get", "the", "number", "of", "rows", "in", "a", "particular", "table", "." ]
python
train
52.4
NoviceLive/intellicoder
intellicoder/synthesizers.py
https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/synthesizers.py#L213-L229
def c_var_decls(self): """Get the needed variable definitions.""" if self.opts.no_structs: mod_decl = 'HMODULE {} = NULL;\n'.format(self.name) return [mod_decl] + [ '{} *{} = NULL;\n'.format( self._c_type_name(name), name ) ...
[ "def", "c_var_decls", "(", "self", ")", ":", "if", "self", ".", "opts", ".", "no_structs", ":", "mod_decl", "=", "'HMODULE {} = NULL;\\n'", ".", "format", "(", "self", ".", "name", ")", "return", "[", "mod_decl", "]", "+", "[", "'{} *{} = NULL;\\n'", ".", ...
Get the needed variable definitions.
[ "Get", "the", "needed", "variable", "definitions", "." ]
python
train
32.411765
josiahcarlson/rom
rom/query.py
https://github.com/josiahcarlson/rom/blob/8b5607a856341df85df33422accc30ba9294dbdb/rom/query.py#L329-L362
def like(self, **kwargs): ''' When provided with keyword arguments of the form ``col=pattern``, this will limit the entities returned to those that include the provided pattern. Note that 'like' queries require that the ``prefix=True`` option must have been provided as part of th...
[ "def", "like", "(", "self", ",", "*", "*", "kwargs", ")", ":", "new", "=", "[", "]", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "v", "=", "self", ".", "_check", "(", "k", ",", "v", ",", "'like'", ")", "new", ".", "...
When provided with keyword arguments of the form ``col=pattern``, this will limit the entities returned to those that include the provided pattern. Note that 'like' queries require that the ``prefix=True`` option must have been provided as part of the column definition. Patterns allow f...
[ "When", "provided", "with", "keyword", "arguments", "of", "the", "form", "col", "=", "pattern", "this", "will", "limit", "the", "entities", "returned", "to", "those", "that", "include", "the", "provided", "pattern", ".", "Note", "that", "like", "queries", "r...
python
test
45.058824
hozn/stravalib
stravalib/attributes.py
https://github.com/hozn/stravalib/blob/5500ebc39e0bf4706bb1ca4c27b25e56becaaa5f/stravalib/attributes.py#L256-L274
def marshal(self, v): """ Turn this value into API format. Do a reverse dictionary lookup on choices to find the original value. If there are no keys or too many keys for now we raise a NotImplementedError as marshal is not used anywhere currently. In the future we will want to ...
[ "def", "marshal", "(", "self", ",", "v", ")", ":", "if", "v", ":", "orig", "=", "[", "i", "for", "i", "in", "self", ".", "choices", "if", "self", ".", "choices", "[", "i", "]", "==", "v", "]", "if", "len", "(", "orig", ")", "==", "1", ":", ...
Turn this value into API format. Do a reverse dictionary lookup on choices to find the original value. If there are no keys or too many keys for now we raise a NotImplementedError as marshal is not used anywhere currently. In the future we will want to fail gracefully.
[ "Turn", "this", "value", "into", "API", "format", "." ]
python
train
46.421053
saltstack/salt
salt/beacons/logs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/logs.py#L70-L157
def beacon(config): ''' Read the log file and return match whole string .. code-block:: yaml beacons: log: - file: <path> - tags: <tag>: regex: <pattern> .. note:: regex matching is based on the `re`_ modul...
[ "def", "beacon", "(", "config", ")", ":", "_config", "=", "{", "}", "list", "(", "map", "(", "_config", ".", "update", ",", "config", ")", ")", "ret", "=", "[", "]", "if", "'file'", "not", "in", "_config", ":", "event", "=", "SKEL", ".", "copy", ...
Read the log file and return match whole string .. code-block:: yaml beacons: log: - file: <path> - tags: <tag>: regex: <pattern> .. note:: regex matching is based on the `re`_ module .. _re: https://docs.pyth...
[ "Read", "the", "log", "file", "and", "return", "match", "whole", "string" ]
python
train
27.659091
Azure/azure-sdk-for-python
azure-mgmt-resource/azure/mgmt/resource/policy/policy_client.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-resource/azure/mgmt/resource/policy/policy_client.py#L127-L152
def policy_assignments(self): """Instance depends on the API version: * 2015-10-01-preview: :class:`PolicyAssignmentsOperations<azure.mgmt.resource.policy.v2015_10_01_preview.operations.PolicyAssignmentsOperations>` * 2016-04-01: :class:`PolicyAssignmentsOperations<azure.mgmt.resource.pol...
[ "def", "policy_assignments", "(", "self", ")", ":", "api_version", "=", "self", ".", "_get_api_version", "(", "'policy_assignments'", ")", "if", "api_version", "==", "'2015-10-01-preview'", ":", "from", ".", "v2015_10_01_preview", ".", "operations", "import", "Polic...
Instance depends on the API version: * 2015-10-01-preview: :class:`PolicyAssignmentsOperations<azure.mgmt.resource.policy.v2015_10_01_preview.operations.PolicyAssignmentsOperations>` * 2016-04-01: :class:`PolicyAssignmentsOperations<azure.mgmt.resource.policy.v2016_04_01.operations.PolicyAssignme...
[ "Instance", "depends", "on", "the", "API", "version", ":" ]
python
test
81.076923
IdentityPython/oidcendpoint
src/oidcendpoint/token_handler.py
https://github.com/IdentityPython/oidcendpoint/blob/6c1d729d51bfb6332816117fe476073df7a1d823/src/oidcendpoint/token_handler.py#L170-L184
def info(self, token): """ Return token information. :param token: A token :return: dictionary with info about the token """ _res = dict(zip(['_id', 'type', 'sid', 'exp'], self.split_token(token))) if _res['type'] != self.type: ...
[ "def", "info", "(", "self", ",", "token", ")", ":", "_res", "=", "dict", "(", "zip", "(", "[", "'_id'", ",", "'type'", ",", "'sid'", ",", "'exp'", "]", ",", "self", ".", "split_token", "(", "token", ")", ")", ")", "if", "_res", "[", "'type'", "...
Return token information. :param token: A token :return: dictionary with info about the token
[ "Return", "token", "information", "." ]
python
train
31.8
AmesCornish/buttersink
buttersink/S3Store.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/S3Store.py#L195-L203
def receiveVolumeInfo(self, paths): """ Return Context Manager for a file-like (stream) object to store volume info. """ path = self.selectReceivePath(paths) path = path + Store.theInfoExtension if self._skipDryRun(logger)("receive info in '%s'", path): return None ...
[ "def", "receiveVolumeInfo", "(", "self", ",", "paths", ")", ":", "path", "=", "self", ".", "selectReceivePath", "(", "paths", ")", "path", "=", "path", "+", "Store", ".", "theInfoExtension", "if", "self", ".", "_skipDryRun", "(", "logger", ")", "(", "\"r...
Return Context Manager for a file-like (stream) object to store volume info.
[ "Return", "Context", "Manager", "for", "a", "file", "-", "like", "(", "stream", ")", "object", "to", "store", "volume", "info", "." ]
python
train
41.888889
mbj4668/pyang
pyang/plugins/jsonxsl.py
https://github.com/mbj4668/pyang/blob/f2a5cc3142162e5b9ee4e18d154568d939ff63dd/pyang/plugins/jsonxsl.py#L250-L259
def xsl_withparam(self, name, value, parent): """Construct an XSLT 'with-param' element. `parent` is this element's parent. `name` is the parameter name. `value` is the parameter value. """ res = ET.SubElement(parent, "with-param", name=name) res.text = value ...
[ "def", "xsl_withparam", "(", "self", ",", "name", ",", "value", ",", "parent", ")", ":", "res", "=", "ET", ".", "SubElement", "(", "parent", ",", "\"with-param\"", ",", "name", "=", "name", ")", "res", ".", "text", "=", "value", "return", "res" ]
Construct an XSLT 'with-param' element. `parent` is this element's parent. `name` is the parameter name. `value` is the parameter value.
[ "Construct", "an", "XSLT", "with", "-", "param", "element", "." ]
python
train
32.6
berkeley-cocosci/Wallace
wallace/custom.py
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/custom.py#L197-L206
def launch(): """Launch the experiment.""" exp = experiment(db.init_db(drop_all=False)) exp.log("Launching experiment...", "-----") init_db() exp.recruiter().open_recruitment(n=exp.initial_recruitment_size) session_psiturk.commit() session.commit() return success_response(request_type="...
[ "def", "launch", "(", ")", ":", "exp", "=", "experiment", "(", "db", ".", "init_db", "(", "drop_all", "=", "False", ")", ")", "exp", ".", "log", "(", "\"Launching experiment...\"", ",", "\"-----\"", ")", "init_db", "(", ")", "exp", ".", "recruiter", "(...
Launch the experiment.
[ "Launch", "the", "experiment", "." ]
python
train
31.9
oxalorg/dystic
dystic/indexer.py
https://github.com/oxalorg/dystic/blob/6f5a449158ec12fc1c9cc25d85e2f8adc27885db/dystic/indexer.py#L17-L48
def index_dir(self, folder): """ Creates a nested dictionary that represents the folder structure of folder. Also extracts meta data from all markdown posts and adds to the dictionary. """ folder_path = folder print('Indexing folder: ' + folder_path) nested_dir = ...
[ "def", "index_dir", "(", "self", ",", "folder", ")", ":", "folder_path", "=", "folder", "print", "(", "'Indexing folder: '", "+", "folder_path", ")", "nested_dir", "=", "{", "}", "folder", "=", "folder_path", ".", "rstrip", "(", "os", ".", "sep", ")", "s...
Creates a nested dictionary that represents the folder structure of folder. Also extracts meta data from all markdown posts and adds to the dictionary.
[ "Creates", "a", "nested", "dictionary", "that", "represents", "the", "folder", "structure", "of", "folder", ".", "Also", "extracts", "meta", "data", "from", "all", "markdown", "posts", "and", "adds", "to", "the", "dictionary", "." ]
python
train
44.78125
edx/edx-django-utils
edx_django_utils/monitoring/utils.py
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/utils.py#L103-L113
def function_trace(function_name): """ Wraps a chunk of code that we want to appear as a separate, explicit, segment in our monitoring tools. """ if newrelic: nr_transaction = newrelic.agent.current_transaction() with newrelic.agent.FunctionTrace(nr_transaction, function_name): ...
[ "def", "function_trace", "(", "function_name", ")", ":", "if", "newrelic", ":", "nr_transaction", "=", "newrelic", ".", "agent", ".", "current_transaction", "(", ")", "with", "newrelic", ".", "agent", ".", "FunctionTrace", "(", "nr_transaction", ",", "function_n...
Wraps a chunk of code that we want to appear as a separate, explicit, segment in our monitoring tools.
[ "Wraps", "a", "chunk", "of", "code", "that", "we", "want", "to", "appear", "as", "a", "separate", "explicit", "segment", "in", "our", "monitoring", "tools", "." ]
python
train
31.454545
tanghaibao/goatools
goatools/rpt/write_hierarchy_base.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/write_hierarchy_base.py#L97-L102
def _init_item_marks(item_marks): """Initialize the makred item dict.""" if isinstance(item_marks, dict): return item_marks if item_marks: return {item_id:'>' for item_id in item_marks}
[ "def", "_init_item_marks", "(", "item_marks", ")", ":", "if", "isinstance", "(", "item_marks", ",", "dict", ")", ":", "return", "item_marks", "if", "item_marks", ":", "return", "{", "item_id", ":", "'>'", "for", "item_id", "in", "item_marks", "}" ]
Initialize the makred item dict.
[ "Initialize", "the", "makred", "item", "dict", "." ]
python
train
38
tensorflow/probability
tensorflow_probability/python/distributions/linear_gaussian_ssm.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/linear_gaussian_ssm.py#L454-L541
def backward_smoothing_pass(self, filtered_means, filtered_covs, predicted_means, predicted_covs): """Run the backward pass in Kalman smoother. The backward smoothing is using Rauch, Tung and...
[ "def", "backward_smoothing_pass", "(", "self", ",", "filtered_means", ",", "filtered_covs", ",", "predicted_means", ",", "predicted_covs", ")", ":", "with", "tf", ".", "name_scope", "(", "\"backward_pass\"", ")", ":", "filtered_means", "=", "tf", ".", "convert_to_...
Run the backward pass in Kalman smoother. The backward smoothing is using Rauch, Tung and Striebel smoother as as discussed in section 18.3.2 of Kevin P. Murphy, 2012, Machine Learning: A Probabilistic Perspective, The MIT Press. The inputs are returned by `forward_filter` function. Args: fi...
[ "Run", "the", "backward", "pass", "in", "Kalman", "smoother", "." ]
python
test
47.340909
StagPython/StagPy
stagpy/misc.py
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L15-L31
def out_name(stem, timestep=None): """Return StagPy out file name. Args: stem (str): short description of file content. timestep (int): timestep if relevant. Returns: str: the output file name. Other Parameters: conf.core.outname (str): the generic name stem, defaults ...
[ "def", "out_name", "(", "stem", ",", "timestep", "=", "None", ")", ":", "if", "timestep", "is", "not", "None", ":", "stem", "=", "(", "stem", "+", "INT_FMT", ")", ".", "format", "(", "timestep", ")", "return", "conf", ".", "core", ".", "outname", "...
Return StagPy out file name. Args: stem (str): short description of file content. timestep (int): timestep if relevant. Returns: str: the output file name. Other Parameters: conf.core.outname (str): the generic name stem, defaults to ``'stagpy'``.
[ "Return", "StagPy", "out", "file", "name", "." ]
python
train
27.058824
buildinspace/peru
peru/cache.py
https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/cache.py#L440-L512
async def modify_tree(self, tree, modifications): '''The modifications are a map of the form, {path: TreeEntry}. The tree can be None to indicate an empty starting tree. The entries can be either blobs or trees, or None to indicate a deletion. The return value is either the hash of the r...
[ "async", "def", "modify_tree", "(", "self", ",", "tree", ",", "modifications", ")", ":", "# Read the original contents of the base tree.", "if", "tree", "is", "None", ":", "entries", "=", "{", "}", "else", ":", "entries", "=", "await", "self", ".", "ls_tree", ...
The modifications are a map of the form, {path: TreeEntry}. The tree can be None to indicate an empty starting tree. The entries can be either blobs or trees, or None to indicate a deletion. The return value is either the hash of the resulting tree, or None if the resulting tree is empty...
[ "The", "modifications", "are", "a", "map", "of", "the", "form", "{", "path", ":", "TreeEntry", "}", ".", "The", "tree", "can", "be", "None", "to", "indicate", "an", "empty", "starting", "tree", ".", "The", "entries", "can", "be", "either", "blobs", "or...
python
train
47.876712
collectiveacuity/labPack
labpack/databases/couchbase.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L1038-L1081
def purge(self, doc_ids): ''' a method to remove docs from the collection :param doc_ids: string or list of strings with document ids to purge :return: list of strings of doc ids purged ''' # https://developer.couchbase.com/documentation/mobile...
[ "def", "purge", "(", "self", ",", "doc_ids", ")", ":", "# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/document/post__db___purge", "title", "=", "'%s.purge'", "%", "self", ".", "__class__", ".", "__name__", "# ingest ...
a method to remove docs from the collection :param doc_ids: string or list of strings with document ids to purge :return: list of strings of doc ids purged
[ "a", "method", "to", "remove", "docs", "from", "the", "collection", ":", "param", "doc_ids", ":", "string", "or", "list", "of", "strings", "with", "document", "ids", "to", "purge", ":", "return", ":", "list", "of", "strings", "of", "doc", "ids", "purged"...
python
train
31.409091
ynop/audiomate
audiomate/processing/pipeline/base.py
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/processing/pipeline/base.py#L113-L137
def update(self, data, offset, is_last, buffer_index=0): """ Update the buffer at the given index. Args: data (np.ndarray): The frames. offset (int): The index of the first frame in `data` within the sequence. is_last (bool): Whether this is the last block of...
[ "def", "update", "(", "self", ",", "data", ",", "offset", ",", "is_last", ",", "buffer_index", "=", "0", ")", ":", "if", "buffer_index", ">=", "self", ".", "num_buffers", ":", "raise", "ValueError", "(", "'Expected buffer index < {} but got index {}.'", ".", "...
Update the buffer at the given index. Args: data (np.ndarray): The frames. offset (int): The index of the first frame in `data` within the sequence. is_last (bool): Whether this is the last block of frames in the sequence. buffer_index (int): The index of the buf...
[ "Update", "the", "buffer", "at", "the", "given", "index", "." ]
python
train
48.64
rosenbrockc/acorn
acorn/analyze/sklearn.py
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L124-L143
def predict(fqdn, result, *argl, **argd): """Analyzes the result of a generic predict operation performed by `sklearn`. Args: fqdn (str): full-qualified name of the method that was called. result: result of calling the method with `fqdn`. argl (tuple): positional arguments passed to...
[ "def", "predict", "(", "fqdn", ",", "result", ",", "*", "argl", ",", "*", "*", "argd", ")", ":", "#Check the arguments to see what kind of data we are working with, then", "#choose the appropriate function below to return the analysis dictionary.", "out", "=", "None", "if", ...
Analyzes the result of a generic predict operation performed by `sklearn`. Args: fqdn (str): full-qualified name of the method that was called. result: result of calling the method with `fqdn`. argl (tuple): positional arguments passed to the method call. argd (dict): keyword ar...
[ "Analyzes", "the", "result", "of", "a", "generic", "predict", "operation", "performed", "by", "sklearn", "." ]
python
train
41.6
COLORFULBOARD/revision
revision/data.py
https://github.com/COLORFULBOARD/revision/blob/2f22e72cce5b60032a80c002ac45c2ecef0ed987/revision/data.py#L88-L110
def parse(self, rev_string): """ :param rev_string: :type rev_string: str """ elements = rev_string.split(MESSAGE_LINE_SEPARATOR) heading = elements[0] heading_elements = heading.split(" ") self.revision_id = heading_elements[2] datetime_str = "...
[ "def", "parse", "(", "self", ",", "rev_string", ")", ":", "elements", "=", "rev_string", ".", "split", "(", "MESSAGE_LINE_SEPARATOR", ")", "heading", "=", "elements", "[", "0", "]", "heading_elements", "=", "heading", ".", "split", "(", "\" \"", ")", "self...
:param rev_string: :type rev_string: str
[ ":", "param", "rev_string", ":", ":", "type", "rev_string", ":", "str" ]
python
train
25.304348
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L6044-L6049
def getBoneName(self, action, nBoneIndex, pchBoneName, unNameBufferSize): """Fills the given buffer with the name of the bone at the given index in the skeleton associated with the given action""" fn = self.function_table.getBoneName result = fn(action, nBoneIndex, pchBoneName, unNameBufferSize...
[ "def", "getBoneName", "(", "self", ",", "action", ",", "nBoneIndex", ",", "pchBoneName", ",", "unNameBufferSize", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getBoneName", "result", "=", "fn", "(", "action", ",", "nBoneIndex", ",", "pchBoneName...
Fills the given buffer with the name of the bone at the given index in the skeleton associated with the given action
[ "Fills", "the", "given", "buffer", "with", "the", "name", "of", "the", "bone", "at", "the", "given", "index", "in", "the", "skeleton", "associated", "with", "the", "given", "action" ]
python
train
56.333333
twisted/txaws
txaws/ec2/client.py
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/ec2/client.py#L414-L420
def delete_snapshot(self, snapshot_id): """Remove a previously created snapshot.""" query = self.query_factory( action="DeleteSnapshot", creds=self.creds, endpoint=self.endpoint, other_params={"SnapshotId": snapshot_id}) d = query.submit() return d.addCallback(sel...
[ "def", "delete_snapshot", "(", "self", ",", "snapshot_id", ")", ":", "query", "=", "self", ".", "query_factory", "(", "action", "=", "\"DeleteSnapshot\"", ",", "creds", "=", "self", ".", "creds", ",", "endpoint", "=", "self", ".", "endpoint", ",", "other_p...
Remove a previously created snapshot.
[ "Remove", "a", "previously", "created", "snapshot", "." ]
python
train
48
benfred/implicit
setup.py
https://github.com/benfred/implicit/blob/6b16c50d1d514a814f2e5b8cf2a829ff23dbba63/setup.py#L101-L116
def set_gcc(): """Try to use GCC on OSX for OpenMP support.""" # For macports and homebrew if 'darwin' in platform.platform().lower(): gcc = extract_gcc_binaries() if gcc is not None: os.environ["CC"] = gcc os.environ["CXX"] = gcc else: global u...
[ "def", "set_gcc", "(", ")", ":", "# For macports and homebrew", "if", "'darwin'", "in", "platform", ".", "platform", "(", ")", ".", "lower", "(", ")", ":", "gcc", "=", "extract_gcc_binaries", "(", ")", "if", "gcc", "is", "not", "None", ":", "os", ".", ...
Try to use GCC on OSX for OpenMP support.
[ "Try", "to", "use", "GCC", "on", "OSX", "for", "OpenMP", "support", "." ]
python
train
29.6875
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L228-L250
def getSubstitutionElement(self, elt, ps): '''if elt matches a member of the head substitutionGroup, return the GED typecode representation of the member. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap instance ''' nsu...
[ "def", "getSubstitutionElement", "(", "self", ",", "elt", ",", "ps", ")", ":", "nsuri", ",", "ncname", "=", "_get_element_nsuri_name", "(", "elt", ")", "typecode", "=", "GED", "(", "nsuri", ",", "ncname", ")", "if", "typecode", "is", "None", ":", "return...
if elt matches a member of the head substitutionGroup, return the GED typecode representation of the member. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap instance
[ "if", "elt", "matches", "a", "member", "of", "the", "head", "substitutionGroup", "return", "the", "GED", "typecode", "representation", "of", "the", "member", "." ]
python
train
31.217391
Nekmo/simple-monitor-alert
simple_monitor_alert/management.py
https://github.com/Nekmo/simple-monitor-alert/blob/11d6dbd3c0b3b9a210d6435208066f5636f1f44e/simple_monitor_alert/management.py#L36-L61
def set_default_subparser(self, name, args=None): """default subparser selection. Call after setup, just before parse_args() name: is the name of the subparser to call by default args: if set is the argument list handed to parse_args() , tested with 2.7, 3.2, 3.3, 3.4 it works with 2.6 assuming arg...
[ "def", "set_default_subparser", "(", "self", ",", "name", ",", "args", "=", "None", ")", ":", "subparser_found", "=", "False", "for", "arg", "in", "sys", ".", "argv", "[", "1", ":", "]", ":", "if", "arg", "in", "[", "'-h'", ",", "'--help'", "]", ":...
default subparser selection. Call after setup, just before parse_args() name: is the name of the subparser to call by default args: if set is the argument list handed to parse_args() , tested with 2.7, 3.2, 3.3, 3.4 it works with 2.6 assuming argparse is installed
[ "default", "subparser", "selection", ".", "Call", "after", "setup", "just", "before", "parse_args", "()", "name", ":", "is", "the", "name", "of", "the", "subparser", "to", "call", "by", "default", "args", ":", "if", "set", "is", "the", "argument", "list", ...
python
valid
39.5
Genida/django-meerkat
src/meerkat/logs/models.py
https://github.com/Genida/django-meerkat/blob/486502a75bb0800266db785fd32717d8c0eb8deb/src/meerkat/logs/models.py#L648-L662
def start_daemon(): """ Start a thread to continuously read log files and append lines in DB. Work in progress. Currently the thread doesn't append anything, it only print the information parsed from each line read. Returns: thread: the started thread. """ ...
[ "def", "start_daemon", "(", ")", ":", "if", "RequestLog", ".", "daemon", "is", "None", ":", "parser", "=", "get_nginx_parser", "(", ")", "RequestLog", ".", "daemon", "=", "RequestLog", ".", "ParseToDBThread", "(", "parser", ",", "daemon", "=", "True", ")",...
Start a thread to continuously read log files and append lines in DB. Work in progress. Currently the thread doesn't append anything, it only print the information parsed from each line read. Returns: thread: the started thread.
[ "Start", "a", "thread", "to", "continuously", "read", "log", "files", "and", "append", "lines", "in", "DB", "." ]
python
train
35.266667
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L73-L75
def conf(self, key): '''get config''' return self.__conf[key] if key in self.__conf else _YunpianConf.YP_CONF.get(key)
[ "def", "conf", "(", "self", ",", "key", ")", ":", "return", "self", ".", "__conf", "[", "key", "]", "if", "key", "in", "self", ".", "__conf", "else", "_YunpianConf", ".", "YP_CONF", ".", "get", "(", "key", ")" ]
get config
[ "get", "config" ]
python
train
44
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py#L46-L56
def autoLayout(self, size=None): """ Updates the layout for the graphics within this scene. """ if size is None: size = self._view.size() self.setSceneRect(0, 0, size.width(), size.height()) for item in self.items(): if isinstance...
[ "def", "autoLayout", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "size", "=", "self", ".", "_view", ".", "size", "(", ")", "self", ".", "setSceneRect", "(", "0", ",", "0", ",", "size", ".", "width", "(", ")...
Updates the layout for the graphics within this scene.
[ "Updates", "the", "layout", "for", "the", "graphics", "within", "this", "scene", "." ]
python
train
34.272727
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L4267-L4272
def elemDump(self, f, cur): """Dump an XML/HTML node, recursive behaviour, children are printed too. """ if cur is None: cur__o = None else: cur__o = cur._o libxml2mod.xmlElemDump(f, self._o, cur__o)
[ "def", "elemDump", "(", "self", ",", "f", ",", "cur", ")", ":", "if", "cur", "is", "None", ":", "cur__o", "=", "None", "else", ":", "cur__o", "=", "cur", ".", "_o", "libxml2mod", ".", "xmlElemDump", "(", "f", ",", "self", ".", "_o", ",", "cur__o"...
Dump an XML/HTML node, recursive behaviour, children are printed too.
[ "Dump", "an", "XML", "/", "HTML", "node", "recursive", "behaviour", "children", "are", "printed", "too", "." ]
python
train
39.5
djordon/queueing-tool
queueing_tool/network/queue_network.py
https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/network/queue_network.py#L1138-L1183
def show_active(self, **kwargs): """Draws the network, highlighting active queues. The colored vertices represent vertices that have at least one queue on an in-edge that is active. Dark edges represent queues that are active, light edges represent queues that are inactive. ...
[ "def", "show_active", "(", "self", ",", "*", "*", "kwargs", ")", ":", "g", "=", "self", ".", "g", "for", "v", "in", "g", ".", "nodes", "(", ")", ":", "self", ".", "g", ".", "set_vp", "(", "v", ",", "'vertex_color'", ",", "[", "0", ",", "0", ...
Draws the network, highlighting active queues. The colored vertices represent vertices that have at least one queue on an in-edge that is active. Dark edges represent queues that are active, light edges represent queues that are inactive. Parameters ---------- *...
[ "Draws", "the", "network", "highlighting", "active", "queues", "." ]
python
valid
38.130435
common-workflow-language/schema_salad
schema_salad/avro/schema.py
https://github.com/common-workflow-language/schema_salad/blob/608ba207b9058fe0a9c3db161058ab3782eef015/schema_salad/avro/schema.py#L215-L235
def add_name(self, name_attr, space_attr, new_schema): # type: (Text, Optional[Text], NamedSchema) -> Name """ Add a new schema object to the name set. @arg name_attr: name value read in schema @arg space_attr: namespace value read in schema. @return: the Name tha...
[ "def", "add_name", "(", "self", ",", "name_attr", ",", "space_attr", ",", "new_schema", ")", ":", "# type: (Text, Optional[Text], NamedSchema) -> Name", "to_add", "=", "Name", "(", "name_attr", ",", "space_attr", ",", "self", ".", "default_namespace", ")", "if", "...
Add a new schema object to the name set. @arg name_attr: name value read in schema @arg space_attr: namespace value read in schema. @return: the Name that was just added.
[ "Add", "a", "new", "schema", "object", "to", "the", "name", "set", "." ]
python
train
38.238095
genialis/resolwe
resolwe/flow/expression_engines/jinja/filters.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/expression_engines/jinja/filters.py#L117-L135
def descriptor(obj, path=''): """Return descriptor of given object. If ``path`` is specified, only the content on that path is returned. """ if isinstance(obj, dict): # Current object is hydrated, so we need to get descriptor from # dict representation. desc = obj['__descrip...
[ "def", "descriptor", "(", "obj", ",", "path", "=", "''", ")", ":", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "# Current object is hydrated, so we need to get descriptor from", "# dict representation.", "desc", "=", "obj", "[", "'__descriptor'", "]", "...
Return descriptor of given object. If ``path`` is specified, only the content on that path is returned.
[ "Return", "descriptor", "of", "given", "object", "." ]
python
train
25.631579
Microsoft/botbuilder-python
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L266-L276
async def get_conversations(self, service_url: str, continuation_token: str=None): """ Lists the Conversations in which this bot has participated for a given channel server. The channel server returns results in pages and each page will include a `continuationToken` that can be used to fetch the...
[ "async", "def", "get_conversations", "(", "self", ",", "service_url", ":", "str", ",", "continuation_token", ":", "str", "=", "None", ")", ":", "client", "=", "self", ".", "create_connector_client", "(", "service_url", ")", "return", "await", "client", ".", ...
Lists the Conversations in which this bot has participated for a given channel server. The channel server returns results in pages and each page will include a `continuationToken` that can be used to fetch the next page of results from the server. :param service_url: :param continuation_...
[ "Lists", "the", "Conversations", "in", "which", "this", "bot", "has", "participated", "for", "a", "given", "channel", "server", ".", "The", "channel", "server", "returns", "results", "in", "pages", "and", "each", "page", "will", "include", "a", "continuationTo...
python
test
53.363636
mardix/Yass
yass/publisher.py
https://github.com/mardix/Yass/blob/32f804c1a916f5b0a13d13fa750e52be3b6d666d/yass/publisher.py#L224-L240
def purge_files(self, exclude_files=["index.html", "error.html"]): """ To delete files that are in the manifest :param excludes_files: list : files to not delete :return: """ for chunk in utils.chunk_list(self._get_manifest_data(), 1000): try: ...
[ "def", "purge_files", "(", "self", ",", "exclude_files", "=", "[", "\"index.html\"", ",", "\"error.html\"", "]", ")", ":", "for", "chunk", "in", "utils", ".", "chunk_list", "(", "self", ".", "_get_manifest_data", "(", ")", ",", "1000", ")", ":", "try", "...
To delete files that are in the manifest :param excludes_files: list : files to not delete :return:
[ "To", "delete", "files", "that", "are", "in", "the", "manifest", ":", "param", "excludes_files", ":", "list", ":", "files", "to", "not", "delete", ":", "return", ":" ]
python
train
36.470588
PyProphet/pyprophet
pyprophet/main.py
https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/main.py#L144-L154
def peptide(infile, outfile, context, parametric, pfdr, pi0_lambda, pi0_method, pi0_smooth_df, pi0_smooth_log_pi0, lfdr_truncate, lfdr_monotone, lfdr_transformation, lfdr_adj, lfdr_eps): """ Infer peptides and conduct error-rate estimation in different contexts. """ if outfile is None: outfile ...
[ "def", "peptide", "(", "infile", ",", "outfile", ",", "context", ",", "parametric", ",", "pfdr", ",", "pi0_lambda", ",", "pi0_method", ",", "pi0_smooth_df", ",", "pi0_smooth_log_pi0", ",", "lfdr_truncate", ",", "lfdr_monotone", ",", "lfdr_transformation", ",", "...
Infer peptides and conduct error-rate estimation in different contexts.
[ "Infer", "peptides", "and", "conduct", "error", "-", "rate", "estimation", "in", "different", "contexts", "." ]
python
test
49.818182
davidfokkema/artist
artist/multi_plot.py
https://github.com/davidfokkema/artist/blob/26ae7987522622710f2910980770c50012fda47d/artist/multi_plot.py#L482-L489
def get_subplot_at(self, row, column): """Return the subplot at row, column position. :param row,column: specify the subplot. """ idx = row * self.columns + column return self.subplots[idx]
[ "def", "get_subplot_at", "(", "self", ",", "row", ",", "column", ")", ":", "idx", "=", "row", "*", "self", ".", "columns", "+", "column", "return", "self", ".", "subplots", "[", "idx", "]" ]
Return the subplot at row, column position. :param row,column: specify the subplot.
[ "Return", "the", "subplot", "at", "row", "column", "position", "." ]
python
train
28
PMEAL/porespy
porespy/tools/__funcs__.py
https://github.com/PMEAL/porespy/blob/1e13875b56787d8f5b7ffdabce8c4342c33ba9f8/porespy/tools/__funcs__.py#L510-L575
def randomize_colors(im, keep_vals=[0]): r''' Takes a greyscale image and randomly shuffles the greyscale values, so that all voxels labeled X will be labelled Y, and all voxels labeled Y will be labeled Z, where X, Y, Z and so on are randomly selected from the values in the input image. This f...
[ "def", "randomize_colors", "(", "im", ",", "keep_vals", "=", "[", "0", "]", ")", ":", "im_flat", "=", "im", ".", "flatten", "(", ")", "keep_vals", "=", "sp", ".", "array", "(", "keep_vals", ")", "swap_vals", "=", "~", "sp", ".", "in1d", "(", "im_fl...
r''' Takes a greyscale image and randomly shuffles the greyscale values, so that all voxels labeled X will be labelled Y, and all voxels labeled Y will be labeled Z, where X, Y, Z and so on are randomly selected from the values in the input image. This function is useful for improving the visibilit...
[ "r", "Takes", "a", "greyscale", "image", "and", "randomly", "shuffles", "the", "greyscale", "values", "so", "that", "all", "voxels", "labeled", "X", "will", "be", "labelled", "Y", "and", "all", "voxels", "labeled", "Y", "will", "be", "labeled", "Z", "where...
python
train
31.787879
gem/oq-engine
openquake/hazardlib/gsim/zhao_2016.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/zhao_2016.py#L82-L102
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ # extracting dictionary of coefficients specific to required #...
[ "def", "get_mean_and_stddevs", "(", "self", ",", "sites", ",", "rup", ",", "dists", ",", "imt", ",", "stddev_types", ")", ":", "# extracting dictionary of coefficients specific to required", "# intensity measure type.", "C", "=", "self", ".", "COEFFS", "[", "imt", "...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.
[ "See", ":", "meth", ":", "superclass", "method", "<", ".", "base", ".", "GroundShakingIntensityModel", ".", "get_mean_and_stddevs", ">", "for", "spec", "of", "input", "and", "result", "values", "." ]
python
train
43.142857
LuminosoInsight/luminoso-api-client-python
luminoso_api/v5_upload.py
https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v5_upload.py#L35-L47
def _simplify_doc(doc): """ Limit a document to just the three fields we should upload. """ # Mutate a copy of the document to fill in missing fields doc = dict(doc) if 'text' not in doc: raise ValueError("The document {!r} has no text field".format(doc)) return { 'text': doc...
[ "def", "_simplify_doc", "(", "doc", ")", ":", "# Mutate a copy of the document to fill in missing fields", "doc", "=", "dict", "(", "doc", ")", "if", "'text'", "not", "in", "doc", ":", "raise", "ValueError", "(", "\"The document {!r} has no text field\"", ".", "format...
Limit a document to just the three fields we should upload.
[ "Limit", "a", "document", "to", "just", "the", "three", "fields", "we", "should", "upload", "." ]
python
test
31.230769
gatkin/declxml
declxml.py
https://github.com/gatkin/declxml/blob/3a2324b43aee943e82a04587fbb68932c6f392ba/declxml.py#L1202-L1214
def parse_at_element( self, element, # type: ET.Element state # type: _ProcessorState ): # type: (...) -> Any """Parse the primitive value at the XML element.""" if self._attribute: parsed_value = self._parse_attribute(element, self._attribut...
[ "def", "parse_at_element", "(", "self", ",", "element", ",", "# type: ET.Element", "state", "# type: _ProcessorState", ")", ":", "# type: (...) -> Any", "if", "self", ".", "_attribute", ":", "parsed_value", "=", "self", ".", "_parse_attribute", "(", "element", ",", ...
Parse the primitive value at the XML element.
[ "Parse", "the", "primitive", "value", "at", "the", "XML", "element", "." ]
python
train
36.307692
pyblish/pyblish-qml
pyblish_qml/ipc/service.py
https://github.com/pyblish/pyblish-qml/blob/6095d18b2ec0afd0409a9b1a17e53b0658887283/pyblish_qml/ipc/service.py#L109-L118
def _dispatch(self, method, params): """Customise exception handling""" self._count += 1 func = getattr(self, method) try: return func(*params) except Exception as e: traceback.print_exc() raise e
[ "def", "_dispatch", "(", "self", ",", "method", ",", "params", ")", ":", "self", ".", "_count", "+=", "1", "func", "=", "getattr", "(", "self", ",", "method", ")", "try", ":", "return", "func", "(", "*", "params", ")", "except", "Exception", "as", ...
Customise exception handling
[ "Customise", "exception", "handling" ]
python
train
26.4
happyleavesaoc/python-limitlessled
limitlessled/group/__init__.py
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/group/__init__.py#L139-L153
def _scale_steps(self, duration, commands, *steps): """ Scale steps :param duration: Total time (in seconds) :param commands: Number of commands to be executed. :param steps: Steps for one or many properties to take. :return: Steps scaled to time and total. """ f...
[ "def", "_scale_steps", "(", "self", ",", "duration", ",", "commands", ",", "*", "steps", ")", ":", "factor", "=", "duration", "/", "(", "(", "self", ".", "wait", "*", "self", ".", "reps", "*", "commands", ")", "-", "(", "self", ".", "wait", "*", ...
Scale steps :param duration: Total time (in seconds) :param commands: Number of commands to be executed. :param steps: Steps for one or many properties to take. :return: Steps scaled to time and total.
[ "Scale", "steps" ]
python
train
38.933333
vrtsystems/pyat
pyat/sync.py
https://github.com/vrtsystems/pyat/blob/23f87904e5f9f6902665bbf825e65e7eddd64995/pyat/sync.py#L120-L131
def result(self): ''' The result from the executed task. Raises NotExecutedYet if not yet executed. ''' if self.cancelled or (self._fn is not None): raise NotExecutedYet() if self._fn_exc is not None: six.reraise(*self._fn_exc) else: ...
[ "def", "result", "(", "self", ")", ":", "if", "self", ".", "cancelled", "or", "(", "self", ".", "_fn", "is", "not", "None", ")", ":", "raise", "NotExecutedYet", "(", ")", "if", "self", ".", "_fn_exc", "is", "not", "None", ":", "six", ".", "reraise"...
The result from the executed task. Raises NotExecutedYet if not yet executed.
[ "The", "result", "from", "the", "executed", "task", ".", "Raises", "NotExecutedYet", "if", "not", "yet", "executed", "." ]
python
train
28
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/XMLSchema.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/XMLSchema.py#L126-L141
def loadFromURL(self, url, schema=None): """Return an XMLSchema instance loaded from the given url. url -- URL to dereference schema -- Optional XMLSchema instance. """ reader = self.__readerClass() if self.__base_url: url = basejoin(self.__base_url,url)...
[ "def", "loadFromURL", "(", "self", ",", "url", ",", "schema", "=", "None", ")", ":", "reader", "=", "self", ".", "__readerClass", "(", ")", "if", "self", ".", "__base_url", ":", "url", "=", "basejoin", "(", "self", ".", "__base_url", ",", "url", ")",...
Return an XMLSchema instance loaded from the given url. url -- URL to dereference schema -- Optional XMLSchema instance.
[ "Return", "an", "XMLSchema", "instance", "loaded", "from", "the", "given", "url", ".", "url", "--", "URL", "to", "dereference", "schema", "--", "Optional", "XMLSchema", "instance", "." ]
python
train
32.9375
atztogo/phonopy
phonopy/harmonic/force_constants.py
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/harmonic/force_constants.py#L298-L349
def set_tensor_symmetry_old(force_constants, lattice, # column vectors positions, symmetry): """Full force constants are symmetrized using crystal symmetry. This method extracts symmetrically equivalent sets of atomic pairs an...
[ "def", "set_tensor_symmetry_old", "(", "force_constants", ",", "lattice", ",", "# column vectors", "positions", ",", "symmetry", ")", ":", "rotations", "=", "symmetry", ".", "get_symmetry_operations", "(", ")", "[", "'rotations'", "]", "translations", "=", "symmetry...
Full force constants are symmetrized using crystal symmetry. This method extracts symmetrically equivalent sets of atomic pairs and take sum of their force constants and average the sum. Since get_force_constants_disps may include crystal symmetry, this method is usually meaningless.
[ "Full", "force", "constants", "are", "symmetrized", "using", "crystal", "symmetry", "." ]
python
train
39.519231
coldfix/udiskie
udiskie/udisks2.py
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/udisks2.py#L446-L454
def unmount(self, force=None, auth_no_user_interaction=None): """Unmount filesystem.""" return self._M.Filesystem.Unmount( '(a{sv})', filter_opt({ 'force': ('b', force), 'auth.no_user_interaction': ('b', auth_no_user_interaction), }) ...
[ "def", "unmount", "(", "self", ",", "force", "=", "None", ",", "auth_no_user_interaction", "=", "None", ")", ":", "return", "self", ".", "_M", ".", "Filesystem", ".", "Unmount", "(", "'(a{sv})'", ",", "filter_opt", "(", "{", "'force'", ":", "(", "'b'", ...
Unmount filesystem.
[ "Unmount", "filesystem", "." ]
python
train
35.444444
suurjaak/InputScope
inputscope/webui.py
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/webui.py#L52-L64
def keyboard(table, day=None): """Handler for showing the keyboard statistics page.""" cols, group = "realkey AS key, COUNT(*) AS count", "realkey" where = (("day", day),) if day else () counts_display = counts = db.fetch(table, cols, where, group, "count DESC") if "combos" == table: c...
[ "def", "keyboard", "(", "table", ",", "day", "=", "None", ")", ":", "cols", ",", "group", "=", "\"realkey AS key, COUNT(*) AS count\"", ",", "\"realkey\"", "where", "=", "(", "(", "\"day\"", ",", "day", ")", ",", ")", "if", "day", "else", "(", ")", "co...
Handler for showing the keyboard statistics page.
[ "Handler", "for", "showing", "the", "keyboard", "statistics", "page", "." ]
python
train
58.461538
andrewramsay/sk8-drivers
pysk8/calibration/sk8_calibration_gui.py
https://github.com/andrewramsay/sk8-drivers/blob/67347a71762fb421f5ae65a595def5c7879e8b0c/pysk8/calibration/sk8_calibration_gui.py#L309-L316
def mag_calibration(self): """Perform magnetometer calibration for current IMU.""" self.calibration_state = self.CAL_MAG self.mag_dialog = SK8MagDialog(self.sk8.get_imu(self.spinIMU.value()), self) if self.mag_dialog.exec_() == QDialog.Rejected: return self.calculate...
[ "def", "mag_calibration", "(", "self", ")", ":", "self", ".", "calibration_state", "=", "self", ".", "CAL_MAG", "self", ".", "mag_dialog", "=", "SK8MagDialog", "(", "self", ".", "sk8", ".", "get_imu", "(", "self", ".", "spinIMU", ".", "value", "(", ")", ...
Perform magnetometer calibration for current IMU.
[ "Perform", "magnetometer", "calibration", "for", "current", "IMU", "." ]
python
train
44.25
seatgeek/fuzzywuzzy
benchmarks.py
https://github.com/seatgeek/fuzzywuzzy/blob/778162c5a73256745eb6ae22f925bc2dbcf7c894/benchmarks.py#L47-L57
def print_result_from_timeit(stmt='pass', setup='pass', number=1000000): """ Clean function to know how much time took the execution of one statement """ units = ["s", "ms", "us", "ns"] duration = timeit(stmt, setup, number=int(number)) avg_duration = duration / float(number) thousands = int...
[ "def", "print_result_from_timeit", "(", "stmt", "=", "'pass'", ",", "setup", "=", "'pass'", ",", "number", "=", "1000000", ")", ":", "units", "=", "[", "\"s\"", ",", "\"ms\"", ",", "\"us\"", ",", "\"ns\"", "]", "duration", "=", "timeit", "(", "stmt", "...
Clean function to know how much time took the execution of one statement
[ "Clean", "function", "to", "know", "how", "much", "time", "took", "the", "execution", "of", "one", "statement" ]
python
train
43.818182
gbiggs/rtctree
rtctree/component.py
https://github.com/gbiggs/rtctree/blob/bd725a47ac87c259c8bce06156ccc9ab71111c26/rtctree/component.py#L554-L574
def deactivate_in_ec(self, ec_index): '''Deactivate this component in an execution context. @param ec_index The index of the execution context to deactivate in. This index is into the total array of contexts, that is both owned and participating contexts....
[ "def", "deactivate_in_ec", "(", "self", ",", "ec_index", ")", ":", "with", "self", ".", "_mutex", ":", "if", "ec_index", ">=", "len", "(", "self", ".", "owned_ecs", ")", ":", "ec_index", "-=", "len", "(", "self", ".", "owned_ecs", ")", "if", "ec_index"...
Deactivate this component in an execution context. @param ec_index The index of the execution context to deactivate in. This index is into the total array of contexts, that is both owned and participating contexts. If the value of ec_index...
[ "Deactivate", "this", "component", "in", "an", "execution", "context", "." ]
python
train
47.190476
gabstopper/smc-python
smc/core/collection.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L533-L599
def add_layer3_cluster_interface(self, interface_id, cluster_virtual=None, network_value=None, macaddress=None, nodes=None, cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw): """ Add cluster virtual interface. A "CVI" interface is used as a VIP address for clu...
[ "def", "add_layer3_cluster_interface", "(", "self", ",", "interface_id", ",", "cluster_virtual", "=", "None", ",", "network_value", "=", "None", ",", "macaddress", "=", "None", ",", "nodes", "=", "None", ",", "cvi_mode", "=", "'packetdispatch'", ",", "zone_ref",...
Add cluster virtual interface. A "CVI" interface is used as a VIP address for clustered engines. Providing 'nodes' will create the node specific interfaces. You can also add a cluster address with only a CVI, or only NDI's. Add CVI only:: engine.physic...
[ "Add", "cluster", "virtual", "interface", ".", "A", "CVI", "interface", "is", "used", "as", "a", "VIP", "address", "for", "clustered", "engines", ".", "Providing", "nodes", "will", "create", "the", "node", "specific", "interfaces", ".", "You", "can", "also",...
python
train
45.134328
ultrabug/py3status
py3status/modules/battery_level.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/modules/battery_level.py#L266-L325
def _extract_battery_info_from_sys(self): """ Extract the percent charged, charging state, time remaining, and capacity for a battery, using Linux's kernel /sys interface Only available in kernel 2.6.24(?) and newer. Before kernel provided a similar, yet incompatible interface i...
[ "def", "_extract_battery_info_from_sys", "(", "self", ")", ":", "if", "not", "os", ".", "listdir", "(", "self", ".", "sys_battery_path", ")", ":", "return", "[", "]", "def", "_parse_battery_info", "(", "sys_path", ")", ":", "\"\"\"\n Extract battery inf...
Extract the percent charged, charging state, time remaining, and capacity for a battery, using Linux's kernel /sys interface Only available in kernel 2.6.24(?) and newer. Before kernel provided a similar, yet incompatible interface in /proc
[ "Extract", "the", "percent", "charged", "charging", "state", "time", "remaining", "and", "capacity", "for", "a", "battery", "using", "Linux", "s", "kernel", "/", "sys", "interface" ]
python
train
38.15