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
skelsec/jackdaw
5fd4c2123025b3314ba44408e0b6dc88eeb5479d
jackdaw/external/aiocmd/aiocmd/aiocmd.py
python
PromptToolkitCmd._on_close
(self)
Optional hook to call on closing the cmd
Optional hook to call on closing the cmd
[ "Optional", "hook", "to", "call", "on", "closing", "the", "cmd" ]
def _on_close(self): """Optional hook to call on closing the cmd""" pass
[ "def", "_on_close", "(", "self", ")", ":", "pass" ]
https://github.com/skelsec/jackdaw/blob/5fd4c2123025b3314ba44408e0b6dc88eeb5479d/jackdaw/external/aiocmd/aiocmd/aiocmd.py#L157-L159
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py
python
Node.appendChild
(self, node)
Insert node as a child of the current node :arg node: the node to insert
Insert node as a child of the current node
[ "Insert", "node", "as", "a", "child", "of", "the", "current", "node" ]
def appendChild(self, node): """Insert node as a child of the current node :arg node: the node to insert """ raise NotImplementedError
[ "def", "appendChild", "(", "self", ",", "node", ")", ":", "raise", "NotImplementedError" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py#L57-L63
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/contrib/wagtailapi/apps.py
python
WagtailAPIAppConfig.ready
(self)
[]
def ready(self): # Install cache purging signal handlers if getattr(settings, 'WAGTAILAPI_USE_FRONTENDCACHE', False): if apps.is_installed('wagtail.contrib.wagtailfrontendcache'): from wagtail.contrib.wagtailapi.signal_handlers import register_signal_handlers ...
[ "def", "ready", "(", "self", ")", ":", "# Install cache purging signal handlers", "if", "getattr", "(", "settings", ",", "'WAGTAILAPI_USE_FRONTENDCACHE'", ",", "False", ")", ":", "if", "apps", ".", "is_installed", "(", "'wagtail.contrib.wagtailfrontendcache'", ")", ":...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/contrib/wagtailapi/apps.py#L13-L29
graalvm/mx
29c0debab406352df3af246be2f8973be5db69ae
mx_cmake.py
python
CMakeNinjaProject._build_task
(self, target_arch, args)
return CMakeNinjaBuildTask(args, self, target_arch, self._ninja_targets)
[]
def _build_task(self, target_arch, args): return CMakeNinjaBuildTask(args, self, target_arch, self._ninja_targets)
[ "def", "_build_task", "(", "self", ",", "target_arch", ",", "args", ")", ":", "return", "CMakeNinjaBuildTask", "(", "args", ",", "self", ",", "target_arch", ",", "self", ".", "_ninja_targets", ")" ]
https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_cmake.py#L125-L126
src-d/ml
db23fb14fc93dece05b434342def5f77b01c6cc3
sourced/ml/transformers/transformer.py
python
Transformer.explode
(self, head=None)
return self._explode(head, pipeline)
Execute all the branches in the tree going from the node. The node itself is execute()-ed. :param head: The input to feed to the root. Can be None - the default one \ will be used if possible. :return: The results from all the leaves.
Execute all the branches in the tree going from the node. The node itself is execute()-ed. :param head: The input to feed to the root. Can be None - the default one \ will be used if possible. :return: The results from all the leaves.
[ "Execute", "all", "the", "branches", "in", "the", "tree", "going", "from", "the", "node", ".", "The", "node", "itself", "is", "execute", "()", "-", "ed", ".", ":", "param", "head", ":", "The", "input", "to", "feed", "to", "the", "root", ".", "Can", ...
def explode(self, head=None): """ Execute all the branches in the tree going from the node. The node itself is execute()-ed. :param head: The input to feed to the root. Can be None - the default one \ will be used if possible. :return: The results from all th...
[ "def", "explode", "(", "self", ",", "head", "=", "None", ")", ":", "head", "=", "self", ".", "execute", "(", "head", ")", "pipeline", "=", "[", "self", "]", "node", "=", "self", "while", "node", ".", "parent", "is", "not", "None", ":", "node", "=...
https://github.com/src-d/ml/blob/db23fb14fc93dece05b434342def5f77b01c6cc3/sourced/ml/transformers/transformer.py#L86-L101
savio-code/fern-wifi-cracker
0da03aba988c66dfa131a45824568abb84b7704a
Fern-Wifi-Cracker/core/toolbox/fern_ray_fusion.py
python
Ray_Fusion.HTTP_HTTPS_Mode
(self)
[]
def HTTP_HTTPS_Mode(self): self.port_edit.setVisible(False) self.label.setPixmap(self.http_https_pixmap) self.target_edit.clear() self.target_edit.setFocus()
[ "def", "HTTP_HTTPS_Mode", "(", "self", ")", ":", "self", ".", "port_edit", ".", "setVisible", "(", "False", ")", "self", ".", "label", ".", "setPixmap", "(", "self", ".", "http_https_pixmap", ")", "self", ".", "target_edit", ".", "clear", "(", ")", "self...
https://github.com/savio-code/fern-wifi-cracker/blob/0da03aba988c66dfa131a45824568abb84b7704a/Fern-Wifi-Cracker/core/toolbox/fern_ray_fusion.py#L90-L94
edwardlib/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
observations/r/randu.py
python
randu
(path)
return x_train, metadata
Random Numbers from Congruential Generator RANDU 400 triples of successive random numbers were taken from the VAX FORTRAN function RANDU running under VMS 1.5. A data frame with 400 observations on 3 variables named `x`, `y` and `z` which give the first, second and third random number in the triple. Davi...
Random Numbers from Congruential Generator RANDU
[ "Random", "Numbers", "from", "Congruential", "Generator", "RANDU" ]
def randu(path): """Random Numbers from Congruential Generator RANDU 400 triples of successive random numbers were taken from the VAX FORTRAN function RANDU running under VMS 1.5. A data frame with 400 observations on 3 variables named `x`, `y` and `z` which give the first, second and third random number in...
[ "def", "randu", "(", "path", ")", ":", "import", "pandas", "as", "pd", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "filename", "=", "'randu.csv'", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", ...
https://github.com/edwardlib/observations/blob/2c8b1ac31025938cb17762e540f2f592e302d5de/observations/r/randu.py#L14-L51
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/metrics/paice.py
python
_count_intersection
(l1, l2)
return (x, y)
Count intersection between two line segments defined by coordinate pairs. :param l1: Tuple of two coordinate pairs defining the first line segment :param l2: Tuple of two coordinate pairs defining the second line segment :type l1: tuple(float, float) :type l2: tuple(float, float) :return: Coordinat...
Count intersection between two line segments defined by coordinate pairs.
[ "Count", "intersection", "between", "two", "line", "segments", "defined", "by", "coordinate", "pairs", "." ]
def _count_intersection(l1, l2): """Count intersection between two line segments defined by coordinate pairs. :param l1: Tuple of two coordinate pairs defining the first line segment :param l2: Tuple of two coordinate pairs defining the second line segment :type l1: tuple(float, float) :type l2: tu...
[ "def", "_count_intersection", "(", "l1", ",", "l2", ")", ":", "x1", ",", "y1", "=", "l1", "[", "0", "]", "x2", ",", "y2", "=", "l1", "[", "1", "]", "x3", ",", "y3", "=", "l2", "[", "0", "]", "x4", ",", "y4", "=", "l2", "[", "1", "]", "d...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/metrics/paice.py#L64-L96
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/boxmove.py
python
BoxMoveData.is_empty
(self)
return False
[]
def is_empty(self): if len(self.track_selections) == 0: return True return False
[ "def", "is_empty", "(", "self", ")", ":", "if", "len", "(", "self", ".", "track_selections", ")", "==", "0", ":", "return", "True", "return", "False" ]
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/boxmove.py#L251-L255
steveKapturowski/tensorflow-rl
6dc58da69bad0349a646cfc94ea9c5d1eada8351
networks/continuous_actions.py
python
ContinuousPolicyValueNetwork._build_sigma
(self, input_state)
[]
def _build_sigma(self, input_state): if self.use_state_dependent_std: self.w_sigma2, self.b_sigma2, self.sigma_hat = layers.fc( 'std2', input_state, self.num_actions, activation='linear') self.sigma2 = tf.log(1+tf.exp(self.sigma_hat)) sigma = tf.sqrt(self.sigm...
[ "def", "_build_sigma", "(", "self", ",", "input_state", ")", ":", "if", "self", ".", "use_state_dependent_std", ":", "self", ".", "w_sigma2", ",", "self", ".", "b_sigma2", ",", "self", ".", "sigma_hat", "=", "layers", ".", "fc", "(", "'std2'", ",", "inpu...
https://github.com/steveKapturowski/tensorflow-rl/blob/6dc58da69bad0349a646cfc94ea9c5d1eada8351/networks/continuous_actions.py#L40-L52
fastnlp/fitlog
ba9547a56f4855a2d9cf26ae709d01922befa077
fitlog/fastgit/committer.py
python
Committer.init_project
(self, pj_name: str, version: str = "normal", hide: bool = False, git: bool = True)
return 0
命令行用来初始化一个 fitlog 项目 :param pj_name: 项目名称 :param version: 项目初始化文件夹的版本,目前只有 normal 这一种 :param hide: 是否隐藏 .fitconfig 文件到 .fitlog 文件夹中 :param git: 是否在初始化 fitlog 的同时为项目初始化 git :return: 状态码。0表示正常完成,其它错误码与系统相关
命令行用来初始化一个 fitlog 项目
[ "命令行用来初始化一个", "fitlog", "项目" ]
def init_project(self, pj_name: str, version: str = "normal", hide: bool = False, git: bool = True) -> int: """命令行用来初始化一个 fitlog 项目 :param pj_name: 项目名称 :param version: 项目初始化文件夹的版本,目前只有 normal 这一种 :param hide: 是否隐藏 .fitconfig 文件到 .fitlog 文件夹中 :param git: 是否在初始化 fitlog 的同时为项目初始化 ...
[ "def", "init_project", "(", "self", ",", "pj_name", ":", "str", ",", "version", ":", "str", "=", "\"normal\"", ",", "hide", ":", "bool", "=", "False", ",", "git", ":", "bool", "=", "True", ")", "->", "int", ":", "if", "pj_name", "==", "'.'", ":", ...
https://github.com/fastnlp/fitlog/blob/ba9547a56f4855a2d9cf26ae709d01922befa077/fitlog/fastgit/committer.py#L478-L537
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
xonsh/parsers/base.py
python
ensure_list_from_str_or_list
(x, lineno=None, col=None)
return ast.IfExp( test=ast.Call( func=ast.Name( id="isinstance", ctx=ast.Load(), lineno=lineno, col_offset=col ), args=[x, ast.Name(id="str", ctx=ast.Load(), lineno=lineno, col_offset=col)], keywords=[], starargs=None, kwarg...
Creates the AST node for the following expression:: [x] if isinstance(x, str) else x Somewhat useful.
Creates the AST node for the following expression::
[ "Creates", "the", "AST", "node", "for", "the", "following", "expression", "::" ]
def ensure_list_from_str_or_list(x, lineno=None, col=None): """Creates the AST node for the following expression:: [x] if isinstance(x, str) else x Somewhat useful. """ return ast.IfExp( test=ast.Call( func=ast.Name( id="isinstance", ctx=ast.Load(), lineno=l...
[ "def", "ensure_list_from_str_or_list", "(", "x", ",", "lineno", "=", "None", ",", "col", "=", "None", ")", ":", "return", "ast", ".", "IfExp", "(", "test", "=", "ast", ".", "Call", "(", "func", "=", "ast", ".", "Name", "(", "id", "=", "\"isinstance\"...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/parsers/base.py#L90-L113
stepjam/PyRep
d778d5d4ffa3be366d4e699f6e2941553fd47ecc
pyrep/objects/object.py
python
Object.set_matrix
(self, matrix: np.ndarray, relative_to=None)
Sets the transformation matrix of this object. :param relative_to: Indicates relative to which reference frame the matrix is specified. Specify None to set the absolute transformation matrix, or an Object relative to whose reference frame the transformation matrix is specifi...
Sets the transformation matrix of this object.
[ "Sets", "the", "transformation", "matrix", "of", "this", "object", "." ]
def set_matrix(self, matrix: np.ndarray, relative_to=None) -> None: """Sets the transformation matrix of this object. :param relative_to: Indicates relative to which reference frame the matrix is specified. Specify None to set the absolute transformation matrix, or an Object rel...
[ "def", "set_matrix", "(", "self", ",", "matrix", ":", "np", ".", "ndarray", ",", "relative_to", "=", "None", ")", "->", "None", ":", "if", "not", "isinstance", "(", "matrix", ",", "np", ".", "ndarray", ")", ":", "raise", "ValueError", "(", "'Expected N...
https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/objects/object.py#L304-L317
hasegaw/IkaLog
bd476da541fcc296f792d4db76a6b9174c4777ad
ikalog/outputs/boyomi.py
python
Boyomi.get_config
(self, config)
return config
[]
def get_config(self, config): boyomi = self._dict.get_config() config[self.config_key()] = boyomi return config
[ "def", "get_config", "(", "self", ",", "config", ")", ":", "boyomi", "=", "self", ".", "_dict", ".", "get_config", "(", ")", "config", "[", "self", ".", "config_key", "(", ")", "]", "=", "boyomi", "return", "config" ]
https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/outputs/boyomi.py#L138-L141
aploium/zmirror
f3db3048f83d1ea1bf06a94df312dd30d54b96d3
zmirror/external_pkgs/ColorfulPyPrint/thirdparty/colorama/ansitowin32.py
python
AnsiToWin32.should_wrap
(self)
return self.convert or self.strip or self.autoreset
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requeste...
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requeste...
[ "True", "if", "this", "class", "is", "actually", "needed", ".", "If", "false", "then", "the", "output", "stream", "will", "not", "be", "affected", "nor", "will", "win32", "calls", "be", "issued", "so", "wrapping", "stdout", "is", "not", "actually", "requir...
def should_wrap(self): ''' True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionali...
[ "def", "should_wrap", "(", "self", ")", ":", "return", "self", ".", "convert", "or", "self", ".", "strip", "or", "self", ".", "autoreset" ]
https://github.com/aploium/zmirror/blob/f3db3048f83d1ea1bf06a94df312dd30d54b96d3/zmirror/external_pkgs/ColorfulPyPrint/thirdparty/colorama/ansitowin32.py#L81-L89
wbond/packagecontrol.io
9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20
app/lib/package_control/deps/asn1crypto/ocsp.py
python
SingleResponse.archive_cutoff_value
(self)
return self._archive_cutoff_value
This extension is used to indicate the date at which an archived (historical) certificate status entry will no longer be available. :return: None or a GeneralizedTime object
This extension is used to indicate the date at which an archived (historical) certificate status entry will no longer be available.
[ "This", "extension", "is", "used", "to", "indicate", "the", "date", "at", "which", "an", "archived", "(", "historical", ")", "certificate", "status", "entry", "will", "no", "longer", "be", "available", "." ]
def archive_cutoff_value(self): """ This extension is used to indicate the date at which an archived (historical) certificate status entry will no longer be available. :return: None or a GeneralizedTime object """ if self._processed_extensions is False: ...
[ "def", "archive_cutoff_value", "(", "self", ")", ":", "if", "self", ".", "_processed_extensions", "is", "False", ":", "self", ".", "_set_extensions", "(", ")", "return", "self", ".", "_archive_cutoff_value" ]
https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/deps/asn1crypto/ocsp.py#L496-L507
WeblateOrg/weblate
8126f3dda9d24f2846b755955132a8b8410866c8
weblate/trans/migrations/0127_fix_source_glossary.py
python
migrate_glossaries
(apps, schema_editor)
Removes automatically created glossaries for source language. These were wrongly created by 0116_migrate_glossaries and it was fixed in 0d8b564903518a313d4116ffe82d9c7bc31f7908.
Removes automatically created glossaries for source language.
[ "Removes", "automatically", "created", "glossaries", "for", "source", "language", "." ]
def migrate_glossaries(apps, schema_editor): """ Removes automatically created glossaries for source language. These were wrongly created by 0116_migrate_glossaries and it was fixed in 0d8b564903518a313d4116ffe82d9c7bc31f7908. """ Component = apps.get_model("trans", "Component") db_alias = ...
[ "def", "migrate_glossaries", "(", "apps", ",", "schema_editor", ")", ":", "Component", "=", "apps", ".", "get_model", "(", "\"trans\"", ",", "\"Component\"", ")", "db_alias", "=", "schema_editor", ".", "connection", ".", "alias", "for", "component", "in", "(",...
https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/trans/migrations/0127_fix_source_glossary.py#L12-L45
koalalorenzo/python-digitalocean
ebea58fddf2ceea35c027bfa66f2fa9f5debfd64
digitalocean/Volume.py
python
Volume.create_from_snapshot
(self, *args, **kwargs)
return self
Creates a Block Storage volume Note: Every argument and parameter given to this method will be assigned to the object. Args: name: string - a name for the volume snapshot_id: string - unique identifier for the volume snapshot size_gigabytes: int - size of th...
Creates a Block Storage volume
[ "Creates", "a", "Block", "Storage", "volume" ]
def create_from_snapshot(self, *args, **kwargs): """ Creates a Block Storage volume Note: Every argument and parameter given to this method will be assigned to the object. Args: name: string - a name for the volume snapshot_id: string - unique identifier...
[ "def", "create_from_snapshot", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "get_data", "(", "'volumes/'", ",", "type", "=", "POST", ",", "params", "=", "{", "'name'", ":", "self", ".", "name", ",", "'...
https://github.com/koalalorenzo/python-digitalocean/blob/ebea58fddf2ceea35c027bfa66f2fa9f5debfd64/digitalocean/Volume.py#L77-L113
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/3rdparty/tvm/topi/python/topi/opengl/pooling.py
python
schedule_pool
(outs, layout)
return s
Schedule for pool. Parameters ---------- outs: Array of Tensor The computation graph description of pool in the format of an array of tensors. layout: str Data layout. Returns ------- s: Schedule The computation schedule for pool.
Schedule for pool.
[ "Schedule", "for", "pool", "." ]
def schedule_pool(outs, layout): """Schedule for pool. Parameters ---------- outs: Array of Tensor The computation graph description of pool in the format of an array of tensors. layout: str Data layout. Returns ------- s: Schedule The computation sched...
[ "def", "schedule_pool", "(", "outs", ",", "layout", ")", ":", "outs", "=", "[", "outs", "]", "if", "isinstance", "(", "outs", ",", "tvm", ".", "tensor", ".", "Tensor", ")", "else", "outs", "s", "=", "tvm", ".", "create_schedule", "(", "[", "x", "."...
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/3rdparty/tvm/topi/python/topi/opengl/pooling.py#L57-L108
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/difflib.py
python
SequenceMatcher.real_quick_ratio
(self)
return _calculate_ratio(min(la, lb), la + lb)
Return an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .ratio(), and is faster to compute than either .ratio() or .quick_ratio().
Return an upper bound on ratio() very quickly.
[ "Return", "an", "upper", "bound", "on", "ratio", "()", "very", "quickly", "." ]
def real_quick_ratio(self): """Return an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .ratio(), and is faster to compute than either .ratio() or .quick_ratio(). """ la, lb = len(self.a), len(self.b) # can't have more matche...
[ "def", "real_quick_ratio", "(", "self", ")", ":", "la", ",", "lb", "=", "len", "(", "self", ".", "a", ")", ",", "len", "(", "self", ".", "b", ")", "# can't have more matches than the number of elements in the", "# shorter sequence", "return", "_calculate_ratio", ...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/difflib.py#L691-L701
python-diamond/Diamond
7000e16cfdf4508ed9291fc4b3800592557b2431
src/diamond/utils/classes.py
python
load_dynamic_class
(fqn, subclass)
return cls
Dynamically load fqn class and verify it's a subclass of subclass
Dynamically load fqn class and verify it's a subclass of subclass
[ "Dynamically", "load", "fqn", "class", "and", "verify", "it", "s", "a", "subclass", "of", "subclass" ]
def load_dynamic_class(fqn, subclass): """ Dynamically load fqn class and verify it's a subclass of subclass """ if not isinstance(fqn, basestring): return fqn cls = load_class_from_name(fqn) if cls == subclass or not issubclass(cls, subclass): raise TypeError("%s is not a vali...
[ "def", "load_dynamic_class", "(", "fqn", ",", "subclass", ")", ":", "if", "not", "isinstance", "(", "fqn", ",", "basestring", ")", ":", "return", "fqn", "cls", "=", "load_class_from_name", "(", "fqn", ")", "if", "cls", "==", "subclass", "or", "not", "iss...
https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/diamond/utils/classes.py#L39-L51
dropbox/changes
37e23c3141b75e4785cf398d015e3dbca41bdd56
changes/lib/artifact_store_mock.py
python
ArtifactStoreMock.create_bucket
(self, bucket_name, owner='changes')
return b
:return: The created Bucket
:return: The created Bucket
[ ":", "return", ":", "The", "created", "Bucket" ]
def create_bucket(self, bucket_name, owner='changes'): """ :return: The created Bucket """ if bucket_name in ArtifactStoreMock.buckets: raise Exception('bucket already exists') b = Bucket( { 'id': bucket_name, 'owner': owne...
[ "def", "create_bucket", "(", "self", ",", "bucket_name", ",", "owner", "=", "'changes'", ")", ":", "if", "bucket_name", "in", "ArtifactStoreMock", ".", "buckets", ":", "raise", "Exception", "(", "'bucket already exists'", ")", "b", "=", "Bucket", "(", "{", "...
https://github.com/dropbox/changes/blob/37e23c3141b75e4785cf398d015e3dbca41bdd56/changes/lib/artifact_store_mock.py#L30-L50
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/dateutil/tz/win.py
python
tzwinbase.transitions
(self, year)
return dston, dstoff
For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. :return: Returns a :class:`tupl...
For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``.
[ "For", "a", "given", "year", "get", "the", "DST", "on", "and", "off", "transition", "times", "expressed", "always", "on", "the", "standard", "time", "side", ".", "For", "zones", "with", "no", "transitions", "this", "function", "returns", "None", "." ]
def transitions(self, year): """ For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns ``None``. :param year: The year whose transitions you would like to query. ...
[ "def", "transitions", "(", "self", ",", "year", ")", ":", "if", "not", "self", ".", "hasdst", ":", "return", "None", "dston", "=", "picknthweekday", "(", "year", ",", "self", ".", "_dstmonth", ",", "self", ".", "_dstdayofweek", ",", "self", ".", "_dsth...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/dateutil/tz/win.py#L151-L180
thricedotted/twitterbot
ea5ff3fd9192e07555331b5c77ce005455a8ced9
examples/fartbot/fartbot.py
python
FartBot.on_scheduled_tweet
(self)
Make a public tweet to the bot's own timeline. It's up to you to ensure that it's less than 140 characters. Set tweet frequency in seconds with TWEET_INTERVAL in config.py.
Make a public tweet to the bot's own timeline.
[ "Make", "a", "public", "tweet", "to", "the", "bot", "s", "own", "timeline", "." ]
def on_scheduled_tweet(self): """ Make a public tweet to the bot's own timeline. It's up to you to ensure that it's less than 140 characters. Set tweet frequency in seconds with TWEET_INTERVAL in config.py. """ text = 'fart ' + choice(self.words) self.post_tweet...
[ "def", "on_scheduled_tweet", "(", "self", ")", ":", "text", "=", "'fart '", "+", "choice", "(", "self", ".", "words", ")", "self", ".", "post_tweet", "(", "text", ")" ]
https://github.com/thricedotted/twitterbot/blob/ea5ff3fd9192e07555331b5c77ce005455a8ced9/examples/fartbot/fartbot.py#L83-L92
qilingframework/qiling
32cc674f2f6fa4b4c9d64a35a1a57853fe1e4142
qiling/os/memory.py
python
align_up
(self, value: int, alignment: int = None)
return (value + alignment - 1) & ~(alignment - 1)
Align a value up to the specified alignment boundary. Args: value: value to align alignment: alignment boundary; must be a power of 2. if not specified value will be aligned to page size Returns: aligned value
Align a value up to the specified alignment boundary.
[ "Align", "a", "value", "up", "to", "the", "specified", "alignment", "boundary", "." ]
def align_up(self, value: int, alignment: int = None) -> int: """Align a value up to the specified alignment boundary. Args: value: value to align alignment: alignment boundary; must be a power of 2. if not specified value will be aligned to page size Return...
[ "def", "align_up", "(", "self", ",", "value", ":", "int", ",", "alignment", ":", "int", "=", "None", ")", "->", "int", ":", "if", "alignment", "is", "None", ":", "alignment", "=", "self", ".", "pagesize", "# make sure alignment is a power of 2", "assert", ...
https://github.com/qilingframework/qiling/blob/32cc674f2f6fa4b4c9d64a35a1a57853fe1e4142/qiling/os/memory.py#L218-L236
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/common/formats.py
python
findInputExtension
(fmt)
Will be fully deprecated when there's an exact equivalent in converter... Given an input format or music21 format, find and return all possible input extensions. >>> a = common.findInputExtension('musicxml') >>> a ('.xml', '.mxl', '.musicxml') >>> a = common.findInputExtension('humdrum') ...
Will be fully deprecated when there's an exact equivalent in converter...
[ "Will", "be", "fully", "deprecated", "when", "there", "s", "an", "exact", "equivalent", "in", "converter", "..." ]
def findInputExtension(fmt): ''' Will be fully deprecated when there's an exact equivalent in converter... Given an input format or music21 format, find and return all possible input extensions. >>> a = common.findInputExtension('musicxml') >>> a ('.xml', '.mxl', '.musicxml') >>> a = ...
[ "def", "findInputExtension", "(", "fmt", ")", ":", "from", "music21", "import", "converter", "fmt", "=", "fmt", ".", "lower", "(", ")", ".", "strip", "(", ")", "if", "fmt", ".", "startswith", "(", "'.'", ")", ":", "fmt", "=", "fmt", "[", "1", ":", ...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/common/formats.py#L178-L231
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/soupsieve/css_parser.py
python
CSSParser.parse_selectors
( self, iselector: Iterator[Tuple[str, Match[str]]], index: int = 0, flags: int = 0 )
return ct.SelectorList([s.freeze() for s in selectors], is_not, is_html)
Parse selectors.
Parse selectors.
[ "Parse", "selectors", "." ]
def parse_selectors( self, iselector: Iterator[Tuple[str, Match[str]]], index: int = 0, flags: int = 0 ) -> ct.SelectorList: """Parse selectors.""" # Initialize important variables sel = _Selector() selectors = [] has_selector = False ...
[ "def", "parse_selectors", "(", "self", ",", "iselector", ":", "Iterator", "[", "Tuple", "[", "str", ",", "Match", "[", "str", "]", "]", "]", ",", "index", ":", "int", "=", "0", ",", "flags", ":", "int", "=", "0", ")", "->", "ct", ".", "SelectorLi...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/soupsieve/css_parser.py#L925-L1113
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/docking/q_dock_item.py
python
QDockItemLayout.count
(self)
return 0
A required virtual method implementation. This method should not be used and returns a constant value.
A required virtual method implementation.
[ "A", "required", "virtual", "method", "implementation", "." ]
def count(self): """ A required virtual method implementation. This method should not be used and returns a constant value. """ return 0
[ "def", "count", "(", "self", ")", ":", "return", "0" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/docking/q_dock_item.py#L220-L226
chartit/django-chartit
0934cace4c841c41461b916d63e7a7f8acaf5f7d
demoproject/demoproject/models.py
python
SalesHistory.__unicode__
(self)
return '%s %s %s' % (self.bookstore, self.book, self.sale_date)
[]
def __unicode__(self): return '%s %s %s' % (self.bookstore, self.book, self.sale_date)
[ "def", "__unicode__", "(", "self", ")", ":", "return", "'%s %s %s'", "%", "(", "self", ".", "bookstore", ",", "self", ".", "book", ",", "self", ".", "sale_date", ")" ]
https://github.com/chartit/django-chartit/blob/0934cace4c841c41461b916d63e7a7f8acaf5f7d/demoproject/demoproject/models.py#L89-L90
hyperspy/hyperspy
1ffb3fab33e607045a37f30c1463350b72617e10
hyperspy/signal.py
python
BaseSignal._check_signal_mask
(self, mask)
Check the shape of the signal mask. Parameters ---------- mask : numpy array or BaseSignal. Mask to check the shape. Raises ------ ValueError If shape doesn't match the shape of the signal dimension. Returns ------- None.
Check the shape of the signal mask.
[ "Check", "the", "shape", "of", "the", "signal", "mask", "." ]
def _check_signal_mask(self, mask): """ Check the shape of the signal mask. Parameters ---------- mask : numpy array or BaseSignal. Mask to check the shape. Raises ------ ValueError If shape doesn't match the shape of the signal d...
[ "def", "_check_signal_mask", "(", "self", ",", "mask", ")", ":", "if", "isinstance", "(", "mask", ",", "BaseSignal", ")", ":", "if", "mask", ".", "axes_manager", ".", "navigation_dimension", "!=", "0", ":", "raise", "ValueError", "(", "\"The signal mask signal...
https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/signal.py#L6368-L6398
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
static/paddlex/cv/nets/segmentation/hrnet.py
python
HRNet.generate_inputs
(self)
return inputs
[]
def generate_inputs(self): inputs = OrderedDict() if self.fixed_input_shape is not None: input_shape = [ None, self.input_channel, self.fixed_input_shape[1], self.fixed_input_shape[0] ] inputs['image'] = fluid.data( dty...
[ "def", "generate_inputs", "(", "self", ")", ":", "inputs", "=", "OrderedDict", "(", ")", "if", "self", ".", "fixed_input_shape", "is", "not", "None", ":", "input_shape", "=", "[", "None", ",", "self", ".", "input_channel", ",", "self", ".", "fixed_input_sh...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/nets/segmentation/hrnet.py#L136-L157
tjweir/liftbook
e977a7face13ade1a4558e1909a6951d2f8928dd
elyxer.py
python
LineReader.close
(self)
[]
def close(self): self.file.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "file", ".", "close", "(", ")" ]
https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L156-L157
ansible-collections/community.general
3faffe8f47968a2400ba3c896c8901c03001a194
plugins/modules/remote_management/manageiq/manageiq_policies.py
python
ManageIQPolicies.clean_policy_object
(self, policy)
return dict( name=name, description=description, active=active)
Clean a policy object to have human readable form of: { name: STR, description: STR, active: BOOL }
Clean a policy object to have human readable form of: { name: STR, description: STR, active: BOOL }
[ "Clean", "a", "policy", "object", "to", "have", "human", "readable", "form", "of", ":", "{", "name", ":", "STR", "description", ":", "STR", "active", ":", "BOOL", "}" ]
def clean_policy_object(self, policy): """ Clean a policy object to have human readable form of: { name: STR, description: STR, active: BOOL } """ name = policy.get('name') description = policy.get('description') active = policy...
[ "def", "clean_policy_object", "(", "self", ",", "policy", ")", ":", "name", "=", "policy", ".", "get", "(", "'name'", ")", "description", "=", "policy", ".", "get", "(", "'description'", ")", "active", "=", "policy", ".", "get", "(", "'active'", ")", "...
https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/remote_management/manageiq/manageiq_policies.py#L204-L219
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/GenBank/Record.py
python
Qualifier.__str__
(self)
return output + _wrapped_genbank( self.key + self.value, Record.GB_FEATURE_INDENT, space_wrap )
Return feature qualifier as a GenBank format string.
Return feature qualifier as a GenBank format string.
[ "Return", "feature", "qualifier", "as", "a", "GenBank", "format", "string", "." ]
def __str__(self): """Return feature qualifier as a GenBank format string.""" output = " " * Record.GB_FEATURE_INDENT # determine whether we can wrap on spaces space_wrap = 1 for no_space_key in Bio.GenBank._BaseGenBankConsumer.remove_space_keys: if no_space_key in se...
[ "def", "__str__", "(", "self", ")", ":", "output", "=", "\" \"", "*", "Record", ".", "GB_FEATURE_INDENT", "# determine whether we can wrap on spaces", "space_wrap", "=", "1", "for", "no_space_key", "in", "Bio", ".", "GenBank", ".", "_BaseGenBankConsumer", ".", "re...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/GenBank/Record.py#L658-L669
GoSecure/pyrdp
abd8b8762b6d7fd0e49d4a927b529f892b412743
pyrdp/convert/RDPReplayer.py
python
ConversionLayer.filename
(self)
return self.sink.filename
[]
def filename(self): return self.sink.filename
[ "def", "filename", "(", "self", ")", ":", "return", "self", ".", "sink", ".", "filename" ]
https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/convert/RDPReplayer.py#L48-L49
derv82/wifite2
e190794149f488f9c4a2801962e5165b29e71b5e
wifite/model/handshake.py
python
Handshake.print_pairs
(pairs, capfile, tool=None)
Prints out BSSID and/or ESSID given a list of tuples (bssid,essid)
Prints out BSSID and/or ESSID given a list of tuples (bssid,essid)
[ "Prints", "out", "BSSID", "and", "/", "or", "ESSID", "given", "a", "list", "of", "tuples", "(", "bssid", "essid", ")" ]
def print_pairs(pairs, capfile, tool=None): ''' Prints out BSSID and/or ESSID given a list of tuples (bssid,essid) ''' tool_str = '' if tool is not None: tool_str = '{C}%s{W}: ' % tool.rjust(8) if len(pairs) == 0: Color.pl('{!} %s.cap file {R}...
[ "def", "print_pairs", "(", "pairs", ",", "capfile", ",", "tool", "=", "None", ")", ":", "tool_str", "=", "''", "if", "tool", "is", "not", "None", ":", "tool_str", "=", "'{C}%s{W}: '", "%", "tool", ".", "rjust", "(", "8", ")", "if", "len", "(", "pai...
https://github.com/derv82/wifite2/blob/e190794149f488f9c4a2801962e5165b29e71b5e/wifite/model/handshake.py#L177-L196
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/examples/nips17_adversarial_competition/dev_toolkit/validation_tool/submission_validator_lib.py
python
SubmissionValidator._verify_output
(self, submission_type)
return result
Verifies correctness of the submission output. Args: submission_type: type of the submission Returns: True if output looks valid
Verifies correctness of the submission output.
[ "Verifies", "correctness", "of", "the", "submission", "output", "." ]
def _verify_output(self, submission_type): """Verifies correctness of the submission output. Args: submission_type: type of the submission Returns: True if output looks valid """ result = True if submission_type == "defense": try: ...
[ "def", "_verify_output", "(", "self", ",", "submission_type", ")", ":", "result", "=", "True", "if", "submission_type", "==", "\"defense\"", ":", "try", ":", "image_classification", "=", "load_defense_output", "(", "os", ".", "path", ".", "join", "(", "self", ...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/examples/nips17_adversarial_competition/dev_toolkit/validation_tool/submission_validator_lib.py#L386-L426
F5Networks/f5-common-python
425ed5fb57dad9381311a96a67ad8b95aaa454bb
f5/bigiq/cm/device/licensing/pool/regkey.py
python
Members.delete
(self, **kwargs)
Deletes a member from a license pool You need to be careful with this method. When you use it, and it succeeds on the remote BIG-IP, the configuration of the BIG-IP will be reloaded. During this process, you will not be able to access the REST interface. This method overrides t...
Deletes a member from a license pool
[ "Deletes", "a", "member", "from", "a", "license", "pool" ]
def delete(self, **kwargs): """Deletes a member from a license pool You need to be careful with this method. When you use it, and it succeeds on the remote BIG-IP, the configuration of the BIG-IP will be reloaded. During this process, you will not be able to access the REST inte...
[ "def", "delete", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "'id'", "not", "in", "kwargs", ":", "# BIG-IQ requires that you provide the ID of the members to revoke", "# a license from. This ID is already part of the deletion URL though.", "# Therefore, if you do not pr...
https://github.com/F5Networks/f5-common-python/blob/425ed5fb57dad9381311a96a67ad8b95aaa454bb/f5/bigiq/cm/device/licensing/pool/regkey.py#L134-L184
CoinAlpha/hummingbot
36f6149c1644c07cd36795b915f38b8f49b798e7
hummingbot/connector/connector/uniswap/uniswap_connector.py
python
UniswapConnector.approve_uniswap_spender
(self, token_symbol: str)
return amount_approved
Approves Uniswap contract as a spender for a token. :param token_symbol: token to approve.
Approves Uniswap contract as a spender for a token. :param token_symbol: token to approve.
[ "Approves", "Uniswap", "contract", "as", "a", "spender", "for", "a", "token", ".", ":", "param", "token_symbol", ":", "token", "to", "approve", "." ]
async def approve_uniswap_spender(self, token_symbol: str) -> Decimal: """ Approves Uniswap contract as a spender for a token. :param token_symbol: token to approve. """ resp = await self._api_request("post", "eth/approve", ...
[ "async", "def", "approve_uniswap_spender", "(", "self", ",", "token_symbol", ":", "str", ")", "->", "Decimal", ":", "resp", "=", "await", "self", ".", "_api_request", "(", "\"post\"", ",", "\"eth/approve\"", ",", "{", "\"token\"", ":", "token_symbol", ",", "...
https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/connector/connector/uniswap/uniswap_connector.py#L148-L162
yadayada/acd_cli
cd4a9eea52f1740aa8de10d8c75ab2f6c17de52b
acdcli/acd_fuse.py
python
ACDFuse.rmdir
(self, path)
Moves a directory into ACD trash.
Moves a directory into ACD trash.
[ "Moves", "a", "directory", "into", "ACD", "trash", "." ]
def rmdir(self, path): """Moves a directory into ACD trash.""" self._trash(path)
[ "def", "rmdir", "(", "self", ",", "path", ")", ":", "self", ".", "_trash", "(", "path", ")" ]
https://github.com/yadayada/acd_cli/blob/cd4a9eea52f1740aa8de10d8c75ab2f6c17de52b/acdcli/acd_fuse.py#L527-L529
mila-iqia/blocks
c69c2dc2b9c90a8eac9e432690eb59ff99d2f28a
blocks/bricks/attention.py
python
SequenceContentAttention.preprocess
(self, attended)
return self.attended_transformer.apply(attended)
Preprocess the sequence for computing attention weights. Parameters ---------- attended : :class:`~tensor.TensorVariable` The attended sequence, time is the 1-st dimension.
Preprocess the sequence for computing attention weights.
[ "Preprocess", "the", "sequence", "for", "computing", "attention", "weights", "." ]
def preprocess(self, attended): """Preprocess the sequence for computing attention weights. Parameters ---------- attended : :class:`~tensor.TensorVariable` The attended sequence, time is the 1-st dimension. """ return self.attended_transformer.apply(attende...
[ "def", "preprocess", "(", "self", ",", "attended", ")", ":", "return", "self", ".", "attended_transformer", ".", "apply", "(", "attended", ")" ]
https://github.com/mila-iqia/blocks/blob/c69c2dc2b9c90a8eac9e432690eb59ff99d2f28a/blocks/bricks/attention.py#L399-L408
xiaolonw/adversarial-frcnn
2a7bb96c9884c0f09ca5bde35a981087be28562b
lib/datasets/coco.py
python
coco._roidb_from_proposals
(self, method)
return roidb
Creates a roidb from pre-computed proposals of a particular methods.
Creates a roidb from pre-computed proposals of a particular methods.
[ "Creates", "a", "roidb", "from", "pre", "-", "computed", "proposals", "of", "a", "particular", "methods", "." ]
def _roidb_from_proposals(self, method): """ Creates a roidb from pre-computed proposals of a particular methods. """ top_k = self.config['top_k'] cache_file = osp.join(self.cache_path, self.name + '_{:s}_top{:d}'.format(method, top_k) + ...
[ "def", "_roidb_from_proposals", "(", "self", ",", "method", ")", ":", "top_k", "=", "self", ".", "config", "[", "'top_k'", "]", "cache_file", "=", "osp", ".", "join", "(", "self", ".", "cache_path", ",", "self", ".", "name", "+", "'_{:s}_top{:d}'", ".", ...
https://github.com/xiaolonw/adversarial-frcnn/blob/2a7bb96c9884c0f09ca5bde35a981087be28562b/lib/datasets/coco.py#L132-L159
skyhehe123/SA-SSD
2d75c973af65453186bd9242d7fa5e62dc44ec03
mmdet/datasets/kitti_utils.py
python
get_lidar_in_image_fov
(pc_velo, calib, xmin, ymin, xmax, ymax, return_more=False, clip_distance=2.0)
Filter lidar points, keep those in image FOV
Filter lidar points, keep those in image FOV
[ "Filter", "lidar", "points", "keep", "those", "in", "image", "FOV" ]
def get_lidar_in_image_fov(pc_velo, calib, xmin, ymin, xmax, ymax, return_more=False, clip_distance=2.0): ''' Filter lidar points, keep those in image FOV ''' pts_2d = project_velo_to_image(pc_velo[:,:3], calib) fov_inds = (pts_2d[:,0]<xmax) & (pts_2d[:,0]>=xmin) & \ (pts_...
[ "def", "get_lidar_in_image_fov", "(", "pc_velo", ",", "calib", ",", "xmin", ",", "ymin", ",", "xmax", ",", "ymax", ",", "return_more", "=", "False", ",", "clip_distance", "=", "2.0", ")", ":", "pts_2d", "=", "project_velo_to_image", "(", "pc_velo", "[", ":...
https://github.com/skyhehe123/SA-SSD/blob/2d75c973af65453186bd9242d7fa5e62dc44ec03/mmdet/datasets/kitti_utils.py#L252-L263
genforce/idinvert
138266724c7c8709fa4b2565c1f8e648ae5c6641
dnnlib/tflib/network.py
python
import_handler
(handler_func)
return handler_func
Function decorator for declaring custom import handlers.
Function decorator for declaring custom import handlers.
[ "Function", "decorator", "for", "declaring", "custom", "import", "handlers", "." ]
def import_handler(handler_func): """Function decorator for declaring custom import handlers.""" _import_handlers.append(handler_func) return handler_func
[ "def", "import_handler", "(", "handler_func", ")", ":", "_import_handlers", ".", "append", "(", "handler_func", ")", "return", "handler_func" ]
https://github.com/genforce/idinvert/blob/138266724c7c8709fa4b2565c1f8e648ae5c6641/dnnlib/tflib/network.py#L30-L33
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/calendar.py
python
Calendar.itermonthdays2
(self, year, month)
Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0.
Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0.
[ "Like", "itermonthdates", "()", "but", "will", "yield", "(", "day", "number", "weekday", "number", ")", "tuples", ".", "For", "days", "outside", "the", "specified", "month", "the", "day", "number", "is", "0", "." ]
def itermonthdays2(self, year, month): """ Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0. """ for date in self.itermonthdates(year, month): if date.month != month: yi...
[ "def", "itermonthdays2", "(", "self", ",", "year", ",", "month", ")", ":", "for", "date", "in", "self", ".", "itermonthdates", "(", "year", ",", "month", ")", ":", "if", "date", ".", "month", "!=", "month", ":", "yield", "(", "0", ",", "date", ".",...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/calendar.py#L168-L177
mitre/caldera
46429594584f3852d1f9353402407fdb7c1a8302
app/service/interfaces/i_app_svc.py
python
AppServiceInterface.find_link
(self, unique)
Locate a given link by its unique property :param unique: :return:
Locate a given link by its unique property :param unique: :return:
[ "Locate", "a", "given", "link", "by", "its", "unique", "property", ":", "param", "unique", ":", ":", "return", ":" ]
def find_link(self, unique): """ Locate a given link by its unique property :param unique: :return: """ pass
[ "def", "find_link", "(", "self", ",", "unique", ")", ":", "pass" ]
https://github.com/mitre/caldera/blob/46429594584f3852d1f9353402407fdb7c1a8302/app/service/interfaces/i_app_svc.py#L15-L21
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/modeling/models/core.py
python
ModelBase.frozen
(self)
return np.all([p.frozen for p in self.parameters])
Frozen status of a model, True if all parameters are frozen
Frozen status of a model, True if all parameters are frozen
[ "Frozen", "status", "of", "a", "model", "True", "if", "all", "parameters", "are", "frozen" ]
def frozen(self): """Frozen status of a model, True if all parameters are frozen""" return np.all([p.frozen for p in self.parameters])
[ "def", "frozen", "(", "self", ")", ":", "return", "np", ".", "all", "(", "[", "p", ".", "frozen", "for", "p", "in", "self", ".", "parameters", "]", ")" ]
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/modeling/models/core.py#L213-L215
tdpetrou/pandas_cub
9f933c2a1a11a7f8eebab29b62c320cedb9d631a
pandas_cub/__init__.py
python
DataFrame.__pow__
(self, other)
return self._oper('__pow__', other)
[]
def __pow__(self, other): return self._oper('__pow__', other)
[ "def", "__pow__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_oper", "(", "'__pow__'", ",", "other", ")" ]
https://github.com/tdpetrou/pandas_cub/blob/9f933c2a1a11a7f8eebab29b62c320cedb9d631a/pandas_cub/__init__.py#L493-L494
openstack/freezer
3eb84784c668ed9f442322abee4e48bd1bc51fd4
freezer/engine/osbrick/osbrick.py
python
OsbrickEngine.metadata
(self, backup_resource)
return { "engine_name": self.name, "volume_info": self.volume_info, "encryption": bool(self.encrypt_pass_file) }
Construct metadata
Construct metadata
[ "Construct", "metadata" ]
def metadata(self, backup_resource): """Construct metadata""" return { "engine_name": self.name, "volume_info": self.volume_info, "encryption": bool(self.encrypt_pass_file) }
[ "def", "metadata", "(", "self", ",", "backup_resource", ")", ":", "return", "{", "\"engine_name\"", ":", "self", ".", "name", ",", "\"volume_info\"", ":", "self", ".", "volume_info", ",", "\"encryption\"", ":", "bool", "(", "self", ".", "encrypt_pass_file", ...
https://github.com/openstack/freezer/blob/3eb84784c668ed9f442322abee4e48bd1bc51fd4/freezer/engine/osbrick/osbrick.py#L56-L62
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/core/parser/base_lexer.py
python
BaseEnamlLexer.t_WS
(self, t)
r' [ \t\f]+
r' [ \t\f]+
[ "r", "[", "\\", "t", "\\", "f", "]", "+" ]
def t_WS(self, t): r' [ \t\f]+ ' value = t.value # A formfeed character may be present at the start of the # line; it will be ignored for the indentation calculations # above. Formfeed characters occurring elsewhere in the # leading whitespace have an undefined effect (f...
[ "def", "t_WS", "(", "self", ",", "t", ")", ":", "value", "=", "t", ".", "value", "# A formfeed character may be present at the start of the", "# line; it will be ignored for the indentation calculations", "# above. Formfeed characters occurring elsewhere in the", "# leading whitespac...
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/parser/base_lexer.py#L256-L284
tvaddonsco/script.module.urlresolver
ddeca574c133d51879624bf3059c6e73445d90bc
lib/urlresolver/plugins/lib/jscrypto/pyaes.py
python
AES.add_round_key
(self, block, round)
AddRoundKey step in AES. This is where the key is mixed into plaintext
AddRoundKey step in AES. This is where the key is mixed into plaintext
[ "AddRoundKey", "step", "in", "AES", ".", "This", "is", "where", "the", "key", "is", "mixed", "into", "plaintext" ]
def add_round_key(self, block, round): """AddRoundKey step in AES. This is where the key is mixed into plaintext""" offset = round * 16 exkey = self.exkey for i in range(16): block[i] ^= exkey[offset + i]
[ "def", "add_round_key", "(", "self", ",", "block", ",", "round", ")", ":", "offset", "=", "round", "*", "16", "exkey", "=", "self", ".", "exkey", "for", "i", "in", "range", "(", "16", ")", ":", "block", "[", "i", "]", "^=", "exkey", "[", "offset"...
https://github.com/tvaddonsco/script.module.urlresolver/blob/ddeca574c133d51879624bf3059c6e73445d90bc/lib/urlresolver/plugins/lib/jscrypto/pyaes.py#L167-L174
ericgazoni/openpyxl
c55988e4904d4337ce4c35ab8b7dc305bca9de23
openpyxl/formatting/__init__.py
python
ConditionalFormatting.setDxfStyles
(self, wb)
Formatting for non color scale conditional formatting uses the dxf style list in styles.xml. This scans the cf_rules for dxf styles which have not been added - and saves them to the workbook. When adding a conditional formatting rule that uses a font, border or fill, this must be called at least once ...
Formatting for non color scale conditional formatting uses the dxf style list in styles.xml. This scans the cf_rules for dxf styles which have not been added - and saves them to the workbook.
[ "Formatting", "for", "non", "color", "scale", "conditional", "formatting", "uses", "the", "dxf", "style", "list", "in", "styles", ".", "xml", ".", "This", "scans", "the", "cf_rules", "for", "dxf", "styles", "which", "have", "not", "been", "added", "-", "an...
def setDxfStyles(self, wb): """Formatting for non color scale conditional formatting uses the dxf style list in styles.xml. This scans the cf_rules for dxf styles which have not been added - and saves them to the workbook. When adding a conditional formatting rule that uses a font, border or fi...
[ "def", "setDxfStyles", "(", "self", ",", "wb", ")", ":", "if", "not", "wb", ".", "style_properties", ":", "wb", ".", "style_properties", "=", "{", "'dxf_list'", ":", "[", "]", "}", "elif", "'dxf_list'", "not", "in", "wb", ".", "style_properties", ":", ...
https://github.com/ericgazoni/openpyxl/blob/c55988e4904d4337ce4c35ab8b7dc305bca9de23/openpyxl/formatting/__init__.py#L64-L92
asdf-format/asdf
c1f6cf915409da5372c47ac725dc922b4bd52f7d
asdf/config.py
python
AsdfConfig.io_block_size
(self)
return self._io_block_size
Get the block size used when reading and writing files. Returns ------- int Block size, or -1 to use the filesystem's preferred block size.
Get the block size used when reading and writing files.
[ "Get", "the", "block", "size", "used", "when", "reading", "and", "writing", "files", "." ]
def io_block_size(self): """ Get the block size used when reading and writing files. Returns ------- int Block size, or -1 to use the filesystem's preferred block size. """ return self._io_block_size
[ "def", "io_block_size", "(", "self", ")", ":", "return", "self", ".", "_io_block_size" ]
https://github.com/asdf-format/asdf/blob/c1f6cf915409da5372c47ac725dc922b4bd52f7d/asdf/config.py#L236-L247
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/vultr.py
python
VultrNodeDriverV1.delete_key_pair
(self, key_pair)
return res.status == httplib.OK
Delete an SSH key. :param key_pair: The SSH key to delete :type key_pair: :class:`SSHKey` :return: True on success :rtype: ``bool``
Delete an SSH key. :param key_pair: The SSH key to delete :type key_pair: :class:`SSHKey`
[ "Delete", "an", "SSH", "key", ".", ":", "param", "key_pair", ":", "The", "SSH", "key", "to", "delete", ":", "type", "key_pair", ":", ":", "class", ":", "SSHKey" ]
def delete_key_pair(self, key_pair): """ Delete an SSH key. :param key_pair: The SSH key to delete :type key_pair: :class:`SSHKey` :return: True on success :rtype: ``bool`` """ params = {"SSHKEYID": key_pair.id} res = self.connection.post("/v1/ssh...
[ "def", "delete_key_pair", "(", "self", ",", "key_pair", ")", ":", "params", "=", "{", "\"SSHKEYID\"", ":", "key_pair", ".", "id", "}", "res", "=", "self", ".", "connection", ".", "post", "(", "\"/v1/sshkey/destroy\"", ",", "params", ")", "return", "res", ...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/vultr.py#L825-L836
Baidu-AIP/python-sdk
e9add82014dec830a1b84c2b145a9faf40a84fc7
aip/nlp.py
python
AipNlp._proccessResult
(self, content)
formate result
formate result
[ "formate", "result" ]
def _proccessResult(self, content): """ formate result """ if sys.version_info.major == 2: return json.loads(content.decode('gbk', 'ignore').encode('utf8')) or {} else: return json.loads(str(content, 'gbk')) or {}
[ "def", "_proccessResult", "(", "self", ",", "content", ")", ":", "if", "sys", ".", "version_info", ".", "major", "==", "2", ":", "return", "json", ".", "loads", "(", "content", ".", "decode", "(", "'gbk'", ",", "'ignore'", ")", ".", "encode", "(", "'...
https://github.com/Baidu-AIP/python-sdk/blob/e9add82014dec830a1b84c2b145a9faf40a84fc7/aip/nlp.py#L52-L60
reahl/reahl
86aac47c3a9b5b98e9f77dad4939034a02d54d46
reahl-web/reahl/web/bootstrap/navs.py
python
Nav.add_dropdown
(self, title, dropdown_menu, drop_position='down', query_arguments={})
return submenu
Adds the dropdown_menu :class:`DropdownMenu` to this Nav. It appears as the top-level item with text `title`. :keyword drop_position: Position relative to the item where the dropdown should appear ('up', 'down', 'left' or 'right'). :keyword query_arguments: (For internal use)
Adds the dropdown_menu :class:`DropdownMenu` to this Nav. It appears as the top-level item with text `title`.
[ "Adds", "the", "dropdown_menu", ":", "class", ":", "DropdownMenu", "to", "this", "Nav", ".", "It", "appears", "as", "the", "top", "-", "level", "item", "with", "text", "title", "." ]
def add_dropdown(self, title, dropdown_menu, drop_position='down', query_arguments={}): """Adds the dropdown_menu :class:`DropdownMenu` to this Nav. It appears as the top-level item with text `title`. :keyword drop_position: Position relative to the item where the dropdown should appear ('up', ...
[ "def", "add_dropdown", "(", "self", ",", "title", ",", "dropdown_menu", ",", "drop_position", "=", "'down'", ",", "query_arguments", "=", "{", "}", ")", ":", "if", "self", ".", "open_item", "==", "title", ":", "extra_query_arguments", "=", "{", "'open_item'"...
https://github.com/reahl/reahl/blob/86aac47c3a9b5b98e9f77dad4939034a02d54d46/reahl-web/reahl/web/bootstrap/navs.py#L222-L251
MichiganCOG/ViP
74776f2575bd5339ba39c784bbda4f04cc859add
metrics.py
python
AverageRecall.get_recall
(self, predictions, targets, targets_mask)
Args: predictions: shape [N,C,4], coordinate format [x1, y1, x2, y2] targets: shape [N,C,4] targets_mask: binary mask, shape [N,C]
Args: predictions: shape [N,C,4], coordinate format [x1, y1, x2, y2] targets: shape [N,C,4] targets_mask: binary mask, shape [N,C]
[ "Args", ":", "predictions", ":", "shape", "[", "N", "C", "4", "]", "coordinate", "format", "[", "x1", "y1", "x2", "y2", "]", "targets", ":", "shape", "[", "N", "C", "4", "]", "targets_mask", ":", "binary", "mask", "shape", "[", "N", "C", "]" ]
def get_recall(self, predictions, targets, targets_mask): """ Args: predictions: shape [N,C,4], coordinate format [x1, y1, x2, y2] targets: shape [N,C,4] targets_mask: binary mask, shape [N,C] """ iou_values = self.IOU.get_accuracy(predictions, targets...
[ "def", "get_recall", "(", "self", ",", "predictions", ",", "targets", ",", "targets_mask", ")", ":", "iou_values", "=", "self", ".", "IOU", ".", "get_accuracy", "(", "predictions", ",", "targets", ")", "#[N,C] ", "TP", "=", "torch", ".", "sum", "(", "(",...
https://github.com/MichiganCOG/ViP/blob/74776f2575bd5339ba39c784bbda4f04cc859add/metrics.py#L427-L442
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/contrib/messages/api.py
python
warning
(request, message, extra_tags='', fail_silently=False)
Adds a message with the ``WARNING`` level.
Adds a message with the ``WARNING`` level.
[ "Adds", "a", "message", "with", "the", "WARNING", "level", "." ]
def warning(request, message, extra_tags='', fail_silently=False): """ Adds a message with the ``WARNING`` level. """ add_message(request, constants.WARNING, message, extra_tags=extra_tags, fail_silently=fail_silently)
[ "def", "warning", "(", "request", ",", "message", ",", "extra_tags", "=", "''", ",", "fail_silently", "=", "False", ")", ":", "add_message", "(", "request", ",", "constants", ".", "WARNING", ",", "message", ",", "extra_tags", "=", "extra_tags", ",", "fail_...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/messages/api.py#L89-L94
JDASoftwareGroup/kartothek
1821ea5df60d4079d3911b3c2f17be11d8780e22
kartothek/core/index.py
python
IndexBase.observed_values
(self, date_as_object=True)
return np.array(labeled_array.to_pandas(date_as_object=date_as_object))
Return an array of all observed values
Return an array of all observed values
[ "Return", "an", "array", "of", "all", "observed", "values" ]
def observed_values(self, date_as_object=True) -> np.ndarray: """ Return an array of all observed values """ keys = np.array(list(self.index_dct.keys())) labeled_array = pa.array(keys, type=self.dtype) return np.array(labeled_array.to_pandas(date_as_object=date_as_object)...
[ "def", "observed_values", "(", "self", ",", "date_as_object", "=", "True", ")", "->", "np", ".", "ndarray", ":", "keys", "=", "np", ".", "array", "(", "list", "(", "self", ".", "index_dct", ".", "keys", "(", ")", ")", ")", "labeled_array", "=", "pa",...
https://github.com/JDASoftwareGroup/kartothek/blob/1821ea5df60d4079d3911b3c2f17be11d8780e22/kartothek/core/index.py#L142-L148
deepmind/dm_control
806a10e896e7c887635328bfa8352604ad0fedae
dm_control/mujoco/wrapper/core.py
python
UnmanagedMjrContext.__init__
(self)
[]
def __init__(self): ptr = ctypes.pointer(types.MJRCONTEXT()) mjlib.mjr_defaultContext(ptr) super().__init__(ptr)
[ "def", "__init__", "(", "self", ")", ":", "ptr", "=", "ctypes", ".", "pointer", "(", "types", ".", "MJRCONTEXT", "(", ")", ")", "mjlib", ".", "mjr_defaultContext", "(", "ptr", ")", "super", "(", ")", ".", "__init__", "(", "ptr", ")" ]
https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/mujoco/wrapper/core.py#L765-L768
zhou13/lcnn
e07e48b98d9c5b067a63d48445e757c2460ba4b6
lcnn/box.py
python
BoxList.to_json
(self, filename=None, encoding="utf-8", errors="strict", multiline=False, **json_kwargs)
Transform the BoxList object into a JSON string. :param filename: If provided will save to file :param encoding: File encoding :param errors: How to handle encoding errors :param multiline: Put each item in list onto it's own line :param json_kwargs: additional arguments to pass...
Transform the BoxList object into a JSON string.
[ "Transform", "the", "BoxList", "object", "into", "a", "JSON", "string", "." ]
def to_json(self, filename=None, encoding="utf-8", errors="strict", multiline=False, **json_kwargs): """ Transform the BoxList object into a JSON string. :param filename: If provided will save to file :param encoding: File encoding :param errors: ...
[ "def", "to_json", "(", "self", ",", "filename", "=", "None", ",", "encoding", "=", "\"utf-8\"", ",", "errors", "=", "\"strict\"", ",", "multiline", "=", "False", ",", "*", "*", "json_kwargs", ")", ":", "if", "filename", "and", "multiline", ":", "lines", ...
https://github.com/zhou13/lcnn/blob/e07e48b98d9c5b067a63d48445e757c2460ba4b6/lcnn/box.py#L861-L882
DanMcInerney/msf-autopwn
ba7c7835ca5ed3967875bd77ad6ac1716e9b84f4
msf-autopwn.py
python
run_ms17
(c_id, ip, os_type)
return mod_out
Exploit ms17_010
Exploit ms17_010
[ "Exploit", "ms17_010" ]
def run_ms17(c_id, ip, os_type): ''' Exploit ms17_010 ''' # Check for named pipe availability (preVista you could just grab em) # If we find one, then use Romance/Synergy instead of Blue port = '445' named_pipe = None named_pipes = check_named_pipes(c_id, ip, os_type) # Just use th...
[ "def", "run_ms17", "(", "c_id", ",", "ip", ",", "os_type", ")", ":", "# Check for named pipe availability (preVista you could just grab em)", "# If we find one, then use Romance/Synergy instead of Blue", "port", "=", "'445'", "named_pipe", "=", "None", "named_pipes", "=", "ch...
https://github.com/DanMcInerney/msf-autopwn/blob/ba7c7835ca5ed3967875bd77ad6ac1716e9b84f4/msf-autopwn.py#L667-L692
Netflix-Skunkworks/stethoscope
33a35236ca3857ab2a50b622ca51f445a55170fb
stethoscope/plugins/transform/vpnlabeler.py
python
VPNLabeler.transform
(self, events)
return events
Augment each event with a tag indicating whether the associated IP is in the VPN range.
Augment each event with a tag indicating whether the associated IP is in the VPN range.
[ "Augment", "each", "event", "with", "a", "tag", "indicating", "whether", "the", "associated", "IP", "is", "in", "the", "VPN", "range", "." ]
def transform(self, events): """Augment each event with a tag indicating whether the associated IP is in the VPN range.""" for event in events: event['vpn'] = (netaddr.IPAddress(event['ip_address']) in self._networks) return events
[ "def", "transform", "(", "self", ",", "events", ")", ":", "for", "event", "in", "events", ":", "event", "[", "'vpn'", "]", "=", "(", "netaddr", ".", "IPAddress", "(", "event", "[", "'ip_address'", "]", ")", "in", "self", ".", "_networks", ")", "retur...
https://github.com/Netflix-Skunkworks/stethoscope/blob/33a35236ca3857ab2a50b622ca51f445a55170fb/stethoscope/plugins/transform/vpnlabeler.py#L24-L28
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pydoc.py
python
classname
(object, modname)
return name
Get a class name and qualify it with a module name if necessary.
Get a class name and qualify it with a module name if necessary.
[ "Get", "a", "class", "name", "and", "qualify", "it", "with", "a", "module", "name", "if", "necessary", "." ]
def classname(object, modname): """Get a class name and qualify it with a module name if necessary.""" name = object.__name__ if object.__module__ != modname: name = object.__module__ + '.' + name return name
[ "def", "classname", "(", "object", ",", "modname", ")", ":", "name", "=", "object", ".", "__name__", "if", "object", ".", "__module__", "!=", "modname", ":", "name", "=", "object", ".", "__module__", "+", "'.'", "+", "name", "return", "name" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pydoc.py#L95-L100
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/core/batch_major_attention.py
python
LocalSelfAttentionXL.__init__
(self, params)
Constructs a LocalSelfAttentionXL object.
Constructs a LocalSelfAttentionXL object.
[ "Constructs", "a", "LocalSelfAttentionXL", "object", "." ]
def __init__(self, params): """Constructs a LocalSelfAttentionXL object.""" super().__init__(params) params = self.params if params.rel_pos_emb_dim is None or params.rel_pos_emb_dim <= 0: raise ValueError('Invalid rel_pos_emb_dim: %s' % params.rel_pos_emb_dim) if params.use_3d_recurrent_state...
[ "def", "__init__", "(", "self", ",", "params", ")", ":", "super", "(", ")", ".", "__init__", "(", "params", ")", "params", "=", "self", ".", "params", "if", "params", ".", "rel_pos_emb_dim", "is", "None", "or", "params", ".", "rel_pos_emb_dim", "<=", "...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/batch_major_attention.py#L2636-L2661
lehrblogger/where-do-you-go
51c1fb3a66d8babe00a9412c72ebbd66fe348d88
geo/geomodel.py
python
GeoModel.update_location
(self)
Syncs underlying geocell properties with the entity's location. Updates the underlying geocell properties of the entity to match the entity's location property. A put() must occur after this call to save the changes to App Engine.
Syncs underlying geocell properties with the entity's location.
[ "Syncs", "underlying", "geocell", "properties", "with", "the", "entity", "s", "location", "." ]
def update_location(self): """Syncs underlying geocell properties with the entity's location. Updates the underlying geocell properties of the entity to match the entity's location property. A put() must occur after this call to save the changes to App Engine.""" max_res_geocell = geocell.compute(s...
[ "def", "update_location", "(", "self", ")", ":", "max_res_geocell", "=", "geocell", ".", "compute", "(", "self", ".", "location", ")", "self", ".", "location_geocells", "=", "[", "max_res_geocell", "[", ":", "res", "]", "for", "res", "in", "range", "(", ...
https://github.com/lehrblogger/where-do-you-go/blob/51c1fb3a66d8babe00a9412c72ebbd66fe348d88/geo/geomodel.py#L55-L64
crits/crits_services
c7abf91f1865d913cffad4b966599da204f8ae43
taxii_service/handlers.py
python
add_feed_config_buttons
(html)
return SafeText(html[0:idx+9] + buttons + html[idx:])
Modify the form html to include buttons enabling the addition, editing, and removal of feeds. :return str
Modify the form html to include buttons enabling the addition, editing, and removal of feeds.
[ "Modify", "the", "form", "html", "to", "include", "buttons", "enabling", "the", "addition", "editing", "and", "removal", "of", "feeds", "." ]
def add_feed_config_buttons(html): """ Modify the form html to include buttons enabling the addition, editing, and removal of feeds. :return str """ # Add TAXII Feed config buttons to form html = str(html) idx = html.rfind('</select>') buttons = '<br /><input class="form_submit_but...
[ "def", "add_feed_config_buttons", "(", "html", ")", ":", "# Add TAXII Feed config buttons to form", "html", "=", "str", "(", "html", ")", "idx", "=", "html", ".", "rfind", "(", "'</select>'", ")", "buttons", "=", "'<br /><input class=\"form_submit_button\" type=\"button...
https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/taxii_service/handlers.py#L1892-L1904
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
examples/specialty_plots/skewt.py
python
SkewXAxes._set_lim_and_transforms
(self)
This is called once when the plot is created to set up all the transforms for the data, text and grids.
This is called once when the plot is created to set up all the transforms for the data, text and grids.
[ "This", "is", "called", "once", "when", "the", "plot", "is", "created", "to", "set", "up", "all", "the", "transforms", "for", "the", "data", "text", "and", "grids", "." ]
def _set_lim_and_transforms(self): """ This is called once when the plot is created to set up all the transforms for the data, text and grids. """ rot = 30 # Get the standard transform setup from the Axes base class super()._set_lim_and_transforms() # Ne...
[ "def", "_set_lim_and_transforms", "(", "self", ")", ":", "rot", "=", "30", "# Get the standard transform setup from the Axes base class", "super", "(", ")", ".", "_set_lim_and_transforms", "(", ")", "# Need to put the skew in the middle, after the scale and limits,", "# but befor...
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/examples/specialty_plots/skewt.py#L101-L132
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
private/scripts/refresh-problem-details.py
python
EditorialHandler.conditional
(dal_object)
return ( ( (dal_object.editorial_added_on == None) | (special_ops.date_op(dal_object.editorial_added_on) >= before_30) ) & \ ( (dal_object.editorial_link == None) | \ (dal_object.editorial_lin...
@params dal_object (DAL relation or Record object): Object on which the conditions should be applied
[]
def conditional(dal_object): """ @params dal_object (DAL relation or Record object): Object on which the conditions should be applied """ special_ops = SpecialOps(dal_object) return ( ( (dal_object.editorial_added_on == None) | ...
[ "def", "conditional", "(", "dal_object", ")", ":", "special_ops", "=", "SpecialOps", "(", "dal_object", ")", "return", "(", "(", "(", "dal_object", ".", "editorial_added_on", "==", "None", ")", "|", "(", "special_ops", ".", "date_op", "(", "dal_object", ".",...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/private/scripts/refresh-problem-details.py#L133-L153
thinkingmachines/geomancer
d1748c4c4f8f77fc4456ce1deef23f8f017c9549
geomancer/backend/cores/base.py
python
DBCore.ST_GeoFromText
(self, x)
Custom-implementation of converting a string into a geographical type As it turns out, :code:`ST_GeogFromText` only exists in BigQuery and PostGIS. Only :code:`ST_GeomFromText` is available for Spatialite. Thus, we need to construct our own method for type-casting
Custom-implementation of converting a string into a geographical type
[ "Custom", "-", "implementation", "of", "converting", "a", "string", "into", "a", "geographical", "type" ]
def ST_GeoFromText(self, x): """Custom-implementation of converting a string into a geographical type As it turns out, :code:`ST_GeogFromText` only exists in BigQuery and PostGIS. Only :code:`ST_GeomFromText` is available for Spatialite. Thus, we need to construct our own method for typ...
[ "def", "ST_GeoFromText", "(", "self", ",", "x", ")", ":", "raise", "NotImplementedError" ]
https://github.com/thinkingmachines/geomancer/blob/d1748c4c4f8f77fc4456ce1deef23f8f017c9549/geomancer/backend/cores/base.py#L44-L51
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/tkinter/__init__.py
python
IntVar.__init__
(self, master=None, value=None, name=None)
Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained.
Construct an integer variable.
[ "Construct", "an", "integer", "variable", "." ]
def __init__(self, master=None, value=None, name=None): """Construct an integer variable. MASTER can be given as master widget. VALUE is an optional value (defaults to 0) NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omi...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "value", "=", "None", ",", "name", "=", "None", ")", ":", "Variable", ".", "__init__", "(", "self", ",", "master", ",", "value", ",", "name", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/tkinter/__init__.py#L344-L354
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/xemacs.py
python
init
()
return ok
Return True if the plugin has loaded successfully.
Return True if the plugin has loaded successfully.
[ "Return", "True", "if", "the", "plugin", "has", "loaded", "successfully", "." ]
def init(): """Return True if the plugin has loaded successfully.""" ok = not g.unitTesting if ok: g.plugin_signon(__name__) return ok
[ "def", "init", "(", ")", ":", "ok", "=", "not", "g", ".", "unitTesting", "if", "ok", ":", "g", ".", "plugin_signon", "(", "__name__", ")", "return", "ok" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/xemacs.py#L46-L51
gitpython-developers/gitdb
2913a6454c9dfc803679dc5f75315e2d821ee977
gitdb/fun.py
python
loose_object_header_info
(m)
return type_name, int(size)
:return: tuple(type_string, uncompressed_size_in_bytes) the type string of the object as well as its uncompressed size in bytes. :param m: memory map from which to read the compressed object data
:return: tuple(type_string, uncompressed_size_in_bytes) the type string of the object as well as its uncompressed size in bytes. :param m: memory map from which to read the compressed object data
[ ":", "return", ":", "tuple", "(", "type_string", "uncompressed_size_in_bytes", ")", "the", "type", "string", "of", "the", "object", "as", "well", "as", "its", "uncompressed", "size", "in", "bytes", ".", ":", "param", "m", ":", "memory", "map", "from", "whi...
def loose_object_header_info(m): """ :return: tuple(type_string, uncompressed_size_in_bytes) the type string of the object as well as its uncompressed size in bytes. :param m: memory map from which to read the compressed object data""" decompress_size = 8192 # is used in cgit as well hd...
[ "def", "loose_object_header_info", "(", "m", ")", ":", "decompress_size", "=", "8192", "# is used in cgit as well", "hdr", "=", "decompressobj", "(", ")", ".", "decompress", "(", "m", ",", "decompress_size", ")", "type_name", ",", "size", "=", "hdr", "[", ":",...
https://github.com/gitpython-developers/gitdb/blob/2913a6454c9dfc803679dc5f75315e2d821ee977/gitdb/fun.py#L403-L412
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/html5lib/treewalkers/lxmletree.py
python
TreeWalker.__init__
(self, tree)
[]
def __init__(self, tree): if hasattr(tree, "getroot"): tree = Root(tree) elif isinstance(tree, list): tree = FragmentRoot(tree) _base.NonRecursiveTreeWalker.__init__(self, tree) self.filter = ihatexml.InfosetFilter()
[ "def", "__init__", "(", "self", ",", "tree", ")", ":", "if", "hasattr", "(", "tree", ",", "\"getroot\"", ")", ":", "tree", "=", "Root", "(", "tree", ")", "elif", "isinstance", "(", "tree", ",", "list", ")", ":", "tree", "=", "FragmentRoot", "(", "t...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/html5lib/treewalkers/lxmletree.py#L119-L125
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/lib2to3/pgen2/pgen.py
python
ParserGenerator.make_dfa
(self, start, finish)
return states
[]
def make_dfa(self, start, finish): # To turn an NFA into a DFA, we define the states of the DFA # to correspond to *sets* of states of the NFA. Then do some # state reduction. Let's represent sets as dicts with 1 for # values. assert isinstance(start, NFAState) assert i...
[ "def", "make_dfa", "(", "self", ",", "start", ",", "finish", ")", ":", "# To turn an NFA into a DFA, we define the states of the DFA", "# to correspond to *sets* of states of the NFA. Then do some", "# state reduction. Let's represent sets as dicts with 1 for", "# values.", "assert", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/lib2to3/pgen2/pgen.py#L169-L203
aeasringnar/django-RESTfulAPI
b76689f0feee33f0e8ca13f2a920f229f7a9af82
utils/WeChatPay.py
python
WeChatUnityPay.get_req_xml
(self)
return xml.encode('utf-8')
拼接XML
拼接XML
[ "拼接XML" ]
def get_req_xml(self): """ 拼接XML """ self.get_sign(self.params) # 生成签名 xml = "<xml>" for k in sorted(self.params.keys()): xml += '<{0}>{1}</{0}>'.format(k, self.params[k]) xml += "</xml>" print('得到XML:',xml) return xml.encode('utf-8')
[ "def", "get_req_xml", "(", "self", ")", ":", "self", ".", "get_sign", "(", "self", ".", "params", ")", "# 生成签名", "xml", "=", "\"<xml>\"", "for", "k", "in", "sorted", "(", "self", ".", "params", ".", "keys", "(", ")", ")", ":", "xml", "+=", "'<{0}>{...
https://github.com/aeasringnar/django-RESTfulAPI/blob/b76689f0feee33f0e8ca13f2a920f229f7a9af82/utils/WeChatPay.py#L81-L91
sztomi/code-generator
f9e1b108664a21728f1dc5b504f8966ea40ee9e0
src/clang/cindex.py
python
TokenKind.register
(value, name)
Register a new TokenKind enumeration. This should only be called at module load time by code within this package.
Register a new TokenKind enumeration.
[ "Register", "a", "new", "TokenKind", "enumeration", "." ]
def register(value, name): """Register a new TokenKind enumeration. This should only be called at module load time by code within this package. """ if value in TokenKind._value_map: raise ValueError('TokenKind already registered: %d' % value) kind = TokenKin...
[ "def", "register", "(", "value", ",", "name", ")", ":", "if", "value", "in", "TokenKind", ".", "_value_map", ":", "raise", "ValueError", "(", "'TokenKind already registered: %d'", "%", "value", ")", "kind", "=", "TokenKind", "(", "value", ",", "name", ")", ...
https://github.com/sztomi/code-generator/blob/f9e1b108664a21728f1dc5b504f8966ea40ee9e0/src/clang/cindex.py#L485-L496
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/interpreter.py
python
Interpreter.op_INPLACE_MODULO
(self, inst, lhs, rhs, res)
[]
def op_INPLACE_MODULO(self, inst, lhs, rhs, res): self._inplace_binop('%', lhs, rhs, res)
[ "def", "op_INPLACE_MODULO", "(", "self", ",", "inst", ",", "lhs", ",", "rhs", ",", "res", ")", ":", "self", ".", "_inplace_binop", "(", "'%'", ",", "lhs", ",", "rhs", ",", "res", ")" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/interpreter.py#L1540-L1541
docker/docker-py
a48a5a9647761406d66e8271f19fab7fa0c5f582
docker/context/api.py
python
ContextAPI.get_context
(cls, name=None)
return Context.load_context(name)
Retrieves a context object. Args: name (str): The name of the context Example: >>> from docker.context import ContextAPI >>> ctx = ContextAPI.get_context(name='test') >>> print(ctx.Metadata) { "Name": "test", "Metadata": {}, ...
Retrieves a context object. Args: name (str): The name of the context
[ "Retrieves", "a", "context", "object", ".", "Args", ":", "name", "(", "str", ")", ":", "The", "name", "of", "the", "context" ]
def get_context(cls, name=None): """Retrieves a context object. Args: name (str): The name of the context Example: >>> from docker.context import ContextAPI >>> ctx = ContextAPI.get_context(name='test') >>> print(ctx.Metadata) { "Name": "...
[ "def", "get_context", "(", "cls", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "name", "=", "get_current_context_name", "(", ")", "if", "name", "==", "\"default\"", ":", "return", "cls", ".", "DEFAULT_CONTEXT", "return", "Context", ".", ...
https://github.com/docker/docker-py/blob/a48a5a9647761406d66e8271f19fab7fa0c5f582/docker/context/api.py#L70-L95
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet2/bin/enh_inference.py
python
SeparateSpeech.cal_permumation
(self, ref_wavs, enh_wavs, criterion="si_snr")
return perm
Calculate the permutation between seaprated streams in two adjacent segments. Args: ref_wavs (List[torch.Tensor]): [(Batch, Nsamples)] enh_wavs (List[torch.Tensor]): [(Batch, Nsamples)] criterion (str): one of ("si_snr", "mse", "corr) Returns: perm (torch...
Calculate the permutation between seaprated streams in two adjacent segments.
[ "Calculate", "the", "permutation", "between", "seaprated", "streams", "in", "two", "adjacent", "segments", "." ]
def cal_permumation(self, ref_wavs, enh_wavs, criterion="si_snr"): """Calculate the permutation between seaprated streams in two adjacent segments. Args: ref_wavs (List[torch.Tensor]): [(Batch, Nsamples)] enh_wavs (List[torch.Tensor]): [(Batch, Nsamples)] criterion (...
[ "def", "cal_permumation", "(", "self", ",", "ref_wavs", ",", "enh_wavs", ",", "criterion", "=", "\"si_snr\"", ")", ":", "criterion_class", "=", "{", "\"si_snr\"", ":", "SISNRLoss", ",", "\"mse\"", ":", "FrequencyDomainMSE", "}", "[", "criterion", "]", "pit_sol...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet2/bin/enh_inference.py#L238-L255
Symbo1/wsltools
0b6e536fc85c707a1c81f0296c4e91ca835396a1
wsltools/utils/faker/providers/address/ne_NP/__init__.py
python
Provider.building_prefix
(self)
return self.random_element(self.building_prefixes)
:example वडा
:example वडा
[ ":", "example", "वडा" ]
def building_prefix(self): """ :example वडा """ return self.random_element(self.building_prefixes)
[ "def", "building_prefix", "(", "self", ")", ":", "return", "self", ".", "random_element", "(", "self", ".", "building_prefixes", ")" ]
https://github.com/Symbo1/wsltools/blob/0b6e536fc85c707a1c81f0296c4e91ca835396a1/wsltools/utils/faker/providers/address/ne_NP/__init__.py#L598-L602
ev3dev/ev3dev-lang-python
f84152ca9b952a7a47a3f477542f878f3b69b824
ev3dev2/stopwatch.py
python
StopWatch.value_hms
(self)
return hours, mins, secs, x
Returns this StopWatch's elapsed time as a tuple ``(hours, minutes, seconds, milliseconds)``.
Returns this StopWatch's elapsed time as a tuple ``(hours, minutes, seconds, milliseconds)``.
[ "Returns", "this", "StopWatch", "s", "elapsed", "time", "as", "a", "tuple", "(", "hours", "minutes", "seconds", "milliseconds", ")", "." ]
def value_hms(self): """ Returns this StopWatch's elapsed time as a tuple ``(hours, minutes, seconds, milliseconds)``. """ (hours, x) = divmod(int(self.value_ms), 3600000) (mins, x) = divmod(x, 60000) (secs, x) = divmod(x, 1000) return hours, mins, secs, x
[ "def", "value_hms", "(", "self", ")", ":", "(", "hours", ",", "x", ")", "=", "divmod", "(", "int", "(", "self", ".", "value_ms", ")", ",", "3600000", ")", "(", "mins", ",", "x", ")", "=", "divmod", "(", "x", ",", "60000", ")", "(", "secs", ",...
https://github.com/ev3dev/ev3dev-lang-python/blob/f84152ca9b952a7a47a3f477542f878f3b69b824/ev3dev2/stopwatch.py#L109-L117
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/xmlrpclib.py
python
loads
(data, use_datetime=0)
return u.close(), u.getmethodname()
data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception.
data -> unmarshalled data, method name
[ "data", "-", ">", "unmarshalled", "data", "method", "name" ]
def loads(data, use_datetime=0): """data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception. """ p, u = getparser(use_datetime=...
[ "def", "loads", "(", "data", ",", "use_datetime", "=", "0", ")", ":", "p", ",", "u", "=", "getparser", "(", "use_datetime", "=", "use_datetime", ")", "p", ".", "feed", "(", "data", ")", "p", ".", "close", "(", ")", "return", "u", ".", "close", "(...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/xmlrpclib.py#L1134-L1146
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/media_player/__init__.py
python
MediaPlayerEntity.play_media
(self, media_type, media_id, **kwargs)
Play a piece of media.
Play a piece of media.
[ "Play", "a", "piece", "of", "media", "." ]
def play_media(self, media_type, media_id, **kwargs): """Play a piece of media.""" raise NotImplementedError()
[ "def", "play_media", "(", "self", ",", "media_type", ",", "media_id", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/media_player/__init__.py#L714-L716
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py
python
Text.window_configure
(self, index, cnf=None, **kw)
return self._configure(('window', 'configure', index), cnf, kw)
Configure an embedded window at INDEX.
Configure an embedded window at INDEX.
[ "Configure", "an", "embedded", "window", "at", "INDEX", "." ]
def window_configure(self, index, cnf=None, **kw): """Configure an embedded window at INDEX.""" return self._configure(('window', 'configure', index), cnf, kw)
[ "def", "window_configure", "(", "self", ",", "index", ",", "cnf", "=", "None", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "_configure", "(", "(", "'window'", ",", "'configure'", ",", "index", ")", ",", "cnf", ",", "kw", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py#L3111-L3113
pyvideo/richard
894f5380e07d7e66453fe730891a21aca32d8edb
src/richard/base/views.py
python
stats
(request)
return ret
List statistics about the collection. E.g. number of videos, top 5 categories.
List statistics about the collection.
[ "List", "statistics", "about", "the", "collection", "." ]
def stats(request): """List statistics about the collection. E.g. number of videos, top 5 categories. """ # Retrieve objects of model `m`, ordered by the number of videos they have most_videos = lambda m: (m.objects.filter(videos__state=Video.STATE_LIVE) .anno...
[ "def", "stats", "(", "request", ")", ":", "# Retrieve objects of model `m`, ordered by the number of videos they have", "most_videos", "=", "lambda", "m", ":", "(", "m", ".", "objects", ".", "filter", "(", "videos__state", "=", "Video", ".", "STATE_LIVE", ")", ".", ...
https://github.com/pyvideo/richard/blob/894f5380e07d7e66453fe730891a21aca32d8edb/src/richard/base/views.py#L75-L106
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/forms/fields.py
python
RegexField.__init__
(self, regex, max_length=None, min_length=None, error_message=None, *args, **kwargs)
regex can be either a string or a compiled regular expression object. error_message is an optional error message to use, if 'Enter a valid value' is too generic for you.
regex can be either a string or a compiled regular expression object. error_message is an optional error message to use, if 'Enter a valid value' is too generic for you.
[ "regex", "can", "be", "either", "a", "string", "or", "a", "compiled", "regular", "expression", "object", ".", "error_message", "is", "an", "optional", "error", "message", "to", "use", "if", "Enter", "a", "valid", "value", "is", "too", "generic", "for", "yo...
def __init__(self, regex, max_length=None, min_length=None, error_message=None, *args, **kwargs): """ regex can be either a string or a compiled regular expression object. error_message is an optional error message to use, if 'Enter a valid value' is too generic for you. """ ...
[ "def", "__init__", "(", "self", ",", "regex", ",", "max_length", "=", "None", ",", "min_length", "=", "None", ",", "error_message", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# error_message is just kept for backwards compatibility:", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/forms/fields.py#L434-L446
qibinlou/SinaWeibo-Emotion-Classification
f336fc104abd68b0ec4180fe2ed80fafe49cb790
nltk/sem/logic.py
python
IndividualVariableExpression.constants
(self)
return set()
:see: Expression.constants()
:see: Expression.constants()
[ ":", "see", ":", "Expression", ".", "constants", "()" ]
def constants(self): """:see: Expression.constants()""" return set()
[ "def", "constants", "(", "self", ")", ":", "return", "set", "(", ")" ]
https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/sem/logic.py#L871-L873
robclewley/pydstool
939e3abc9dd1f180d35152bacbde57e24c85ff26
PyDSTool/Model.py
python
NonHybridModel._validateRegistry
(self, obsvars, intvars)
Validate Model's modelInfo attribute.
Validate Model's modelInfo attribute.
[ "Validate", "Model", "s", "modelInfo", "attribute", "." ]
def _validateRegistry(self, obsvars, intvars): """Validate Model's modelInfo attribute.""" # ensure that modelInfo is a single Generator object only assert len(self.modelInfo) == 1, \ "Non-hybrid model must contain a single Generator"
[ "def", "_validateRegistry", "(", "self", ",", "obsvars", ",", "intvars", ")", ":", "# ensure that modelInfo is a single Generator object only", "assert", "len", "(", "self", ".", "modelInfo", ")", "==", "1", ",", "\"Non-hybrid model must contain a single Generator\"" ]
https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/Model.py#L2118-L2122
vfilimonov/co2meter
8e9e8f9c89dc0c7baa75a4fb8ac6eba4272b886d
co2meter/co2meter.py
python
CO2monitor.is_alive
(self)
If the device is still connected
If the device is still connected
[ "If", "the", "device", "is", "still", "connected" ]
def is_alive(self): """ If the device is still connected """ try: with self.co2hid(send_magic_table=True): return True except: return False
[ "def", "is_alive", "(", "self", ")", ":", "try", ":", "with", "self", ".", "co2hid", "(", "send_magic_table", "=", "True", ")", ":", "return", "True", "except", ":", "return", "False" ]
https://github.com/vfilimonov/co2meter/blob/8e9e8f9c89dc0c7baa75a4fb8ac6eba4272b886d/co2meter/co2meter.py#L188-L194
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
rllib/agents/dreamer/dreamer_torch_policy.py
python
action_sampler_fn
(policy, model, input_dict, state, explore, timestep)
return action, logp, state
Action sampler function has two phases. During the prefill phase, actions are sampled uniformly [-1, 1]. During training phase, actions are evaluated through DreamerPolicy and an additive gaussian is added to incentivize exploration.
Action sampler function has two phases. During the prefill phase, actions are sampled uniformly [-1, 1]. During training phase, actions are evaluated through DreamerPolicy and an additive gaussian is added to incentivize exploration.
[ "Action", "sampler", "function", "has", "two", "phases", ".", "During", "the", "prefill", "phase", "actions", "are", "sampled", "uniformly", "[", "-", "1", "1", "]", ".", "During", "training", "phase", "actions", "are", "evaluated", "through", "DreamerPolicy",...
def action_sampler_fn(policy, model, input_dict, state, explore, timestep): """Action sampler function has two phases. During the prefill phase, actions are sampled uniformly [-1, 1]. During training phase, actions are evaluated through DreamerPolicy and an additive gaussian is added to incentivize expl...
[ "def", "action_sampler_fn", "(", "policy", ",", "model", ",", "input_dict", ",", "state", ",", "explore", ",", "timestep", ")", ":", "obs", "=", "input_dict", "[", "\"obs\"", "]", "# Custom Exploration", "if", "timestep", "<=", "policy", ".", "config", "[", ...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/rllib/agents/dreamer/dreamer_torch_policy.py#L197-L222
iGio90/Dwarf
bb3011cdffd209c7e3f5febe558053bf649ca69c
dwarf_debugger/ui/widgets/list_view.py
python
DwarfListView.rows_dualcolor
(self, value)
AlternatingRowColors
AlternatingRowColors
[ "AlternatingRowColors" ]
def rows_dualcolor(self, value): """ AlternatingRowColors """ if isinstance(value, bool): self.setAlternatingRowColors(value) elif isinstance(value, str): self.setAlternatingRowColors(value.lower() == 'true')
[ "def", "rows_dualcolor", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "self", ".", "setAlternatingRowColors", "(", "value", ")", "elif", "isinstance", "(", "value", ",", "str", ")", ":", "self", ".", "se...
https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/ui/widgets/list_view.py#L70-L76
fastnlp/fastNLP
fb645d370f4cc1b00c7dbb16c1ff4542327c46e5
reproduction/sequence_labelling/cws/model/metric.py
python
RelayMetric.get_metric
(self, reset=True)
return {'f': round(f, 6), 'pre': round(pre, 6), 'rec': round(rec, 6)}
在所有数据都计算结束之后,得到performance :param reset: :return:
在所有数据都计算结束之后,得到performance :param reset: :return:
[ "在所有数据都计算结束之后,得到performance", ":", "param", "reset", ":", ":", "return", ":" ]
def get_metric(self, reset=True): """ 在所有数据都计算结束之后,得到performance :param reset: :return: """ pre = self.tp/(self.pre + 1e-12) rec = self.tp/(self.rec + 1e-12) f = 2*pre*rec/(1e-12 + pre + rec) if reset: self.tp = 0 ...
[ "def", "get_metric", "(", "self", ",", "reset", "=", "True", ")", ":", "pre", "=", "self", ".", "tp", "/", "(", "self", ".", "pre", "+", "1e-12", ")", "rec", "=", "self", ".", "tp", "/", "(", "self", ".", "rec", "+", "1e-12", ")", "f", "=", ...
https://github.com/fastnlp/fastNLP/blob/fb645d370f4cc1b00c7dbb16c1ff4542327c46e5/reproduction/sequence_labelling/cws/model/metric.py#L27-L44
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/inspect.py
python
_signature_is_builtin
(obj)
return (isbuiltin(obj) or ismethoddescriptor(obj) or isinstance(obj, _NonUserDefinedCallables) or # Can't test 'isinstance(type)' here, as it would # also be True for regular python classes obj in (type, object))
Private helper to test if `obj` is a callable that might support Argument Clinic's __text_signature__ protocol.
Private helper to test if `obj` is a callable that might support Argument Clinic's __text_signature__ protocol.
[ "Private", "helper", "to", "test", "if", "obj", "is", "a", "callable", "that", "might", "support", "Argument", "Clinic", "s", "__text_signature__", "protocol", "." ]
def _signature_is_builtin(obj): """Private helper to test if `obj` is a callable that might support Argument Clinic's __text_signature__ protocol. """ return (isbuiltin(obj) or ismethoddescriptor(obj) or isinstance(obj, _NonUserDefinedCallables) or # Can't test 'isins...
[ "def", "_signature_is_builtin", "(", "obj", ")", ":", "return", "(", "isbuiltin", "(", "obj", ")", "or", "ismethoddescriptor", "(", "obj", ")", "or", "isinstance", "(", "obj", ",", "_NonUserDefinedCallables", ")", "or", "# Can't test 'isinstance(type)' here, as it w...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/inspect.py#L1990-L1999
neo4j/neo4j-python-driver
97fd0e1da8223373018fa4755ac431b90a144f02
neo4j/graph/__init__.py
python
Path.end_node
(self)
return self._nodes[-1]
The last :class:`.Node` in this path.
The last :class:`.Node` in this path.
[ "The", "last", ":", "class", ":", ".", "Node", "in", "this", "path", "." ]
def end_node(self): """ The last :class:`.Node` in this path. """ return self._nodes[-1]
[ "def", "end_node", "(", "self", ")", ":", "return", "self", ".", "_nodes", "[", "-", "1", "]" ]
https://github.com/neo4j/neo4j-python-driver/blob/97fd0e1da8223373018fa4755ac431b90a144f02/neo4j/graph/__init__.py#L332-L335
zhao94254/pspider
b83430f00d168deb1ab3f15e7a7c93735bd307f7
spider/pspider.py
python
ReqParse.parse_func
(self)
放置请求的函数和处理返回的函数 self._req_func: { "request":{ "url": http://xxxx, "header": xxx, ... } "response":{ "handler": xxx, # handler最后返回 dict list(一般用在列表页) str } }
放置请求的函数和处理返回的函数 self._req_func: { "request":{ "url": http://xxxx, "header": xxx, ... } "response":{ "handler": xxx, # handler最后返回 dict list(一般用在列表页) str } }
[ "放置请求的函数和处理返回的函数", "self", ".", "_req_func", ":", "{", "request", ":", "{", "url", ":", "http", ":", "//", "xxxx", "header", ":", "xxx", "...", "}", "response", ":", "{", "handler", ":", "xxx", "#", "handler最后返回", "dict", "list(一般用在列表页)", "str", "}", "...
def parse_func(self): """ 放置请求的函数和处理返回的函数 self._req_func: { "request":{ "url": http://xxxx, "header": xxx, ... } "response":{ "handler": xxx, # handler最后返回 dict list(一般用在列表页) str } } ...
[ "def", "parse_func", "(", "self", ")", ":", "r", "=", "self", ".", "_req_func", "(", ")", "if", "'request'", "in", "r", "and", "'response'", "in", "r", ":", "_req", "=", "r", "[", "'request'", "]", "_resp", "=", "r", "[", "'response'", "]", "if", ...
https://github.com/zhao94254/pspider/blob/b83430f00d168deb1ab3f15e7a7c93735bd307f7/spider/pspider.py#L88-L119
SpiderClub/weibospider
e1f289871187da9e1c9096cd61984066c73625a8
page_parse/home.py
python
get_total_page
(html)
return get_max_num(cont)
从ajax返回的内容获取用户主页的所有能看到的页数 :param html: :return:
从ajax返回的内容获取用户主页的所有能看到的页数 :param html: :return:
[ "从ajax返回的内容获取用户主页的所有能看到的页数", ":", "param", "html", ":", ":", "return", ":" ]
def get_total_page(html): """ 从ajax返回的内容获取用户主页的所有能看到的页数 :param html: :return: """ cont = json.loads(html, encoding='utf-8').get('data', '') if not cont: # todo 返回1或者0还需要验证只有一页的情况 return 1 return get_max_num(cont)
[ "def", "get_total_page", "(", "html", ")", ":", "cont", "=", "json", ".", "loads", "(", "html", ",", "encoding", "=", "'utf-8'", ")", ".", "get", "(", "'data'", ",", "''", ")", "if", "not", "cont", ":", "# todo 返回1或者0还需要验证只有一页的情况", "return", "1", "retu...
https://github.com/SpiderClub/weibospider/blob/e1f289871187da9e1c9096cd61984066c73625a8/page_parse/home.py#L178-L188
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tbp/v20190627/tbp_client.py
python
TbpClient.TextReset
(self, request)
会话重置接口。 :param request: Request instance for TextReset. :type request: :class:`tencentcloud.tbp.v20190627.models.TextResetRequest` :rtype: :class:`tencentcloud.tbp.v20190627.models.TextResetResponse`
会话重置接口。
[ "会话重置接口。" ]
def TextReset(self, request): """会话重置接口。 :param request: Request instance for TextReset. :type request: :class:`tencentcloud.tbp.v20190627.models.TextResetRequest` :rtype: :class:`tencentcloud.tbp.v20190627.models.TextResetResponse` """ try: params = request...
[ "def", "TextReset", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"TextReset\"", ",", "params", ")", "response", "=", "json", ".", "loads", "(", "bod...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tbp/v20190627/tbp_client.py#L57-L82
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/sf/orthogonal.py
python
SymmetricFunctionAlgebra_orthogonal.__init__
(self, Sym)
Initialize ``self``. TESTS:: sage: o = SymmetricFunctions(QQ).o() sage: TestSuite(o).run()
Initialize ``self``.
[ "Initialize", "self", "." ]
def __init__(self, Sym): """ Initialize ``self``. TESTS:: sage: o = SymmetricFunctions(QQ).o() sage: TestSuite(o).run() """ sfa.SymmetricFunctionAlgebra_generic.__init__(self, Sym, "orthogonal", 'o', ...
[ "def", "__init__", "(", "self", ",", "Sym", ")", ":", "sfa", ".", "SymmetricFunctionAlgebra_generic", ".", "__init__", "(", "self", ",", "Sym", ",", "\"orthogonal\"", ",", "'o'", ",", "graded", "=", "False", ")", "# We make a strong reference since we use it for o...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/sf/orthogonal.py#L160-L183
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/tokenize/casual.py
python
reduce_lengthening
(text)
return pattern.sub(r"\1\1\1", text)
Replace repeated character sequences of length 3 or greater with sequences of length 3.
Replace repeated character sequences of length 3 or greater with sequences of length 3.
[ "Replace", "repeated", "character", "sequences", "of", "length", "3", "or", "greater", "with", "sequences", "of", "length", "3", "." ]
def reduce_lengthening(text): """ Replace repeated character sequences of length 3 or greater with sequences of length 3. """ pattern = regex.compile(r"(.)\1{2,}") return pattern.sub(r"\1\1\1", text)
[ "def", "reduce_lengthening", "(", "text", ")", ":", "pattern", "=", "regex", ".", "compile", "(", "r\"(.)\\1{2,}\"", ")", "return", "pattern", ".", "sub", "(", "r\"\\1\\1\\1\"", ",", "text", ")" ]
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/tokenize/casual.py#L391-L397