repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
ayust/kitnirc
kitnirc/client.py
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/client.py#L995-L1002
def _parse_nicknameinuse(client, command, actor, args): """Parse a NICKNAMEINUSE message and dispatch an event. The parameter passed along with the event is the nickname which is already in use. """ nick, _, _ = args.rpartition(" ") client.dispatch_event("NICKNAMEINUSE", nick)
[ "def", "_parse_nicknameinuse", "(", "client", ",", "command", ",", "actor", ",", "args", ")", ":", "nick", ",", "_", ",", "_", "=", "args", ".", "rpartition", "(", "\" \"", ")", "client", ".", "dispatch_event", "(", "\"NICKNAMEINUSE\"", ",", "nick", ")" ...
Parse a NICKNAMEINUSE message and dispatch an event. The parameter passed along with the event is the nickname which is already in use.
[ "Parse", "a", "NICKNAMEINUSE", "message", "and", "dispatch", "an", "event", "." ]
python
train
b3j0f/utils
b3j0f/utils/property.py
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/property.py#L638-L657
def firsts(properties): """ Transform a dictionary of {name: [(elt, value)+]} (resulting from get_properties) to a dictionary of {name, value} where names are first encountered in input properties. :param dict properties: properties to firsts. :return: dictionary of parameter values by ...
[ "def", "firsts", "(", "properties", ")", ":", "result", "=", "{", "}", "# parse elts", "for", "name", "in", "properties", ":", "elt_properties", "=", "properties", "[", "name", "]", "# add property values in result[name]", "result", "[", "name", "]", "=", "elt...
Transform a dictionary of {name: [(elt, value)+]} (resulting from get_properties) to a dictionary of {name, value} where names are first encountered in input properties. :param dict properties: properties to firsts. :return: dictionary of parameter values by names. :rtype: dict
[ "Transform", "a", "dictionary", "of", "{", "name", ":", "[", "(", "elt", "value", ")", "+", "]", "}", "(", "resulting", "from", "get_properties", ")", "to", "a", "dictionary", "of", "{", "name", "value", "}", "where", "names", "are", "first", "encounte...
python
train
xiaocong/uiautomator
uiautomator/__init__.py
https://github.com/xiaocong/uiautomator/blob/9a0c892ffd056713f91aa2153d1533c5b0553a1c/uiautomator/__init__.py#L1090-L1095
def child(self, **kwargs): '''set childSelector.''' return AutomatorDeviceObject( self.device, self.selector.clone().child(**kwargs) )
[ "def", "child", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "AutomatorDeviceObject", "(", "self", ".", "device", ",", "self", ".", "selector", ".", "clone", "(", ")", ".", "child", "(", "*", "*", "kwargs", ")", ")" ]
set childSelector.
[ "set", "childSelector", "." ]
python
train
foremast/foremast
src/foremast/awslambda/awslambda.py
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L118-L134
def _get_sg_ids(self): """Get IDs for all defined security groups. Returns: list: security group IDs for all lambda_extras """ try: lambda_extras = self.settings['security_groups']['lambda_extras'] except KeyError: lambda_extras = [] ...
[ "def", "_get_sg_ids", "(", "self", ")", ":", "try", ":", "lambda_extras", "=", "self", ".", "settings", "[", "'security_groups'", "]", "[", "'lambda_extras'", "]", "except", "KeyError", ":", "lambda_extras", "=", "[", "]", "security_groups", "=", "[", "self"...
Get IDs for all defined security groups. Returns: list: security group IDs for all lambda_extras
[ "Get", "IDs", "for", "all", "defined", "security", "groups", "." ]
python
train
manns/pyspread
pyspread/src/lib/vlc.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1820-L1830
def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux): '''Add a vod, with one input. @param psz_name: the name of the new vod media. @param psz_input: the input MRL. @param i_options: number of additional options. @param ppsz_options: additional ...
[ "def", "vlm_add_vod", "(", "self", ",", "psz_name", ",", "psz_input", ",", "i_options", ",", "ppsz_options", ",", "b_enabled", ",", "psz_mux", ")", ":", "return", "libvlc_vlm_add_vod", "(", "self", ",", "str_to_bytes", "(", "psz_name", ")", ",", "str_to_bytes"...
Add a vod, with one input. @param psz_name: the name of the new vod media. @param psz_input: the input MRL. @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new vod. @param psz_mux: the mux...
[ "Add", "a", "vod", "with", "one", "input", "." ]
python
train
jorgenschaefer/elpy
elpy/server.py
https://github.com/jorgenschaefer/elpy/blob/ffd982f829b11e53f2be187c7b770423341f29bc/elpy/server.py#L232-L255
def get_source(fileobj): """Translate fileobj into file contents. fileobj is either a string or a dict. If it's a string, that's the file contents. If it's a string, then the filename key contains the name of the file whose contents we are to use. If the dict contains a true value for the key dele...
[ "def", "get_source", "(", "fileobj", ")", ":", "if", "not", "isinstance", "(", "fileobj", ",", "dict", ")", ":", "return", "fileobj", "else", ":", "try", ":", "with", "io", ".", "open", "(", "fileobj", "[", "\"filename\"", "]", ",", "encoding", "=", ...
Translate fileobj into file contents. fileobj is either a string or a dict. If it's a string, that's the file contents. If it's a string, then the filename key contains the name of the file whose contents we are to use. If the dict contains a true value for the key delete_after_use, the file shoul...
[ "Translate", "fileobj", "into", "file", "contents", "." ]
python
train
cjdrake/pyeda
pyeda/logic/aes.py
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/logic/aes.py#L234-L244
def inv_sub_bytes(state): """ Transformation in the Inverse Cipher that is the inverse of SubBytes(). """ state = state.reshape(4, 32) return fcat( invsubword(state[0]), invsubword(state[1]), invsubword(state[2]), invsubword(state[3]), )
[ "def", "inv_sub_bytes", "(", "state", ")", ":", "state", "=", "state", ".", "reshape", "(", "4", ",", "32", ")", "return", "fcat", "(", "invsubword", "(", "state", "[", "0", "]", ")", ",", "invsubword", "(", "state", "[", "1", "]", ")", ",", "inv...
Transformation in the Inverse Cipher that is the inverse of SubBytes().
[ "Transformation", "in", "the", "Inverse", "Cipher", "that", "is", "the", "inverse", "of", "SubBytes", "()", "." ]
python
train
galaxyproject/pulsar
pulsar/client/manager.py
https://github.com/galaxyproject/pulsar/blob/9ab6683802884324652da0a9f0808c7eb59d3ab4/pulsar/client/manager.py#L83-L90
def get_client(self, destination_params, job_id, **kwargs): """Build a client given specific destination parameters and job_id.""" destination_params = _parse_destination_params(destination_params) destination_params.update(**kwargs) job_manager_interface_class = self.job_manager_interfa...
[ "def", "get_client", "(", "self", ",", "destination_params", ",", "job_id", ",", "*", "*", "kwargs", ")", ":", "destination_params", "=", "_parse_destination_params", "(", "destination_params", ")", "destination_params", ".", "update", "(", "*", "*", "kwargs", "...
Build a client given specific destination parameters and job_id.
[ "Build", "a", "client", "given", "specific", "destination", "parameters", "and", "job_id", "." ]
python
train
frictionlessdata/tableschema-bigquery-py
tableschema_bigquery/mapper.py
https://github.com/frictionlessdata/tableschema-bigquery-py/blob/aec6f0530ba5a0a08499f5e7a10f2c179c500285/tableschema_bigquery/mapper.py#L30-L57
def convert_descriptor(self, descriptor): """Convert descriptor to BigQuery """ # Fields fields = [] fallbacks = [] schema = tableschema.Schema(descriptor) for index, field in enumerate(schema.fields): converted_type = self.convert_type(field.type) ...
[ "def", "convert_descriptor", "(", "self", ",", "descriptor", ")", ":", "# Fields", "fields", "=", "[", "]", "fallbacks", "=", "[", "]", "schema", "=", "tableschema", ".", "Schema", "(", "descriptor", ")", "for", "index", ",", "field", "in", "enumerate", ...
Convert descriptor to BigQuery
[ "Convert", "descriptor", "to", "BigQuery" ]
python
train
google/grr
grr/core/grr_response_core/lib/parser.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parser.py#L130-L136
def GetClassesByArtifact(cls, artifact_name): """Get the classes that support parsing a given artifact.""" return [ cls.classes[c] for c in cls.classes if artifact_name in cls.classes[c].supported_artifacts ]
[ "def", "GetClassesByArtifact", "(", "cls", ",", "artifact_name", ")", ":", "return", "[", "cls", ".", "classes", "[", "c", "]", "for", "c", "in", "cls", ".", "classes", "if", "artifact_name", "in", "cls", ".", "classes", "[", "c", "]", ".", "supported_...
Get the classes that support parsing a given artifact.
[ "Get", "the", "classes", "that", "support", "parsing", "a", "given", "artifact", "." ]
python
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/account_model/future_account.py
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/account_model/future_account.py#L213-L217
def realized_pnl(self): """ [float] 平仓盈亏 """ return sum(position.realized_pnl for position in six.itervalues(self._positions))
[ "def", "realized_pnl", "(", "self", ")", ":", "return", "sum", "(", "position", ".", "realized_pnl", "for", "position", "in", "six", ".", "itervalues", "(", "self", ".", "_positions", ")", ")" ]
[float] 平仓盈亏
[ "[", "float", "]", "平仓盈亏" ]
python
train
rraadd88/rohan
rohan/dandage/stat/norm.py
https://github.com/rraadd88/rohan/blob/b0643a3582a2fffc0165ace69fb80880d92bfb10/rohan/dandage/stat/norm.py#L4-L39
def quantile_norm(X): """Normalize the columns of X to each have the same distribution. Given an expression matrix (microarray data, read counts, etc) of M genes by N samples, quantile normalization ensures all samples have the same spread of data (by construction). The data across each row are av...
[ "def", "quantile_norm", "(", "X", ")", ":", "# compute the quantiles", "quantiles", "=", "np", ".", "mean", "(", "np", ".", "sort", "(", "X", ",", "axis", "=", "0", ")", ",", "axis", "=", "1", ")", "# compute the column-wise ranks. Each observation is replaced...
Normalize the columns of X to each have the same distribution. Given an expression matrix (microarray data, read counts, etc) of M genes by N samples, quantile normalization ensures all samples have the same spread of data (by construction). The data across each row are averaged to obtain an average c...
[ "Normalize", "the", "columns", "of", "X", "to", "each", "have", "the", "same", "distribution", "." ]
python
train
rocky/python-uncompyle6
uncompyle6/show.py
https://github.com/rocky/python-uncompyle6/blob/c5d7944e657f0ad05a0e2edd34e1acb27001abc0/uncompyle6/show.py#L18-L32
def maybe_show_asm(showasm, tokens): """ Show the asm based on the showasm flag (or file object), writing to the appropriate stream depending on the type of the flag. :param showasm: Flag which determines whether the ingested code is written to sys.stdout or not. (It is also to pass...
[ "def", "maybe_show_asm", "(", "showasm", ",", "tokens", ")", ":", "if", "showasm", ":", "stream", "=", "showasm", "if", "hasattr", "(", "showasm", ",", "'write'", ")", "else", "sys", ".", "stdout", "for", "t", "in", "tokens", ":", "stream", ".", "write...
Show the asm based on the showasm flag (or file object), writing to the appropriate stream depending on the type of the flag. :param showasm: Flag which determines whether the ingested code is written to sys.stdout or not. (It is also to pass a file like object, into whi...
[ "Show", "the", "asm", "based", "on", "the", "showasm", "flag", "(", "or", "file", "object", ")", "writing", "to", "the", "appropriate", "stream", "depending", "on", "the", "type", "of", "the", "flag", "." ]
python
train
angr/angr
angr/analyses/vfg.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L513-L542
def _job_sorting_key(self, job): """ Get the sorting key of a VFGJob instance. :param VFGJob job: the VFGJob object. :return: An integer that determines the order of this job in the queue. :rtype: int """ MAX_BLOCKS_PER_FUNCTION = 1000000 task_functions...
[ "def", "_job_sorting_key", "(", "self", ",", "job", ")", ":", "MAX_BLOCKS_PER_FUNCTION", "=", "1000000", "task_functions", "=", "list", "(", "reversed", "(", "list", "(", "task", ".", "function_address", "for", "task", "in", "self", ".", "_task_stack", "if", ...
Get the sorting key of a VFGJob instance. :param VFGJob job: the VFGJob object. :return: An integer that determines the order of this job in the queue. :rtype: int
[ "Get", "the", "sorting", "key", "of", "a", "VFGJob", "instance", "." ]
python
train
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/mapping.py
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/mapping.py#L587-L649
def save(self): """ save or update this cluster in Ariane Server :return: """ LOGGER.debug("Cluster.save") post_payload = {} consolidated_containers_id = [] if self.id is not None: post_payload['clusterID'] = self.id if self.name is n...
[ "def", "save", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"Cluster.save\"", ")", "post_payload", "=", "{", "}", "consolidated_containers_id", "=", "[", "]", "if", "self", ".", "id", "is", "not", "None", ":", "post_payload", "[", "'clusterID'", ...
save or update this cluster in Ariane Server :return:
[ "save", "or", "update", "this", "cluster", "in", "Ariane", "Server", ":", "return", ":" ]
python
train
softlayer/softlayer-python
SoftLayer/managers/firewall.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/firewall.py#L168-L212
def _get_fwl_port_speed(self, server_id, is_virt=True): """Determines the appropriate speed for a firewall. :param int server_id: The ID of server the firewall is for :param bool is_virt: True if the server_id is for a virtual server :returns: a integer representing the Mbps speed of a ...
[ "def", "_get_fwl_port_speed", "(", "self", ",", "server_id", ",", "is_virt", "=", "True", ")", ":", "fwl_port_speed", "=", "0", "if", "is_virt", ":", "mask", "=", "(", "'primaryNetworkComponent[maxSpeed]'", ")", "svc", "=", "self", ".", "client", "[", "'Virt...
Determines the appropriate speed for a firewall. :param int server_id: The ID of server the firewall is for :param bool is_virt: True if the server_id is for a virtual server :returns: a integer representing the Mbps speed of a firewall
[ "Determines", "the", "appropriate", "speed", "for", "a", "firewall", "." ]
python
train
nephics/mat4py
mat4py/loadmat.py
https://github.com/nephics/mat4py/blob/6c1a2ad903937437cc5f24f3c3f5aa2c5a77a1c1/mat4py/loadmat.py#L107-L122
def unpack(endian, fmt, data): """Unpack a byte string to the given format. If the byte string contains more bytes than required for the given format, the function returns a tuple of values. """ if fmt == 's': # read data as an array of chars val = struct.unpack(''.join([endian, str(...
[ "def", "unpack", "(", "endian", ",", "fmt", ",", "data", ")", ":", "if", "fmt", "==", "'s'", ":", "# read data as an array of chars", "val", "=", "struct", ".", "unpack", "(", "''", ".", "join", "(", "[", "endian", ",", "str", "(", "len", "(", "data"...
Unpack a byte string to the given format. If the byte string contains more bytes than required for the given format, the function returns a tuple of values.
[ "Unpack", "a", "byte", "string", "to", "the", "given", "format", ".", "If", "the", "byte", "string", "contains", "more", "bytes", "than", "required", "for", "the", "given", "format", "the", "function", "returns", "a", "tuple", "of", "values", "." ]
python
valid
saltstack/salt
salt/modules/debuild_pkgbuild.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debuild_pkgbuild.py#L305-L315
def _get_src(tree_base, source, saltenv='base'): ''' Get the named sources and place them into the tree_base ''' parsed = _urlparse(source) sbase = os.path.basename(source) dest = os.path.join(tree_base, sbase) if parsed.scheme: __salt__['cp.get_url'](source, dest, saltenv=saltenv) ...
[ "def", "_get_src", "(", "tree_base", ",", "source", ",", "saltenv", "=", "'base'", ")", ":", "parsed", "=", "_urlparse", "(", "source", ")", "sbase", "=", "os", ".", "path", ".", "basename", "(", "source", ")", "dest", "=", "os", ".", "path", ".", ...
Get the named sources and place them into the tree_base
[ "Get", "the", "named", "sources", "and", "place", "them", "into", "the", "tree_base" ]
python
train
watson-developer-cloud/python-sdk
ibm_watson/compare_comply_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L3922-L3939
def _from_dict(cls, _dict): """Initialize a Parties object from a json dictionary.""" args = {} if 'party' in _dict: args['party'] = _dict.get('party') if 'importance' in _dict: args['importance'] = _dict.get('importance') if 'role' in _dict: a...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'party'", "in", "_dict", ":", "args", "[", "'party'", "]", "=", "_dict", ".", "get", "(", "'party'", ")", "if", "'importance'", "in", "_dict", ":", "args", "[", ...
Initialize a Parties object from a json dictionary.
[ "Initialize", "a", "Parties", "object", "from", "a", "json", "dictionary", "." ]
python
train
opencobra/memote
memote/support/validation.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/validation.py#L52-L61
def format_failure(failure): """Format how an error or warning should be displayed.""" return "Line {}, Column {} - #{}: {} - Category: {}, Severity: {}".format( failure.getLine(), failure.getColumn(), failure.getErrorId(), failure.getMessage(), failure.getCategoryAsStrin...
[ "def", "format_failure", "(", "failure", ")", ":", "return", "\"Line {}, Column {} - #{}: {} - Category: {}, Severity: {}\"", ".", "format", "(", "failure", ".", "getLine", "(", ")", ",", "failure", ".", "getColumn", "(", ")", ",", "failure", ".", "getErrorId", "(...
Format how an error or warning should be displayed.
[ "Format", "how", "an", "error", "or", "warning", "should", "be", "displayed", "." ]
python
train
dtmilano/AndroidViewClient
src/com/dtmilano/android/viewclient.py
https://github.com/dtmilano/AndroidViewClient/blob/7e6e83fde63af99e5e4ab959712ecf94f9881aa2/src/com/dtmilano/android/viewclient.py#L2942-L2953
def serviceResponse(self, response): ''' Checks the response received from the I{ViewServer}. @return: C{True} if the response received matches L{PARCEL_TRUE}, C{False} otherwise ''' PARCEL_TRUE = "Result: Parcel(00000000 00000001 '........')\r\n" ''' The TRUE respons...
[ "def", "serviceResponse", "(", "self", ",", "response", ")", ":", "PARCEL_TRUE", "=", "\"Result: Parcel(00000000 00000001 '........')\\r\\n\"", "''' The TRUE response parcel '''", "if", "DEBUG", ":", "print", ">>", "sys", ".", "stderr", ",", "\"serviceResponse: comparing ...
Checks the response received from the I{ViewServer}. @return: C{True} if the response received matches L{PARCEL_TRUE}, C{False} otherwise
[ "Checks", "the", "response", "received", "from", "the", "I", "{", "ViewServer", "}", "." ]
python
train
silenc3r/dikicli
dikicli/core.py
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L133-L202
def _parse_html(html_dump, native=False): """Parse html string. Parameters ---------- html_dump : str HTML content. native : bool, optional Whether to translate from native to foreign language. Returns ------- translations : list Translations list. Raises ...
[ "def", "_parse_html", "(", "html_dump", ",", "native", "=", "False", ")", ":", "# pylint: disable=too-many-locals", "soup", "=", "BeautifulSoup", "(", "html_dump", ",", "\"html.parser\"", ")", "translations", "=", "[", "]", "for", "entity", "in", "soup", ".", ...
Parse html string. Parameters ---------- html_dump : str HTML content. native : bool, optional Whether to translate from native to foreign language. Returns ------- translations : list Translations list. Raises ------ WordNotFound If word can't ...
[ "Parse", "html", "string", "." ]
python
train
jay-johnson/celery-loaders
celery_loaders/work_tasks/custom_task.py
https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/custom_task.py#L35-L54
def on_failure(self, exc, task_id, args, kwargs, einfo): """on_failure http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance :param exc: exception :param task_id: task id :param args: arguments passed into task :param kwargs: keyword arguments pa...
[ "def", "on_failure", "(", "self", ",", "exc", ",", "task_id", ",", "args", ",", "kwargs", ",", "einfo", ")", ":", "use_exc", "=", "str", "(", "exc", ")", "log", ".", "error", "(", "(", "\"{} FAIL - exc={} \"", "\"args={} kwargs={}\"", ")", ".", "format",...
on_failure http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance :param exc: exception :param task_id: task id :param args: arguments passed into task :param kwargs: keyword arguments passed into task :param einfo: exception info
[ "on_failure" ]
python
train
PGower/PyCanvas
pycanvas/apis/groups.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/groups.py#L433-L455
def list_group_memberships(self, group_id, filter_states=None): """ List group memberships. List the members of a group. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id ...
[ "def", "list_group_memberships", "(", "self", ",", "group_id", ",", "filter_states", "=", "None", ")", ":", "path", "=", "{", "}", "data", "=", "{", "}", "params", "=", "{", "}", "# REQUIRED - PATH - group_id\r", "\"\"\"ID\"\"\"", "path", "[", "\"group_id\"", ...
List group memberships. List the members of a group.
[ "List", "group", "memberships", ".", "List", "the", "members", "of", "a", "group", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/routing_system/interface/ve/ip/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/routing_system/interface/ve/ip/__init__.py#L145-L166
def _set_ip_anycast_address(self, v, load=False): """ Setter method for ip_anycast_address, mapped from YANG variable /routing_system/interface/ve/ip/ip_anycast_address (list) If this variable is read-only (config: false) in the source YANG file, then _set_ip_anycast_address is considered as a private ...
[ "def", "_set_ip_anycast_address", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ","...
Setter method for ip_anycast_address, mapped from YANG variable /routing_system/interface/ve/ip/ip_anycast_address (list) If this variable is read-only (config: false) in the source YANG file, then _set_ip_anycast_address is considered as a private method. Backends looking to populate this variable should ...
[ "Setter", "method", "for", "ip_anycast_address", "mapped", "from", "YANG", "variable", "/", "routing_system", "/", "interface", "/", "ve", "/", "ip", "/", "ip_anycast_address", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "conf...
python
train
opentracing-contrib/python-tornado
tornado_opentracing/application.py
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/application.py#L31-L64
def tracer_config(__init__, app, args, kwargs): """ Wraps the Tornado web application initialization so that the TornadoTracing instance is created around an OpenTracing-compatible tracer. """ __init__(*args, **kwargs) tracing = app.settings.get('opentracing_tracing') tracer_callable = app....
[ "def", "tracer_config", "(", "__init__", ",", "app", ",", "args", ",", "kwargs", ")", ":", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "tracing", "=", "app", ".", "settings", ".", "get", "(", "'opentracing_tracing'", ")", "tracer_callable...
Wraps the Tornado web application initialization so that the TornadoTracing instance is created around an OpenTracing-compatible tracer.
[ "Wraps", "the", "Tornado", "web", "application", "initialization", "so", "that", "the", "TornadoTracing", "instance", "is", "created", "around", "an", "OpenTracing", "-", "compatible", "tracer", "." ]
python
train
andreasjansson/head-in-the-clouds
headintheclouds/dependencies/PyDbLite/PyDbLite_conversions.py
https://github.com/andreasjansson/head-in-the-clouds/blob/32c1d00d01036834dc94368e7f38b0afd3f7a82f/headintheclouds/dependencies/PyDbLite/PyDbLite_conversions.py#L8-L26
def toCSV(pdl,out=None,write_field_names=True): """Conversion from the PyDbLite Base instance pdl to the file object out open for writing in binary mode If out is not specified, the field name is the same as the PyDbLite file with extension .csv If write_field_names is True, field names are wri...
[ "def", "toCSV", "(", "pdl", ",", "out", "=", "None", ",", "write_field_names", "=", "True", ")", ":", "import", "csv", "if", "out", "is", "None", ":", "file_name", "=", "os", ".", "path", ".", "splitext", "(", "pdl", ".", "name", ")", "[", "0", "...
Conversion from the PyDbLite Base instance pdl to the file object out open for writing in binary mode If out is not specified, the field name is the same as the PyDbLite file with extension .csv If write_field_names is True, field names are written at the top of the CSV file
[ "Conversion", "from", "the", "PyDbLite", "Base", "instance", "pdl", "to", "the", "file", "object", "out", "open", "for", "writing", "in", "binary", "mode", "If", "out", "is", "not", "specified", "the", "field", "name", "is", "the", "same", "as", "the", "...
python
train
maljovec/topopy
topopy/ContourTree.py
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/ContourTree.py#L91-L142
def build(self, X, Y, w=None, edges=None): """ Assigns data to this object and builds the Morse-Smale Complex @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses correspond...
[ "def", "build", "(", "self", ",", "X", ",", "Y", ",", "w", "=", "None", ",", "edges", "=", "None", ")", ":", "super", "(", "ContourTree", ",", "self", ")", ".", "build", "(", "X", ",", "Y", ",", "w", ",", "edges", ")", "# Build the join and split...
Assigns data to this object and builds the Morse-Smale Complex @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples specified by X @ In, w...
[ "Assigns", "data", "to", "this", "object", "and", "builds", "the", "Morse", "-", "Smale", "Complex" ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_sanity_checks.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_sanity_checks.py#L131-L141
def _sanity_check_output_source_follower_blocks(ir_blocks): """Ensure there are no Traverse / Backtrack / Recurse blocks after an OutputSource block.""" seen_output_source = False for block in ir_blocks: if isinstance(block, OutputSource): seen_output_source = True elif seen_outp...
[ "def", "_sanity_check_output_source_follower_blocks", "(", "ir_blocks", ")", ":", "seen_output_source", "=", "False", "for", "block", "in", "ir_blocks", ":", "if", "isinstance", "(", "block", ",", "OutputSource", ")", ":", "seen_output_source", "=", "True", "elif", ...
Ensure there are no Traverse / Backtrack / Recurse blocks after an OutputSource block.
[ "Ensure", "there", "are", "no", "Traverse", "/", "Backtrack", "/", "Recurse", "blocks", "after", "an", "OutputSource", "block", "." ]
python
train
numenta/htmresearch
htmresearch/frameworks/sp_paper/sp_metrics.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/sp_paper/sp_metrics.py#L515-L528
def classifySPoutput(targetOutputColumns, outputColumns): """ Classify the SP output @param targetOutputColumns (list) The target outputs, corresponding to different classes @param outputColumns (array) The current output @return classLabel (int) classification outcome ""...
[ "def", "classifySPoutput", "(", "targetOutputColumns", ",", "outputColumns", ")", ":", "numTargets", ",", "numDims", "=", "targetOutputColumns", ".", "shape", "overlap", "=", "np", ".", "zeros", "(", "(", "numTargets", ",", ")", ")", "for", "i", "in", "range...
Classify the SP output @param targetOutputColumns (list) The target outputs, corresponding to different classes @param outputColumns (array) The current output @return classLabel (int) classification outcome
[ "Classify", "the", "SP", "output" ]
python
train
orbingol/NURBS-Python
geomdl/voxelize.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/voxelize.py#L16-L56
def voxelize(obj, **kwargs): """ Generates binary voxel representation of the surfaces and volumes. Keyword Arguments: * ``grid_size``: size of the voxel grid. *Default: (8, 8, 8)* * ``padding``: voxel padding for in-outs finding. *Default: 10e-8* * ``use_cubes``: use cube voxels instea...
[ "def", "voxelize", "(", "obj", ",", "*", "*", "kwargs", ")", ":", "# Get keyword arguments", "grid_size", "=", "kwargs", ".", "pop", "(", "'grid_size'", ",", "(", "8", ",", "8", ",", "8", ")", ")", "use_cubes", "=", "kwargs", ".", "pop", "(", "'use_c...
Generates binary voxel representation of the surfaces and volumes. Keyword Arguments: * ``grid_size``: size of the voxel grid. *Default: (8, 8, 8)* * ``padding``: voxel padding for in-outs finding. *Default: 10e-8* * ``use_cubes``: use cube voxels instead of cuboid ones. *Default: False* ...
[ "Generates", "binary", "voxel", "representation", "of", "the", "surfaces", "and", "volumes", "." ]
python
train
datacamp/antlr-ast
antlr_ast/ast.py
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L207-L216
def isinstance(self, instance, class_name): """Check if a BaseNode is an instance of a registered dynamic class""" if isinstance(instance, BaseNode): klass = self.dynamic_node_classes.get(class_name, None) if klass: return isinstance(instance, klass) #...
[ "def", "isinstance", "(", "self", ",", "instance", ",", "class_name", ")", ":", "if", "isinstance", "(", "instance", ",", "BaseNode", ")", ":", "klass", "=", "self", ".", "dynamic_node_classes", ".", "get", "(", "class_name", ",", "None", ")", "if", "kla...
Check if a BaseNode is an instance of a registered dynamic class
[ "Check", "if", "a", "BaseNode", "is", "an", "instance", "of", "a", "registered", "dynamic", "class" ]
python
train
pytroll/satpy
satpy/readers/ahi_hsd.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/ahi_hsd.py#L310-L313
def scheduled_time(self): """Time this band was scheduled to be recorded.""" timeline = "{:04d}".format(self.basic_info['observation_timeline'][0]) return self.start_time.replace(hour=int(timeline[:2]), minute=int(timeline[2:4]), second=0, microsecond=0)
[ "def", "scheduled_time", "(", "self", ")", ":", "timeline", "=", "\"{:04d}\"", ".", "format", "(", "self", ".", "basic_info", "[", "'observation_timeline'", "]", "[", "0", "]", ")", "return", "self", ".", "start_time", ".", "replace", "(", "hour", "=", "...
Time this band was scheduled to be recorded.
[ "Time", "this", "band", "was", "scheduled", "to", "be", "recorded", "." ]
python
train
ewels/MultiQC
multiqc/modules/featureCounts/feature_counts.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/featureCounts/feature_counts.py#L52-L103
def parse_featurecounts_report (self, f): """ Parse the featureCounts log file. """ file_names = list() parsed_data = dict() for l in f['f'].splitlines(): thisrow = list() s = l.split("\t") if len(s) < 2: continue if s[0] =...
[ "def", "parse_featurecounts_report", "(", "self", ",", "f", ")", ":", "file_names", "=", "list", "(", ")", "parsed_data", "=", "dict", "(", ")", "for", "l", "in", "f", "[", "'f'", "]", ".", "splitlines", "(", ")", ":", "thisrow", "=", "list", "(", ...
Parse the featureCounts log file.
[ "Parse", "the", "featureCounts", "log", "file", "." ]
python
train
deschler/django-modeltranslation
modeltranslation/fields.py
https://github.com/deschler/django-modeltranslation/blob/18fec04a5105cbd83fc3759f4fda20135b3a848c/modeltranslation/fields.py#L277-L291
def south_field_triple(self): """ Returns a suitable description of this field for South. """ # We'll just introspect the _actual_ field. from south.modelsinspector import introspector try: # Check if the field provides its own 'field_class': field...
[ "def", "south_field_triple", "(", "self", ")", ":", "# We'll just introspect the _actual_ field.", "from", "south", ".", "modelsinspector", "import", "introspector", "try", ":", "# Check if the field provides its own 'field_class':", "field_class", "=", "self", ".", "translat...
Returns a suitable description of this field for South.
[ "Returns", "a", "suitable", "description", "of", "this", "field", "for", "South", "." ]
python
train
Yelp/py_zipkin
py_zipkin/encoding/_decoders.py
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L146-L178
def _convert_from_thrift_binary_annotations(self, thrift_binary_annotations): """Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation. """ tags = {} local_endpoint = None remote_endpoint = None for binary_annotation in thrift_binar...
[ "def", "_convert_from_thrift_binary_annotations", "(", "self", ",", "thrift_binary_annotations", ")", ":", "tags", "=", "{", "}", "local_endpoint", "=", "None", "remote_endpoint", "=", "None", "for", "binary_annotation", "in", "thrift_binary_annotations", ":", "if", "...
Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation.
[ "Accepts", "a", "thrift", "decoded", "binary", "annotation", "and", "converts", "it", "to", "a", "v1", "binary", "annotation", "." ]
python
test
biolink/ontobio
ontobio/assoc_factory.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/assoc_factory.py#L36-L86
def create(self, ontology=None,subject_category=None,object_category=None,evidence=None,taxon=None,relation=None, file=None, fmt=None, skim=True): """ creates an AssociationSet Currently, this uses an eager binding to a `ontobio.golr` instance. All compact associations for the particular combin...
[ "def", "create", "(", "self", ",", "ontology", "=", "None", ",", "subject_category", "=", "None", ",", "object_category", "=", "None", ",", "evidence", "=", "None", ",", "taxon", "=", "None", ",", "relation", "=", "None", ",", "file", "=", "None", ",",...
creates an AssociationSet Currently, this uses an eager binding to a `ontobio.golr` instance. All compact associations for the particular combination of parameters are fetched. Arguments --------- ontology: an `Ontology` object subject_category: string represen...
[ "creates", "an", "AssociationSet" ]
python
train
minio/minio-py
minio/parsers.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/parsers.py#L155-L169
def parse_multipart_upload_result(data): """ Parser for complete multipart upload response. :param data: Response data for complete multipart upload. :return: :class:`MultipartUploadResult <MultipartUploadResult>`. """ root = S3Element.fromstring('CompleteMultipartUploadResult', data) retu...
[ "def", "parse_multipart_upload_result", "(", "data", ")", ":", "root", "=", "S3Element", ".", "fromstring", "(", "'CompleteMultipartUploadResult'", ",", "data", ")", "return", "MultipartUploadResult", "(", "root", ".", "get_child_text", "(", "'Bucket'", ")", ",", ...
Parser for complete multipart upload response. :param data: Response data for complete multipart upload. :return: :class:`MultipartUploadResult <MultipartUploadResult>`.
[ "Parser", "for", "complete", "multipart", "upload", "response", "." ]
python
train
Ezhil-Language-Foundation/open-tamil
ngram/LetterModels.py
https://github.com/Ezhil-Language-Foundation/open-tamil/blob/b7556e88878d29bbc6c944ee17cdd3f75b8ea9f0/ngram/LetterModels.py#L65-L78
def language_model(self,verbose=True): """ builds a Tamil bigram letter model """ # use a generator in corpus prev = None for next_letter in self.corpus.next_tamil_letter(): # update frequency from corpus if prev: self.letter2[prev][next_letter] +=...
[ "def", "language_model", "(", "self", ",", "verbose", "=", "True", ")", ":", "# use a generator in corpus", "prev", "=", "None", "for", "next_letter", "in", "self", ".", "corpus", ".", "next_tamil_letter", "(", ")", ":", "# update frequency from corpus", "if", "...
builds a Tamil bigram letter model
[ "builds", "a", "Tamil", "bigram", "letter", "model" ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/container_state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/container_state.py#L1978-L2000
def _check_transition_target(self, transition): """Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the ...
[ "def", "_check_transition_target", "(", "self", ",", "transition", ")", ":", "to_state_id", "=", "transition", ".", "to_state", "to_outcome_id", "=", "transition", ".", "to_outcome", "if", "to_state_id", "==", "self", ".", "state_id", ":", "if", "to_outcome_id", ...
Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is valid, False else. message gives ...
[ "Checks", "the", "validity", "of", "a", "transition", "target" ]
python
train
wavycloud/pyboto3
pyboto3/iam.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/iam.py#L4415-L4592
def simulate_principal_policy(PolicySourceArn=None, PolicyInputList=None, ActionNames=None, ResourceArns=None, ResourcePolicy=None, ResourceOwner=None, CallerArn=None, ContextEntries=None, ResourceHandlingOption=None, MaxItems=None, Marker=None): """ Simulate how a set of IAM policies attached to an IAM entity ...
[ "def", "simulate_principal_policy", "(", "PolicySourceArn", "=", "None", ",", "PolicyInputList", "=", "None", ",", "ActionNames", "=", "None", ",", "ResourceArns", "=", "None", ",", "ResourcePolicy", "=", "None", ",", "ResourceOwner", "=", "None", ",", "CallerAr...
Simulate how a set of IAM policies attached to an IAM entity works with a list of API actions and AWS resources to determine the policies' effective permissions. The entity can be an IAM user, group, or role. If you specify a user, then the simulation also includes all of the policies that are attached to groups that t...
[ "Simulate", "how", "a", "set", "of", "IAM", "policies", "attached", "to", "an", "IAM", "entity", "works", "with", "a", "list", "of", "API", "actions", "and", "AWS", "resources", "to", "determine", "the", "policies", "effective", "permissions", ".", "The", ...
python
train
ramrod-project/database-brain
schema/brain/decorators.py
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/decorators.py#L45-L61
def deprecated_function(func_, replacement="(see docs)", *args, **kwargs): """ decorator to annotate deprecated functions usage @decorator(replacement="brain.whatever.new_function") :param func_: <callable> :param replacement: <str> :param args: positional arguments ...
[ "def", "deprecated_function", "(", "func_", ",", "replacement", "=", "\"(see docs)\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "msg", "=", "\"{} is deprecated, use {}\\n\"", ".", "format", "(", "func_", ".", "__name__", ",", "replacement", ")", ...
decorator to annotate deprecated functions usage @decorator(replacement="brain.whatever.new_function") :param func_: <callable> :param replacement: <str> :param args: positional arguments :param kwargs: :return: <func_'s return value>
[ "decorator", "to", "annotate", "deprecated", "functions" ]
python
train
scott-maddox/openbandparams
src/openbandparams/iii_v_zinc_blende_binaries.py
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/iii_v_zinc_blende_binaries.py#L190-L200
def GaP_Eg_Gamma(self, **kwargs): ''' Returns the Gamma-valley bandgap, Eg_Gamma, in electron Volts at a given temperature, T, in Kelvin (default: 300 K). GaP has a unique Gamma-gap temperature dependence. ''' T = kwargs.get('T', 300.) if T < 1e-4: return self.Eg_Gamma_0() retur...
[ "def", "GaP_Eg_Gamma", "(", "self", ",", "*", "*", "kwargs", ")", ":", "T", "=", "kwargs", ".", "get", "(", "'T'", ",", "300.", ")", "if", "T", "<", "1e-4", ":", "return", "self", ".", "Eg_Gamma_0", "(", ")", "return", "self", ".", "Eg_Gamma_0", ...
Returns the Gamma-valley bandgap, Eg_Gamma, in electron Volts at a given temperature, T, in Kelvin (default: 300 K). GaP has a unique Gamma-gap temperature dependence.
[ "Returns", "the", "Gamma", "-", "valley", "bandgap", "Eg_Gamma", "in", "electron", "Volts", "at", "a", "given", "temperature", "T", "in", "Kelvin", "(", "default", ":", "300", "K", ")", "." ]
python
train
hvac/hvac
hvac/api/system_backend/leader.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/system_backend/leader.py#L6-L19
def read_leader_status(self): """Read the high availability status and current leader instance of Vault. Supported methods: GET: /sys/leader. Produces: 200 application/json :return: The JSON response of the request. :rtype: dict """ api_path = '/v1/sys/leade...
[ "def", "read_leader_status", "(", "self", ")", ":", "api_path", "=", "'/v1/sys/leader'", "response", "=", "self", ".", "_adapter", ".", "get", "(", "url", "=", "api_path", ",", ")", "return", "response", ".", "json", "(", ")" ]
Read the high availability status and current leader instance of Vault. Supported methods: GET: /sys/leader. Produces: 200 application/json :return: The JSON response of the request. :rtype: dict
[ "Read", "the", "high", "availability", "status", "and", "current", "leader", "instance", "of", "Vault", "." ]
python
train
openstack/monasca-common
monasca_common/kafka_lib/protocol.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/protocol.py#L126-L158
def _decode_message_set_iter(cls, data): """ Iteratively decode a MessageSet Reads repeated elements of (offset, message), calling decode_message to decode a single message. Since compressed messages contain futher MessageSets, these two methods have been decoupled so that they ...
[ "def", "_decode_message_set_iter", "(", "cls", ",", "data", ")", ":", "cur", "=", "0", "read_message", "=", "False", "while", "cur", "<", "len", "(", "data", ")", ":", "try", ":", "(", "(", "offset", ",", ")", ",", "cur", ")", "=", "relative_unpack",...
Iteratively decode a MessageSet Reads repeated elements of (offset, message), calling decode_message to decode a single message. Since compressed messages contain futher MessageSets, these two methods have been decoupled so that they may recurse easily.
[ "Iteratively", "decode", "a", "MessageSet" ]
python
train
bububa/pyTOP
pyTOP/taobaoke.py
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/taobaoke.py#L30-L42
def get(self, date, page_no=1, page_size=40, fields=[]): '''taobao.taobaoke.report.get 淘宝客报表查询 淘宝客报表查询''' request = TOPRequest('taobao.taobaoke.items.get') request['date'] = date request['page_no'] = page_no request['page_size'] = page_size if not fields:...
[ "def", "get", "(", "self", ",", "date", ",", "page_no", "=", "1", ",", "page_size", "=", "40", ",", "fields", "=", "[", "]", ")", ":", "request", "=", "TOPRequest", "(", "'taobao.taobaoke.items.get'", ")", "request", "[", "'date'", "]", "=", "date", ...
taobao.taobaoke.report.get 淘宝客报表查询 淘宝客报表查询
[ "taobao", ".", "taobaoke", ".", "report", ".", "get", "淘宝客报表查询", "淘宝客报表查询" ]
python
train
chrislit/abydos
abydos/stats/_mean.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L289-L333
def imean(nums): r"""Return identric (exponential) mean. The identric mean of two numbers x and y is: x if x = y otherwise :math:`\frac{1}{e} \sqrt[x-y]{\frac{x^x}{y^y}}` Cf. https://en.wikipedia.org/wiki/Identric_mean Parameters ---------- nums : list A series of numbers ...
[ "def", "imean", "(", "nums", ")", ":", "if", "len", "(", "nums", ")", "==", "1", ":", "return", "nums", "[", "0", "]", "if", "len", "(", "nums", ")", ">", "2", ":", "raise", "AttributeError", "(", "'imean supports no more than two values'", ")", "if", ...
r"""Return identric (exponential) mean. The identric mean of two numbers x and y is: x if x = y otherwise :math:`\frac{1}{e} \sqrt[x-y]{\frac{x^x}{y^y}}` Cf. https://en.wikipedia.org/wiki/Identric_mean Parameters ---------- nums : list A series of numbers Returns ------- ...
[ "r", "Return", "identric", "(", "exponential", ")", "mean", "." ]
python
valid
spacetelescope/drizzlepac
drizzlepac/tweakutils.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakutils.py#L721-L724
def gauss(x, sigma): """ Compute 1-D value of gaussian at position x relative to center.""" return (np.exp(-np.power(x, 2) / (2 * np.power(sigma, 2))) / (sigma * np.sqrt(2 * np.pi)))
[ "def", "gauss", "(", "x", ",", "sigma", ")", ":", "return", "(", "np", ".", "exp", "(", "-", "np", ".", "power", "(", "x", ",", "2", ")", "/", "(", "2", "*", "np", ".", "power", "(", "sigma", ",", "2", ")", ")", ")", "/", "(", "sigma", ...
Compute 1-D value of gaussian at position x relative to center.
[ "Compute", "1", "-", "D", "value", "of", "gaussian", "at", "position", "x", "relative", "to", "center", "." ]
python
train
msmbuilder/msmbuilder
msmbuilder/tpt/hub.py
https://github.com/msmbuilder/msmbuilder/blob/556a93a170782f47be53f4a1e9d740fb1c8272b3/msmbuilder/tpt/hub.py#L86-L136
def hub_scores(msm, waypoints=None): """ Calculate the hub score for one or more waypoints The "hub score" is a measure of how well traveled a certain state or set of states is in a network. Specifically, it is the fraction of times that a walker visits a state en route from some state A to another...
[ "def", "hub_scores", "(", "msm", ",", "waypoints", "=", "None", ")", ":", "n_states", "=", "msm", ".", "n_states_", "if", "isinstance", "(", "waypoints", ",", "int", ")", ":", "waypoints", "=", "[", "waypoints", "]", "elif", "waypoints", "is", "None", ...
Calculate the hub score for one or more waypoints The "hub score" is a measure of how well traveled a certain state or set of states is in a network. Specifically, it is the fraction of times that a walker visits a state en route from some state A to another state B, averaged over all combinations of A...
[ "Calculate", "the", "hub", "score", "for", "one", "or", "more", "waypoints" ]
python
train
greyli/flask-avatars
flask_avatars/identicon.py
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/identicon.py#L87-L93
def _get_pastel_colour(self, lighten=127): """ Create a pastel colour hex colour string """ def r(): return random.randint(0, 128) + lighten return r(), r(), r()
[ "def", "_get_pastel_colour", "(", "self", ",", "lighten", "=", "127", ")", ":", "def", "r", "(", ")", ":", "return", "random", ".", "randint", "(", "0", ",", "128", ")", "+", "lighten", "return", "r", "(", ")", ",", "r", "(", ")", ",", "r", "("...
Create a pastel colour hex colour string
[ "Create", "a", "pastel", "colour", "hex", "colour", "string" ]
python
train
liip/taxi
taxi/timesheet/entry.py
https://github.com/liip/taxi/blob/269423c1f1ab571bd01a522819afe3e325bfbff6/taxi/timesheet/entry.py#L365-L375
def delete_date(self, date): """ Remove the date line from the textual representation. This doesn't remove any entry line. """ self.lines = [ line for line in self.lines if not isinstance(line, DateLine) or line.date != date ] self.lines =...
[ "def", "delete_date", "(", "self", ",", "date", ")", ":", "self", ".", "lines", "=", "[", "line", "for", "line", "in", "self", ".", "lines", "if", "not", "isinstance", "(", "line", ",", "DateLine", ")", "or", "line", ".", "date", "!=", "date", "]",...
Remove the date line from the textual representation. This doesn't remove any entry line.
[ "Remove", "the", "date", "line", "from", "the", "textual", "representation", ".", "This", "doesn", "t", "remove", "any", "entry", "line", "." ]
python
train
honeynet/beeswarm
beeswarm/shared/asciify.py
https://github.com/honeynet/beeswarm/blob/db51ea0bc29f631c3e3b5312b479ac9d5e31079a/beeswarm/shared/asciify.py#L30-L46
def _asciify_dict(data): """ Ascii-fies dict keys and values """ ret = {} for key, value in data.iteritems(): if isinstance(key, unicode): key = _remove_accents(key) key = key.encode('utf-8') # # note new if if isinstance(value, unicode): value...
[ "def", "_asciify_dict", "(", "data", ")", ":", "ret", "=", "{", "}", "for", "key", ",", "value", "in", "data", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "key", ",", "unicode", ")", ":", "key", "=", "_remove_accents", "(", "key", ")"...
Ascii-fies dict keys and values
[ "Ascii", "-", "fies", "dict", "keys", "and", "values" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_port_profile.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_port_profile.py#L36-L48
def port_profile_vlan_profile_switchport_basic_basic(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") port_profile = ET.SubElement(config, "port-profile", xmlns="urn:brocade.com:mgmt:brocade-port-profile") name_key = ET.SubElement(port_profile, "name") ...
[ "def", "port_profile_vlan_profile_switchport_basic_basic", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "port_profile", "=", "ET", ".", "SubElement", "(", "config", ",", "\"port-profile\"", ",", "...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
boriel/zxbasic
asmlex.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmlex.py#L377-L383
def t_INITIAL_SHARP(self, t): r'\#' if self.find_column(t) == 1: t.lexer.begin('preproc') else: self.t_INITIAL_preproc_error(t)
[ "def", "t_INITIAL_SHARP", "(", "self", ",", "t", ")", ":", "if", "self", ".", "find_column", "(", "t", ")", "==", "1", ":", "t", ".", "lexer", ".", "begin", "(", "'preproc'", ")", "else", ":", "self", ".", "t_INITIAL_preproc_error", "(", "t", ")" ]
r'\#
[ "r", "\\", "#" ]
python
train
mongodb/mongo-python-driver
pymongo/collection.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/collection.py#L648-L696
def insert_one(self, document, bypass_document_validation=False, session=None): """Insert a single document. >>> db.test.count_documents({'x': 1}) 0 >>> result = db.test.insert_one({'x': 1}) >>> result.inserted_id ObjectId('54f112defba522406c...
[ "def", "insert_one", "(", "self", ",", "document", ",", "bypass_document_validation", "=", "False", ",", "session", "=", "None", ")", ":", "common", ".", "validate_is_document_type", "(", "\"document\"", ",", "document", ")", "if", "not", "(", "isinstance", "(...
Insert a single document. >>> db.test.count_documents({'x': 1}) 0 >>> result = db.test.insert_one({'x': 1}) >>> result.inserted_id ObjectId('54f112defba522406c9cc208') >>> db.test.find_one({'x': 1}) {u'x': 1, u'_id': ObjectId('54f112defba522406c9cc2...
[ "Insert", "a", "single", "document", "." ]
python
train
pyamg/pyamg
pyamg/util/utils.py
https://github.com/pyamg/pyamg/blob/89dc54aa27e278f65d2f54bdaf16ab97d7768fa6/pyamg/util/utils.py#L590-L679
def get_block_diag(A, blocksize, inv_flag=True): """Return the block diagonal of A, in array form. Parameters ---------- A : csr_matrix assumed to be square blocksize : int square block size for the diagonal inv_flag : bool if True, return the inverse of the block diagon...
[ "def", "get_block_diag", "(", "A", ",", "blocksize", ",", "inv_flag", "=", "True", ")", ":", "if", "not", "isspmatrix", "(", "A", ")", ":", "raise", "TypeError", "(", "'Expected sparse matrix'", ")", "if", "A", ".", "shape", "[", "0", "]", "!=", "A", ...
Return the block diagonal of A, in array form. Parameters ---------- A : csr_matrix assumed to be square blocksize : int square block size for the diagonal inv_flag : bool if True, return the inverse of the block diagonal Returns ------- block_diag : array ...
[ "Return", "the", "block", "diagonal", "of", "A", "in", "array", "form", "." ]
python
train
googleapis/google-cloud-python
dns/google/cloud/dns/changes.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L193-L215
def _build_resource(self): """Generate a resource for ``create``.""" additions = [ { "name": added.name, "type": added.record_type, "ttl": str(added.ttl), "rrdatas": added.rrdatas, } for added in self.add...
[ "def", "_build_resource", "(", "self", ")", ":", "additions", "=", "[", "{", "\"name\"", ":", "added", ".", "name", ",", "\"type\"", ":", "added", ".", "record_type", ",", "\"ttl\"", ":", "str", "(", "added", ".", "ttl", ")", ",", "\"rrdatas\"", ":", ...
Generate a resource for ``create``.
[ "Generate", "a", "resource", "for", "create", "." ]
python
train
istresearch/scrapy-cluster
utils/scutils/settings_wrapper.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/utils/scutils/settings_wrapper.py#L111-L125
def _convert_to_dict(self, setting): ''' Converts a settings file into a dictionary, ignoring python defaults @param setting: A loaded setting module ''' the_dict = {} set = dir(setting) for key in set: if key in self.ignore: continue ...
[ "def", "_convert_to_dict", "(", "self", ",", "setting", ")", ":", "the_dict", "=", "{", "}", "set", "=", "dir", "(", "setting", ")", "for", "key", "in", "set", ":", "if", "key", "in", "self", ".", "ignore", ":", "continue", "value", "=", "getattr", ...
Converts a settings file into a dictionary, ignoring python defaults @param setting: A loaded setting module
[ "Converts", "a", "settings", "file", "into", "a", "dictionary", "ignoring", "python", "defaults" ]
python
train
sprockets/sprockets.mixins.http
sprockets/mixins/http/__init__.py
https://github.com/sprockets/sprockets.mixins.http/blob/982219a10be979668726f573f324415fcf2020c8/sprockets/mixins/http/__init__.py#L212-L236
def _deserialize(self): """Try and deserialize a response body based upon the specified content type. :rtype: mixed """ if not self._responses or not self._responses[-1].body: return None if 'Content-Type' not in self._responses[-1].headers: retu...
[ "def", "_deserialize", "(", "self", ")", ":", "if", "not", "self", ".", "_responses", "or", "not", "self", ".", "_responses", "[", "-", "1", "]", ".", "body", ":", "return", "None", "if", "'Content-Type'", "not", "in", "self", ".", "_responses", "[", ...
Try and deserialize a response body based upon the specified content type. :rtype: mixed
[ "Try", "and", "deserialize", "a", "response", "body", "based", "upon", "the", "specified", "content", "type", "." ]
python
train
pyca/pyopenssl
src/OpenSSL/crypto.py
https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L821-L834
def get_short_name(self): """ Returns the short type name of this X.509 extension. The result is a byte string such as :py:const:`b"basicConstraints"`. :return: The short type name. :rtype: :py:data:`bytes` .. versionadded:: 0.12 """ obj = _lib.X509_EXT...
[ "def", "get_short_name", "(", "self", ")", ":", "obj", "=", "_lib", ".", "X509_EXTENSION_get_object", "(", "self", ".", "_extension", ")", "nid", "=", "_lib", ".", "OBJ_obj2nid", "(", "obj", ")", "return", "_ffi", ".", "string", "(", "_lib", ".", "OBJ_ni...
Returns the short type name of this X.509 extension. The result is a byte string such as :py:const:`b"basicConstraints"`. :return: The short type name. :rtype: :py:data:`bytes` .. versionadded:: 0.12
[ "Returns", "the", "short", "type", "name", "of", "this", "X", ".", "509", "extension", "." ]
python
test
hannorein/rebound
rebound/simulation.py
https://github.com/hannorein/rebound/blob/bb0f814c98e629401acaab657cae2304b0e003f7/rebound/simulation.py#L935-L978
def units(self): """ Tuple of the units for length, time and mass. Can be set in any order, and strings are not case-sensitive. See ipython_examples/Units.ipynb for more information. You can check the units' exact values and add Additional units in rebound/rebound/units.py. Units should be set befor...
[ "def", "units", "(", "self", ")", ":", "return", "{", "'length'", ":", "hash_to_unit", "(", "self", ".", "python_unit_l", ")", ",", "'mass'", ":", "hash_to_unit", "(", "self", ".", "python_unit_m", ")", ",", "'time'", ":", "hash_to_unit", "(", "self", "....
Tuple of the units for length, time and mass. Can be set in any order, and strings are not case-sensitive. See ipython_examples/Units.ipynb for more information. You can check the units' exact values and add Additional units in rebound/rebound/units.py. Units should be set before adding particles to the simulation ...
[ "Tuple", "of", "the", "units", "for", "length", "time", "and", "mass", ".", "Can", "be", "set", "in", "any", "order", "and", "strings", "are", "not", "case", "-", "sensitive", ".", "See", "ipython_examples", "/", "Units", ".", "ipynb", "for", "more", "...
python
train
apache/spark
python/pyspark/streaming/dstream.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/streaming/dstream.py#L343-L352
def cogroup(self, other, numPartitions=None): """ Return a new DStream by applying 'cogroup' between RDDs of this DStream and `other` DStream. Hash partitioning is used to generate the RDDs with `numPartitions` partitions. """ if numPartitions is None: numPar...
[ "def", "cogroup", "(", "self", ",", "other", ",", "numPartitions", "=", "None", ")", ":", "if", "numPartitions", "is", "None", ":", "numPartitions", "=", "self", ".", "_sc", ".", "defaultParallelism", "return", "self", ".", "transformWith", "(", "lambda", ...
Return a new DStream by applying 'cogroup' between RDDs of this DStream and `other` DStream. Hash partitioning is used to generate the RDDs with `numPartitions` partitions.
[ "Return", "a", "new", "DStream", "by", "applying", "cogroup", "between", "RDDs", "of", "this", "DStream", "and", "other", "DStream", "." ]
python
train
jeffknupp/sandman2
sandman2/service.py
https://github.com/jeffknupp/sandman2/blob/1ce21d6f7a6df77fa96fab694b0f9bb8469c166b/sandman2/service.py#L112-L129
def patch(self, resource_id): """Return an HTTP response object resulting from an HTTP PATCH call. :returns: ``HTTP 200`` if the resource already exists :returns: ``HTTP 400`` if the request is malformed :returns: ``HTTP 404`` if the resource is not found :param resource_id: The...
[ "def", "patch", "(", "self", ",", "resource_id", ")", ":", "resource", "=", "self", ".", "_resource", "(", "resource_id", ")", "error_message", "=", "is_valid_method", "(", "self", ".", "__model__", ",", "resource", ")", "if", "error_message", ":", "raise", ...
Return an HTTP response object resulting from an HTTP PATCH call. :returns: ``HTTP 200`` if the resource already exists :returns: ``HTTP 400`` if the request is malformed :returns: ``HTTP 404`` if the resource is not found :param resource_id: The value of the resource's primary key
[ "Return", "an", "HTTP", "response", "object", "resulting", "from", "an", "HTTP", "PATCH", "call", "." ]
python
train
facelessuser/backrefs
backrefs/_bre_parse.py
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/_bre_parse.py#L624-L634
def main_group(self, i): """The main group: group 0.""" current = [] while True: try: t = next(i) current.extend(self.normal(t, i)) except StopIteration: break return current
[ "def", "main_group", "(", "self", ",", "i", ")", ":", "current", "=", "[", "]", "while", "True", ":", "try", ":", "t", "=", "next", "(", "i", ")", "current", ".", "extend", "(", "self", ".", "normal", "(", "t", ",", "i", ")", ")", "except", "...
The main group: group 0.
[ "The", "main", "group", ":", "group", "0", "." ]
python
train
saltstack/salt
salt/states/zone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zone.py#L202-L253
def property_absent(name, property): ''' Ensure property is absent name : string name of the zone property : string name of property .. note:: This does a zoneacfg clear call. So the property may be reset to a default value! Does has the side effect of always having...
[ "def", "property_absent", "(", "name", ",", "property", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "zones", "=", "__salt__", "[", "'zoneadm.list'", ...
Ensure property is absent name : string name of the zone property : string name of property .. note:: This does a zoneacfg clear call. So the property may be reset to a default value! Does has the side effect of always having to be called.
[ "Ensure", "property", "is", "absent" ]
python
train
astooke/gtimer
gtimer/public/io.py
https://github.com/astooke/gtimer/blob/2146dab459e5d959feb291821733d3d3ba7c523c/gtimer/public/io.py#L170-L193
def load_pkl(filenames): """ Unpickle file contents. Args: filenames (str): Can be one or a list or tuple of filenames to retrieve. Returns: Times: A single object, or from a collection of filenames, a list of Times objects. Raises: TypeError: If any loaded object is not a...
[ "def", "load_pkl", "(", "filenames", ")", ":", "if", "not", "isinstance", "(", "filenames", ",", "(", "list", ",", "tuple", ")", ")", ":", "filenames", "=", "[", "filenames", "]", "times", "=", "[", "]", "for", "name", "in", "filenames", ":", "name",...
Unpickle file contents. Args: filenames (str): Can be one or a list or tuple of filenames to retrieve. Returns: Times: A single object, or from a collection of filenames, a list of Times objects. Raises: TypeError: If any loaded object is not a Times object.
[ "Unpickle", "file", "contents", "." ]
python
train
rigetti/pyquil
pyquil/api/_job.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_job.py#L162-L174
def _get_metadata(self, key): """ If the server returned a metadata dictionary, retrieve a particular key from it. If no metadata exists, or the key does not exist, return None. :param key: Metadata key, e.g., "gate_depth" :return: The associated metadata. :rtype: Option...
[ "def", "_get_metadata", "(", "self", ",", "key", ")", ":", "if", "not", "self", ".", "is_done", "(", ")", ":", "raise", "ValueError", "(", "\"Cannot get metadata for a program that isn't completed.\"", ")", "return", "self", ".", "_raw", ".", "get", "(", "\"me...
If the server returned a metadata dictionary, retrieve a particular key from it. If no metadata exists, or the key does not exist, return None. :param key: Metadata key, e.g., "gate_depth" :return: The associated metadata. :rtype: Optional[Any]
[ "If", "the", "server", "returned", "a", "metadata", "dictionary", "retrieve", "a", "particular", "key", "from", "it", ".", "If", "no", "metadata", "exists", "or", "the", "key", "does", "not", "exist", "return", "None", "." ]
python
train
mar10/pyftpsync
ftpsync/util.py
https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/util.py#L202-L285
def get_credentials_for_url(url, opts, force_user=None): """Lookup credentials for a given target in keyring and .netrc. Optionally prompts for credentials if not found. Returns: 2-tuple (username, password) or None """ creds = None verbose = int(opts.get("verbose")) force_prompt =...
[ "def", "get_credentials_for_url", "(", "url", ",", "opts", ",", "force_user", "=", "None", ")", ":", "creds", "=", "None", "verbose", "=", "int", "(", "opts", ".", "get", "(", "\"verbose\"", ")", ")", "force_prompt", "=", "opts", ".", "get", "(", "\"pr...
Lookup credentials for a given target in keyring and .netrc. Optionally prompts for credentials if not found. Returns: 2-tuple (username, password) or None
[ "Lookup", "credentials", "for", "a", "given", "target", "in", "keyring", "and", ".", "netrc", "." ]
python
train
pseudonym117/Riot-Watcher
src/riotwatcher/_apis/SummonerApiV4.py
https://github.com/pseudonym117/Riot-Watcher/blob/21ab12453a0d824d67e30f5514d02a5c5a411dea/src/riotwatcher/_apis/SummonerApiV4.py#L62-L74
def by_id(self, region, encrypted_summoner_id): """ Get a summoner by summoner ID. :param string region: The region to execute this request on :param string encrypted_summoner_id: Summoner ID :returns: SummonerDTO: represents a summoner """ ...
[ "def", "by_id", "(", "self", ",", "region", ",", "encrypted_summoner_id", ")", ":", "url", ",", "query", "=", "SummonerApiV4Urls", ".", "by_id", "(", "region", "=", "region", ",", "encrypted_summoner_id", "=", "encrypted_summoner_id", ")", "return", "self", "....
Get a summoner by summoner ID. :param string region: The region to execute this request on :param string encrypted_summoner_id: Summoner ID :returns: SummonerDTO: represents a summoner
[ "Get", "a", "summoner", "by", "summoner", "ID", "." ]
python
train
IDSIA/sacred
sacred/commandline_options.py
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/commandline_options.py#L159-L165
def gather_command_line_options(filter_disabled=None): """Get a sorted list of all CommandLineOption subclasses.""" if filter_disabled is None: filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS options = [opt for opt in get_inheritors(CommandLineOption) if not filter_d...
[ "def", "gather_command_line_options", "(", "filter_disabled", "=", "None", ")", ":", "if", "filter_disabled", "is", "None", ":", "filter_disabled", "=", "not", "SETTINGS", ".", "COMMAND_LINE", ".", "SHOW_DISABLED_OPTIONS", "options", "=", "[", "opt", "for", "opt",...
Get a sorted list of all CommandLineOption subclasses.
[ "Get", "a", "sorted", "list", "of", "all", "CommandLineOption", "subclasses", "." ]
python
train
edx/edx-search
search/elastic.py
https://github.com/edx/edx-search/blob/476cf02b71ceba34ae7d8b798f36d60692317c55/search/elastic.py#L172-L185
def _process_facet_terms(facet_terms): """ We have a list of terms with which we return facets """ elastic_facets = {} for facet in facet_terms: facet_term = {"field": facet} if facet_terms[facet]: for facet_option in facet_terms[facet]: facet_term[facet_option] =...
[ "def", "_process_facet_terms", "(", "facet_terms", ")", ":", "elastic_facets", "=", "{", "}", "for", "facet", "in", "facet_terms", ":", "facet_term", "=", "{", "\"field\"", ":", "facet", "}", "if", "facet_terms", "[", "facet", "]", ":", "for", "facet_option"...
We have a list of terms with which we return facets
[ "We", "have", "a", "list", "of", "terms", "with", "which", "we", "return", "facets" ]
python
valid
robertpeteuil/multi-cloud-control
mcc/cldcnct.py
https://github.com/robertpeteuil/multi-cloud-control/blob/f1565af1c0b6ed465ff312d3ccc592ba0609f4a2/mcc/cldcnct.py#L288-L299
def adj_nodes_ali(ali_nodes): """Adjust details specific to AliCloud.""" for node in ali_nodes: node.cloud = "alicloud" node.cloud_disp = "AliCloud" node.private_ips = ip_to_str(node.extra['vpc_attributes']['private_ip_address']) node.public_ips = ip_to_str(node.public_ips) ...
[ "def", "adj_nodes_ali", "(", "ali_nodes", ")", ":", "for", "node", "in", "ali_nodes", ":", "node", ".", "cloud", "=", "\"alicloud\"", "node", ".", "cloud_disp", "=", "\"AliCloud\"", "node", ".", "private_ips", "=", "ip_to_str", "(", "node", ".", "extra", "...
Adjust details specific to AliCloud.
[ "Adjust", "details", "specific", "to", "AliCloud", "." ]
python
train
hyperledger/indy-sdk
vcx/wrappers/python3/vcx/api/proof.py
https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/proof.py#L55-L70
async def deserialize(data: dict): """ Builds a Proof object with defined attributes. Attributes are provided by a previous call to the serialize function. :param data: Example: name = "proof name" requested_attrs = [{"name": "age", "restrictions": [{"schema_id": ...
[ "async", "def", "deserialize", "(", "data", ":", "dict", ")", ":", "return", "await", "Proof", ".", "_deserialize", "(", "\"vcx_proof_deserialize\"", ",", "json", ".", "dumps", "(", "data", ")", ",", "data", ".", "get", "(", "'data'", ")", ".", "get", ...
Builds a Proof object with defined attributes. Attributes are provided by a previous call to the serialize function. :param data: Example: name = "proof name" requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11", "schema_...
[ "Builds", "a", "Proof", "object", "with", "defined", "attributes", ".", "Attributes", "are", "provided", "by", "a", "previous", "call", "to", "the", "serialize", "function", ".", ":", "param", "data", ":", "Example", ":", "name", "=", "proof", "name", "req...
python
train
gwpy/gwpy
gwpy/segments/flag.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/segments/flag.py#L457-L522
def query_dqsegdb(cls, flag, *args, **kwargs): """Query the advanced LIGO DQSegDB for the given flag Parameters ---------- flag : `str` The name of the flag for which to query *args Either, two `float`-like numbers indicating the GPS [start, ...
[ "def", "query_dqsegdb", "(", "cls", ",", "flag", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# parse arguments", "qsegs", "=", "_parse_query_segments", "(", "args", ",", "cls", ".", "query_dqsegdb", ")", "# get server", "url", "=", "kwargs", ".",...
Query the advanced LIGO DQSegDB for the given flag Parameters ---------- flag : `str` The name of the flag for which to query *args Either, two `float`-like numbers indicating the GPS [start, stop) interval, or a `SegmentList` defining a ...
[ "Query", "the", "advanced", "LIGO", "DQSegDB", "for", "the", "given", "flag" ]
python
train
pallets/werkzeug
src/werkzeug/utils.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L669-L707
def bind_arguments(func, args, kwargs): """Bind the arguments provided into a dict. When passed a function, a tuple of arguments and a dict of keyword arguments `bind_arguments` returns a dict of names as the function would see it. This can be useful to implement a cache decorator that uses the functi...
[ "def", "bind_arguments", "(", "func", ",", "args", ",", "kwargs", ")", ":", "(", "args", ",", "kwargs", ",", "missing", ",", "extra", ",", "extra_positional", ",", "arg_spec", ",", "vararg_var", ",", "kwarg_var", ",", ")", "=", "_parse_signature", "(", "...
Bind the arguments provided into a dict. When passed a function, a tuple of arguments and a dict of keyword arguments `bind_arguments` returns a dict of names as the function would see it. This can be useful to implement a cache decorator that uses the function arguments to build the cache key based o...
[ "Bind", "the", "arguments", "provided", "into", "a", "dict", ".", "When", "passed", "a", "function", "a", "tuple", "of", "arguments", "and", "a", "dict", "of", "keyword", "arguments", "bind_arguments", "returns", "a", "dict", "of", "names", "as", "the", "f...
python
train
Pytwitcher/pytwitcherapi
src/pytwitcherapi/session.py
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/session.py#L89-L109
def request(self, method, url, **kwargs): """Constructs a :class:`requests.Request`, prepares it and sends it. Raises HTTPErrors by default. :param method: method for the new :class:`Request` object. :type method: :class:`str` :param url: URL for the new :class:`Request` object....
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "if", "oauthlib", ".", "oauth2", ".", "is_secure_transport", "(", "url", ")", ":", "m", "=", "super", "(", "OAuthSession", ",", "self", ")", ".", "request", ...
Constructs a :class:`requests.Request`, prepares it and sends it. Raises HTTPErrors by default. :param method: method for the new :class:`Request` object. :type method: :class:`str` :param url: URL for the new :class:`Request` object. :type url: :class:`str` :param kwarg...
[ "Constructs", "a", ":", "class", ":", "requests", ".", "Request", "prepares", "it", "and", "sends", "it", ".", "Raises", "HTTPErrors", "by", "default", "." ]
python
train
draperjames/qtpandas
qtpandas/models/DataFrameModel.py
https://github.com/draperjames/qtpandas/blob/64294fb69f1839e53dee5ea453337266bfaf24f4/qtpandas/models/DataFrameModel.py#L621-L632
def enableEditing(self, editable=True): """ Sets the DataFrameModel and columnDtypeModel's editable properties. :param editable: bool defaults to True, False disables most editing methods. :return: None """ self.editable = edita...
[ "def", "enableEditing", "(", "self", ",", "editable", "=", "True", ")", ":", "self", ".", "editable", "=", "editable", "self", ".", "_columnDtypeModel", ".", "setEditable", "(", "self", ".", "editable", ")" ]
Sets the DataFrameModel and columnDtypeModel's editable properties. :param editable: bool defaults to True, False disables most editing methods. :return: None
[ "Sets", "the", "DataFrameModel", "and", "columnDtypeModel", "s", "editable", "properties", ".", ":", "param", "editable", ":", "bool", "defaults", "to", "True", "False", "disables", "most", "editing", "methods", ".", ":", "return", ":", "None" ]
python
train
iotaledger/iota.lib.py
iota/adapter/sandbox.py
https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/adapter/sandbox.py#L191-L205
def get_jobs_url(self, job_id): # type: (Text) -> Text """ Returns the URL to check job status. :param job_id: The ID of the job to check. """ return compat.urllib_parse.urlunsplit(( self.uri.scheme, self.uri.netloc, self.u...
[ "def", "get_jobs_url", "(", "self", ",", "job_id", ")", ":", "# type: (Text) -> Text", "return", "compat", ".", "urllib_parse", ".", "urlunsplit", "(", "(", "self", ".", "uri", ".", "scheme", ",", "self", ".", "uri", ".", "netloc", ",", "self", ".", "uri...
Returns the URL to check job status. :param job_id: The ID of the job to check.
[ "Returns", "the", "URL", "to", "check", "job", "status", "." ]
python
test
zimeon/iiif
iiif/generators/check.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/generators/check.py#L31-L55
def pixel(self, x, y, size=None, red=0): """Return color for a pixel. The paremeter size is used to recursively follow down to smaller and smaller middle squares (number 5). The paremeter red is used to shade from black to red going toward the middle of the figure. """ i...
[ "def", "pixel", "(", "self", ",", "x", ",", "y", ",", "size", "=", "None", ",", "red", "=", "0", ")", ":", "if", "(", "size", "is", "None", ")", ":", "size", "=", "self", ".", "sz", "# Have we go to the smallest element?", "if", "(", "size", "<=", ...
Return color for a pixel. The paremeter size is used to recursively follow down to smaller and smaller middle squares (number 5). The paremeter red is used to shade from black to red going toward the middle of the figure.
[ "Return", "color", "for", "a", "pixel", "." ]
python
train
szastupov/aiotg
aiotg/bot.py
https://github.com/szastupov/aiotg/blob/eed81a6a728c02120f1d730a6e8b8fe50263c010/aiotg/bot.py#L489-L504
def edit_message_reply_markup(self, chat_id, message_id, reply_markup, **options): """ Edit a reply markup of message in a chat :param int chat_id: ID of the chat the message to edit is in :param int message_id: ID of the message to edit :param str reply_markup: New inline keybo...
[ "def", "edit_message_reply_markup", "(", "self", ",", "chat_id", ",", "message_id", ",", "reply_markup", ",", "*", "*", "options", ")", ":", "return", "self", ".", "api_call", "(", "\"editMessageReplyMarkup\"", ",", "chat_id", "=", "chat_id", ",", "message_id", ...
Edit a reply markup of message in a chat :param int chat_id: ID of the chat the message to edit is in :param int message_id: ID of the message to edit :param str reply_markup: New inline keyboard markup for the message :param options: Additional API options
[ "Edit", "a", "reply", "markup", "of", "message", "in", "a", "chat" ]
python
train
nosegae/NoseGAE
nosegae.py
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L251-L253
def _init_stub(self, stub_init, **stub_kwargs): """Initializes all other stubs for consistency's sake""" getattr(self.testbed, stub_init, lambda **kwargs: None)(**stub_kwargs)
[ "def", "_init_stub", "(", "self", ",", "stub_init", ",", "*", "*", "stub_kwargs", ")", ":", "getattr", "(", "self", ".", "testbed", ",", "stub_init", ",", "lambda", "*", "*", "kwargs", ":", "None", ")", "(", "*", "*", "stub_kwargs", ")" ]
Initializes all other stubs for consistency's sake
[ "Initializes", "all", "other", "stubs", "for", "consistency", "s", "sake" ]
python
train
bcbio/bcbio-nextgen
bcbio/workflow/template.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/workflow/template.py#L279-L308
def _parse_metadata(in_handle): """Reads metadata from a simple CSV structured input file. samplename,batch,phenotype ERR256785,batch1,normal """ metadata = {} reader = csv.reader(in_handle) while 1: header = next(reader) if not header[0].startswith("#"): break ...
[ "def", "_parse_metadata", "(", "in_handle", ")", ":", "metadata", "=", "{", "}", "reader", "=", "csv", ".", "reader", "(", "in_handle", ")", "while", "1", ":", "header", "=", "next", "(", "reader", ")", "if", "not", "header", "[", "0", "]", ".", "s...
Reads metadata from a simple CSV structured input file. samplename,batch,phenotype ERR256785,batch1,normal
[ "Reads", "metadata", "from", "a", "simple", "CSV", "structured", "input", "file", "." ]
python
train
pkgw/pwkit
pwkit/contours.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/contours.py#L22-L278
def analytic_2d (f, df, x0, y0, maxiters=5000, defeta=0.05, netastep=12, vtol1=1e-3, vtol2=1e-8, maxnewt=20, dorder=7, goright=False): """Sample a contour in a 2D analytic function...
[ "def", "analytic_2d", "(", "f", ",", "df", ",", "x0", ",", "y0", ",", "maxiters", "=", "5000", ",", "defeta", "=", "0.05", ",", "netastep", "=", "12", ",", "vtol1", "=", "1e-3", ",", "vtol2", "=", "1e-8", ",", "maxnewt", "=", "20", ",", "dorder",...
Sample a contour in a 2D analytic function. Arguments: f A function, mapping (x, y) -> z. df The partial derivative: df (x, y) -> [dz/dx, dz/dy]. If None, the derivative of f is approximated numerically with scipy.derivative. x0 Initial x value. Should be of "typical" size for...
[ "Sample", "a", "contour", "in", "a", "2D", "analytic", "function", ".", "Arguments", ":" ]
python
train
materialsproject/pymatgen-db
matgendb/builders/incr.py
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/incr.py#L355-L371
def save(self, mark): """Save a position in this collection. :param mark: The position to save :type mark: Mark :raises: DBError, NoTrackingCollection """ self._check_exists() obj = mark.as_dict() try: # Make a 'filter' to find/update existing...
[ "def", "save", "(", "self", ",", "mark", ")", ":", "self", ".", "_check_exists", "(", ")", "obj", "=", "mark", ".", "as_dict", "(", ")", "try", ":", "# Make a 'filter' to find/update existing record, which uses", "# the field name and operation (but not the position).",...
Save a position in this collection. :param mark: The position to save :type mark: Mark :raises: DBError, NoTrackingCollection
[ "Save", "a", "position", "in", "this", "collection", "." ]
python
train
svartalf/python-opus
opus/api/ctl.py
https://github.com/svartalf/python-opus/blob/a3c1d556d2772b5be659ddd08c033ddd4d566b3a/opus/api/ctl.py#L19-L30
def query(request): """Query encoder/decoder with a request value""" def inner(func, obj): result_code = func(obj, request) if result_code is not constants.OK: raise OpusError(result_code) return result_code return inner
[ "def", "query", "(", "request", ")", ":", "def", "inner", "(", "func", ",", "obj", ")", ":", "result_code", "=", "func", "(", "obj", ",", "request", ")", "if", "result_code", "is", "not", "constants", ".", "OK", ":", "raise", "OpusError", "(", "resul...
Query encoder/decoder with a request value
[ "Query", "encoder", "/", "decoder", "with", "a", "request", "value" ]
python
train
lotabout/pymustache
pymustache/mustache.py
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L263-L269
def _escape(self, text): """Escape text according to self.escape""" ret = EMPTYSTRING if text is None else str(text) if self.escape: return html_escape(ret) else: return ret
[ "def", "_escape", "(", "self", ",", "text", ")", ":", "ret", "=", "EMPTYSTRING", "if", "text", "is", "None", "else", "str", "(", "text", ")", "if", "self", ".", "escape", ":", "return", "html_escape", "(", "ret", ")", "else", ":", "return", "ret" ]
Escape text according to self.escape
[ "Escape", "text", "according", "to", "self", ".", "escape" ]
python
train
google/fleetspeak
fleetspeak/src/client/daemonservice/client/client.py
https://github.com/google/fleetspeak/blob/bc95dd6941494461d2e5dff0a7f4c78a07ff724d/fleetspeak/src/client/daemonservice/client/client.py#L58-L71
def _EnvOpen(var, mode): """Open a file descriptor identified by an environment variable.""" value = os.getenv(var) if value is None: raise ValueError("%s is not set" % var) fd = int(value) # If running on Windows, convert the file handle to a C file descriptor; see: # https://groups.google.com/forum/...
[ "def", "_EnvOpen", "(", "var", ",", "mode", ")", ":", "value", "=", "os", ".", "getenv", "(", "var", ")", "if", "value", "is", "None", ":", "raise", "ValueError", "(", "\"%s is not set\"", "%", "var", ")", "fd", "=", "int", "(", "value", ")", "# If...
Open a file descriptor identified by an environment variable.
[ "Open", "a", "file", "descriptor", "identified", "by", "an", "environment", "variable", "." ]
python
train
alex-kostirin/pyatomac
atomac/ldtpd/combo_box.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/combo_box.py#L31-L83
def selectitem(self, window_name, object_name, item_name): """ Select combo box / layered pane item @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to ...
[ "def", "selectitem", "(", "self", ",", "window_name", ",", "object_name", ",", "item_name", ")", ":", "object_handle", "=", "self", ".", "_get_object_handle", "(", "window_name", ",", "object_name", ")", "if", "not", "object_handle", ".", "AXEnabled", ":", "ra...
Select combo box / layered pane item @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name convention, or a Unix glob. ...
[ "Select", "combo", "box", "/", "layered", "pane", "item", "@param", "window_name", ":", "Window", "name", "to", "type", "in", "either", "full", "name", "LDTP", "s", "name", "convention", "or", "a", "Unix", "glob", ".", "@type", "window_name", ":", "string"...
python
valid
rigetti/pyquil
pyquil/wavefunction.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/wavefunction.py#L230-L247
def _octet_bits(o): """ Get the bits of an octet. :param o: The octets. :return: The bits as a list in LSB-to-MSB order. :rtype: list """ if not isinstance(o, integer_types): raise TypeError("o should be an int") if not (0 <= o <= 255): raise ValueError("o should be betw...
[ "def", "_octet_bits", "(", "o", ")", ":", "if", "not", "isinstance", "(", "o", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"o should be an int\"", ")", "if", "not", "(", "0", "<=", "o", "<=", "255", ")", ":", "raise", "ValueError", "("...
Get the bits of an octet. :param o: The octets. :return: The bits as a list in LSB-to-MSB order. :rtype: list
[ "Get", "the", "bits", "of", "an", "octet", "." ]
python
train
saltstack/salt
salt/modules/rh_service.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_service.py#L186-L204
def _chkconfig_is_enabled(name, runlevel=None): ''' Return ``True`` if the service is enabled according to chkconfig; otherwise return ``False``. If ``runlevel`` is ``None``, then use the current runlevel. ''' cmdline = '/sbin/chkconfig --list {0}'.format(name) result = __salt__['cmd.run_al...
[ "def", "_chkconfig_is_enabled", "(", "name", ",", "runlevel", "=", "None", ")", ":", "cmdline", "=", "'/sbin/chkconfig --list {0}'", ".", "format", "(", "name", ")", "result", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmdline", ",", "python_shell", "="...
Return ``True`` if the service is enabled according to chkconfig; otherwise return ``False``. If ``runlevel`` is ``None``, then use the current runlevel.
[ "Return", "True", "if", "the", "service", "is", "enabled", "according", "to", "chkconfig", ";", "otherwise", "return", "False", ".", "If", "runlevel", "is", "None", "then", "use", "the", "current", "runlevel", "." ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_vcs_rpc/show_vcs/output/vcs_nodes/vcs_node_info/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_vcs_rpc/show_vcs/output/vcs_nodes/vcs_node_info/__init__.py#L267-L290
def _set_node_hw_sync_state(self, v, load=False): """ Setter method for node_hw_sync_state, mapped from YANG variable /brocade_vcs_rpc/show_vcs/output/vcs_nodes/vcs_node_info/node_hw_sync_state (node-hw-sync-state-type) If this variable is read-only (config: false) in the source YANG file, then _set_nod...
[ "def", "_set_node_hw_sync_state", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ","...
Setter method for node_hw_sync_state, mapped from YANG variable /brocade_vcs_rpc/show_vcs/output/vcs_nodes/vcs_node_info/node_hw_sync_state (node-hw-sync-state-type) If this variable is read-only (config: false) in the source YANG file, then _set_node_hw_sync_state is considered as a private method. Backend...
[ "Setter", "method", "for", "node_hw_sync_state", "mapped", "from", "YANG", "variable", "/", "brocade_vcs_rpc", "/", "show_vcs", "/", "output", "/", "vcs_nodes", "/", "vcs_node_info", "/", "node_hw_sync_state", "(", "node", "-", "hw", "-", "sync", "-", "state", ...
python
train
quantumlib/Cirq
cirq/sim/wave_function.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/sim/wave_function.py#L82-L116
def density_matrix_of(self, qubits: List[ops.Qid] = None) -> np.ndarray: r"""Returns the density matrix of the state. Calculate the density matrix for the system on the list, qubits. Any qubits not in the list that are present in self.state_vector() will be traced out. If qubits is None...
[ "def", "density_matrix_of", "(", "self", ",", "qubits", ":", "List", "[", "ops", ".", "Qid", "]", "=", "None", ")", "->", "np", ".", "ndarray", ":", "return", "density_matrix_from_state_vector", "(", "self", ".", "state_vector", "(", ")", ",", "[", "self...
r"""Returns the density matrix of the state. Calculate the density matrix for the system on the list, qubits. Any qubits not in the list that are present in self.state_vector() will be traced out. If qubits is None the full density matrix for self.state_vector() is returned, given self....
[ "r", "Returns", "the", "density", "matrix", "of", "the", "state", "." ]
python
train
osrg/ryu
ryu/lib/ovs/bridge.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/lib/ovs/bridge.py#L318-L328
def db_get_map(self, table, record, column): """ Gets dict type value of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL """ val = self.db_get_val(table, record, column) assert is...
[ "def", "db_get_map", "(", "self", ",", "table", ",", "record", ",", "column", ")", ":", "val", "=", "self", ".", "db_get_val", "(", "table", ",", "record", ",", "column", ")", "assert", "isinstance", "(", "val", ",", "dict", ")", "return", "val" ]
Gets dict type value of 'column' in 'record' in 'table'. This method is corresponding to the following ovs-vsctl command:: $ ovs-vsctl get TBL REC COL
[ "Gets", "dict", "type", "value", "of", "column", "in", "record", "in", "table", "." ]
python
train
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L71-L81
def getCompilerFlags(self, engineRoot, fmt): """ Constructs the compiler flags string for building against this library """ return Utility.join( fmt.delim, self.prefixedStrings(self.definitionPrefix, self.definitions, engineRoot) + self.prefixedStrings(self.includeDirPrefix, self.includeDirs, engine...
[ "def", "getCompilerFlags", "(", "self", ",", "engineRoot", ",", "fmt", ")", ":", "return", "Utility", ".", "join", "(", "fmt", ".", "delim", ",", "self", ".", "prefixedStrings", "(", "self", ".", "definitionPrefix", ",", "self", ".", "definitions", ",", ...
Constructs the compiler flags string for building against this library
[ "Constructs", "the", "compiler", "flags", "string", "for", "building", "against", "this", "library" ]
python
train
transifex/transifex-python-library
txlib/api/base.py
https://github.com/transifex/transifex-python-library/blob/9fea86b718973de35ccca6d54bd1f445c9632406/txlib/api/base.py#L264-L269
def _update(self, **kwargs): """Update a resource in a remote Transifex server.""" path = self._construct_path_to_item() if not kwargs: return return self._http.put(path, json.dumps(kwargs))
[ "def", "_update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "path", "=", "self", ".", "_construct_path_to_item", "(", ")", "if", "not", "kwargs", ":", "return", "return", "self", ".", "_http", ".", "put", "(", "path", ",", "json", ".", "dumps",...
Update a resource in a remote Transifex server.
[ "Update", "a", "resource", "in", "a", "remote", "Transifex", "server", "." ]
python
train
markovmodel/msmtools
msmtools/estimation/sparse/newton/linsolve.py
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/newton/linsolve.py#L183-L228
def solve_factorized_aug(z, Fval, LU, G, A): M, N=G.shape P, N=A.shape """Total number of inequality constraints""" m = M """Primal variable""" x = z[0:N] """Multiplier for equality constraints""" nu = z[N:N+P] """Multiplier for inequality constraints""" l = z[N+P:N+P+M] ...
[ "def", "solve_factorized_aug", "(", "z", ",", "Fval", ",", "LU", ",", "G", ",", "A", ")", ":", "M", ",", "N", "=", "G", ".", "shape", "P", ",", "N", "=", "A", ".", "shape", "m", "=", "M", "\"\"\"Primal variable\"\"\"", "x", "=", "z", "[", "0", ...
Total number of inequality constraints
[ "Total", "number", "of", "inequality", "constraints" ]
python
train
cherrypy/cheroot
cheroot/server.py
https://github.com/cherrypy/cheroot/blob/2af3b1798d66da697957480d3a8b4831a405770b/cheroot/server.py#L1083-L1118
def simple_response(self, status, msg=''): """Write a simple response back to the client.""" status = str(status) proto_status = '%s %s\r\n' % (self.server.protocol, status) content_length = 'Content-Length: %s\r\n' % len(msg) content_type = 'Content-Type: text/plain\r\n' ...
[ "def", "simple_response", "(", "self", ",", "status", ",", "msg", "=", "''", ")", ":", "status", "=", "str", "(", "status", ")", "proto_status", "=", "'%s %s\\r\\n'", "%", "(", "self", ".", "server", ".", "protocol", ",", "status", ")", "content_length",...
Write a simple response back to the client.
[ "Write", "a", "simple", "response", "back", "to", "the", "client", "." ]
python
train
spyder-ide/spyder
spyder/plugins/editor/utils/editor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L530-L542
def line_nbr_from_position(self, y_pos): """ Returns the line number from the y_pos. :param y_pos: Y pos in the editor :return: Line number (0 based), -1 if out of range """ editor = self._editor height = editor.fontMetrics().height() for top, line, block...
[ "def", "line_nbr_from_position", "(", "self", ",", "y_pos", ")", ":", "editor", "=", "self", ".", "_editor", "height", "=", "editor", ".", "fontMetrics", "(", ")", ".", "height", "(", ")", "for", "top", ",", "line", ",", "block", "in", "editor", ".", ...
Returns the line number from the y_pos. :param y_pos: Y pos in the editor :return: Line number (0 based), -1 if out of range
[ "Returns", "the", "line", "number", "from", "the", "y_pos", "." ]
python
train
tensorflow/mesh
mesh_tensorflow/transformer/transformer.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/transformer/transformer.py#L946-L955
def make_layer_stack(layers=gin.REQUIRED, num_layers=6): """Configurable layer stack. Args: layers: a list of subclasses of TransformerLayer num_layers: an integer Returns: a LayerStack """ return LayerStack([cls() for cls in layers] * num_layers)
[ "def", "make_layer_stack", "(", "layers", "=", "gin", ".", "REQUIRED", ",", "num_layers", "=", "6", ")", ":", "return", "LayerStack", "(", "[", "cls", "(", ")", "for", "cls", "in", "layers", "]", "*", "num_layers", ")" ]
Configurable layer stack. Args: layers: a list of subclasses of TransformerLayer num_layers: an integer Returns: a LayerStack
[ "Configurable", "layer", "stack", "." ]
python
train
juanifioren/django-oidc-provider
oidc_provider/lib/utils/token.py
https://github.com/juanifioren/django-oidc-provider/blob/f0daed07b2ac7608565b80d4c80ccf04d8c416a8/oidc_provider/lib/utils/token.py#L72-L79
def encode_id_token(payload, client): """ Represent the ID Token as a JSON Web Token (JWT). Return a hash. """ keys = get_client_alg_keys(client) _jws = JWS(payload, alg=client.jwt_alg) return _jws.sign_compact(keys)
[ "def", "encode_id_token", "(", "payload", ",", "client", ")", ":", "keys", "=", "get_client_alg_keys", "(", "client", ")", "_jws", "=", "JWS", "(", "payload", ",", "alg", "=", "client", ".", "jwt_alg", ")", "return", "_jws", ".", "sign_compact", "(", "ke...
Represent the ID Token as a JSON Web Token (JWT). Return a hash.
[ "Represent", "the", "ID", "Token", "as", "a", "JSON", "Web", "Token", "(", "JWT", ")", ".", "Return", "a", "hash", "." ]
python
train