id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
248,200 | kmedian/onepara | onepara/onepara_func.py | onepara | def onepara(R):
"""Converts an ill-conditioned correlation matrix
into well-conditioned matrix with one common
correlation coefficient
Parameters:
-----------
R : ndarray
an illconditioned correlation matrix,
e.g. oxyba.illcond_corrmat
Return:
-------
cmat : n... | python | def onepara(R):
"""Converts an ill-conditioned correlation matrix
into well-conditioned matrix with one common
correlation coefficient
Parameters:
-----------
R : ndarray
an illconditioned correlation matrix,
e.g. oxyba.illcond_corrmat
Return:
-------
cmat : n... | [
"def",
"onepara",
"(",
"R",
")",
":",
"import",
"numpy",
"as",
"np",
"import",
"warnings",
"d",
"=",
"R",
".",
"shape",
"[",
"0",
"]",
"if",
"d",
"<",
"2",
":",
"raise",
"Exception",
"(",
"(",
"\"More than one variable is required.\"",
"\"Supply at least a... | Converts an ill-conditioned correlation matrix
into well-conditioned matrix with one common
correlation coefficient
Parameters:
-----------
R : ndarray
an illconditioned correlation matrix,
e.g. oxyba.illcond_corrmat
Return:
-------
cmat : ndarray
DxD matr... | [
"Converts",
"an",
"ill",
"-",
"conditioned",
"correlation",
"matrix",
"into",
"well",
"-",
"conditioned",
"matrix",
"with",
"one",
"common",
"correlation",
"coefficient"
] | ed4142b92e3f67bad209dbea1eafc9ea6e3c32b9 | https://github.com/kmedian/onepara/blob/ed4142b92e3f67bad209dbea1eafc9ea6e3c32b9/onepara/onepara_func.py#L2-L39 |
248,201 | cbrand/vpnchooser | src/vpnchooser/query/rules_query.py | RulesQuery._load_rules | def _load_rules(self):
"""
Loads the rules from the SSH-Connection
"""
with self._sftp_connection.open(self.RULE_PATH) as file:
data = file.read()
lines = (
line.strip()
for line in data.split('\n')
)
rule_strings = (
... | python | def _load_rules(self):
"""
Loads the rules from the SSH-Connection
"""
with self._sftp_connection.open(self.RULE_PATH) as file:
data = file.read()
lines = (
line.strip()
for line in data.split('\n')
)
rule_strings = (
... | [
"def",
"_load_rules",
"(",
"self",
")",
":",
"with",
"self",
".",
"_sftp_connection",
".",
"open",
"(",
"self",
".",
"RULE_PATH",
")",
"as",
"file",
":",
"data",
"=",
"file",
".",
"read",
"(",
")",
"lines",
"=",
"(",
"line",
".",
"strip",
"(",
")",... | Loads the rules from the SSH-Connection | [
"Loads",
"the",
"rules",
"from",
"the",
"SSH",
"-",
"Connection"
] | d153e3d05555c23cf5e8e15e507eecad86465923 | https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/query/rules_query.py#L17-L39 |
248,202 | cbrand/vpnchooser | src/vpnchooser/query/rules_query.py | RulesQuery._exec_command | def _exec_command(self, command: str):
"""
Executes the command and closes the handles
afterwards.
"""
stdin, stdout, stderr = self._ssh.exec_command(command)
# Clearing the buffers
stdout.read()
stderr.read()
stdin.close() | python | def _exec_command(self, command: str):
"""
Executes the command and closes the handles
afterwards.
"""
stdin, stdout, stderr = self._ssh.exec_command(command)
# Clearing the buffers
stdout.read()
stderr.read()
stdin.close() | [
"def",
"_exec_command",
"(",
"self",
",",
"command",
":",
"str",
")",
":",
"stdin",
",",
"stdout",
",",
"stderr",
"=",
"self",
".",
"_ssh",
".",
"exec_command",
"(",
"command",
")",
"# Clearing the buffers",
"stdout",
".",
"read",
"(",
")",
"stderr",
"."... | Executes the command and closes the handles
afterwards. | [
"Executes",
"the",
"command",
"and",
"closes",
"the",
"handles",
"afterwards",
"."
] | d153e3d05555c23cf5e8e15e507eecad86465923 | https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/query/rules_query.py#L71-L80 |
248,203 | cbrand/vpnchooser | src/vpnchooser/query/rules_query.py | RulesQuery.sync | def sync(self, rules: list):
"""
Synchronizes the given rules with the server
and ensures that there are no old rules active
which are not in the given list.
"""
self._reset()
old_rules = self.rules
to_delete_rules = [
rule for rule in old_rule... | python | def sync(self, rules: list):
"""
Synchronizes the given rules with the server
and ensures that there are no old rules active
which are not in the given list.
"""
self._reset()
old_rules = self.rules
to_delete_rules = [
rule for rule in old_rule... | [
"def",
"sync",
"(",
"self",
",",
"rules",
":",
"list",
")",
":",
"self",
".",
"_reset",
"(",
")",
"old_rules",
"=",
"self",
".",
"rules",
"to_delete_rules",
"=",
"[",
"rule",
"for",
"rule",
"in",
"old_rules",
"if",
"rule",
"not",
"in",
"rules",
"]",
... | Synchronizes the given rules with the server
and ensures that there are no old rules active
which are not in the given list. | [
"Synchronizes",
"the",
"given",
"rules",
"with",
"the",
"server",
"and",
"ensures",
"that",
"there",
"are",
"no",
"old",
"rules",
"active",
"which",
"are",
"not",
"in",
"the",
"given",
"list",
"."
] | d153e3d05555c23cf5e8e15e507eecad86465923 | https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/query/rules_query.py#L82-L107 |
248,204 | cbrand/vpnchooser | src/vpnchooser/query/rules_query.py | RulesQuery._update | def _update(self, rules: list):
"""
Updates the given rules and stores
them on the router.
"""
self._rules = rules
to_store = '\n'.join(
rule.config_string
for rule in rules
)
sftp_connection = self._sftp_connection
with sft... | python | def _update(self, rules: list):
"""
Updates the given rules and stores
them on the router.
"""
self._rules = rules
to_store = '\n'.join(
rule.config_string
for rule in rules
)
sftp_connection = self._sftp_connection
with sft... | [
"def",
"_update",
"(",
"self",
",",
"rules",
":",
"list",
")",
":",
"self",
".",
"_rules",
"=",
"rules",
"to_store",
"=",
"'\\n'",
".",
"join",
"(",
"rule",
".",
"config_string",
"for",
"rule",
"in",
"rules",
")",
"sftp_connection",
"=",
"self",
".",
... | Updates the given rules and stores
them on the router. | [
"Updates",
"the",
"given",
"rules",
"and",
"stores",
"them",
"on",
"the",
"router",
"."
] | d153e3d05555c23cf5e8e15e507eecad86465923 | https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/query/rules_query.py#L109-L121 |
248,205 | kynikos/lib.py.cmenu | cmenu.py | _CommandWithFlags.complete | def complete(self, sp_args, line, rl_prefix, rl_begidx, rl_endidx):
"""
Override in order to have command or argument completion.
It is necessary to return a 'list', i.e. not a tuple or other
sequences.
"""
# TODO: Optionally check that flags are not repeated (i.e. exclu... | python | def complete(self, sp_args, line, rl_prefix, rl_begidx, rl_endidx):
"""
Override in order to have command or argument completion.
It is necessary to return a 'list', i.e. not a tuple or other
sequences.
"""
# TODO: Optionally check that flags are not repeated (i.e. exclu... | [
"def",
"complete",
"(",
"self",
",",
"sp_args",
",",
"line",
",",
"rl_prefix",
",",
"rl_begidx",
",",
"rl_endidx",
")",
":",
"# TODO: Optionally check that flags are not repeated (i.e. exclude",
"# them from the possible matches if they are already in the",
"# command... | Override in order to have command or argument completion.
It is necessary to return a 'list', i.e. not a tuple or other
sequences. | [
"Override",
"in",
"order",
"to",
"have",
"command",
"or",
"argument",
"completion",
"."
] | eb1e806f0b674c4deb24730cbd7cf4604150c461 | https://github.com/kynikos/lib.py.cmenu/blob/eb1e806f0b674c4deb24730cbd7cf4604150c461/cmenu.py#L264-L298 |
248,206 | troup-system/troup | troup/infrastructure.py | IncomingChannelWSAdapter.local_address | def local_address(self):
"""
Local endpoint address as a tuple
"""
if not self._local_address:
self._local_address = self.proto.reader._transport.get_extra_info('sockname')
if len(self._local_address) == 4:
self._local_address = self._local_address... | python | def local_address(self):
"""
Local endpoint address as a tuple
"""
if not self._local_address:
self._local_address = self.proto.reader._transport.get_extra_info('sockname')
if len(self._local_address) == 4:
self._local_address = self._local_address... | [
"def",
"local_address",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_local_address",
":",
"self",
".",
"_local_address",
"=",
"self",
".",
"proto",
".",
"reader",
".",
"_transport",
".",
"get_extra_info",
"(",
"'sockname'",
")",
"if",
"len",
"(",
"... | Local endpoint address as a tuple | [
"Local",
"endpoint",
"address",
"as",
"a",
"tuple"
] | e3c74c363101243dfbfc3d2f0c7c8fce5d9ad1a8 | https://github.com/troup-system/troup/blob/e3c74c363101243dfbfc3d2f0c7c8fce5d9ad1a8/troup/infrastructure.py#L198-L206 |
248,207 | troup-system/troup | troup/infrastructure.py | IncomingChannelWSAdapter.peer_address | def peer_address(self):
"""
Peer endpoint address as a tuple
"""
if not self._peer_address:
self._peer_address = self.proto.reader._transport.get_extra_info('peername')
if len(self._peer_address) == 4:
self._peer_address = self._peer_address[:2]
... | python | def peer_address(self):
"""
Peer endpoint address as a tuple
"""
if not self._peer_address:
self._peer_address = self.proto.reader._transport.get_extra_info('peername')
if len(self._peer_address) == 4:
self._peer_address = self._peer_address[:2]
... | [
"def",
"peer_address",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_peer_address",
":",
"self",
".",
"_peer_address",
"=",
"self",
".",
"proto",
".",
"reader",
".",
"_transport",
".",
"get_extra_info",
"(",
"'peername'",
")",
"if",
"len",
"(",
"sel... | Peer endpoint address as a tuple | [
"Peer",
"endpoint",
"address",
"as",
"a",
"tuple"
] | e3c74c363101243dfbfc3d2f0c7c8fce5d9ad1a8 | https://github.com/troup-system/troup/blob/e3c74c363101243dfbfc3d2f0c7c8fce5d9ad1a8/troup/infrastructure.py#L209-L217 |
248,208 | lambdalisue/tolerance | src/tolerance/utils.py | argument_switch_generator | def argument_switch_generator(argument_name=None,
default=True,
reverse=False,
keep=False):
"""
Create switch function which return the status from specified named
argument
Parameters
----------
argument_n... | python | def argument_switch_generator(argument_name=None,
default=True,
reverse=False,
keep=False):
"""
Create switch function which return the status from specified named
argument
Parameters
----------
argument_n... | [
"def",
"argument_switch_generator",
"(",
"argument_name",
"=",
"None",
",",
"default",
"=",
"True",
",",
"reverse",
"=",
"False",
",",
"keep",
"=",
"False",
")",
":",
"def",
"switch_function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
... | Create switch function which return the status from specified named
argument
Parameters
----------
argument_name : string or None
An argument name which is used to judge the status.
If ``None`` is specified, the value of
``tolerance.utils.DEFAULT_ARGUMENT_NAME`` will be used ins... | [
"Create",
"switch",
"function",
"which",
"return",
"the",
"status",
"from",
"specified",
"named",
"argument"
] | e332622d78b1f8066098cc768af4ed12ccb4153d | https://github.com/lambdalisue/tolerance/blob/e332622d78b1f8066098cc768af4ed12ccb4153d/src/tolerance/utils.py#L10-L93 |
248,209 | jjangsangy/kan | kan/__main__.py | command_line | def command_line():
'''
Parses users command line arguments and returns the namespace
containing parsed values.
'''
description = 'Kan helps you find the book'
version = ' '.join([__version__, __release__])
parser = ArgumentParser(prog='kan', description=description)
subparser ... | python | def command_line():
'''
Parses users command line arguments and returns the namespace
containing parsed values.
'''
description = 'Kan helps you find the book'
version = ' '.join([__version__, __release__])
parser = ArgumentParser(prog='kan', description=description)
subparser ... | [
"def",
"command_line",
"(",
")",
":",
"description",
"=",
"'Kan helps you find the book'",
"version",
"=",
"' '",
".",
"join",
"(",
"[",
"__version__",
",",
"__release__",
"]",
")",
"parser",
"=",
"ArgumentParser",
"(",
"prog",
"=",
"'kan'",
",",
"description"... | Parses users command line arguments and returns the namespace
containing parsed values. | [
"Parses",
"users",
"command",
"line",
"arguments",
"and",
"returns",
"the",
"namespace",
"containing",
"parsed",
"values",
"."
] | 7da9d9ec5dc6b8bbb86cfd27d737978a406d9fa6 | https://github.com/jjangsangy/kan/blob/7da9d9ec5dc6b8bbb86cfd27d737978a406d9fa6/kan/__main__.py#L18-L83 |
248,210 | edeposit/edeposit.amqp.calibre | src/edeposit/amqp/calibre/calibre.py | convert | def convert(input_format, output_format, b64_data):
"""
Convert `b64_data` fron `input_format` to `output_format`.
Args:
input_format (str): Specification of input format (pdf/epub/whatever),
see :attr:`INPUT_FORMATS` for list.
output_format (str): Specificatio... | python | def convert(input_format, output_format, b64_data):
"""
Convert `b64_data` fron `input_format` to `output_format`.
Args:
input_format (str): Specification of input format (pdf/epub/whatever),
see :attr:`INPUT_FORMATS` for list.
output_format (str): Specificatio... | [
"def",
"convert",
"(",
"input_format",
",",
"output_format",
",",
"b64_data",
")",
":",
"# checks",
"assert",
"input_format",
"in",
"INPUT_FORMATS",
",",
"\"Unsupported input format!\"",
"assert",
"output_format",
"in",
"OUTPUT_FORMATS",
",",
"\"Unsupported output format!... | Convert `b64_data` fron `input_format` to `output_format`.
Args:
input_format (str): Specification of input format (pdf/epub/whatever),
see :attr:`INPUT_FORMATS` for list.
output_format (str): Specification of output format (pdf/epub/..),
s... | [
"Convert",
"b64_data",
"fron",
"input_format",
"to",
"output_format",
"."
] | 60ba5de0c30452d41f6e0da58d2ec6729ebdd7f1 | https://github.com/edeposit/edeposit.amqp.calibre/blob/60ba5de0c30452d41f6e0da58d2ec6729ebdd7f1/src/edeposit/amqp/calibre/calibre.py#L46-L114 |
248,211 | thibault/libnexmo | libnexmo/base.py | Nexmo.send_sms | def send_sms(self, frm, to, text):
"""Sends a simple text message.
Example usage::
>>> msg = "Cherie, n'oublie pas les gauffres !"
>>> nexmo.send_sms('+33123456780', '+33987654321', msg)
:arg frm: The `from` field, a phone number (international format with
... | python | def send_sms(self, frm, to, text):
"""Sends a simple text message.
Example usage::
>>> msg = "Cherie, n'oublie pas les gauffres !"
>>> nexmo.send_sms('+33123456780', '+33987654321', msg)
:arg frm: The `from` field, a phone number (international format with
... | [
"def",
"send_sms",
"(",
"self",
",",
"frm",
",",
"to",
",",
"text",
")",
":",
"frm",
"=",
"re",
".",
"sub",
"(",
"'[^\\d]'",
",",
"''",
",",
"frm",
")",
"to",
"=",
"re",
".",
"sub",
"(",
"'[^\\d]'",
",",
"''",
",",
"to",
")",
"api_url",
"=",
... | Sends a simple text message.
Example usage::
>>> msg = "Cherie, n'oublie pas les gauffres !"
>>> nexmo.send_sms('+33123456780', '+33987654321', msg)
:arg frm: The `from` field, a phone number (international format with
or without a leading "+" or alphanumerical).
... | [
"Sends",
"a",
"simple",
"text",
"message",
"."
] | ed6cb6379bbcfd622f32d4e65f1a3f40f7910286 | https://github.com/thibault/libnexmo/blob/ed6cb6379bbcfd622f32d4e65f1a3f40f7910286/libnexmo/base.py#L32-L60 |
248,212 | thibault/libnexmo | libnexmo/base.py | Nexmo.send_request | def send_request(self, url, params, method='GET'):
"""Sends a raw request to the given api endpoint.
:arg url: A Nexmpo api endpoint (json only)
:arg params: A parameter dictionnary
Returns a :class:`~libnexmo.NexmoResponse`.
Raises:
The library uses `Requests
... | python | def send_request(self, url, params, method='GET'):
"""Sends a raw request to the given api endpoint.
:arg url: A Nexmpo api endpoint (json only)
:arg params: A parameter dictionnary
Returns a :class:`~libnexmo.NexmoResponse`.
Raises:
The library uses `Requests
... | [
"def",
"send_request",
"(",
"self",
",",
"url",
",",
"params",
",",
"method",
"=",
"'GET'",
")",
":",
"method",
"=",
"method",
".",
"lower",
"(",
")",
"if",
"method",
"not",
"in",
"[",
"'get'",
",",
"'post'",
"]",
":",
"raise",
"ValueError",
"(",
"... | Sends a raw request to the given api endpoint.
:arg url: A Nexmpo api endpoint (json only)
:arg params: A parameter dictionnary
Returns a :class:`~libnexmo.NexmoResponse`.
Raises:
The library uses `Requests
<http://docs.python-requests.org/en/latest/>`_ to per... | [
"Sends",
"a",
"raw",
"request",
"to",
"the",
"given",
"api",
"endpoint",
"."
] | ed6cb6379bbcfd622f32d4e65f1a3f40f7910286 | https://github.com/thibault/libnexmo/blob/ed6cb6379bbcfd622f32d4e65f1a3f40f7910286/libnexmo/base.py#L62-L95 |
248,213 | pavelsof/ipatok | ipatok/tokens.py | tokenise | def tokenise(string, strict=False, replace=False,
diphtongs=False, tones=False, unknown=False, merge=None):
"""
Tokenise an IPA string into a list of tokens. Raise ValueError if there is
a problem; if strict=True, this includes the string not being compliant to
the IPA spec.
If replace=True, replace some co... | python | def tokenise(string, strict=False, replace=False,
diphtongs=False, tones=False, unknown=False, merge=None):
"""
Tokenise an IPA string into a list of tokens. Raise ValueError if there is
a problem; if strict=True, this includes the string not being compliant to
the IPA spec.
If replace=True, replace some co... | [
"def",
"tokenise",
"(",
"string",
",",
"strict",
"=",
"False",
",",
"replace",
"=",
"False",
",",
"diphtongs",
"=",
"False",
",",
"tones",
"=",
"False",
",",
"unknown",
"=",
"False",
",",
"merge",
"=",
"None",
")",
":",
"words",
"=",
"string",
".",
... | Tokenise an IPA string into a list of tokens. Raise ValueError if there is
a problem; if strict=True, this includes the string not being compliant to
the IPA spec.
If replace=True, replace some common non-IPA symbols with their IPA
counterparts. If diphtongs=True, try to group diphtongs into single tokens.
If ton... | [
"Tokenise",
"an",
"IPA",
"string",
"into",
"a",
"list",
"of",
"tokens",
".",
"Raise",
"ValueError",
"if",
"there",
"is",
"a",
"problem",
";",
"if",
"strict",
"=",
"True",
"this",
"includes",
"the",
"string",
"not",
"being",
"compliant",
"to",
"the",
"IPA... | fde3c334b8573315fd1073f14341b71f50f7f006 | https://github.com/pavelsof/ipatok/blob/fde3c334b8573315fd1073f14341b71f50f7f006/ipatok/tokens.py#L150-L179 |
248,214 | KnowledgeLinks/rdfframework | rdfframework/framework.py | verify_server_core | def verify_server_core(timeout=120, start_delay=90):
''' checks to see if the server_core is running
args:
delay: will cycle till core is up.
timeout: number of seconds to wait
'''
timestamp = time.time()
last_check = time.time() + start_delay - 10
last_delay_notific... | python | def verify_server_core(timeout=120, start_delay=90):
''' checks to see if the server_core is running
args:
delay: will cycle till core is up.
timeout: number of seconds to wait
'''
timestamp = time.time()
last_check = time.time() + start_delay - 10
last_delay_notific... | [
"def",
"verify_server_core",
"(",
"timeout",
"=",
"120",
",",
"start_delay",
"=",
"90",
")",
":",
"timestamp",
"=",
"time",
".",
"time",
"(",
")",
"last_check",
"=",
"time",
".",
"time",
"(",
")",
"+",
"start_delay",
"-",
"10",
"last_delay_notification",
... | checks to see if the server_core is running
args:
delay: will cycle till core is up.
timeout: number of seconds to wait | [
"checks",
"to",
"see",
"if",
"the",
"server_core",
"is",
"running"
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/framework.py#L221-L267 |
248,215 | KnowledgeLinks/rdfframework | rdfframework/framework.py | RdfFramework.load_rml | def load_rml(self, rml_name):
""" loads an rml mapping into memory
args:
rml_name(str): the name of the rml file
"""
conn = CFG.rml_tstore
cache_path = os.path.join(CFG.CACHE_DATA_PATH, 'rml_files', rml_name)
if not os.path.exists(cache_path):
res... | python | def load_rml(self, rml_name):
""" loads an rml mapping into memory
args:
rml_name(str): the name of the rml file
"""
conn = CFG.rml_tstore
cache_path = os.path.join(CFG.CACHE_DATA_PATH, 'rml_files', rml_name)
if not os.path.exists(cache_path):
res... | [
"def",
"load_rml",
"(",
"self",
",",
"rml_name",
")",
":",
"conn",
"=",
"CFG",
".",
"rml_tstore",
"cache_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"CFG",
".",
"CACHE_DATA_PATH",
",",
"'rml_files'",
",",
"rml_name",
")",
"if",
"not",
"os",
".",
... | loads an rml mapping into memory
args:
rml_name(str): the name of the rml file | [
"loads",
"an",
"rml",
"mapping",
"into",
"memory"
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/framework.py#L87-L103 |
248,216 | KnowledgeLinks/rdfframework | rdfframework/framework.py | RdfFramework.get_rml | def get_rml(self, rml_name):
""" returns the rml mapping RdfDataset
rml_name(str): Name of the rml mapping to retrieve
"""
try:
return getattr(self, rml_name)
except AttributeError:
return self.load_rml(rml_name) | python | def get_rml(self, rml_name):
""" returns the rml mapping RdfDataset
rml_name(str): Name of the rml mapping to retrieve
"""
try:
return getattr(self, rml_name)
except AttributeError:
return self.load_rml(rml_name) | [
"def",
"get_rml",
"(",
"self",
",",
"rml_name",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
",",
"rml_name",
")",
"except",
"AttributeError",
":",
"return",
"self",
".",
"load_rml",
"(",
"rml_name",
")"
] | returns the rml mapping RdfDataset
rml_name(str): Name of the rml mapping to retrieve | [
"returns",
"the",
"rml",
"mapping",
"RdfDataset"
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/framework.py#L105-L114 |
248,217 | KnowledgeLinks/rdfframework | rdfframework/framework.py | RdfFramework._set_data_filelist | def _set_data_filelist(self,
start_path,
attr_name,
conn,
file_exts=[],
dir_filter=set()):
''' does a directory search for data files '''
def filter_path(filter_terms, ... | python | def _set_data_filelist(self,
start_path,
attr_name,
conn,
file_exts=[],
dir_filter=set()):
''' does a directory search for data files '''
def filter_path(filter_terms, ... | [
"def",
"_set_data_filelist",
"(",
"self",
",",
"start_path",
",",
"attr_name",
",",
"conn",
",",
"file_exts",
"=",
"[",
"]",
",",
"dir_filter",
"=",
"set",
"(",
")",
")",
":",
"def",
"filter_path",
"(",
"filter_terms",
",",
"dir_path",
")",
":",
"\"\"\" ... | does a directory search for data files | [
"does",
"a",
"directory",
"search",
"for",
"data",
"files"
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/framework.py#L171-L219 |
248,218 | devricks/soft_drf | soft_drf/auth/authentication.py | BaseJSONWebTokenAuthentication.authenticate | def authenticate(self, request):
"""
Returns a two-tuple of `User` and token if a valid signature has been
supplied using JWT-based authentication. Otherwise returns `None`.
"""
jwt_value = self.get_jwt_value(request)
if jwt_value is None:
return None
... | python | def authenticate(self, request):
"""
Returns a two-tuple of `User` and token if a valid signature has been
supplied using JWT-based authentication. Otherwise returns `None`.
"""
jwt_value = self.get_jwt_value(request)
if jwt_value is None:
return None
... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
")",
":",
"jwt_value",
"=",
"self",
".",
"get_jwt_value",
"(",
"request",
")",
"if",
"jwt_value",
"is",
"None",
":",
"return",
"None",
"try",
":",
"payload",
"=",
"jwt_decode_handler",
"(",
"jwt_value",
"... | Returns a two-tuple of `User` and token if a valid signature has been
supplied using JWT-based authentication. Otherwise returns `None`. | [
"Returns",
"a",
"two",
"-",
"tuple",
"of",
"User",
"and",
"token",
"if",
"a",
"valid",
"signature",
"has",
"been",
"supplied",
"using",
"JWT",
"-",
"based",
"authentication",
".",
"Otherwise",
"returns",
"None",
"."
] | 1869b13f9341bfcebd931059e93de2bc38570da3 | https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/auth/authentication.py#L29-L51 |
248,219 | rorr73/LifeSOSpy | lifesospy/util.py | to_ascii_hex | def to_ascii_hex(value: int, digits: int) -> str:
"""Converts an int value to ASCII hex, as used by LifeSOS.
Unlike regular hex, it uses the first 6 characters that follow
numerics on the ASCII table instead of A - F."""
if digits < 1:
return ''
text = ''
for _ in range(0, digits):... | python | def to_ascii_hex(value: int, digits: int) -> str:
"""Converts an int value to ASCII hex, as used by LifeSOS.
Unlike regular hex, it uses the first 6 characters that follow
numerics on the ASCII table instead of A - F."""
if digits < 1:
return ''
text = ''
for _ in range(0, digits):... | [
"def",
"to_ascii_hex",
"(",
"value",
":",
"int",
",",
"digits",
":",
"int",
")",
"->",
"str",
":",
"if",
"digits",
"<",
"1",
":",
"return",
"''",
"text",
"=",
"''",
"for",
"_",
"in",
"range",
"(",
"0",
",",
"digits",
")",
":",
"text",
"=",
"chr... | Converts an int value to ASCII hex, as used by LifeSOS.
Unlike regular hex, it uses the first 6 characters that follow
numerics on the ASCII table instead of A - F. | [
"Converts",
"an",
"int",
"value",
"to",
"ASCII",
"hex",
"as",
"used",
"by",
"LifeSOS",
".",
"Unlike",
"regular",
"hex",
"it",
"uses",
"the",
"first",
"6",
"characters",
"that",
"follow",
"numerics",
"on",
"the",
"ASCII",
"table",
"instead",
"of",
"A",
"-... | 62360fbab2e90bf04d52b547093bdab2d4e389b4 | https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/util.py#L17-L27 |
248,220 | rorr73/LifeSOSpy | lifesospy/util.py | serializable | def serializable(obj: Any, on_filter: Callable[[Any, str], bool] = None) -> Any:
"""
Ensures the specified object is serializable, converting if necessary.
:param obj: the object to use.
:param on_filter: optional function that can be used to filter which
properties on the object ... | python | def serializable(obj: Any, on_filter: Callable[[Any, str], bool] = None) -> Any:
"""
Ensures the specified object is serializable, converting if necessary.
:param obj: the object to use.
:param on_filter: optional function that can be used to filter which
properties on the object ... | [
"def",
"serializable",
"(",
"obj",
":",
"Any",
",",
"on_filter",
":",
"Callable",
"[",
"[",
"Any",
",",
"str",
"]",
",",
"bool",
"]",
"=",
"None",
")",
"->",
"Any",
":",
"# Will be called recursively when object has children",
"def",
"_serializable",
"(",
"p... | Ensures the specified object is serializable, converting if necessary.
:param obj: the object to use.
:param on_filter: optional function that can be used to filter which
properties on the object will be included.
:return value representing the object, which is serializable. | [
"Ensures",
"the",
"specified",
"object",
"is",
"serializable",
"converting",
"if",
"necessary",
"."
] | 62360fbab2e90bf04d52b547093bdab2d4e389b4 | https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/util.py#L61-L124 |
248,221 | rorr73/LifeSOSpy | lifesospy/util.py | encode_value_using_ma | def encode_value_using_ma(message_attribute: int, value: Optional[Union[int, float]]) -> int:
"""Encode special sensor value using the message attribute."""
if message_attribute == MA_TX3AC_100A:
# TX-3AC in 100A mode; use value as-is, with 0xFE indicating null
if value is None:
retu... | python | def encode_value_using_ma(message_attribute: int, value: Optional[Union[int, float]]) -> int:
"""Encode special sensor value using the message attribute."""
if message_attribute == MA_TX3AC_100A:
# TX-3AC in 100A mode; use value as-is, with 0xFE indicating null
if value is None:
retu... | [
"def",
"encode_value_using_ma",
"(",
"message_attribute",
":",
"int",
",",
"value",
":",
"Optional",
"[",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
")",
"->",
"int",
":",
"if",
"message_attribute",
"==",
"MA_TX3AC_100A",
":",
"# TX-3AC in 100A mode; use value... | Encode special sensor value using the message attribute. | [
"Encode",
"special",
"sensor",
"value",
"using",
"the",
"message",
"attribute",
"."
] | 62360fbab2e90bf04d52b547093bdab2d4e389b4 | https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/util.py#L149-L167 |
248,222 | openpermissions/perch | perch/validators.py | partial_schema | def partial_schema(schema, filtered_fields):
"""
Validator for part of a schema, ignoring some fields
:param schema: the Schema
:param filtered_fields: fields to filter out
"""
return Schema({
k: v for k, v in schema.schema.items()
if getattr(k, 'schema', k) not in filtered_fiel... | python | def partial_schema(schema, filtered_fields):
"""
Validator for part of a schema, ignoring some fields
:param schema: the Schema
:param filtered_fields: fields to filter out
"""
return Schema({
k: v for k, v in schema.schema.items()
if getattr(k, 'schema', k) not in filtered_fiel... | [
"def",
"partial_schema",
"(",
"schema",
",",
"filtered_fields",
")",
":",
"return",
"Schema",
"(",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"schema",
".",
"schema",
".",
"items",
"(",
")",
"if",
"getattr",
"(",
"k",
",",
"'schema'",
",",
"k"... | Validator for part of a schema, ignoring some fields
:param schema: the Schema
:param filtered_fields: fields to filter out | [
"Validator",
"for",
"part",
"of",
"a",
"schema",
"ignoring",
"some",
"fields"
] | 36d78994133918f3c52c187f19e50132960a0156 | https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/validators.py#L53-L63 |
248,223 | openpermissions/perch | perch/validators.py | validate_url | def validate_url(url):
"""Validate URL is valid
NOTE: only support http & https
"""
schemes = ['http', 'https']
netloc_re = re.compile(
r'^'
r'(?:\S+(?::\S*)?@)?' # user:pass auth
r'(?:[a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])'
r'(?:\.(?:[a-z0-9]|[a-z0-9][a-z0-9\-]... | python | def validate_url(url):
"""Validate URL is valid
NOTE: only support http & https
"""
schemes = ['http', 'https']
netloc_re = re.compile(
r'^'
r'(?:\S+(?::\S*)?@)?' # user:pass auth
r'(?:[a-z0-9]|[a-z0-9][a-z0-9\-]{0,61}[a-z0-9])'
r'(?:\.(?:[a-z0-9]|[a-z0-9][a-z0-9\-]... | [
"def",
"validate_url",
"(",
"url",
")",
":",
"schemes",
"=",
"[",
"'http'",
",",
"'https'",
"]",
"netloc_re",
"=",
"re",
".",
"compile",
"(",
"r'^'",
"r'(?:\\S+(?::\\S*)?@)?'",
"# user:pass auth",
"r'(?:[a-z0-9]|[a-z0-9][a-z0-9\\-]{0,61}[a-z0-9])'",
"r'(?:\\.(?:[a-z0-9]... | Validate URL is valid
NOTE: only support http & https | [
"Validate",
"URL",
"is",
"valid"
] | 36d78994133918f3c52c187f19e50132960a0156 | https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/validators.py#L83-L109 |
248,224 | openpermissions/perch | perch/validators.py | validate_reference_links | def validate_reference_links(reference_links):
"""
Vaidate reference links data structure
Expected data structure:
{
"links": {
id_type1: url1,
id_type2: url2
},
"redirect_id_type": id_type1 | id1_type2
}
where links i... | python | def validate_reference_links(reference_links):
"""
Vaidate reference links data structure
Expected data structure:
{
"links": {
id_type1: url1,
id_type2: url2
},
"redirect_id_type": id_type1 | id1_type2
}
where links i... | [
"def",
"validate_reference_links",
"(",
"reference_links",
")",
":",
"allowed_keys",
"=",
"[",
"'links'",
",",
"'redirect_id_type'",
"]",
"if",
"not",
"isinstance",
"(",
"reference_links",
",",
"dict",
")",
":",
"raise",
"Invalid",
"(",
"'Expected reference_links to... | Vaidate reference links data structure
Expected data structure:
{
"links": {
id_type1: url1,
id_type2: url2
},
"redirect_id_type": id_type1 | id1_type2
}
where links is an optional key but must be a dictionary with id types to... | [
"Vaidate",
"reference",
"links",
"data",
"structure"
] | 36d78994133918f3c52c187f19e50132960a0156 | https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/validators.py#L112-L150 |
248,225 | openpermissions/perch | perch/validators.py | _validate_state | def _validate_state(state, valid_states):
"""Validate a state string"""
if state in State:
return state.name
elif state in valid_states:
return state
else:
raise Invalid('Invalid state') | python | def _validate_state(state, valid_states):
"""Validate a state string"""
if state in State:
return state.name
elif state in valid_states:
return state
else:
raise Invalid('Invalid state') | [
"def",
"_validate_state",
"(",
"state",
",",
"valid_states",
")",
":",
"if",
"state",
"in",
"State",
":",
"return",
"state",
".",
"name",
"elif",
"state",
"in",
"valid_states",
":",
"return",
"state",
"else",
":",
"raise",
"Invalid",
"(",
"'Invalid state'",
... | Validate a state string | [
"Validate",
"a",
"state",
"string"
] | 36d78994133918f3c52c187f19e50132960a0156 | https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/validators.py#L165-L172 |
248,226 | blubberdiblub/eztemplate | eztemplate/__main__.py | is_filelike | def is_filelike(ob):
"""Check for filelikeness of an object.
Needed to distinguish it from file names.
Returns true if it has a read or a write method.
"""
if hasattr(ob, 'read') and callable(ob.read):
return True
if hasattr(ob, 'write') and callable(ob.write):
return True
... | python | def is_filelike(ob):
"""Check for filelikeness of an object.
Needed to distinguish it from file names.
Returns true if it has a read or a write method.
"""
if hasattr(ob, 'read') and callable(ob.read):
return True
if hasattr(ob, 'write') and callable(ob.write):
return True
... | [
"def",
"is_filelike",
"(",
"ob",
")",
":",
"if",
"hasattr",
"(",
"ob",
",",
"'read'",
")",
"and",
"callable",
"(",
"ob",
".",
"read",
")",
":",
"return",
"True",
"if",
"hasattr",
"(",
"ob",
",",
"'write'",
")",
"and",
"callable",
"(",
"ob",
".",
... | Check for filelikeness of an object.
Needed to distinguish it from file names.
Returns true if it has a read or a write method. | [
"Check",
"for",
"filelikeness",
"of",
"an",
"object",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L18-L30 |
248,227 | blubberdiblub/eztemplate | eztemplate/__main__.py | dump_engines | def dump_engines(target=sys.stderr):
"""Print successfully imported templating engines."""
print("Available templating engines:", file=target)
width = max(len(engine) for engine in engines.engines)
for handle, engine in sorted(engines.engines.items()):
description = engine.__doc__.split('\n', 0... | python | def dump_engines(target=sys.stderr):
"""Print successfully imported templating engines."""
print("Available templating engines:", file=target)
width = max(len(engine) for engine in engines.engines)
for handle, engine in sorted(engines.engines.items()):
description = engine.__doc__.split('\n', 0... | [
"def",
"dump_engines",
"(",
"target",
"=",
"sys",
".",
"stderr",
")",
":",
"print",
"(",
"\"Available templating engines:\"",
",",
"file",
"=",
"target",
")",
"width",
"=",
"max",
"(",
"len",
"(",
"engine",
")",
"for",
"engine",
"in",
"engines",
".",
"en... | Print successfully imported templating engines. | [
"Print",
"successfully",
"imported",
"templating",
"engines",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L220-L227 |
248,228 | blubberdiblub/eztemplate | eztemplate/__main__.py | check_engine | def check_engine(handle):
"""Check availability of requested template engine."""
if handle == 'help':
dump_engines()
sys.exit(0)
if handle not in engines.engines:
print('Engine "%s" is not available.' % (handle,), file=sys.stderr)
sys.exit(1) | python | def check_engine(handle):
"""Check availability of requested template engine."""
if handle == 'help':
dump_engines()
sys.exit(0)
if handle not in engines.engines:
print('Engine "%s" is not available.' % (handle,), file=sys.stderr)
sys.exit(1) | [
"def",
"check_engine",
"(",
"handle",
")",
":",
"if",
"handle",
"==",
"'help'",
":",
"dump_engines",
"(",
")",
"sys",
".",
"exit",
"(",
"0",
")",
"if",
"handle",
"not",
"in",
"engines",
".",
"engines",
":",
"print",
"(",
"'Engine \"%s\" is not available.'"... | Check availability of requested template engine. | [
"Check",
"availability",
"of",
"requested",
"template",
"engine",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L230-L238 |
248,229 | blubberdiblub/eztemplate | eztemplate/__main__.py | make_mapping | def make_mapping(args):
"""Make a mapping from the name=value pairs."""
mapping = {}
if args:
for arg in args:
name_value = arg.split('=', 1)
mapping[name_value[0]] = (name_value[1]
if len(name_value) > 1
... | python | def make_mapping(args):
"""Make a mapping from the name=value pairs."""
mapping = {}
if args:
for arg in args:
name_value = arg.split('=', 1)
mapping[name_value[0]] = (name_value[1]
if len(name_value) > 1
... | [
"def",
"make_mapping",
"(",
"args",
")",
":",
"mapping",
"=",
"{",
"}",
"if",
"args",
":",
"for",
"arg",
"in",
"args",
":",
"name_value",
"=",
"arg",
".",
"split",
"(",
"'='",
",",
"1",
")",
"mapping",
"[",
"name_value",
"[",
"0",
"]",
"]",
"=",
... | Make a mapping from the name=value pairs. | [
"Make",
"a",
"mapping",
"from",
"the",
"name",
"=",
"value",
"pairs",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L241-L252 |
248,230 | blubberdiblub/eztemplate | eztemplate/__main__.py | make_path_properties | def make_path_properties(file_or_path, prefix=''):
"""Build useful properties from a file path."""
is_std = file_or_path in (sys.stdin, sys.stdout, sys.stderr)
if is_std:
path = '-'
elif is_filelike(file_or_path):
try:
path = str(file_or_path.name)
except AttributeEr... | python | def make_path_properties(file_or_path, prefix=''):
"""Build useful properties from a file path."""
is_std = file_or_path in (sys.stdin, sys.stdout, sys.stderr)
if is_std:
path = '-'
elif is_filelike(file_or_path):
try:
path = str(file_or_path.name)
except AttributeEr... | [
"def",
"make_path_properties",
"(",
"file_or_path",
",",
"prefix",
"=",
"''",
")",
":",
"is_std",
"=",
"file_or_path",
"in",
"(",
"sys",
".",
"stdin",
",",
"sys",
".",
"stdout",
",",
"sys",
".",
"stderr",
")",
"if",
"is_std",
":",
"path",
"=",
"'-'",
... | Build useful properties from a file path. | [
"Build",
"useful",
"properties",
"from",
"a",
"file",
"path",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L255-L305 |
248,231 | blubberdiblub/eztemplate | eztemplate/__main__.py | constant_outfile_iterator | def constant_outfile_iterator(outfiles, infiles, arggroups):
"""Iterate over all output files."""
assert len(infiles) == 1
assert len(arggroups) == 1
return ((outfile, infiles[0], arggroups[0]) for outfile in outfiles) | python | def constant_outfile_iterator(outfiles, infiles, arggroups):
"""Iterate over all output files."""
assert len(infiles) == 1
assert len(arggroups) == 1
return ((outfile, infiles[0], arggroups[0]) for outfile in outfiles) | [
"def",
"constant_outfile_iterator",
"(",
"outfiles",
",",
"infiles",
",",
"arggroups",
")",
":",
"assert",
"len",
"(",
"infiles",
")",
"==",
"1",
"assert",
"len",
"(",
"arggroups",
")",
"==",
"1",
"return",
"(",
"(",
"outfile",
",",
"infiles",
"[",
"0",
... | Iterate over all output files. | [
"Iterate",
"over",
"all",
"output",
"files",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L308-L313 |
248,232 | blubberdiblub/eztemplate | eztemplate/__main__.py | variable_outfile_iterator | def variable_outfile_iterator(outfiles, infiles, arggroups, engine):
"""Iterate over variable output file name template."""
assert len(outfiles) == 1
template = engine(outfiles[0], tolerant=False)
for infile in infiles:
properties = make_path_properties(infile, prefix='')
for arggroup... | python | def variable_outfile_iterator(outfiles, infiles, arggroups, engine):
"""Iterate over variable output file name template."""
assert len(outfiles) == 1
template = engine(outfiles[0], tolerant=False)
for infile in infiles:
properties = make_path_properties(infile, prefix='')
for arggroup... | [
"def",
"variable_outfile_iterator",
"(",
"outfiles",
",",
"infiles",
",",
"arggroups",
",",
"engine",
")",
":",
"assert",
"len",
"(",
"outfiles",
")",
"==",
"1",
"template",
"=",
"engine",
"(",
"outfiles",
"[",
"0",
"]",
",",
"tolerant",
"=",
"False",
")... | Iterate over variable output file name template. | [
"Iterate",
"over",
"variable",
"output",
"file",
"name",
"template",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L316-L327 |
248,233 | blubberdiblub/eztemplate | eztemplate/__main__.py | process_combinations | def process_combinations(combinations, engine,
tolerant=False,
read_old=False,
delete_empty=False,
):
"""Process outfile-infile-arggroup combinations."""
outfiles = set()
templatereader = CachedTemplateReade... | python | def process_combinations(combinations, engine,
tolerant=False,
read_old=False,
delete_empty=False,
):
"""Process outfile-infile-arggroup combinations."""
outfiles = set()
templatereader = CachedTemplateReade... | [
"def",
"process_combinations",
"(",
"combinations",
",",
"engine",
",",
"tolerant",
"=",
"False",
",",
"read_old",
"=",
"False",
",",
"delete_empty",
"=",
"False",
",",
")",
":",
"outfiles",
"=",
"set",
"(",
")",
"templatereader",
"=",
"CachedTemplateReader",
... | Process outfile-infile-arggroup combinations. | [
"Process",
"outfile",
"-",
"infile",
"-",
"arggroup",
"combinations",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L361-L400 |
248,234 | blubberdiblub/eztemplate | eztemplate/__main__.py | perform_templating | def perform_templating(args):
"""Perform templating according to the given arguments."""
engine = engines.engines[args.engine]
if args.vary:
it = variable_outfile_iterator(args.outfiles,
args.infiles,
args.args,
... | python | def perform_templating(args):
"""Perform templating according to the given arguments."""
engine = engines.engines[args.engine]
if args.vary:
it = variable_outfile_iterator(args.outfiles,
args.infiles,
args.args,
... | [
"def",
"perform_templating",
"(",
"args",
")",
":",
"engine",
"=",
"engines",
".",
"engines",
"[",
"args",
".",
"engine",
"]",
"if",
"args",
".",
"vary",
":",
"it",
"=",
"variable_outfile_iterator",
"(",
"args",
".",
"outfiles",
",",
"args",
".",
"infile... | Perform templating according to the given arguments. | [
"Perform",
"templating",
"according",
"to",
"the",
"given",
"arguments",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L403-L421 |
248,235 | blubberdiblub/eztemplate | eztemplate/__main__.py | CachedTemplateReader.read | def read(self, file_or_path):
"""Read template from cache or file."""
if file_or_path in self._cached_templates:
return self._cached_templates[file_or_path]
if is_filelike(file_or_path):
template = file_or_path.read()
dirname = None
else:
... | python | def read(self, file_or_path):
"""Read template from cache or file."""
if file_or_path in self._cached_templates:
return self._cached_templates[file_or_path]
if is_filelike(file_or_path):
template = file_or_path.read()
dirname = None
else:
... | [
"def",
"read",
"(",
"self",
",",
"file_or_path",
")",
":",
"if",
"file_or_path",
"in",
"self",
".",
"_cached_templates",
":",
"return",
"self",
".",
"_cached_templates",
"[",
"file_or_path",
"]",
"if",
"is_filelike",
"(",
"file_or_path",
")",
":",
"template",
... | Read template from cache or file. | [
"Read",
"template",
"from",
"cache",
"or",
"file",
"."
] | ab5b2b4987c045116d130fd83e216704b8edfb5d | https://github.com/blubberdiblub/eztemplate/blob/ab5b2b4987c045116d130fd83e216704b8edfb5d/eztemplate/__main__.py#L340-L358 |
248,236 | nws-cip/zenconf | examples/config.py | get_config | def get_config(cli_args=None, config_path=None):
"""
Perform standard setup - get the merged config
:param cli_args dict: A dictionary of CLI arguments
:param config_path string: Path to the config file to load
:return dict: A dictionary of config values drawn from different sources
"""
co... | python | def get_config(cli_args=None, config_path=None):
"""
Perform standard setup - get the merged config
:param cli_args dict: A dictionary of CLI arguments
:param config_path string: Path to the config file to load
:return dict: A dictionary of config values drawn from different sources
"""
co... | [
"def",
"get_config",
"(",
"cli_args",
"=",
"None",
",",
"config_path",
"=",
"None",
")",
":",
"config",
"=",
"Config",
"(",
"app_name",
"=",
"\"MYAPP\"",
",",
"cli_args",
"=",
"cli_args",
",",
"config_path",
"=",
"config_path",
")",
"config_dict",
"=",
"co... | Perform standard setup - get the merged config
:param cli_args dict: A dictionary of CLI arguments
:param config_path string: Path to the config file to load
:return dict: A dictionary of config values drawn from different sources | [
"Perform",
"standard",
"setup",
"-",
"get",
"the",
"merged",
"config"
] | fc96706468c0741fb1b54b2eeb9f9225737e3e36 | https://github.com/nws-cip/zenconf/blob/fc96706468c0741fb1b54b2eeb9f9225737e3e36/examples/config.py#L101-L114 |
248,237 | OldhamMade/PySO8601 | PySO8601/intervals.py | parse_interval | def parse_interval(interval):
"""
Attepmt to parse an ISO8601 formatted ``interval``.
Returns a tuple of ``datetime.datetime`` and ``datetime.timedelta``
objects, order dependent on ``interval``.
"""
a, b = str(interval).upper().strip().split('/')
if a[0] is 'P' and b[0] is 'P':
ra... | python | def parse_interval(interval):
"""
Attepmt to parse an ISO8601 formatted ``interval``.
Returns a tuple of ``datetime.datetime`` and ``datetime.timedelta``
objects, order dependent on ``interval``.
"""
a, b = str(interval).upper().strip().split('/')
if a[0] is 'P' and b[0] is 'P':
ra... | [
"def",
"parse_interval",
"(",
"interval",
")",
":",
"a",
",",
"b",
"=",
"str",
"(",
"interval",
")",
".",
"upper",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"'/'",
")",
"if",
"a",
"[",
"0",
"]",
"is",
"'P'",
"and",
"b",
"[",
"0",
... | Attepmt to parse an ISO8601 formatted ``interval``.
Returns a tuple of ``datetime.datetime`` and ``datetime.timedelta``
objects, order dependent on ``interval``. | [
"Attepmt",
"to",
"parse",
"an",
"ISO8601",
"formatted",
"interval",
"."
] | b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4 | https://github.com/OldhamMade/PySO8601/blob/b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4/PySO8601/intervals.py#L6-L31 |
248,238 | hitchtest/hitchserve | hitchserve/hitch_service.py | Subcommand.run | def run(self, shell=False, ignore_errors=False, stdin=False, check_output=False):
"""Run subcommand.
Args:
shell (Optional[bool]): Run command using shell (default False)
ignore_errors (Optional[bool]): If the command has a non-zero return code, don't raise an exception (default... | python | def run(self, shell=False, ignore_errors=False, stdin=False, check_output=False):
"""Run subcommand.
Args:
shell (Optional[bool]): Run command using shell (default False)
ignore_errors (Optional[bool]): If the command has a non-zero return code, don't raise an exception (default... | [
"def",
"run",
"(",
"self",
",",
"shell",
"=",
"False",
",",
"ignore_errors",
"=",
"False",
",",
"stdin",
"=",
"False",
",",
"check_output",
"=",
"False",
")",
":",
"previous_directory",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"se... | Run subcommand.
Args:
shell (Optional[bool]): Run command using shell (default False)
ignore_errors (Optional[bool]): If the command has a non-zero return code, don't raise an exception (default False)
stdin (Optional[bool]): Plug input from stdin when running command (defau... | [
"Run",
"subcommand",
"."
] | a2def19979264186d283e76f7f0c88f3ed97f2e0 | https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/hitch_service.py#L52-L88 |
248,239 | hitchtest/hitchserve | hitchserve/hitch_service.py | Service.subcommand | def subcommand(self, *args):
"""Get subcommand acting on a service. Subcommand will run in service directory
and with the environment variables used to run the service itself.
Args:
*args: Arguments to run command (e.g. "redis-cli", "-n", "1")
Returns:
Subcom... | python | def subcommand(self, *args):
"""Get subcommand acting on a service. Subcommand will run in service directory
and with the environment variables used to run the service itself.
Args:
*args: Arguments to run command (e.g. "redis-cli", "-n", "1")
Returns:
Subcom... | [
"def",
"subcommand",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"Subcommand",
"(",
"*",
"args",
",",
"directory",
"=",
"self",
".",
"directory",
",",
"env_vars",
"=",
"self",
".",
"env_vars",
")"
] | Get subcommand acting on a service. Subcommand will run in service directory
and with the environment variables used to run the service itself.
Args:
*args: Arguments to run command (e.g. "redis-cli", "-n", "1")
Returns:
Subcommand object. | [
"Get",
"subcommand",
"acting",
"on",
"a",
"service",
".",
"Subcommand",
"will",
"run",
"in",
"service",
"directory",
"and",
"with",
"the",
"environment",
"variables",
"used",
"to",
"run",
"the",
"service",
"itself",
"."
] | a2def19979264186d283e76f7f0c88f3ed97f2e0 | https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/hitch_service.py#L237-L247 |
248,240 | pydsigner/taskit | taskit/resync.py | Mediator.set_error | def set_error(self, e):
"""
Rather than allowing unmanaged exceptions to explode, or raising errors
within thread, the worker thread should call this function with an
error class or instance.
"""
self.result = (False, e)
self._lock.release() | python | def set_error(self, e):
"""
Rather than allowing unmanaged exceptions to explode, or raising errors
within thread, the worker thread should call this function with an
error class or instance.
"""
self.result = (False, e)
self._lock.release() | [
"def",
"set_error",
"(",
"self",
",",
"e",
")",
":",
"self",
".",
"result",
"=",
"(",
"False",
",",
"e",
")",
"self",
".",
"_lock",
".",
"release",
"(",
")"
] | Rather than allowing unmanaged exceptions to explode, or raising errors
within thread, the worker thread should call this function with an
error class or instance. | [
"Rather",
"than",
"allowing",
"unmanaged",
"exceptions",
"to",
"explode",
"or",
"raising",
"errors",
"within",
"thread",
"the",
"worker",
"thread",
"should",
"call",
"this",
"function",
"with",
"an",
"error",
"class",
"or",
"instance",
"."
] | 3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f | https://github.com/pydsigner/taskit/blob/3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f/taskit/resync.py#L128-L135 |
248,241 | pydsigner/taskit | taskit/resync.py | Resyncer._wrapper | def _wrapper(self):
"""
Wraps around a few calls which need to be made in the same thread.
"""
try:
res = self.func(*self.args, **self.kw)
except Exception as e:
self.mediator.set_error(e)
else:
self.mediator.set_result(res) | python | def _wrapper(self):
"""
Wraps around a few calls which need to be made in the same thread.
"""
try:
res = self.func(*self.args, **self.kw)
except Exception as e:
self.mediator.set_error(e)
else:
self.mediator.set_result(res) | [
"def",
"_wrapper",
"(",
"self",
")",
":",
"try",
":",
"res",
"=",
"self",
".",
"func",
"(",
"*",
"self",
".",
"args",
",",
"*",
"*",
"self",
".",
"kw",
")",
"except",
"Exception",
"as",
"e",
":",
"self",
".",
"mediator",
".",
"set_error",
"(",
... | Wraps around a few calls which need to be made in the same thread. | [
"Wraps",
"around",
"a",
"few",
"calls",
"which",
"need",
"to",
"be",
"made",
"in",
"the",
"same",
"thread",
"."
] | 3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f | https://github.com/pydsigner/taskit/blob/3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f/taskit/resync.py#L170-L179 |
248,242 | merryspankersltd/irenee | irenee/catfish.py | addinterval | def addinterval(instr, add, interval):
'''
adds string every n character. returns string
'''
if not isinstance(instr, str):
instr = str(instr)
return add.join(
instr[i:i+interval]
for i in xrange(0,len(instr),interval)) | python | def addinterval(instr, add, interval):
'''
adds string every n character. returns string
'''
if not isinstance(instr, str):
instr = str(instr)
return add.join(
instr[i:i+interval]
for i in xrange(0,len(instr),interval)) | [
"def",
"addinterval",
"(",
"instr",
",",
"add",
",",
"interval",
")",
":",
"if",
"not",
"isinstance",
"(",
"instr",
",",
"str",
")",
":",
"instr",
"=",
"str",
"(",
"instr",
")",
"return",
"add",
".",
"join",
"(",
"instr",
"[",
"i",
":",
"i",
"+",... | adds string every n character. returns string | [
"adds",
"string",
"every",
"n",
"character",
".",
"returns",
"string"
] | 8bf3c7644dc69001fa4b09be5fbb770dbf06a465 | https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/catfish.py#L27-L36 |
248,243 | merryspankersltd/irenee | irenee/catfish.py | parse_ok | def parse_ok(l1, l3):
'''
parse html when siren is ok
'''
return {
'annee': l1.text.split(' : ')[1].split()[2],
'siren valide': ''.join(
l1.text.split(' : ')[1].split(u'\xab')[0].split()[-4:-1]),
'categorie': ' '.join(
l1.text.split(' : ')[1].split(u'\... | python | def parse_ok(l1, l3):
'''
parse html when siren is ok
'''
return {
'annee': l1.text.split(' : ')[1].split()[2],
'siren valide': ''.join(
l1.text.split(' : ')[1].split(u'\xab')[0].split()[-4:-1]),
'categorie': ' '.join(
l1.text.split(' : ')[1].split(u'\... | [
"def",
"parse_ok",
"(",
"l1",
",",
"l3",
")",
":",
"return",
"{",
"'annee'",
":",
"l1",
".",
"text",
".",
"split",
"(",
"' : '",
")",
"[",
"1",
"]",
".",
"split",
"(",
")",
"[",
"2",
"]",
",",
"'siren valide'",
":",
"''",
".",
"join",
"(",
"l... | parse html when siren is ok | [
"parse",
"html",
"when",
"siren",
"is",
"ok"
] | 8bf3c7644dc69001fa4b09be5fbb770dbf06a465 | https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/catfish.py#L86-L97 |
248,244 | pjanis/funtool | funtool/lib/general.py | sort_states | def sort_states(states, sort_list):
"""
Returns a list of sorted states, original states list remains unsorted
The sort list is a list of state field: field key pairs
For example (as YAML):
- data: position
- meta: created_at
The field_key part can be a list to simplify ... | python | def sort_states(states, sort_list):
"""
Returns a list of sorted states, original states list remains unsorted
The sort list is a list of state field: field key pairs
For example (as YAML):
- data: position
- meta: created_at
The field_key part can be a list to simplify ... | [
"def",
"sort_states",
"(",
"states",
",",
"sort_list",
")",
":",
"sorted_states",
"=",
"states",
".",
"copy",
"(",
")",
"for",
"sort_pair",
"in",
"reversed",
"(",
"_convert_list_of_dict_to_tuple",
"(",
"sort_list",
")",
")",
":",
"if",
"sort_pair",
"[",
"0",... | Returns a list of sorted states, original states list remains unsorted
The sort list is a list of state field: field key pairs
For example (as YAML):
- data: position
- meta: created_at
The field_key part can be a list to simplify input
- meta: created_at
- meta:... | [
"Returns",
"a",
"list",
"of",
"sorted",
"states",
"original",
"states",
"list",
"remains",
"unsorted"
] | 231851238f0a62bc3682d8fa937db9053378c53d | https://github.com/pjanis/funtool/blob/231851238f0a62bc3682d8fa937db9053378c53d/funtool/lib/general.py#L27-L75 |
248,245 | jmgilman/Neolib | neolib/pyamf/__init__.py | load_class | def load_class(alias):
"""
Finds the class registered to the alias.
The search is done in order:
1. Checks if the class name has been registered via L{register_class}
or L{register_package}.
2. Checks all functions registered via L{register_class_loader}.
3. Attempts to load the ... | python | def load_class(alias):
"""
Finds the class registered to the alias.
The search is done in order:
1. Checks if the class name has been registered via L{register_class}
or L{register_package}.
2. Checks all functions registered via L{register_class_loader}.
3. Attempts to load the ... | [
"def",
"load_class",
"(",
"alias",
")",
":",
"# Try the CLASS_CACHE first",
"try",
":",
"return",
"CLASS_CACHE",
"[",
"alias",
"]",
"except",
"KeyError",
":",
"pass",
"for",
"loader",
"in",
"CLASS_LOADERS",
":",
"klass",
"=",
"loader",
"(",
"alias",
")",
"if... | Finds the class registered to the alias.
The search is done in order:
1. Checks if the class name has been registered via L{register_class}
or L{register_package}.
2. Checks all functions registered via L{register_class_loader}.
3. Attempts to load the class via standard module loading t... | [
"Finds",
"the",
"class",
"registered",
"to",
"the",
"alias",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/__init__.py#L336-L399 |
248,246 | jmgilman/Neolib | neolib/pyamf/__init__.py | decode | def decode(stream, *args, **kwargs):
"""
A generator function to decode a datastream.
@param stream: AMF data to be decoded.
@type stream: byte data.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A generator that will decode each element in the stream.
"""
encod... | python | def decode(stream, *args, **kwargs):
"""
A generator function to decode a datastream.
@param stream: AMF data to be decoded.
@type stream: byte data.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A generator that will decode each element in the stream.
"""
encod... | [
"def",
"decode",
"(",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"encoding",
"=",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"DEFAULT_ENCODING",
")",
"decoder",
"=",
"get_decoder",
"(",
"encoding",
",",
"stream",
",",
"*",
"args"... | A generator function to decode a datastream.
@param stream: AMF data to be decoded.
@type stream: byte data.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A generator that will decode each element in the stream. | [
"A",
"generator",
"function",
"to",
"decode",
"a",
"datastream",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/__init__.py#L402-L414 |
248,247 | jmgilman/Neolib | neolib/pyamf/__init__.py | encode | def encode(*args, **kwargs):
"""
A helper function to encode an element.
@param args: The python data to be encoded.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A L{util.BufferedByteStream} object that contains the data.
"""
encoding = kwargs.pop('encoding', DEFAU... | python | def encode(*args, **kwargs):
"""
A helper function to encode an element.
@param args: The python data to be encoded.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A L{util.BufferedByteStream} object that contains the data.
"""
encoding = kwargs.pop('encoding', DEFAU... | [
"def",
"encode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"encoding",
"=",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"DEFAULT_ENCODING",
")",
"encoder",
"=",
"get_encoder",
"(",
"encoding",
",",
"*",
"*",
"kwargs",
")",
"[",
"encoder",
... | A helper function to encode an element.
@param args: The python data to be encoded.
@kwarg encoding: AMF encoding type. One of L{ENCODING_TYPES}.
@return: A L{util.BufferedByteStream} object that contains the data. | [
"A",
"helper",
"function",
"to",
"encode",
"an",
"element",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/__init__.py#L417-L433 |
248,248 | jmgilman/Neolib | neolib/pyamf/__init__.py | get_type | def get_type(type_):
"""
Gets the declaration for the corresponding custom type.
@raise KeyError: Unknown type.
@see: L{add_type} and L{remove_type}
"""
if isinstance(type_, list):
type_ = tuple(type_)
for k, v in TYPE_MAP.iteritems():
if k == type_:
return v
... | python | def get_type(type_):
"""
Gets the declaration for the corresponding custom type.
@raise KeyError: Unknown type.
@see: L{add_type} and L{remove_type}
"""
if isinstance(type_, list):
type_ = tuple(type_)
for k, v in TYPE_MAP.iteritems():
if k == type_:
return v
... | [
"def",
"get_type",
"(",
"type_",
")",
":",
"if",
"isinstance",
"(",
"type_",
",",
"list",
")",
":",
"type_",
"=",
"tuple",
"(",
"type_",
")",
"for",
"k",
",",
"v",
"in",
"TYPE_MAP",
".",
"iteritems",
"(",
")",
":",
"if",
"k",
"==",
"type_",
":",
... | Gets the declaration for the corresponding custom type.
@raise KeyError: Unknown type.
@see: L{add_type} and L{remove_type} | [
"Gets",
"the",
"declaration",
"for",
"the",
"corresponding",
"custom",
"type",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/__init__.py#L558-L572 |
248,249 | madisona/apysigner | apysigner.py | Signer.create_signature | def create_signature(self, base_url, payload=None):
"""
Creates unique signature for request.
Make sure ALL 'GET' and 'POST' data is already included before
creating the signature or receiver won't be able to re-create it.
:param base_url:
The url you'll using for yo... | python | def create_signature(self, base_url, payload=None):
"""
Creates unique signature for request.
Make sure ALL 'GET' and 'POST' data is already included before
creating the signature or receiver won't be able to re-create it.
:param base_url:
The url you'll using for yo... | [
"def",
"create_signature",
"(",
"self",
",",
"base_url",
",",
"payload",
"=",
"None",
")",
":",
"url",
"=",
"urlparse",
"(",
"base_url",
")",
"url_to_sign",
"=",
"\"{path}?{query}\"",
".",
"format",
"(",
"path",
"=",
"url",
".",
"path",
",",
"query",
"="... | Creates unique signature for request.
Make sure ALL 'GET' and 'POST' data is already included before
creating the signature or receiver won't be able to re-create it.
:param base_url:
The url you'll using for your request.
:param payload:
The POST data that you'l... | [
"Creates",
"unique",
"signature",
"for",
"request",
".",
"Make",
"sure",
"ALL",
"GET",
"and",
"POST",
"data",
"is",
"already",
"included",
"before",
"creating",
"the",
"signature",
"or",
"receiver",
"won",
"t",
"be",
"able",
"to",
"re",
"-",
"create",
"it"... | 3666b478d228a38aca66a1b73d0aaf4aa67e765d | https://github.com/madisona/apysigner/blob/3666b478d228a38aca66a1b73d0aaf4aa67e765d/apysigner.py#L66-L85 |
248,250 | madisona/apysigner | apysigner.py | Signer._convert | def _convert(self, payload):
"""
Converts payload to a string. Complex objects are dumped to json
"""
if not isinstance(payload, six.string_types):
payload = json.dumps(payload, cls=DefaultJSONEncoder, sort_keys=True)
return str(payload) | python | def _convert(self, payload):
"""
Converts payload to a string. Complex objects are dumped to json
"""
if not isinstance(payload, six.string_types):
payload = json.dumps(payload, cls=DefaultJSONEncoder, sort_keys=True)
return str(payload) | [
"def",
"_convert",
"(",
"self",
",",
"payload",
")",
":",
"if",
"not",
"isinstance",
"(",
"payload",
",",
"six",
".",
"string_types",
")",
":",
"payload",
"=",
"json",
".",
"dumps",
"(",
"payload",
",",
"cls",
"=",
"DefaultJSONEncoder",
",",
"sort_keys",... | Converts payload to a string. Complex objects are dumped to json | [
"Converts",
"payload",
"to",
"a",
"string",
".",
"Complex",
"objects",
"are",
"dumped",
"to",
"json"
] | 3666b478d228a38aca66a1b73d0aaf4aa67e765d | https://github.com/madisona/apysigner/blob/3666b478d228a38aca66a1b73d0aaf4aa67e765d/apysigner.py#L87-L93 |
248,251 | heikomuller/sco-datastore | scodata/funcdata.py | DefaultFunctionalDataManager.from_dict | def from_dict(self, document):
"""Create functional data object from JSON document retrieved from
database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
FunctionalDataHandle
Handle for functional... | python | def from_dict(self, document):
"""Create functional data object from JSON document retrieved from
database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
FunctionalDataHandle
Handle for functional... | [
"def",
"from_dict",
"(",
"self",
",",
"document",
")",
":",
"identifier",
"=",
"str",
"(",
"document",
"[",
"'_id'",
"]",
")",
"active",
"=",
"document",
"[",
"'active'",
"]",
"# The directory is not materilaized in database to allow moving the",
"# base directory wit... | Create functional data object from JSON document retrieved from
database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
FunctionalDataHandle
Handle for functional data object | [
"Create",
"functional",
"data",
"object",
"from",
"JSON",
"document",
"retrieved",
"from",
"database",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/funcdata.py#L238-L259 |
248,252 | kennydo/nyaalib | nyaalib/__init__.py | NyaaClient.view_torrent | def view_torrent(self, torrent_id):
"""Retrieves and parses the torrent page for a given `torrent_id`.
:param torrent_id: the ID of the torrent to view
:raises TorrentNotFoundError: if the torrent does not exist
:returns: a :class:`TorrentPage` with a snapshot view of the torrent
... | python | def view_torrent(self, torrent_id):
"""Retrieves and parses the torrent page for a given `torrent_id`.
:param torrent_id: the ID of the torrent to view
:raises TorrentNotFoundError: if the torrent does not exist
:returns: a :class:`TorrentPage` with a snapshot view of the torrent
... | [
"def",
"view_torrent",
"(",
"self",
",",
"torrent_id",
")",
":",
"params",
"=",
"{",
"'page'",
":",
"'view'",
",",
"'tid'",
":",
"torrent_id",
",",
"}",
"r",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"base_url",
",",
"params",
"=",
"params",
")"... | Retrieves and parses the torrent page for a given `torrent_id`.
:param torrent_id: the ID of the torrent to view
:raises TorrentNotFoundError: if the torrent does not exist
:returns: a :class:`TorrentPage` with a snapshot view of the torrent
detail page | [
"Retrieves",
"and",
"parses",
"the",
"torrent",
"page",
"for",
"a",
"given",
"torrent_id",
"."
] | ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d | https://github.com/kennydo/nyaalib/blob/ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d/nyaalib/__init__.py#L67-L122 |
248,253 | kennydo/nyaalib | nyaalib/__init__.py | NyaaClient.get_torrent | def get_torrent(self, torrent_id):
"""Gets the `.torrent` data for the given `torrent_id`.
:param torrent_id: the ID of the torrent to download
:raises TorrentNotFoundError: if the torrent does not exist
:returns: :class:`Torrent` of the associated torrent
"""
params = {... | python | def get_torrent(self, torrent_id):
"""Gets the `.torrent` data for the given `torrent_id`.
:param torrent_id: the ID of the torrent to download
:raises TorrentNotFoundError: if the torrent does not exist
:returns: :class:`Torrent` of the associated torrent
"""
params = {... | [
"def",
"get_torrent",
"(",
"self",
",",
"torrent_id",
")",
":",
"params",
"=",
"{",
"'page'",
":",
"'download'",
",",
"'tid'",
":",
"torrent_id",
",",
"}",
"r",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"base_url",
",",
"params",
"=",
"params",
... | Gets the `.torrent` data for the given `torrent_id`.
:param torrent_id: the ID of the torrent to download
:raises TorrentNotFoundError: if the torrent does not exist
:returns: :class:`Torrent` of the associated torrent | [
"Gets",
"the",
".",
"torrent",
"data",
"for",
"the",
"given",
"torrent_id",
"."
] | ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d | https://github.com/kennydo/nyaalib/blob/ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d/nyaalib/__init__.py#L124-L139 |
248,254 | kennydo/nyaalib | nyaalib/__init__.py | NyaaClient.search | def search(self, terms, category=Category.all_categories, page=1,
sort_key=SearchSortKey.date,
order_key=SearchOrderKey.descending):
"""Get a list of torrents that match the given search term
:param terms: the `str` needle
:param category: the desired :class:`Categ... | python | def search(self, terms, category=Category.all_categories, page=1,
sort_key=SearchSortKey.date,
order_key=SearchOrderKey.descending):
"""Get a list of torrents that match the given search term
:param terms: the `str` needle
:param category: the desired :class:`Categ... | [
"def",
"search",
"(",
"self",
",",
"terms",
",",
"category",
"=",
"Category",
".",
"all_categories",
",",
"page",
"=",
"1",
",",
"sort_key",
"=",
"SearchSortKey",
".",
"date",
",",
"order_key",
"=",
"SearchOrderKey",
".",
"descending",
")",
":",
"params",
... | Get a list of torrents that match the given search term
:param terms: the `str` needle
:param category: the desired :class:`Category` of the results
:param page: the 1-based page to return the result
:param sort_key: the :class:`SearchSortKey` of the results list
:param order_ke... | [
"Get",
"a",
"list",
"of",
"torrents",
"that",
"match",
"the",
"given",
"search",
"term"
] | ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d | https://github.com/kennydo/nyaalib/blob/ab787b7ba141ed53d2ad978bf13eb7b8bcdd4b0d/nyaalib/__init__.py#L141-L204 |
248,255 | edeposit/edeposit.amqp.harvester | src/edeposit/amqp/harvester/scrappers/grada_cz.py | _parse_format_pages_isbn | def _parse_format_pages_isbn(html_chunk):
"""
Parse format, number of pages and ISBN.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
tuple: (format, pages, isbn), all as string.
"""
ppi = get_first_content(
html_chunk.find("div",... | python | def _parse_format_pages_isbn(html_chunk):
"""
Parse format, number of pages and ISBN.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
tuple: (format, pages, isbn), all as string.
"""
ppi = get_first_content(
html_chunk.find("div",... | [
"def",
"_parse_format_pages_isbn",
"(",
"html_chunk",
")",
":",
"ppi",
"=",
"get_first_content",
"(",
"html_chunk",
".",
"find",
"(",
"\"div\"",
",",
"{",
"\"class\"",
":",
"\"price-overflow\"",
"}",
")",
")",
"if",
"not",
"ppi",
":",
"return",
"None",
",",
... | Parse format, number of pages and ISBN.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
tuple: (format, pages, isbn), all as string. | [
"Parse",
"format",
"number",
"of",
"pages",
"and",
"ISBN",
"."
] | 38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e | https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/grada_cz.py#L148-L182 |
248,256 | edeposit/edeposit.amqp.harvester | src/edeposit/amqp/harvester/scrappers/grada_cz.py | _parse_price | def _parse_price(html_chunk):
"""
Parse price of the book.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
str/None: Price as string with currency or None if not found.
"""
price = get_first_content(
html_chunk.find("div", {"class... | python | def _parse_price(html_chunk):
"""
Parse price of the book.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
str/None: Price as string with currency or None if not found.
"""
price = get_first_content(
html_chunk.find("div", {"class... | [
"def",
"_parse_price",
"(",
"html_chunk",
")",
":",
"price",
"=",
"get_first_content",
"(",
"html_chunk",
".",
"find",
"(",
"\"div\"",
",",
"{",
"\"class\"",
":",
"\"prices\"",
"}",
")",
")",
"if",
"not",
"price",
":",
"return",
"None",
"# it is always in fo... | Parse price of the book.
Args:
html_chunk (obj): HTMLElement containing slice of the page with details.
Returns:
str/None: Price as string with currency or None if not found. | [
"Parse",
"price",
"of",
"the",
"book",
"."
] | 38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e | https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/grada_cz.py#L185-L206 |
248,257 | radjkarl/appBase | appbase/MultiWorkspaceWindow.py | MultiWorkspaceWindow.workspaces | def workspaces(self, index=None):
"""return generator for all all workspace instances"""
c = self.centralWidget()
if index is None:
return (c.widget(n) for n in range(c.count()))
else:
return c.widget(index) | python | def workspaces(self, index=None):
"""return generator for all all workspace instances"""
c = self.centralWidget()
if index is None:
return (c.widget(n) for n in range(c.count()))
else:
return c.widget(index) | [
"def",
"workspaces",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"c",
"=",
"self",
".",
"centralWidget",
"(",
")",
"if",
"index",
"is",
"None",
":",
"return",
"(",
"c",
".",
"widget",
"(",
"n",
")",
"for",
"n",
"in",
"range",
"(",
"c",
".... | return generator for all all workspace instances | [
"return",
"generator",
"for",
"all",
"all",
"workspace",
"instances"
] | 72b514e6dee7c083f01a2d0b2cc93d46df55bdcb | https://github.com/radjkarl/appBase/blob/72b514e6dee7c083f01a2d0b2cc93d46df55bdcb/appbase/MultiWorkspaceWindow.py#L77-L83 |
248,258 | zyga/call | examples/example2.py | validate | def validate(func):
"""
Check if annotated function arguments validate according to spec
"""
call = PythonCall(func)
@wraps(func)
def decorator(*args, **kwargs):
parameters = call.bind(args, kwargs)
for arg_name, validator in func.__annotations__.items():
if not vali... | python | def validate(func):
"""
Check if annotated function arguments validate according to spec
"""
call = PythonCall(func)
@wraps(func)
def decorator(*args, **kwargs):
parameters = call.bind(args, kwargs)
for arg_name, validator in func.__annotations__.items():
if not vali... | [
"def",
"validate",
"(",
"func",
")",
":",
"call",
"=",
"PythonCall",
"(",
"func",
")",
"@",
"wraps",
"(",
"func",
")",
"def",
"decorator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"parameters",
"=",
"call",
".",
"bind",
"(",
"args",
"... | Check if annotated function arguments validate according to spec | [
"Check",
"if",
"annotated",
"function",
"arguments",
"validate",
"according",
"to",
"spec"
] | dcef9a5aac7f9085bd4829dd6bcedc5fc2945d87 | https://github.com/zyga/call/blob/dcef9a5aac7f9085bd4829dd6bcedc5fc2945d87/examples/example2.py#L20-L34 |
248,259 | abe-winter/pg13-py | pg13/pgmock_dbapi2.py | expression_type | def expression_type(con, topx, ex):
"take a BaseX descendant from sqparse2, return a type class from above"
if isinstance(ex,sqparse2.Literal):
if isinstance(ex.val,basestring): return STRING
else: raise NotImplementedError('literal', type(ex.val))
elif isinstance(ex,sqparse2.AttrX):
if ex.parent.name... | python | def expression_type(con, topx, ex):
"take a BaseX descendant from sqparse2, return a type class from above"
if isinstance(ex,sqparse2.Literal):
if isinstance(ex.val,basestring): return STRING
else: raise NotImplementedError('literal', type(ex.val))
elif isinstance(ex,sqparse2.AttrX):
if ex.parent.name... | [
"def",
"expression_type",
"(",
"con",
",",
"topx",
",",
"ex",
")",
":",
"if",
"isinstance",
"(",
"ex",
",",
"sqparse2",
".",
"Literal",
")",
":",
"if",
"isinstance",
"(",
"ex",
".",
"val",
",",
"basestring",
")",
":",
"return",
"STRING",
"else",
":",... | take a BaseX descendant from sqparse2, return a type class from above | [
"take",
"a",
"BaseX",
"descendant",
"from",
"sqparse2",
"return",
"a",
"type",
"class",
"from",
"above"
] | c78806f99f35541a8756987e86edca3438aa97f5 | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L55-L71 |
248,260 | abe-winter/pg13-py | pg13/pgmock_dbapi2.py | call_cur | def call_cur(f):
"decorator for opening a connection and passing a cursor to the function"
@functools.wraps(f)
def f2(self, *args, **kwargs):
with self.withcur() as cur:
return f(self, cur, *args, **kwargs)
return f2 | python | def call_cur(f):
"decorator for opening a connection and passing a cursor to the function"
@functools.wraps(f)
def f2(self, *args, **kwargs):
with self.withcur() as cur:
return f(self, cur, *args, **kwargs)
return f2 | [
"def",
"call_cur",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"f2",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"withcur",
"(",
")",
"as",
"cur",
":",
"return",
"f",
"(... | decorator for opening a connection and passing a cursor to the function | [
"decorator",
"for",
"opening",
"a",
"connection",
"and",
"passing",
"a",
"cursor",
"to",
"the",
"function"
] | c78806f99f35541a8756987e86edca3438aa97f5 | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L195-L201 |
248,261 | abe-winter/pg13-py | pg13/pgmock_dbapi2.py | Cursor.description | def description(self):
"this is only a property so it can raise; make it an attr once it works"
if self.lastx is None: return
if type(self.lastx) not in (sqparse2.SelectX,sqparse2.UpdateX,sqparse2.InsertX): return
if type(self.lastx) in (sqparse2.UpdateX,sqparse2.InsertX) and self.lastx.ret is None: ret... | python | def description(self):
"this is only a property so it can raise; make it an attr once it works"
if self.lastx is None: return
if type(self.lastx) not in (sqparse2.SelectX,sqparse2.UpdateX,sqparse2.InsertX): return
if type(self.lastx) in (sqparse2.UpdateX,sqparse2.InsertX) and self.lastx.ret is None: ret... | [
"def",
"description",
"(",
"self",
")",
":",
"if",
"self",
".",
"lastx",
"is",
"None",
":",
"return",
"if",
"type",
"(",
"self",
".",
"lastx",
")",
"not",
"in",
"(",
"sqparse2",
".",
"SelectX",
",",
"sqparse2",
".",
"UpdateX",
",",
"sqparse2",
".",
... | this is only a property so it can raise; make it an attr once it works | [
"this",
"is",
"only",
"a",
"property",
"so",
"it",
"can",
"raise",
";",
"make",
"it",
"an",
"attr",
"once",
"it",
"works"
] | c78806f99f35541a8756987e86edca3438aa97f5 | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L93-L102 |
248,262 | KnowledgeLinks/rdfframework | rdfframework/utilities/mapreduce.py | SimpleMapReduce.partition | def partition(self, mapped_values):
"""Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values.
"""
partitioned_data = collections.defaultdict(list)
for key, value in mapped_values:
partitioned_data[key].appe... | python | def partition(self, mapped_values):
"""Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values.
"""
partitioned_data = collections.defaultdict(list)
for key, value in mapped_values:
partitioned_data[key].appe... | [
"def",
"partition",
"(",
"self",
",",
"mapped_values",
")",
":",
"partitioned_data",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"key",
",",
"value",
"in",
"mapped_values",
":",
"partitioned_data",
"[",
"key",
"]",
".",
"append",
"(",
... | Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values. | [
"Organize",
"the",
"mapped",
"values",
"by",
"their",
"key",
".",
"Returns",
"an",
"unsorted",
"sequence",
"of",
"tuples",
"with",
"a",
"key",
"and",
"a",
"sequence",
"of",
"values",
"."
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/mapreduce.py#L31-L38 |
248,263 | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.pre | def pre(self, command, output_dir, kw):
"""
Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files
"""
# Build a random secret_key
chars = u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
kw['secret_ke... | python | def pre(self, command, output_dir, kw):
"""
Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files
"""
# Build a random secret_key
chars = u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
kw['secret_ke... | [
"def",
"pre",
"(",
"self",
",",
"command",
",",
"output_dir",
",",
"kw",
")",
":",
"# Build a random secret_key",
"chars",
"=",
"u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'",
"kw",
"[",
"'secret_key'",
"]",
"=",
"''",
".",
"join",
"(",
"[",
"choice",
"... | Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files | [
"Prepare",
"some",
"context",
"before",
"install",
"Added",
"kwargs",
"in",
"kw",
"will",
"be",
"accessible",
"into",
"paste",
"template",
"files"
] | 29eabbcb17e21996a6e1d99592fc719dc8833b59 | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L63-L75 |
248,264 | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.get_mods | def get_mods(self, project_path, vars):
"""
Build the mod list to enable
"""
# Start with answers from interactive command
mods = [var.name for var in self.vars if vars[var.name].lower() == 'yes']
mods = set(mods)
# Base mods
for name in self.mods_list:
... | python | def get_mods(self, project_path, vars):
"""
Build the mod list to enable
"""
# Start with answers from interactive command
mods = [var.name for var in self.vars if vars[var.name].lower() == 'yes']
mods = set(mods)
# Base mods
for name in self.mods_list:
... | [
"def",
"get_mods",
"(",
"self",
",",
"project_path",
",",
"vars",
")",
":",
"# Start with answers from interactive command",
"mods",
"=",
"[",
"var",
".",
"name",
"for",
"var",
"in",
"self",
".",
"vars",
"if",
"vars",
"[",
"var",
".",
"name",
"]",
".",
"... | Build the mod list to enable | [
"Build",
"the",
"mod",
"list",
"to",
"enable"
] | 29eabbcb17e21996a6e1d99592fc719dc8833b59 | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L77-L94 |
248,265 | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.post | def post(self, command, output_dir, vars):
"""
Do some tasks after install
"""
if command.simulate:
return
# Find the 'project/' dir in the created paste project
project_path = join(getcwd(), vars['project'], 'project')
# 1. Mods
... | python | def post(self, command, output_dir, vars):
"""
Do some tasks after install
"""
if command.simulate:
return
# Find the 'project/' dir in the created paste project
project_path = join(getcwd(), vars['project'], 'project')
# 1. Mods
... | [
"def",
"post",
"(",
"self",
",",
"command",
",",
"output_dir",
",",
"vars",
")",
":",
"if",
"command",
".",
"simulate",
":",
"return",
"# Find the 'project/' dir in the created paste project",
"project_path",
"=",
"join",
"(",
"getcwd",
"(",
")",
",",
"vars",
... | Do some tasks after install | [
"Do",
"some",
"tasks",
"after",
"install"
] | 29eabbcb17e21996a6e1d99592fc719dc8833b59 | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L116-L138 |
248,266 | dugan/coverage-reporter | coverage_reporter/collectors/base.py | _iter_full_paths | def _iter_full_paths(path_list):
"""
Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths.
"""
for path in path_list:
if not os.path.isdir(path):
full_path = os.path.realpath(path)
yield path
else:
... | python | def _iter_full_paths(path_list):
"""
Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths.
"""
for path in path_list:
if not os.path.isdir(path):
full_path = os.path.realpath(path)
yield path
else:
... | [
"def",
"_iter_full_paths",
"(",
"path_list",
")",
":",
"for",
"path",
"in",
"path_list",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",
"yield",
"path"... | Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths. | [
"Iterates",
"over",
"all",
"paths",
"that",
"are",
"in",
"a",
"directory",
"and",
"its",
"subdirectory",
"returning",
"fully",
"-",
"specified",
"paths",
"."
] | 18ecc9189de4f62b15366901b2451b8047f1ccfb | https://github.com/dugan/coverage-reporter/blob/18ecc9189de4f62b15366901b2451b8047f1ccfb/coverage_reporter/collectors/base.py#L53-L66 |
248,267 | f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline.c | def c(self):
"""Caching client for not repeapting checks"""
if self._client is None:
self._parse_settings()
self._client = Rumetr(**self.settings)
return self._client | python | def c(self):
"""Caching client for not repeapting checks"""
if self._client is None:
self._parse_settings()
self._client = Rumetr(**self.settings)
return self._client | [
"def",
"c",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_parse_settings",
"(",
")",
"self",
".",
"_client",
"=",
"Rumetr",
"(",
"*",
"*",
"self",
".",
"settings",
")",
"return",
"self",
".",
"_client"
] | Caching client for not repeapting checks | [
"Caching",
"client",
"for",
"not",
"repeapting",
"checks"
] | 5180152bcb2eed8246b88035db7c0bb1fe603166 | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L81-L86 |
248,268 | f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline._parse_settings | def _parse_settings(self):
"""Gets upload options from the scrapy settings"""
if hasattr(self, 'settings'): # parse setting only one time
return
self.settings = {
'auth_key': self._check_required_setting('RUMETR_TOKEN'),
'developer': self._check_required_set... | python | def _parse_settings(self):
"""Gets upload options from the scrapy settings"""
if hasattr(self, 'settings'): # parse setting only one time
return
self.settings = {
'auth_key': self._check_required_setting('RUMETR_TOKEN'),
'developer': self._check_required_set... | [
"def",
"_parse_settings",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'settings'",
")",
":",
"# parse setting only one time",
"return",
"self",
".",
"settings",
"=",
"{",
"'auth_key'",
":",
"self",
".",
"_check_required_setting",
"(",
"'RUMETR_TOK... | Gets upload options from the scrapy settings | [
"Gets",
"upload",
"options",
"from",
"the",
"scrapy",
"settings"
] | 5180152bcb2eed8246b88035db7c0bb1fe603166 | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L88-L97 |
248,269 | f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline._parse_deadline | def _parse_deadline(deadline):
"""Translate deadline date from human-acceptable format to the machine-acceptable"""
if '-' in deadline and len(deadline) == 10:
return deadline
if '.' in deadline and len(deadline) == 10: # russian format dd.mm.yyyy to yyyy-mm-dd
dmy = de... | python | def _parse_deadline(deadline):
"""Translate deadline date from human-acceptable format to the machine-acceptable"""
if '-' in deadline and len(deadline) == 10:
return deadline
if '.' in deadline and len(deadline) == 10: # russian format dd.mm.yyyy to yyyy-mm-dd
dmy = de... | [
"def",
"_parse_deadline",
"(",
"deadline",
")",
":",
"if",
"'-'",
"in",
"deadline",
"and",
"len",
"(",
"deadline",
")",
"==",
"10",
":",
"return",
"deadline",
"if",
"'.'",
"in",
"deadline",
"and",
"len",
"(",
"deadline",
")",
"==",
"10",
":",
"# russia... | Translate deadline date from human-acceptable format to the machine-acceptable | [
"Translate",
"deadline",
"date",
"from",
"human",
"-",
"acceptable",
"format",
"to",
"the",
"machine",
"-",
"acceptable"
] | 5180152bcb2eed8246b88035db7c0bb1fe603166 | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L109-L119 |
248,270 | tylerbutler/propane | propane/paths.py | has_files | def has_files(the_path):
"""Given a path, returns whether the path has any files in it or any subfolders. Works recursively."""
the_path = Path(the_path)
try:
for _ in the_path.walkfiles():
return True
return False
except OSError as ex:
if ex.errno == errno.ENOENT:
... | python | def has_files(the_path):
"""Given a path, returns whether the path has any files in it or any subfolders. Works recursively."""
the_path = Path(the_path)
try:
for _ in the_path.walkfiles():
return True
return False
except OSError as ex:
if ex.errno == errno.ENOENT:
... | [
"def",
"has_files",
"(",
"the_path",
")",
":",
"the_path",
"=",
"Path",
"(",
"the_path",
")",
"try",
":",
"for",
"_",
"in",
"the_path",
".",
"walkfiles",
"(",
")",
":",
"return",
"True",
"return",
"False",
"except",
"OSError",
"as",
"ex",
":",
"if",
... | Given a path, returns whether the path has any files in it or any subfolders. Works recursively. | [
"Given",
"a",
"path",
"returns",
"whether",
"the",
"path",
"has",
"any",
"files",
"in",
"it",
"or",
"any",
"subfolders",
".",
"Works",
"recursively",
"."
] | 6c404285ab8d78865b7175a5c8adf8fae12d6be5 | https://github.com/tylerbutler/propane/blob/6c404285ab8d78865b7175a5c8adf8fae12d6be5/propane/paths.py#L88-L100 |
248,271 | hapylestat/apputils | apputils/settings/ast/cmd.py | DefaultTokenizer.tokenize | def tokenize(cls, obj):
"""
Convert input data to tokens
:type obj list|set|tuple
"""
tokens = {}
try:
token_iterator = cls.make_iterable(obj)
_lang = cls.language_definition()
tokens = {k: [] for k in _lang.argument_types}
prev, current = None, next(token_iterator)
... | python | def tokenize(cls, obj):
"""
Convert input data to tokens
:type obj list|set|tuple
"""
tokens = {}
try:
token_iterator = cls.make_iterable(obj)
_lang = cls.language_definition()
tokens = {k: [] for k in _lang.argument_types}
prev, current = None, next(token_iterator)
... | [
"def",
"tokenize",
"(",
"cls",
",",
"obj",
")",
":",
"tokens",
"=",
"{",
"}",
"try",
":",
"token_iterator",
"=",
"cls",
".",
"make_iterable",
"(",
"obj",
")",
"_lang",
"=",
"cls",
".",
"language_definition",
"(",
")",
"tokens",
"=",
"{",
"k",
":",
... | Convert input data to tokens
:type obj list|set|tuple | [
"Convert",
"input",
"data",
"to",
"tokens"
] | 5d185616feda27e6e21273307161471ef11a3518 | https://github.com/hapylestat/apputils/blob/5d185616feda27e6e21273307161471ef11a3518/apputils/settings/ast/cmd.py#L66-L120 |
248,272 | hapylestat/apputils | apputils/settings/ast/cmd.py | CommandLineAST.parse | def parse(self, argv, tokenizer=DefaultTokenizer):
"""
Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer
"""
args = tokenizer.tokenize(argv)
_lang = tokenizer.language_definition()
#
# for param in self.__args:
# if self._is_default_arg(param)... | python | def parse(self, argv, tokenizer=DefaultTokenizer):
"""
Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer
"""
args = tokenizer.tokenize(argv)
_lang = tokenizer.language_definition()
#
# for param in self.__args:
# if self._is_default_arg(param)... | [
"def",
"parse",
"(",
"self",
",",
"argv",
",",
"tokenizer",
"=",
"DefaultTokenizer",
")",
":",
"args",
"=",
"tokenizer",
".",
"tokenize",
"(",
"argv",
")",
"_lang",
"=",
"tokenizer",
".",
"language_definition",
"(",
")",
"#",
"# for param in self.__args:",
"... | Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer | [
"Parse",
"command",
"line",
"to",
"out",
"tree"
] | 5d185616feda27e6e21273307161471ef11a3518 | https://github.com/hapylestat/apputils/blob/5d185616feda27e6e21273307161471ef11a3518/apputils/settings/ast/cmd.py#L142-L160 |
248,273 | kervi/kervi-core | kervi/actions/__init__.py | action | def action(method=None, **kwargs):
"""
Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@a... | python | def action(method=None, **kwargs):
"""
Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@a... | [
"def",
"action",
"(",
"method",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"action_wrap",
"(",
"f",
")",
":",
"action_id",
"=",
"kwargs",
".",
"get",
"(",
"\"action_id\"",
",",
"f",
".",
"__name__",
")",
"name",
"=",
"kwargs",
".",
"get... | Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@action(action_id="action_1", name="This is my action... | [
"Decorator",
"that",
"turns",
"a",
"function",
"or",
"controller",
"method",
"into",
"an",
"kervi",
"action",
".",
"it",
"is",
"possible",
"to",
"call",
"the",
"action",
"in",
"other",
"kervi",
"processes",
"or",
"modules",
"."
] | 3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23 | https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/__init__.py#L42-L92 |
248,274 | b3j0f/conf | b3j0f/conf/model/base.py | ModelElement.copy | def copy(self, *args, **kwargs):
"""Copy this model element and contained elements if they exist."""
for slot in self.__slots__:
attr = getattr(self, slot)
if slot[0] == '_': # convert protected attribute name to public
slot = slot[1:]
if slot not in... | python | def copy(self, *args, **kwargs):
"""Copy this model element and contained elements if they exist."""
for slot in self.__slots__:
attr = getattr(self, slot)
if slot[0] == '_': # convert protected attribute name to public
slot = slot[1:]
if slot not in... | [
"def",
"copy",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"slot",
"in",
"self",
".",
"__slots__",
":",
"attr",
"=",
"getattr",
"(",
"self",
",",
"slot",
")",
"if",
"slot",
"[",
"0",
"]",
"==",
"'_'",
":",
"# conver... | Copy this model element and contained elements if they exist. | [
"Copy",
"this",
"model",
"element",
"and",
"contained",
"elements",
"if",
"they",
"exist",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L48-L60 |
248,275 | b3j0f/conf | b3j0f/conf/model/base.py | ModelElement.update | def update(self, other, copy=True, *args, **kwargs):
"""Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this"""... | python | def update(self, other, copy=True, *args, **kwargs):
"""Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this"""... | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"copy",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"other",
":",
"# dirty hack for python2.6",
"if",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"i... | Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this | [
"Update",
"this",
"element",
"related",
"to",
"other",
"element",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L108-L134 |
248,276 | b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.__i | def __i(self, other, func):
"""Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s)."""
if isinstance(oth... | python | def __i(self, other, func):
"""Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s)."""
if isinstance(oth... | [
"def",
"__i",
"(",
"self",
",",
"other",
",",
"func",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
":",
"other",
"=",
"tuple",
"(",
"other",
")",
"elif",
"isinstance",
"(",
"other",
",",
"self",
".",
"__contenttyp... | Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s). | [
"Process",
"input",
"other",
"with",
"input",
"func",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L179-L200 |
248,277 | b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.update | def update(self, other, copy=True, *args, **kwargs):
"""Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: se... | python | def update(self, other, copy=True, *args, **kwargs):
"""Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: se... | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"copy",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"CompositeModelElement",
",",
"self",
")",
".",
"update",
"(",
"other",
",",
"copy",
"=",
"copy",
",",
"*",
"... | Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: self | [
"Update",
"this",
"composite",
"model",
"element",
"with",
"other",
"element",
"content",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L253-L292 |
248,278 | b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.params | def params(self):
"""Get set of parameters by names.
:rtype: dict"""
result = {}
for content in list(self.values()):
if isinstance(content, CompositeModelElement):
cparams = content.params
for cpname in cparams:
cparam ... | python | def params(self):
"""Get set of parameters by names.
:rtype: dict"""
result = {}
for content in list(self.values()):
if isinstance(content, CompositeModelElement):
cparams = content.params
for cpname in cparams:
cparam ... | [
"def",
"params",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"content",
"in",
"list",
"(",
"self",
".",
"values",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"content",
",",
"CompositeModelElement",
")",
":",
"cparams",
"=",
"content",
".... | Get set of parameters by names.
:rtype: dict | [
"Get",
"set",
"of",
"parameters",
"by",
"names",
"."
] | 18dd6d5d6560f9b202793739e2330a2181163511 | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L295-L322 |
248,279 | anti1869/sunhead | src/sunhead/decorators.py | cached_property | def cached_property():
"""
Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name... | python | def cached_property():
"""
Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name... | [
"def",
"cached_property",
"(",
")",
":",
"def",
"_stored_value",
"(",
"f",
")",
":",
"storage_var_name",
"=",
"\"__{}\"",
".",
"format",
"(",
"f",
".",
"__name__",
")",
"def",
"_wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"... | Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name of the class property to store cac... | [
"Handy",
"utility",
"to",
"build",
"caching",
"properties",
"in",
"your",
"classes",
".",
"Decorated",
"code",
"will",
"be",
"run",
"only",
"once",
"and",
"then",
"result",
"will",
"be",
"stored",
"in",
"private",
"class",
"property",
"with",
"the",
"given",... | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/decorators.py#L18-L40 |
248,280 | anti1869/sunhead | src/sunhead/decorators.py | deprecated | def deprecated(message=DEPRECATION_MESSAGE, logger=None):
"""
This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function.
"""
if logger is None:
logger = default_logger
def _d... | python | def deprecated(message=DEPRECATION_MESSAGE, logger=None):
"""
This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function.
"""
if logger is None:
logger = default_logger
def _d... | [
"def",
"deprecated",
"(",
"message",
"=",
"DEPRECATION_MESSAGE",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"None",
":",
"logger",
"=",
"default_logger",
"def",
"_deprecated",
"(",
"f",
")",
":",
"def",
"_wrapper",
"(",
"*",
"args",
",",... | This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function. | [
"This",
"decorator",
"will",
"simply",
"print",
"warning",
"before",
"running",
"decoratee",
".",
"So",
"presumably",
"you",
"want",
"to",
"use",
"it",
"with",
"console",
"-",
"based",
"commands",
"."
] | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/decorators.py#L43-L59 |
248,281 | AndreLouisCaron/runwith | features/steps/cli.py | write_fixture_file | def write_fixture_file(context, path):
"""Write fixture to disk."""
print('CWD:', os.getcwd())
print('FIXTURE:', path)
with open(path, 'w') as stream:
stream.write(context.text) | python | def write_fixture_file(context, path):
"""Write fixture to disk."""
print('CWD:', os.getcwd())
print('FIXTURE:', path)
with open(path, 'w') as stream:
stream.write(context.text) | [
"def",
"write_fixture_file",
"(",
"context",
",",
"path",
")",
":",
"print",
"(",
"'CWD:'",
",",
"os",
".",
"getcwd",
"(",
")",
")",
"print",
"(",
"'FIXTURE:'",
",",
"path",
")",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"stream",
":",
"s... | Write fixture to disk. | [
"Write",
"fixture",
"to",
"disk",
"."
] | cfa2b6ae67d73ec5b24f1502a37060d838276e8b | https://github.com/AndreLouisCaron/runwith/blob/cfa2b6ae67d73ec5b24f1502a37060d838276e8b/features/steps/cli.py#L140-L146 |
248,282 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.add_section | def add_section(self, section):
"""Add a new Section object to the config. Should be a subclass of
_AbstractSection."""
if not issubclass(section.__class__, _AbstractSection):
raise TypeError("argument should be a subclass of Section")
self.sections[section.get_key_name()] = ... | python | def add_section(self, section):
"""Add a new Section object to the config. Should be a subclass of
_AbstractSection."""
if not issubclass(section.__class__, _AbstractSection):
raise TypeError("argument should be a subclass of Section")
self.sections[section.get_key_name()] = ... | [
"def",
"add_section",
"(",
"self",
",",
"section",
")",
":",
"if",
"not",
"issubclass",
"(",
"section",
".",
"__class__",
",",
"_AbstractSection",
")",
":",
"raise",
"TypeError",
"(",
"\"argument should be a subclass of Section\"",
")",
"self",
".",
"sections",
... | Add a new Section object to the config. Should be a subclass of
_AbstractSection. | [
"Add",
"a",
"new",
"Section",
"object",
"to",
"the",
"config",
".",
"Should",
"be",
"a",
"subclass",
"of",
"_AbstractSection",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L160-L166 |
248,283 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.get_parser | def get_parser(self, **kwargs):
"""This method will create and return a new parser with prog_name,
description, and a config file argument.
"""
self.parser = argparse.ArgumentParser(prog=self.prog_name,
description=self._desc,
... | python | def get_parser(self, **kwargs):
"""This method will create and return a new parser with prog_name,
description, and a config file argument.
"""
self.parser = argparse.ArgumentParser(prog=self.prog_name,
description=self._desc,
... | [
"def",
"get_parser",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"self",
".",
"prog_name",
",",
"description",
"=",
"self",
".",
"_desc",
",",
"add_help",
"=",
"False"... | This method will create and return a new parser with prog_name,
description, and a config file argument. | [
"This",
"method",
"will",
"create",
"and",
"return",
"a",
"new",
"parser",
"with",
"prog_name",
"description",
"and",
"a",
"config",
"file",
"argument",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L228-L242 |
248,284 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.reload | def reload(self, hooks=None):
"""This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file ... | python | def reload(self, hooks=None):
"""This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file ... | [
"def",
"reload",
"(",
"self",
",",
"hooks",
"=",
"None",
")",
":",
"#from argcomplete import debug",
"# Parsing the command line looking for the previous options like",
"# configuration file name or server section. Extra arguments",
"# will be store into argv.",
"args",
"=",
"None",
... | This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file name. | [
"This",
"method",
"will",
"reload",
"the",
"configuration",
"using",
"input",
"argument",
"from",
"the",
"command",
"line",
"interface",
".",
"1",
".",
"pasing",
"arguments",
"2",
".",
"applying",
"hooks",
"3",
".",
"addding",
"help",
"argument",
"4",
".",
... | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L244-L295 |
248,285 | fred49/argtoolbox | argtoolbox/argtoolbox.py | _AbstractSection.get_representation | def get_representation(self, prefix="", suffix="\n"):
"""return the string representation of the current object."""
res = prefix + "Section " + self.get_section_name().upper() + suffix
return res | python | def get_representation(self, prefix="", suffix="\n"):
"""return the string representation of the current object."""
res = prefix + "Section " + self.get_section_name().upper() + suffix
return res | [
"def",
"get_representation",
"(",
"self",
",",
"prefix",
"=",
"\"\"",
",",
"suffix",
"=",
"\"\\n\"",
")",
":",
"res",
"=",
"prefix",
"+",
"\"Section \"",
"+",
"self",
".",
"get_section_name",
"(",
")",
".",
"upper",
"(",
")",
"+",
"suffix",
"return",
"... | return the string representation of the current object. | [
"return",
"the",
"string",
"representation",
"of",
"the",
"current",
"object",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L379-L382 |
248,286 | fred49/argtoolbox | argtoolbox/argtoolbox.py | _Section.add_element | def add_element(self, elt):
"""Helper to add a element to the current section. The Element name
will be used as an identifier."""
if not isinstance(elt, Element):
raise TypeError("argument should be a subclass of Element")
self.elements[elt.get_name()] = elt
return el... | python | def add_element(self, elt):
"""Helper to add a element to the current section. The Element name
will be used as an identifier."""
if not isinstance(elt, Element):
raise TypeError("argument should be a subclass of Element")
self.elements[elt.get_name()] = elt
return el... | [
"def",
"add_element",
"(",
"self",
",",
"elt",
")",
":",
"if",
"not",
"isinstance",
"(",
"elt",
",",
"Element",
")",
":",
"raise",
"TypeError",
"(",
"\"argument should be a subclass of Element\"",
")",
"self",
".",
"elements",
"[",
"elt",
".",
"get_name",
"(... | Helper to add a element to the current section. The Element name
will be used as an identifier. | [
"Helper",
"to",
"add",
"a",
"element",
"to",
"the",
"current",
"section",
".",
"The",
"Element",
"name",
"will",
"be",
"used",
"as",
"an",
"identifier",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L414-L420 |
248,287 | fred49/argtoolbox | argtoolbox/argtoolbox.py | _Section.add_element_list | def add_element_list(self, elt_list, **kwargs):
"""Helper to add a list of similar elements to the current section.
Element names will be used as an identifier."""
for e in elt_list:
self.add_element(Element(e, **kwargs)) | python | def add_element_list(self, elt_list, **kwargs):
"""Helper to add a list of similar elements to the current section.
Element names will be used as an identifier."""
for e in elt_list:
self.add_element(Element(e, **kwargs)) | [
"def",
"add_element_list",
"(",
"self",
",",
"elt_list",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"e",
"in",
"elt_list",
":",
"self",
".",
"add_element",
"(",
"Element",
"(",
"e",
",",
"*",
"*",
"kwargs",
")",
")"
] | Helper to add a list of similar elements to the current section.
Element names will be used as an identifier. | [
"Helper",
"to",
"add",
"a",
"list",
"of",
"similar",
"elements",
"to",
"the",
"current",
"section",
".",
"Element",
"names",
"will",
"be",
"used",
"as",
"an",
"identifier",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L422-L426 |
248,288 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.get_representation | def get_representation(self, prefix="", suffix="\n"):
"""This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed.
"""
res = []
if self.hidden:
res.append(prefix + " - " + str(self.... | python | def get_representation(self, prefix="", suffix="\n"):
"""This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed.
"""
res = []
if self.hidden:
res.append(prefix + " - " + str(self.... | [
"def",
"get_representation",
"(",
"self",
",",
"prefix",
"=",
"\"\"",
",",
"suffix",
"=",
"\"\\n\"",
")",
":",
"res",
"=",
"[",
"]",
"if",
"self",
".",
"hidden",
":",
"res",
".",
"append",
"(",
"prefix",
"+",
"\" - \"",
"+",
"str",
"(",
"self",
"."... | This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed. | [
"This",
"method",
"build",
"a",
"array",
"that",
"will",
"contain",
"the",
"string",
"representation",
"of",
"the",
"current",
"object",
".",
"Every",
"lines",
"could",
"be",
"prefixed",
"and",
"suffixed",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L658-L679 |
248,289 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.load | def load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied.
"""
self._load(file_parser, section_name)
self.post_load() | python | def load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied.
"""
self._load(file_parser, section_name)
self.post_load() | [
"def",
"load",
"(",
"self",
",",
"file_parser",
",",
"section_name",
")",
":",
"self",
".",
"_load",
"(",
"file_parser",
",",
"section_name",
")",
"self",
".",
"post_load",
"(",
")"
] | The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied. | [
"The",
"current",
"element",
"is",
"loaded",
"from",
"the",
"configuration",
"file",
"all",
"constraints",
"and",
"requirements",
"are",
"checked",
".",
"Then",
"element",
"hooks",
"are",
"applied",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L697-L703 |
248,290 | fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.get_arg_parse_arguments | def get_arg_parse_arguments(self):
"""
During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You... | python | def get_arg_parse_arguments(self):
"""
During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You... | [
"def",
"get_arg_parse_arguments",
"(",
"self",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"if",
"self",
".",
"_required",
":",
"if",
"self",
".",
"value",
"is",
"not",
"None",
":",
"ret",
"[",
"\"default\"",
"]",
"=",
"self",
".",
"value",
"else",
":",
... | During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You does not need to have multiple declarations. | [
"During",
"the",
"element",
"declaration",
"all",
"configuration",
"file",
"requirements",
"and",
"all",
"cli",
"requirements",
"have",
"been",
"described",
"once",
".",
"This",
"method",
"will",
"build",
"a",
"dict",
"containing",
"all",
"argparse",
"options",
... | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L789-L813 |
248,291 | fred49/argtoolbox | argtoolbox/argtoolbox.py | ElementWithSubSections.add_section | def add_section(self, section):
"""You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree.
"""
if not issubclass(section.__class__, SubSection):
raise TypeError("Argument should be a subclass of SubSecti... | python | def add_section(self, section):
"""You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree.
"""
if not issubclass(section.__class__, SubSection):
raise TypeError("Argument should be a subclass of SubSecti... | [
"def",
"add_section",
"(",
"self",
",",
"section",
")",
":",
"if",
"not",
"issubclass",
"(",
"section",
".",
"__class__",
",",
"SubSection",
")",
":",
"raise",
"TypeError",
"(",
"\"Argument should be a subclass of SubSection, \\\n not :\"",
"... | You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree. | [
"You",
"can",
"add",
"section",
"inside",
"a",
"Element",
"the",
"section",
"must",
"be",
"a",
"subclass",
"of",
"SubSection",
".",
"You",
"can",
"use",
"this",
"class",
"to",
"represent",
"a",
"tree",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L881-L890 |
248,292 | fred49/argtoolbox | argtoolbox/argtoolbox.py | BasicProgram.add_commands | def add_commands(self):
""" You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time."""
self.parser.add_argument(
'-d',
action="count",
**self.config.default.deb... | python | def add_commands(self):
""" You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time."""
self.parser.add_argument(
'-d',
action="count",
**self.config.default.deb... | [
"def",
"add_commands",
"(",
"self",
")",
":",
"self",
".",
"parser",
".",
"add_argument",
"(",
"'-d'",
",",
"action",
"=",
"\"count\"",
",",
"*",
"*",
"self",
".",
"config",
".",
"default",
".",
"debug",
".",
"get_arg_parse_arguments",
"(",
")",
")"
] | You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time. | [
"You",
"can",
"override",
"this",
"method",
"in",
"order",
"to",
"add",
"your",
"command",
"line",
"arguments",
"to",
"the",
"argparse",
"parser",
".",
"The",
"configuration",
"file",
"was",
"reloaded",
"at",
"this",
"time",
"."
] | e32ad6265567d5a1891df3c3425423774dafab41 | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L1283-L1290 |
248,293 | henrysher/kotocore | kotocore/introspection.py | Introspection.strip_html | def strip_html(self, doc):
"""
This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns:... | python | def strip_html(self, doc):
"""
This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns:... | [
"def",
"strip_html",
"(",
"self",
",",
"doc",
")",
":",
"if",
"not",
"isinstance",
"(",
"doc",
",",
"six",
".",
"string_types",
")",
":",
"return",
"''",
"doc",
"=",
"doc",
".",
"strip",
"(",
")",
"doc",
"=",
"self",
".",
"tag_re",
".",
"sub",
"(... | This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns: The stripped/cleaned docstring
:rtype:... | [
"This",
"method",
"removes",
"all",
"HTML",
"from",
"a",
"docstring",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L84-L102 |
248,294 | henrysher/kotocore | kotocore/introspection.py | Introspection.parse_param | def parse_param(self, core_param):
"""
Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information
"""
return {
... | python | def parse_param(self, core_param):
"""
Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information
"""
return {
... | [
"def",
"parse_param",
"(",
"self",
",",
"core_param",
")",
":",
"return",
"{",
"'var_name'",
":",
"core_param",
".",
"py_name",
",",
"'api_name'",
":",
"core_param",
".",
"name",
",",
"'required'",
":",
"core_param",
".",
"required",
",",
"'docs'",
":",
"s... | Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information | [
"Returns",
"data",
"about",
"a",
"specific",
"parameter",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L104-L119 |
248,295 | henrysher/kotocore | kotocore/introspection.py | Introspection.parse_params | def parse_params(self, core_params):
"""
Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dicti... | python | def parse_params(self, core_params):
"""
Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dicti... | [
"def",
"parse_params",
"(",
"self",
",",
"core_params",
")",
":",
"params",
"=",
"[",
"]",
"for",
"core_param",
"in",
"core_params",
":",
"params",
".",
"append",
"(",
"self",
".",
"parse_param",
"(",
"core_param",
")",
")",
"return",
"params"
] | Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dictionaries | [
"Goes",
"through",
"a",
"set",
"of",
"parameters",
"extracting",
"information",
"about",
"each",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L121-L136 |
248,296 | Nydareld/ConfigEnv | ConfigEnv/Config.py | Config.addFile | def addFile(self,file):
"""
Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier
"""
mylambda= lambda adict : { k... | python | def addFile(self,file):
"""
Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier
"""
mylambda= lambda adict : { k... | [
"def",
"addFile",
"(",
"self",
",",
"file",
")",
":",
"mylambda",
"=",
"lambda",
"adict",
":",
"{",
"key",
".",
"upper",
"(",
")",
":",
"mylambda",
"(",
"adict",
"[",
"key",
"]",
")",
"if",
"isinstance",
"(",
"adict",
"[",
"key",
"]",
",",
"dict"... | Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier | [
"Permet",
"d",
"ajouter",
"un",
"fichier"
] | 38c13e5dd9d6c5f3dcd4c1194507a43384c31e29 | https://github.com/Nydareld/ConfigEnv/blob/38c13e5dd9d6c5f3dcd4c1194507a43384c31e29/ConfigEnv/Config.py#L16-L41 |
248,297 | AguaClara/aide_document-DEPRECATED | aide_document/combine.py | render_document | def render_document(template_name, data_name, output_name):
"""
Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact ... | python | def render_document(template_name, data_name, output_name):
"""
Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact ... | [
"def",
"render_document",
"(",
"template_name",
",",
"data_name",
",",
"output_name",
")",
":",
"# Set up environment and load templates from pip package",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"PackageLoader",
"(",
"'aide_document'",
")",
")",
"#TODO: add custom... | Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact name of the MarkDown template file from the aide_document/templates fold... | [
"Combines",
"a",
"MarkDown",
"template",
"file",
"from",
"the",
"aide_document",
"package",
"with",
"a",
"local",
"associated",
"YAML",
"data",
"file",
"then",
"outputs",
"the",
"rendered",
"combination",
"to",
"a",
"local",
"MarkDown",
"output",
"file",
"."
] | 3f3b5c9f321264e0e4d8ed68dfbc080762579815 | https://github.com/AguaClara/aide_document-DEPRECATED/blob/3f3b5c9f321264e0e4d8ed68dfbc080762579815/aide_document/combine.py#L5-L37 |
248,298 | echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorComponentSkeleton.cache | def cache(self, refreshing=None, next_action=None, data_blob=None, json_last_refresh=None, rollback_point=False):
"""
push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob ... | python | def cache(self, refreshing=None, next_action=None, data_blob=None, json_last_refresh=None, rollback_point=False):
"""
push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob ... | [
"def",
"cache",
"(",
"self",
",",
"refreshing",
"=",
"None",
",",
"next_action",
"=",
"None",
",",
"data_blob",
"=",
"None",
",",
"json_last_refresh",
"=",
"None",
",",
"rollback_point",
"=",
"False",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCompo... | push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob value
:param json_last_refresh: the new json last refresh value - if None the date of this call
:param rollback_point:... | [
"push",
"this",
"component",
"into",
"the",
"cache"
] | 0a7feddebf66fee4bef38d64f456d93a7e9fcd68 | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L808-L829 |
248,299 | echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorComponentSkeleton.rollback | def rollback(self):
"""
push back last rollbackpoint into the cache
:return:
"""
return self.component_cache_actor.save(refreshing=self.rollback_point_refreshing,
next_action=self.rollback_point_next_action,
... | python | def rollback(self):
"""
push back last rollbackpoint into the cache
:return:
"""
return self.component_cache_actor.save(refreshing=self.rollback_point_refreshing,
next_action=self.rollback_point_next_action,
... | [
"def",
"rollback",
"(",
"self",
")",
":",
"return",
"self",
".",
"component_cache_actor",
".",
"save",
"(",
"refreshing",
"=",
"self",
".",
"rollback_point_refreshing",
",",
"next_action",
"=",
"self",
".",
"rollback_point_next_action",
",",
"json_last_refresh",
"... | push back last rollbackpoint into the cache
:return: | [
"push",
"back",
"last",
"rollbackpoint",
"into",
"the",
"cache"
] | 0a7feddebf66fee4bef38d64f456d93a7e9fcd68 | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L831-L840 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.