nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
Fallen-Breath/MCDReforged
fdb1d2520b35f916123f265dbd94603981bb2b0c
mcdreforged/plugin/plugin_registry.py
python
PluginRegistryStorage.__init__
(self, plugin_manager: 'PluginManager')
[]
def __init__(self, plugin_manager: 'PluginManager'): super().__init__() self.plugin_manager = plugin_manager
[ "def", "__init__", "(", "self", ",", "plugin_manager", ":", "'PluginManager'", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "plugin_manager", "=", "plugin_manager" ]
https://github.com/Fallen-Breath/MCDReforged/blob/fdb1d2520b35f916123f265dbd94603981bb2b0c/mcdreforged/plugin/plugin_registry.py#L92-L94
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/functions.py
python
sech
(ctx, z)
return ctx.one / ctx.cosh(z)
[]
def sech(ctx, z): return ctx.one / ctx.cosh(z)
[ "def", "sech", "(", "ctx", ",", "z", ")", ":", "return", "ctx", ".", "one", "/", "ctx", ".", "cosh", "(", "z", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/functions.py#L103-L103
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/tornado/tcpserver.py
python
TCPServer.start
(self, num_processes: Optional[int] = 1, max_restarts: int = None)
Starts this server in the `.IOLoop`. By default, we run the server in this process and do not fork any additional child process. If num_processes is ``None`` or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If num_process...
Starts this server in the `.IOLoop`.
[ "Starts", "this", "server", "in", "the", ".", "IOLoop", "." ]
def start(self, num_processes: Optional[int] = 1, max_restarts: int = None) -> None: """Starts this server in the `.IOLoop`. By default, we run the server in this process and do not fork any additional child process. If num_processes is ``None`` or <= 0, we detect the number of cores ...
[ "def", "start", "(", "self", ",", "num_processes", ":", "Optional", "[", "int", "]", "=", "1", ",", "max_restarts", ":", "int", "=", "None", ")", "->", "None", ":", "assert", "not", "self", ".", "_started", "self", ".", "_started", "=", "True", "if",...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/tornado/tcpserver.py#L212-L244
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/models/dbm/layer.py
python
ConvMaxPool.get_range_rewards
(self, state, coeffs)
return rval
.. todo:: WRITEME
.. todo::
[ "..", "todo", "::" ]
def get_range_rewards(self, state, coeffs): """ .. todo:: WRITEME """ rval = 0. if self.pool_rows == 1 and self.pool_cols == 1: # If the pool size is 1 then pools = detectors # and we should not penalize pools and detectors separately ...
[ "def", "get_range_rewards", "(", "self", ",", "state", ",", "coeffs", ")", ":", "rval", "=", "0.", "if", "self", ".", "pool_rows", "==", "1", "and", "self", ".", "pool_cols", "==", "1", ":", "# If the pool size is 1 then pools = detectors", "# and we should not ...
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/dbm/layer.py#L2631-L2667
CogComp/cogcomp-nlpy
bc6298908011084b26fe3877e02324026ae86178
ccg_nlpy/pipeline_config.py
python
get_current_config
()
return config, models_downloaded
Function to get configuration for setting up pipeline. If the models have been downloaded, the function will (restore and) load configuration from '~/.ccg_nlpy/config.cfg.' Otherwise, it will load from 'pipeline.cfg' in the package @return: config, a ConfigParser instance with loaded configuration ...
Function to get configuration for setting up pipeline. If the models have been downloaded, the function will (restore and) load configuration from '~/.ccg_nlpy/config.cfg.' Otherwise, it will load from 'pipeline.cfg' in the package
[ "Function", "to", "get", "configuration", "for", "setting", "up", "pipeline", ".", "If", "the", "models", "have", "been", "downloaded", "the", "function", "will", "(", "restore", "and", ")", "load", "configuration", "from", "~", "/", ".", "ccg_nlpy", "/", ...
def get_current_config(): """ Function to get configuration for setting up pipeline. If the models have been downloaded, the function will (restore and) load configuration from '~/.ccg_nlpy/config.cfg.' Otherwise, it will load from 'pipeline.cfg' in the package @return: config, a ConfigParser insta...
[ "def", "get_current_config", "(", ")", ":", "package_config_file", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "+", "'/config/pipeline.cfg'", "config_file", "=", "package_config_file", "models_downl...
https://github.com/CogComp/cogcomp-nlpy/blob/bc6298908011084b26fe3877e02324026ae86178/ccg_nlpy/pipeline_config.py#L14-L44
OpenNMT/OpenNMT-py
4815f07fcd482af9a1fe1d3b620d144197178bc5
onmt/inputters/datareader_base.py
python
DataReaderBase._read_file
(cls, path)
Line-by-line read a file as bytes.
Line-by-line read a file as bytes.
[ "Line", "-", "by", "-", "line", "read", "a", "file", "as", "bytes", "." ]
def _read_file(cls, path): """Line-by-line read a file as bytes.""" with open(path, "rb") as f: for line in f: yield line
[ "def", "_read_file", "(", "cls", ",", "path", ")", ":", "with", "open", "(", "path", ",", "\"rb\"", ")", "as", "f", ":", "for", "line", "in", "f", ":", "yield", "line" ]
https://github.com/OpenNMT/OpenNMT-py/blob/4815f07fcd482af9a1fe1d3b620d144197178bc5/onmt/inputters/datareader_base.py#L30-L34
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/distutils/command/install.py
python
install.has_lib
(self)
return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules())
Returns true if the current distribution has any Python modules to install.
Returns true if the current distribution has any Python modules to install.
[ "Returns", "true", "if", "the", "current", "distribution", "has", "any", "Python", "modules", "to", "install", "." ]
def has_lib(self): """Returns true if the current distribution has any Python modules to install.""" return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules())
[ "def", "has_lib", "(", "self", ")", ":", "return", "(", "self", ".", "distribution", ".", "has_pure_modules", "(", ")", "or", "self", ".", "distribution", ".", "has_ext_modules", "(", ")", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/distutils/command/install.py#L622-L626
dcsync/pycobalt
d3a630bfadaeeb6c99aad28f226abe48f6b4acca
pycobalt/aggressor.py
python
transform
(*args, fork=None, sync=True)
return engine.call('transform', args, fork=fork, sync=sync)
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Transform shellcode into another format. Arguments $1 - the shellcode to transform $2 - the transform to apply Type Description array comma separated byte values...
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
[ "r", "Documentation", "from", "https", ":", "//", "www", ".", "cobaltstrike", ".", "com", "/", "aggressor", "-", "script", "/", "functions", ".", "html", ":" ]
def transform(*args, fork=None, sync=True): r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Transform shellcode into another format. Arguments $1 - the shellcode to transform $2 - the transform to apply Type Description ...
[ "def", "transform", "(", "*", "args", ",", "fork", "=", "None", ",", "sync", "=", "True", ")", ":", "return", "engine", ".", "call", "(", "'transform'", ",", "args", ",", "fork", "=", "fork", ",", "sync", "=", "sync", ")" ]
https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L6758-L6803
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/checker.py
python
is_more_general_arg_prefix
(t: FunctionLike, s: FunctionLike)
return False
Does t have wider arguments than s?
Does t have wider arguments than s?
[ "Does", "t", "have", "wider", "arguments", "than", "s?" ]
def is_more_general_arg_prefix(t: FunctionLike, s: FunctionLike) -> bool: """Does t have wider arguments than s?""" # TODO should an overload with additional items be allowed to be more # general than one with fewer items (or just one item)? if isinstance(t, CallableType): if isinstance(s, ...
[ "def", "is_more_general_arg_prefix", "(", "t", ":", "FunctionLike", ",", "s", ":", "FunctionLike", ")", "->", "bool", ":", "# TODO should an overload with additional items be allowed to be more", "# general than one with fewer items (or just one item)?", "if", "isinstance", ...
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/checker.py#L5785-L5799
fronzbot/blinkpy
21f29ad302072d16efdc8205aaba826013e69176
blinkpy/auth.py
python
Auth.login
(self, login_url=LOGIN_ENDPOINT)
Attempt login to blink servers.
Attempt login to blink servers.
[ "Attempt", "login", "to", "blink", "servers", "." ]
def login(self, login_url=LOGIN_ENDPOINT): """Attempt login to blink servers.""" self.validate_login() _LOGGER.info("Attempting login with %s", login_url) response = api.request_login(self, login_url, self.data, is_retry=False,) try: if response.status_code == 200: ...
[ "def", "login", "(", "self", ",", "login_url", "=", "LOGIN_ENDPOINT", ")", ":", "self", ".", "validate_login", "(", ")", "_LOGGER", ".", "info", "(", "\"Attempting login with %s\"", ",", "login_url", ")", "response", "=", "api", ".", "request_login", "(", "s...
https://github.com/fronzbot/blinkpy/blob/21f29ad302072d16efdc8205aaba826013e69176/blinkpy/auth.py#L102-L112
jamiecaesar/securecrt-tools
f3cbb49223a485fc9af86e9799b5c940f19e8027
templates/multi_device_template-w-check_mode.py
python
script_main
(script)
| MULTIPLE device script | Author: XXXXXXXX | Email: XXXXXXX@domain.com PUT A DESCRIPTION OF THIS SCRIPT HERE. WHAT IT DOES, ETC. This script checks that it will NOT be run in a connected tab. :param script: A subclass of the scripts.Script object that represents the execution of this particular ...
| MULTIPLE device script | Author: XXXXXXXX | Email: XXXXXXX@domain.com
[ "|", "MULTIPLE", "device", "script", "|", "Author", ":", "XXXXXXXX", "|", "Email", ":", "XXXXXXX@domain", ".", "com" ]
def script_main(script): """ | MULTIPLE device script | Author: XXXXXXXX | Email: XXXXXXX@domain.com PUT A DESCRIPTION OF THIS SCRIPT HERE. WHAT IT DOES, ETC. This script checks that it will NOT be run in a connected tab. :param script: A subclass of the scripts.Script object that represe...
[ "def", "script_main", "(", "script", ")", ":", "session", "=", "script", ".", "get_main_session", "(", ")", "# If this is launched on an active tab, disconnect before continuing.", "logger", ".", "debug", "(", "\"<M_SCRIPT> Checking if current tab is connected.\"", ")", "if",...
https://github.com/jamiecaesar/securecrt-tools/blob/f3cbb49223a485fc9af86e9799b5c940f19e8027/templates/multi_device_template-w-check_mode.py#L30-L121
TheSouthFrog/stylealign
910632d2fccc9db61b00c265ae18a88913113c1d
pytorch_code/data.py
python
ImageFilelist.__len__
(self)
return len(self.imlist)
[]
def __len__(self): return len(self.imlist)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "imlist", ")" ]
https://github.com/TheSouthFrog/stylealign/blob/910632d2fccc9db61b00c265ae18a88913113c1d/pytorch_code/data.py#L41-L42
determined-ai/determined
f637264493acc14f12e66550cb51c520b5d27f6c
harness/determined/_core/_distributed.py
python
DistributedContext.get_rank
(self)
return self.rank
Return the rank of the process in the trial. The rank of a process is a unique ID within the trial; that is, no two processes in the same trial will be assigned the same rank.
Return the rank of the process in the trial. The rank of a process is a unique ID within the trial; that is, no two processes in the same trial will be assigned the same rank.
[ "Return", "the", "rank", "of", "the", "process", "in", "the", "trial", ".", "The", "rank", "of", "a", "process", "is", "a", "unique", "ID", "within", "the", "trial", ";", "that", "is", "no", "two", "processes", "in", "the", "same", "trial", "will", "...
def get_rank(self) -> int: """ Return the rank of the process in the trial. The rank of a process is a unique ID within the trial; that is, no two processes in the same trial will be assigned the same rank. """ return self.rank
[ "def", "get_rank", "(", "self", ")", "->", "int", ":", "return", "self", ".", "rank" ]
https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/harness/determined/_core/_distributed.py#L181-L187
IndicoDataSolutions/Passage
af6e100804dfe332c88bd2cd192e93a807377887
passage/activations.py
python
clipped_rectify
(x)
return T.clip((x + abs(x)) / 2.0, 0., 5.)
[]
def clipped_rectify(x): return T.clip((x + abs(x)) / 2.0, 0., 5.)
[ "def", "clipped_rectify", "(", "x", ")", ":", "return", "T", ".", "clip", "(", "(", "x", "+", "abs", "(", "x", ")", ")", "/", "2.0", ",", "0.", ",", "5.", ")" ]
https://github.com/IndicoDataSolutions/Passage/blob/af6e100804dfe332c88bd2cd192e93a807377887/passage/activations.py#L35-L36
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/varLib/merger.py
python
merge
(merger, self, lst)
[]
def merge(merger, self, lst): merger.valueFormat1 = self.ValueFormat1 = reduce(int.__or__, [l.ValueFormat1 for l in lst], 0) merger.valueFormat2 = self.ValueFormat2 = reduce(int.__or__, [l.ValueFormat2 for l in lst], 0) if self.Format == 1: _PairPosFormat1_merge(self, lst, merger) elif self.Format == 2: _PairP...
[ "def", "merge", "(", "merger", ",", "self", ",", "lst", ")", ":", "merger", ".", "valueFormat1", "=", "self", ".", "ValueFormat1", "=", "reduce", "(", "int", ".", "__or__", ",", "[", "l", ".", "ValueFormat1", "for", "l", "in", "lst", "]", ",", "0",...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/varLib/merger.py#L523-L559
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/numpy/polynomial/hermite_e.py
python
_normed_hermite_e_n
(x, n)
return c0 + c1*x
Evaluate a normalized HermiteE polynomial. Compute the value of the normalized HermiteE polynomial of degree ``n`` at the points ``x``. Parameters ---------- x : ndarray of double. Points at which to evaluate the function n : int Degree of the normalized HermiteE function to b...
Evaluate a normalized HermiteE polynomial.
[ "Evaluate", "a", "normalized", "HermiteE", "polynomial", "." ]
def _normed_hermite_e_n(x, n): """ Evaluate a normalized HermiteE polynomial. Compute the value of the normalized HermiteE polynomial of degree ``n`` at the points ``x``. Parameters ---------- x : ndarray of double. Points at which to evaluate the function n : int Degr...
[ "def", "_normed_hermite_e_n", "(", "x", ",", "n", ")", ":", "if", "n", "==", "0", ":", "return", "np", ".", "ones", "(", "x", ".", "shape", ")", "/", "np", ".", "sqrt", "(", "np", ".", "sqrt", "(", "2", "*", "np", ".", "pi", ")", ")", "c0",...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/numpy/polynomial/hermite_e.py#L1647-L1687
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/contrib/factorization/python/ops/factorization_ops.py
python
WALSModel._cached_copy
(self, var, name, pass_through=False)
return cache, cache_init, cache_reset
Helper function to create a worker cached copy of a Variable. This assigns the var (either a single Variable or a list of Variables) to local transient cache Variable(s). Note that if var is a list of Variables, the assignment is done sequentially to minimize the memory overheads. Also note that if pas...
Helper function to create a worker cached copy of a Variable.
[ "Helper", "function", "to", "create", "a", "worker", "cached", "copy", "of", "a", "Variable", "." ]
def _cached_copy(self, var, name, pass_through=False): """Helper function to create a worker cached copy of a Variable. This assigns the var (either a single Variable or a list of Variables) to local transient cache Variable(s). Note that if var is a list of Variables, the assignment is done sequential...
[ "def", "_cached_copy", "(", "self", ",", "var", ",", "name", ",", "pass_through", "=", "False", ")", ":", "if", "var", "is", "None", ":", "return", "None", ",", "None", ",", "None", "elif", "pass_through", ":", "cache", "=", "var", "cache_init", "=", ...
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L416-L466
gem/oq-engine
1bdb88f3914e390abcbd285600bfd39477aae47c
openquake/hazardlib/imt.py
python
LiqProb
()
return IMT('LiqProb')
Liquefaction probability
Liquefaction probability
[ "Liquefaction", "probability" ]
def LiqProb(): """ Liquefaction probability """ return IMT('LiqProb')
[ "def", "LiqProb", "(", ")", ":", "return", "IMT", "(", "'LiqProb'", ")" ]
https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/imt.py#L253-L257
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/setting/presenters_gtk.py
python
GtkFolderChooserPresenter._set_value
(self, dirpath)
[]
def _set_value(self, dirpath): if dirpath is not None: encoded_dirpath = dirpath.encode(pgconstants.GTK_CHARACTER_ENCODING) else: encoded_dirpath = b"" self._element.set_current_folder(encoded_dirpath)
[ "def", "_set_value", "(", "self", ",", "dirpath", ")", ":", "if", "dirpath", "is", "not", "None", ":", "encoded_dirpath", "=", "dirpath", ".", "encode", "(", "pgconstants", ".", "GTK_CHARACTER_ENCODING", ")", "else", ":", "encoded_dirpath", "=", "b\"\"", "se...
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/setting/presenters_gtk.py#L507-L513
conda/conda
09cb6bdde68e551852c3844fd2b59c8ba4cafce2
conda/common/configuration.py
python
PrimitiveLoadedParameter.__init__
(self, name, element_type, value, key_flag, value_flags, validation=None)
Args: element_type (type or Tuple[type]): Type-validation of parameter's value. value (primitive value): primitive python value.
Args: element_type (type or Tuple[type]): Type-validation of parameter's value. value (primitive value): primitive python value.
[ "Args", ":", "element_type", "(", "type", "or", "Tuple", "[", "type", "]", ")", ":", "Type", "-", "validation", "of", "parameter", "s", "value", ".", "value", "(", "primitive", "value", ")", ":", "primitive", "python", "value", "." ]
def __init__(self, name, element_type, value, key_flag, value_flags, validation=None): """ Args: element_type (type or Tuple[type]): Type-validation of parameter's value. value (primitive value): primitive python value. """ self._type = element_type self._...
[ "def", "__init__", "(", "self", ",", "name", ",", "element_type", ",", "value", ",", "key_flag", ",", "value_flags", ",", "validation", "=", "None", ")", ":", "self", ".", "_type", "=", "element_type", "self", ".", "_element_type", "=", "element_type", "su...
https://github.com/conda/conda/blob/09cb6bdde68e551852c3844fd2b59c8ba4cafce2/conda/common/configuration.py#L621-L630
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/utils/find_usb_devices.py
python
GetBusDeviceToTTYMap
()
return result
Gets all mappings from (bus, device) to ttyUSB string. Gets mapping from (bus, device) to ttyUSB string (e.g. 'ttyUSB0'), for all ttyUSB strings currently active. Returns: [dict] Dict that maps (bus, device) to ttyUSB string
Gets all mappings from (bus, device) to ttyUSB string.
[ "Gets", "all", "mappings", "from", "(", "bus", "device", ")", "to", "ttyUSB", "string", "." ]
def GetBusDeviceToTTYMap(): """Gets all mappings from (bus, device) to ttyUSB string. Gets mapping from (bus, device) to ttyUSB string (e.g. 'ttyUSB0'), for all ttyUSB strings currently active. Returns: [dict] Dict that maps (bus, device) to ttyUSB string """ result = {} for tty in GetTTYList(): ...
[ "def", "GetBusDeviceToTTYMap", "(", ")", ":", "result", "=", "{", "}", "for", "tty", "in", "GetTTYList", "(", ")", ":", "result", "[", "GetBusDeviceFromTTY", "(", "tty", ")", "]", "=", "tty", "return", "result" ]
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/utils/find_usb_devices.py#L464-L476
pkkid/python-plexapi
8a048d28360b0cdc728a41fa7d3077d0593b68fb
plexapi/mixins.py
python
BannerMixin.unlockBanner
(self)
Unlock the banner for a Plex object.
Unlock the banner for a Plex object.
[ "Unlock", "the", "banner", "for", "a", "Plex", "object", "." ]
def unlockBanner(self): """ Unlock the banner for a Plex object. """ self._edit(**{'banner.locked': 0})
[ "def", "unlockBanner", "(", "self", ")", ":", "self", ".", "_edit", "(", "*", "*", "{", "'banner.locked'", ":", "0", "}", ")" ]
https://github.com/pkkid/python-plexapi/blob/8a048d28360b0cdc728a41fa7d3077d0593b68fb/plexapi/mixins.py#L153-L155
suurjaak/Skyperious
6a4f264dbac8d326c2fa8aeb5483dbca987860bf
skyperious/lib/util.py
python
format_seconds
(seconds, insert="")
return formatted
Returns nicely formatted seconds, e.g. "25 hours, 12 seconds". @param insert text inserted between count and unit, e.g. "4 call hours"
Returns nicely formatted seconds, e.g. "25 hours, 12 seconds".
[ "Returns", "nicely", "formatted", "seconds", "e", ".", "g", ".", "25", "hours", "12", "seconds", "." ]
def format_seconds(seconds, insert=""): """ Returns nicely formatted seconds, e.g. "25 hours, 12 seconds". @param insert text inserted between count and unit, e.g. "4 call hours" """ insert = insert + " " if insert else "" formatted = "0 %sseconds" % insert seconds = int(seconds) if ...
[ "def", "format_seconds", "(", "seconds", ",", "insert", "=", "\"\"", ")", ":", "insert", "=", "insert", "+", "\" \"", "if", "insert", "else", "\"\"", "formatted", "=", "\"0 %sseconds\"", "%", "insert", "seconds", "=", "int", "(", "seconds", ")", "if", "s...
https://github.com/suurjaak/Skyperious/blob/6a4f264dbac8d326c2fa8aeb5483dbca987860bf/skyperious/lib/util.py#L102-L119
menpo/menpo
a61500656c4fc2eea82497684f13cc31a605550b
menpo/shape/pointcloud.py
python
PointCloud.from_mask
(self, mask)
return pc
A 1D boolean array with the same number of elements as the number of points in the PointCloud. This is then broadcast across the dimensions of the PointCloud and returns a new PointCloud containing only those points that were ``True`` in the mask. Parameters ---------- m...
A 1D boolean array with the same number of elements as the number of points in the PointCloud. This is then broadcast across the dimensions of the PointCloud and returns a new PointCloud containing only those points that were ``True`` in the mask.
[ "A", "1D", "boolean", "array", "with", "the", "same", "number", "of", "elements", "as", "the", "number", "of", "points", "in", "the", "PointCloud", ".", "This", "is", "then", "broadcast", "across", "the", "dimensions", "of", "the", "PointCloud", "and", "re...
def from_mask(self, mask): """ A 1D boolean array with the same number of elements as the number of points in the PointCloud. This is then broadcast across the dimensions of the PointCloud and returns a new PointCloud containing only those points that were ``True`` in the mask. ...
[ "def", "from_mask", "(", "self", ",", "mask", ")", ":", "if", "mask", ".", "shape", "[", "0", "]", "!=", "self", ".", "n_points", ":", "raise", "ValueError", "(", "\"Mask must be a 1D boolean array of the same \"", "\"number of entries as points in this PointCloud.\""...
https://github.com/menpo/menpo/blob/a61500656c4fc2eea82497684f13cc31a605550b/menpo/shape/pointcloud.py#L1298-L1327
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/asterisk_mbox/mailbox.py
python
AsteriskMailbox.async_delete
(self, msgid)
return True
Delete the specified messages.
Delete the specified messages.
[ "Delete", "the", "specified", "messages", "." ]
async def async_delete(self, msgid): """Delete the specified messages.""" client = self.hass.data[ASTERISK_DOMAIN].client _LOGGER.info("Deleting: %s", msgid) await self.hass.async_add_executor_job(client.delete, msgid) return True
[ "async", "def", "async_delete", "(", "self", ",", "msgid", ")", ":", "client", "=", "self", ".", "hass", ".", "data", "[", "ASTERISK_DOMAIN", "]", ".", "client", "_LOGGER", ".", "info", "(", "\"Deleting: %s\"", ",", "msgid", ")", "await", "self", ".", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/asterisk_mbox/mailbox.py#L76-L81
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py
python
Client.get_type_all
(self, name)
return self.recv_get_type_all()
Parameters: - name
Parameters: - name
[ "Parameters", ":", "-", "name" ]
def get_type_all(self, name): """ Parameters: - name """ self.send_get_type_all(name) return self.recv_get_type_all()
[ "def", "get_type_all", "(", "self", ",", "name", ")", ":", "self", ".", "send_get_type_all", "(", "name", ")", "return", "self", ".", "recv_get_type_all", "(", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L1752-L1759
m-labs/artiq
eaa1505c947c7987cdbd31c24056823c740e84e0
artiq/coredevice/ad9914.py
python
AD9914.set_x_mu
(self, xftw, amplitude=0x0fff)
Set the DDS frequency and amplitude with an extended-resolution (63-bit) frequency tuning word. Phase control is not implemented in this mode; the phase offset can assume any value. After this function has been called, exit extended-resolution mode before calling functions that...
Set the DDS frequency and amplitude with an extended-resolution (63-bit) frequency tuning word.
[ "Set", "the", "DDS", "frequency", "and", "amplitude", "with", "an", "extended", "-", "resolution", "(", "63", "-", "bit", ")", "frequency", "tuning", "word", "." ]
def set_x_mu(self, xftw, amplitude=0x0fff): """Set the DDS frequency and amplitude with an extended-resolution (63-bit) frequency tuning word. Phase control is not implemented in this mode; the phase offset can assume any value. After this function has been called, exit extende...
[ "def", "set_x_mu", "(", "self", ",", "xftw", ",", "amplitude", "=", "0x0fff", ")", ":", "delay_mu", "(", "-", "self", ".", "set_x_duration_mu", ")", "self", ".", "write", "(", "AD9914_GPIO", ",", "(", "1", "<<", "self", ".", "channel", ")", "<<", "1"...
https://github.com/m-labs/artiq/blob/eaa1505c947c7987cdbd31c24056823c740e84e0/artiq/coredevice/ad9914.py#L289-L309
coreemu/core
7e18a7a72023a69a92ad61d87461bd659ba27f7c
daemon/core/configservices/frrservices/services.py
python
has_mtu_mismatch
(iface: CoreInterface)
return False
Helper to detect MTU mismatch and add the appropriate FRR mtu-ignore command. This is needed when e.g. a node is linked via a GreTap device.
Helper to detect MTU mismatch and add the appropriate FRR mtu-ignore command. This is needed when e.g. a node is linked via a GreTap device.
[ "Helper", "to", "detect", "MTU", "mismatch", "and", "add", "the", "appropriate", "FRR", "mtu", "-", "ignore", "command", ".", "This", "is", "needed", "when", "e", ".", "g", ".", "a", "node", "is", "linked", "via", "a", "GreTap", "device", "." ]
def has_mtu_mismatch(iface: CoreInterface) -> bool: """ Helper to detect MTU mismatch and add the appropriate FRR mtu-ignore command. This is needed when e.g. a node is linked via a GreTap device. """ if iface.mtu != DEFAULT_MTU: return True if not iface.net: return False ...
[ "def", "has_mtu_mismatch", "(", "iface", ":", "CoreInterface", ")", "->", "bool", ":", "if", "iface", ".", "mtu", "!=", "DEFAULT_MTU", ":", "return", "True", "if", "not", "iface", ".", "net", ":", "return", "False", "for", "iface", "in", "iface", ".", ...
https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/configservices/frrservices/services.py#L15-L28
apple/coremltools
141a83af482fcbdd5179807c9eaff9a7999c2c49
coremltools/converters/onnx/_operators_nd.py
python
_convert_ceil
(builder, node, graph, err)
convert to CoreML Ceil Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5018
convert to CoreML Ceil Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5018
[ "convert", "to", "CoreML", "Ceil", "Layer", ":", "https", ":", "//", "github", ".", "com", "/", "apple", "/", "coremltools", "/", "blob", "/", "655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492", "/", "mlmodel", "/", "format", "/", "NeuralNetwork", ".", "proto#L5018" ]
def _convert_ceil(builder, node, graph, err): """ convert to CoreML Ceil Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5018 """ builder.add_ceil( name=node.name, input_name=node.inputs[0], output_name=node.output...
[ "def", "_convert_ceil", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "builder", ".", "add_ceil", "(", "name", "=", "node", ".", "name", ",", "input_name", "=", "node", ".", "inputs", "[", "0", "]", ",", "output_name", "=", "node",...
https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/converters/onnx/_operators_nd.py#L492-L499
aws/aws-cli
d697e0ed79fca0f853ce53efe1f83ee41a478134
awscli/help.py
python
HelpCommand.related_items
(self)
return self._related_items
This is list of items that are related to the help command
This is list of items that are related to the help command
[ "This", "is", "list", "of", "items", "that", "are", "related", "to", "the", "help", "command" ]
def related_items(self): """This is list of items that are related to the help command""" return self._related_items
[ "def", "related_items", "(", "self", ")", ":", "return", "self", ".", "_related_items" ]
https://github.com/aws/aws-cli/blob/d697e0ed79fca0f853ce53efe1f83ee41a478134/awscli/help.py#L254-L256
bojone/attention
2eddb302349dfeff8bd530966c97934f32d4ec10
attention_keras.py
python
SparseSelfAttention.__init__
(self, heads, size_per_head, rate=2, key_size=None, mask_right=False, **kwargs)
[]
def __init__(self, heads, size_per_head, rate=2, key_size=None, mask_right=False, **kwargs): super(SparseSelfAttention, self).__init__(**kwargs) self.heads = heads self.size_per_head = size_per_head self.out_dim = heads * size_per_head self.key_size = key_size if...
[ "def", "__init__", "(", "self", ",", "heads", ",", "size_per_head", ",", "rate", "=", "2", ",", "key_size", "=", "None", ",", "mask_right", "=", "False", ",", "*", "*", "kwargs", ")", ":", "super", "(", "SparseSelfAttention", ",", "self", ")", ".", "...
https://github.com/bojone/attention/blob/2eddb302349dfeff8bd530966c97934f32d4ec10/attention_keras.py#L290-L300
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/gui/skin/skintree.py
python
load_yaml_include
(incpath, included_paths)
Returns bytes for an include. incpath include path to another YAML file included_paths a sequence of all already included (absolute) paths that will be added to by this function
Returns bytes for an include.
[ "Returns", "bytes", "for", "an", "include", "." ]
def load_yaml_include(incpath, included_paths): ''' Returns bytes for an include. incpath include path to another YAML file included_paths a sequence of all already included (absolute) paths that will be added to by this function ''' incpath = path(incpath).abspat...
[ "def", "load_yaml_include", "(", "incpath", ",", "included_paths", ")", ":", "incpath", "=", "path", "(", "incpath", ")", ".", "abspath", "(", ")", "if", "not", "incpath", "in", "included_paths", ":", "bytes", "=", "load_yaml_content", "(", "incpath", ".", ...
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/gui/skin/skintree.py#L482-L500
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/bitbake/lib/bb/fetch2/__init__.py
python
fetcher_compare_revisions
(d)
return headrevs != bb.fetch2.saved_headrevs
Compare the revisions in the persistent cache with the saved values from when bitbake was started and return true if they have changed.
Compare the revisions in the persistent cache with the saved values from when bitbake was started and return true if they have changed.
[ "Compare", "the", "revisions", "in", "the", "persistent", "cache", "with", "the", "saved", "values", "from", "when", "bitbake", "was", "started", "and", "return", "true", "if", "they", "have", "changed", "." ]
def fetcher_compare_revisions(d): """ Compare the revisions in the persistent cache with the saved values from when bitbake was started and return true if they have changed. """ headrevs = dict(bb.persist_data.persist('BB_URI_HEADREVS', d)) return headrevs != bb.fetch2.saved_headrevs
[ "def", "fetcher_compare_revisions", "(", "d", ")", ":", "headrevs", "=", "dict", "(", "bb", ".", "persist_data", ".", "persist", "(", "'BB_URI_HEADREVS'", ",", "d", ")", ")", "return", "headrevs", "!=", "bb", ".", "fetch2", ".", "saved_headrevs" ]
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/bitbake/lib/bb/fetch2/__init__.py#L521-L528
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pymysql/converters.py
python
escape_unicode
(value, mapping=None)
return u"'%s'" % _escape_unicode(value)
[]
def escape_unicode(value, mapping=None): return u"'%s'" % _escape_unicode(value)
[ "def", "escape_unicode", "(", "value", ",", "mapping", "=", "None", ")", ":", "return", "u\"'%s'\"", "%", "_escape_unicode", "(", "value", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pymysql/converters.py#L117-L118
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/packages/all/scandir.py
python
_walk
(top, topdown=True, onerror=None, followlinks=False)
Like Python 3.5's implementation of os.walk() -- faster than the pre-Python 3.5 version as it uses scandir() internally.
Like Python 3.5's implementation of os.walk() -- faster than the pre-Python 3.5 version as it uses scandir() internally.
[ "Like", "Python", "3", ".", "5", "s", "implementation", "of", "os", ".", "walk", "()", "--", "faster", "than", "the", "pre", "-", "Python", "3", ".", "5", "version", "as", "it", "uses", "scandir", "()", "internally", "." ]
def _walk(top, topdown=True, onerror=None, followlinks=False): """Like Python 3.5's implementation of os.walk() -- faster than the pre-Python 3.5 version as it uses scandir() internally. """ dirs = [] nondirs = [] # We may not have read permission for top, in which case we can't # get a lis...
[ "def", "_walk", "(", "top", ",", "topdown", "=", "True", ",", "onerror", "=", "None", ",", "followlinks", "=", "False", ")", ":", "dirs", "=", "[", "]", "nondirs", "=", "[", "]", "# We may not have read permission for top, in which case we can't", "# get a list ...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/all/scandir.py#L582-L659
OCA/l10n-spain
99050907670a70307fcd8cdfb6f3400d9e120df4
l10n_es_aeat_sii_oca/models/account_move.py
python
AccountMove._compute_sii_registration_key_domain
(self)
[]
def _compute_sii_registration_key_domain(self): for record in self: if record.move_type in {"out_invoice", "out_refund"}: record.sii_registration_key_domain = "sale" elif record.move_type in {"in_invoice", "in_refund"}: record.sii_registration_key_domain =...
[ "def", "_compute_sii_registration_key_domain", "(", "self", ")", ":", "for", "record", "in", "self", ":", "if", "record", ".", "move_type", "in", "{", "\"out_invoice\"", ",", "\"out_refund\"", "}", ":", "record", ".", "sii_registration_key_domain", "=", "\"sale\""...
https://github.com/OCA/l10n-spain/blob/99050907670a70307fcd8cdfb6f3400d9e120df4/l10n_es_aeat_sii_oca/models/account_move.py#L257-L264
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/overkiz/coordinator.py
python
OverkizDataUpdateCoordinator._places_to_area
(self, place: Place)
return areas
Convert places with sub_places to a flat dictionary [placeoid, label]).
Convert places with sub_places to a flat dictionary [placeoid, label]).
[ "Convert", "places", "with", "sub_places", "to", "a", "flat", "dictionary", "[", "placeoid", "label", "]", ")", "." ]
def _places_to_area(self, place: Place) -> dict[str, str]: """Convert places with sub_places to a flat dictionary [placeoid, label]).""" areas = {} if isinstance(place, Place): areas[place.oid] = place.label if isinstance(place.sub_places, list): for sub_place in...
[ "def", "_places_to_area", "(", "self", ",", "place", ":", "Place", ")", "->", "dict", "[", "str", ",", "str", "]", ":", "areas", "=", "{", "}", "if", "isinstance", "(", "place", ",", "Place", ")", ":", "areas", "[", "place", ".", "oid", "]", "=",...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/overkiz/coordinator.py#L107-L117
JoinMarket-Org/joinmarket-clientserver
8b3d21f226185e31aa10e8e16cdfc719cea4a98e
jmclient/jmclient/payjoin.py
python
JMPayjoinManager.set_payjoin_psbt
(self, in_psbt, signed_psbt_for_fees)
return (True, None)
This is the PSBT as initially proposed by the receiver, so we keep a copy of it in that state. This must be a copy as the sig_psbt function will update the mutable psbt it is given. This must not be called until the psbt has passed all sanity and validation checks.
This is the PSBT as initially proposed by the receiver, so we keep a copy of it in that state. This must be a copy as the sig_psbt function will update the mutable psbt it is given. This must not be called until the psbt has passed all sanity and validation checks.
[ "This", "is", "the", "PSBT", "as", "initially", "proposed", "by", "the", "receiver", "so", "we", "keep", "a", "copy", "of", "it", "in", "that", "state", ".", "This", "must", "be", "a", "copy", "as", "the", "sig_psbt", "function", "will", "update", "the...
def set_payjoin_psbt(self, in_psbt, signed_psbt_for_fees): """ This is the PSBT as initially proposed by the receiver, so we keep a copy of it in that state. This must be a copy as the sig_psbt function will update the mutable psbt it is given. This must not be called until the p...
[ "def", "set_payjoin_psbt", "(", "self", ",", "in_psbt", ",", "signed_psbt_for_fees", ")", ":", "assert", "isinstance", "(", "in_psbt", ",", "btc", ".", "PartiallySignedTransaction", ")", "assert", "isinstance", "(", "signed_psbt_for_fees", ",", "btc", ".", "Partia...
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/8b3d21f226185e31aa10e8e16cdfc719cea4a98e/jmclient/jmclient/payjoin.py#L341-L357
jet-admin/jet-django
9bd4536e02d581d39890d56190e8cc966e2714a4
jet_django/deps/rest_framework/views.py
python
APIView.determine_version
(self, request, *args, **kwargs)
return (scheme.determine_version(request, *args, **kwargs), scheme)
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
[ "If", "versioning", "is", "being", "used", "then", "determine", "any", "API", "version", "for", "the", "incoming", "request", ".", "Returns", "a", "two", "-", "tuple", "of", "(", "version", "versioning_scheme", ")" ]
def determine_version(self, request, *args, **kwargs): """ If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) """ if self.versioning_class is None: return (None, None) schem...
[ "def", "determine_version", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "versioning_class", "is", "None", ":", "return", "(", "None", ",", "None", ")", "scheme", "=", "self", ".", "versioning_cla...
https://github.com/jet-admin/jet-django/blob/9bd4536e02d581d39890d56190e8cc966e2714a4/jet_django/deps/rest_framework/views.py#L347-L355
scivision/PyLivestream
6c8243dd8ef76e2d441489198a346f5ed5bc262b
src/pylivestream/base.py
python
SaveDisk.__init__
(self, inifn: Path, outfn: Path = None, **kwargs)
records to disk screen capture with audio if not outfn, just cite command that would have run
records to disk screen capture with audio
[ "records", "to", "disk", "screen", "capture", "with", "audio" ]
def __init__(self, inifn: Path, outfn: Path = None, **kwargs): """ records to disk screen capture with audio if not outfn, just cite command that would have run """ super().__init__(inifn, site="file", vidsource="screen", **kwargs) self.outfn = Path(outfn).expanduser() ...
[ "def", "__init__", "(", "self", ",", "inifn", ":", "Path", ",", "outfn", ":", "Path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "inifn", ",", "site", "=", "\"file\"", ",", "vidsource", "=", "\"screen\"...
https://github.com/scivision/PyLivestream/blob/6c8243dd8ef76e2d441489198a346f5ed5bc262b/src/pylivestream/base.py#L258-L284
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/pip/_vendor/ipaddress.py
python
_count_righthand_zero_bits
(number, bits)
return min(bits, _compat_bit_length(~number & (number - 1)))
Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number.
Count the number of zero bits on the right hand side.
[ "Count", "the", "number", "of", "zero", "bits", "on", "the", "right", "hand", "side", "." ]
def _count_righthand_zero_bits(number, bits): """Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. """ if number == 0: return...
[ "def", "_count_righthand_zero_bits", "(", "number", ",", "bits", ")", ":", "if", "number", "==", "0", ":", "return", "bits", "return", "min", "(", "bits", ",", "_compat_bit_length", "(", "~", "number", "&", "(", "number", "-", "1", ")", ")", ")" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L304-L317
PyQt5/PyQt
d2bbfc9fd6f3fdb5ed5404983cdd0848aa654cf0
QWebEngineView/GetCookie.py
python
WebEngineView.onCookieAdd
(self, cookie)
:param cookie: QNetworkCookie
:param cookie: QNetworkCookie
[ ":", "param", "cookie", ":", "QNetworkCookie" ]
def onCookieAdd(self, cookie): """ :param cookie: QNetworkCookie """ domain = cookie.domain() path = cookie.path() name = cookie.name().data() value = cookie.value().data() if domain in self.DomainCookies: _cookie = self.DomainCookies[domain] ...
[ "def", "onCookieAdd", "(", "self", ",", "cookie", ")", ":", "domain", "=", "cookie", ".", "domain", "(", ")", "path", "=", "cookie", ".", "path", "(", ")", "name", "=", "cookie", ".", "name", "(", ")", ".", "data", "(", ")", "value", "=", "cookie...
https://github.com/PyQt5/PyQt/blob/d2bbfc9fd6f3fdb5ed5404983cdd0848aa654cf0/QWebEngineView/GetCookie.py#L82-L100
hellohaptik/chatbot_ner
742104790170ae5b73c583c94db6786549337dc4
ner_v2/detectors/temporal/date/en/date_detection.py
python
DateDetector._todays_date
(self, date_list=None, original_list=None)
return date_list, original_list
Detects "today" and its variants and returns the date today Matches "today", "2dy", "2day", "tody", "aaj", "aj", "tonight" Args: date_list: Optional, list to store dictionaries of detected dates original_list: Optional, list to store corresponding substrings of given text which w...
Detects "today" and its variants and returns the date today Matches "today", "2dy", "2day", "tody", "aaj", "aj", "tonight" Args: date_list: Optional, list to store dictionaries of detected dates original_list: Optional, list to store corresponding substrings of given text which w...
[ "Detects", "today", "and", "its", "variants", "and", "returns", "the", "date", "today", "Matches", "today", "2dy", "2day", "tody", "aaj", "aj", "tonight", "Args", ":", "date_list", ":", "Optional", "list", "to", "store", "dictionaries", "of", "detected", "da...
def _todays_date(self, date_list=None, original_list=None): """ Detects "today" and its variants and returns the date today Matches "today", "2dy", "2day", "tody", "aaj", "aj", "tonight" Args: date_list: Optional, list to store dictionaries of detected dates origi...
[ "def", "_todays_date", "(", "self", ",", "date_list", "=", "None", ",", "original_list", "=", "None", ")", ":", "if", "date_list", "is", "None", ":", "date_list", "=", "[", "]", "if", "original_list", "is", "None", ":", "original_list", "=", "[", "]", ...
https://github.com/hellohaptik/chatbot_ner/blob/742104790170ae5b73c583c94db6786549337dc4/ner_v2/detectors/temporal/date/en/date_detection.py#L826-L859
geopandas/geopandas
8e7133aef9e6c0d2465e07e92d954e95dedd3881
versioneer.py
python
render
(pieces, style)
return { "version": rendered, "full-revisionid": pieces["long"], "dirty": pieces["dirty"], "error": None, "date": pieces.get("date"), }
Render the given version pieces into the requested style.
Render the given version pieces into the requested style.
[ "Render", "the", "given", "version", "pieces", "into", "the", "requested", "style", "." ]
def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: return { "version": "unknown", "full-revisionid": pieces.get("long"), "dirty": None, "error": pieces["error"], "date": None, ...
[ "def", "render", "(", "pieces", ",", "style", ")", ":", "if", "pieces", "[", "\"error\"", "]", ":", "return", "{", "\"version\"", ":", "\"unknown\"", ",", "\"full-revisionid\"", ":", "pieces", ".", "get", "(", "\"long\"", ")", ",", "\"dirty\"", ":", "Non...
https://github.com/geopandas/geopandas/blob/8e7133aef9e6c0d2465e07e92d954e95dedd3881/versioneer.py#L1634-L1673
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Util/_number_new.py
python
exact_div
(p, d, allow_divzero=False)
return n
Find and return an integer n such that p == n * d If no such integer exists, this function raises ValueError. Both operands must be integers. If the second operand is zero, this function will raise ZeroDivisionError unless allow_divzero is true (default: False).
Find and return an integer n such that p == n * d
[ "Find", "and", "return", "an", "integer", "n", "such", "that", "p", "==", "n", "*", "d" ]
def exact_div(p, d, allow_divzero=False): """Find and return an integer n such that p == n * d If no such integer exists, this function raises ValueError. Both operands must be integers. If the second operand is zero, this function will raise ZeroDivisionError unless allow_divzero is true (defaul...
[ "def", "exact_div", "(", "p", ",", "d", ",", "allow_divzero", "=", "False", ")", ":", "if", "not", "isinstance", "(", "p", ",", "(", "int", ",", "long", ")", ")", "or", "not", "isinstance", "(", "d", ",", "(", "int", ",", "long", ")", ")", ":",...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Util/_number_new.py#L93-L117
microsoft/NimbusML
f6be39ce9359786976429bab0ccd837e849b4ba5
src/python/nimbusml/linear_model/logisticregressionclassifier.py
python
LogisticRegressionClassifier.get_params
(self, deep=False)
return core.get_params(self)
Get the parameters for this operator.
Get the parameters for this operator.
[ "Get", "the", "parameters", "for", "this", "operator", "." ]
def get_params(self, deep=False): """ Get the parameters for this operator. """ return core.get_params(self)
[ "def", "get_params", "(", "self", ",", "deep", "=", "False", ")", ":", "return", "core", ".", "get_params", "(", "self", ")" ]
https://github.com/microsoft/NimbusML/blob/f6be39ce9359786976429bab0ccd837e849b4ba5/src/python/nimbusml/linear_model/logisticregressionclassifier.py#L252-L256
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/turtle.py
python
Tbuffer.__init__
(self, bufsize=10)
[]
def __init__(self, bufsize=10): self.bufsize = bufsize self.buffer = [[None]] * bufsize self.ptr = -1 self.cumulate = False
[ "def", "__init__", "(", "self", ",", "bufsize", "=", "10", ")", ":", "self", ".", "bufsize", "=", "bufsize", "self", ".", "buffer", "=", "[", "[", "None", "]", "]", "*", "bufsize", "self", ".", "ptr", "=", "-", "1", "self", ".", "cumulate", "=", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/turtle.py#L920-L924
weiaicunzai/Bag_of_Tricks_for_Image_Classification_with_Convolutional_Neural_Networks
7e8602f99bfb99b947ef128e6d002bb7d79a5886
dataset/dataset.py
python
compute_mean_and_std
(dataset)
return mean, std
Compute dataset mean and std, and normalize it Args: dataset: instance of CUB_200_2011_Train, CUB_200_2011_Test Returns: return: mean and std of this dataset
Compute dataset mean and std, and normalize it
[ "Compute", "dataset", "mean", "and", "std", "and", "normalize", "it" ]
def compute_mean_and_std(dataset): """Compute dataset mean and std, and normalize it Args: dataset: instance of CUB_200_2011_Train, CUB_200_2011_Test Returns: return: mean and std of this dataset """ mean_r = 0 mean_g = 0 mean_b = 0 for img, _ in dataset: ...
[ "def", "compute_mean_and_std", "(", "dataset", ")", ":", "mean_r", "=", "0", "mean_g", "=", "0", "mean_b", "=", "0", "for", "img", ",", "_", "in", "dataset", ":", "mean_b", "+=", "np", ".", "mean", "(", "img", "[", ":", ",", ":", ",", "0", "]", ...
https://github.com/weiaicunzai/Bag_of_Tricks_for_Image_Classification_with_Convolutional_Neural_Networks/blob/7e8602f99bfb99b947ef128e6d002bb7d79a5886/dataset/dataset.py#L139-L182
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/future/backports/email/_header_value_parser.py
python
Parameter.section_number
(self)
return self[1].number if self.sectioned else 0
[]
def section_number(self): # Because the first token, the attribute (name) eats CFWS, the second # token is always the section if there is one. return self[1].number if self.sectioned else 0
[ "def", "section_number", "(", "self", ")", ":", "# Because the first token, the attribute (name) eats CFWS, the second", "# token is always the section if there is one.", "return", "self", "[", "1", "]", ".", "number", "if", "self", ".", "sectioned", "else", "0" ]
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/email/_header_value_parser.py#L1034-L1037
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1beta1_endpoint.py
python
V1beta1Endpoint.addresses
(self)
return self._addresses
Gets the addresses of this V1beta1Endpoint. # noqa: E501 addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at leas...
Gets the addresses of this V1beta1Endpoint. # noqa: E501
[ "Gets", "the", "addresses", "of", "this", "V1beta1Endpoint", ".", "#", "noqa", ":", "E501" ]
def addresses(self): """Gets the addresses of this V1beta1Endpoint. # noqa: E501 addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabil...
[ "def", "addresses", "(", "self", ")", ":", "return", "self", ".", "_addresses" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_endpoint.py#L85-L93
0vercl0k/stuffz
2ff82f4739d7e215c6140d4987efa8310db39d55
llvm-funz/tiny_symbolic_execution_engine_z3.py
python
SymbolicExecutionEngine._check_if_reg32
(self, r)
return r.lower() in self.ctx
XXX: make a decorator?
XXX: make a decorator?
[ "XXX", ":", "make", "a", "decorator?" ]
def _check_if_reg32(self, r): '''XXX: make a decorator?''' return r.lower() in self.ctx
[ "def", "_check_if_reg32", "(", "self", ",", "r", ")", ":", "return", "r", ".", "lower", "(", ")", "in", "self", ".", "ctx" ]
https://github.com/0vercl0k/stuffz/blob/2ff82f4739d7e215c6140d4987efa8310db39d55/llvm-funz/tiny_symbolic_execution_engine_z3.py#L144-L146
ring04h/weakfilescan
b1a3066e3fdcd60b8ecf635526f49cb5ad603064
libs/requests/structures.py
python
CaseInsensitiveDict.__delitem__
(self, key)
[]
def __delitem__(self, key): del self._store[key.lower()]
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "del", "self", ".", "_store", "[", "key", ".", "lower", "(", ")", "]" ]
https://github.com/ring04h/weakfilescan/blob/b1a3066e3fdcd60b8ecf635526f49cb5ad603064/libs/requests/structures.py#L56-L57
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas/geometry/interpolation/tweening.py
python
tween_points
(points1, points2, num)
return tweens
Compute the interpolated points between two sets of points. Parameters ---------- points1 : list[point] The first set of points. points2 : list[point] The second set of points. num : int The number of interpolated sets to return. Returns ------- list[list[point]...
Compute the interpolated points between two sets of points.
[ "Compute", "the", "interpolated", "points", "between", "two", "sets", "of", "points", "." ]
def tween_points(points1, points2, num): """Compute the interpolated points between two sets of points. Parameters ---------- points1 : list[point] The first set of points. points2 : list[point] The second set of points. num : int The number of interpolated sets to retur...
[ "def", "tween_points", "(", "points1", ",", "points2", ",", "num", ")", ":", "vectors", "=", "[", "subtract_vectors", "(", "p2", ",", "p1", ")", "for", "p1", ",", "p2", "in", "zip", "(", "points1", ",", "points2", ")", "]", "tweens", "=", "[", "]",...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/geometry/interpolation/tweening.py#L17-L56
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
lib/sysinfo.py
python
_State._is_training
(self)
return len(sys.argv) > 1 and sys.argv[1].lower() == "train"
bool: ``True`` if this function has been called during a training session otherwise ``False``.
bool: ``True`` if this function has been called during a training session otherwise ``False``.
[ "bool", ":", "True", "if", "this", "function", "has", "been", "called", "during", "a", "training", "session", "otherwise", "False", "." ]
def _is_training(self): """ bool: ``True`` if this function has been called during a training session otherwise ``False``. """ return len(sys.argv) > 1 and sys.argv[1].lower() == "train"
[ "def", "_is_training", "(", "self", ")", ":", "return", "len", "(", "sys", ".", "argv", ")", ">", "1", "and", "sys", ".", "argv", "[", "1", "]", ".", "lower", "(", ")", "==", "\"train\"" ]
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/sysinfo.py#L368-L371
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/asyncio/base_events.py
python
BaseEventLoop.is_closed
(self)
return self._closed
Returns True if the event loop was closed.
Returns True if the event loop was closed.
[ "Returns", "True", "if", "the", "event", "loop", "was", "closed", "." ]
def is_closed(self): """Returns True if the event loop was closed.""" return self._closed
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "_closed" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/asyncio/base_events.py#L498-L500
pyserial/pyserial-asyncio
44d470181af989fb35fbe5062f47f8eaf5b7939a
serial_asyncio/__init__.py
python
SerialTransport.resume_reading
(self)
Resume the receiving end of the transport. Incoming data will be passed to the protocol's data_received() method until pause_reading() is called.
Resume the receiving end of the transport.
[ "Resume", "the", "receiving", "end", "of", "the", "transport", "." ]
def resume_reading(self): """Resume the receiving end of the transport. Incoming data will be passed to the protocol's data_received() method until pause_reading() is called. """ self._ensure_reader()
[ "def", "resume_reading", "(", "self", ")", ":", "self", ".", "_ensure_reader", "(", ")" ]
https://github.com/pyserial/pyserial-asyncio/blob/44d470181af989fb35fbe5062f47f8eaf5b7939a/serial_asyncio/__init__.py#L154-L160
poodarchu/Det3D
01258d8cb26656c5b950f8d41f9dcc1dd62a391e
det3d/visualization/netviz.py
python
make_dot
(var, params=None)
return dot
Produces Graphviz representation of PyTorch autograd graph. Blue nodes are the Variables that require grad, orange are Tensors saved for backward in torch.autograd.Function Args: var: output Variable params: dict of (name, Variable) to add names to node that require grad (TODO:...
Produces Graphviz representation of PyTorch autograd graph.
[ "Produces", "Graphviz", "representation", "of", "PyTorch", "autograd", "graph", "." ]
def make_dot(var, params=None): """ Produces Graphviz representation of PyTorch autograd graph. Blue nodes are the Variables that require grad, orange are Tensors saved for backward in torch.autograd.Function Args: var: output Variable params: dict of (name, Variable) to add names to n...
[ "def", "make_dot", "(", "var", ",", "params", "=", "None", ")", ":", "if", "params", "is", "not", "None", ":", "assert", "all", "(", "isinstance", "(", "p", ",", "Variable", ")", "for", "p", "in", "params", ".", "values", "(", ")", ")", "param_map"...
https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/visualization/netviz.py#L11-L81
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/docking/q_dock_item.py
python
QDockItem.manager
(self)
return self._manager
Get the dock manager for this dock item. Returns ------- result : DockManager or None The dock manager which is managing this item.
Get the dock manager for this dock item.
[ "Get", "the", "dock", "manager", "for", "this", "dock", "item", "." ]
def manager(self): """ Get the dock manager for this dock item. Returns ------- result : DockManager or None The dock manager which is managing this item. """ return self._manager
[ "def", "manager", "(", "self", ")", ":", "return", "self", ".", "_manager" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/docking/q_dock_item.py#L363-L372
facebookarchive/codemod
41d6eabad7b055a83923150efd5518813831c9a5
codemod/position.py
python
Position.__init__
(self, *path_and_line_number)
You can use the two parameter version, and pass a path and line number, or you can use the one parameter version, and pass a $path:$line_number string, or another instance of Position to copy.
You can use the two parameter version, and pass a path and line number, or you can use the one parameter version, and pass a $path:$line_number string, or another instance of Position to copy.
[ "You", "can", "use", "the", "two", "parameter", "version", "and", "pass", "a", "path", "and", "line", "number", "or", "you", "can", "use", "the", "one", "parameter", "version", "and", "pass", "a", "$path", ":", "$line_number", "string", "or", "another", ...
def __init__(self, *path_and_line_number): """ You can use the two parameter version, and pass a path and line number, or you can use the one parameter version, and pass a $path:$line_number string, or another instance of Position to copy. """ if len(path_...
[ "def", "__init__", "(", "self", ",", "*", "path_and_line_number", ")", ":", "if", "len", "(", "path_and_line_number", ")", "==", "2", ":", "self", ".", "path", ",", "self", ".", "line_number", "=", "path_and_line_number", "elif", "len", "(", "path_and_line_n...
https://github.com/facebookarchive/codemod/blob/41d6eabad7b055a83923150efd5518813831c9a5/codemod/position.py#L14-L38
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/wrapper.py
python
Wrapper.__getattr__
( self, key )
Delegate attribute lookup to our wrappedOperation
Delegate attribute lookup to our wrappedOperation
[ "Delegate", "attribute", "lookup", "to", "our", "wrappedOperation" ]
def __getattr__( self, key ): """Delegate attribute lookup to our wrappedOperation""" if key != 'wrappedOperation': return getattr( self.wrappedOperation, key ) raise AttributeError( key )
[ "def", "__getattr__", "(", "self", ",", "key", ")", ":", "if", "key", "!=", "'wrappedOperation'", ":", "return", "getattr", "(", "self", ".", "wrappedOperation", ",", "key", ")", "raise", "AttributeError", "(", "key", ")" ]
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/wrapper.py#L91-L95
stephenmcd/django-forms-builder
89fe03100ec09a6166cc0bf0022399bbbdca6298
forms_builder/forms/forms.py
python
FormForForm.email_to
(self)
return None
Return the value entered for the first field of type EmailField.
Return the value entered for the first field of type EmailField.
[ "Return", "the", "value", "entered", "for", "the", "first", "field", "of", "type", "EmailField", "." ]
def email_to(self): """ Return the value entered for the first field of type EmailField. """ for field in self.form_fields: if field.is_a(fields.EMAIL): return self.cleaned_data[field.slug] return None
[ "def", "email_to", "(", "self", ")", ":", "for", "field", "in", "self", ".", "form_fields", ":", "if", "field", ".", "is_a", "(", "fields", ".", "EMAIL", ")", ":", "return", "self", ".", "cleaned_data", "[", "field", ".", "slug", "]", "return", "None...
https://github.com/stephenmcd/django-forms-builder/blob/89fe03100ec09a6166cc0bf0022399bbbdca6298/forms_builder/forms/forms.py#L255-L262
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventDetails.member_change_external_id_details
(cls, val)
return cls('member_change_external_id_details', val)
Create an instance of this class set to the ``member_change_external_id_details`` tag with value ``val``. :param MemberChangeExternalIdDetails val: :rtype: EventDetails
Create an instance of this class set to the ``member_change_external_id_details`` tag with value ``val``.
[ "Create", "an", "instance", "of", "this", "class", "set", "to", "the", "member_change_external_id_details", "tag", "with", "value", "val", "." ]
def member_change_external_id_details(cls, val): """ Create an instance of this class set to the ``member_change_external_id_details`` tag with value ``val``. :param MemberChangeExternalIdDetails val: :rtype: EventDetails """ return cls('member_change_external_id...
[ "def", "member_change_external_id_details", "(", "cls", ",", "val", ")", ":", "return", "cls", "(", "'member_change_external_id_details'", ",", "val", ")" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L9576-L9584
rpryzant/neutralizing-bias
fd1358a217f064db28f436879da2d05e1ae44079
src/seq2seq/model.py
python
BilinearAttention.dot
(self, keys, query)
return torch.bmm(keys, query.unsqueeze(2)).squeeze(2)
keys: [B, T, H] query: [B, H]
keys: [B, T, H] query: [B, H]
[ "keys", ":", "[", "B", "T", "H", "]", "query", ":", "[", "B", "H", "]" ]
def dot(self, keys, query): """ keys: [B, T, H] query: [B, H] """ return torch.bmm(keys, query.unsqueeze(2)).squeeze(2)
[ "def", "dot", "(", "self", ",", "keys", ",", "query", ")", ":", "return", "torch", ".", "bmm", "(", "keys", ",", "query", ".", "unsqueeze", "(", "2", ")", ")", ".", "squeeze", "(", "2", ")" ]
https://github.com/rpryzant/neutralizing-bias/blob/fd1358a217f064db28f436879da2d05e1ae44079/src/seq2seq/model.py#L99-L104
Lextal/pspnet-pytorch
4eb6ab61287e837f5e2d8c1ae09fadeaa0e31e37
pspnet.py
python
PSPNet.__init__
(self, n_classes=18, sizes=(1, 2, 3, 6), psp_size=2048, deep_features_size=1024, backend='resnet34', pretrained=True)
[]
def __init__(self, n_classes=18, sizes=(1, 2, 3, 6), psp_size=2048, deep_features_size=1024, backend='resnet34', pretrained=True): super().__init__() self.feats = getattr(extractors, backend)(pretrained) self.psp = PSPModule(psp_size, 1024, sizes) self.drop_1 = nn.Dropou...
[ "def", "__init__", "(", "self", ",", "n_classes", "=", "18", ",", "sizes", "=", "(", "1", ",", "2", ",", "3", ",", "6", ")", ",", "psp_size", "=", "2048", ",", "deep_features_size", "=", "1024", ",", "backend", "=", "'resnet34'", ",", "pretrained", ...
https://github.com/Lextal/pspnet-pytorch/blob/4eb6ab61287e837f5e2d8c1ae09fadeaa0e31e37/pspnet.py#L44-L65
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/research_projects/seq2seq-distillation/utils.py
python
grad_status
(model: nn.Module)
return (par.requires_grad for par in model.parameters())
[]
def grad_status(model: nn.Module) -> Iterable: return (par.requires_grad for par in model.parameters())
[ "def", "grad_status", "(", "model", ":", "nn", ".", "Module", ")", "->", "Iterable", ":", "return", "(", "par", ".", "requires_grad", "for", "par", "in", "model", ".", "parameters", "(", ")", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/seq2seq-distillation/utils.py#L565-L566
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/analyses/decompiler/condition_processor.py
python
ConditionProcessor.sympy_expr_to_claripy_ast
(expr, memo: Dict)
[]
def sympy_expr_to_claripy_ast(expr, memo: Dict): if expr.is_Symbol: return memo[expr] if isinstance(expr, sympy.Or): return claripy.Or(*(ConditionProcessor.sympy_expr_to_claripy_ast(arg, memo) for arg in expr.args)) if isinstance(expr, sympy.And): return clari...
[ "def", "sympy_expr_to_claripy_ast", "(", "expr", ",", "memo", ":", "Dict", ")", ":", "if", "expr", ".", "is_Symbol", ":", "return", "memo", "[", "expr", "]", "if", "isinstance", "(", "expr", ",", "sympy", ".", "Or", ")", ":", "return", "claripy", ".", ...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/decompiler/condition_processor.py#L706-L719
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
lib/matplotlib/backends/backend_pdf.py
python
PdfPages.__init__
(self, filename, keep_empty=True, metadata=None)
Create a new PdfPages object. Parameters ---------- filename : str or path-like or file-like Plots using `PdfPages.savefig` will be written to a file at this location. The file is opened at once and any older file with the same name is overwritten. k...
Create a new PdfPages object.
[ "Create", "a", "new", "PdfPages", "object", "." ]
def __init__(self, filename, keep_empty=True, metadata=None): """ Create a new PdfPages object. Parameters ---------- filename : str or path-like or file-like Plots using `PdfPages.savefig` will be written to a file at this location. The file is opened at...
[ "def", "__init__", "(", "self", ",", "filename", ",", "keep_empty", "=", "True", ",", "metadata", "=", "None", ")", ":", "self", ".", "_file", "=", "PdfFile", "(", "filename", ",", "metadata", "=", "metadata", ")", "self", ".", "keep_empty", "=", "keep...
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backends/backend_pdf.py#L2639-L2665
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
pypy/tool/bench/result.py
python
PerfTable.annotate
(self, result)
return result
Try to put extra information for each revision on the PerfResult objects. These information are retrieved from a branch object.
Try to put extra information for each revision on the PerfResult objects. These information are retrieved from a branch object.
[ "Try", "to", "put", "extra", "information", "for", "each", "revision", "on", "the", "PerfResult", "objects", ".", "These", "information", "are", "retrieved", "from", "a", "branch", "object", "." ]
def annotate(self, result): """Try to put extra information for each revision on the PerfResult objects. These information are retrieved from a branch object. """ #if self.branch is None: # return result class Branch: revision_id = result.revision_i...
[ "def", "annotate", "(", "self", ",", "result", ")", ":", "#if self.branch is None:", "# return result", "class", "Branch", ":", "revision_id", "=", "result", ".", "revision_id", "nick", "=", "\"fake\"", "self", ".", "branch", "=", "Branch", "(", ")", "resul...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/tool/bench/result.py#L167-L203
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/keys.py
python
Key._toString_LSH
(self)
Return a public or private LSH key. See _fromString_PUBLIC_LSH and _fromString_PRIVATE_LSH for the key formats. @rtype: L{bytes}
Return a public or private LSH key. See _fromString_PUBLIC_LSH and _fromString_PRIVATE_LSH for the key formats.
[ "Return", "a", "public", "or", "private", "LSH", "key", ".", "See", "_fromString_PUBLIC_LSH", "and", "_fromString_PRIVATE_LSH", "for", "the", "key", "formats", "." ]
def _toString_LSH(self): """ Return a public or private LSH key. See _fromString_PUBLIC_LSH and _fromString_PRIVATE_LSH for the key formats. @rtype: L{bytes} """ data = self.data() type = self.type() if self.isPublic(): if type == 'RSA': ...
[ "def", "_toString_LSH", "(", "self", ")", ":", "data", "=", "self", ".", "data", "(", ")", "type", "=", "self", ".", "type", "(", ")", "if", "self", ".", "isPublic", "(", ")", ":", "if", "type", "==", "'RSA'", ":", "keyData", "=", "sexpy", ".", ...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/ssh/keys.py#L1296-L1346
adamcaudill/yawast
5e9e7a37831c030530adb971925ee135e9bfcafb
setup.py
python
get_install_reqs
()
[]
def get_install_reqs(): try: lf = Lockfile.load(root_path) return lf.requirements_list except AttributeError: # if it fails, return an empty list - lock file likely missing return []
[ "def", "get_install_reqs", "(", ")", ":", "try", ":", "lf", "=", "Lockfile", ".", "load", "(", "root_path", ")", "return", "lf", ".", "requirements_list", "except", "AttributeError", ":", "# if it fails, return an empty list - lock file likely missing", "return", "[",...
https://github.com/adamcaudill/yawast/blob/5e9e7a37831c030530adb971925ee135e9bfcafb/setup.py#L117-L124
yinghdb/EmbedMask
e9465cb72840113ef3f2ce73a3fe475acfeb0f8e
fcos/fcos.py
python
FCOS.overlay_class_names
(self, image, predictions)
return image
Adds detected class names and scores in the positions defined by the top-left corner of the predicted bounding box Arguments: image (np.ndarray): an image as returned by OpenCV predictions (BoxList): the result of the computation by the model. It should contain t...
Adds detected class names and scores in the positions defined by the top-left corner of the predicted bounding box
[ "Adds", "detected", "class", "names", "and", "scores", "in", "the", "positions", "defined", "by", "the", "top", "-", "left", "corner", "of", "the", "predicted", "bounding", "box" ]
def overlay_class_names(self, image, predictions): """ Adds detected class names and scores in the positions defined by the top-left corner of the predicted bounding box Arguments: image (np.ndarray): an image as returned by OpenCV predictions (BoxList): the resu...
[ "def", "overlay_class_names", "(", "self", ",", "image", ",", "predictions", ")", ":", "scores", "=", "predictions", ".", "get_field", "(", "\"scores\"", ")", ".", "tolist", "(", ")", "labels", "=", "predictions", ".", "get_field", "(", "\"labels\"", ")", ...
https://github.com/yinghdb/EmbedMask/blob/e9465cb72840113ef3f2ce73a3fe475acfeb0f8e/fcos/fcos.py#L355-L378
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/tado/sensor.py
python
TadoZoneSensor._async_update_callback
(self)
Update and write state.
Update and write state.
[ "Update", "and", "write", "state", "." ]
def _async_update_callback(self): """Update and write state.""" self._async_update_zone_data() self.async_write_ha_state()
[ "def", "_async_update_callback", "(", "self", ")", ":", "self", ".", "_async_update_zone_data", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tado/sensor.py#L277-L280
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
s2s-ft/s2s_ft/modeling_decoding.py
python
BertConfig.to_dict
(self)
return output
Serializes this instance to a Python dictionary.
Serializes this instance to a Python dictionary.
[ "Serializes", "this", "instance", "to", "a", "Python", "dictionary", "." ]
def to_dict(self): """Serializes this instance to a Python dictionary.""" output = copy.deepcopy(self.__dict__) return output
[ "def", "to_dict", "(", "self", ")", ":", "output", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "return", "output" ]
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/s2s-ft/s2s_ft/modeling_decoding.py#L205-L208
lawsie/guizero
1c3011a3b0930175beaec3aa2f5503bf9339a0a3
guizero/event.py
python
EventManager.set_event
(self, ref, tk_event, callback)
Sets a callback for this widget against a ref (reference) for a tk_event, setting the callback to None will remove it.
Sets a callback for this widget against a ref (reference) for a tk_event, setting the callback to None will remove it.
[ "Sets", "a", "callback", "for", "this", "widget", "against", "a", "ref", "(", "reference", ")", "for", "a", "tk_event", "setting", "the", "callback", "to", "None", "will", "remove", "it", "." ]
def set_event(self, ref, tk_event, callback): """ Sets a callback for this widget against a ref (reference) for a tk_event, setting the callback to None will remove it. """ # has an EventCallback been created for this tk event if tk_event not in self._event_callbacks: ...
[ "def", "set_event", "(", "self", ",", "ref", ",", "tk_event", ",", "callback", ")", ":", "# has an EventCallback been created for this tk event", "if", "tk_event", "not", "in", "self", ".", "_event_callbacks", ":", "self", ".", "_event_callbacks", "[", "tk_event", ...
https://github.com/lawsie/guizero/blob/1c3011a3b0930175beaec3aa2f5503bf9339a0a3/guizero/event.py#L190-L203
jquast/x84
11f445bb82e6e895d7cce57d4c6d8572d1981162
x84/engine.py
python
accept
(log, server, check_ban)
Accept new connection from server, spawning an unmanaged thread. Connecting socket accepted is server.server_socket, instantiate a new instance of client_factory, with optional keyword arguments defined by server.client_factory_kwargs, registering it with dictionary server.clients, and spawning an unma...
Accept new connection from server, spawning an unmanaged thread.
[ "Accept", "new", "connection", "from", "server", "spawning", "an", "unmanaged", "thread", "." ]
def accept(log, server, check_ban): """ Accept new connection from server, spawning an unmanaged thread. Connecting socket accepted is server.server_socket, instantiate a new instance of client_factory, with optional keyword arguments defined by server.client_factory_kwargs, registering it with ...
[ "def", "accept", "(", "log", ",", "server", ",", "check_ban", ")", ":", "if", "None", "in", "(", "server", ".", "client_factory", ",", "server", ".", "connect_factory", ")", ":", "raise", "NotImplementedError", "(", "\"No accept for server class {server.__class__....
https://github.com/jquast/x84/blob/11f445bb82e6e895d7cce57d4c6d8572d1981162/x84/engine.py#L137-L199
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/asynchat.py
python
async_chat.close_when_done
(self)
automatically close this channel once the outgoing queue is empty
automatically close this channel once the outgoing queue is empty
[ "automatically", "close", "this", "channel", "once", "the", "outgoing", "queue", "is", "empty" ]
def close_when_done (self): "automatically close this channel once the outgoing queue is empty" self.producer_fifo.append(None)
[ "def", "close_when_done", "(", "self", ")", ":", "self", ".", "producer_fifo", ".", "append", "(", "None", ")" ]
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/asynchat.py#L211-L213
Miserlou/Zappa
5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39
zappa/core.py
python
Zappa.get_current_venv
()
return venv
Returns the path to the current virtualenv
Returns the path to the current virtualenv
[ "Returns", "the", "path", "to", "the", "current", "virtualenv" ]
def get_current_venv(): """ Returns the path to the current virtualenv """ if 'VIRTUAL_ENV' in os.environ: venv = os.environ['VIRTUAL_ENV'] elif os.path.exists('.python-version'): # pragma: no cover try: subprocess.check_output(['pyenv', '...
[ "def", "get_current_venv", "(", ")", ":", "if", "'VIRTUAL_ENV'", "in", "os", ".", "environ", ":", "venv", "=", "os", ".", "environ", "[", "'VIRTUAL_ENV'", "]", "elif", "os", ".", "path", ".", "exists", "(", "'.python-version'", ")", ":", "# pragma: no cove...
https://github.com/Miserlou/Zappa/blob/5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39/zappa/core.py#L446-L466
datastax/python-driver
5fdb0061f56f53b9d8d8ad67b99110899653ad77
cassandra/encoder.py
python
Encoder.cql_encode_set_collection
(self, val)
return '{%s}' % ', '.join(self.mapping.get(type(v), self.cql_encode_object)(v) for v in val)
Converts a sequence to a string of the form ``{item1, item2, ...}``. This is suitable for ``set`` type columns.
Converts a sequence to a string of the form ``{item1, item2, ...}``. This is suitable for ``set`` type columns.
[ "Converts", "a", "sequence", "to", "a", "string", "of", "the", "form", "{", "item1", "item2", "...", "}", ".", "This", "is", "suitable", "for", "set", "type", "columns", "." ]
def cql_encode_set_collection(self, val): """ Converts a sequence to a string of the form ``{item1, item2, ...}``. This is suitable for ``set`` type columns. """ return '{%s}' % ', '.join(self.mapping.get(type(v), self.cql_encode_object)(v) for v in val)
[ "def", "cql_encode_set_collection", "(", "self", ",", "val", ")", ":", "return", "'{%s}'", "%", "', '", ".", "join", "(", "self", ".", "mapping", ".", "get", "(", "type", "(", "v", ")", ",", "self", ".", "cql_encode_object", ")", "(", "v", ")", "for"...
https://github.com/datastax/python-driver/blob/5fdb0061f56f53b9d8d8ad67b99110899653ad77/cassandra/encoder.py#L226-L231
brendano/tweetmotif
1b0b1e3a941745cd5a26eba01f554688b7c4b27e
everything_else/djfrontend/django-1.0.2/views/decorators/cache.py
python
never_cache
(view_func)
return wraps(view_func)(_wrapped_view_func)
Decorator that adds headers to a response so that it will never be cached.
Decorator that adds headers to a response so that it will never be cached.
[ "Decorator", "that", "adds", "headers", "to", "a", "response", "so", "that", "it", "will", "never", "be", "cached", "." ]
def never_cache(view_func): """ Decorator that adds headers to a response so that it will never be cached. """ def _wrapped_view_func(request, *args, **kwargs): response = view_func(request, *args, **kwargs) add_never_cache_headers(response) return response return wraps(v...
[ "def", "never_cache", "(", "view_func", ")", ":", "def", "_wrapped_view_func", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "view_func", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", "add_never...
https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/views/decorators/cache.py#L38-L47
pytransitions/transitions
9663094f4566c016b11563e7a7d6d3802593845c
transitions/extensions/asyncio.py
python
AsyncTransition.execute
(self, event_data)
return True
Executes the transition. Args: event_data: An instance of class EventData. Returns: boolean indicating whether or not the transition was successfully executed (True if successful, False if not).
Executes the transition. Args: event_data: An instance of class EventData. Returns: boolean indicating whether or not the transition was successfully executed (True if successful, False if not).
[ "Executes", "the", "transition", ".", "Args", ":", "event_data", ":", "An", "instance", "of", "class", "EventData", ".", "Returns", ":", "boolean", "indicating", "whether", "or", "not", "the", "transition", "was", "successfully", "executed", "(", "True", "if",...
async def execute(self, event_data): """ Executes the transition. Args: event_data: An instance of class EventData. Returns: boolean indicating whether or not the transition was successfully executed (True if successful, False if not). """ _LOGGER.debug("%...
[ "async", "def", "execute", "(", "self", ",", "event_data", ")", ":", "_LOGGER", ".", "debug", "(", "\"%sInitiating transition from state %s to state %s...\"", ",", "event_data", ".", "machine", ".", "name", ",", "self", ".", "source", ",", "self", ".", "dest", ...
https://github.com/pytransitions/transitions/blob/9663094f4566c016b11563e7a7d6d3802593845c/transitions/extensions/asyncio.py#L105-L135
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/xiaomi_aqara/__init__.py
python
XiaomiDevice.parse_voltage
(self, data)
return True
Parse battery level data sent by gateway.
Parse battery level data sent by gateway.
[ "Parse", "battery", "level", "data", "sent", "by", "gateway", "." ]
def parse_voltage(self, data): """Parse battery level data sent by gateway.""" if "voltage" in data: voltage_key = "voltage" elif "battery_voltage" in data: voltage_key = "battery_voltage" else: return False max_volt = 3300 min_volt = ...
[ "def", "parse_voltage", "(", "self", ",", "data", ")", ":", "if", "\"voltage\"", "in", "data", ":", "voltage_key", "=", "\"voltage\"", "elif", "\"battery_voltage\"", "in", "data", ":", "voltage_key", "=", "\"battery_voltage\"", "else", ":", "return", "False", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_aqara/__init__.py#L354-L371
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
Lib/_abcoll.py
python
MutableSet.remove
(self, value)
Remove an element. If not a member, raise a KeyError.
Remove an element. If not a member, raise a KeyError.
[ "Remove", "an", "element", ".", "If", "not", "a", "member", "raise", "a", "KeyError", "." ]
def remove(self, value): """Remove an element. If not a member, raise a KeyError.""" if value not in self: raise KeyError(value) self.discard(value)
[ "def", "remove", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "self", ":", "raise", "KeyError", "(", "value", ")", "self", ".", "discard", "(", "value", ")" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/_abcoll.py#L274-L278
alichtman/shallow-backup
883df28772cb3f6aabcfb03563e0876a4d972f2a
shallow_backup/utils.py
python
strip_home
(full_path)
Removes the path to $HOME from the front of the absolute path, if it's there
Removes the path to $HOME from the front of the absolute path, if it's there
[ "Removes", "the", "path", "to", "$HOME", "from", "the", "front", "of", "the", "absolute", "path", "if", "it", "s", "there" ]
def strip_home(full_path): """Removes the path to $HOME from the front of the absolute path, if it's there""" home_path = os.path.expanduser("~") if full_path.startswith(home_path): return full_path.replace(home_path + "/", "") else: return full_path
[ "def", "strip_home", "(", "full_path", ")", ":", "home_path", "=", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", "if", "full_path", ".", "startswith", "(", "home_path", ")", ":", "return", "full_path", ".", "replace", "(", "home_path", "+", "\...
https://github.com/alichtman/shallow-backup/blob/883df28772cb3f6aabcfb03563e0876a4d972f2a/shallow_backup/utils.py#L226-L232
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/requests/models.py
python
RequestEncodingMixin._encode_files
(files, data)
return body, content_type
Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filenam...
Build the body for a multipart/form-data request.
[ "Build", "the", "body", "for", "a", "multipart", "/", "form", "-", "data", "request", "." ]
def _encode_files(files, data): """Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tu...
[ "def", "_encode_files", "(", "files", ",", "data", ")", ":", "if", "(", "not", "files", ")", ":", "raise", "ValueError", "(", "\"Files must be provided.\"", ")", "elif", "isinstance", "(", "data", ",", "basestring", ")", ":", "raise", "ValueError", "(", "\...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/requests/models.py#L103-L160
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_scale.py
python
Yedit.exists
(self, path, value)
return entry == value
check if value exists at path
check if value exists at path
[ "check", "if", "value", "exists", "at", "path" ]
def exists(self, path, value): ''' check if value exists at path''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if isinstance(entry, list): if value in entry: return True ...
[ "def", "exists", "(", "self", ",", "path", ",", "value", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except", "KeyError", ":", "entry", "=", "None", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_scale.py#L496-L521
OpenBazaar/OpenBazaar-Server
6bfd8f0c899d7133dadd38d1afdd537a2e182ff1
market/transactions.py
python
BitcoinTransaction.create_signature
(self, privkey, reedem_script)
return signatures
Exports a raw signature suitable for use in a multisig transaction
Exports a raw signature suitable for use in a multisig transaction
[ "Exports", "a", "raw", "signature", "suitable", "for", "use", "in", "a", "multisig", "transaction" ]
def create_signature(self, privkey, reedem_script): """ Exports a raw signature suitable for use in a multisig transaction """ seckey = CBitcoinSecret.from_secret_bytes(x(bitcointools.encode_privkey(privkey, "hex"))) signatures = [] for i in range(len(self.tx.vin)): ...
[ "def", "create_signature", "(", "self", ",", "privkey", ",", "reedem_script", ")", ":", "seckey", "=", "CBitcoinSecret", ".", "from_secret_bytes", "(", "x", "(", "bitcointools", ".", "encode_privkey", "(", "privkey", ",", "\"hex\"", ")", ")", ")", "signatures"...
https://github.com/OpenBazaar/OpenBazaar-Server/blob/6bfd8f0c899d7133dadd38d1afdd537a2e182ff1/market/transactions.py#L90-L103
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/keystone/keystone/openstack/common/policy.py
python
AndCheck.add_check
(self, rule)
return self
Allows addition of another rule to the list of rules that will be tested. Returns the AndCheck object for convenience.
Allows addition of another rule to the list of rules that will be tested. Returns the AndCheck object for convenience.
[ "Allows", "addition", "of", "another", "rule", "to", "the", "list", "of", "rules", "that", "will", "be", "tested", ".", "Returns", "the", "AndCheck", "object", "for", "convenience", "." ]
def add_check(self, rule): """ Allows addition of another rule to the list of rules that will be tested. Returns the AndCheck object for convenience. """ self.rules.append(rule) return self
[ "def", "add_check", "(", "self", ",", "rule", ")", ":", "self", ".", "rules", ".", "append", "(", "rule", ")", "return", "self" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/keystone/keystone/openstack/common/policy.py#L328-L335
mcs07/ChemDataExtractor
349a3bea965f2073141d62043b89319222e46af1
chemdataextractor/utils.py
python
flatten
(x)
return result
Return a single flat list containing elements from nested lists.
Return a single flat list containing elements from nested lists.
[ "Return", "a", "single", "flat", "list", "containing", "elements", "from", "nested", "lists", "." ]
def flatten(x): """Return a single flat list containing elements from nested lists.""" result = [] for el in x: if hasattr(el, '__iter__') and not isinstance(el, six.string_types): result.extend(flatten(el)) else: result.append(el) return result
[ "def", "flatten", "(", "x", ")", ":", "result", "=", "[", "]", "for", "el", "in", "x", ":", "if", "hasattr", "(", "el", ",", "'__iter__'", ")", "and", "not", "isinstance", "(", "el", ",", "six", ".", "string_types", ")", ":", "result", ".", "exte...
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/utils.py#L73-L81
sunnyxiaohu/R-C3D.pytorch
e8731af7b95f1dc934f6604f9c09e3c4ead74db5
lib/tf_model_zoo/models/inception/inception/inception_train.py
python
train
(dataset)
Train on dataset for a number of steps.
Train on dataset for a number of steps.
[ "Train", "on", "dataset", "for", "a", "number", "of", "steps", "." ]
def train(dataset): """Train on dataset for a number of steps.""" with tf.Graph().as_default(), tf.device('/cpu:0'): # Create a variable to count the number of train() calls. This equals the # number of batches processed * FLAGS.num_gpus. global_step = tf.get_variable( 'global_step', [], ...
[ "def", "train", "(", "dataset", ")", ":", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", ",", "tf", ".", "device", "(", "'/cpu:0'", ")", ":", "# Create a variable to count the number of train() calls. This equals the", "# number of batches proces...
https://github.com/sunnyxiaohu/R-C3D.pytorch/blob/e8731af7b95f1dc934f6604f9c09e3c4ead74db5/lib/tf_model_zoo/models/inception/inception/inception_train.py#L180-L355
idanr1986/cuckoo-droid
1350274639473d3d2b0ac740cae133ca53ab7444
analyzer/android_on_linux/lib/api/androguard/dvm.py
python
EncodedCatchHandlerList.get_list
(self)
return self.list
Return the actual list of handler lists, represented directly (not as offsets), and concatenated sequentially :rtype: a list of :class:`EncodedCatchHandler` objects
Return the actual list of handler lists, represented directly (not as offsets), and concatenated sequentially
[ "Return", "the", "actual", "list", "of", "handler", "lists", "represented", "directly", "(", "not", "as", "offsets", ")", "and", "concatenated", "sequentially" ]
def get_list(self) : """ Return the actual list of handler lists, represented directly (not as offsets), and concatenated sequentially :rtype: a list of :class:`EncodedCatchHandler` objects """ return self.list
[ "def", "get_list", "(", "self", ")", ":", "return", "self", ".", "list" ]
https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android_on_linux/lib/api/androguard/dvm.py#L3599-L3605
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/bs4/dammit.py
python
UnicodeDammit._to_unicode
(self, data, encoding, errors="strict")
return str(data, encoding, errors)
Given a string and its encoding, decodes the string into Unicode. %encoding is a string recognized by encodings.aliases
Given a string and its encoding, decodes the string into Unicode. %encoding is a string recognized by encodings.aliases
[ "Given", "a", "string", "and", "its", "encoding", "decodes", "the", "string", "into", "Unicode", ".", "%encoding", "is", "a", "string", "recognized", "by", "encodings", ".", "aliases" ]
def _to_unicode(self, data, encoding, errors="strict"): '''Given a string and its encoding, decodes the string into Unicode. %encoding is a string recognized by encodings.aliases''' return str(data, encoding, errors)
[ "def", "_to_unicode", "(", "self", ",", "data", ",", "encoding", ",", "errors", "=", "\"strict\"", ")", ":", "return", "str", "(", "data", ",", "encoding", ",", "errors", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/bs4/dammit.py#L438-L441
determined-ai/determined
f637264493acc14f12e66550cb51c520b5d27f6c
harness/determined/common/experimental/determined.py
python
Determined.get_checkpoint
(self, uuid: str)
return checkpoint.Checkpoint.from_json(r["checkpoint"], self._session)
Get the :class:`~determined.experimental.Checkpoint` representing the checkpoint with the provided UUID.
Get the :class:`~determined.experimental.Checkpoint` representing the checkpoint with the provided UUID.
[ "Get", "the", ":", "class", ":", "~determined", ".", "experimental", ".", "Checkpoint", "representing", "the", "checkpoint", "with", "the", "provided", "UUID", "." ]
def get_checkpoint(self, uuid: str) -> checkpoint.Checkpoint: """ Get the :class:`~determined.experimental.Checkpoint` representing the checkpoint with the provided UUID. """ r = self._session.get("/api/v1/checkpoints/{}".format(uuid)).json() return checkpoint.Checkpoint....
[ "def", "get_checkpoint", "(", "self", ",", "uuid", ":", "str", ")", "->", "checkpoint", ".", "Checkpoint", ":", "r", "=", "self", ".", "_session", ".", "get", "(", "\"/api/v1/checkpoints/{}\"", ".", "format", "(", "uuid", ")", ")", ".", "json", "(", ")...
https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/harness/determined/common/experimental/determined.py#L128-L134
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
frontend/option_def.py
python
_Init
(opt_def)
[]
def _Init(opt_def): # type: (_OptionDef) -> None opt_def.Add('errexit', short_flag='e', builtin='set', groups=['oil:basic', 'oil:all']) opt_def.Add('nounset', short_flag='u', builtin='set', groups=['oil:basic', 'oil:all']) opt_def.Add('pipefail', builtin='set', group...
[ "def", "_Init", "(", "opt_def", ")", ":", "# type: (_OptionDef) -> None", "opt_def", ".", "Add", "(", "'errexit'", ",", "short_flag", "=", "'e'", ",", "builtin", "=", "'set'", ",", "groups", "=", "[", "'oil:basic'", ",", "'oil:all'", "]", ")", "opt_def", "...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/frontend/option_def.py#L229-L313
PaddlePaddle/PaddleSpeech
26524031d242876b7fdb71582b0b3a7ea45c7d9d
paddlespeech/s2t/decoders/beam_search/beam_search.py
python
BeamSearch.forward
(self, x: paddle.Tensor, maxlenratio: float=0.0, minlenratio: float=0.0)
return nbest_hyps
Perform beam search. Args: x (paddle.Tensor): Encoded speech feature (T, D) maxlenratio (float): Input length ratio to obtain max output length. If maxlenratio=0.0 (default), it uses a end-detect function to automatically find maximum hypothesis lengt...
Perform beam search.
[ "Perform", "beam", "search", "." ]
def forward(self, x: paddle.Tensor, maxlenratio: float=0.0, minlenratio: float=0.0) -> List[Hypothesis]: """Perform beam search. Args: x (paddle.Tensor): Encoded speech feature (T, D) maxlenratio (float): Input length ratio to obta...
[ "def", "forward", "(", "self", ",", "x", ":", "paddle", ".", "Tensor", ",", "maxlenratio", ":", "float", "=", "0.0", ",", "minlenratio", ":", "float", "=", "0.0", ")", "->", "List", "[", "Hypothesis", "]", ":", "# set length bounds", "if", "maxlenratio",...
https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/s2t/decoders/beam_search/beam_search.py#L352-L430
magenta/ddsp
8536a366c7834908f418a6721547268e8f2083cc
ddsp/training/data.py
python
RecordProvider.default_file_pattern
(self)
Used if file_pattern is not provided to constructor.
Used if file_pattern is not provided to constructor.
[ "Used", "if", "file_pattern", "is", "not", "provided", "to", "constructor", "." ]
def default_file_pattern(self): """Used if file_pattern is not provided to constructor.""" raise NotImplementedError( 'You must pass a "file_pattern" argument to the constructor or ' 'choose a FileDataProvider with a default_file_pattern.')
[ "def", "default_file_pattern", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'You must pass a \"file_pattern\" argument to the constructor or '", "'choose a FileDataProvider with a default_file_pattern.'", ")" ]
https://github.com/magenta/ddsp/blob/8536a366c7834908f418a6721547268e8f2083cc/ddsp/training/data.py#L198-L202
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py
python
indentedBlock
(blockStatementExpr, indentStack, indent=True)
return smExpr.setName('indented block')
Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - blockStatementExpr - expression defining syntax of statement that is repeated within the indented block - indentStack - list created by caller ...
Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code.
[ "Helper", "method", "for", "defining", "space", "-", "delimited", "indentation", "blocks", "such", "as", "those", "used", "to", "define", "block", "statements", "in", "Python", "source", "code", "." ]
def indentedBlock(blockStatementExpr, indentStack, indent=True): """ Helper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - blockStatementExpr - expression defining syntax of statement that is re...
[ "def", "indentedBlock", "(", "blockStatementExpr", ",", "indentStack", ",", "indent", "=", "True", ")", ":", "def", "checkPeerIndent", "(", "s", ",", "l", ",", "t", ")", ":", "if", "l", ">=", "len", "(", "s", ")", ":", "return", "curCol", "=", "col",...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L5201-L5313
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/distutils/commands/bdist_pex.py
python
bdist_pex.run
(self)
[]
def run(self): parser = configure_clp() options = parser.parse_args(self.pex_args) if options.entry_point or options.script or options.pex_name: die( "Must not specify entry point, script or output file to --pex-args, given: {}".format( " ".join(s...
[ "def", "run", "(", "self", ")", ":", "parser", "=", "configure_clp", "(", ")", "options", "=", "parser", ".", "parse_args", "(", "self", ".", "pex_args", ")", "if", "options", ".", "entry_point", "or", "options", ".", "script", "or", "options", ".", "p...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/distutils/commands/bdist_pex.py#L75-L142
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas_rhino/conversions/_geometry.py
python
RhinoGeometry.transform
(self, T)
Transform the Rhino object. Parameters ---------- T : :class:`compas.geometry.Transformation` or Rhino.Geomtry.Transform The transformation matrix. Returns ------- None The Rhino object is transformed in place.
Transform the Rhino object.
[ "Transform", "the", "Rhino", "object", "." ]
def transform(self, T): """Transform the Rhino object. Parameters ---------- T : :class:`compas.geometry.Transformation` or Rhino.Geomtry.Transform The transformation matrix. Returns ------- None The Rhino object is transformed in place. ...
[ "def", "transform", "(", "self", ",", "T", ")", ":", "if", "not", "isinstance", "(", "T", ",", "Rhino", ".", "Geometry", ".", "Transform", ")", ":", "M", "=", "Rhino", ".", "Geometry", ".", "Transform", "(", "0.0", ")", "for", "i", "in", "range", ...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas_rhino/conversions/_geometry.py#L158-L178
ynhacler/RedKindle
7c970920dc840f869e38cbda480d630cc2e7b200
lib/feedparser.py
python
_BaseHTMLProcessor.output
(self)
return ''.join([str(p) for p in self.pieces])
Return processed HTML as a single string
Return processed HTML as a single string
[ "Return", "processed", "HTML", "as", "a", "single", "string" ]
def output(self): '''Return processed HTML as a single string''' return ''.join([str(p) for p in self.pieces])
[ "def", "output", "(", "self", ")", ":", "return", "''", ".", "join", "(", "[", "str", "(", "p", ")", "for", "p", "in", "self", ".", "pieces", "]", ")" ]
https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/lib/feedparser.py#L2041-L2043
ivre/ivre
5728855b51c0ae2e59450a1c3a782febcad2128b
ivre/tools/zeek2db.py
python
main
()
Update the flow database from Zeek logs
Update the flow database from Zeek logs
[ "Update", "the", "flow", "database", "from", "Zeek", "logs" ]
def main() -> None: """Update the flow database from Zeek logs""" parser = ArgumentParser(description=__doc__) parser.add_argument("logfiles", nargs="*", metavar="FILE", help="Zeek log files") parser.add_argument("-v", "--verbose", help="verbose mode", action="store_true") parser.add_argument( ...
[ "def", "main", "(", ")", "->", "None", ":", "parser", "=", "ArgumentParser", "(", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "\"logfiles\"", ",", "nargs", "=", "\"*\"", ",", "metavar", "=", "\"FILE\"", ",", "help", "=", "\"Ze...
https://github.com/ivre/ivre/blob/5728855b51c0ae2e59450a1c3a782febcad2128b/ivre/tools/zeek2db.py#L131-L171