repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
blockstack/blockstack-core
blockstack/lib/atlas.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L902-L916
def atlasdb_cache_zonefile_info( con=None, path=None ): """ Load up and cache our zonefile inventory from the database """ global ZONEFILE_INV, NUM_ZONEFILES, ZONEFILE_INV_LOCK inv = None with ZONEFILE_INV_LOCK: inv_len = atlasdb_zonefile_inv_length( con=con, path=path ) inv...
[ "def", "atlasdb_cache_zonefile_info", "(", "con", "=", "None", ",", "path", "=", "None", ")", ":", "global", "ZONEFILE_INV", ",", "NUM_ZONEFILES", ",", "ZONEFILE_INV_LOCK", "inv", "=", "None", "with", "ZONEFILE_INV_LOCK", ":", "inv_len", "=", "atlasdb_zonefile_inv...
Load up and cache our zonefile inventory from the database
[ "Load", "up", "and", "cache", "our", "zonefile", "inventory", "from", "the", "database" ]
python
train
29.866667
log2timeline/dfvfs
dfvfs/file_io/qcow_file_io.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/qcow_file_io.py#L16-L36
def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. Returns: pyqcow.file: a file-like object. Raises: PathSpecError: if the path specification is incorrect. """ if not path_spec.Ha...
[ "def", "_OpenFileObject", "(", "self", ",", "path_spec", ")", ":", "if", "not", "path_spec", ".", "HasParent", "(", ")", ":", "raise", "errors", ".", "PathSpecError", "(", "'Unsupported path specification without parent.'", ")", "file_object", "=", "resolver", "."...
Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. Returns: pyqcow.file: a file-like object. Raises: PathSpecError: if the path specification is incorrect.
[ "Opens", "the", "file", "-", "like", "object", "defined", "by", "path", "specification", "." ]
python
train
29.47619
chrippa/ds4drv
ds4drv/uinput.py
https://github.com/chrippa/ds4drv/blob/be7327fc3f5abb8717815f2a1a2ad3d335535d8a/ds4drv/uinput.py#L246-L302
def create_device(self, layout): """Creates a uinput device using the specified layout.""" events = {ecodes.EV_ABS: [], ecodes.EV_KEY: [], ecodes.EV_REL: []} # Joystick device if layout.axes or layout.buttons or layout.hats: self.joystick_dev = next_joystic...
[ "def", "create_device", "(", "self", ",", "layout", ")", ":", "events", "=", "{", "ecodes", ".", "EV_ABS", ":", "[", "]", ",", "ecodes", ".", "EV_KEY", ":", "[", "]", ",", "ecodes", ".", "EV_REL", ":", "[", "]", "}", "# Joystick device", "if", "lay...
Creates a uinput device using the specified layout.
[ "Creates", "a", "uinput", "device", "using", "the", "specified", "layout", "." ]
python
train
40.912281
gpennington/PyMarvel
marvel/marvel.py
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L280-L299
def get_series(self, *args, **kwargs): """Fetches lists of events. get /v1/public/events :returns: SeriesDataWrapper >>> #Find all the series that involved Wolverine >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> respo...
[ "def", "get_series", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Series", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches lists of events. get /v1/public/events :returns: SeriesDataWrapper >>> #Find all the series that involved Wolverine >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> response = m.get_series(characters="1009718") >...
[ "Fetches", "lists", "of", "events", "." ]
python
train
32.25
Unity-Technologies/ml-agents
ml-agents/mlagents/trainers/trainer_controller.py
https://github.com/Unity-Technologies/ml-agents/blob/37d139af636e4a2351751fbf0f2fca5a9ed7457f/ml-agents/mlagents/trainers/trainer_controller.py#L183-L193
def _reset_env(self, env: BaseUnityEnvironment): """Resets the environment. Returns: A Data structure corresponding to the initial reset state of the environment. """ if self.meta_curriculum is not None: return env.reset(train_mode=self.fast_simulatio...
[ "def", "_reset_env", "(", "self", ",", "env", ":", "BaseUnityEnvironment", ")", ":", "if", "self", ".", "meta_curriculum", "is", "not", "None", ":", "return", "env", ".", "reset", "(", "train_mode", "=", "self", ".", "fast_simulation", ",", "config", "=", ...
Resets the environment. Returns: A Data structure corresponding to the initial reset state of the environment.
[ "Resets", "the", "environment", "." ]
python
train
39.090909
mozillazg/baidu-pcs-python-sdk
baidupcs/api.py
https://github.com/mozillazg/baidu-pcs-python-sdk/blob/12fe3f13b2ecda8f8bdcc5334c876e934776a5cc/baidupcs/api.py#L841-L856
def cancel_download_task(self, task_id, expires=None, **kwargs): """取消离线下载任务. :param task_id: 要取消的任务ID号。 :type task_id: str :param expires: 请求失效时间,如果有,则会校验。 :type expires: int :return: Response 对象 """ data = { 'expires': expires, ...
[ "def", "cancel_download_task", "(", "self", ",", "task_id", ",", "expires", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'expires'", ":", "expires", ",", "'task_id'", ":", "task_id", ",", "}", "return", "self", ".", "_request", "(...
取消离线下载任务. :param task_id: 要取消的任务ID号。 :type task_id: str :param expires: 请求失效时间,如果有,则会校验。 :type expires: int :return: Response 对象
[ "取消离线下载任务", "." ]
python
train
28.0625
abilian/abilian-core
abilian/services/security/service.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/services/security/service.py#L534-L576
def ungrant_role(self, principal, role, object=None): """Ungrant `role` to `user` (either globally, if `object` is None, or on the specific `object`).""" assert principal principal = unwrap(principal) session = object_session(object) if object is not None else db.session ...
[ "def", "ungrant_role", "(", "self", ",", "principal", ",", "role", ",", "object", "=", "None", ")", ":", "assert", "principal", "principal", "=", "unwrap", "(", "principal", ")", "session", "=", "object_session", "(", "object", ")", "if", "object", "is", ...
Ungrant `role` to `user` (either globally, if `object` is None, or on the specific `object`).
[ "Ungrant", "role", "to", "user", "(", "either", "globally", "if", "object", "is", "None", "or", "on", "the", "specific", "object", ")", "." ]
python
train
34.976744
phoemur/wgetter
wgetter.py
https://github.com/phoemur/wgetter/blob/ac182a72480e150e4a800fbade4fbccc29e72b51/wgetter.py#L133-L138
def filename_from_url(url): """:return: detected filename or None""" fname = os.path.basename(urlparse.urlparse(url).path) if len(fname.strip(" \n\t.")) == 0: return None return fname
[ "def", "filename_from_url", "(", "url", ")", ":", "fname", "=", "os", ".", "path", ".", "basename", "(", "urlparse", ".", "urlparse", "(", "url", ")", ".", "path", ")", "if", "len", "(", "fname", ".", "strip", "(", "\" \\n\\t.\"", ")", ")", "==", "...
:return: detected filename or None
[ ":", "return", ":", "detected", "filename", "or", "None" ]
python
train
33.666667
bitcraze/crazyflie-lib-python
cflib/crazyflie/log.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/log.py#L490-L582
def _new_packet_cb(self, packet): """Callback for newly arrived packets with TOC information""" chan = packet.channel cmd = packet.data[0] payload = packet.data[1:] if (chan == CHAN_SETTINGS): id = payload[0] error_status = payload[1] block = ...
[ "def", "_new_packet_cb", "(", "self", ",", "packet", ")", ":", "chan", "=", "packet", ".", "channel", "cmd", "=", "packet", ".", "data", "[", "0", "]", "payload", "=", "packet", ".", "data", "[", "1", ":", "]", "if", "(", "chan", "==", "CHAN_SETTIN...
Callback for newly arrived packets with TOC information
[ "Callback", "for", "newly", "arrived", "packets", "with", "TOC", "information" ]
python
train
45.88172
saltstack/salt
salt/utils/jid.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jid.py#L17-L39
def gen_jid(opts=None): ''' Generate a jid ''' if opts is None: salt.utils.versions.warn_until( 'Sodium', 'The `opts` argument was not passed into salt.utils.jid.gen_jid(). ' 'This will be required starting in {version}.' ) opts = {} global...
[ "def", "gen_jid", "(", "opts", "=", "None", ")", ":", "if", "opts", "is", "None", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Sodium'", ",", "'The `opts` argument was not passed into salt.utils.jid.gen_jid(). '", "'This will be required start...
Generate a jid
[ "Generate", "a", "jid" ]
python
train
34.826087
gwpy/gwpy
gwpy/types/series.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/types/series.py#L978-L1026
def inject(self, other): """Add two compatible `Series` along their shared x-axis values. Parameters ---------- other : `Series` a `Series` whose xindex intersects with `self.xindex` Returns ------- out : `Series` the sum of `self` and `o...
[ "def", "inject", "(", "self", ",", "other", ")", ":", "# check Series compatibility", "self", ".", "is_compatible", "(", "other", ")", "if", "(", "self", ".", "xunit", "==", "second", ")", "and", "(", "other", ".", "xspan", "[", "0", "]", "<", "self", ...
Add two compatible `Series` along their shared x-axis values. Parameters ---------- other : `Series` a `Series` whose xindex intersects with `self.xindex` Returns ------- out : `Series` the sum of `self` and `other` along their shared x-axis valu...
[ "Add", "two", "compatible", "Series", "along", "their", "shared", "x", "-", "axis", "values", "." ]
python
train
38.612245
edeposit/edeposit.amqp.ltp
src/edeposit/amqp/ltp/settings.py
https://github.com/edeposit/edeposit.amqp.ltp/blob/df9ac7ec6cbdbeaaeed438ca66df75ea967b6d8e/src/edeposit/amqp/ltp/settings.py#L92-L111
def _read_from_paths(): """ Try to read data from configuration paths ($HOME/_SETTINGS_PATH, /etc/_SETTINGS_PATH). """ home = os.environ.get("HOME", "/") home_path = os.path.join(home, _SETTINGS_PATH) etc_path = os.path.join("/etc", _SETTINGS_PATH) read_path = None if home and os.pa...
[ "def", "_read_from_paths", "(", ")", ":", "home", "=", "os", ".", "environ", ".", "get", "(", "\"HOME\"", ",", "\"/\"", ")", "home_path", "=", "os", ".", "path", ".", "join", "(", "home", ",", "_SETTINGS_PATH", ")", "etc_path", "=", "os", ".", "path"...
Try to read data from configuration paths ($HOME/_SETTINGS_PATH, /etc/_SETTINGS_PATH).
[ "Try", "to", "read", "data", "from", "configuration", "paths", "(", "$HOME", "/", "_SETTINGS_PATH", "/", "etc", "/", "_SETTINGS_PATH", ")", "." ]
python
train
27.7
sigvaldm/frmt
frmt.py
https://github.com/sigvaldm/frmt/blob/d077af06c83a7a0533ca2218be55ce086df274b7/frmt.py#L73-L111
def format_time_small(seconds): """ Same as format_time() but always uses SI-prefix and 3 significant figures. """ if not isinstance(seconds, (int, float)): return str(seconds) if math.isnan(seconds): return "-" if abs(seconds)<1: milliseconds = 1000*seconds if...
[ "def", "format_time_small", "(", "seconds", ")", ":", "if", "not", "isinstance", "(", "seconds", ",", "(", "int", ",", "float", ")", ")", ":", "return", "str", "(", "seconds", ")", "if", "math", ".", "isnan", "(", "seconds", ")", ":", "return", "\"-\...
Same as format_time() but always uses SI-prefix and 3 significant figures.
[ "Same", "as", "format_time", "()", "but", "always", "uses", "SI", "-", "prefix", "and", "3", "significant", "figures", "." ]
python
train
32.666667
rosenbrockc/fortpy
fortpy/isense/context.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L144-L149
def symbol(self): """Gets the symbol under the current cursor.""" if self._symbol is None: self._symbol = self._symbol_extract(cache.RE_CURSOR) return self._symbol
[ "def", "symbol", "(", "self", ")", ":", "if", "self", ".", "_symbol", "is", "None", ":", "self", ".", "_symbol", "=", "self", ".", "_symbol_extract", "(", "cache", ".", "RE_CURSOR", ")", "return", "self", ".", "_symbol" ]
Gets the symbol under the current cursor.
[ "Gets", "the", "symbol", "under", "the", "current", "cursor", "." ]
python
train
34.5
DinoTools/python-overpy
overpy/__init__.py
https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1008-L1061
def from_xml(cls, child, result=None): """ Create new way element from XML data :param child: XML node to be parsed :type child: xml.etree.ElementTree.Element :param result: The result this node belongs to :type result: overpy.Result :return: New Way oject ...
[ "def", "from_xml", "(", "cls", ",", "child", ",", "result", "=", "None", ")", ":", "if", "child", ".", "tag", ".", "lower", "(", ")", "!=", "cls", ".", "_type_value", ":", "raise", "exception", ".", "ElementDataWrongType", "(", "type_expected", "=", "c...
Create new way element from XML data :param child: XML node to be parsed :type child: xml.etree.ElementTree.Element :param result: The result this node belongs to :type result: overpy.Result :return: New Way oject :rtype: overpy.Way :raises overpy.exception.Eleme...
[ "Create", "new", "way", "element", "from", "XML", "data" ]
python
train
37.425926
juju/python-libjuju
juju/controller.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/controller.py#L601-L616
async def grant_model(self, username, model_uuid, acl='read'): """Grant a user access to a model. Note that if the user already has higher permissions than the provided ACL, this will do nothing (see revoke_model for a way to remove permissions). :param str username: Username ...
[ "async", "def", "grant_model", "(", "self", ",", "username", ",", "model_uuid", ",", "acl", "=", "'read'", ")", ":", "model_facade", "=", "client", ".", "ModelManagerFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "user", "=...
Grant a user access to a model. Note that if the user already has higher permissions than the provided ACL, this will do nothing (see revoke_model for a way to remove permissions). :param str username: Username :param str model_uuid: The UUID of the model to change. :par...
[ "Grant", "a", "user", "access", "to", "a", "model", ".", "Note", "that", "if", "the", "user", "already", "has", "higher", "permissions", "than", "the", "provided", "ACL", "this", "will", "do", "nothing", "(", "see", "revoke_model", "for", "a", "way", "to...
python
train
46.6875
dbcli/athenacli
athenacli/packages/parseutils.py
https://github.com/dbcli/athenacli/blob/bcab59e4953145866430083e902ed4d042d4ebba/athenacli/packages/parseutils.py#L109-L134
def extract_table_identifiers(token_stream): """yields tuples of (schema_name, table_name, table_alias)""" for item in token_stream: if isinstance(item, IdentifierList): for identifier in item.get_identifiers(): # Sometimes Keywords (such as FROM ) are classified as ...
[ "def", "extract_table_identifiers", "(", "token_stream", ")", ":", "for", "item", "in", "token_stream", ":", "if", "isinstance", "(", "item", ",", "IdentifierList", ")", ":", "for", "identifier", "in", "item", ".", "get_identifiers", "(", ")", ":", "# Sometime...
yields tuples of (schema_name, table_name, table_alias)
[ "yields", "tuples", "of", "(", "schema_name", "table_name", "table_alias", ")" ]
python
train
43.230769
Parsl/parsl
parsl/executors/ipp.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/ipp.py#L229-L252
def scale_out(self, blocks=1): """Scales out the number of active workers by 1. This method is notImplemented for threads and will raise the error if called. Parameters: blocks : int Number of blocks to be provisioned. """ r = [] for i in rang...
[ "def", "scale_out", "(", "self", ",", "blocks", "=", "1", ")", ":", "r", "=", "[", "]", "for", "i", "in", "range", "(", "blocks", ")", ":", "if", "self", ".", "provider", ":", "block", "=", "self", ".", "provider", ".", "submit", "(", "self", "...
Scales out the number of active workers by 1. This method is notImplemented for threads and will raise the error if called. Parameters: blocks : int Number of blocks to be provisioned.
[ "Scales", "out", "the", "number", "of", "active", "workers", "by", "1", "." ]
python
valid
36.416667
Qiskit/qiskit-terra
qiskit/visualization/text.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/text.py#L647-L697
def merge_lines(top, bot, icod="top"): """ Merges two lines (top and bot) in the way that the overlapping make senses. Args: top (str): the top line bot (str): the bottom line icod (top or bot): in case of doubt, which line should have priority? Default: "top"...
[ "def", "merge_lines", "(", "top", ",", "bot", ",", "icod", "=", "\"top\"", ")", ":", "ret", "=", "\"\"", "for", "topc", ",", "botc", "in", "zip", "(", "top", ",", "bot", ")", ":", "if", "topc", "==", "botc", ":", "ret", "+=", "topc", "elif", "t...
Merges two lines (top and bot) in the way that the overlapping make senses. Args: top (str): the top line bot (str): the bottom line icod (top or bot): in case of doubt, which line should have priority? Default: "top". Returns: str: The merge of both lines...
[ "Merges", "two", "lines", "(", "top", "and", "bot", ")", "in", "the", "way", "that", "the", "overlapping", "make", "senses", ".", "Args", ":", "top", "(", "str", ")", ":", "the", "top", "line", "bot", "(", "str", ")", ":", "the", "bottom", "line", ...
python
test
37.196078
PyCQA/prospector
prospector/tools/pylint/__init__.py
https://github.com/PyCQA/prospector/blob/7cfc6d587049a786f935a722d6851cd3b72d7972/prospector/tools/pylint/__init__.py#L212-L239
def _combine_w0614(self, messages): """ For the "unused import from wildcard import" messages, we want to combine all warnings about the same line into a single message. """ by_loc = defaultdict(list) out = [] for message in messages: if messa...
[ "def", "_combine_w0614", "(", "self", ",", "messages", ")", ":", "by_loc", "=", "defaultdict", "(", "list", ")", "out", "=", "[", "]", "for", "message", "in", "messages", ":", "if", "message", ".", "code", "==", "'unused-wildcard-import'", ":", "by_loc", ...
For the "unused import from wildcard import" messages, we want to combine all warnings about the same line into a single message.
[ "For", "the", "unused", "import", "from", "wildcard", "import", "messages", "we", "want", "to", "combine", "all", "warnings", "about", "the", "same", "line", "into", "a", "single", "message", "." ]
python
train
34.071429
dslackw/slpkg
slpkg/__metadata__.py
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/__metadata__.py#L28-L36
def remove_repositories(repositories, default_repositories): """ Remove no default repositories """ repos = [] for repo in repositories: if repo in default_repositories: repos.append(repo) return repos
[ "def", "remove_repositories", "(", "repositories", ",", "default_repositories", ")", ":", "repos", "=", "[", "]", "for", "repo", "in", "repositories", ":", "if", "repo", "in", "default_repositories", ":", "repos", ".", "append", "(", "repo", ")", "return", "...
Remove no default repositories
[ "Remove", "no", "default", "repositories" ]
python
train
26.333333
T-002/pycast
pycast/common/matrix.py
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/common/matrix.py#L445-L453
def matrix_multiplication_blockwise(self, matrix, blocksize): """ http://en.wikipedia.org/wiki/Block_matrix#Block_matrix_multiplication """ #Create the blockwise version of self and matrix selfBlockwise = self.matrix_to_blockmatrix(blocksize) matrixBlockwise = matrix.matr...
[ "def", "matrix_multiplication_blockwise", "(", "self", ",", "matrix", ",", "blocksize", ")", ":", "#Create the blockwise version of self and matrix", "selfBlockwise", "=", "self", ".", "matrix_to_blockmatrix", "(", "blocksize", ")", "matrixBlockwise", "=", "matrix", ".", ...
http://en.wikipedia.org/wiki/Block_matrix#Block_matrix_multiplication
[ "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Block_matrix#Block_matrix_multiplication" ]
python
train
44.444444
RRZE-HPC/kerncraft
kerncraft/models/ecm.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/models/ecm.py#L167-L173
def analyze(self): """Run complete anaylysis and return results.""" self.calculate_cache_access() self.calculate_cycles() self.results['flops per iteration'] = sum(self.kernel._flops.values()) return self.results
[ "def", "analyze", "(", "self", ")", ":", "self", ".", "calculate_cache_access", "(", ")", "self", ".", "calculate_cycles", "(", ")", "self", ".", "results", "[", "'flops per iteration'", "]", "=", "sum", "(", "self", ".", "kernel", ".", "_flops", ".", "v...
Run complete anaylysis and return results.
[ "Run", "complete", "anaylysis", "and", "return", "results", "." ]
python
test
35.285714
ska-sa/montblanc
montblanc/util/__init__.py
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/__init__.py#L96-L113
def random_like(ary=None, shape=None, dtype=None): """ Returns a random array of the same shape and type as the supplied array argument, or the supplied shape and dtype """ if ary is not None: shape, dtype = ary.shape, ary.dtype elif shape is None or dtype is None: raise ValueErr...
[ "def", "random_like", "(", "ary", "=", "None", ",", "shape", "=", "None", ",", "dtype", "=", "None", ")", ":", "if", "ary", "is", "not", "None", ":", "shape", ",", "dtype", "=", "ary", ".", "shape", ",", "ary", ".", "dtype", "elif", "shape", "is"...
Returns a random array of the same shape and type as the supplied array argument, or the supplied shape and dtype
[ "Returns", "a", "random", "array", "of", "the", "same", "shape", "and", "type", "as", "the", "supplied", "array", "argument", "or", "the", "supplied", "shape", "and", "dtype" ]
python
train
39.444444
Erotemic/utool
utool/util_inspect.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1261-L1269
def dummy_func(arg1, arg2, arg3=None, arg4=[1, 2, 3], arg5={}, **kwargs): """ test func for kwargs parseing """ foo = kwargs.get('foo', None) bar = kwargs.pop('bar', 4) foo2 = kwargs['foo2'] foobar = str(foo) + str(bar) + str(foo2) return foobar
[ "def", "dummy_func", "(", "arg1", ",", "arg2", ",", "arg3", "=", "None", ",", "arg4", "=", "[", "1", ",", "2", ",", "3", "]", ",", "arg5", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "foo", "=", "kwargs", ".", "get", "(", "'foo'", ","...
test func for kwargs parseing
[ "test", "func", "for", "kwargs", "parseing" ]
python
train
29.888889
mitsei/dlkit
dlkit/json_/authorization/queries.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/queries.py#L300-L310
def match_function_id(self, function_id, match): """Matches the function identified by the given ``Id``. arg: function_id (osid.id.Id): the Id of the ``Function`` arg: match (boolean): ``true`` if a positive match, ``false`` for a negative match raise: NullArgumen...
[ "def", "match_function_id", "(", "self", ",", "function_id", ",", "match", ")", ":", "self", ".", "_add_match", "(", "'functionId'", ",", "str", "(", "function_id", ")", ",", "bool", "(", "match", ")", ")" ]
Matches the function identified by the given ``Id``. arg: function_id (osid.id.Id): the Id of the ``Function`` arg: match (boolean): ``true`` if a positive match, ``false`` for a negative match raise: NullArgument - ``function_id`` is ``null`` *compliance: mandato...
[ "Matches", "the", "function", "identified", "by", "the", "given", "Id", "." ]
python
train
44.636364
pybel/pybel
src/pybel/struct/filters/edge_predicate_builders.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/struct/filters/edge_predicate_builders.py#L83-L98
def build_annotation_dict_any_filter(annotations: Mapping[str, Iterable[str]]) -> EdgePredicate: """Build an edge predicate that passes for edges whose data dictionaries match the given dictionary. If the given dictionary is empty, will always evaluate to true. :param annotations: The annotation query dic...
[ "def", "build_annotation_dict_any_filter", "(", "annotations", ":", "Mapping", "[", "str", ",", "Iterable", "[", "str", "]", "]", ")", "->", "EdgePredicate", ":", "if", "not", "annotations", ":", "return", "keep_edge_permissive", "@", "edge_predicate", "def", "a...
Build an edge predicate that passes for edges whose data dictionaries match the given dictionary. If the given dictionary is empty, will always evaluate to true. :param annotations: The annotation query dict to match
[ "Build", "an", "edge", "predicate", "that", "passes", "for", "edges", "whose", "data", "dictionaries", "match", "the", "given", "dictionary", "." ]
python
train
41.25
sods/paramz
paramz/parameterized.py
https://github.com/sods/paramz/blob/ae6fc6274b70fb723d91e48fc5026a9bc5a06508/paramz/parameterized.py#L195-L226
def unlink_parameter(self, param): """ :param param: param object to remove from being a parameter of this parameterized object. """ if not param in self.parameters: try: raise HierarchyError("{} does not belong to this object {}, remove parameters directly fr...
[ "def", "unlink_parameter", "(", "self", ",", "param", ")", ":", "if", "not", "param", "in", "self", ".", "parameters", ":", "try", ":", "raise", "HierarchyError", "(", "\"{} does not belong to this object {}, remove parameters directly from their respective parents\"", "....
:param param: param object to remove from being a parameter of this parameterized object.
[ ":", "param", "param", ":", "param", "object", "to", "remove", "from", "being", "a", "parameter", "of", "this", "parameterized", "object", "." ]
python
train
41.375
keflavich/plfit
plfit/plfit.py
https://github.com/keflavich/plfit/blob/7dafa6302b427ba8c89651148e3e9d29add436c3/plfit/plfit.py#L53-L79
def alpha_gen(x): """ Create a mappable function alpha to apply to each xmin in a list of xmins. This is essentially the slow version of fplfit/cplfit, though I bet it could be speeded up with a clever use of parellel_map. Not intended to be used by users. Docstring for the generated alpha function:: ...
[ "def", "alpha_gen", "(", "x", ")", ":", "def", "alpha_", "(", "xmin", ",", "x", "=", "x", ")", ":", "\"\"\"\n Given a sorted data set and a minimum, returns power law MLE fit\n data is passed as a keyword parameter so that it can be vectorized\n\n If there is onl...
Create a mappable function alpha to apply to each xmin in a list of xmins. This is essentially the slow version of fplfit/cplfit, though I bet it could be speeded up with a clever use of parellel_map. Not intended to be used by users. Docstring for the generated alpha function:: Given a sorted da...
[ "Create", "a", "mappable", "function", "alpha", "to", "apply", "to", "each", "xmin", "in", "a", "list", "of", "xmins", ".", "This", "is", "essentially", "the", "slow", "version", "of", "fplfit", "/", "cplfit", "though", "I", "bet", "it", "could", "be", ...
python
test
35.481481
Qiskit/qiskit-terra
qiskit/tools/qcvv/tomography.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L644-L684
def marginal_counts(counts, meas_qubits): """ Compute the marginal counts for a subset of measured qubits. Args: counts (dict): the counts returned from a backend ({str: int}). meas_qubits (list[int]): the qubits to return the marginal counts distribution fo...
[ "def", "marginal_counts", "(", "counts", ",", "meas_qubits", ")", ":", "# pylint: disable=cell-var-from-loop", "# Extract total number of qubits from count keys", "num_of_qubits", "=", "len", "(", "list", "(", "counts", ".", "keys", "(", ")", ")", "[", "0", "]", ")"...
Compute the marginal counts for a subset of measured qubits. Args: counts (dict): the counts returned from a backend ({str: int}). meas_qubits (list[int]): the qubits to return the marginal counts distribution for. Returns: dict: A counts dict for the m...
[ "Compute", "the", "marginal", "counts", "for", "a", "subset", "of", "measured", "qubits", "." ]
python
test
32.609756
mongodb/mongo-python-driver
pymongo/collection.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/collection.py#L2222-L2258
def options(self, session=None): """Get the options set on this collection. Returns a dictionary of options and their values - see :meth:`~pymongo.database.Database.create_collection` for more information on the possible options. Returns an empty dictionary if the collection has...
[ "def", "options", "(", "self", ",", "session", "=", "None", ")", ":", "dbo", "=", "self", ".", "__database", ".", "client", ".", "get_database", "(", "self", ".", "__database", ".", "name", ",", "self", ".", "codec_options", ",", "self", ".", "read_pre...
Get the options set on this collection. Returns a dictionary of options and their values - see :meth:`~pymongo.database.Database.create_collection` for more information on the possible options. Returns an empty dictionary if the collection has not been created yet. :Parameters:...
[ "Get", "the", "options", "set", "on", "this", "collection", "." ]
python
train
29.594595
funilrys/PyFunceble
PyFunceble/helpers.py
https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1005-L1047
def match(self): """ Used to get exploitable result of re.search :return: The data of the match status. :rtype: mixed """ # We initate this variable which gonna contain the returned data result = [] # We compile the regex string to_match = comp(...
[ "def", "match", "(", "self", ")", ":", "# We initate this variable which gonna contain the returned data", "result", "=", "[", "]", "# We compile the regex string", "to_match", "=", "comp", "(", "self", ".", "regex", ")", "# In case we have to use the implementation of ${BASH...
Used to get exploitable result of re.search :return: The data of the match status. :rtype: mixed
[ "Used", "to", "get", "exploitable", "result", "of", "re", ".", "search" ]
python
test
31.860465
carljm/django-adminfiles
adminfiles/flickr.py
https://github.com/carljm/django-adminfiles/blob/b01dc7be266305d575c11d5ff9a37ccac04a78c2/adminfiles/flickr.py#L359-L373
def editMeta(self, title=None, description=None): """Set metadata for photo. (flickr.photos.setMeta)""" method = 'flickr.photosets.editMeta' if title is None: title = self.title if description is None: description = self.description _dopost(m...
[ "def", "editMeta", "(", "self", ",", "title", "=", "None", ",", "description", "=", "None", ")", ":", "method", "=", "'flickr.photosets.editMeta'", "if", "title", "is", "None", ":", "title", "=", "self", ".", "title", "if", "description", "is", "None", "...
Set metadata for photo. (flickr.photos.setMeta)
[ "Set", "metadata", "for", "photo", ".", "(", "flickr", ".", "photos", ".", "setMeta", ")" ]
python
train
33.2
PhracturedBlue/asterisk_mbox
asterisk_mbox/utils.py
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/utils.py#L42-L49
def get(self, block=True, timeout=None): """get.""" try: item = super().get(block, timeout) self._getsocket.recv(1) return item except queue.Empty: raise queue.Empty
[ "def", "get", "(", "self", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "try", ":", "item", "=", "super", "(", ")", ".", "get", "(", "block", ",", "timeout", ")", "self", ".", "_getsocket", ".", "recv", "(", "1", ")", "retu...
get.
[ "get", "." ]
python
train
28.75
rpcope1/PythonConfluenceAPI
PythonConfluenceAPI/api.py
https://github.com/rpcope1/PythonConfluenceAPI/blob/b7f0ca2a390f964715fdf3a60b5b0c5ef7116d40/PythonConfluenceAPI/api.py#L650-L664
def get_long_task_info(self, long_task_id, expand=None, callback=None): """ Returns information about a long-running task. :param long_task_id (string): The key of the task to be returned. :param expand (string): A comma separated list of properties to expand on the task. Default: Empty ...
[ "def", "get_long_task_info", "(", "self", ",", "long_task_id", ",", "expand", "=", "None", ",", "callback", "=", "None", ")", ":", "params", "=", "{", "}", "if", "expand", ":", "params", "[", "\"expand\"", "]", "=", "expand", "return", "self", ".", "_s...
Returns information about a long-running task. :param long_task_id (string): The key of the task to be returned. :param expand (string): A comma separated list of properties to expand on the task. Default: Empty :param callback: OPTIONAL: The callback to execute on the resulting data, before the...
[ "Returns", "information", "about", "a", "long", "-", "running", "task", ".", ":", "param", "long_task_id", "(", "string", ")", ":", "The", "key", "of", "the", "task", "to", "be", "returned", ".", ":", "param", "expand", "(", "string", ")", ":", "A", ...
python
train
61.4
simpleenergy/env-excavator
excavator/utils.py
https://github.com/simpleenergy/env-excavator/blob/2bce66396f0c92fefa2b39ea458965174e478faf/excavator/utils.py#L128-L148
def env_string(name, required=False, default=empty): """Pulls an environment variable out of the environment returning it as a string. If not present in the environment and no default is specified, an empty string is returned. :param name: The name of the environment variable be pulled :type name: ...
[ "def", "env_string", "(", "name", ",", "required", "=", "False", ",", "default", "=", "empty", ")", ":", "value", "=", "get_env_value", "(", "name", ",", "default", "=", "default", ",", "required", "=", "required", ")", "if", "value", "is", "empty", ":...
Pulls an environment variable out of the environment returning it as a string. If not present in the environment and no default is specified, an empty string is returned. :param name: The name of the environment variable be pulled :type name: str :param required: Whether the environment variable i...
[ "Pulls", "an", "environment", "variable", "out", "of", "the", "environment", "returning", "it", "as", "a", "string", ".", "If", "not", "present", "in", "the", "environment", "and", "no", "default", "is", "specified", "an", "empty", "string", "is", "returned"...
python
train
38.52381
wavefrontHQ/python-client
wavefront_api_client/models/notificant.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/notificant.py#L338-L355
def method(self, method): """Sets the method of this Notificant. The notification method used for notification target. # noqa: E501 :param method: The method of this Notificant. # noqa: E501 :type: str """ if method is None: raise ValueError("Invalid value...
[ "def", "method", "(", "self", ",", "method", ")", ":", "if", "method", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid value for `method`, must not be `None`\"", ")", "# noqa: E501", "allowed_values", "=", "[", "\"WEBHOOK\"", ",", "\"EMAIL\"", ",", "\"PA...
Sets the method of this Notificant. The notification method used for notification target. # noqa: E501 :param method: The method of this Notificant. # noqa: E501 :type: str
[ "Sets", "the", "method", "of", "this", "Notificant", "." ]
python
train
37.444444
adamheins/r12
r12/shell.py
https://github.com/adamheins/r12/blob/ff78178332140930bf46a94a0b15ee082bb92491/r12/shell.py#L53-L55
def warn(self, cmd, desc=''): ''' Style for warning message. ''' return self._label_desc(cmd, desc, self.warn_color)
[ "def", "warn", "(", "self", ",", "cmd", ",", "desc", "=", "''", ")", ":", "return", "self", ".", "_label_desc", "(", "cmd", ",", "desc", ",", "self", ".", "warn_color", ")" ]
Style for warning message.
[ "Style", "for", "warning", "message", "." ]
python
train
43.333333
shidenggui/easytrader
easytrader/follower.py
https://github.com/shidenggui/easytrader/blob/e5ae4daeda4ea125763a95b280dd694c7f68257d/easytrader/follower.py#L250-L343
def _execute_trade_cmd( self, trade_cmd, users, expire_seconds, entrust_prop, send_interval ): """分发交易指令到对应的 user 并执行 :param trade_cmd: :param users: :param expire_seconds: :param entrust_prop: :param send_interval: :return: """ for use...
[ "def", "_execute_trade_cmd", "(", "self", ",", "trade_cmd", ",", "users", ",", "expire_seconds", ",", "entrust_prop", ",", "send_interval", ")", ":", "for", "user", "in", "users", ":", "# check expire", "now", "=", "datetime", ".", "datetime", ".", "now", "(...
分发交易指令到对应的 user 并执行 :param trade_cmd: :param users: :param expire_seconds: :param entrust_prop: :param send_interval: :return:
[ "分发交易指令到对应的", "user", "并执行", ":", "param", "trade_cmd", ":", ":", "param", "users", ":", ":", "param", "expire_seconds", ":", ":", "param", "entrust_prop", ":", ":", "param", "send_interval", ":", ":", "return", ":" ]
python
train
37.255319
bpsmith/tia
tia/bbg/v3api.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/bbg/v3api.py#L263-L267
def as_frame(self): """ :return: Multi-Index DataFrame """ sids, frames = self.response_map.keys(), self.response_map.values() frame = pd.concat(frames, keys=sids, axis=1) return frame
[ "def", "as_frame", "(", "self", ")", ":", "sids", ",", "frames", "=", "self", ".", "response_map", ".", "keys", "(", ")", ",", "self", ".", "response_map", ".", "values", "(", ")", "frame", "=", "pd", ".", "concat", "(", "frames", ",", "keys", "=",...
:return: Multi-Index DataFrame
[ ":", "return", ":", "Multi", "-", "Index", "DataFrame" ]
python
train
42.4
monim67/django-bootstrap-datepicker-plus
bootstrap_datepicker_plus/_base.py
https://github.com/monim67/django-bootstrap-datepicker-plus/blob/55819bf12507c98dba91c702e224afd9bae3ef9a/bootstrap_datepicker_plus/_base.py#L127-L155
def end_of(self, event_id, import_options=True): """ Set Date-Picker as the end-date of a date-range. Args: - event_id (string): User-defined unique id for linking two fields - import_options (bool): inherit options from start-date input, default: TRUE ...
[ "def", "end_of", "(", "self", ",", "event_id", ",", "import_options", "=", "True", ")", ":", "event_id", "=", "str", "(", "event_id", ")", "if", "event_id", "in", "DatePickerDictionary", ".", "items", ":", "linked_picker", "=", "DatePickerDictionary", ".", "...
Set Date-Picker as the end-date of a date-range. Args: - event_id (string): User-defined unique id for linking two fields - import_options (bool): inherit options from start-date input, default: TRUE
[ "Set", "Date", "-", "Picker", "as", "the", "end", "-", "date", "of", "a", "date", "-", "range", "." ]
python
train
47.103448
tensorflow/tensor2tensor
tensor2tensor/data_generators/subject_verb_agreement.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/subject_verb_agreement.py#L77-L111
def load_examples(tmp_dir, prop_train=0.09, prop_val=0.01): """Loads exampls from the tsv file. Args: tmp_dir: temp directory. prop_train: proportion of the train data prop_val: proportion of the validation data Returns: All examples in the dataset pluse train, test, and development splits. "...
[ "def", "load_examples", "(", "tmp_dir", ",", "prop_train", "=", "0.09", ",", "prop_val", "=", "0.01", ")", ":", "infile", "=", "generator_utils", ".", "maybe_download", "(", "tmp_dir", ",", "_TAR", ",", "_URL", ")", "tf", ".", "logging", ".", "info", "("...
Loads exampls from the tsv file. Args: tmp_dir: temp directory. prop_train: proportion of the train data prop_val: proportion of the validation data Returns: All examples in the dataset pluse train, test, and development splits.
[ "Loads", "exampls", "from", "the", "tsv", "file", "." ]
python
train
29.914286
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAFetch/QAQuery.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L99-L143
def QA_fetch_stock_min(code, start, end, format='numpy', frequence='1min', collections=DATABASE.stock_min): '获取股票分钟线' if frequence in ['1min', '1m']: frequence = '1min' elif frequence in ['5min', '5m']: frequence = '5min' elif frequence in ['15min', '15m']: frequence = '15min' ...
[ "def", "QA_fetch_stock_min", "(", "code", ",", "start", ",", "end", ",", "format", "=", "'numpy'", ",", "frequence", "=", "'1min'", ",", "collections", "=", "DATABASE", ".", "stock_min", ")", ":", "if", "frequence", "in", "[", "'1min'", ",", "'1m'", "]",...
获取股票分钟线
[ "获取股票分钟线" ]
python
train
36.888889
mwouts/jupytext
jupytext/header.py
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/header.py#L51-L70
def encoding_and_executable(notebook, metadata, ext): """Return encoding and executable lines for a notebook, if applicable""" lines = [] comment = _SCRIPT_EXTENSIONS.get(ext, {}).get('comment') jupytext_metadata = metadata.get('jupytext', {}) if ext not in ['.Rmd', '.md'] and 'executable' in jupyt...
[ "def", "encoding_and_executable", "(", "notebook", ",", "metadata", ",", "ext", ")", ":", "lines", "=", "[", "]", "comment", "=", "_SCRIPT_EXTENSIONS", ".", "get", "(", "ext", ",", "{", "}", ")", ".", "get", "(", "'comment'", ")", "jupytext_metadata", "=...
Return encoding and executable lines for a notebook, if applicable
[ "Return", "encoding", "and", "executable", "lines", "for", "a", "notebook", "if", "applicable" ]
python
train
38.65
dw/mitogen
ansible_mitogen/runner.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/ansible_mitogen/runner.py#L222-L228
def utf8(s): """ Coerce an object to bytes if it is Unicode. """ if isinstance(s, mitogen.core.UnicodeType): s = s.encode('utf-8') return s
[ "def", "utf8", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "mitogen", ".", "core", ".", "UnicodeType", ")", ":", "s", "=", "s", ".", "encode", "(", "'utf-8'", ")", "return", "s" ]
Coerce an object to bytes if it is Unicode.
[ "Coerce", "an", "object", "to", "bytes", "if", "it", "is", "Unicode", "." ]
python
train
23
rodluger/everest
everest/user.py
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/user.py#L1298-L1317
def _save_npz(self): ''' Saves all of the de-trending information to disk in an `npz` file ''' # Save the data d = dict(self.__dict__) d.pop('_weights', None) d.pop('_A', None) d.pop('_B', None) d.pop('_f', None) d.pop('_mK', None) ...
[ "def", "_save_npz", "(", "self", ")", ":", "# Save the data", "d", "=", "dict", "(", "self", ".", "__dict__", ")", "d", ".", "pop", "(", "'_weights'", ",", "None", ")", "d", ".", "pop", "(", "'_A'", ",", "None", ")", "d", ".", "pop", "(", "'_B'",...
Saves all of the de-trending information to disk in an `npz` file
[ "Saves", "all", "of", "the", "de", "-", "trending", "information", "to", "disk", "in", "an", "npz", "file" ]
python
train
26.95
suds-community/suds
tools/setup_base_environments.py
https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/tools/setup_base_environments.py#L778-L821
def download_pip_based_installations(env, pip_invocation, requirements, download_cache_folder): """Download requirements for pip based installation.""" if config.installation_cache_folder() is None: raise EnvironmentSetupError("Local installation cache folder not " "defined but ...
[ "def", "download_pip_based_installations", "(", "env", ",", "pip_invocation", ",", "requirements", ",", "download_cache_folder", ")", ":", "if", "config", ".", "installation_cache_folder", "(", ")", "is", "None", ":", "raise", "EnvironmentSetupError", "(", "\"Local in...
Download requirements for pip based installation.
[ "Download", "requirements", "for", "pip", "based", "installation", "." ]
python
train
61
clearclaw/logtool
logtool/logtime.py
https://github.com/clearclaw/logtool/blob/e34c9a580538a9a14fec9b4bbab8b8df92ad36e7/logtool/logtime.py#L23-L33
def now (time_t = None, slug = False): '''Gives current time as tuple (t, t_str) where t is integer portion from time.time() t_str string of t using DEFAULT_TIMEFORMAT ''' if not time_t: time_t = time () time_s = strftime ( DEFAULT_SLUGFORMAT if slug else DEFAULT_TIMEFORMAT, gmtime (time_t...
[ "def", "now", "(", "time_t", "=", "None", ",", "slug", "=", "False", ")", ":", "if", "not", "time_t", ":", "time_t", "=", "time", "(", ")", "time_s", "=", "strftime", "(", "DEFAULT_SLUGFORMAT", "if", "slug", "else", "DEFAULT_TIMEFORMAT", ",", "gmtime", ...
Gives current time as tuple (t, t_str) where t is integer portion from time.time() t_str string of t using DEFAULT_TIMEFORMAT
[ "Gives", "current", "time", "as", "tuple", "(", "t", "t_str", ")", "where", "t", "is", "integer", "portion", "from", "time", ".", "time", "()", "t_str", "string", "of", "t", "using", "DEFAULT_TIMEFORMAT" ]
python
train
31.272727
nimbis/cmsplugin-newsplus
cmsplugin_newsplus/admin.py
https://github.com/nimbis/cmsplugin-newsplus/blob/1787fb674faa7800845f18ce782154e290f6be27/cmsplugin_newsplus/admin.py#L38-L46
def make_published(self, request, queryset): """ Marks selected news items as published """ rows_updated = queryset.update(is_published=True) self.message_user(request, ungettext('%(count)d newsitem was published', ...
[ "def", "make_published", "(", "self", ",", "request", ",", "queryset", ")", ":", "rows_updated", "=", "queryset", ".", "update", "(", "is_published", "=", "True", ")", "self", ".", "message_user", "(", "request", ",", "ungettext", "(", "'%(count)d newsitem was...
Marks selected news items as published
[ "Marks", "selected", "news", "items", "as", "published" ]
python
train
47.444444
20c/xbahn
xbahn/connection/__init__.py
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L329-L336
def connect(url, prefix=None, **kwargs): """ connect and return a connection instance from url arguments: - url (str): xbahn connection url """ return connection(url, prefix=get_prefix(prefix), **kwargs)
[ "def", "connect", "(", "url", ",", "prefix", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "connection", "(", "url", ",", "prefix", "=", "get_prefix", "(", "prefix", ")", ",", "*", "*", "kwargs", ")" ]
connect and return a connection instance from url arguments: - url (str): xbahn connection url
[ "connect", "and", "return", "a", "connection", "instance", "from", "url" ]
python
train
28.125
openstack/networking-cisco
networking_cisco/ml2_drivers/ucsm/ucsm_db.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/ucsm_db.py#L32-L36
def get_port_profile_for_vlan(self, vlan_id, device_id): """Returns Vlan id associated with the port profile.""" entry = self.session.query(ucsm_model.PortProfile).filter_by( vlan_id=vlan_id, device_id=device_id).first() return entry.profile_id if entry else None
[ "def", "get_port_profile_for_vlan", "(", "self", ",", "vlan_id", ",", "device_id", ")", ":", "entry", "=", "self", ".", "session", ".", "query", "(", "ucsm_model", ".", "PortProfile", ")", ".", "filter_by", "(", "vlan_id", "=", "vlan_id", ",", "device_id", ...
Returns Vlan id associated with the port profile.
[ "Returns", "Vlan", "id", "associated", "with", "the", "port", "profile", "." ]
python
train
59
chaoss/grimoirelab-manuscripts
manuscripts2/report.py
https://github.com/chaoss/grimoirelab-manuscripts/blob/94a3ad4f11bfbcd6c5190e01cb5d3e47a5187cd9/manuscripts2/report.py#L134-L148
def get_metric_index(self, data_source): """ This function will return the elasticsearch index for a corresponding data source. It chooses in between the default and the user inputed es indices and returns the user inputed one if it is available. :param data_source: the data sou...
[ "def", "get_metric_index", "(", "self", ",", "data_source", ")", ":", "if", "data_source", "in", "self", ".", "index_dict", ":", "index", "=", "self", ".", "index_dict", "[", "data_source", "]", "else", ":", "index", "=", "self", ".", "class2index", "[", ...
This function will return the elasticsearch index for a corresponding data source. It chooses in between the default and the user inputed es indices and returns the user inputed one if it is available. :param data_source: the data source for which the index has to be returned :returns: ...
[ "This", "function", "will", "return", "the", "elasticsearch", "index", "for", "a", "corresponding", "data", "source", ".", "It", "chooses", "in", "between", "the", "default", "and", "the", "user", "inputed", "es", "indices", "and", "returns", "the", "user", ...
python
train
41.133333
boto/s3transfer
s3transfer/download.py
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/download.py#L91-L103
def queue_file_io_task(self, fileobj, data, offset): """Queue IO write for submission to the IO executor. This method accepts an IO executor and information about the downloaded data, and handles submitting this to the IO executor. This method may defer submission to the IO executor if...
[ "def", "queue_file_io_task", "(", "self", ",", "fileobj", ",", "data", ",", "offset", ")", ":", "self", ".", "_transfer_coordinator", ".", "submit", "(", "self", ".", "_io_executor", ",", "self", ".", "get_io_write_task", "(", "fileobj", ",", "data", ",", ...
Queue IO write for submission to the IO executor. This method accepts an IO executor and information about the downloaded data, and handles submitting this to the IO executor. This method may defer submission to the IO executor if necessary.
[ "Queue", "IO", "write", "for", "submission", "to", "the", "IO", "executor", "." ]
python
test
36.538462
ZELLMECHANIK-DRESDEN/dclab
dclab/features/bright.py
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/features/bright.py#L12-L85
def get_bright(mask, image, ret_data="avg,sd"): """Compute avg and/or std of the event brightness The event brightness is defined by the gray-scale values of the image data within the event mask area. Parameters ---------- mask: ndarray or list of ndarrays of shape (M,N) and dtype bool ...
[ "def", "get_bright", "(", "mask", ",", "image", ",", "ret_data", "=", "\"avg,sd\"", ")", ":", "# This method is based on a pull request by Maik Herbig.", "ret_avg", "=", "\"avg\"", "in", "ret_data", "ret_std", "=", "\"sd\"", "in", "ret_data", "if", "ret_avg", "+", ...
Compute avg and/or std of the event brightness The event brightness is defined by the gray-scale values of the image data within the event mask area. Parameters ---------- mask: ndarray or list of ndarrays of shape (M,N) and dtype bool The mask values, True where the event is located in `i...
[ "Compute", "avg", "and", "/", "or", "std", "of", "the", "event", "brightness" ]
python
train
28.635135
twoolie/NBT
nbt/region.py
https://github.com/twoolie/NBT/blob/b06dd6cc8117d2788da1d8416e642d58bad45762/nbt/region.py#L454-L467
def get_chunk_coords(self): """ Return the x,z coordinates and length of the chunks that are defined in te regionfile. This includes chunks which may not be readable for whatever reason. This method is deprecated. Use :meth:`get_metadata` instead. """ chunks = []...
[ "def", "get_chunk_coords", "(", "self", ")", ":", "chunks", "=", "[", "]", "for", "x", "in", "range", "(", "32", ")", ":", "for", "z", "in", "range", "(", "32", ")", ":", "m", "=", "self", ".", "metadata", "[", "x", ",", "z", "]", "if", "m", ...
Return the x,z coordinates and length of the chunks that are defined in te regionfile. This includes chunks which may not be readable for whatever reason. This method is deprecated. Use :meth:`get_metadata` instead.
[ "Return", "the", "x", "z", "coordinates", "and", "length", "of", "the", "chunks", "that", "are", "defined", "in", "te", "regionfile", ".", "This", "includes", "chunks", "which", "may", "not", "be", "readable", "for", "whatever", "reason", ".", "This", "met...
python
train
38.571429
andreikop/qutepart
qutepart/indenter/scheme.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/scheme.py#L15-L23
def _findExpressionEnd(self, block): """Find end of the last expression """ while block.isValid(): column = self._lastColumn(block) if column > 0: return block, column block = block.previous() raise UserWarning()
[ "def", "_findExpressionEnd", "(", "self", ",", "block", ")", ":", "while", "block", ".", "isValid", "(", ")", ":", "column", "=", "self", ".", "_lastColumn", "(", "block", ")", "if", "column", ">", "0", ":", "return", "block", ",", "column", "block", ...
Find end of the last expression
[ "Find", "end", "of", "the", "last", "expression" ]
python
train
32
quantmind/pulsar
pulsar/apps/wsgi/content.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/wsgi/content.py#L779-L796
def get_meta(self, name, meta_key=None): '''Get the ``content`` attribute of a meta tag ``name``. For example:: head.get_meta('decription') returns the ``content`` attribute of the meta tag with attribute ``name`` equal to ``description`` or ``None``. If a differen...
[ "def", "get_meta", "(", "self", ",", "name", ",", "meta_key", "=", "None", ")", ":", "meta_key", "=", "meta_key", "or", "'name'", "for", "child", "in", "self", ".", "meta", ".", "_children", ":", "if", "isinstance", "(", "child", ",", "Html", ")", "a...
Get the ``content`` attribute of a meta tag ``name``. For example:: head.get_meta('decription') returns the ``content`` attribute of the meta tag with attribute ``name`` equal to ``description`` or ``None``. If a different meta key needs to be matched, it can be specified ...
[ "Get", "the", "content", "attribute", "of", "a", "meta", "tag", "name", "." ]
python
train
36.944444
openstack/proliantutils
proliantutils/utils.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L110-L135
def verify_image_checksum(image_location, expected_checksum): """Verifies checksum (md5) of image file against the expected one. This method generates the checksum of the image file on the fly and verifies it against the expected checksum provided as argument. :param image_location: location of image ...
[ "def", "verify_image_checksum", "(", "image_location", ",", "expected_checksum", ")", ":", "try", ":", "with", "open", "(", "image_location", ",", "'rb'", ")", "as", "fd", ":", "actual_checksum", "=", "hash_file", "(", "fd", ")", "except", "IOError", "as", "...
Verifies checksum (md5) of image file against the expected one. This method generates the checksum of the image file on the fly and verifies it against the expected checksum provided as argument. :param image_location: location of image file whose checksum is verified. :param expected_checksum: checks...
[ "Verifies", "checksum", "(", "md5", ")", "of", "image", "file", "against", "the", "expected", "one", "." ]
python
train
48.115385
jdowner/gist
gist/gist.py
https://github.com/jdowner/gist/blob/0f2941434f63c5aed69218edad454de8c73819a0/gist/gist.py#L391-L403
def description(self, request, id, description): """Updates the description of a gist Arguments: request: an initial request object id: the id of the gist we want to edit the description for description: the new description """ request.d...
[ "def", "description", "(", "self", ",", "request", ",", "id", ",", "description", ")", ":", "request", ".", "data", "=", "json", ".", "dumps", "(", "{", "\"description\"", ":", "description", "}", ")", "return", "self", ".", "send", "(", "request", ","...
Updates the description of a gist Arguments: request: an initial request object id: the id of the gist we want to edit the description for description: the new description
[ "Updates", "the", "description", "of", "a", "gist" ]
python
train
33.307692
briancappello/flask-unchained
flask_unchained/bundles/admin/macro.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/admin/macro.py#L1-L42
def macro(name): """Replaces :func:`~flask_admin.model.template.macro`, adding support for using macros imported from another file. For example: .. code:: html+jinja {# templates/admin/column_formatters.html #} {% macro email(model, column) %} {% set address = model[column] %} ...
[ "def", "macro", "(", "name", ")", ":", "def", "wrapper", "(", "view", ",", "context", ",", "model", ",", "column", ")", ":", "if", "'.'", "in", "name", ":", "macro_import_name", ",", "macro_name", "=", "name", ".", "split", "(", "'.'", ")", "m", "=...
Replaces :func:`~flask_admin.model.template.macro`, adding support for using macros imported from another file. For example: .. code:: html+jinja {# templates/admin/column_formatters.html #} {% macro email(model, column) %} {% set address = model[column] %} <a href="mailto...
[ "Replaces", ":", "func", ":", "~flask_admin", ".", "model", ".", "template", ".", "macro", "adding", "support", "for", "using", "macros", "imported", "from", "another", "file", ".", "For", "example", ":" ]
python
train
27.642857
python-openxml/python-docx
docx/enum/base.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/enum/base.py#L15-L27
def alias(*aliases): """ Decorating a class with @alias('FOO', 'BAR', ..) allows the class to be referenced by each of the names provided as arguments. """ def decorator(cls): # alias must be set in globals from caller's frame caller = sys._getframe(1) globals_dict = caller.f...
[ "def", "alias", "(", "*", "aliases", ")", ":", "def", "decorator", "(", "cls", ")", ":", "# alias must be set in globals from caller's frame", "caller", "=", "sys", ".", "_getframe", "(", "1", ")", "globals_dict", "=", "caller", ".", "f_globals", "for", "alias...
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to be referenced by each of the names provided as arguments.
[ "Decorating", "a", "class", "with" ]
python
train
32.615385
SBRG/ssbio
ssbio/pipeline/gempro.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1287-L1334
def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None, execute_from_dir=None, all_genes=False, print_exec=False, **kwargs): """Prepare to run I-TASSER homology modeling for genes without structures, or all genes. Args: it...
[ "def", "prep_itasser_modeling", "(", "self", ",", "itasser_installation", ",", "itlib_folder", ",", "runtype", ",", "create_in_dir", "=", "None", ",", "execute_from_dir", "=", "None", ",", "all_genes", "=", "False", ",", "print_exec", "=", "False", ",", "*", "...
Prepare to run I-TASSER homology modeling for genes without structures, or all genes. Args: itasser_installation (str): Path to I-TASSER folder, i.e. ``~/software/I-TASSER4.4`` itlib_folder (str): Path to ITLIB folder, i.e. ``~/software/ITLIB`` runtype: How you will be runni...
[ "Prepare", "to", "run", "I", "-", "TASSER", "homology", "modeling", "for", "genes", "without", "structures", "or", "all", "genes", "." ]
python
train
55.583333
robinandeer/puzzle
puzzle/models/sql/genelist.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/models/sql/genelist.py#L44-L47
def delete_gene(self, *gene_ids): """Delete one or more gene ids form the list.""" self.gene_ids = [gene_id for gene_id in self.gene_ids if gene_id not in gene_ids]
[ "def", "delete_gene", "(", "self", ",", "*", "gene_ids", ")", ":", "self", ".", "gene_ids", "=", "[", "gene_id", "for", "gene_id", "in", "self", ".", "gene_ids", "if", "gene_id", "not", "in", "gene_ids", "]" ]
Delete one or more gene ids form the list.
[ "Delete", "one", "or", "more", "gene", "ids", "form", "the", "list", "." ]
python
train
50.5
CalebBell/fluids
fluids/flow_meter.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/flow_meter.py#L803-L853
def C_ISA_1932_nozzle(D, Do, rho, mu, m): r'''Calculates the coefficient of discharge of an ISA 1932 style nozzle used for measuring flow rate of fluid, based on the geometry of the nozzle, mass flow rate through the nozzle, and the density and viscosity of the fluid. .. math:: C = 0....
[ "def", "C_ISA_1932_nozzle", "(", "D", ",", "Do", ",", "rho", ",", "mu", ",", "m", ")", ":", "A_pipe", "=", "pi", "/", "4.", "*", "D", "*", "D", "v", "=", "m", "/", "(", "A_pipe", "*", "rho", ")", "Re_D", "=", "rho", "*", "v", "*", "D", "/...
r'''Calculates the coefficient of discharge of an ISA 1932 style nozzle used for measuring flow rate of fluid, based on the geometry of the nozzle, mass flow rate through the nozzle, and the density and viscosity of the fluid. .. math:: C = 0.9900 - 0.2262\beta^{4.1} - (0.00175\beta^2 - 0...
[ "r", "Calculates", "the", "coefficient", "of", "discharge", "of", "an", "ISA", "1932", "style", "nozzle", "used", "for", "measuring", "flow", "rate", "of", "fluid", "based", "on", "the", "geometry", "of", "the", "nozzle", "mass", "flow", "rate", "through", ...
python
train
31.490196
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe.py#L148-L163
def fcoe_fcoe_fabric_map_fcoe_fcf_map_fcf_map_fcf_rbid(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe") fcoe_fabric_map = ET.SubElement(fcoe, "fcoe-fabric-map") fcoe_f...
[ "def", "fcoe_fcoe_fabric_map_fcoe_fcf_map_fcf_map_fcf_rbid", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "fcoe", "=", "ET", ".", "SubElement", "(", "config", ",", "\"fcoe\"", ",", "xmlns", "=",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
55.25
jupyter-widgets/ipywidgets
ipywidgets/embed.py
https://github.com/jupyter-widgets/ipywidgets/blob/36fe37594cd5a268def228709ca27e37b99ac606/ipywidgets/embed.py#L116-L127
def _get_recursive_state(widget, store=None, drop_defaults=False): """Gets the embed state of a widget, and all other widgets it refers to as well""" if store is None: store = dict() state = widget._get_embed_state(drop_defaults=drop_defaults) store[widget.model_id] = state # Loop over all ...
[ "def", "_get_recursive_state", "(", "widget", ",", "store", "=", "None", ",", "drop_defaults", "=", "False", ")", ":", "if", "store", "is", "None", ":", "store", "=", "dict", "(", ")", "state", "=", "widget", ".", "_get_embed_state", "(", "drop_defaults", ...
Gets the embed state of a widget, and all other widgets it refers to as well
[ "Gets", "the", "embed", "state", "of", "a", "widget", "and", "all", "other", "widgets", "it", "refers", "to", "as", "well" ]
python
train
47.333333
PMEAL/porespy
porespy/filters/__funcs__.py
https://github.com/PMEAL/porespy/blob/1e13875b56787d8f5b7ffdabce8c4342c33ba9f8/porespy/filters/__funcs__.py#L579-L601
def fill_blind_pores(im): r""" Fills all pores that are not connected to the edges of the image. Parameters ---------- im : ND-array The image of the porous material Returns ------- image : ND-array A version of ``im`` but with all the disconnected pores removed. S...
[ "def", "fill_blind_pores", "(", "im", ")", ":", "im", "=", "sp", ".", "copy", "(", "im", ")", "holes", "=", "find_disconnected_voxels", "(", "im", ")", "im", "[", "holes", "]", "=", "False", "return", "im" ]
r""" Fills all pores that are not connected to the edges of the image. Parameters ---------- im : ND-array The image of the porous material Returns ------- image : ND-array A version of ``im`` but with all the disconnected pores removed. See Also -------- find_...
[ "r", "Fills", "all", "pores", "that", "are", "not", "connected", "to", "the", "edges", "of", "the", "image", "." ]
python
train
19.73913
tritemio/PyBroMo
pybromo/diffusion.py
https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L98-L104
def _generate(num_particles, D, box, rs): """Generate a list of `Particle` objects.""" X0 = rs.rand(num_particles) * (box.x2 - box.x1) + box.x1 Y0 = rs.rand(num_particles) * (box.y2 - box.y1) + box.y1 Z0 = rs.rand(num_particles) * (box.z2 - box.z1) + box.z1 return [Particle(D=D, ...
[ "def", "_generate", "(", "num_particles", ",", "D", ",", "box", ",", "rs", ")", ":", "X0", "=", "rs", ".", "rand", "(", "num_particles", ")", "*", "(", "box", ".", "x2", "-", "box", ".", "x1", ")", "+", "box", ".", "x1", "Y0", "=", "rs", ".",...
Generate a list of `Particle` objects.
[ "Generate", "a", "list", "of", "Particle", "objects", "." ]
python
valid
55
MAVENSDC/PyTplot
pytplot/get_data.py
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/get_data.py#L8-L39
def get_data(name): """ This function extracts the data from the Tplot Variables stored in memory. Parameters: name : str Name of the tplot variable Returns: time_val : pandas dataframe index data_val : list Examples: >>> # R...
[ "def", "get_data", "(", "name", ")", ":", "global", "data_quants", "if", "name", "not", "in", "data_quants", ".", "keys", "(", ")", ":", "print", "(", "\"That name is currently not in pytplot\"", ")", "return", "temp_data_quant", "=", "data_quants", "[", "name",...
This function extracts the data from the Tplot Variables stored in memory. Parameters: name : str Name of the tplot variable Returns: time_val : pandas dataframe index data_val : list Examples: >>> # Retrieve the data from Variable 1...
[ "This", "function", "extracts", "the", "data", "from", "the", "Tplot", "Variables", "stored", "in", "memory", ".", "Parameters", ":", "name", ":", "str", "Name", "of", "the", "tplot", "variable", "Returns", ":", "time_val", ":", "pandas", "dataframe", "index...
python
train
26.75
jazzband/django-ical
django_ical/feedgenerator.py
https://github.com/jazzband/django-ical/blob/7d616b9e319509b56c3ddab8cac18b0439f33b59/django_ical/feedgenerator.py#L101-L111
def write_items(self, calendar): """ Write all events to the calendar """ for item in self.items: event = Event() for ifield, efield in ITEM_EVENT_FIELD_MAP: val = item.get(ifield) if val is not None: event.add(e...
[ "def", "write_items", "(", "self", ",", "calendar", ")", ":", "for", "item", "in", "self", ".", "items", ":", "event", "=", "Event", "(", ")", "for", "ifield", ",", "efield", "in", "ITEM_EVENT_FIELD_MAP", ":", "val", "=", "item", ".", "get", "(", "if...
Write all events to the calendar
[ "Write", "all", "events", "to", "the", "calendar" ]
python
train
33
michael-lazar/rtv
rtv/packages/praw/__init__.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/__init__.py#L798-L806
def default_subreddits(self, *args, **kwargs): """Return a get_content generator for the default subreddits. The additional parameters are passed directly into :meth:`.get_content`. Note: the `url` parameter cannot be altered. """ url = self.config['default_subreddits'] ...
[ "def", "default_subreddits", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "url", "=", "self", ".", "config", "[", "'default_subreddits'", "]", "return", "self", ".", "get_content", "(", "url", ",", "*", "args", ",", "*", "*", "kw...
Return a get_content generator for the default subreddits. The additional parameters are passed directly into :meth:`.get_content`. Note: the `url` parameter cannot be altered.
[ "Return", "a", "get_content", "generator", "for", "the", "default", "subreddits", "." ]
python
train
39.777778
saltstack/salt
salt/states/junos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L461-L519
def load(name, **kwargs): ''' Loads the configuration provided onto the junos device. .. code-block:: yaml Install the mentioned config: junos: - load - path: salt//configs/interface.set .. code-block:: yaml Install the mentioned ...
[ "def", "load", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "ret", "[", "'changes'", "]", "=", "__salt__",...
Loads the configuration provided onto the junos device. .. code-block:: yaml Install the mentioned config: junos: - load - path: salt//configs/interface.set .. code-block:: yaml Install the mentioned config: junos: ...
[ "Loads", "the", "configuration", "provided", "onto", "the", "junos", "device", "." ]
python
train
37.050847
reingart/pyafipws
wsltv.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/wsltv.py#L255-L260
def AgregarPrecioClase(self, clase_tabaco, precio, total_kilos=None, total_fardos=None, **kwargs): "Agrego un PrecioClase a la liq." precioclase = dict(claseTabaco=clase_tabaco, precio=precio, totalKilos=total_kilos, totalFardos=total_fardos) self.solicitud['precioClas...
[ "def", "AgregarPrecioClase", "(", "self", ",", "clase_tabaco", ",", "precio", ",", "total_kilos", "=", "None", ",", "total_fardos", "=", "None", ",", "*", "*", "kwargs", ")", ":", "precioclase", "=", "dict", "(", "claseTabaco", "=", "clase_tabaco", ",", "p...
Agrego un PrecioClase a la liq.
[ "Agrego", "un", "PrecioClase", "a", "la", "liq", "." ]
python
train
59.666667
openthread/openthread
tools/harness-thci/OpenThread.py
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2582-L2592
def commissionerUnregister(self): """stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner """ print '%s call commissionerUnregister' % self.port cmd = 'commissioner stop' print cmd return self._...
[ "def", "commissionerUnregister", "(", "self", ")", ":", "print", "'%s call commissionerUnregister'", "%", "self", ".", "port", "cmd", "=", "'commissioner stop'", "print", "cmd", "return", "self", ".", "__sendCommand", "(", "cmd", ")", "[", "0", "]", "==", "'Do...
stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner
[ "stop", "commissioner" ]
python
train
30.909091
dbarsam/python-vsgen
vsgen/util/logger.py
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/logger.py#L109-L116
def getLogger(cls, name=None): """ Retrieves the Python native logger :param name: The name of the logger instance in the VSG namespace (VSG.<name>); a None value will use the VSG root. :return: The instacne of the Python logger object. """ return logging.getLo...
[ "def", "getLogger", "(", "cls", ",", "name", "=", "None", ")", ":", "return", "logging", ".", "getLogger", "(", "\"{0}.{1}\"", ".", "format", "(", "cls", ".", "BASENAME", ",", "name", ")", "if", "name", "else", "cls", ".", "BASENAME", ")" ]
Retrieves the Python native logger :param name: The name of the logger instance in the VSG namespace (VSG.<name>); a None value will use the VSG root. :return: The instacne of the Python logger object.
[ "Retrieves", "the", "Python", "native", "logger" ]
python
train
47.625
GNS3/gns3-server
gns3server/compute/base_node.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L254-L261
def create(self): """ Creates the node. """ log.info("{module}: {name} [{id}] created".format(module=self.manager.module_name, name=self.name, id=self.id))
[ "def", "create", "(", "self", ")", ":", "log", ".", "info", "(", "\"{module}: {name} [{id}] created\"", ".", "format", "(", "module", "=", "self", ".", "manager", ".", "module_name", ",", "name", "=", "self", ".", "name", ",", "id", "=", "self", ".", "...
Creates the node.
[ "Creates", "the", "node", "." ]
python
train
37.125
HewlettPackard/python-hpOneView
hpOneView/resources/fc_sans/managed_sans.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L125-L138
def create_endpoints_csv_file(self, timeout=-1): """ Creates an endpoints CSV file for a SAN. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its compl...
[ "def", "create_endpoints_csv_file", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/endpoints/\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_post", "(", "uri", ...
Creates an endpoints CSV file for a SAN. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its completion. Returns: dict: Endpoint CSV File Response...
[ "Creates", "an", "endpoints", "CSV", "file", "for", "a", "SAN", "." ]
python
train
36
pkgw/pwkit
pwkit/msmt.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/msmt.py#L125-L153
def sample_double_norm(mean, std_upper, std_lower, size): """Note that this function requires Scipy.""" from scipy.special import erfinv # There's probably a better way to do this. We first draw percentiles # uniformly between 0 and 1. We want the peak of the distribution to occur # at `mean`. Howe...
[ "def", "sample_double_norm", "(", "mean", ",", "std_upper", ",", "std_lower", ",", "size", ")", ":", "from", "scipy", ".", "special", "import", "erfinv", "# There's probably a better way to do this. We first draw percentiles", "# uniformly between 0 and 1. We want the peak of t...
Note that this function requires Scipy.
[ "Note", "that", "this", "function", "requires", "Scipy", "." ]
python
train
46.172414
python-xlib/python-xlib
Xlib/display.py
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/display.py#L559-L562
def ungrab_server(self, onerror = None): """Release the server if it was previously grabbed by this client.""" request.UngrabServer(display = self.display, onerror = onerror)
[ "def", "ungrab_server", "(", "self", ",", "onerror", "=", "None", ")", ":", "request", ".", "UngrabServer", "(", "display", "=", "self", ".", "display", ",", "onerror", "=", "onerror", ")" ]
Release the server if it was previously grabbed by this client.
[ "Release", "the", "server", "if", "it", "was", "previously", "grabbed", "by", "this", "client", "." ]
python
train
54
Microsoft/nni
src/sdk/pynni/nni/curvefitting_assessor/model_factory.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L88-L116
def filter_curve(self): """filter the poor performing curve Returns ------- None """ avg = np.sum(self.trial_history) / self.point_num standard = avg * avg * self.point_num predict_data = [] tmp_model = [] for i in range(NUM_OF_FUN...
[ "def", "filter_curve", "(", "self", ")", ":", "avg", "=", "np", ".", "sum", "(", "self", ".", "trial_history", ")", "/", "self", ".", "point_num", "standard", "=", "avg", "*", "avg", "*", "self", ".", "point_num", "predict_data", "=", "[", "]", "tmp_...
filter the poor performing curve Returns ------- None
[ "filter", "the", "poor", "performing", "curve", "Returns", "-------", "None" ]
python
train
39.344828
RedFantom/ttkwidgets
ttkwidgets/itemscanvas.py
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/itemscanvas.py#L152-L174
def add_item(self, text, font=("default", 12, "bold"), backgroundcolor="yellow", textcolor="black", highlightcolor="blue"): """ Add a new item on the Canvas. :param text: text to display :type text: str :param font: font of the text :type font: t...
[ "def", "add_item", "(", "self", ",", "text", ",", "font", "=", "(", "\"default\"", ",", "12", ",", "\"bold\"", ")", ",", "backgroundcolor", "=", "\"yellow\"", ",", "textcolor", "=", "\"black\"", ",", "highlightcolor", "=", "\"blue\"", ")", ":", "item", "...
Add a new item on the Canvas. :param text: text to display :type text: str :param font: font of the text :type font: tuple or :class:`~tkinter.font.Font` :param backgroundcolor: background color :type backgroundcolor: str :param textcolor: text color ...
[ "Add", "a", "new", "item", "on", "the", "Canvas", ".", ":", "param", "text", ":", "text", "to", "display", ":", "type", "text", ":", "str", ":", "param", "font", ":", "font", "of", "the", "text", ":", "type", "font", ":", "tuple", "or", ":", "cla...
python
train
46.347826
manns/pyspread
pyspread/src/lib/parsers.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/parsers.py#L83-L89
def code2color(color_string): """Returns wx.Colour from a string of a 3-tuple of floats in [0.0, 1.0]""" color_tuple = ast.literal_eval(color_string) color_tuple_int = map(lambda x: int(x * 255.0), color_tuple) return wx.Colour(*color_tuple_int)
[ "def", "code2color", "(", "color_string", ")", ":", "color_tuple", "=", "ast", ".", "literal_eval", "(", "color_string", ")", "color_tuple_int", "=", "map", "(", "lambda", "x", ":", "int", "(", "x", "*", "255.0", ")", ",", "color_tuple", ")", "return", "...
Returns wx.Colour from a string of a 3-tuple of floats in [0.0, 1.0]
[ "Returns", "wx", ".", "Colour", "from", "a", "string", "of", "a", "3", "-", "tuple", "of", "floats", "in", "[", "0", ".", "0", "1", ".", "0", "]" ]
python
train
36.714286
d0c-s4vage/pfp
pfp/interp.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L366-L373
def get_local(self, name, recurse=True): """Get the local field (search for it) from the scope stack. An alias for ``get_var`` :name: The name of the local field """ self._dlog("getting local '{}'".format(name)) return self._search("vars", name, recurse)
[ "def", "get_local", "(", "self", ",", "name", ",", "recurse", "=", "True", ")", ":", "self", ".", "_dlog", "(", "\"getting local '{}'\"", ".", "format", "(", "name", ")", ")", "return", "self", ".", "_search", "(", "\"vars\"", ",", "name", ",", "recurs...
Get the local field (search for it) from the scope stack. An alias for ``get_var`` :name: The name of the local field
[ "Get", "the", "local", "field", "(", "search", "for", "it", ")", "from", "the", "scope", "stack", ".", "An", "alias", "for", "get_var" ]
python
train
37
rosenbrockc/fortpy
fortpy/scripts/analyze.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/scripts/analyze.py#L1073-L1084
def _set_def_prompt(self): """Sets the default prompt to match the currently active unit test.""" if len(self.active) > 15: ids = self.active.split(".") if len(ids) > 2: module, executable, compiler = ids else: module, executable = ids ...
[ "def", "_set_def_prompt", "(", "self", ")", ":", "if", "len", "(", "self", ".", "active", ")", ">", "15", ":", "ids", "=", "self", ".", "active", ".", "split", "(", "\".\"", ")", "if", "len", "(", "ids", ")", ">", "2", ":", "module", ",", "exec...
Sets the default prompt to match the currently active unit test.
[ "Sets", "the", "default", "prompt", "to", "match", "the", "currently", "active", "unit", "test", "." ]
python
train
43.666667
craft-ai/craft-ai-client-python
craftai/time.py
https://github.com/craft-ai/craft-ai-client-python/blob/8bc1a9038511540930371aacfdde0f4040e08f24/craftai/time.py#L151-L157
def timestamp_from_datetime(date_time): """Returns POSIX timestamp as float""" if date_time.tzinfo is None: return time.mktime((date_time.year, date_time.month, date_time.day, date_time.hour, date_time.minute, date_time.second, -1, -1, -1)) + date_time.m...
[ "def", "timestamp_from_datetime", "(", "date_time", ")", ":", "if", "date_time", ".", "tzinfo", "is", "None", ":", "return", "time", ".", "mktime", "(", "(", "date_time", ".", "year", ",", "date_time", ".", "month", ",", "date_time", ".", "day", ",", "da...
Returns POSIX timestamp as float
[ "Returns", "POSIX", "timestamp", "as", "float" ]
python
train
54
wummel/linkchecker
linkcheck/logger/text.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/text.py#L167-L170
def write_base (self, url_data): """Write url_data.base_ref.""" self.write(self.part("base") + self.spaces("base")) self.writeln(url_data.base_ref, color=self.colorbase)
[ "def", "write_base", "(", "self", ",", "url_data", ")", ":", "self", ".", "write", "(", "self", ".", "part", "(", "\"base\"", ")", "+", "self", ".", "spaces", "(", "\"base\"", ")", ")", "self", ".", "writeln", "(", "url_data", ".", "base_ref", ",", ...
Write url_data.base_ref.
[ "Write", "url_data", ".", "base_ref", "." ]
python
train
47.5
inveniosoftware/invenio-oauth2server
invenio_oauth2server/views/server.py
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/views/server.py#L36-L50
def error_handler(f): """Handle uncaught OAuth errors.""" @wraps(f) def decorated(*args, **kwargs): try: return f(*args, **kwargs) except OAuth2Error as e: # Only FatalClientError are handled by Flask-OAuthlib (as these # errors should not be redirect back...
[ "def", "error_handler", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "OAuth2Error", ...
Handle uncaught OAuth errors.
[ "Handle", "uncaught", "OAuth", "errors", "." ]
python
train
39.466667
jxtech/wechatpy
wechatpy/enterprise/client/api/appchat.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L99-L110
def send_text(self, chat_id, content, safe=0): """ 发送文本消息 详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248/文本消息/ :param chat_id: 群聊id :param content: 消息内容 :param safe: 表示是否是保密消息,0表示否,1表示是,默认0 :return: """ return self.send(chat_id, 'text...
[ "def", "send_text", "(", "self", ",", "chat_id", ",", "content", ",", "safe", "=", "0", ")", ":", "return", "self", ".", "send", "(", "chat_id", ",", "'text'", ",", "safe", "=", "safe", ",", "content", "=", "content", ")" ]
发送文本消息 详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248/文本消息/ :param chat_id: 群聊id :param content: 消息内容 :param safe: 表示是否是保密消息,0表示否,1表示是,默认0 :return:
[ "发送文本消息" ]
python
train
28.25
tjcsl/ion
intranet/apps/announcements/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/announcements/views.py#L81-L130
def request_announcement_view(request): """The request announcement page.""" if request.method == "POST": form = AnnouncementRequestForm(request.POST) logger.debug(form) logger.debug(form.data) if form.is_valid(): teacher_objs = form.cleaned_data["teachers_requested"...
[ "def", "request_announcement_view", "(", "request", ")", ":", "if", "request", ".", "method", "==", "\"POST\"", ":", "form", "=", "AnnouncementRequestForm", "(", "request", ".", "POST", ")", "logger", ".", "debug", "(", "form", ")", "logger", ".", "debug", ...
The request announcement page.
[ "The", "request", "announcement", "page", "." ]
python
train
39.46
opendatateam/udata
tasks.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/tasks.py#L42-L55
def update(ctx, migrate=False): '''Perform a development update''' msg = 'Update all dependencies' if migrate: msg += ' and migrate data' header(msg) info('Updating Python dependencies') lrun('pip install -r requirements/develop.pip') lrun('pip install -e .') info('Updating JavaS...
[ "def", "update", "(", "ctx", ",", "migrate", "=", "False", ")", ":", "msg", "=", "'Update all dependencies'", "if", "migrate", ":", "msg", "+=", "' and migrate data'", "header", "(", "msg", ")", "info", "(", "'Updating Python dependencies'", ")", "lrun", "(", ...
Perform a development update
[ "Perform", "a", "development", "update" ]
python
train
31.071429
intelligenia/modeltranslation
modeltranslation/models.py
https://github.com/intelligenia/modeltranslation/blob/64d6adeb537747321d5020efedf5d7e0d135862d/modeltranslation/models.py#L155-L166
def _init_module_cache(): """ Module caching, it helps with not having to import again and again same modules. @return: boolean, True if module caching has been done, False if module caching was already done. """ # While there are not loaded modules, load these ones if len(FieldTranslation._modules) < len...
[ "def", "_init_module_cache", "(", ")", ":", "# While there are not loaded modules, load these ones", "if", "len", "(", "FieldTranslation", ".", "_modules", ")", "<", "len", "(", "FieldTranslation", ".", "_model_module_paths", ")", ":", "for", "module_path", "in", "Fie...
Module caching, it helps with not having to import again and again same modules. @return: boolean, True if module caching has been done, False if module caching was already done.
[ "Module", "caching", "it", "helps", "with", "not", "having", "to", "import", "again", "and", "again", "same", "modules", "." ]
python
train
43.333333
Othernet-Project/conz
conz/console.py
https://github.com/Othernet-Project/conz/blob/051214fa95a837c21595b03426a2c54c522d07a0/conz/console.py#L183-L239
def menu(self, choices, prompt='Please choose from the provided options:', error='Invalid choice', intro=None, strict=True, default=None, numerator=lambda x: [i + 1 for i in range(x)], formatter=lambda x, y: '{0:>3}) {1}'.format(x, y), clean=utils.safeint): ""...
[ "def", "menu", "(", "self", ",", "choices", ",", "prompt", "=", "'Please choose from the provided options:'", ",", "error", "=", "'Invalid choice'", ",", "intro", "=", "None", ",", "strict", "=", "True", ",", "default", "=", "None", ",", "numerator", "=", "l...
Print a menu The choices must be an iterable of two-tuples where the first value is the value of the menu item, and the second is the label for that matches the value. The menu will be printed with numeric choices. For example:: 1) foo 2) bar Formattin...
[ "Print", "a", "menu" ]
python
train
46.350877
depop/python-flexisettings
flexisettings/utils.py
https://github.com/depop/python-flexisettings/blob/36d08280ab7c45568fdf206fcdb4cf771d240c6b/flexisettings/utils.py#L47-L75
def override_environment(settings, **kwargs): # type: (Settings, **str) -> Generator """ Override env vars and reload the Settings object NOTE: Obviously this context has to be in place before you import any module which reads env values at import time. NOTE: The values in `kwargs` mus...
[ "def", "override_environment", "(", "settings", ",", "*", "*", "kwargs", ")", ":", "# type: (Settings, **str) -> Generator", "old_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "os", ".", "environ", ".", "update", "(", "kwargs", ")", "settings", "."...
Override env vars and reload the Settings object NOTE: Obviously this context has to be in place before you import any module which reads env values at import time. NOTE: The values in `kwargs` must be strings else you will get a cryptic: TypeError: execve() arg 3 contains a non-string va...
[ "Override", "env", "vars", "and", "reload", "the", "Settings", "object" ]
python
train
23.862069
shoebot/shoebot
shoebot/gui/gtk_window.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/gui/gtk_window.py#L235-L241
def do_unfullscreen(self, widget): """ Widget Action to set Windowed Mode. """ self.unfullscreen() self.is_fullscreen = False self.bot._screen_ratio = None
[ "def", "do_unfullscreen", "(", "self", ",", "widget", ")", ":", "self", ".", "unfullscreen", "(", ")", "self", ".", "is_fullscreen", "=", "False", "self", ".", "bot", ".", "_screen_ratio", "=", "None" ]
Widget Action to set Windowed Mode.
[ "Widget", "Action", "to", "set", "Windowed", "Mode", "." ]
python
valid
28.142857
Mxit/python-mxit
mxit/services.py
https://github.com/Mxit/python-mxit/blob/6b18a54ef6fbfe1f9d94755ba3d4ad77743c8b0c/mxit/services.py#L251-L272
def get_contact_list(self, list_filter, skip=None, count=None, scope='graph/read'): """ Retrieve the Mxit user's full contact list User authentication required with the following scope: 'graph/read' """ params = { 'filter': list_filter } if skip: ...
[ "def", "get_contact_list", "(", "self", ",", "list_filter", ",", "skip", "=", "None", ",", "count", "=", "None", ",", "scope", "=", "'graph/read'", ")", ":", "params", "=", "{", "'filter'", ":", "list_filter", "}", "if", "skip", ":", "params", "[", "'s...
Retrieve the Mxit user's full contact list User authentication required with the following scope: 'graph/read'
[ "Retrieve", "the", "Mxit", "user", "s", "full", "contact", "list", "User", "authentication", "required", "with", "the", "following", "scope", ":", "graph", "/", "read" ]
python
train
31.5
the01/python-paps
paps/person.py
https://github.com/the01/python-paps/blob/2dde5a71913e4c7b22901cf05c6ecedd890919c4/paps/person.py#L53-L64
def from_dict(self, d): """ Set this person from dict :param d: Dictionary representing a person ('sitting'[, 'id']) :type d: dict :rtype: Person :raises KeyError: 'sitting' not set """ self.sitting = d['sitting'] self.id = d.get('id', None) ...
[ "def", "from_dict", "(", "self", ",", "d", ")", ":", "self", ".", "sitting", "=", "d", "[", "'sitting'", "]", "self", ".", "id", "=", "d", ".", "get", "(", "'id'", ",", "None", ")", "return", "self" ]
Set this person from dict :param d: Dictionary representing a person ('sitting'[, 'id']) :type d: dict :rtype: Person :raises KeyError: 'sitting' not set
[ "Set", "this", "person", "from", "dict" ]
python
train
26.916667
pandas-dev/pandas
pandas/io/pytables.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L878-L926
def remove(self, key, where=None, start=None, stop=None): """ Remove pandas object partially by specifying the where condition Parameters ---------- key : string Node to remove or delete rows from where : list of Term (or convertible) objects, optional ...
[ "def", "remove", "(", "self", ",", "key", ",", "where", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "where", "=", "_ensure_term", "(", "where", ",", "scope_level", "=", "1", ")", "try", ":", "s", "=", "self", ".", ...
Remove pandas object partially by specifying the where condition Parameters ---------- key : string Node to remove or delete rows from where : list of Term (or convertible) objects, optional start : integer (defaults to None), row number to start selection st...
[ "Remove", "pandas", "object", "partially", "by", "specifying", "the", "where", "condition" ]
python
train
32
jasonrollins/shareplum
shareplum/shareplum.py
https://github.com/jasonrollins/shareplum/blob/404f320808912619920e2d787f2c4387225a14e0/shareplum/shareplum.py#L140-L205
def AddList(self, listName, description, templateID): """Create a new List Provide: List Name, List Description, and List Template Templates Include: Announcements Contacts Custom List Custom List in Datasheet View ...
[ "def", "AddList", "(", "self", ",", "listName", ",", "description", ",", "templateID", ")", ":", "templateIDs", "=", "{", "'Announcements'", ":", "'104'", ",", "'Contacts'", ":", "'105'", ",", "'Custom List'", ":", "'100'", ",", "'Custom List in Datasheet View'"...
Create a new List Provide: List Name, List Description, and List Template Templates Include: Announcements Contacts Custom List Custom List in Datasheet View DataSources Discussion Board Docume...
[ "Create", "a", "new", "List", "Provide", ":", "List", "Name", "List", "Description", "and", "List", "Template", "Templates", "Include", ":", "Announcements", "Contacts", "Custom", "List", "Custom", "List", "in", "Datasheet", "View", "DataSources", "Discussion", ...
python
train
36.045455
senaite/senaite.core
bika/lims/utils/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/utils/__init__.py#L331-L399
def senaite_url_fetcher(url): """Uses plone.subrequest to fetch an internal image resource. If the URL points to an external resource, the URL is handed to weasyprint.default_url_fetcher. Please see these links for details: - https://github.com/plone/plone.subrequest - https://pypi.py...
[ "def", "senaite_url_fetcher", "(", "url", ")", ":", "logger", ".", "info", "(", "\"Fetching URL '{}' for WeasyPrint\"", ".", "format", "(", "url", ")", ")", "# get the pyhsical path from the URL", "request", "=", "api", ".", "get_request", "(", ")", "host", "=", ...
Uses plone.subrequest to fetch an internal image resource. If the URL points to an external resource, the URL is handed to weasyprint.default_url_fetcher. Please see these links for details: - https://github.com/plone/plone.subrequest - https://pypi.python.org/pypi/plone.subrequest ...
[ "Uses", "plone", ".", "subrequest", "to", "fetch", "an", "internal", "image", "resource", "." ]
python
train
38.130435
Nic30/hwt
hwt/simulator/vcdHdlSimConfig.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/vcdHdlSimConfig.py#L113-L121
def logChange(self, nowTime, sig, nextVal): """ This method is called for every value change of any signal. """ try: self.vcdWriter.logChange(nowTime, sig, nextVal) except KeyError: # not every signal has to be registered pass
[ "def", "logChange", "(", "self", ",", "nowTime", ",", "sig", ",", "nextVal", ")", ":", "try", ":", "self", ".", "vcdWriter", ".", "logChange", "(", "nowTime", ",", "sig", ",", "nextVal", ")", "except", "KeyError", ":", "# not every signal has to be registere...
This method is called for every value change of any signal.
[ "This", "method", "is", "called", "for", "every", "value", "change", "of", "any", "signal", "." ]
python
test
32.666667