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
mingrammer/diagrams
e43c860732f6ae760c27831b0069838a2afa2bff
scripts/generate.py
python
make_module
(pvd: str, typ: str, classes: str)
Create a module file
Create a module file
[ "Create", "a", "module", "file" ]
def make_module(pvd: str, typ: str, classes: str) -> None: """Create a module file""" mod_path = os.path.join(app_root_dir(pvd), f"{typ}.py") with open(mod_path, "w+") as f: f.write(classes)
[ "def", "make_module", "(", "pvd", ":", "str", ",", "typ", ":", "str", ",", "classes", ":", "str", ")", "->", "None", ":", "mod_path", "=", "os", ".", "path", ".", "join", "(", "app_root_dir", "(", "pvd", ")", ",", "f\"{typ}.py\"", ")", "with", "ope...
https://github.com/mingrammer/diagrams/blob/e43c860732f6ae760c27831b0069838a2afa2bff/scripts/generate.py#L66-L70
phreeza/cells
1286eaac8b62c922b6cd300df6491f2b215c705e
cells.py
python
Game.add_agent
(self, a)
Adds an agent to the game.
Adds an agent to the game.
[ "Adds", "an", "agent", "to", "the", "game", "." ]
def add_agent(self, a): ''' Adds an agent to the game. ''' self.agent_population.append(a) self.agent_map.set(a.x, a.y, a)
[ "def", "add_agent", "(", "self", ",", "a", ")", ":", "self", ".", "agent_population", ".", "append", "(", "a", ")", "self", ".", "agent_map", ".", "set", "(", "a", ".", "x", ",", "a", ".", "y", ",", "a", ")" ]
https://github.com/phreeza/cells/blob/1286eaac8b62c922b6cd300df6491f2b215c705e/cells.py#L149-L152
Marten4n6/EvilOSX
033a662030e99b3704a1505244ebc1e6e59fba57
bot/loaders/launch_daemon/remove.py
python
run_command
(command)
return out + err
Runs a system command and returns its response.
Runs a system command and returns its response.
[ "Runs", "a", "system", "command", "and", "returns", "its", "response", "." ]
def run_command(command): """Runs a system command and returns its response.""" out, err = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate() return out + err
[ "def", "run_command", "(", "command", ")", ":", "out", ",", "err", "=", "subprocess", ".", "Popen", "(", "command", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "shell", "=", "True", ")", ".", "co...
https://github.com/Marten4n6/EvilOSX/blob/033a662030e99b3704a1505244ebc1e6e59fba57/bot/loaders/launch_daemon/remove.py#L9-L12
pikepdf/pikepdf
63b660b68b52a0f99ced3015fe4acb66fb6ca8d5
src/pikepdf/models/__init__.py
python
unparse_content_stream
( instructions: Collection[UnparseableContentStreamInstructions], )
Given a parsed list of instructions/operand-operators, convert to bytes suitable for embedding in a PDF. In PDF the operator always follows the operands. Args: instructions: collection of instructions such as is returned by :func:`parse_content_stream()` Returns: A binary conte...
Given a parsed list of instructions/operand-operators, convert to bytes suitable for embedding in a PDF. In PDF the operator always follows the operands.
[ "Given", "a", "parsed", "list", "of", "instructions", "/", "operand", "-", "operators", "convert", "to", "bytes", "suitable", "for", "embedding", "in", "a", "PDF", ".", "In", "PDF", "the", "operator", "always", "follows", "the", "operands", "." ]
def unparse_content_stream( instructions: Collection[UnparseableContentStreamInstructions], ) -> bytes: """ Given a parsed list of instructions/operand-operators, convert to bytes suitable for embedding in a PDF. In PDF the operator always follows the operands. Args: instructions: collectio...
[ "def", "unparse_content_stream", "(", "instructions", ":", "Collection", "[", "UnparseableContentStreamInstructions", "]", ",", ")", "->", "bytes", ":", "try", ":", "return", "_qpdf", ".", "_unparse_content_stream", "(", "instructions", ")", "except", "(", "ValueErr...
https://github.com/pikepdf/pikepdf/blob/63b660b68b52a0f99ced3015fe4acb66fb6ca8d5/src/pikepdf/models/__init__.py#L121-L147
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/exceptions.py
python
HashErrors.append
(self, error)
[]
def append(self, error): self.errors.append(error)
[ "def", "append", "(", "self", ",", "error", ")", ":", "self", ".", "errors", ".", "append", "(", "error", ")" ]
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/exceptions.py#L60-L61
EntilZha/PyFunctional
6064194206d54b6c71f7d8cd35183d6dc0ea7eab
functional/lineage.py
python
Lineage.__getitem__
(self, item)
return self.transformations[item]
Return specific transformation in lineage. :param item: Transformation to retrieve :return: Requested transformation
Return specific transformation in lineage. :param item: Transformation to retrieve :return: Requested transformation
[ "Return", "specific", "transformation", "in", "lineage", ".", ":", "param", "item", ":", "Transformation", "to", "retrieve", ":", "return", ":", "Requested", "transformation" ]
def __getitem__(self, item): """ Return specific transformation in lineage. :param item: Transformation to retrieve :return: Requested transformation """ return self.transformations[item]
[ "def", "__getitem__", "(", "self", ",", "item", ")", ":", "return", "self", ".", "transformations", "[", "item", "]" ]
https://github.com/EntilZha/PyFunctional/blob/6064194206d54b6c71f7d8cd35183d6dc0ea7eab/functional/lineage.py#L45-L51
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility-2.3/build/lib/volatility/plugins/linux/check_syscall_arm.py
python
linux_check_syscall_arm.calculate
(self)
This works by walking the system call table and verifies that each is a symbol in the kernel
This works by walking the system call table and verifies that each is a symbol in the kernel
[ "This", "works", "by", "walking", "the", "system", "call", "table", "and", "verifies", "that", "each", "is", "a", "symbol", "in", "the", "kernel" ]
def calculate(self): """ This works by walking the system call table and verifies that each is a symbol in the kernel """ linux_common.set_plugin_members(self) num_syscalls = self._get_syscall_table_size() syscall_addr = self._get_syscall_table_address(...
[ "def", "calculate", "(", "self", ")", ":", "linux_common", ".", "set_plugin_members", "(", "self", ")", "num_syscalls", "=", "self", ".", "_get_syscall_table_size", "(", ")", "syscall_addr", "=", "self", ".", "_get_syscall_table_address", "(", ")", "sym_addrs", ...
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility-2.3/build/lib/volatility/plugins/linux/check_syscall_arm.py#L62-L87
lektor/lektor
d5a7f22343572a991f2316c086f24005d0cbf0f8
lektor/db.py
python
Image.height
(self)
return Undefined("Height of image could not be determined.")
The height of the image if possible to determine.
The height of the image if possible to determine.
[ "The", "height", "of", "the", "image", "if", "possible", "to", "determine", "." ]
def height(self): """The height of the image if possible to determine.""" rv = self._get_image_info()[2] if rv is not None: return rv return Undefined("Height of image could not be determined.")
[ "def", "height", "(", "self", ")", ":", "rv", "=", "self", ".", "_get_image_info", "(", ")", "[", "2", "]", "if", "rv", "is", "not", "None", ":", "return", "rv", "return", "Undefined", "(", "\"Height of image could not be determined.\"", ")" ]
https://github.com/lektor/lektor/blob/d5a7f22343572a991f2316c086f24005d0cbf0f8/lektor/db.py#L792-L797
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/pytz/__init__.py
python
_FixedOffset.dst
(self, dt)
return ZERO
[]
def dst(self, dt): return ZERO
[ "def", "dst", "(", "self", ",", "dt", ")", ":", "return", "ZERO" ]
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/pytz/__init__.py#L390-L391
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/req/req_set.py
python
make_abstract_dist
(req_to_install)
Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction.
Factory to make an abstract dist object.
[ "Factory", "to", "make", "an", "abstract", "dist", "object", "." ]
def make_abstract_dist(req_to_install): """Factory to make an abstract dist object. Preconditions: Either an editable req with a source_dir, or satisfied_by or a wheel link, or a non-editable req with a source_dir. :return: A concrete DistAbstraction. """ if req_to_install.editable: re...
[ "def", "make_abstract_dist", "(", "req_to_install", ")", ":", "if", "req_to_install", ".", "editable", ":", "return", "IsSDist", "(", "req_to_install", ")", "elif", "req_to_install", ".", "link", "and", "req_to_install", ".", "link", ".", "is_wheel", ":", "retur...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/req/req_set.py#L90-L103
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/core/rnn_cell.py
python
LSTMCellSimple.PostTrainingStepUpdate
(self)
Update the global_step value.
Update the global_step value.
[ "Update", "the", "global_step", "value", "." ]
def PostTrainingStepUpdate(self): """Update the global_step value.""" p = self.params if p.deterministic: with tf.name_scope(p.name): summary_utils.scalar('step_counter', self.vars.lstm_step_counter) return self.vars.lstm_step_counter.assign(py_utils.GetGlobalStep()) else: retu...
[ "def", "PostTrainingStepUpdate", "(", "self", ")", ":", "p", "=", "self", ".", "params", "if", "p", ".", "deterministic", ":", "with", "tf", ".", "name_scope", "(", "p", ".", "name", ")", ":", "summary_utils", ".", "scalar", "(", "'step_counter'", ",", ...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/rnn_cell.py#L683-L691
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/stringold.py
python
atol
(*args)
atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. I...
atol(s [,base]) -> long
[ "atol", "(", "s", "[", "base", "]", ")", "-", ">", "long" ]
def atol(*args): """atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x o...
[ "def", "atol", "(", "*", "args", ")", ":", "try", ":", "s", "=", "args", "[", "0", "]", "except", "IndexError", ":", "raise", "TypeError", "(", "'function requires at least 1 argument: %d given'", "%", "len", "(", "args", ")", ")", "# Don't catch type error re...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/stringold.py#L237-L261
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
external/linux32/lib/python2.6/site-packages/matplotlib/axes.py
python
Axes.set_ybound
(self, lower=None, upper=None)
Set the lower and upper numerical bounds of the y-axis. This method will honor axes inversion regardless of parameter order.
Set the lower and upper numerical bounds of the y-axis. This method will honor axes inversion regardless of parameter order.
[ "Set", "the", "lower", "and", "upper", "numerical", "bounds", "of", "the", "y", "-", "axis", ".", "This", "method", "will", "honor", "axes", "inversion", "regardless", "of", "parameter", "order", "." ]
def set_ybound(self, lower=None, upper=None): """Set the lower and upper numerical bounds of the y-axis. This method will honor axes inversion regardless of parameter order. """ if upper is None and iterable(lower): lower,upper = lower old_lower,old_upper = self.g...
[ "def", "set_ybound", "(", "self", ",", "lower", "=", "None", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", "and", "iterable", "(", "lower", ")", ":", "lower", ",", "upper", "=", "lower", "old_lower", ",", "old_upper", "=", "self",...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/axes.py#L1985-L2006
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/setuptools/dist.py
python
Distribution.include_feature
(self, name)
Request inclusion of feature named 'name
Request inclusion of feature named 'name
[ "Request", "inclusion", "of", "feature", "named", "name" ]
def include_feature(self, name): """Request inclusion of feature named 'name'""" if self.feature_is_included(name) == 0: descr = self.features[name].description raise DistutilsOptionError( descr + " is required, but was excluded or is not available" )...
[ "def", "include_feature", "(", "self", ",", "name", ")", ":", "if", "self", ".", "feature_is_included", "(", "name", ")", "==", "0", ":", "descr", "=", "self", ".", "features", "[", "name", "]", ".", "description", "raise", "DistutilsOptionError", "(", "...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/setuptools/dist.py#L663-L672
jeffkit/wechat
95510106605e3870e81d7b2ea08ef7868b01d3bf
wechat/enterprise.py
python
WxApi.send_voice
(self, media_id, agentid, safe="0", touser=None, toparty=None, totag=None, media_url=None)
return self.send_simple_media('voice', media_id, agentid, safe, touser, toparty, totag, media_url)
[]
def send_voice(self, media_id, agentid, safe="0", touser=None, toparty=None, totag=None, media_url=None): return self.send_simple_media('voice', media_id, agentid, safe, touser, toparty, totag, media_url)
[ "def", "send_voice", "(", "self", ",", "media_id", ",", "agentid", ",", "safe", "=", "\"0\"", ",", "touser", "=", "None", ",", "toparty", "=", "None", ",", "totag", "=", "None", ",", "media_url", "=", "None", ")", ":", "return", "self", ".", "send_si...
https://github.com/jeffkit/wechat/blob/95510106605e3870e81d7b2ea08ef7868b01d3bf/wechat/enterprise.py#L272-L275
aiogram/aiogram
4d2d81138681d730270819579f22b3a0001c43a5
aiogram/dispatcher/handler.py
python
Handler.notify
(self, *args)
return results
Notify handlers :param args: :return:
Notify handlers
[ "Notify", "handlers" ]
async def notify(self, *args): """ Notify handlers :param args: :return: """ from .filters import check_filters, FilterNotPassed results = [] data = {} ctx_data.set(data) if self.middleware_key: try: await se...
[ "async", "def", "notify", "(", "self", ",", "*", "args", ")", ":", "from", ".", "filters", "import", "check_filters", ",", "FilterNotPassed", "results", "=", "[", "]", "data", "=", "{", "}", "ctx_data", ".", "set", "(", "data", ")", "if", "self", "."...
https://github.com/aiogram/aiogram/blob/4d2d81138681d730270819579f22b3a0001c43a5/aiogram/dispatcher/handler.py#L84-L132
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py
python
TransformerGraphicItem.edit
(self)
Open the appropriate editor dialogue :return:
Open the appropriate editor dialogue :return:
[ "Open", "the", "appropriate", "editor", "dialogue", ":", "return", ":" ]
def edit(self): """ Open the appropriate editor dialogue :return: """ Sbase = self.diagramScene.circuit.Sbase templates = self.diagramScene.circuit.transformer_types current_template = self.api_object.template dlg = TransformerEditor(self.api_object, Sbase...
[ "def", "edit", "(", "self", ")", ":", "Sbase", "=", "self", ".", "diagramScene", ".", "circuit", ".", "Sbase", "templates", "=", "self", ".", "diagramScene", ".", "circuit", ".", "transformer_types", "current_template", "=", "self", ".", "api_object", ".", ...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py#L784-L797
qutip/qutip
52d01da181a21b810c3407812c670f35fdc647e8
qutip/nonmarkov/bofin_solvers.py
python
HEOMSolver.run
(self, rho0, tlist, e_ops=None, ado_init=False, ado_return=False)
return output
Solve for the time evolution of the system. Parameters ---------- rho0 : Qobj or HierarchyADOsState or numpy.array Initial state (:obj:`~Qobj` density matrix) of the system if ``ado_init`` is ``False``. If ``ado_init`` is ``True``, then ``rho0`` should be an...
Solve for the time evolution of the system.
[ "Solve", "for", "the", "time", "evolution", "of", "the", "system", "." ]
def run(self, rho0, tlist, e_ops=None, ado_init=False, ado_return=False): """ Solve for the time evolution of the system. Parameters ---------- rho0 : Qobj or HierarchyADOsState or numpy.array Initial state (:obj:`~Qobj` density matrix) of the system if `...
[ "def", "run", "(", "self", ",", "rho0", ",", "tlist", ",", "e_ops", "=", "None", ",", "ado_init", "=", "False", ",", "ado_return", "=", "False", ")", ":", "e_ops", ",", "expected", "=", "self", ".", "_convert_e_ops", "(", "e_ops", ")", "e_ops_callables...
https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/nonmarkov/bofin_solvers.py#L821-L957
quic/aimet
dae9bae9a77ca719aa7553fefde4768270fc3518
TrainingExtensions/torch/src/python/aimet_torch/winnow/winnow_utils.py
python
ReShape.forward
(self, x)
return x.view(self.shape)
forward pass
forward pass
[ "forward", "pass" ]
def forward(self, x): """ forward pass """ return x.view(self.shape)
[ "def", "forward", "(", "self", ",", "x", ")", ":", "return", "x", ".", "view", "(", "self", ".", "shape", ")" ]
https://github.com/quic/aimet/blob/dae9bae9a77ca719aa7553fefde4768270fc3518/TrainingExtensions/torch/src/python/aimet_torch/winnow/winnow_utils.py#L105-L107
materialsvirtuallab/megnet
debbb7f6ff987f196bb3914749713a9160215d4b
megnet/layers/graph/base.py
python
GraphNetworkLayer.phi_v
(self, b_ei_p: tf.Tensor, inputs: Sequence)
r""" Step 3. Compute updated node attributes v_i' = phi_v(\bar e_i, vi, u) Args: b_ei_p (tf.Tensor): edge-to-node aggregated tensor inputs (Sequence): list or tuple for the graph inputs Returns: updated node/atom attributes
r""" Step 3. Compute updated node attributes v_i' = phi_v(\bar e_i, vi, u)
[ "r", "Step", "3", ".", "Compute", "updated", "node", "attributes", "v_i", "=", "phi_v", "(", "\\", "bar", "e_i", "vi", "u", ")" ]
def phi_v(self, b_ei_p: tf.Tensor, inputs: Sequence): r""" Step 3. Compute updated node attributes v_i' = phi_v(\bar e_i, vi, u) Args: b_ei_p (tf.Tensor): edge-to-node aggregated tensor inputs (Sequence): list or tuple for the graph inputs Returns: ...
[ "def", "phi_v", "(", "self", ",", "b_ei_p", ":", "tf", ".", "Tensor", ",", "inputs", ":", "Sequence", ")", ":", "raise", "NotImplementedError" ]
https://github.com/materialsvirtuallab/megnet/blob/debbb7f6ff987f196bb3914749713a9160215d4b/megnet/layers/graph/base.py#L129-L140
wbond/package_control
cfaaeb57612023e3679ecb7f8cd7ceac9f57990d
package_control/deps/asn1crypto/x509.py
python
Certificate.signature
(self)
return self['signature_value'].native
:return: A byte string of the signature
:return: A byte string of the signature
[ ":", "return", ":", "A", "byte", "string", "of", "the", "signature" ]
def signature(self): """ :return: A byte string of the signature """ return self['signature_value'].native
[ "def", "signature", "(", "self", ")", ":", "return", "self", "[", "'signature_value'", "]", ".", "native" ]
https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/package_control/deps/asn1crypto/x509.py#L2499-L2505
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/lang/llvmir/parser.py
python
LlvmIrParser.parse_define
(self)
Parse a function
Parse a function
[ "Parse", "a", "function" ]
def parse_define(self): """ Parse a function """ self.consume("define") function = self.parse_function_header() self.parse_function_body(function)
[ "def", "parse_define", "(", "self", ")", ":", "self", ".", "consume", "(", "\"define\"", ")", "function", "=", "self", ".", "parse_function_header", "(", ")", "self", ".", "parse_function_body", "(", "function", ")" ]
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/lang/llvmir/parser.py#L66-L70
pybrain/pybrain
dcdf32ba1805490cefbc0bdeb227260d304fdb42
pybrain/utilities.py
python
_import
(name)
return mod
Return module from a package. These two are equivalent: > from package import module as bar > bar = _import('package.module')
Return module from a package.
[ "Return", "module", "from", "a", "package", "." ]
def _import(name): """Return module from a package. These two are equivalent: > from package import module as bar > bar = _import('package.module') """ mod = __import__(name) components = name.split('.') for comp in components[1:]: try: mod = getattr(mod, c...
[ "def", "_import", "(", "name", ")", ":", "mod", "=", "__import__", "(", "name", ")", "components", "=", "name", ".", "split", "(", "'.'", ")", "for", "comp", "in", "components", "[", "1", ":", "]", ":", "try", ":", "mod", "=", "getattr", "(", "mo...
https://github.com/pybrain/pybrain/blob/dcdf32ba1805490cefbc0bdeb227260d304fdb42/pybrain/utilities.py#L331-L347
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/webpage/webpage/libs/soupsieve/css_match.py
python
_FakeParent.__len__
(self)
return len(self.contents)
Length.
Length.
[ "Length", "." ]
def __len__(self): """Length.""" return len(self.contents)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "contents", ")" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/soupsieve/css_match.py#L71-L74
juhot/MPE_Util
c4b8aec5d2170752ded8ab7fa6faa8d12030bdd2
MPE_Util.py
python
TrackModel.s_name
(self)
return self._s_name
s_name is the tracks name without the index-number at the beginning.
s_name is the tracks name without the index-number at the beginning.
[ "s_name", "is", "the", "tracks", "name", "without", "the", "index", "-", "number", "at", "the", "beginning", "." ]
def s_name(self): """ s_name is the tracks name without the index-number at the beginning. """ return self._s_name
[ "def", "s_name", "(", "self", ")", ":", "return", "self", ".", "_s_name" ]
https://github.com/juhot/MPE_Util/blob/c4b8aec5d2170752ded8ab7fa6faa8d12030bdd2/MPE_Util.py#L248-L250
enaeseth/python-fp-growth
49763de81738523910e82c7fa07bb65c5679c809
fp_growth.py
python
FPNode.children
(self)
return tuple(self._children.itervalues())
The nodes that are children of this node.
The nodes that are children of this node.
[ "The", "nodes", "that", "are", "children", "of", "this", "node", "." ]
def children(self): """The nodes that are children of this node.""" return tuple(self._children.itervalues())
[ "def", "children", "(", "self", ")", ":", "return", "tuple", "(", "self", ".", "_children", ".", "itervalues", "(", ")", ")" ]
https://github.com/enaeseth/python-fp-growth/blob/49763de81738523910e82c7fa07bb65c5679c809/fp_growth.py#L310-L312
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/content/analysisrequest.py
python
AnalysisRequest.getSubtotalVATAmount
(self)
return 0
Compute VAT amount without member discount
Compute VAT amount without member discount
[ "Compute", "VAT", "amount", "without", "member", "discount" ]
def getSubtotalVATAmount(self): """Compute VAT amount without member discount """ analyses, a_profiles = self.getBillableItems() if len(analyses) > 0 or len(a_profiles) > 0: return sum( [Decimal(o.getVATAmount()) for o in analyses] + [Decimal(o...
[ "def", "getSubtotalVATAmount", "(", "self", ")", ":", "analyses", ",", "a_profiles", "=", "self", ".", "getBillableItems", "(", ")", "if", "len", "(", "analyses", ")", ">", "0", "or", "len", "(", "a_profiles", ")", ">", "0", ":", "return", "sum", "(", ...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/content/analysisrequest.py#L2126-L2135
tatp22/linformer-pytorch
f10226a6918cae0d5d72b392897a702ae30c6e36
examples/pretrain_tutorial_lm.py
python
get_optimizer
(model_parameters)
return optim, sched
Gets an optimizer. Just as an example, I put in SGD
Gets an optimizer. Just as an example, I put in SGD
[ "Gets", "an", "optimizer", ".", "Just", "as", "an", "example", "I", "put", "in", "SGD" ]
def get_optimizer(model_parameters): """ Gets an optimizer. Just as an example, I put in SGD """ optim = torch.optim.SGD(model_parameters, lr=config["lr"]) sched = torch.optim.lr_scheduler.StepLR(optim, 1.0, gamma=config["gamma"]) return optim, sched
[ "def", "get_optimizer", "(", "model_parameters", ")", ":", "optim", "=", "torch", ".", "optim", ".", "SGD", "(", "model_parameters", ",", "lr", "=", "config", "[", "\"lr\"", "]", ")", "sched", "=", "torch", ".", "optim", ".", "lr_scheduler", ".", "StepLR...
https://github.com/tatp22/linformer-pytorch/blob/f10226a6918cae0d5d72b392897a702ae30c6e36/examples/pretrain_tutorial_lm.py#L109-L115
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/channels/media_player.py
python
ChannelsPlayer.media_content_id
(self)
return self.channel_number
Content ID of current playing channel.
Content ID of current playing channel.
[ "Content", "ID", "of", "current", "playing", "channel", "." ]
def media_content_id(self): """Content ID of current playing channel.""" return self.channel_number
[ "def", "media_content_id", "(", "self", ")", ":", "return", "self", ".", "channel_number" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/channels/media_player.py#L191-L193
GitYCC/NTU_HYLee_MachineLearning_Homework
e59b8cd4432eed35493f845ad6c39e15cbf78e88
hw02/dnn.py
python
get_dnn_model
()
return model
[]
def get_dnn_model(): model = keras.models.Sequential() model.add(keras.layers.Dense(units=10, input_dim=57)) model.add(keras.layers.Activation('relu')) model.add(keras.layers.Dense(units=10)) model.add(keras.layers.Activation('relu')) model.add(keras.layers.Dense(units=2)) model.add(keras.la...
[ "def", "get_dnn_model", "(", ")", ":", "model", "=", "keras", ".", "models", ".", "Sequential", "(", ")", "model", ".", "add", "(", "keras", ".", "layers", ".", "Dense", "(", "units", "=", "10", ",", "input_dim", "=", "57", ")", ")", "model", ".", ...
https://github.com/GitYCC/NTU_HYLee_MachineLearning_Homework/blob/e59b8cd4432eed35493f845ad6c39e15cbf78e88/hw02/dnn.py#L8-L21
microsoft/SDNet
adef46911c4ef4161938e0dcc8a2b435cd680582
Models/Bert/tokenization.py
python
BasicTokenizer._run_split_on_punc
(self, text)
return ["".join(x) for x in output]
Splits punctuation on a piece of text.
Splits punctuation on a piece of text.
[ "Splits", "punctuation", "on", "a", "piece", "of", "text", "." ]
def _run_split_on_punc(self, text): """Splits punctuation on a piece of text.""" chars = list(text) i = 0 start_new_word = True output = [] while i < len(chars): char = chars[i] if _is_punctuation(char): output.append([char]) ...
[ "def", "_run_split_on_punc", "(", "self", ",", "text", ")", ":", "chars", "=", "list", "(", "text", ")", "i", "=", "0", "start_new_word", "=", "True", "output", "=", "[", "]", "while", "i", "<", "len", "(", "chars", ")", ":", "char", "=", "chars", ...
https://github.com/microsoft/SDNet/blob/adef46911c4ef4161938e0dcc8a2b435cd680582/Models/Bert/tokenization.py#L196-L214
cython/cython
9db1fc39b31b7b3b2ed574a79f5f9fd980ee3be7
Cython/Compiler/ParseTreeTransforms.py
python
DecoratorTransform.chain_decorators
(node, decorators, name)
return [node, reassignment]
Decorators are applied directly in DefNode and PyClassDefNode to avoid reassignments to the function/class name - except for cdef class methods. For those, the reassignment is required as methods are originally defined in the PyMethodDef struct. The IndirectionNode allows DefNode to ove...
Decorators are applied directly in DefNode and PyClassDefNode to avoid reassignments to the function/class name - except for cdef class methods. For those, the reassignment is required as methods are originally defined in the PyMethodDef struct.
[ "Decorators", "are", "applied", "directly", "in", "DefNode", "and", "PyClassDefNode", "to", "avoid", "reassignments", "to", "the", "function", "/", "class", "name", "-", "except", "for", "cdef", "class", "methods", ".", "For", "those", "the", "reassignment", "...
def chain_decorators(node, decorators, name): """ Decorators are applied directly in DefNode and PyClassDefNode to avoid reassignments to the function/class name - except for cdef class methods. For those, the reassignment is required as methods are originally defined in the PyMe...
[ "def", "chain_decorators", "(", "node", ",", "decorators", ",", "name", ")", ":", "decorator_result", "=", "ExprNodes", ".", "NameNode", "(", "node", ".", "pos", ",", "name", "=", "name", ")", "for", "decorator", "in", "decorators", "[", ":", ":", "-", ...
https://github.com/cython/cython/blob/9db1fc39b31b7b3b2ed574a79f5f9fd980ee3be7/Cython/Compiler/ParseTreeTransforms.py#L1576-L1600
kozec/sc-controller
ce92c773b8b26f6404882e9209aff212c4053170
scc/gui/macro_editor.py
python
MacroEditor.on_clearb_clicked
(self, trash, action_data)
Handler for 'delete action' button
Handler for 'delete action' button
[ "Handler", "for", "delete", "action", "button" ]
def on_clearb_clicked(self, trash, action_data): """ Handler for 'delete action' button """ self._clear_grid() self.actions.remove(action_data) readd = [ x.action for x in self.actions ] self._refill_grid(readd) self.update_action_field()
[ "def", "on_clearb_clicked", "(", "self", ",", "trash", ",", "action_data", ")", ":", "self", ".", "_clear_grid", "(", ")", "self", ".", "actions", ".", "remove", "(", "action_data", ")", "readd", "=", "[", "x", ".", "action", "for", "x", "in", "self", ...
https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/gui/macro_editor.py#L211-L217
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/decimal.py
python
Decimal._cmp
(self, other)
Compare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.
Compare the two non-NaN decimal instances self and other.
[ "Compare", "the", "two", "non", "-", "NaN", "decimal", "instances", "self", "and", "other", "." ]
def _cmp(self, other): """Compare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.""" if self._is_special or other._is_special: self_inf = self._isinfinity() ...
[ "def", "_cmp", "(", "self", ",", "other", ")", ":", "if", "self", ".", "_is_special", "or", "other", ".", "_is_special", ":", "self_inf", "=", "self", ".", "_isinfinity", "(", ")", "other_inf", "=", "other", ".", "_isinfinity", "(", ")", "if", "self_in...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/decimal.py#L799-L844
HaoZhang95/Python24
b897224b8a0e6a5734f408df8c24846a98c553bf
14Django/day03/BookManager/Book/views.py
python
test51
(request)
return JsonResponse(json_dict)
{ 这里或者替换成[]都行 'book_list': [ {'name': 'book1'}, {'name': 'book2'}, ] }
{ 这里或者替换成[]都行 'book_list': [ {'name': 'book1'}, {'name': 'book2'}, ] }
[ "{", "这里或者替换成", "[]", "都行", "book_list", ":", "[", "{", "name", ":", "book1", "}", "{", "name", ":", "book2", "}", "]", "}" ]
def test51(request): # 响应ajax局部刷新,返回一个json # 数据库查询 book_list = BookInfo.objects.all() # 不能直接传入一个列表,需要传入一个json格式的列表,或者一个json对象 # 转成以下的格式 """ { 这里或者替换成[]都行 'book_list': [ {'name': 'book1'}, {'name': 'book2'}, ] } """ ...
[ "def", "test51", "(", "request", ")", ":", "# 响应ajax局部刷新,返回一个json", "# 数据库查询", "book_list", "=", "BookInfo", ".", "objects", ".", "all", "(", ")", "# 不能直接传入一个列表,需要传入一个json格式的列表,或者一个json对象", "# 转成以下的格式", "book_dict_list", "=", "[", "]", "for", "book", "in", "book_l...
https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/14Django/day03/BookManager/Book/views.py#L71-L93
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/addons/account/wizard/account_report_print_journal.py
python
account_print_journal.fields_view_get
(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False)
return res
used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' in the context.
used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' in the context.
[ "used", "to", "set", "the", "domain", "on", "journal_ids", "field", ":", "we", "exclude", "or", "only", "propose", "the", "journals", "of", "type", "sale", "/", "purchase", "(", "+", "refund", ")", "accordingly", "to", "the", "presence", "of", "the", "ke...
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): ''' used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' ...
[ "def", "fields_view_get", "(", "self", ",", "cr", ",", "uid", ",", "view_id", "=", "None", ",", "view_type", "=", "'form'", ",", "context", "=", "None", ",", "toolbar", "=", "False", ",", "submenu", "=", "False", ")", ":", "if", "context", "is", "Non...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/account/wizard/account_report_print_journal.py#L44-L62
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/spack/modules/common.py
python
BaseModuleFileWriter.write
(self, overwrite=False)
Writes the module file. Args: overwrite (bool): if True it is fine to overwrite an already existing file. If False the operation is skipped an we print a warning to the user.
Writes the module file.
[ "Writes", "the", "module", "file", "." ]
def write(self, overwrite=False): """Writes the module file. Args: overwrite (bool): if True it is fine to overwrite an already existing file. If False the operation is skipped an we print a warning to the user. """ # Return immediately if the...
[ "def", "write", "(", "self", ",", "overwrite", "=", "False", ")", ":", "# Return immediately if the module is blacklisted", "if", "self", ".", "conf", ".", "blacklisted", ":", "msg", "=", "'\\tNOT WRITING: {0} [BLACKLISTED]'", "tty", ".", "debug", "(", "msg", ".",...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/modules/common.py#L836-L909
ideal/mirror
e57a98030dd8793c2e6cfbad6deb875db2afb184
mirror/configmanager.py
python
_ConfigManager.close
(self, config)
Close a config file.
Close a config file.
[ "Close", "a", "config", "file", "." ]
def close(self, config): """Close a config file.""" try: del self.config_files[config] except KeyError: pass
[ "def", "close", "(", "self", ",", "config", ")", ":", "try", ":", "del", "self", ".", "config_files", "[", "config", "]", "except", "KeyError", ":", "pass" ]
https://github.com/ideal/mirror/blob/e57a98030dd8793c2e6cfbad6deb875db2afb184/mirror/configmanager.py#L81-L86
Unbabel/OpenKiwi
07d7cfed880457d95daf189dd8282e5b02ac2954
kiwi/lib/search.py
python
Objective.updates_per_epochs
(self)
return int( self.num_train_lines / self.base_config_dict['system']['batch_size']['train'] / self.base_config_dict['trainer']['gradient_accumulation_steps'] )
The number of parameter updates per epochs.
The number of parameter updates per epochs.
[ "The", "number", "of", "parameter", "updates", "per", "epochs", "." ]
def updates_per_epochs(self) -> int: """The number of parameter updates per epochs.""" return int( self.num_train_lines / self.base_config_dict['system']['batch_size']['train'] / self.base_config_dict['trainer']['gradient_accumulation_steps'] )
[ "def", "updates_per_epochs", "(", "self", ")", "->", "int", ":", "return", "int", "(", "self", ".", "num_train_lines", "/", "self", ".", "base_config_dict", "[", "'system'", "]", "[", "'batch_size'", "]", "[", "'train'", "]", "/", "self", ".", "base_config...
https://github.com/Unbabel/OpenKiwi/blob/07d7cfed880457d95daf189dd8282e5b02ac2954/kiwi/lib/search.py#L314-L320
fortharris/Pcode
147962d160a834c219e12cb456abc130826468e4
Pcode.py
python
Pcode.addProject
(self, window, name, type='Project', iconPath=None)
[]
def addProject(self, window, name, type='Project', iconPath=None): self.projectWindowStack.insertWidget(0, window) if type == 'Project': self.projectTitleBox.insertItem(0, QtGui.QIcon( os.path.join("Resources", "images", "project")), name, [window, type]) else: ...
[ "def", "addProject", "(", "self", ",", "window", ",", "name", ",", "type", "=", "'Project'", ",", "iconPath", "=", "None", ")", ":", "self", ".", "projectWindowStack", ".", "insertWidget", "(", "0", ",", "window", ")", "if", "type", "==", "'Project'", ...
https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Pcode.py#L167-L174
yhlleo/tensorflow.cifar10
cd950323e7157e30391c123b665804b6276e38a6
compat.py
python
as_text
(bytes_or_text)
Returns the given argument as a unicode string. Args: bytes_or_text: A `bytes`, `str, or `unicode` object. Returns: A `unicode` (Python 2) or `str` (Python 3) object. Raises: TypeError: If `bytes_or_text` is not a binary or unicode string.
Returns the given argument as a unicode string.
[ "Returns", "the", "given", "argument", "as", "a", "unicode", "string", "." ]
def as_text(bytes_or_text): """Returns the given argument as a unicode string. Args: bytes_or_text: A `bytes`, `str, or `unicode` object. Returns: A `unicode` (Python 2) or `str` (Python 3) object. Raises: TypeError: If `bytes_or_text` is not a binary or unicode string. """ if isinstance(byte...
[ "def", "as_text", "(", "bytes_or_text", ")", ":", "if", "isinstance", "(", "bytes_or_text", ",", "six", ".", "text_type", ")", ":", "return", "bytes_or_text", "elif", "isinstance", "(", "bytes_or_text", ",", "bytes", ")", ":", "return", "bytes_or_text", ".", ...
https://github.com/yhlleo/tensorflow.cifar10/blob/cd950323e7157e30391c123b665804b6276e38a6/compat.py#L46-L63
sabri-zaki/EasY_HaCk
2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9
.modules/.theHarvester/discovery/IPy.py
python
IP.net
(self)
return IP(IPint.net(self))
Return the base (first) address of a network as an IP object. The same as IP[0]. >>> IP('10.0.0.0/8').net() IP('10.0.0.0')
Return the base (first) address of a network as an IP object.
[ "Return", "the", "base", "(", "first", ")", "address", "of", "a", "network", "as", "an", "IP", "object", "." ]
def net(self): """Return the base (first) address of a network as an IP object. The same as IP[0]. >>> IP('10.0.0.0/8').net() IP('10.0.0.0') """ return IP(IPint.net(self))
[ "def", "net", "(", "self", ")", ":", "return", "IP", "(", "IPint", ".", "net", "(", "self", ")", ")" ]
https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.theHarvester/discovery/IPy.py#L795-L803
EnterpriseDB/barman
487bad92edec72712531ead4746fad72bb310270
barman/backup_executor.py
python
FsBackupExecutor.__init__
(self, backup_manager, mode, local_mode=False)
Constructor of the abstract class for backups via Ssh :param barman.backup.BackupManager backup_manager: the BackupManager assigned to the executor :param bool local_mode: if set to False (default), the class is able to operate on remote servers using SSH. Operates only locally ...
Constructor of the abstract class for backups via Ssh
[ "Constructor", "of", "the", "abstract", "class", "for", "backups", "via", "Ssh" ]
def __init__(self, backup_manager, mode, local_mode=False): """ Constructor of the abstract class for backups via Ssh :param barman.backup.BackupManager backup_manager: the BackupManager assigned to the executor :param bool local_mode: if set to False (default), the class is...
[ "def", "__init__", "(", "self", ",", "backup_manager", ",", "mode", ",", "local_mode", "=", "False", ")", ":", "super", "(", "FsBackupExecutor", ",", "self", ")", ".", "__init__", "(", "backup_manager", ",", "mode", ")", "# Set local/remote mode for copy", "se...
https://github.com/EnterpriseDB/barman/blob/487bad92edec72712531ead4746fad72bb310270/barman/backup_executor.py#L674-L737
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/reportlab/src/reportlab/graphics/shapes.py
python
Group.shift
(self, x, y)
Convenience function to set the origin arbitrarily
Convenience function to set the origin arbitrarily
[ "Convenience", "function", "to", "set", "the", "origin", "arbitrarily" ]
def shift(self, x, y): '''Convenience function to set the origin arbitrarily''' self.transform = self.transform[:-2]+(x,y)
[ "def", "shift", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "transform", "=", "self", ".", "transform", "[", ":", "-", "2", "]", "+", "(", "x", ",", "y", ")" ]
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/src/reportlab/graphics/shapes.py#L514-L516
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/discovery_v1alpha1_api.py
python
DiscoveryV1alpha1Api.delete_namespaced_endpoint_slice_with_http_info
(self, name, namespace, **kwargs)
return self.api_client.call_api( '/apis/discovery.k8s.io/v1alpha1/namespaces/{namespace}/endpointslices/{name}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, ...
delete_namespaced_endpoint_slice # noqa: E501 delete an EndpointSlice # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_namespaced_endpoint_slice_with_http_info(name, namespace...
delete_namespaced_endpoint_slice # noqa: E501
[ "delete_namespaced_endpoint_slice", "#", "noqa", ":", "E501" ]
def delete_namespaced_endpoint_slice_with_http_info(self, name, namespace, **kwargs): # noqa: E501 """delete_namespaced_endpoint_slice # noqa: E501 delete an EndpointSlice # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, plea...
[ "def", "delete_namespaced_endpoint_slice_with_http_info", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'name'", ",", "'namespace'", ",", "'pre...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/discovery_v1alpha1_api.py#L383-L502
MediaBrowser/plugin.video.emby
71162fc7704656833d8b228dc9014f88742215b1
libraries/requests/packages/urllib3/packages/six.py
python
_import_module
(name)
return sys.modules[name]
Import module, returning the module after the last dot.
Import module, returning the module after the last dot.
[ "Import", "module", "returning", "the", "module", "after", "the", "last", "dot", "." ]
def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name]
[ "def", "_import_module", "(", "name", ")", ":", "__import__", "(", "name", ")", "return", "sys", ".", "modules", "[", "name", "]" ]
https://github.com/MediaBrowser/plugin.video.emby/blob/71162fc7704656833d8b228dc9014f88742215b1/libraries/requests/packages/urllib3/packages/six.py#L72-L75
ustayready/CredKing
68b612e4cdf01d2b65b14ab2869bb8a5531056ee
plugins/gmail/bs4/element.py
python
Tag.clear
(self, decompose=False)
Extract all children. If decompose is True, decompose instead.
Extract all children. If decompose is True, decompose instead.
[ "Extract", "all", "children", ".", "If", "decompose", "is", "True", "decompose", "instead", "." ]
def clear(self, decompose=False): """ Extract all children. If decompose is True, decompose instead. """ if decompose: for element in self.contents[:]: if isinstance(element, Tag): element.decompose() else: ...
[ "def", "clear", "(", "self", ",", "decompose", "=", "False", ")", ":", "if", "decompose", ":", "for", "element", "in", "self", ".", "contents", "[", ":", "]", ":", "if", "isinstance", "(", "element", ",", "Tag", ")", ":", "element", ".", "decompose",...
https://github.com/ustayready/CredKing/blob/68b612e4cdf01d2b65b14ab2869bb8a5531056ee/plugins/gmail/bs4/element.py#L965-L977
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
vispy/scene/cameras/fly.py
python
FlyCamera.keymap
(self)
return self._keymap
A dictionary that maps keys to thruster directions The keys in this dictionary are vispy key descriptions (from vispy.keys) or characters that represent keys. These are matched to the "key" attribute of key-press and key-release events. The values are tuples, in which the first element...
A dictionary that maps keys to thruster directions
[ "A", "dictionary", "that", "maps", "keys", "to", "thruster", "directions" ]
def keymap(self): """A dictionary that maps keys to thruster directions The keys in this dictionary are vispy key descriptions (from vispy.keys) or characters that represent keys. These are matched to the "key" attribute of key-press and key-release events. The values are tuple...
[ "def", "keymap", "(", "self", ")", ":", "return", "self", ".", "_keymap" ]
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/scene/cameras/fly.py#L149-L163
FateScript/CenterNet-better
972dbf2882375d54ec0e06ada21f39baaa997f0c
dl_lib/nn_utils/weight_init.py
python
c2_msra_fill
(module: nn.Module)
Initialize `module.weight` using the "MSRAFill" implemented in Caffe2. Also initializes `module.bias` to 0. Args: module (torch.nn.Module): module to initialize.
Initialize `module.weight` using the "MSRAFill" implemented in Caffe2. Also initializes `module.bias` to 0.
[ "Initialize", "module", ".", "weight", "using", "the", "MSRAFill", "implemented", "in", "Caffe2", ".", "Also", "initializes", "module", ".", "bias", "to", "0", "." ]
def c2_msra_fill(module: nn.Module): """ Initialize `module.weight` using the "MSRAFill" implemented in Caffe2. Also initializes `module.bias` to 0. Args: module (torch.nn.Module): module to initialize. """ nn.init.kaiming_normal_(module.weight, mode="fan_out", nonlinearity="relu") ...
[ "def", "c2_msra_fill", "(", "module", ":", "nn", ".", "Module", ")", ":", "nn", ".", "init", ".", "kaiming_normal_", "(", "module", ".", "weight", ",", "mode", "=", "\"fan_out\"", ",", "nonlinearity", "=", "\"relu\"", ")", "if", "module", ".", "bias", ...
https://github.com/FateScript/CenterNet-better/blob/972dbf2882375d54ec0e06ada21f39baaa997f0c/dl_lib/nn_utils/weight_init.py#L81-L91
myhdl/myhdl
7b17942abbb2d9374df13f4f1f8c9d4589e1c88c
myhdl/_Simulation.py
python
Simulation.__init__
(self, *args)
Construct a simulation object. *args -- list of arguments. Each argument is a generator or a nested sequence of generators.
Construct a simulation object.
[ "Construct", "a", "simulation", "object", "." ]
def __init__(self, *args): """ Construct a simulation object. *args -- list of arguments. Each argument is a generator or a nested sequence of generators. """ _simulator._time = 0 arglist = _flatten(*args) self._waiters, self._cosims = _makeWaiters(argl...
[ "def", "__init__", "(", "self", ",", "*", "args", ")", ":", "_simulator", ".", "_time", "=", "0", "arglist", "=", "_flatten", "(", "*", "args", ")", "self", ".", "_waiters", ",", "self", ".", "_cosims", "=", "_makeWaiters", "(", "arglist", ")", "if",...
https://github.com/myhdl/myhdl/blob/7b17942abbb2d9374df13f4f1f8c9d4589e1c88c/myhdl/_Simulation.py#L76-L91
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/config.py
python
ConfigHandler._parse_section_to_dict
(cls, section_options, values_parser=None)
return value
Parses section options into a dictionary. Optionally applies a given parser to values. :param dict section_options: :param callable values_parser: :rtype: dict
Parses section options into a dictionary.
[ "Parses", "section", "options", "into", "a", "dictionary", "." ]
def _parse_section_to_dict(cls, section_options, values_parser=None): """Parses section options into a dictionary. Optionally applies a given parser to values. :param dict section_options: :param callable values_parser: :rtype: dict """ value = {} values...
[ "def", "_parse_section_to_dict", "(", "cls", ",", "section_options", ",", "values_parser", "=", "None", ")", ":", "value", "=", "{", "}", "values_parser", "=", "values_parser", "or", "(", "lambda", "val", ":", "val", ")", "for", "key", ",", "(", "_", ","...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/config.py#L333-L346
pathak22/noreward-rl
3e220c2177fc253916f12d980957fc40579d577a
src/model.py
python
StatePredictor.pred_bonus
(self, s1, s2, asample)
return error
returns bonus predicted by forward model input: s1,s2: [h, w, ch], asample: [ac_space] 1-hot encoding output: scalar bonus
returns bonus predicted by forward model input: s1,s2: [h, w, ch], asample: [ac_space] 1-hot encoding output: scalar bonus
[ "returns", "bonus", "predicted", "by", "forward", "model", "input", ":", "s1", "s2", ":", "[", "h", "w", "ch", "]", "asample", ":", "[", "ac_space", "]", "1", "-", "hot", "encoding", "output", ":", "scalar", "bonus" ]
def pred_bonus(self, s1, s2, asample): ''' returns bonus predicted by forward model input: s1,s2: [h, w, ch], asample: [ac_space] 1-hot encoding output: scalar bonus ''' sess = tf.get_default_session() bonus = self.aencBonus if self.stateAenc else self.for...
[ "def", "pred_bonus", "(", "self", ",", "s1", ",", "s2", ",", "asample", ")", ":", "sess", "=", "tf", ".", "get_default_session", "(", ")", "bonus", "=", "self", ".", "aencBonus", "if", "self", ".", "stateAenc", "else", "self", ".", "forwardloss", "erro...
https://github.com/pathak22/noreward-rl/blob/3e220c2177fc253916f12d980957fc40579d577a/src/model.py#L372-L384
HunterMcGushion/hyperparameter_hunter
28b1d48e01a993818510811b82a677e0a7a232b2
hyperparameter_hunter/space/space_core.py
python
Space.n_dims
(self)
return len(self.dimensions)
Dimensionality of the original space Returns ------- Int Length of :attr:`dimensions`
Dimensionality of the original space
[ "Dimensionality", "of", "the", "original", "space" ]
def n_dims(self) -> int: """Dimensionality of the original space Returns ------- Int Length of :attr:`dimensions`""" return len(self.dimensions)
[ "def", "n_dims", "(", "self", ")", "->", "int", ":", "return", "len", "(", "self", ".", "dimensions", ")" ]
https://github.com/HunterMcGushion/hyperparameter_hunter/blob/28b1d48e01a993818510811b82a677e0a7a232b2/hyperparameter_hunter/space/space_core.py#L301-L308
PhoenixDL/rising
6de193375dcaac35605163c35cec259c9a2116d1
versioneer.py
python
run_command
(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None)
return stdout, p.returncode
Call the given command(s).
Call the given command(s).
[ "Call", "the", "given", "command", "(", "s", ")", "." ]
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): """Call the given command(s).""" assert isinstance(commands, list) p = None for c in commands: try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just...
[ "def", "run_command", "(", "commands", ",", "args", ",", "cwd", "=", "None", ",", "verbose", "=", "False", ",", "hide_stderr", "=", "False", ",", "env", "=", "None", ")", ":", "assert", "isinstance", "(", "commands", ",", "list", ")", "p", "=", "None...
https://github.com/PhoenixDL/rising/blob/6de193375dcaac35605163c35cec259c9a2116d1/versioneer.py#L389-L421
playerkk/face-py-faster-rcnn
045a7be37e5852adae6447bbcc132664efd584f1
lib/datasets/pascal_voc.py
python
pascal_voc._load_pascal_annotation
(self, index)
return {'boxes' : boxes, 'gt_classes': gt_classes, 'gt_overlaps' : overlaps, 'flipped' : False, 'seg_areas' : seg_areas}
Load image and bounding boxes info from XML file in the PASCAL VOC format.
Load image and bounding boxes info from XML file in the PASCAL VOC format.
[ "Load", "image", "and", "bounding", "boxes", "info", "from", "XML", "file", "in", "the", "PASCAL", "VOC", "format", "." ]
def _load_pascal_annotation(self, index): """ Load image and bounding boxes info from XML file in the PASCAL VOC format. """ filename = os.path.join(self._data_path, 'Annotations', index + '.xml') tree = ET.parse(filename) objs = tree.findall('object') if ...
[ "def", "_load_pascal_annotation", "(", "self", ",", "index", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_data_path", ",", "'Annotations'", ",", "index", "+", "'.xml'", ")", "tree", "=", "ET", ".", "parse", "(", "filen...
https://github.com/playerkk/face-py-faster-rcnn/blob/045a7be37e5852adae6447bbcc132664efd584f1/lib/datasets/pascal_voc.py#L180-L224
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/_weakrefset.py
python
WeakSet._commit_removals
(self)
[]
def _commit_removals(self): l = self._pending_removals discard = self.data.discard while l: discard(l.pop())
[ "def", "_commit_removals", "(", "self", ")", ":", "l", "=", "self", ".", "_pending_removals", "discard", "=", "self", ".", "data", ".", "discard", "while", "l", ":", "discard", "(", "l", ".", "pop", "(", ")", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/_weakrefset.py#L52-L56
dask/dask-jobqueue
4980e746e9be15e5fe6736b6c496b8faea737fd7
versioneer.py
python
render
(pieces, style)
return {"version": rendered, "full-revisionid": pieces["long"], "dirty": pieces["dirty"], "error": None, "date": pieces.get("date")}
Render the given version pieces into the requested style.
Render the given version pieces into the requested style.
[ "Render", "the", "given", "version", "pieces", "into", "the", "requested", "style", "." ]
def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: return {"version": "unknown", "full-revisionid": pieces.get("long"), "dirty": None, "error": pieces["error"], "date": None} ...
[ "def", "render", "(", "pieces", ",", "style", ")", ":", "if", "pieces", "[", "\"error\"", "]", ":", "return", "{", "\"version\"", ":", "\"unknown\"", ",", "\"full-revisionid\"", ":", "pieces", ".", "get", "(", "\"long\"", ")", ",", "\"dirty\"", ":", "Non...
https://github.com/dask/dask-jobqueue/blob/4980e746e9be15e5fe6736b6c496b8faea737fd7/versioneer.py#L1368-L1397
IBM/EvolveGCN
90869062bbc98d56935e3d92e1d9b1b4c25be593
sbm_dl.py
python
sbm_dataset.make_contigous_node_ids
(self,edges)
return edges
[]
def make_contigous_node_ids(self,edges): new_edges = edges[:,[self.ecols.FromNodeId,self.ecols.ToNodeId]] _, new_edges = new_edges.unique(return_inverse=True) edges[:,[self.ecols.FromNodeId,self.ecols.ToNodeId]] = new_edges return edges
[ "def", "make_contigous_node_ids", "(", "self", ",", "edges", ")", ":", "new_edges", "=", "edges", "[", ":", ",", "[", "self", ".", "ecols", ".", "FromNodeId", ",", "self", ".", "ecols", ".", "ToNodeId", "]", "]", "_", ",", "new_edges", "=", "new_edges"...
https://github.com/IBM/EvolveGCN/blob/90869062bbc98d56935e3d92e1d9b1b4c25be593/sbm_dl.py#L68-L72
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/requests/sessions.py
python
Session.merge_environment_settings
(self, url, proxies, stream, verify, cert)
return {'verify': verify, 'proxies': proxies, 'stream': stream, 'cert': cert}
Check the environment and merge it with some settings.
Check the environment and merge it with some settings.
[ "Check", "the", "environment", "and", "merge", "it", "with", "some", "settings", "." ]
def merge_environment_settings(self, url, proxies, stream, verify, cert): """Check the environment and merge it with some settings.""" # Gather clues from the surrounding environment. if self.trust_env: # Set environment's proxies. env_proxies = get_environ_proxies(url) o...
[ "def", "merge_environment_settings", "(", "self", ",", "url", ",", "proxies", ",", "stream", ",", "verify", ",", "cert", ")", ":", "# Gather clues from the surrounding environment.", "if", "self", ".", "trust_env", ":", "# Set environment's proxies.", "env_proxies", "...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/requests/sessions.py#L612-L634
binaryage/drydrop
2f27e15befd247255d89f9120eeee44851b82c4a
dryapp/jinja2/lexer.py
python
Lexer.wrap
(self, stream, name=None, filename=None)
This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value.
This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value.
[ "This", "is", "called", "with", "the", "stream", "as", "returned", "by", "tokenize", "and", "wraps", "every", "token", "in", "a", ":", "class", ":", "Token", "and", "converts", "the", "value", "." ]
def wrap(self, stream, name=None, filename=None): """This is called with the stream as returned by `tokenize` and wraps every token in a :class:`Token` and converts the value. """ for lineno, token, value in stream: if token in ('comment_begin', 'comment', 'comment_end', ...
[ "def", "wrap", "(", "self", ",", "stream", ",", "name", "=", "None", ",", "filename", "=", "None", ")", ":", "for", "lineno", ",", "token", ",", "value", "in", "stream", ":", "if", "token", "in", "(", "'comment_begin'", ",", "'comment'", ",", "'comme...
https://github.com/binaryage/drydrop/blob/2f27e15befd247255d89f9120eeee44851b82c4a/dryapp/jinja2/lexer.py#L384-L427
ring04h/dirfuzz
52373582c465a395769473d14ad6725b1f9e4156
libs/requests/models.py
python
Response.__nonzero__
(self)
return self.ok
Returns true if :attr:`status_code` is 'OK'.
Returns true if :attr:`status_code` is 'OK'.
[ "Returns", "true", "if", ":", "attr", ":", "status_code", "is", "OK", "." ]
def __nonzero__(self): """Returns true if :attr:`status_code` is 'OK'.""" return self.ok
[ "def", "__nonzero__", "(", "self", ")", ":", "return", "self", ".", "ok" ]
https://github.com/ring04h/dirfuzz/blob/52373582c465a395769473d14ad6725b1f9e4156/libs/requests/models.py#L608-L610
liaopeiyuan/ml-arsenal-public
f8938ce3cb58b35fc7cc20d096c39a85ec9780b2
projects/TGS_salt/shakeup_simulations/shakeup_ocnet_256_6.py
python
load_image
(path, mask = False)
Load image from a given path and pad it on the sides, so that eash side is divisible by 32 (newtwork requirement) if pad = True: returns image as numpy.array, tuple with padding in pixels as(x_min_pad, y_min_pad, x_max_pad, y_max_pad) else: returns image as numpy.array
Load image from a given path and pad it on the sides, so that eash side is divisible by 32 (newtwork requirement)
[ "Load", "image", "from", "a", "given", "path", "and", "pad", "it", "on", "the", "sides", "so", "that", "eash", "side", "is", "divisible", "by", "32", "(", "newtwork", "requirement", ")" ]
def load_image(path, mask = False): """ Load image from a given path and pad it on the sides, so that eash side is divisible by 32 (newtwork requirement) if pad = True: returns image as numpy.array, tuple with padding in pixels as(x_min_pad, y_min_pad, x_max_pad, y_max_pad) else: return...
[ "def", "load_image", "(", "path", ",", "mask", "=", "False", ")", ":", "img", "=", "cv2", ".", "imread", "(", "str", "(", "path", ")", ",", "cv2", ".", "IMREAD_GRAYSCALE", ")", "#img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)", "#height, width, _ = img.shape", "heig...
https://github.com/liaopeiyuan/ml-arsenal-public/blob/f8938ce3cb58b35fc7cc20d096c39a85ec9780b2/projects/TGS_salt/shakeup_simulations/shakeup_ocnet_256_6.py#L46-L85
seleniumbase/SeleniumBase
0d1de7238bfafe4b7309fec6f735dcd0dc4538a8
seleniumbase/fixtures/page_actions.py
python
wait_for_element_visible
( driver, selector, by=By.CSS_SELECTOR, timeout=settings.LARGE_TIMEOUT )
Searches for the specified element by the given selector. Returns the element object if the element is present and visible on the page. Raises NoSuchElementException if the element does not exist in the HTML within the specified timeout. Raises ElementNotVisibleException if the element exists in the HTM...
Searches for the specified element by the given selector. Returns the element object if the element is present and visible on the page. Raises NoSuchElementException if the element does not exist in the HTML within the specified timeout. Raises ElementNotVisibleException if the element exists in the HTM...
[ "Searches", "for", "the", "specified", "element", "by", "the", "given", "selector", ".", "Returns", "the", "element", "object", "if", "the", "element", "is", "present", "and", "visible", "on", "the", "page", ".", "Raises", "NoSuchElementException", "if", "the"...
def wait_for_element_visible( driver, selector, by=By.CSS_SELECTOR, timeout=settings.LARGE_TIMEOUT ): """ Searches for the specified element by the given selector. Returns the element object if the element is present and visible on the page. Raises NoSuchElementException if the element does not exis...
[ "def", "wait_for_element_visible", "(", "driver", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "settings", ".", "LARGE_TIMEOUT", ")", ":", "element", "=", "None", "is_present", "=", "False", "start_ms", "=", "time", ".", ...
https://github.com/seleniumbase/SeleniumBase/blob/0d1de7238bfafe4b7309fec6f735dcd0dc4538a8/seleniumbase/fixtures/page_actions.py#L322-L384
bennylope/django-organizations
86c386568b0b49a70273d9ab5a2f9d7f61b484c1
src/organizations/backends/defaults.py
python
BaseBackend.get_success_url
(self)
Will return the class's `success_url` attribute unless overridden
Will return the class's `success_url` attribute unless overridden
[ "Will", "return", "the", "class", "s", "success_url", "attribute", "unless", "overridden" ]
def get_success_url(self): """Will return the class's `success_url` attribute unless overridden""" raise NotImplementedError
[ "def", "get_success_url", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/bennylope/django-organizations/blob/86c386568b0b49a70273d9ab5a2f9d7f61b484c1/src/organizations/backends/defaults.py#L53-L55
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py
python
RequestsCookieJar.__setstate__
(self, state)
Unlike a normal CookieJar, this class is pickleable.
Unlike a normal CookieJar, this class is pickleable.
[ "Unlike", "a", "normal", "CookieJar", "this", "class", "is", "pickleable", "." ]
def __setstate__(self, state): """Unlike a normal CookieJar, this class is pickleable.""" self.__dict__.update(state) if '_cookies_lock' not in self.__dict__: self._cookies_lock = threading.RLock()
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "self", ".", "__dict__", ".", "update", "(", "state", ")", "if", "'_cookies_lock'", "not", "in", "self", ".", "__dict__", ":", "self", ".", "_cookies_lock", "=", "threading", ".", "RLock", "(", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py#L407-L411
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
research/object_detection/metrics/coco_evaluation.py
python
CocoPanopticSegmentationEvaluator.evaluate
(self)
return mask_metrics
Evaluates the detection masks and returns a dictionary of coco metrics. Returns: A dictionary holding - 1. summary_metric: 'PanopticQuality@%.2fIOU': mean panoptic quality averaged over classes at the required IOU. 'SegmentationQuality@%.2fIOU': mean segmentation quality averaged o...
Evaluates the detection masks and returns a dictionary of coco metrics.
[ "Evaluates", "the", "detection", "masks", "and", "returns", "a", "dictionary", "of", "coco", "metrics", "." ]
def evaluate(self): """Evaluates the detection masks and returns a dictionary of coco metrics. Returns: A dictionary holding - 1. summary_metric: 'PanopticQuality@%.2fIOU': mean panoptic quality averaged over classes at the required IOU. 'SegmentationQuality@%.2fIOU': mean segm...
[ "def", "evaluate", "(", "self", ")", ":", "# Evaluate and accumulate the iou/tp/fp/fn.", "sum_tp_iou", ",", "sum_num_tp", ",", "sum_num_fp", ",", "sum_num_fn", "=", "self", ".", "_evaluate_all_masks", "(", ")", "# Compute PQ metric for each category and average over all class...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/metrics/coco_evaluation.py#L1482-L1508
rajeshmajumdar/BruteXSS
ed08d0561a46d6553627ba7a26fd23fd792383e0
mechanize/_form.py
python
ListControl.get_value_by_label
(self)
return res
Return the value of the control as given by normalized labels.
Return the value of the control as given by normalized labels.
[ "Return", "the", "value", "of", "the", "control", "as", "given", "by", "normalized", "labels", "." ]
def get_value_by_label(self): """Return the value of the control as given by normalized labels.""" res = [] compat = self._form.backwards_compat for o in self.items: if (not o.disabled or compat) and o.selected: for l in o.get_labels(): if ...
[ "def", "get_value_by_label", "(", "self", ")", ":", "res", "=", "[", "]", "compat", "=", "self", ".", "_form", ".", "backwards_compat", "for", "o", "in", "self", ".", "items", ":", "if", "(", "not", "o", ".", "disabled", "or", "compat", ")", "and", ...
https://github.com/rajeshmajumdar/BruteXSS/blob/ed08d0561a46d6553627ba7a26fd23fd792383e0/mechanize/_form.py#L2099-L2111
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/pexpect/expect.py
python
Expecter.errored
(self)
[]
def errored(self): spawn = self.spawn spawn.before = spawn._before.getvalue() spawn.after = None spawn.match = None spawn.match_index = None
[ "def", "errored", "(", "self", ")", ":", "spawn", "=", "self", ".", "spawn", "spawn", ".", "before", "=", "spawn", ".", "_before", ".", "getvalue", "(", ")", "spawn", ".", "after", "=", "None", "spawn", ".", "match", "=", "None", "spawn", ".", "mat...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/pexpect/expect.py#L146-L151
dmeranda/demjson
5bc65974e7141746acc88c581f5d2dfb8ea14064
demjson.py
python
helpers.decode_binary
( binarystring )
return n
Decodes a binary string into it's integer value.
Decodes a binary string into it's integer value.
[ "Decodes", "a", "binary", "string", "into", "it", "s", "integer", "value", "." ]
def decode_binary( binarystring ): """Decodes a binary string into it's integer value.""" n = 0 for c in binarystring: if c == '0': d = 0 elif c == '1': d = 1 else: raise ValueError('Not an binary number', binary...
[ "def", "decode_binary", "(", "binarystring", ")", ":", "n", "=", "0", "for", "c", "in", "binarystring", ":", "if", "c", "==", "'0'", ":", "d", "=", "0", "elif", "c", "==", "'1'", ":", "d", "=", "1", "else", ":", "raise", "ValueError", "(", "'Not ...
https://github.com/dmeranda/demjson/blob/5bc65974e7141746acc88c581f5d2dfb8ea14064/demjson.py#L1401-L1413
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/qark/qark/lib/pubsub/core/listenerbase.py
python
ListenerBase.__str__
(self)
return self.__nameID
String rep is the callable
String rep is the callable
[ "String", "rep", "is", "the", "callable" ]
def __str__(self): """String rep is the callable""" return self.__nameID
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "__nameID" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/pubsub/core/listenerbase.py#L131-L133
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/web/_newclient.py
python
Response._bodyDataReceived_CONNECTED
(self, data)
Deliver any data received to the protocol to which this L{Response} is connected.
Deliver any data received to the protocol to which this L{Response} is connected.
[ "Deliver", "any", "data", "received", "to", "the", "protocol", "to", "which", "this", "L", "{", "Response", "}", "is", "connected", "." ]
def _bodyDataReceived_CONNECTED(self, data): """ Deliver any data received to the protocol to which this L{Response} is connected. """ self._bodyProtocol.dataReceived(data)
[ "def", "_bodyDataReceived_CONNECTED", "(", "self", ",", "data", ")", ":", "self", ".", "_bodyProtocol", ".", "dataReceived", "(", "data", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/web/_newclient.py#L1011-L1016
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/meta/lib/oe/sstatesig.py
python
OEOuthashBasic
(path, sigfile, task, d)
return h.hexdigest()
Basic output hash function Calculates the output hash of a task by hashing all output file metadata, and file contents.
Basic output hash function
[ "Basic", "output", "hash", "function" ]
def OEOuthashBasic(path, sigfile, task, d): """ Basic output hash function Calculates the output hash of a task by hashing all output file metadata, and file contents. """ import hashlib import stat import pwd import grp import re import fnmatch def update_hash(s): ...
[ "def", "OEOuthashBasic", "(", "path", ",", "sigfile", ",", "task", ",", "d", ")", ":", "import", "hashlib", "import", "stat", "import", "pwd", "import", "grp", "import", "re", "import", "fnmatch", "def", "update_hash", "(", "s", ")", ":", "s", "=", "s"...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/meta/lib/oe/sstatesig.py#L462-L642
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
pytorch/pytorchcv/models/linknet.py
python
linknet_cityscapes
(pretrained_backbone=False, num_classes=19, **kwargs)
return get_linknet(backbone=backbone, backbone_out_channels=backbone_out_channels, num_classes=num_classes, model_name="linknet_cityscapes", **kwargs)
LinkNet model for Cityscapes from 'LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation,' https://arxiv.org/abs/1707.03718. Parameters: ---------- pretrained_backbone : bool, default False Whether to load the pretrained weights for feature extractor. num_classes :...
LinkNet model for Cityscapes from 'LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation,' https://arxiv.org/abs/1707.03718.
[ "LinkNet", "model", "for", "Cityscapes", "from", "LinkNet", ":", "Exploiting", "Encoder", "Representations", "for", "Efficient", "Semantic", "Segmentation", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1707", ".", "03718", "." ]
def linknet_cityscapes(pretrained_backbone=False, num_classes=19, **kwargs): """ LinkNet model for Cityscapes from 'LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation,' https://arxiv.org/abs/1707.03718. Parameters: ---------- pretrained_backbone : bool, default Fals...
[ "def", "linknet_cityscapes", "(", "pretrained_backbone", "=", "False", ",", "num_classes", "=", "19", ",", "*", "*", "kwargs", ")", ":", "backbone", "=", "resnet18", "(", "pretrained", "=", "pretrained_backbone", ")", ".", "features", "del", "backbone", "[", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/linknet.py#L252-L272
inveniosoftware-contrib/workflow
455499316d0ef42d9f61b3fc12579a674daed78a
workflow/engine.py
python
MachineState.__setstate__
(self, state)
:type state: dict
:type state: dict
[ ":", "type", "state", ":", "dict" ]
def __setstate__(self, state): """ :type state: dict """ for key in self._state_keys: setattr(self, key, state[key])
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "for", "key", "in", "self", ".", "_state_keys", ":", "setattr", "(", "self", ",", "key", ",", "state", "[", "key", "]", ")" ]
https://github.com/inveniosoftware-contrib/workflow/blob/455499316d0ef42d9f61b3fc12579a674daed78a/workflow/engine.py#L154-L159
thaines/helit
04bd36ee0fb6b762c63d746e2cd8813641dceda9
handwriting/hst/hst.py
python
HST.__fullscreen
(self, widget)
Toggles the window being fullscreen.
Toggles the window being fullscreen.
[ "Toggles", "the", "window", "being", "fullscreen", "." ]
def __fullscreen(self, widget): """Toggles the window being fullscreen.""" if widget.get_active(): self.fullscreen() else: self.unfullscreen()
[ "def", "__fullscreen", "(", "self", ",", "widget", ")", ":", "if", "widget", ".", "get_active", "(", ")", ":", "self", ".", "fullscreen", "(", ")", "else", ":", "self", ".", "unfullscreen", "(", ")" ]
https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/handwriting/hst/hst.py#L798-L803
mozilla/zamboni
14b1a44658e47b9f048962fa52dbf00a3beaaf30
mkt/comm/models.py
python
CommAttachment.display_name
(self)
return mark_safe(bleach.clean(display))
Returns a string describing the attachment suitable for front-end display.
Returns a string describing the attachment suitable for front-end display.
[ "Returns", "a", "string", "describing", "the", "attachment", "suitable", "for", "front", "-", "end", "display", "." ]
def display_name(self): """ Returns a string describing the attachment suitable for front-end display. """ display = self.description if self.description else self.filename() return mark_safe(bleach.clean(display))
[ "def", "display_name", "(", "self", ")", ":", "display", "=", "self", ".", "description", "if", "self", ".", "description", "else", "self", ".", "filename", "(", ")", "return", "mark_safe", "(", "bleach", ".", "clean", "(", "display", ")", ")" ]
https://github.com/mozilla/zamboni/blob/14b1a44658e47b9f048962fa52dbf00a3beaaf30/mkt/comm/models.py#L324-L330
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/subprocess.py
python
Popen.__del__
(self, _maxsize=sys.maxsize, _warn=warnings.warn)
[]
def __del__(self, _maxsize=sys.maxsize, _warn=warnings.warn): if not self._child_created: # We didn't get to successfully create a child process. return if self.returncode is None: # Not reading subprocess exit status creates a zombie process which # is on...
[ "def", "__del__", "(", "self", ",", "_maxsize", "=", "sys", ".", "maxsize", ",", "_warn", "=", "warnings", ".", "warn", ")", ":", "if", "not", "self", ".", "_child_created", ":", "# We didn't get to successfully create a child process.", "return", "if", "self", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/subprocess.py#L1060-L1073
jgyates/genmon
2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e
genmonlib/myserialtcp.py
python
SerialTCPDevice.Write
(self, data)
[]
def Write(self, data): try: if self.Socket == None: return None return self.Socket.sendall(data) except Exception as e1: if self.Socket != None: self.Socket.close() self.Socket = None self.LogErrorLine( "Err...
[ "def", "Write", "(", "self", ",", "data", ")", ":", "try", ":", "if", "self", ".", "Socket", "==", "None", ":", "return", "None", "return", "self", ".", "Socket", ".", "sendall", "(", "data", ")", "except", "Exception", "as", "e1", ":", "if", "self...
https://github.com/jgyates/genmon/blob/2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e/genmonlib/myserialtcp.py#L186-L197
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/decimal.py
python
Decimal._rescale
(self, exp, rounding)
return _dec_from_triple(self._sign, coeff, exp)
Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the context. exp = exp to scale to (an...
Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode.
[ "Rescale", "self", "so", "that", "the", "exponent", "is", "exp", "either", "by", "padding", "with", "zeros", "or", "by", "truncating", "digits", "using", "the", "given", "rounding", "mode", "." ]
def _rescale(self, exp, rounding): """Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the ...
[ "def", "_rescale", "(", "self", ",", "exp", ",", "rounding", ")", ":", "if", "self", ".", "_is_special", ":", "return", "Decimal", "(", "self", ")", "if", "not", "self", ":", "return", "_dec_from_triple", "(", "self", ".", "_sign", ",", "'0'", ",", "...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/decimal.py#L2480-L2512
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/argparse.py
python
_ActionsContainer.get_default
(self, dest)
return self._defaults.get(dest, None)
[]
def get_default(self, dest): for action in self._actions: if action.dest == dest and action.default is not None: return action.default return self._defaults.get(dest, None)
[ "def", "get_default", "(", "self", ",", "dest", ")", ":", "for", "action", "in", "self", ".", "_actions", ":", "if", "action", ".", "dest", "==", "dest", "and", "action", ".", "default", "is", "not", "None", ":", "return", "action", ".", "default", "...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/argparse.py#L1327-L1331
sabri-zaki/EasY_HaCk
2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9
.modules/.sqlmap/thirdparty/clientform/clientform.py
python
Item.get_labels
(self)
return res
Return all labels (Label instances) for this item. For items that represent radio buttons or checkboxes, if the item was surrounded by a <label> tag, that will be the first label; all other labels, connected by 'for' and 'id', are in the order that appear in the HTML. For items...
Return all labels (Label instances) for this item.
[ "Return", "all", "labels", "(", "Label", "instances", ")", "for", "this", "item", "." ]
def get_labels(self): """Return all labels (Label instances) for this item. For items that represent radio buttons or checkboxes, if the item was surrounded by a <label> tag, that will be the first label; all other labels, connected by 'for' and 'id', are in the order that appear in ...
[ "def", "get_labels", "(", "self", ")", ":", "res", "=", "[", "]", "res", ".", "extend", "(", "self", ".", "_labels", ")", "if", "self", ".", "id", ":", "res", ".", "extend", "(", "self", ".", "_control", ".", "_form", ".", "_id_to_labels", ".", "...
https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/thirdparty/clientform/clientform.py#L1630-L1651
roam-qgis/Roam
6bfa836a2735f611b7f26de18ae4a4581f7e83ef
ext_libs/cx_Freeze/finder.py
python
ModuleFinder._RunHook
(self, hookName, moduleName, *args)
Run hook for the given module if one is present.
Run hook for the given module if one is present.
[ "Run", "hook", "for", "the", "given", "module", "if", "one", "is", "present", "." ]
def _RunHook(self, hookName, moduleName, *args): """Run hook for the given module if one is present.""" name = "%s_%s" % (hookName, moduleName.replace(".", "_")) method = getattr(cx_Freeze.hooks, name, None) if method is not None: method(self, *args)
[ "def", "_RunHook", "(", "self", ",", "hookName", ",", "moduleName", ",", "*", "args", ")", ":", "name", "=", "\"%s_%s\"", "%", "(", "hookName", ",", "moduleName", ".", "replace", "(", "\".\"", ",", "\"_\"", ")", ")", "method", "=", "getattr", "(", "c...
https://github.com/roam-qgis/Roam/blob/6bfa836a2735f611b7f26de18ae4a4581f7e83ef/ext_libs/cx_Freeze/finder.py#L505-L510
OpenMDAO/OpenMDAO
f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd
openmdao/components/implicit_func_comp.py
python
ImplicitFuncComp._linearize
(self, jac=None, sub_do_ln=False)
Compute jacobian / factorization. The model is assumed to be in a scaled state. Parameters ---------- jac : Jacobian or None Ignored. sub_do_ln : bool Flag indicating if the children should call linearize on their linear solvers.
Compute jacobian / factorization. The model is assumed to be in a scaled state.
[ "Compute", "jacobian", "/", "factorization", ".", "The", "model", "is", "assumed", "to", "be", "in", "a", "scaled", "state", "." ]
def _linearize(self, jac=None, sub_do_ln=False): """ Compute jacobian / factorization. The model is assumed to be in a scaled state. Parameters ---------- jac : Jacobian or None Ignored. sub_do_ln : bool Flag indicating if the children should call...
[ "def", "_linearize", "(", "self", ",", "jac", "=", "None", ",", "sub_do_ln", "=", "False", ")", ":", "if", "self", ".", "options", "[", "'use_jax'", "]", ":", "self", ".", "_check_first_linearize", "(", ")", "self", ".", "_jax_linearize", "(", ")", "if...
https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/components/implicit_func_comp.py#L198-L215
crccheck/django-object-actions
80498e7731a571931a68e8e3ac241d9a0fe33aa4
django_object_actions/utils.py
python
BaseDjangoObjectActions.get_change_actions
(self, request, object_id, form_url)
return self.change_actions
Override this to customize what actions get to the change view. This takes the same parameters as `change_view`. For example, to restrict actions to superusers, you could do: class ChoiceAdmin(DjangoObjectActions, admin.ModelAdmin): def get_change_actions(self, request, **...
Override this to customize what actions get to the change view.
[ "Override", "this", "to", "customize", "what", "actions", "get", "to", "the", "change", "view", "." ]
def get_change_actions(self, request, object_id, form_url): """ Override this to customize what actions get to the change view. This takes the same parameters as `change_view`. For example, to restrict actions to superusers, you could do: class ChoiceAdmin(DjangoObjectActi...
[ "def", "get_change_actions", "(", "self", ",", "request", ",", "object_id", ",", "form_url", ")", ":", "return", "self", ".", "change_actions" ]
https://github.com/crccheck/django-object-actions/blob/80498e7731a571931a68e8e3ac241d9a0fe33aa4/django_object_actions/utils.py#L88-L104
blockcypher/explorer
3cb07c58ed6573964921e343fce01552accdf958
users/models.py
python
AuthUser.has_module_perms
(self, app_label)
return self.is_superuser
Does the user have permissions to view the app `app_label`?
Does the user have permissions to view the app `app_label`?
[ "Does", "the", "user", "have", "permissions", "to", "view", "the", "app", "app_label", "?" ]
def has_module_perms(self, app_label): "Does the user have permissions to view the app `app_label`?" # FIXME return self.is_superuser
[ "def", "has_module_perms", "(", "self", ",", "app_label", ")", ":", "# FIXME", "return", "self", ".", "is_superuser" ]
https://github.com/blockcypher/explorer/blob/3cb07c58ed6573964921e343fce01552accdf958/users/models.py#L92-L95
shinnytech/tqsdk-python
b766b45bb82c89a0401a6a84e0e42600fa10e6f4
tqsdk/sim/trade.py
python
SimTrade._adjust_position_account
(self, symbol, quote, underlying_quote=None, pre_last_price=float('nan'), last_price=float('nan'), pre_underlying_last_price=float('nan'), underlying_last_price=float('nan'), buy_open=0, buy_close=0, sell_open=0, sell_close=0)
价格变化,使得 position 中的以下计算字段需要修改,这个函数计算出需要修改的差值部分,计算出差值部分修改 position、account 有两种情况下调用 1. 委托单 FINISHED,且全部成交,分为4种:buy_open, buy_close, sell_open, sell_close 2. 行情跳动
价格变化,使得 position 中的以下计算字段需要修改,这个函数计算出需要修改的差值部分,计算出差值部分修改 position、account 有两种情况下调用 1. 委托单 FINISHED,且全部成交,分为4种:buy_open, buy_close, sell_open, sell_close 2. 行情跳动
[ "价格变化,使得", "position", "中的以下计算字段需要修改,这个函数计算出需要修改的差值部分,计算出差值部分修改", "position、account", "有两种情况下调用", "1", ".", "委托单", "FINISHED,且全部成交,分为4种:buy_open", "buy_close", "sell_open", "sell_close", "2", ".", "行情跳动" ]
def _adjust_position_account(self, symbol, quote, underlying_quote=None, pre_last_price=float('nan'), last_price=float('nan'), pre_underlying_last_price=float('nan'), underlying_last_price=float('nan'), buy_open=0, buy_close=0, sell_open=0, sell_close=0)...
[ "def", "_adjust_position_account", "(", "self", ",", "symbol", ",", "quote", ",", "underlying_quote", "=", "None", ",", "pre_last_price", "=", "float", "(", "'nan'", ")", ",", "last_price", "=", "float", "(", "'nan'", ")", ",", "pre_underlying_last_price", "="...
https://github.com/shinnytech/tqsdk-python/blob/b766b45bb82c89a0401a6a84e0e42600fa10e6f4/tqsdk/sim/trade.py#L418-L495
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
lib/matplotlib/axes/_base.py
python
_process_plot_var_args._getdefaults
(self, ignore, kw)
return default_dict
If some keys in the property cycle (excluding those in the set *ignore*) are absent or set to None in the dict *kw*, return a copy of the next entry in the property cycle, excluding keys in *ignore*. Otherwise, don't advance the property cycle, and return an empty dict.
If some keys in the property cycle (excluding those in the set *ignore*) are absent or set to None in the dict *kw*, return a copy of the next entry in the property cycle, excluding keys in *ignore*. Otherwise, don't advance the property cycle, and return an empty dict.
[ "If", "some", "keys", "in", "the", "property", "cycle", "(", "excluding", "those", "in", "the", "set", "*", "ignore", "*", ")", "are", "absent", "or", "set", "to", "None", "in", "the", "dict", "*", "kw", "*", "return", "a", "copy", "of", "the", "ne...
def _getdefaults(self, ignore, kw): """ If some keys in the property cycle (excluding those in the set *ignore*) are absent or set to None in the dict *kw*, return a copy of the next entry in the property cycle, excluding keys in *ignore*. Otherwise, don't advance the property cy...
[ "def", "_getdefaults", "(", "self", ",", "ignore", ",", "kw", ")", ":", "prop_keys", "=", "self", ".", "_prop_keys", "-", "ignore", "if", "any", "(", "kw", ".", "get", "(", "k", ",", "None", ")", "is", "None", "for", "k", "in", "prop_keys", ")", ...
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/axes/_base.py#L320-L336
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pip/build/lib.linux-i686-2.7/pip/commands/__init__.py
python
get_summaries
(ignore_hidden=True, ordered=True)
Yields sorted (command name, command summary) tuples.
Yields sorted (command name, command summary) tuples.
[ "Yields", "sorted", "(", "command", "name", "command", "summary", ")", "tuples", "." ]
def get_summaries(ignore_hidden=True, ordered=True): """Yields sorted (command name, command summary) tuples.""" if ordered: cmditems = _sort_commands(commands_dict, commands_order) else: cmditems = commands_dict.items() for name, command_class in cmditems: if ignore_hidden and...
[ "def", "get_summaries", "(", "ignore_hidden", "=", "True", ",", "ordered", "=", "True", ")", ":", "if", "ordered", ":", "cmditems", "=", "_sort_commands", "(", "commands_dict", ",", "commands_order", ")", "else", ":", "cmditems", "=", "commands_dict", ".", "...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/build/lib.linux-i686-2.7/pip/commands/__init__.py#L42-L54
accel-brain/accel-brain-code
86f489dc9be001a3bae6d053f48d6b57c0bedb95
Accel-Brain-Base/accelbrainbase/iteratabledata/labeled_csv_iterator.py
python
LabeledCSVIterator.set_scale
(self, value)
setter
setter
[ "setter" ]
def set_scale(self, value): ''' setter ''' self.__scale = value
[ "def", "set_scale", "(", "self", ",", "value", ")", ":", "self", ".", "__scale", "=", "value" ]
https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Accel-Brain-Base/accelbrainbase/iteratabledata/labeled_csv_iterator.py#L87-L89
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_service_port.py
python
V1ServicePort.protocol
(self, protocol)
Sets the protocol of this V1ServicePort. The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP. # noqa: E501 :param protocol: The protocol of this V1ServicePort. # noqa: E501 :type: str
Sets the protocol of this V1ServicePort.
[ "Sets", "the", "protocol", "of", "this", "V1ServicePort", "." ]
def protocol(self, protocol): """Sets the protocol of this V1ServicePort. The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP. # noqa: E501 :param protocol: The protocol of this V1ServicePort. # noqa: E501 :type: str """ self._proto...
[ "def", "protocol", "(", "self", ",", "protocol", ")", ":", "self", ".", "_protocol", "=", "protocol" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_service_port.py#L185-L194
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
http_check/datadog_checks/http_check/config_models/defaults.py
python
instance_allow_redirects
(field, value)
return True
[]
def instance_allow_redirects(field, value): return True
[ "def", "instance_allow_redirects", "(", "field", ",", "value", ")", ":", "return", "True" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/http_check/datadog_checks/http_check/config_models/defaults.py#L29-L30
moinwiki/moin
568f223231aadecbd3b21a701ec02271f8d8021d
src/moin/utils/interwiki.py
python
InterWikiMap.__init__
(self, s)
Check for 's' to be a valid interwiki map string, then parses it and stores to a dict.
Check for 's' to be a valid interwiki map string, then parses it and stores to a dict.
[ "Check", "for", "s", "to", "be", "a", "valid", "interwiki", "map", "string", "then", "parses", "it", "and", "stores", "to", "a", "dict", "." ]
def __init__(self, s): """ Check for 's' to be a valid interwiki map string, then parses it and stores to a dict. """ self.iwmap = dict() for line in s.splitlines(): if self.SKIP in line: line = line.split(self.SKIP, 1)[0] # remov...
[ "def", "__init__", "(", "self", ",", "s", ")", ":", "self", ".", "iwmap", "=", "dict", "(", ")", "for", "line", "in", "s", ".", "splitlines", "(", ")", ":", "if", "self", ".", "SKIP", "in", "line", ":", "line", "=", "line", ".", "split", "(", ...
https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/utils/interwiki.py#L321-L341
mypaint/mypaint
90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33
lib/color.py
python
UIColor.__copy__
(self)
return color_class(color=self)
Clones the object using its own constructor; see `copy.copy()`.
Clones the object using its own constructor; see `copy.copy()`.
[ "Clones", "the", "object", "using", "its", "own", "constructor", ";", "see", "copy", ".", "copy", "()", "." ]
def __copy__(self): """Clones the object using its own constructor; see `copy.copy()`. """ color_class = type(self) return color_class(color=self)
[ "def", "__copy__", "(", "self", ")", ":", "color_class", "=", "type", "(", "self", ")", "return", "color_class", "(", "color", "=", "self", ")" ]
https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/color.py#L179-L183
PixarAnimationStudios/OpenTimelineIO
990a54ccbe6488180a93753370fc87902b982962
contrib/opentimelineio_contrib/adapters/fcpx_xml.py
python
FcpxOtio.__init__
(self, otio_timeline)
[]
def __init__(self, otio_timeline): self.otio_timeline = otio_timeline self.fcpx_xml = cElementTree.Element("fcpxml", version="1.8") self.resource_element = cElementTree.SubElement( self.fcpx_xml, "resources" ) if self.otio_timeline.schema_name() == "Timeli...
[ "def", "__init__", "(", "self", ",", "otio_timeline", ")", ":", "self", ".", "otio_timeline", "=", "otio_timeline", "self", ".", "fcpx_xml", "=", "cElementTree", ".", "Element", "(", "\"fcpxml\"", ",", "version", "=", "\"1.8\"", ")", "self", ".", "resource_e...
https://github.com/PixarAnimationStudios/OpenTimelineIO/blob/990a54ccbe6488180a93753370fc87902b982962/contrib/opentimelineio_contrib/adapters/fcpx_xml.py#L157-L182
csujedihy/lc-all-solutions
b9fd938a7b3c164f28096361993600e338c399c3
279.perfect-squares/perfect-squares.py
python
Solution.numSquares
(self, n)
return level
:type n: int :rtype: int
:type n: int :rtype: int
[ ":", "type", "n", ":", "int", ":", "rtype", ":", "int" ]
def numSquares(self, n): """ :type n: int :rtype: int """ squares = [] j = 1 while j * j <= n: squares.append(j * j) j += 1 level = 0 queue = [n] visited = [False] * (n + 1) while queue: level += 1 temp = [] for q in queue: for factor in ...
[ "def", "numSquares", "(", "self", ",", "n", ")", ":", "squares", "=", "[", "]", "j", "=", "1", "while", "j", "*", "j", "<=", "n", ":", "squares", ".", "append", "(", "j", "*", "j", ")", "j", "+=", "1", "level", "=", "0", "queue", "=", "[", ...
https://github.com/csujedihy/lc-all-solutions/blob/b9fd938a7b3c164f28096361993600e338c399c3/279.perfect-squares/perfect-squares.py#L2-L29
hhstore/annotated-py-projects
4f4eca9a3913a19983cae496279a72699c083a0b
asyncio/asyncio-3.4.3/asyncio/queues.py
python
JoinableQueue.task_done
(self)
Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have ...
Indicate that a formerly enqueued task is complete.
[ "Indicate", "that", "a", "formerly", "enqueued", "task", "is", "complete", "." ]
def task_done(self): """Indicate that a formerly enqueued task is complete. Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will res...
[ "def", "task_done", "(", "self", ")", ":", "if", "self", ".", "_unfinished_tasks", "<=", "0", ":", "raise", "ValueError", "(", "'task_done() called too many times'", ")", "self", ".", "_unfinished_tasks", "-=", "1", "if", "self", ".", "_unfinished_tasks", "==", ...
https://github.com/hhstore/annotated-py-projects/blob/4f4eca9a3913a19983cae496279a72699c083a0b/asyncio/asyncio-3.4.3/asyncio/queues.py#L335-L353
otuncelli/turkish-stemmer-python
0c22380bf84a5ab1f219f4a905274c78afa04ed1
TurkishStemmer/__init__.py
python
LoadWordSet
(path)
return frozenset(result)
Creates a set from a file Args: path (str): relative path to file Returns: set: the set
Creates a set from a file
[ "Creates", "a", "set", "from", "a", "file" ]
def LoadWordSet(path): """ Creates a set from a file Args: path (str): relative path to file Returns: set: the set """ result = set() try: path_to_file = os.path.join(os.path.dirname(__file__), "resources", path) with open(path_to_file, encoding="utf-8") as f: ...
[ "def", "LoadWordSet", "(", "path", ")", ":", "result", "=", "set", "(", ")", "try", ":", "path_to_file", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"resources\"", ",", "path", ")", "wit...
https://github.com/otuncelli/turkish-stemmer-python/blob/0c22380bf84a5ab1f219f4a905274c78afa04ed1/TurkishStemmer/__init__.py#L408-L426
malthe/chameleon
e64dc4fa3921cfaa886cab6c766f7237ebb2f3a3
src/chameleon/interfaces.py
python
ITALESIterator.index
()
Return the position (starting with "0") within the iteration
Return the position (starting with "0") within the iteration
[ "Return", "the", "position", "(", "starting", "with", "0", ")", "within", "the", "iteration" ]
def index(): """Return the position (starting with "0") within the iteration """
[ "def", "index", "(", ")", ":" ]
https://github.com/malthe/chameleon/blob/e64dc4fa3921cfaa886cab6c766f7237ebb2f3a3/src/chameleon/interfaces.py#L47-L49
akfamily/akshare
590e50eece9ec067da3538c7059fd660b71f1339
akshare/stock/stock_new_cninfo.py
python
stock_new_gh_cninfo
()
return temp_df
巨潮资讯-数据中心-新股数据-新股过会 http://webapi.cninfo.com.cn/#/xinguList :return: 新股过会 :rtype: pandas.DataFrame
巨潮资讯-数据中心-新股数据-新股过会 http://webapi.cninfo.com.cn/#/xinguList :return: 新股过会 :rtype: pandas.DataFrame
[ "巨潮资讯", "-", "数据中心", "-", "新股数据", "-", "新股过会", "http", ":", "//", "webapi", ".", "cninfo", ".", "com", ".", "cn", "/", "#", "/", "xinguList", ":", "return", ":", "新股过会", ":", "rtype", ":", "pandas", ".", "DataFrame" ]
def stock_new_gh_cninfo() -> pd.DataFrame: """ 巨潮资讯-数据中心-新股数据-新股过会 http://webapi.cninfo.com.cn/#/xinguList :return: 新股过会 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1098" random_time_str = str(int(time.time())) js_code = py_mini_racer.MiniRacer(...
[ "def", "stock_new_gh_cninfo", "(", ")", "->", "pd", ".", "DataFrame", ":", "url", "=", "\"http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1098\"", "random_time_str", "=", "str", "(", "int", "(", "time", ".", "time", "(", ")", ")", ")", "js_code", "=", "py_mini_ra...
https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/stock/stock_new_cninfo.py#L45-L85
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/future/backports/xmlrpc/server.py
python
SimpleXMLRPCRequestHandler.decode_request_content
(self, data)
[]
def decode_request_content(self, data): #support gzip encoding of request encoding = self.headers.get("content-encoding", "identity").lower() if encoding == "identity": return data if encoding == "gzip": try: return gzip_decode(data) ex...
[ "def", "decode_request_content", "(", "self", ",", "data", ")", ":", "#support gzip encoding of request", "encoding", "=", "self", ".", "headers", ".", "get", "(", "\"content-encoding\"", ",", "\"identity\"", ")", ".", "lower", "(", ")", "if", "encoding", "==", ...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/xmlrpc/server.py#L534-L549