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
NuGrid/NuGridPy
nugridpy/utils.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/utils.py#L827-L872
def trajectory_SgConst(Sg=0.1, delta_logt_dex=-0.01): ''' setup trajectories for constant radiation entropy. S_gamma/R where the radiation constant R = N_A*k (Dave Arnett, Supernova book, p. 212) This relates rho and T but the time scale for this is independent. Parameters ---------- ...
[ "def", "trajectory_SgConst", "(", "Sg", "=", "0.1", ",", "delta_logt_dex", "=", "-", "0.01", ")", ":", "# reverse logarithmic time", "logtimerev", "=", "np", ".", "arange", "(", "5.", ",", "-", "6.", ",", "delta_logt_dex", ")", "logrho", "=", "np", ".", ...
setup trajectories for constant radiation entropy. S_gamma/R where the radiation constant R = N_A*k (Dave Arnett, Supernova book, p. 212) This relates rho and T but the time scale for this is independent. Parameters ---------- Sg : float S_gamma/R, values between 0.1 and 10. reflec...
[ "setup", "trajectories", "for", "constant", "radiation", "entropy", "." ]
python
train
31.478261
amzn/ion-python
amazon/ion/writer_text.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/writer_text.py#L433-L449
def raw_writer(indent=None): """Returns a raw text writer co-routine. Yields: DataEvent: serialization events to write out Receives :class:`amazon.ion.core.IonEvent` or ``None`` when the co-routine yields ``HAS_PENDING`` :class:`WriteEventType` events. """ is_whitespace_str = ...
[ "def", "raw_writer", "(", "indent", "=", "None", ")", ":", "is_whitespace_str", "=", "isinstance", "(", "indent", ",", "str", ")", "and", "re", ".", "search", "(", "r'\\A\\s*\\Z'", ",", "indent", ",", "re", ".", "M", ")", "is", "not", "None", "if", "...
Returns a raw text writer co-routine. Yields: DataEvent: serialization events to write out Receives :class:`amazon.ion.core.IonEvent` or ``None`` when the co-routine yields ``HAS_PENDING`` :class:`WriteEventType` events.
[ "Returns", "a", "raw", "text", "writer", "co", "-", "routine", "." ]
python
train
40.235294
dddomodossola/remi
remi/server.py
https://github.com/dddomodossola/remi/blob/85206f62220662bb7ecd471042268def71ccad28/remi/server.py#L98-L111
def parse_session_cookie(cookie_to_cook): """ cookie_to_cook = http_header['cookie'] """ #print("cookie_to_cook: %s"%str(cookie_to_cook)) session_value = None tokens = cookie_to_cook.split(";") for tok in tokens: if 'remi_session=' in tok: #print("found session id: %s"%str(to...
[ "def", "parse_session_cookie", "(", "cookie_to_cook", ")", ":", "#print(\"cookie_to_cook: %s\"%str(cookie_to_cook))", "session_value", "=", "None", "tokens", "=", "cookie_to_cook", ".", "split", "(", "\";\"", ")", "for", "tok", "in", "tokens", ":", "if", "'remi_sessio...
cookie_to_cook = http_header['cookie']
[ "cookie_to_cook", "=", "http_header", "[", "cookie", "]" ]
python
train
33.071429
numenta/nupic
src/nupic/regions/tm_region.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/tm_region.py#L788-L821
def writeToProto(self, proto): """ Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`. Write state to proto object. :param proto: TMRegionProto capnproto object """ proto.temporalImp = self.temporalImp proto.columnCount = self.columnCount proto.inputWidth = self.i...
[ "def", "writeToProto", "(", "self", ",", "proto", ")", ":", "proto", ".", "temporalImp", "=", "self", ".", "temporalImp", "proto", ".", "columnCount", "=", "self", ".", "columnCount", "proto", ".", "inputWidth", "=", "self", ".", "inputWidth", "proto", "."...
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.writeToProto`. Write state to proto object. :param proto: TMRegionProto capnproto object
[ "Overrides", ":", "meth", ":", "~nupic", ".", "bindings", ".", "regions", ".", "PyRegion", ".", "PyRegion", ".", "writeToProto", "." ]
python
valid
33.970588
exosite-labs/pyonep
pyonep/portals/endpoints.py
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/portals/endpoints.py#L430-L455
def create_token(self, user_id, permission_obj): """ 'permission_obj' param should be a string. e.g. '[{"access":"d_u_list","oid":{"id":"1576946496","type":"Domain"}}]' http://docs.exosite.com/portals/#add-user-permission """ headers = { 'User-Agent': s...
[ "def", "create_token", "(", "self", ",", "user_id", ",", "permission_obj", ")", ":", "headers", "=", "{", "'User-Agent'", ":", "self", ".", "user_agent", "(", ")", ",", "'Content-Type'", ":", "self", ".", "content_type", "(", ")", "}", "headers", ".", "u...
'permission_obj' param should be a string. e.g. '[{"access":"d_u_list","oid":{"id":"1576946496","type":"Domain"}}]' http://docs.exosite.com/portals/#add-user-permission
[ "permission_obj", "param", "should", "be", "a", "string", ".", "e", ".", "g", ".", "[", "{", "access", ":", "d_u_list", "oid", ":", "{", "id", ":", "1576946496", "type", ":", "Domain", "}}", "]" ]
python
train
36.538462
DLR-RM/RAFCON
source/rafcon/core/states/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1110-L1147
def output_data_ports(self, output_data_ports): """ Setter for _output_data_ports field See property :param dict output_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type :class:`rafcon.core.state_elements.data_port.OutputDataP...
[ "def", "output_data_ports", "(", "self", ",", "output_data_ports", ")", ":", "if", "not", "isinstance", "(", "output_data_ports", ",", "dict", ")", ":", "raise", "TypeError", "(", "\"output_data_ports must be of type dict\"", ")", "if", "[", "port_id", "for", "por...
Setter for _output_data_ports field See property :param dict output_data_ports: Dictionary that maps :class:`int` data_port_ids onto values of type :class:`rafcon.core.state_elements.data_port.OutputDataPort` :raises exceptions.TypeError: if the output_dat...
[ "Setter", "for", "_output_data_ports", "field" ]
python
train
55.868421
Delgan/loguru
loguru/_logger.py
https://github.com/Delgan/loguru/blob/6571879c37904e3a18567e694d70651c6886b860/loguru/_logger.py#L1081-L1123
def bind(_self, **kwargs): """Bind attributes to the ``extra`` dict of each logged message record. This is used to add custom context to each logging call. Parameters ---------- **kwargs Mapping between keys and values that will be added to the ``extra`` dict. ...
[ "def", "bind", "(", "_self", ",", "*", "*", "kwargs", ")", ":", "return", "Logger", "(", "{", "*", "*", "_self", ".", "_extra", ",", "*", "*", "kwargs", "}", ",", "_self", ".", "_exception", ",", "_self", ".", "_record", ",", "_self", ".", "_lazy...
Bind attributes to the ``extra`` dict of each logged message record. This is used to add custom context to each logging call. Parameters ---------- **kwargs Mapping between keys and values that will be added to the ``extra`` dict. Returns ------- :c...
[ "Bind", "attributes", "to", "the", "extra", "dict", "of", "each", "logged", "message", "record", "." ]
python
train
30.627907
PyCQA/pylint
pylint/lint.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L1143-L1156
def expand_files(self, modules): """get modules and errors from a list of modules and handle errors """ result, errors = utils.expand_modules( modules, self.config.black_list, self.config.black_list_re ) for error in errors: message = modname = error["mod"...
[ "def", "expand_files", "(", "self", ",", "modules", ")", ":", "result", ",", "errors", "=", "utils", ".", "expand_modules", "(", "modules", ",", "self", ".", "config", ".", "black_list", ",", "self", ".", "config", ".", "black_list_re", ")", "for", "erro...
get modules and errors from a list of modules and handle errors
[ "get", "modules", "and", "errors", "from", "a", "list", "of", "modules", "and", "handle", "errors" ]
python
test
40.142857
wummel/patool
patoolib/programs/lha.py
https://github.com/wummel/patool/blob/d7e64d9fd60faaa4b3f824bd97c43ce59b185c40/patoolib/programs/lha.py#L18-L24
def extract_lzh (archive, compression, cmd, verbosity, interactive, outdir): """Extract a LZH archive.""" opts = 'x' if verbosity > 1: opts += 'v' opts += "w=%s" % outdir return [cmd, opts, archive]
[ "def", "extract_lzh", "(", "archive", ",", "compression", ",", "cmd", ",", "verbosity", ",", "interactive", ",", "outdir", ")", ":", "opts", "=", "'x'", "if", "verbosity", ">", "1", ":", "opts", "+=", "'v'", "opts", "+=", "\"w=%s\"", "%", "outdir", "re...
Extract a LZH archive.
[ "Extract", "a", "LZH", "archive", "." ]
python
train
31.428571
Azure/azure-sdk-for-python
azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/application_definitions_operations.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/application_definitions_operations.py#L452-L491
def delete_by_id( self, application_definition_id, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes the managed application definition. :param application_definition_id: The fully qualified ID of the managed application definition, including the managed...
[ "def", "delete_by_id", "(", "self", ",", "application_definition_id", ",", "custom_headers", "=", "None", ",", "raw", "=", "False", ",", "polling", "=", "True", ",", "*", "*", "operation_config", ")", ":", "raw_result", "=", "self", ".", "_delete_by_id_initial...
Deletes the managed application definition. :param application_definition_id: The fully qualified ID of the managed application definition, including the managed application name and the managed application definition resource type. Use the format, /subscriptions/{guid}/resourceGroup...
[ "Deletes", "the", "managed", "application", "definition", "." ]
python
test
53.825
bwohlberg/sporco
sporco/plot.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/plot.py#L35-L72
def attach_keypress(fig, scaling=1.1): """ Attach a key press event handler that configures keys for closing a figure and changing the figure size. Keys 'e' and 'c' respectively expand and contract the figure, and key 'q' closes it. **Note:** Resizing may not function correctly with all matplotlib ...
[ "def", "attach_keypress", "(", "fig", ",", "scaling", "=", "1.1", ")", ":", "def", "press", "(", "event", ")", ":", "if", "event", ".", "key", "==", "'q'", ":", "plt", ".", "close", "(", "fig", ")", "elif", "event", ".", "key", "==", "'e'", ":", ...
Attach a key press event handler that configures keys for closing a figure and changing the figure size. Keys 'e' and 'c' respectively expand and contract the figure, and key 'q' closes it. **Note:** Resizing may not function correctly with all matplotlib backends (a `bug <https://github.com/matplo...
[ "Attach", "a", "key", "press", "event", "handler", "that", "configures", "keys", "for", "closing", "a", "figure", "and", "changing", "the", "figure", "size", ".", "Keys", "e", "and", "c", "respectively", "expand", "and", "contract", "the", "figure", "and", ...
python
train
32.710526
Qiskit/qiskit-terra
qiskit/visualization/circuit_visualization.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/circuit_visualization.py#L441-L475
def _matplotlib_circuit_drawer(circuit, scale=0.7, filename=None, style=None, plot_barriers=True, reverse_bits=False, justify=None): ...
[ "def", "_matplotlib_circuit_drawer", "(", "circuit", ",", "scale", "=", "0.7", ",", "filename", "=", "None", ",", "style", "=", "None", ",", "plot_barriers", "=", "True", ",", "reverse_bits", "=", "False", ",", "justify", "=", "None", ")", ":", "qregs", ...
Draw a quantum circuit based on matplotlib. If `%matplotlib inline` is invoked in a Jupyter notebook, it visualizes a circuit inline. We recommend `%config InlineBackend.figure_format = 'svg'` for the inline visualization. Args: circuit (QuantumCircuit): a quantum circuit scale (float): sca...
[ "Draw", "a", "quantum", "circuit", "based", "on", "matplotlib", ".", "If", "%matplotlib", "inline", "is", "invoked", "in", "a", "Jupyter", "notebook", "it", "visualizes", "a", "circuit", "inline", ".", "We", "recommend", "%config", "InlineBackend", ".", "figur...
python
test
48.228571
kubernetes-client/python
kubernetes/client/apis/node_v1beta1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/node_v1beta1_api.py#L823-L846
def replace_runtime_class(self, name, body, **kwargs): """ replace the specified RuntimeClass This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_runtime_class(name, body, async_req=Tru...
[ "def", "replace_runtime_class", "(", "self", ",", "name", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "repla...
replace the specified RuntimeClass This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_runtime_class(name, body, async_req=True) >>> result = thread.get() :param async_req bool ...
[ "replace", "the", "specified", "RuntimeClass", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api...
python
train
64.041667
proycon/pynlpl
pynlpl/statistics.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/statistics.py#L610-L616
def normalize(numbers, total=1.0): #from AI: A Modern Appproach """Multiply each number by a constant such that the sum is 1.0 (or total). >>> normalize([1,2,1]) [0.25, 0.5, 0.25] """ k = total / sum(numbers) return [k * n for n in numbers]
[ "def", "normalize", "(", "numbers", ",", "total", "=", "1.0", ")", ":", "#from AI: A Modern Appproach", "k", "=", "total", "/", "sum", "(", "numbers", ")", "return", "[", "k", "*", "n", "for", "n", "in", "numbers", "]" ]
Multiply each number by a constant such that the sum is 1.0 (or total). >>> normalize([1,2,1]) [0.25, 0.5, 0.25]
[ "Multiply", "each", "number", "by", "a", "constant", "such", "that", "the", "sum", "is", "1", ".", "0", "(", "or", "total", ")", ".", ">>>", "normalize", "(", "[", "1", "2", "1", "]", ")", "[", "0", ".", "25", "0", ".", "5", "0", ".", "25", ...
python
train
37
inasafe/inasafe
safe/impact_function/multi_exposure_wrapper.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/multi_exposure_wrapper.py#L536-L575
def _generate_provenance(self): """Function to generate provenance at the end of the IF.""" # noinspection PyTypeChecker hazard = definition( self._provenance['hazard_keywords']['hazard']) exposures = [ definition(layer.keywords['exposure']) for layer in self.expo...
[ "def", "_generate_provenance", "(", "self", ")", ":", "# noinspection PyTypeChecker", "hazard", "=", "definition", "(", "self", ".", "_provenance", "[", "'hazard_keywords'", "]", "[", "'hazard'", "]", ")", "exposures", "=", "[", "definition", "(", "layer", ".", ...
Function to generate provenance at the end of the IF.
[ "Function", "to", "generate", "provenance", "at", "the", "end", "of", "the", "IF", "." ]
python
train
30.075
restran/mountains
mountains/ssh/__init__.py
https://github.com/restran/mountains/blob/a97fee568b112f4e10d878f815d0db3dd0a98d74/mountains/ssh/__init__.py#L86-L121
def run_expect_command(self, cmd, expect_end=None, timeout=3, wait_seconds=2): """ 执行 shell 命令并获取返回结果 :param timeout: :param wait_seconds: :param cmd: :param expect_end: :return: """ shell = self.ssh_session.invoke_shell() last_time = int(t...
[ "def", "run_expect_command", "(", "self", ",", "cmd", ",", "expect_end", "=", "None", ",", "timeout", "=", "3", ",", "wait_seconds", "=", "2", ")", ":", "shell", "=", "self", ".", "ssh_session", ".", "invoke_shell", "(", ")", "last_time", "=", "int", "...
执行 shell 命令并获取返回结果 :param timeout: :param wait_seconds: :param cmd: :param expect_end: :return:
[ "执行", "shell", "命令并获取返回结果", ":", "param", "timeout", ":", ":", "param", "wait_seconds", ":", ":", "param", "cmd", ":", ":", "param", "expect_end", ":", ":", "return", ":" ]
python
train
26.666667
resync/resync
resync/client.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/client.py#L241-L326
def baseline_or_audit(self, allow_deletion=False, audit_only=False): """Baseline synchonization or audit. Both functions implemented in this routine because audit is a prerequisite for a baseline sync. In the case of baseline sync the last timestamp seen is recorded as client state. ...
[ "def", "baseline_or_audit", "(", "self", ",", "allow_deletion", "=", "False", ",", "audit_only", "=", "False", ")", ":", "action", "=", "(", "'audit'", "if", "(", "audit_only", ")", "else", "'baseline sync'", ")", "self", ".", "logger", ".", "debug", "(", ...
Baseline synchonization or audit. Both functions implemented in this routine because audit is a prerequisite for a baseline sync. In the case of baseline sync the last timestamp seen is recorded as client state.
[ "Baseline", "synchonization", "or", "audit", "." ]
python
train
50.313953
gbowerman/azurerm
azurerm/networkrp.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L442-L459
def get_vnet(access_token, subscription_id, resource_group, vnet_name): '''Get details about the named virtual network. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vn...
[ "def", "get_vnet", "(", "access_token", ",", "subscription_id", ",", "resource_group", ",", "vnet_name", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourceGroups...
Get details about the named virtual network. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vnet_name (str): Name of the VNet. Returns: HTTP response. VNet JSON...
[ "Get", "details", "about", "the", "named", "virtual", "network", "." ]
python
train
41.111111
Opentrons/opentrons
update-server/otupdate/migration/endpoints.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/update-server/otupdate/migration/endpoints.py#L31-L44
def require_session(handler): """ Decorator to ensure a session is properly in the request """ @functools.wraps(handler) async def decorated(request: web.Request) -> web.Response: request_session_token = request.match_info['session'] session = session_from_request(request) if not ses...
[ "def", "require_session", "(", "handler", ")", ":", "@", "functools", ".", "wraps", "(", "handler", ")", "async", "def", "decorated", "(", "request", ":", "web", ".", "Request", ")", "->", "web", ".", "Response", ":", "request_session_token", "=", "request...
Decorator to ensure a session is properly in the request
[ "Decorator", "to", "ensure", "a", "session", "is", "properly", "in", "the", "request" ]
python
train
49.285714
andreikop/qutepart
qutepart/rectangularselection.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L90-L98
def _realToVisibleColumn(self, text, realColumn): """If \t is used, real position of symbol in block and visible position differs This function converts real to visible """ generator = self._visibleCharPositionGenerator(text) for i in range(realColumn): val = next(gen...
[ "def", "_realToVisibleColumn", "(", "self", ",", "text", ",", "realColumn", ")", ":", "generator", "=", "self", ".", "_visibleCharPositionGenerator", "(", "text", ")", "for", "i", "in", "range", "(", "realColumn", ")", ":", "val", "=", "next", "(", "genera...
If \t is used, real position of symbol in block and visible position differs This function converts real to visible
[ "If", "\\", "t", "is", "used", "real", "position", "of", "symbol", "in", "block", "and", "visible", "position", "differs", "This", "function", "converts", "real", "to", "visible" ]
python
train
40.888889
rytilahti/python-songpal
songpal/device.py
https://github.com/rytilahti/python-songpal/blob/0443de6b3d960b9067a851d82261ca00e46b4618/songpal/device.py#L383-L389
async def get_sound_settings(self, target="") -> List[Setting]: """Get the current sound settings. :param str target: settings target, defaults to all. """ res = await self.services["audio"]["getSoundSettings"]({"target": target}) return [Setting.make(**x) for x in res]
[ "async", "def", "get_sound_settings", "(", "self", ",", "target", "=", "\"\"", ")", "->", "List", "[", "Setting", "]", ":", "res", "=", "await", "self", ".", "services", "[", "\"audio\"", "]", "[", "\"getSoundSettings\"", "]", "(", "{", "\"target\"", ":"...
Get the current sound settings. :param str target: settings target, defaults to all.
[ "Get", "the", "current", "sound", "settings", "." ]
python
train
43.571429
inspirehep/inspire-schemas
inspire_schemas/builders/references.py
https://github.com/inspirehep/inspire-schemas/blob/34bc124b62fba565b6b40d1a3c15103a23a05edb/inspire_schemas/builders/references.py#L336-L357
def set_page_artid(self, page_start=None, page_end=None, artid=None): """Add artid, start, end pages to publication info of a reference. Args: page_start(Optional[string]): value for the field page_start page_end(Optional[string]): value for the field page_end artid(...
[ "def", "set_page_artid", "(", "self", ",", "page_start", "=", "None", ",", "page_end", "=", "None", ",", "artid", "=", "None", ")", ":", "if", "page_end", "and", "not", "page_start", ":", "raise", "ValueError", "(", "'End_page provided without start_page'", ")...
Add artid, start, end pages to publication info of a reference. Args: page_start(Optional[string]): value for the field page_start page_end(Optional[string]): value for the field page_end artid(Optional[string]): value for the field artid Raises: ValueEr...
[ "Add", "artid", "start", "end", "pages", "to", "publication", "info", "of", "a", "reference", "." ]
python
train
40.590909
koszullab/instaGRAAL
instagraal/leastsqbound.py
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L19-L46
def internal2external_grad(xi, bounds): """ Calculate the internal to external gradiant Calculates the partial of external over internal """ ge = np.empty_like(xi) for i, (v, bound) in enumerate(zip(xi, bounds)): a = bound[0] # minimum b = bound[1] # maximum ...
[ "def", "internal2external_grad", "(", "xi", ",", "bounds", ")", ":", "ge", "=", "np", ".", "empty_like", "(", "xi", ")", "for", "i", ",", "(", "v", ",", "bound", ")", "in", "enumerate", "(", "zip", "(", "xi", ",", "bounds", ")", ")", ":", "a", ...
Calculate the internal to external gradiant Calculates the partial of external over internal
[ "Calculate", "the", "internal", "to", "external", "gradiant", "Calculates", "the", "partial", "of", "external", "over", "internal" ]
python
train
22.285714
iotile/coretools
iotile_ext_cloud/iotile/cloud/utilities.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/utilities.py#L7-L28
def device_slug_to_id(slug): """Convert a d-- device slug to an integer. Args: slug (str): A slug in the format d--XXXX-XXXX-XXXX-XXXX Returns: int: The device id as an integer Raises: ArgumentError: if there is a malformed slug """ if not isinstance(slug, str): ...
[ "def", "device_slug_to_id", "(", "slug", ")", ":", "if", "not", "isinstance", "(", "slug", ",", "str", ")", ":", "raise", "ArgumentError", "(", "\"Invalid device slug that is not a string\"", ",", "slug", "=", "slug", ")", "try", ":", "device_slug", "=", "IOTi...
Convert a d-- device slug to an integer. Args: slug (str): A slug in the format d--XXXX-XXXX-XXXX-XXXX Returns: int: The device id as an integer Raises: ArgumentError: if there is a malformed slug
[ "Convert", "a", "d", "--", "device", "slug", "to", "an", "integer", "." ]
python
train
26.772727
PyCQA/pylint
pylint/checkers/base.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L1397-L1454
def _check_reversed(self, node): """ check that the argument to `reversed` is a sequence """ try: argument = utils.safe_infer(utils.get_argument_from_call(node, position=0)) except utils.NoSuchArgumentError: pass else: if argument is astroid.Uninferabl...
[ "def", "_check_reversed", "(", "self", ",", "node", ")", ":", "try", ":", "argument", "=", "utils", ".", "safe_infer", "(", "utils", ".", "get_argument_from_call", "(", "node", ",", "position", "=", "0", ")", ")", "except", "utils", ".", "NoSuchArgumentErr...
check that the argument to `reversed` is a sequence
[ "check", "that", "the", "argument", "to", "reversed", "is", "a", "sequence" ]
python
test
42.103448
hamelsmu/ktext
ktext/preprocess.py
https://github.com/hamelsmu/ktext/blob/221f09f5b1762705075fd1bd914881c0724d5e02/ktext/preprocess.py#L81-L92
def process_text_constructor(cleaner: Callable, tokenizer: Callable, append_indicators: bool, start_tok: str, end_tok: str): """Generate a function that will clean and tokenize text.""" def proces...
[ "def", "process_text_constructor", "(", "cleaner", ":", "Callable", ",", "tokenizer", ":", "Callable", ",", "append_indicators", ":", "bool", ",", "start_tok", ":", "str", ",", "end_tok", ":", "str", ")", ":", "def", "process_text", "(", "text", ")", ":", ...
Generate a function that will clean and tokenize text.
[ "Generate", "a", "function", "that", "will", "clean", "and", "tokenize", "text", "." ]
python
test
43.416667
CZ-NIC/yangson
yangson/schemanode.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L653-L668
def _ascii_tree(self, indent: str, no_types: bool, val_count: bool) -> str: """Return the receiver's subtree as ASCII art.""" def suffix(sn): return f" {{{sn.val_count}}}\n" if val_count else "\n" if not self.children: return "" cs = [] for c in self.child...
[ "def", "_ascii_tree", "(", "self", ",", "indent", ":", "str", ",", "no_types", ":", "bool", ",", "val_count", ":", "bool", ")", "->", "str", ":", "def", "suffix", "(", "sn", ")", ":", "return", "f\" {{{sn.val_count}}}\\n\"", "if", "val_count", "else", "\...
Return the receiver's subtree as ASCII art.
[ "Return", "the", "receiver", "s", "subtree", "as", "ASCII", "art", "." ]
python
train
45
mitsei/dlkit
dlkit/services/authorization.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1165-L1173
def use_federated_vault_view(self): """Pass through to provider AuthorizationLookupSession.use_federated_vault_view""" self._vault_view = FEDERATED # self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked for session in self._get_provider_session...
[ "def", "use_federated_vault_view", "(", "self", ")", ":", "self", ".", "_vault_view", "=", "FEDERATED", "# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked", "for", "session", "in", "self", ".", "_get_provider_sessions", "(", ")",...
Pass through to provider AuthorizationLookupSession.use_federated_vault_view
[ "Pass", "through", "to", "provider", "AuthorizationLookupSession", ".", "use_federated_vault_view" ]
python
train
48.888889
noahbenson/neuropythy
neuropythy/io/core.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/io/core.py#L355-L391
def load_nifti(filename, to='auto'): ''' load_nifti(filename) yields the Nifti1Image or Nifti2Image referened by the given filename by using the nibabel load function. The optional argument to may be used to coerce the resulting data to a particular format; the following arguments are underst...
[ "def", "load_nifti", "(", "filename", ",", "to", "=", "'auto'", ")", ":", "img", "=", "nib", ".", "load", "(", "filename", ")", "to", "=", "to", ".", "lower", "(", ")", "if", "to", "==", "'image'", ":", "return", "img", "elif", "to", "==", "'data...
load_nifti(filename) yields the Nifti1Image or Nifti2Image referened by the given filename by using the nibabel load function. The optional argument to may be used to coerce the resulting data to a particular format; the following arguments are understood: * 'header' will yield just the image h...
[ "load_nifti", "(", "filename", ")", "yields", "the", "Nifti1Image", "or", "Nifti2Image", "referened", "by", "the", "given", "filename", "by", "using", "the", "nibabel", "load", "function", ".", "The", "optional", "argument", "to", "may", "be", "used", "to", ...
python
train
46.135135
softlayer/softlayer-python
SoftLayer/managers/network.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/network.py#L200-L209
def cancel_global_ip(self, global_ip_id): """Cancels the specified global IP address. :param int id: The ID of the global IP to be cancelled. """ service = self.client['Network_Subnet_IpAddress_Global'] ip_address = service.getObject(id=global_ip_id, mask='billingItem') ...
[ "def", "cancel_global_ip", "(", "self", ",", "global_ip_id", ")", ":", "service", "=", "self", ".", "client", "[", "'Network_Subnet_IpAddress_Global'", "]", "ip_address", "=", "service", ".", "getObject", "(", "id", "=", "global_ip_id", ",", "mask", "=", "'bil...
Cancels the specified global IP address. :param int id: The ID of the global IP to be cancelled.
[ "Cancels", "the", "specified", "global", "IP", "address", "." ]
python
train
42.8
mozilla/treeherder
treeherder/webapp/graphql/helpers.py
https://github.com/mozilla/treeherder/blob/cc47bdec872e5c668d0f01df89517390a164cda3/treeherder/webapp/graphql/helpers.py#L2-L18
def collect_fields(node): """ Get all the unique field names that are eligible for optimization Requested a function like this be added to the ``info`` object upstream in graphene_django: https://github.com/graphql-python/graphene-django/issues/230 """ fields = set() for leaf in node: ...
[ "def", "collect_fields", "(", "node", ")", ":", "fields", "=", "set", "(", ")", "for", "leaf", "in", "node", ":", "if", "leaf", ".", "get", "(", "'kind'", ",", "None", ")", "==", "\"Field\"", ":", "fields", ".", "add", "(", "leaf", "[", "\"name\"",...
Get all the unique field names that are eligible for optimization Requested a function like this be added to the ``info`` object upstream in graphene_django: https://github.com/graphql-python/graphene-django/issues/230
[ "Get", "all", "the", "unique", "field", "names", "that", "are", "eligible", "for", "optimization" ]
python
train
32.058824
boppreh/keyboard
keyboard/__init__.py
https://github.com/boppreh/keyboard/blob/dbb73dfff484f733d5fed8dbc53301af5b6c7f50/keyboard/__init__.py#L296-L324
def key_to_scan_codes(key, error_if_missing=True): """ Returns a list of scan codes associated with this key (name or scan code). """ if _is_number(key): return (key,) elif _is_list(key): return sum((key_to_scan_codes(i) for i in key), ()) elif not _is_str(key): raise Val...
[ "def", "key_to_scan_codes", "(", "key", ",", "error_if_missing", "=", "True", ")", ":", "if", "_is_number", "(", "key", ")", ":", "return", "(", "key", ",", ")", "elif", "_is_list", "(", "key", ")", ":", "return", "sum", "(", "(", "key_to_scan_codes", ...
Returns a list of scan codes associated with this key (name or scan code).
[ "Returns", "a", "list", "of", "scan", "codes", "associated", "with", "this", "key", "(", "name", "or", "scan", "code", ")", "." ]
python
train
39.206897
CitrineInformatics/pypif
pypif/pif.py
https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L8-L16
def dump(pif, fp, **kwargs): """ Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file. :param pif: Object or list of objects to serialize. :param fp: File-like object supporting .write() method to write the serialized object(s) to. :param kwargs: An...
[ "def", "dump", "(", "pif", ",", "fp", ",", "*", "*", "kwargs", ")", ":", "return", "json", ".", "dump", "(", "pif", ",", "fp", ",", "cls", "=", "PifEncoder", ",", "*", "*", "kwargs", ")" ]
Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file. :param pif: Object or list of objects to serialize. :param fp: File-like object supporting .write() method to write the serialized object(s) to. :param kwargs: Any options available to json.dump().
[ "Convert", "a", "single", "Physical", "Information", "Object", "or", "a", "list", "of", "such", "objects", "into", "a", "JSON", "-", "encoded", "text", "file", "." ]
python
train
45.666667
hydraplatform/hydra-base
hydra_base/lib/units.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/units.py#L292-L303
def get_unit_by_abbreviation(unit_abbreviation, **kwargs): """ Returns a single unit by abbreviation. Used as utility function to resolve string to id """ try: if unit_abbreviation is None: unit_abbreviation = '' unit_i = db.DBSession.query(Unit).filter(Unit.abbreviation=...
[ "def", "get_unit_by_abbreviation", "(", "unit_abbreviation", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "unit_abbreviation", "is", "None", ":", "unit_abbreviation", "=", "''", "unit_i", "=", "db", ".", "DBSession", ".", "query", "(", "Unit", ")", ...
Returns a single unit by abbreviation. Used as utility function to resolve string to id
[ "Returns", "a", "single", "unit", "by", "abbreviation", ".", "Used", "as", "utility", "function", "to", "resolve", "string", "to", "id" ]
python
train
43.333333
fusionbox/django-pyscss
django_pyscss/extension/django.py
https://github.com/fusionbox/django-pyscss/blob/8baf1e9c78af733d60299c4444c81501e733b434/django_pyscss/extension/django.py#L17-L47
def handle_import(self, name, compilation, rule): """ Re-implementation of the core Sass import mechanism, which looks for files using the staticfiles storage and staticfiles finders. """ original_path = PurePath(name) search_exts = list(compilation.compiler.dynamic_exte...
[ "def", "handle_import", "(", "self", ",", "name", ",", "compilation", ",", "rule", ")", ":", "original_path", "=", "PurePath", "(", "name", ")", "search_exts", "=", "list", "(", "compilation", ".", "compiler", ".", "dynamic_extensions", ")", "if", "original_...
Re-implementation of the core Sass import mechanism, which looks for files using the staticfiles storage and staticfiles finders.
[ "Re", "-", "implementation", "of", "the", "core", "Sass", "import", "mechanism", "which", "looks", "for", "files", "using", "the", "staticfiles", "storage", "and", "staticfiles", "finders", "." ]
python
train
41.129032
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L68-L95
def DefaultEnvironment(*args, **kw): """ Initial public entry point for creating the default construction Environment. After creating the environment, we overwrite our name (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, which more efficiently returns the initialized default...
[ "def", "DefaultEnvironment", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "global", "_default_env", "if", "not", "_default_env", ":", "import", "SCons", ".", "Util", "_default_env", "=", "SCons", ".", "Environment", ".", "Environment", "(", "*", "args"...
Initial public entry point for creating the default construction Environment. After creating the environment, we overwrite our name (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, which more efficiently returns the initialized default construction environment without checking fo...
[ "Initial", "public", "entry", "point", "for", "creating", "the", "default", "construction", "Environment", "." ]
python
train
40.535714
ambitioninc/django-query-builder
querybuilder/query.py
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/query.py#L103-L119
def set_left_table(self, left_table=None): """ Sets the left table for this join clause. If no table is specified, the first table in the query will be used :type left_table: str or dict or :class:`Table <querybuilder.tables.Table>` or None :param left_table: The left table bein...
[ "def", "set_left_table", "(", "self", ",", "left_table", "=", "None", ")", ":", "if", "left_table", ":", "self", ".", "left_table", "=", "TableFactory", "(", "table", "=", "left_table", ",", "owner", "=", "self", ".", "owner", ",", ")", "else", ":", "s...
Sets the left table for this join clause. If no table is specified, the first table in the query will be used :type left_table: str or dict or :class:`Table <querybuilder.tables.Table>` or None :param left_table: The left table being joined with. This can be a string of the table na...
[ "Sets", "the", "left", "table", "for", "this", "join", "clause", ".", "If", "no", "table", "is", "specified", "the", "first", "table", "in", "the", "query", "will", "be", "used" ]
python
train
41.411765
googleapis/google-cloud-python
core/google/cloud/_helpers.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/core/google/cloud/_helpers.py#L324-L341
def _datetime_to_rfc3339(value, ignore_zone=True): """Convert a timestamp to a string. :type value: :class:`datetime.datetime` :param value: The datetime object to be converted to a string. :type ignore_zone: bool :param ignore_zone: If True, then the timezone (if any) of the datetime ...
[ "def", "_datetime_to_rfc3339", "(", "value", ",", "ignore_zone", "=", "True", ")", ":", "if", "not", "ignore_zone", "and", "value", ".", "tzinfo", "is", "not", "None", ":", "# Convert to UTC and remove the time zone info.", "value", "=", "value", ".", "replace", ...
Convert a timestamp to a string. :type value: :class:`datetime.datetime` :param value: The datetime object to be converted to a string. :type ignore_zone: bool :param ignore_zone: If True, then the timezone (if any) of the datetime object is ignored. :rtype: str :retur...
[ "Convert", "a", "timestamp", "to", "a", "string", "." ]
python
train
35.111111
icometrix/dicom2nifti
dicom2nifti/convert_dir.py
https://github.com/icometrix/dicom2nifti/blob/1462ae5dd979fa3f276fe7a78ceb9b028121536f/dicom2nifti/convert_dir.py#L102-L130
def _is_valid_imaging_dicom(dicom_header): """ Function will do some basic checks to see if this is a valid imaging dicom """ # if it is philips and multiframe dicom then we assume it is ok try: if common.is_philips([dicom_header]): if common.is_multiframe_dicom([dicom_header]): ...
[ "def", "_is_valid_imaging_dicom", "(", "dicom_header", ")", ":", "# if it is philips and multiframe dicom then we assume it is ok", "try", ":", "if", "common", ".", "is_philips", "(", "[", "dicom_header", "]", ")", ":", "if", "common", ".", "is_multiframe_dicom", "(", ...
Function will do some basic checks to see if this is a valid imaging dicom
[ "Function", "will", "do", "some", "basic", "checks", "to", "see", "if", "this", "is", "a", "valid", "imaging", "dicom" ]
python
train
33.448276
Robpol86/libnl
libnl/msg.py
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/msg.py#L296-L318
def nlmsg_reserve(n, len_, pad): """Reserve room for additional data in a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L407 Reserves room for additional data at the tail of the an existing netlink message. Eventual padding required will be zeroed out. bytearray_ptr...
[ "def", "nlmsg_reserve", "(", "n", ",", "len_", ",", "pad", ")", ":", "nlmsg_len_", "=", "n", ".", "nm_nlh", ".", "nlmsg_len", "tlen", "=", "len_", "if", "not", "pad", "else", "(", "(", "len_", "+", "(", "pad", "-", "1", ")", ")", "&", "~", "(",...
Reserve room for additional data in a Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L407 Reserves room for additional data at the tail of the an existing netlink message. Eventual padding required will be zeroed out. bytearray_ptr() at the start of additional data or No...
[ "Reserve", "room", "for", "additional", "data", "in", "a", "Netlink", "message", "." ]
python
train
36.130435
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L3070-L3084
def sis_metadata(self): """Return Olympus SIS metadata from SIS and INI tags as dict.""" if not self.is_sis: return None tags = self.pages[0].tags result = {} try: result.update(tags['OlympusINI'].value) except Exception: pass t...
[ "def", "sis_metadata", "(", "self", ")", ":", "if", "not", "self", ".", "is_sis", ":", "return", "None", "tags", "=", "self", ".", "pages", "[", "0", "]", ".", "tags", "result", "=", "{", "}", "try", ":", "result", ".", "update", "(", "tags", "["...
Return Olympus SIS metadata from SIS and INI tags as dict.
[ "Return", "Olympus", "SIS", "metadata", "from", "SIS", "and", "INI", "tags", "as", "dict", "." ]
python
train
28.4
omza/azurestoragewrap
azurestoragewrap/queue.py
https://github.com/omza/azurestoragewrap/blob/976878e95d82ff0f7d8a00a5e4a7a3fb6268ab08/azurestoragewrap/queue.py#L251-L273
def unregister_model(self, storagemodel:object, modeldefinition = None, delete_queue=False): """ clear up an Queueservice for an StorageQueueModel in your Azure Storage Account Will delete the hole Queue if delete_queue Flag is True! required Parameter is: - storag...
[ "def", "unregister_model", "(", "self", ",", "storagemodel", ":", "object", ",", "modeldefinition", "=", "None", ",", "delete_queue", "=", "False", ")", ":", "\"\"\" remove from modeldefinitions \"\"\"", "for", "i", "in", "range", "(", "len", "(", "self", ".", ...
clear up an Queueservice for an StorageQueueModel in your Azure Storage Account Will delete the hole Queue if delete_queue Flag is True! required Parameter is: - storagemodel: StorageQueueModel(Object) Optional Parameter is: - delete_queue: bool
[ "clear", "up", "an", "Queueservice", "for", "an", "StorageQueueModel", "in", "your", "Azure", "Storage", "Account", "Will", "delete", "the", "hole", "Queue", "if", "delete_queue", "Flag", "is", "True!", "required", "Parameter", "is", ":", "-", "storagemodel", ...
python
train
43.956522
ndokter/dsmr_parser
dsmr_parser/clients/protocol.py
https://github.com/ndokter/dsmr_parser/blob/c04b0a5add58ce70153eede1a87ca171876b61c7/dsmr_parser/clients/protocol.py#L81-L88
def data_received(self, data): """Add incoming data to buffer.""" data = data.decode('ascii') self.log.debug('received data: %s', data) self.telegram_buffer.append(data) for telegram in self.telegram_buffer.get_all(): self.handle_telegram(telegram)
[ "def", "data_received", "(", "self", ",", "data", ")", ":", "data", "=", "data", ".", "decode", "(", "'ascii'", ")", "self", ".", "log", ".", "debug", "(", "'received data: %s'", ",", "data", ")", "self", ".", "telegram_buffer", ".", "append", "(", "da...
Add incoming data to buffer.
[ "Add", "incoming", "data", "to", "buffer", "." ]
python
test
36.75
blockstack/blockstack-core
blockstack/lib/atlas.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L550-L562
def atlasdb_open( path ): """ Open the atlas db. Return a connection. Return None if it doesn't exist """ if not os.path.exists(path): log.debug("Atlas DB doesn't exist at %s" % path) return None con = sqlite3.connect( path, isolation_level=None ) con.row_factory = atlas...
[ "def", "atlasdb_open", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "log", ".", "debug", "(", "\"Atlas DB doesn't exist at %s\"", "%", "path", ")", "return", "None", "con", "=", "sqlite3", ".", "connect", ...
Open the atlas db. Return a connection. Return None if it doesn't exist
[ "Open", "the", "atlas", "db", ".", "Return", "a", "connection", ".", "Return", "None", "if", "it", "doesn", "t", "exist" ]
python
train
25.923077
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L499-L515
def validate(self): """ validate whether value in config file is correct. """ spec = self._create_specs() # support in future functions = {} validator = validate.Validator(functions=functions) self.config.configspec = spec result = self.config....
[ "def", "validate", "(", "self", ")", ":", "spec", "=", "self", ".", "_create_specs", "(", ")", "# support in future", "functions", "=", "{", "}", "validator", "=", "validate", ".", "Validator", "(", "functions", "=", "functions", ")", "self", ".", "config"...
validate whether value in config file is correct.
[ "validate", "whether", "value", "in", "config", "file", "is", "correct", "." ]
python
train
24.058824
scanny/python-pptx
pptx/shapes/shapetree.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/shapes/shapetree.py#L494-L507
def add_table(self, rows, cols, left, top, width, height): """ Add a |GraphicFrame| object containing a table with the specified number of *rows* and *cols* and the specified position and size. *width* is evenly distributed between the columns of the new table. Likewise, *height*...
[ "def", "add_table", "(", "self", ",", "rows", ",", "cols", ",", "left", ",", "top", ",", "width", ",", "height", ")", ":", "graphicFrame", "=", "self", ".", "_add_graphicFrame_containing_table", "(", "rows", ",", "cols", ",", "left", ",", "top", ",", "...
Add a |GraphicFrame| object containing a table with the specified number of *rows* and *cols* and the specified position and size. *width* is evenly distributed between the columns of the new table. Likewise, *height* is evenly distributed between the rows. Note that the ``.table`` prope...
[ "Add", "a", "|GraphicFrame|", "object", "containing", "a", "table", "with", "the", "specified", "number", "of", "*", "rows", "*", "and", "*", "cols", "*", "and", "the", "specified", "position", "and", "size", ".", "*", "width", "*", "is", "evenly", "dist...
python
train
50.571429
cisco-sas/kitty
kitty/model/low_level/encoder.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/encoder.py#L46-L56
def strToBytes(value): ''' :type value: ``str`` :param value: value to encode ''' kassert.is_of_types(value, (bytes, bytearray, six.string_types)) if isinstance(value, six.string_types): return bytes(bytearray([ord(x) for x in value])) elif isinstance(value, bytearray): retur...
[ "def", "strToBytes", "(", "value", ")", ":", "kassert", ".", "is_of_types", "(", "value", ",", "(", "bytes", ",", "bytearray", ",", "six", ".", "string_types", ")", ")", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "retu...
:type value: ``str`` :param value: value to encode
[ ":", "type", "value", ":", "str", ":", "param", "value", ":", "value", "to", "encode" ]
python
train
31
mikedh/trimesh
trimesh/path/path.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/path.py#L540-L555
def replace_vertex_references(self, mask): """ Replace the vertex index references in every entity. Parameters ------------ mask : (len(self.vertices), ) int Contains new vertex indexes Alters ------------ entity.points in self.entities ...
[ "def", "replace_vertex_references", "(", "self", ",", "mask", ")", ":", "for", "entity", "in", "self", ".", "entities", ":", "entity", ".", "points", "=", "mask", "[", "entity", ".", "points", "]" ]
Replace the vertex index references in every entity. Parameters ------------ mask : (len(self.vertices), ) int Contains new vertex indexes Alters ------------ entity.points in self.entities Replaced by mask[entity.points]
[ "Replace", "the", "vertex", "index", "references", "in", "every", "entity", "." ]
python
train
27.25
standage/tag
tag/feature.py
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/feature.py#L425-L466
def add_attribute(self, attrkey, attrvalue, append=False, oldvalue=None): """ Add an attribute to this feature. Feature attributes are stored as nested dictionaries. Each feature can only have one ID, so ID attribute mapping is 'string' to 'string'. All other attributes can hav...
[ "def", "add_attribute", "(", "self", ",", "attrkey", ",", "attrvalue", ",", "append", "=", "False", ",", "oldvalue", "=", "None", ")", ":", "# Handle ID/Parent relationships", "if", "attrkey", "==", "'ID'", ":", "if", "self", ".", "children", "is", "not", ...
Add an attribute to this feature. Feature attributes are stored as nested dictionaries. Each feature can only have one ID, so ID attribute mapping is 'string' to 'string'. All other attributes can have multiple values, so mapping is 'string' to 'dict of strings'. By default, a...
[ "Add", "an", "attribute", "to", "this", "feature", "." ]
python
train
45.452381
eyurtsev/FlowCytometryTools
setup.py
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/setup.py#L13-L26
def get_package_version(path): '''Extracts the version''' with open(VERSION_FILE, "rt") as f: verstrline = f.read() VERSION = r"^version = ['\"]([^'\"]*)['\"]" results = re.search(VERSION, verstrline, re.M) if results: version = results.group(1) else: raise RuntimeError...
[ "def", "get_package_version", "(", "path", ")", ":", "with", "open", "(", "VERSION_FILE", ",", "\"rt\"", ")", "as", "f", ":", "verstrline", "=", "f", ".", "read", "(", ")", "VERSION", "=", "r\"^version = ['\\\"]([^'\\\"]*)['\\\"]\"", "results", "=", "re", "....
Extracts the version
[ "Extracts", "the", "version" ]
python
train
27.142857
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/job.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/job.py#L2593-L2606
def total_bytes_billed(self): """Return total bytes billed from job statistics, if present. See: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.totalBytesBilled :rtype: int or None :returns: total bytes processed by the job, or None if job is not...
[ "def", "total_bytes_billed", "(", "self", ")", ":", "result", "=", "self", ".", "_job_statistics", "(", ")", ".", "get", "(", "\"totalBytesBilled\"", ")", "if", "result", "is", "not", "None", ":", "result", "=", "int", "(", "result", ")", "return", "resu...
Return total bytes billed from job statistics, if present. See: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.totalBytesBilled :rtype: int or None :returns: total bytes processed by the job, or None if job is not yet complete.
[ "Return", "total", "bytes", "billed", "from", "job", "statistics", "if", "present", "." ]
python
train
35.785714
opendatateam/udata
udata/commands/__init__.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/commands/__init__.py#L117-L120
def formatException(self, ei): '''Indent traceback info for better readability''' out = super(CliFormatter, self).formatException(ei) return b'│' + format_multiline(out)
[ "def", "formatException", "(", "self", ",", "ei", ")", ":", "out", "=", "super", "(", "CliFormatter", ",", "self", ")", ".", "formatException", "(", "ei", ")", "return", "b'│' +", "f", "rmat_multiline(o", "u", "t)", "" ]
Indent traceback info for better readability
[ "Indent", "traceback", "info", "for", "better", "readability" ]
python
train
47.5
ska-sa/katcp-python
katcp/sampling.py
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L41-L59
def update_in_ioloop(update): """Decorator that ensures an update() method is run in the tornado ioloop. Does this by checking the thread identity. Requires that the object to which the method is bound has the attributes :attr:`_ioloop_thread_id` (the result of thread.get_ident() in the ioloop thread) ...
[ "def", "update_in_ioloop", "(", "update", ")", ":", "@", "wraps", "(", "update", ")", "def", "wrapped_update", "(", "self", ",", "sensor", ",", "reading", ")", ":", "if", "get_thread_ident", "(", ")", "==", "self", ".", "_ioloop_thread_id", ":", "update", ...
Decorator that ensures an update() method is run in the tornado ioloop. Does this by checking the thread identity. Requires that the object to which the method is bound has the attributes :attr:`_ioloop_thread_id` (the result of thread.get_ident() in the ioloop thread) and :attr:`ioloop` (the ioloop in...
[ "Decorator", "that", "ensures", "an", "update", "()", "method", "is", "run", "in", "the", "tornado", "ioloop", "." ]
python
train
37.736842
computational-metabolomics/msp2db
msp2db/parse.py
https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/parse.py#L321-L356
def _store_compound_info(self): """Update the compound_info dictionary with the current chunk of compound details Note that we use the inchikey as unique identifier. If we can't find an appropiate inchikey we just use a random string (uuid4) suffixed with UNKNOWN """ other_name_...
[ "def", "_store_compound_info", "(", "self", ")", ":", "other_name_l", "=", "[", "name", "for", "name", "in", "self", ".", "other_names", "if", "name", "!=", "self", ".", "compound_info", "[", "'name'", "]", "]", "self", ".", "compound_info", "[", "'other_n...
Update the compound_info dictionary with the current chunk of compound details Note that we use the inchikey as unique identifier. If we can't find an appropiate inchikey we just use a random string (uuid4) suffixed with UNKNOWN
[ "Update", "the", "compound_info", "dictionary", "with", "the", "current", "chunk", "of", "compound", "details" ]
python
train
47.083333
RRZE-HPC/kerncraft
kerncraft/kernel.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L873-L902
def _get_offsets(self, aref, dim=0): """ Return a tuple of offsets of an ArrayRef object in all dimensions. The index order is right to left (c-code order). e.g. c[i+1][j-2] -> (-2, +1) If aref is actually a c_ast.ID, None will be returned. """ if isinstance(are...
[ "def", "_get_offsets", "(", "self", ",", "aref", ",", "dim", "=", "0", ")", ":", "if", "isinstance", "(", "aref", ",", "c_ast", ".", "ID", ")", ":", "return", "None", "# Check for restrictions", "assert", "type", "(", "aref", ".", "name", ")", "in", ...
Return a tuple of offsets of an ArrayRef object in all dimensions. The index order is right to left (c-code order). e.g. c[i+1][j-2] -> (-2, +1) If aref is actually a c_ast.ID, None will be returned.
[ "Return", "a", "tuple", "of", "offsets", "of", "an", "ArrayRef", "object", "in", "all", "dimensions", "." ]
python
test
37.2
saltstack/salt
salt/utils/roster_matcher.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L92-L97
def ret_list_minions(self): ''' Return minions that match via list ''' tgt = _tgt_set(self.tgt) return self._ret_minions(tgt.intersection)
[ "def", "ret_list_minions", "(", "self", ")", ":", "tgt", "=", "_tgt_set", "(", "self", ".", "tgt", ")", "return", "self", ".", "_ret_minions", "(", "tgt", ".", "intersection", ")" ]
Return minions that match via list
[ "Return", "minions", "that", "match", "via", "list" ]
python
train
28.833333
UAVCAN/pyuavcan
uavcan/app/node_monitor.py
https://github.com/UAVCAN/pyuavcan/blob/a06a9975c1c0de4f1d469f05b29b374332968e2b/uavcan/app/node_monitor.py#L135-L142
def find_all(self, predicate): """Returns a generator that produces a sequence of Entry objects for which the predicate returned True. Args: predicate: A callable that returns a value coercible to bool. """ for _nid, entry in self._registry.items(): if predicate(...
[ "def", "find_all", "(", "self", ",", "predicate", ")", ":", "for", "_nid", ",", "entry", "in", "self", ".", "_registry", ".", "items", "(", ")", ":", "if", "predicate", "(", "entry", ")", ":", "yield", "entry" ]
Returns a generator that produces a sequence of Entry objects for which the predicate returned True. Args: predicate: A callable that returns a value coercible to bool.
[ "Returns", "a", "generator", "that", "produces", "a", "sequence", "of", "Entry", "objects", "for", "which", "the", "predicate", "returned", "True", ".", "Args", ":", "predicate", ":", "A", "callable", "that", "returns", "a", "value", "coercible", "to", "bool...
python
train
43.5
eventable/vobject
docs/build/lib/vobject/icalendar.py
https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1443-L1459
def transformFromNative(cls, obj): """ Convert the list of tuples in obj.value to strings. """ if obj.isNative: obj.isNative = False transformed = [] for tup in obj.value: transformed.append(periodToString(tup, cls.forceUTC)) ...
[ "def", "transformFromNative", "(", "cls", ",", "obj", ")", ":", "if", "obj", ".", "isNative", ":", "obj", ".", "isNative", "=", "False", "transformed", "=", "[", "]", "for", "tup", "in", "obj", ".", "value", ":", "transformed", ".", "append", "(", "p...
Convert the list of tuples in obj.value to strings.
[ "Convert", "the", "list", "of", "tuples", "in", "obj", ".", "value", "to", "strings", "." ]
python
train
33.411765
Chilipp/psy-simple
psy_simple/plotters.py
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plotters.py#L3365-L3374
def cell_nodes_x(self): """The unstructured x-boundaries with shape (N, m) where m > 2""" decoder = self.decoder xcoord = self.xcoord data = self.data xbounds = decoder.get_cell_node_coord( data, coords=data.coords, axis='x') if self.plotter.convert_radian: ...
[ "def", "cell_nodes_x", "(", "self", ")", ":", "decoder", "=", "self", ".", "decoder", "xcoord", "=", "self", ".", "xcoord", "data", "=", "self", ".", "data", "xbounds", "=", "decoder", ".", "get_cell_node_coord", "(", "data", ",", "coords", "=", "data", ...
The unstructured x-boundaries with shape (N, m) where m > 2
[ "The", "unstructured", "x", "-", "boundaries", "with", "shape", "(", "N", "m", ")", "where", "m", ">", "2" ]
python
train
40.1
DataBiosphere/dsub
dsub/commands/dsub.py
https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/commands/dsub.py#L789-L807
def _retry_task(provider, job_descriptor, task_id, task_attempt): """Retry task_id (numeric id) assigning it task_attempt.""" td_orig = job_descriptor.find_task_descriptor(task_id) new_task_descriptors = [ job_model.TaskDescriptor({ 'task-id': task_id, 'task-attempt': task_attempt ...
[ "def", "_retry_task", "(", "provider", ",", "job_descriptor", ",", "task_id", ",", "task_attempt", ")", ":", "td_orig", "=", "job_descriptor", ".", "find_task_descriptor", "(", "task_id", ")", "new_task_descriptors", "=", "[", "job_model", ".", "TaskDescriptor", "...
Retry task_id (numeric id) assigning it task_attempt.
[ "Retry", "task_id", "(", "numeric", "id", ")", "assigning", "it", "task_attempt", "." ]
python
valid
37.263158
SuperCowPowers/workbench
workbench/clients/pcap_report.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/clients/pcap_report.py#L60-L66
def show_files(md5): '''Renders template with `view` of the md5.''' if not WORKBENCH: return flask.redirect('/') md5_view = WORKBENCH.work_request('view', md5) return flask.render_template('templates/md5_view.html', md5_view=md5_view['view'], md5=md5)
[ "def", "show_files", "(", "md5", ")", ":", "if", "not", "WORKBENCH", ":", "return", "flask", ".", "redirect", "(", "'/'", ")", "md5_view", "=", "WORKBENCH", ".", "work_request", "(", "'view'", ",", "md5", ")", "return", "flask", ".", "render_template", "...
Renders template with `view` of the md5.
[ "Renders", "template", "with", "view", "of", "the", "md5", "." ]
python
train
38.571429
crgwbr/asymmetric-jwt-auth
src/asymmetric_jwt_auth/token.py
https://github.com/crgwbr/asymmetric-jwt-auth/blob/eae1a6474b6141edce4d6be2dc1746e18bbf5318/src/asymmetric_jwt_auth/token.py#L60-L96
def verify(token, public_key, validate_nonce=None, algorithms=[DEFAULT_ALGORITHM]): """ Verify the validity of the given JWT using the given public key. :param token: JWM claim :param public_key: Public key to use when verifying the claim's signature. :param validate_nonce: Callable to use to valid...
[ "def", "verify", "(", "token", ",", "public_key", ",", "validate_nonce", "=", "None", ",", "algorithms", "=", "[", "DEFAULT_ALGORITHM", "]", ")", ":", "try", ":", "token_data", "=", "jwt", ".", "decode", "(", "token", ",", "public_key", ",", "algorithms", ...
Verify the validity of the given JWT using the given public key. :param token: JWM claim :param public_key: Public key to use when verifying the claim's signature. :param validate_nonce: Callable to use to validate the claim's nonce. :param algorithms: Allowable signing algorithms. Defaults to ['RS512'...
[ "Verify", "the", "validity", "of", "the", "given", "JWT", "using", "the", "given", "public", "key", "." ]
python
train
41.162162
huggingface/pytorch-pretrained-BERT
pytorch_pretrained_bert/modeling_transfo_xl_utilities.py
https://github.com/huggingface/pytorch-pretrained-BERT/blob/b832d5bb8a6dfc5965015b828e577677eace601e/pytorch_pretrained_bert/modeling_transfo_xl_utilities.py#L281-L300
def sample(self, labels): """ labels: [b1, b2] Return true_log_probs: [b1, b2] samp_log_probs: [n_sample] neg_samples: [n_sample] """ # neg_samples = torch.empty(0).long() n_sample = self.n_sample n_tries = 2 * n_sample ...
[ "def", "sample", "(", "self", ",", "labels", ")", ":", "# neg_samples = torch.empty(0).long()", "n_sample", "=", "self", ".", "n_sample", "n_tries", "=", "2", "*", "n_sample", "with", "torch", ".", "no_grad", "(", ")", ":", "neg_samples", "=", "torch", ".", ...
labels: [b1, b2] Return true_log_probs: [b1, b2] samp_log_probs: [n_sample] neg_samples: [n_sample]
[ "labels", ":", "[", "b1", "b2", "]", "Return", "true_log_probs", ":", "[", "b1", "b2", "]", "samp_log_probs", ":", "[", "n_sample", "]", "neg_samples", ":", "[", "n_sample", "]" ]
python
train
34.45
CEA-COSMIC/ModOpt
modopt/base/observable.py
https://github.com/CEA-COSMIC/ModOpt/blob/019b189cb897cbb4d210c44a100daaa08468830c/modopt/base/observable.py#L168-L181
def _remove_observer(self, signal, observer): """Remove an observer to a valid signal. Parameters ---------- signal : str a valid signal. observer : @func an obervation function to be removed. """ if observer in self._observers[signal]: ...
[ "def", "_remove_observer", "(", "self", ",", "signal", ",", "observer", ")", ":", "if", "observer", "in", "self", ".", "_observers", "[", "signal", "]", ":", "self", ".", "_observers", "[", "signal", "]", ".", "remove", "(", "observer", ")" ]
Remove an observer to a valid signal. Parameters ---------- signal : str a valid signal. observer : @func an obervation function to be removed.
[ "Remove", "an", "observer", "to", "a", "valid", "signal", "." ]
python
train
25.642857
yougov/pmxbot
pmxbot/commands.py
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/commands.py#L774-L780
def progress(rest): "Display the progress of something: start|end|percent" if rest: left, right, amount = [piece.strip() for piece in rest.split('|')] ticks = min(int(round(float(amount) / 10)), 10) bar = "=" * ticks return "%s [%-10s] %s" % (left, bar, right)
[ "def", "progress", "(", "rest", ")", ":", "if", "rest", ":", "left", ",", "right", ",", "amount", "=", "[", "piece", ".", "strip", "(", ")", "for", "piece", "in", "rest", ".", "split", "(", "'|'", ")", "]", "ticks", "=", "min", "(", "int", "(",...
Display the progress of something: start|end|percent
[ "Display", "the", "progress", "of", "something", ":", "start|end|percent" ]
python
train
37.714286
drj11/pypng
code/iccp.py
https://github.com/drj11/pypng/blob/b8220ca9f58e4c5bc1d507e713744fcb8c049225/code/iccp.py#L137-L145
def _addTags(self, **k): """Helper for :meth:`addTags`.""" for tag, thing in k.items(): if not isinstance(thing, (tuple, list)): thing = (thing,) typetag = defaulttagtype[tag] self.rawtagdict[tag] = encode(typetag, *thing) return self
[ "def", "_addTags", "(", "self", ",", "*", "*", "k", ")", ":", "for", "tag", ",", "thing", "in", "k", ".", "items", "(", ")", ":", "if", "not", "isinstance", "(", "thing", ",", "(", "tuple", ",", "list", ")", ")", ":", "thing", "=", "(", "thin...
Helper for :meth:`addTags`.
[ "Helper", "for", ":", "meth", ":", "addTags", "." ]
python
train
33.666667
consbio/ncdjango
ncdjango/views.py
https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/views.py#L128-L133
def get_grid_spatial_dimensions(self, variable): """Returns (width, height) for the given variable""" data = self.open_dataset(self.service).variables[variable.variable] dimensions = list(data.dimensions) return data.shape[dimensions.index(variable.x_dimension)], data.shape[dimensions.i...
[ "def", "get_grid_spatial_dimensions", "(", "self", ",", "variable", ")", ":", "data", "=", "self", ".", "open_dataset", "(", "self", ".", "service", ")", ".", "variables", "[", "variable", ".", "variable", "]", "dimensions", "=", "list", "(", "data", ".", ...
Returns (width, height) for the given variable
[ "Returns", "(", "width", "height", ")", "for", "the", "given", "variable" ]
python
train
57
Tenchi2xh/Almonds
almonds/utils.py
https://github.com/Tenchi2xh/Almonds/blob/6b27024729f055f2cb5e14ae3ca3cb428ae054bc/almonds/utils.py#L8-L19
def clamp(n, lower, upper): """ Restricts the given number to a lower and upper bound (inclusive) :param n: input number :param lower: lower bound (inclusive) :param upper: upper bound (inclusive) :return: clamped number """ if lower > upper: lower, upper = upper, lower...
[ "def", "clamp", "(", "n", ",", "lower", ",", "upper", ")", ":", "if", "lower", ">", "upper", ":", "lower", ",", "upper", "=", "upper", ",", "lower", "return", "max", "(", "min", "(", "upper", ",", "n", ")", ",", "lower", ")" ]
Restricts the given number to a lower and upper bound (inclusive) :param n: input number :param lower: lower bound (inclusive) :param upper: upper bound (inclusive) :return: clamped number
[ "Restricts", "the", "given", "number", "to", "a", "lower", "and", "upper", "bound", "(", "inclusive", ")" ]
python
train
28.833333
nprapps/copydoc
copydoc.py
https://github.com/nprapps/copydoc/blob/e1ab09b287beb0439748c319cf165cbc06c66624/copydoc.py#L89-L104
def check_next(self, tag): """ If next tag is link with same href, combine them. """ if (type(tag.next_sibling) == element.Tag and tag.next_sibling.name == 'a'): next_tag = tag.next_sibling if tag.get('href') and next_tag.get('href'): ...
[ "def", "check_next", "(", "self", ",", "tag", ")", ":", "if", "(", "type", "(", "tag", ".", "next_sibling", ")", "==", "element", ".", "Tag", "and", "tag", ".", "next_sibling", ".", "name", "==", "'a'", ")", ":", "next_tag", "=", "tag", ".", "next_...
If next tag is link with same href, combine them.
[ "If", "next", "tag", "is", "link", "with", "same", "href", "combine", "them", "." ]
python
test
37.875
saltstack/salt
salt/modules/aptly.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L720-L754
def get_snapshot(name, config_path=_DEFAULT_CONFIG_PATH, with_packages=False): ''' Get detailed information about a snapshot. :param str name: The name of the snapshot given during snapshot creation. :param str config_path: The path to the configuration file for the aptly instance. :param bool with...
[ "def", "get_snapshot", "(", "name", ",", "config_path", "=", "_DEFAULT_CONFIG_PATH", ",", "with_packages", "=", "False", ")", ":", "_validate_config", "(", "config_path", ")", "sources", "=", "list", "(", ")", "cmd", "=", "[", "'snapshot'", ",", "'show'", ",...
Get detailed information about a snapshot. :param str name: The name of the snapshot given during snapshot creation. :param str config_path: The path to the configuration file for the aptly instance. :param bool with_packages: Return a list of packages in the snapshot. :return: A dictionary containing...
[ "Get", "detailed", "information", "about", "a", "snapshot", "." ]
python
train
27.257143
google/grr
grr/core/grr_response_core/lib/rdfvalues/client.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/client.py#L77-L98
def ParseFromUnicode(self, value): """Parse a string into a client URN. Convert case so that all URNs are of the form C.[0-9a-f]. Args: value: string value to parse """ precondition.AssertType(value, Text) value = value.strip() super(ClientURN, self).ParseFromUnicode(value) mat...
[ "def", "ParseFromUnicode", "(", "self", ",", "value", ")", ":", "precondition", ".", "AssertType", "(", "value", ",", "Text", ")", "value", "=", "value", ".", "strip", "(", ")", "super", "(", "ClientURN", ",", "self", ")", ".", "ParseFromUnicode", "(", ...
Parse a string into a client URN. Convert case so that all URNs are of the form C.[0-9a-f]. Args: value: string value to parse
[ "Parse", "a", "string", "into", "a", "client", "URN", "." ]
python
train
31.272727
santosjorge/cufflinks
cufflinks/tools.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L623-L640
def merge_figures(figures): """ Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged. """ figure={} data=[] for fig in figures: for trace in fig['data']: data.append(trace) layout=get_base_layout(figures) figure['data']=data ...
[ "def", "merge_figures", "(", "figures", ")", ":", "figure", "=", "{", "}", "data", "=", "[", "]", "for", "fig", "in", "figures", ":", "for", "trace", "in", "fig", "[", "'data'", "]", ":", "data", ".", "append", "(", "trace", ")", "layout", "=", "...
Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged.
[ "Generates", "a", "single", "Figure", "from", "a", "list", "of", "figures" ]
python
train
18.944444
mmoussallam/bird
bird/_bird.py
https://github.com/mmoussallam/bird/blob/1c726e6569db4f3b00804ab7ac063acaa3965987/bird/_bird.py#L111-L196
def _single_multichannel_mp_run(X, Phi, bound, selection_rule, stop_crit, max_iter, verbose=False, pad=0, random_state=None, memory=Memory(None)): """ run of the structured variant of the RSSMP algorithm """ rng = check_random_state(random_state) ...
[ "def", "_single_multichannel_mp_run", "(", "X", ",", "Phi", ",", "bound", ",", "selection_rule", ",", "stop_crit", ",", "max_iter", ",", "verbose", "=", "False", ",", "pad", "=", "0", ",", "random_state", "=", "None", ",", "memory", "=", "Memory", "(", "...
run of the structured variant of the RSSMP algorithm
[ "run", "of", "the", "structured", "variant", "of", "the", "RSSMP", "algorithm" ]
python
train
36.302326
googleapis/google-auth-library-python
google/auth/_helpers.py
https://github.com/googleapis/google-auth-library-python/blob/2c6ad78917e936f38f87c946209c8031166dc96e/google/auth/_helpers.py#L130-L173
def update_query(url, params, remove=None): """Updates a URL's query parameters. Replaces any current values if they are already present in the URL. Args: url (str): The URL to update. params (Mapping[str, str]): A mapping of query parameter keys to values. remove (Sequ...
[ "def", "update_query", "(", "url", ",", "params", ",", "remove", "=", "None", ")", ":", "if", "remove", "is", "None", ":", "remove", "=", "[", "]", "# Split the URL into parts.", "parts", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")", "...
Updates a URL's query parameters. Replaces any current values if they are already present in the URL. Args: url (str): The URL to update. params (Mapping[str, str]): A mapping of query parameter keys to values. remove (Sequence[str]): Parameters to remove from the query str...
[ "Updates", "a", "URL", "s", "query", "parameters", "." ]
python
train
31.318182
avihad/twistes
twistes/client.py
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/client.py#L666-L692
def close(self): """ close all http connections. returns a deferred that fires once they're all closed. """ def validate_client(client): """ Validate that the connection is for the current client :param client: :return: ...
[ "def", "close", "(", "self", ")", ":", "def", "validate_client", "(", "client", ")", ":", "\"\"\"\n Validate that the connection is for the current client\n :param client:\n :return:\n \"\"\"", "host", ",", "port", "=", "client", ".", ...
close all http connections. returns a deferred that fires once they're all closed.
[ "close", "all", "http", "connections", ".", "returns", "a", "deferred", "that", "fires", "once", "they", "re", "all", "closed", "." ]
python
train
35.037037
acutesoftware/AIKIF
aikif/lib/cls_file.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_file.py#L109-L122
def count_lines_in_file(self, fname=''): """ you wont believe what this method does """ i = 0 if fname == '': fname = self.fullname try: #with open(fname, encoding="utf8") as f: with codecs.open(fname, "r",encoding='utf8', errors='ignore') as f: ...
[ "def", "count_lines_in_file", "(", "self", ",", "fname", "=", "''", ")", ":", "i", "=", "0", "if", "fname", "==", "''", ":", "fname", "=", "self", ".", "fullname", "try", ":", "#with open(fname, encoding=\"utf8\") as f:", "with", "codecs", ".", "open", "("...
you wont believe what this method does
[ "you", "wont", "believe", "what", "this", "method", "does" ]
python
train
37.571429
user-cont/colin
colin/core/loader.py
https://github.com/user-cont/colin/blob/00bb80e6e91522e15361935f813e8cf13d7e76dc/colin/core/loader.py#L116-L128
def import_class(self, import_name): """ import selected class :param import_name, str, e.g. some.module.MyClass :return the class """ module_name, class_name = import_name.rsplit(".", 1) mod = import_module(module_name) check_class = getattr(mod, class_n...
[ "def", "import_class", "(", "self", ",", "import_name", ")", ":", "module_name", ",", "class_name", "=", "import_name", ".", "rsplit", "(", "\".\"", ",", "1", ")", "mod", "=", "import_module", "(", "module_name", ")", "check_class", "=", "getattr", "(", "m...
import selected class :param import_name, str, e.g. some.module.MyClass :return the class
[ "import", "selected", "class" ]
python
train
35.153846
django-userena-ce/django-userena-ce
userena/managers.py
https://github.com/django-userena-ce/django-userena-ce/blob/2d8b745eed25128134e961ca96c270802e730256/userena/managers.py#L163-L180
def check_expired_activation(self, activation_key): """ Check if ``activation_key`` is still valid. Raises a ``self.model.DoesNotExist`` exception if key is not present or ``activation_key`` is not a valid string :param activation_key: String containing the secret ...
[ "def", "check_expired_activation", "(", "self", ",", "activation_key", ")", ":", "if", "SHA1_RE", ".", "search", "(", "activation_key", ")", ":", "userena", "=", "self", ".", "get", "(", "activation_key", "=", "activation_key", ")", "return", "userena", ".", ...
Check if ``activation_key`` is still valid. Raises a ``self.model.DoesNotExist`` exception if key is not present or ``activation_key`` is not a valid string :param activation_key: String containing the secret SHA1 for a valid activation. :return: True if the k...
[ "Check", "if", "activation_key", "is", "still", "valid", "." ]
python
train
34.444444
numenta/nupic
src/nupic/swarming/hypersearch/particle.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L270-L295
def initStateFrom(self, particleId, particleState, newBest): """Init all of our variable positions, velocities, and optionally the best result and best position from the given particle. If newBest is true, we get the best result and position for this new generation from the resultsDB, This is used when...
[ "def", "initStateFrom", "(", "self", ",", "particleId", ",", "particleState", ",", "newBest", ")", ":", "# Get the update best position and result?", "if", "newBest", ":", "(", "bestResult", ",", "bestPosition", ")", "=", "self", ".", "_resultsDB", ".", "getPartic...
Init all of our variable positions, velocities, and optionally the best result and best position from the given particle. If newBest is true, we get the best result and position for this new generation from the resultsDB, This is used when evoloving a particle because the bestResult and position as sto...
[ "Init", "all", "of", "our", "variable", "positions", "velocities", "and", "optionally", "the", "best", "result", "and", "best", "position", "from", "the", "given", "particle", "." ]
python
valid
42.846154
PyCQA/pylint
pylint/checkers/utils.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/utils.py#L738-L749
def decorated_with(func: astroid.FunctionDef, qnames: Iterable[str]) -> bool: """Determine if the `func` node has a decorator with the qualified name `qname`.""" decorators = func.decorators.nodes if func.decorators else [] for decorator_node in decorators: try: if any( i...
[ "def", "decorated_with", "(", "func", ":", "astroid", ".", "FunctionDef", ",", "qnames", ":", "Iterable", "[", "str", "]", ")", "->", "bool", ":", "decorators", "=", "func", ".", "decorators", ".", "nodes", "if", "func", ".", "decorators", "else", "[", ...
Determine if the `func` node has a decorator with the qualified name `qname`.
[ "Determine", "if", "the", "func", "node", "has", "a", "decorator", "with", "the", "qualified", "name", "qname", "." ]
python
test
41.416667
blockadeio/analyst_toolbench
blockade/config.py
https://github.com/blockadeio/analyst_toolbench/blob/159b6f8cf8a91c5ff050f1579636ea90ab269863/blockade/config.py#L30-L41
def write_config(self): """Write the configuration to a local file. :return: Boolean if successful """ json.dump( self.config, open(CONFIG_FILE, 'w'), indent=4, separators=(',', ': ') ) return True
[ "def", "write_config", "(", "self", ")", ":", "json", ".", "dump", "(", "self", ".", "config", ",", "open", "(", "CONFIG_FILE", ",", "'w'", ")", ",", "indent", "=", "4", ",", "separators", "=", "(", "','", ",", "': '", ")", ")", "return", "True" ]
Write the configuration to a local file. :return: Boolean if successful
[ "Write", "the", "configuration", "to", "a", "local", "file", "." ]
python
train
23.583333
kovacsbalu/WazeRouteCalculator
WazeRouteCalculator/WazeRouteCalculator.py
https://github.com/kovacsbalu/WazeRouteCalculator/blob/13ddb064571bb2bc0ceec51b5b317640b2bc3fb2/WazeRouteCalculator/WazeRouteCalculator.py#L88-L113
def address_to_coords(self, address): """Convert address to coordinates""" base_coords = self.BASE_COORDS[self.region] get_cord = self.COORD_SERVERS[self.region] url_options = { "q": address, "lang": "eng", "origin": "livemap", "lat": base...
[ "def", "address_to_coords", "(", "self", ",", "address", ")", ":", "base_coords", "=", "self", ".", "BASE_COORDS", "[", "self", ".", "region", "]", "get_cord", "=", "self", ".", "COORD_SERVERS", "[", "self", ".", "region", "]", "url_options", "=", "{", "...
Convert address to coordinates
[ "Convert", "address", "to", "coordinates" ]
python
train
47.038462
hobson/pug-invest
pug/invest/util.py
https://github.com/hobson/pug-invest/blob/836911258a0e920083a88c91beae88eefdebb20c/pug/invest/util.py#L1087-L1172
def hist(table, field=-1, class_column=None, title='', verbosity=2, **kwargs): """Plot discrete PDFs >>> df = pd.DataFrame(pd.np.random.randn(99,3), columns=list('ABC')) >>> df['Class'] = pd.np.array((pd.np.matrix([1,1,1])*pd.np.matrix(df).T).T > 0) >>> len(hist(df, verbosity=0, class_column='...
[ "def", "hist", "(", "table", ",", "field", "=", "-", "1", ",", "class_column", "=", "None", ",", "title", "=", "''", ",", "verbosity", "=", "2", ",", "*", "*", "kwargs", ")", ":", "field", "=", "fuzzy_index_match", "(", "table", ",", "field", ")", ...
Plot discrete PDFs >>> df = pd.DataFrame(pd.np.random.randn(99,3), columns=list('ABC')) >>> df['Class'] = pd.np.array((pd.np.matrix([1,1,1])*pd.np.matrix(df).T).T > 0) >>> len(hist(df, verbosity=0, class_column='Class')) 3
[ "Plot", "discrete", "PDFs" ]
python
train
36.476744
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L1131-L1154
def implicit_includes (self, feature, target_type): """ Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of typ...
[ "def", "implicit_includes", "(", "self", ",", "feature", ",", "target_type", ")", ":", "assert", "isinstance", "(", "feature", ",", "basestring", ")", "assert", "isinstance", "(", "target_type", ",", "basestring", ")", "if", "not", "target_type", ":", "key", ...
Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of type 'target-type' (or for all targets, if 'target_type...
[ "Returns", "the", "properties", "which", "specify", "implicit", "include", "paths", "to", "generated", "headers", ".", "This", "traverses", "all", "targets", "in", "this", "subvariant", "and", "subvariants", "referred", "by", "<implcit", "-", "dependecy", ">", "...
python
train
42.458333
af/turrentine
turrentine/admin.py
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/admin.py#L135-L143
def get_template_names(self): """ Return the page's specified template name, or a fallback if one hasn't been chosen. """ posted_name = self.request.POST.get('template_name') if posted_name: return [posted_name,] else: return super(PagePreviewView,...
[ "def", "get_template_names", "(", "self", ")", ":", "posted_name", "=", "self", ".", "request", ".", "POST", ".", "get", "(", "'template_name'", ")", "if", "posted_name", ":", "return", "[", "posted_name", ",", "]", "else", ":", "return", "super", "(", "...
Return the page's specified template name, or a fallback if one hasn't been chosen.
[ "Return", "the", "page", "s", "specified", "template", "name", "or", "a", "fallback", "if", "one", "hasn", "t", "been", "chosen", "." ]
python
train
37.666667
thombashi/pytablereader
pytablereader/json/core.py
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/core.py#L67-L439
def load(self): """ Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Sc...
[ "def", "load", "(", "self", ")", ":", "formatter", "=", "JsonTableFormatter", "(", "self", ".", "load_dict", "(", ")", ")", "formatter", ".", "accept", "(", "self", ")", "return", "formatter", ".", "to_table_data", "(", ")" ]
Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Schema (1): single table ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "JSON", "file", ".", "|load_source_desc_file|" ]
python
train
35.284182
tensorpack/tensorpack
tensorpack/tfutils/varmanip.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/tfutils/varmanip.py#L214-L238
def is_training_name(name): """ **Guess** if this variable is only used in training. Only used internally to avoid too many logging. Do not use it. """ # TODO: maybe simply check against TRAINABLE_VARIABLES and MODEL_VARIABLES? # TODO or use get_slot_names() name = get_op_tensor_name(name)[0...
[ "def", "is_training_name", "(", "name", ")", ":", "# TODO: maybe simply check against TRAINABLE_VARIABLES and MODEL_VARIABLES?", "# TODO or use get_slot_names()", "name", "=", "get_op_tensor_name", "(", "name", ")", "[", "0", "]", "if", "name", ".", "endswith", "(", "'/Ad...
**Guess** if this variable is only used in training. Only used internally to avoid too many logging. Do not use it.
[ "**", "Guess", "**", "if", "this", "variable", "is", "only", "used", "in", "training", ".", "Only", "used", "internally", "to", "avoid", "too", "many", "logging", ".", "Do", "not", "use", "it", "." ]
python
train
37.28
bitesofcode/projexui
projexui/widgets/xdocktoolbar.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L490-L503
def resizeToMinimum(self): """ Resizes the dock toolbar to the minimum sizes. """ offset = self.padding() min_size = self.minimumPixmapSize() if self.position() in (XDockToolbar.Position.East, XDockToolbar.Position.West): ...
[ "def", "resizeToMinimum", "(", "self", ")", ":", "offset", "=", "self", ".", "padding", "(", ")", "min_size", "=", "self", ".", "minimumPixmapSize", "(", ")", "if", "self", ".", "position", "(", ")", "in", "(", "XDockToolbar", ".", "Position", ".", "Ea...
Resizes the dock toolbar to the minimum sizes.
[ "Resizes", "the", "dock", "toolbar", "to", "the", "minimum", "sizes", "." ]
python
train
41.071429
acoomans/flask-autodoc
flask_autodoc/autodoc.py
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L64-L111
def doc(self, groups=None, set_location=True, **properties): """Add flask route to autodoc for automatic documentation Any route decorated with this method will be added to the list of routes to be documented by the generate() or html() methods. By default, the route is added to the 'a...
[ "def", "doc", "(", "self", ",", "groups", "=", "None", ",", "set_location", "=", "True", ",", "*", "*", "properties", ")", ":", "def", "decorator", "(", "f", ")", ":", "# Get previous group list (if any)", "if", "f", "in", "self", ".", "func_groups", ":"...
Add flask route to autodoc for automatic documentation Any route decorated with this method will be added to the list of routes to be documented by the generate() or html() methods. By default, the route is added to the 'all' group. By specifying group or groups argument, the route can...
[ "Add", "flask", "route", "to", "autodoc", "for", "automatic", "documentation" ]
python
train
39.791667
ARMmbed/icetea
icetea_lib/Reports/ReportJunit.py
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/Reports/ReportJunit.py#L106-L170
def __generate(results): """ Static method which generates the Junit xml string from results :param results: Results as ResultList object. :return: Junit xml format string. """ doc, tag, text = Doc().tagtext() # Counters for testsuite tag info count = 0 ...
[ "def", "__generate", "(", "results", ")", ":", "doc", ",", "tag", ",", "text", "=", "Doc", "(", ")", ".", "tagtext", "(", ")", "# Counters for testsuite tag info", "count", "=", "0", "fails", "=", "0", "errors", "=", "0", "skips", "=", "0", "for", "r...
Static method which generates the Junit xml string from results :param results: Results as ResultList object. :return: Junit xml format string.
[ "Static", "method", "which", "generates", "the", "Junit", "xml", "string", "from", "results" ]
python
train
36.938462
sixty-north/python-transducers
transducer/_util.py
https://github.com/sixty-north/python-transducers/blob/575357e3a17ff3b4c757967afd396bf0ea042c08/transducer/_util.py#L16-L25
def coroutine(func): """Decorator for priming generator-based coroutines. """ @wraps(func) def start(*args, **kwargs): g = func(*args, **kwargs) next(g) return g return start
[ "def", "coroutine", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "start", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "g", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "next", "(", "g", ")", "return",...
Decorator for priming generator-based coroutines.
[ "Decorator", "for", "priming", "generator", "-", "based", "coroutines", "." ]
python
train
21
pgmpy/pgmpy
pgmpy/models/DynamicBayesianNetwork.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/models/DynamicBayesianNetwork.py#L135-L195
def add_edge(self, start, end, **kwargs): """ Add an edge between two nodes. The nodes will be automatically added if they are not present in the network. Parameters ---------- start: tuple Both the start and end nodes should specify the time slice as ...
[ "def", "add_edge", "(", "self", ",", "start", ",", "end", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "len", "(", "start", ")", "!=", "2", "or", "len", "(", "end", ")", "!=", "2", ":", "raise", "ValueError", "(", "'Nodes must be of type (n...
Add an edge between two nodes. The nodes will be automatically added if they are not present in the network. Parameters ---------- start: tuple Both the start and end nodes should specify the time slice as (node_name, time_slice). Here, node_name can be an...
[ "Add", "an", "edge", "between", "two", "nodes", "." ]
python
train
44.754098
xtream1101/web-wrapper
web_wrapper/driver_selenium_chrome.py
https://github.com/xtream1101/web-wrapper/blob/2bfc63caa7d316564088951f01a490db493ea240/web_wrapper/driver_selenium_chrome.py#L88-L97
def reset(self): """ Kills old session and creates a new one with no proxies or headers """ # Kill old connection self.quit() # Clear chrome configs self.opts = webdriver.ChromeOptions() # Create new web driver self._create_session()
[ "def", "reset", "(", "self", ")", ":", "# Kill old connection", "self", ".", "quit", "(", ")", "# Clear chrome configs", "self", ".", "opts", "=", "webdriver", ".", "ChromeOptions", "(", ")", "# Create new web driver", "self", ".", "_create_session", "(", ")" ]
Kills old session and creates a new one with no proxies or headers
[ "Kills", "old", "session", "and", "creates", "a", "new", "one", "with", "no", "proxies", "or", "headers" ]
python
train
29.6
echonest/pyechonest
pyechonest/catalog.py
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/catalog.py#L293-L331
def get_feed(self, buckets=None, since=None, results=15, start=0): """ Returns feed (news, blogs, reviews, audio, video) for the catalog artists; response depends on requested buckets Args: Kwargs: buckets (list): A list of strings specifying which feed items to retrieve ...
[ "def", "get_feed", "(", "self", ",", "buckets", "=", "None", ",", "since", "=", "None", ",", "results", "=", "15", ",", "start", "=", "0", ")", ":", "kwargs", "=", "{", "}", "kwargs", "[", "'bucket'", "]", "=", "buckets", "or", "[", "]", "if", ...
Returns feed (news, blogs, reviews, audio, video) for the catalog artists; response depends on requested buckets Args: Kwargs: buckets (list): A list of strings specifying which feed items to retrieve results (int): An integer number of results to return start (in...
[ "Returns", "feed", "(", "news", "blogs", "reviews", "audio", "video", ")", "for", "the", "catalog", "artists", ";", "response", "depends", "on", "requested", "buckets" ]
python
train
41.487179
aodag/WebDispatch
webdispatch/uritemplate.py
https://github.com/aodag/WebDispatch/blob/55f8658a2b4100498e098a80303a346c3940f1bc/webdispatch/uritemplate.py#L93-L97
def new_named_args(self, cur_named_args: Dict[str, Any]) -> Dict[str, Any]: """ create new named args updating current name args""" named_args = cur_named_args.copy() named_args.update(self.matchdict) return named_args
[ "def", "new_named_args", "(", "self", ",", "cur_named_args", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "named_args", "=", "cur_named_args", ".", "copy", "(", ")", "named_args", ".", "update", "(", ...
create new named args updating current name args
[ "create", "new", "named", "args", "updating", "current", "name", "args" ]
python
train
49.2
bububa/pyTOP
pyTOP/crm.py
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/crm.py#L56-L63
def add(self, group_name, session): '''taobao.crm.group.add 卖家创建一个分组 卖家创建一个新的分组,接口返回一个创建成功的分组的id''' request = TOPRequest('taobao.crm.group.add') request['group_name'] = group_name self.create(self.execute(request, session), fields=['is_success', 'group_id']) retu...
[ "def", "add", "(", "self", ",", "group_name", ",", "session", ")", ":", "request", "=", "TOPRequest", "(", "'taobao.crm.group.add'", ")", "request", "[", "'group_name'", "]", "=", "group_name", "self", ".", "create", "(", "self", ".", "execute", "(", "requ...
taobao.crm.group.add 卖家创建一个分组 卖家创建一个新的分组,接口返回一个创建成功的分组的id
[ "taobao", ".", "crm", ".", "group", ".", "add", "卖家创建一个分组", "卖家创建一个新的分组,接口返回一个创建成功的分组的id" ]
python
train
43.25
davisagli/eye
eye/__init__.py
https://github.com/davisagli/eye/blob/4007b6b490ac667c8423c6cc789b303e93f9d03d/eye/__init__.py#L53-L75
def eye(root=None, zodb_uri=None, port=8080): """Serves a WSGI app to browse objects based on a root object or ZODB URI. """ if root is not None: root_factory = lambda request: Node(root) elif zodb_uri is not None: if '://' not in zodb_uri: # treat it as a file:// ...
[ "def", "eye", "(", "root", "=", "None", ",", "zodb_uri", "=", "None", ",", "port", "=", "8080", ")", ":", "if", "root", "is", "not", "None", ":", "root_factory", "=", "lambda", "request", ":", "Node", "(", "root", ")", "elif", "zodb_uri", "is", "no...
Serves a WSGI app to browse objects based on a root object or ZODB URI.
[ "Serves", "a", "WSGI", "app", "to", "browse", "objects", "based", "on", "a", "root", "object", "or", "ZODB", "URI", "." ]
python
train
37.73913
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py#L120-L175
def ready(ctx, quiet): """Show all the checks that can be released.""" user_config = ctx.obj cached_prs = {} for target in sorted(get_valid_checks()): # get the name of the current release tag cur_version = get_version_string(target) target_tag = get_release_tag_string(target, c...
[ "def", "ready", "(", "ctx", ",", "quiet", ")", ":", "user_config", "=", "ctx", ".", "obj", "cached_prs", "=", "{", "}", "for", "target", "in", "sorted", "(", "get_valid_checks", "(", ")", ")", ":", "# get the name of the current release tag", "cur_version", ...
Show all the checks that can be released.
[ "Show", "all", "the", "checks", "that", "can", "be", "released", "." ]
python
train
38.285714
twisted/mantissa
xmantissa/webtheme.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webtheme.py#L131-L147
def _realGetLoader(n, default=_marker): """ Search all themes for a template named C{n}, returning a loader for it if found. If not found and a default is passed, the default will be returned. Otherwise C{RuntimeError} will be raised. This function is deprecated in favor of using a L{ThemedElement}...
[ "def", "_realGetLoader", "(", "n", ",", "default", "=", "_marker", ")", ":", "for", "t", "in", "getAllThemes", "(", ")", ":", "fact", "=", "t", ".", "getDocFactory", "(", "n", ",", "None", ")", "if", "fact", "is", "not", "None", ":", "return", "fac...
Search all themes for a template named C{n}, returning a loader for it if found. If not found and a default is passed, the default will be returned. Otherwise C{RuntimeError} will be raised. This function is deprecated in favor of using a L{ThemedElement} for your view code, or calling ITemplateNam...
[ "Search", "all", "themes", "for", "a", "template", "named", "C", "{", "n", "}", "returning", "a", "loader", "for", "it", "if", "found", ".", "If", "not", "found", "and", "a", "default", "is", "passed", "the", "default", "will", "be", "returned", ".", ...
python
train
37.058824
PSPC-SPAC-buyandsell/von_anchor
von_anchor/anchor/issuer.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/anchor/issuer.py#L464-L566
async def create_cred( self, cred_offer_json, cred_req_json: str, cred_attrs: dict, rr_size: int = None) -> (str, str): """ Create credential as Issuer out of credential request and dict of key:value (raw, unencoded) entries for attribu...
[ "async", "def", "create_cred", "(", "self", ",", "cred_offer_json", ",", "cred_req_json", ":", "str", ",", "cred_attrs", ":", "dict", ",", "rr_size", ":", "int", "=", "None", ")", "->", "(", "str", ",", "str", ")", ":", "LOGGER", ".", "debug", "(", "...
Create credential as Issuer out of credential request and dict of key:value (raw, unencoded) entries for attributes. Return credential json, and if cred def supports revocation, credential revocation identifier. Raise WalletState for closed wallet. If the credential definition supports...
[ "Create", "credential", "as", "Issuer", "out", "of", "credential", "request", "and", "dict", "of", "key", ":", "value", "(", "raw", "unencoded", ")", "entries", "for", "attributes", "." ]
python
train
47.281553