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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kivy/buildozer | 04f5d0076ea7931fc8aa0588f6a4c81810e2699e | buildozer/__init__.py | python | Buildozer.namify | (self, name) | return re.sub(r'[^a-zA-Z0-9_\-]', '_', name) | Return a "valid" name from a name with lot of invalid chars
(allowed characters: a-z, A-Z, 0-9, -, _) | Return a "valid" name from a name with lot of invalid chars
(allowed characters: a-z, A-Z, 0-9, -, _) | [
"Return",
"a",
"valid",
"name",
"from",
"a",
"name",
"with",
"lot",
"of",
"invalid",
"chars",
"(",
"allowed",
"characters",
":",
"a",
"-",
"z",
"A",
"-",
"Z",
"0",
"-",
"9",
"-",
"_",
")"
] | def namify(self, name):
'''Return a "valid" name from a name with lot of invalid chars
(allowed characters: a-z, A-Z, 0-9, -, _)
'''
return re.sub(r'[^a-zA-Z0-9_\-]', '_', name) | [
"def",
"namify",
"(",
"self",
",",
"name",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'[^a-zA-Z0-9_\\-]'",
",",
"'_'",
",",
"name",
")"
] | https://github.com/kivy/buildozer/blob/04f5d0076ea7931fc8aa0588f6a4c81810e2699e/buildozer/__init__.py#L819-L823 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/payloads/payloads/apache_root_directory.py | python | apache_root_directory.run_read | (self) | [] | def run_read(self):
api_result = self.api_read()
if not api_result['apache_root_directory']:
return 'Apache root directory not found.'
else:
rows = []
rows.append(['Apache root directories'])
rows.append([])
for key_name in api_result:... | [
"def",
"run_read",
"(",
"self",
")",
":",
"api_result",
"=",
"self",
".",
"api_read",
"(",
")",
"if",
"not",
"api_result",
"[",
"'apache_root_directory'",
"]",
":",
"return",
"'Apache root directory not found.'",
"else",
":",
"rows",
"=",
"[",
"]",
"rows",
"... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/payloads/payloads/apache_root_directory.py#L57-L71 | ||||
garrickbrazil/M3D-RPN | bf204e3f95f647d73a132535385119b12c8d6c36 | lib/augmentations.py | python | Augmentation.__init__ | (self, conf) | [] | def __init__(self, conf):
self.mean = conf.image_means
self.stds = conf.image_stds
self.size = conf.crop_size
self.mirror_prob = conf.mirror_prob
self.distort_prob = conf.distort_prob
if conf.distort_prob <= 0:
self.augment = Compose([
Conver... | [
"def",
"__init__",
"(",
"self",
",",
"conf",
")",
":",
"self",
".",
"mean",
"=",
"conf",
".",
"image_means",
"self",
".",
"stds",
"=",
"conf",
".",
"image_stds",
"self",
".",
"size",
"=",
"conf",
".",
"crop_size",
"self",
".",
"mirror_prob",
"=",
"co... | https://github.com/garrickbrazil/M3D-RPN/blob/bf204e3f95f647d73a132535385119b12c8d6c36/lib/augmentations.py#L337-L359 | ||||
sabnzbd/sabnzbd | 52d21e94d3cc6e30764a833fe2a256783d1a8931 | sabnzbd/bpsmeter.py | python | this_week | (t: float) | return time.mktime(monday) | Return timestamp for start of this week (monday) | Return timestamp for start of this week (monday) | [
"Return",
"timestamp",
"for",
"start",
"of",
"this",
"week",
"(",
"monday",
")"
] | def this_week(t: float) -> float:
"""Return timestamp for start of this week (monday)"""
while 1:
tm = time.localtime(t)
if tm.tm_wday == 0:
break
t -= DAY
monday = (tm.tm_year, tm.tm_mon, tm.tm_mday, 0, 0, 0, 0, 0, tm.tm_isdst)
return time.mktime(monday) | [
"def",
"this_week",
"(",
"t",
":",
"float",
")",
"->",
"float",
":",
"while",
"1",
":",
"tm",
"=",
"time",
".",
"localtime",
"(",
"t",
")",
"if",
"tm",
".",
"tm_wday",
"==",
"0",
":",
"break",
"t",
"-=",
"DAY",
"monday",
"=",
"(",
"tm",
".",
... | https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/bpsmeter.py#L48-L56 | |
secretsquirrel/the-backdoor-factory | 9972ac64e2860351a2132e56e6ac191af9b978bb | intel/WinIntelPE64.py | python | winI64_shellcode.iat_reverse_tcp_inline | (self, flItms, CavesPicked={}) | return (self.stackpreserve + self.shellcode1, self.shellcode2 + self.stackrestore) | Position dependent shellcode that uses API thunks of LoadLibraryA and
GetProcAddress to find and load APIs for callback to C2. | Position dependent shellcode that uses API thunks of LoadLibraryA and
GetProcAddress to find and load APIs for callback to C2. | [
"Position",
"dependent",
"shellcode",
"that",
"uses",
"API",
"thunks",
"of",
"LoadLibraryA",
"and",
"GetProcAddress",
"to",
"find",
"and",
"load",
"APIs",
"for",
"callback",
"to",
"C2",
"."
] | def iat_reverse_tcp_inline(self, flItms, CavesPicked={}):
"""
Position dependent shellcode that uses API thunks of LoadLibraryA and
GetProcAddress to find and load APIs for callback to C2.
"""
flItms['apis_needed'] = ['LoadLibraryA', 'GetProcAddress']
for api in flItms['... | [
"def",
"iat_reverse_tcp_inline",
"(",
"self",
",",
"flItms",
",",
"CavesPicked",
"=",
"{",
"}",
")",
":",
"flItms",
"[",
"'apis_needed'",
"]",
"=",
"[",
"'LoadLibraryA'",
",",
"'GetProcAddress'",
"]",
"for",
"api",
"in",
"flItms",
"[",
"'apis_needed'",
"]",
... | https://github.com/secretsquirrel/the-backdoor-factory/blob/9972ac64e2860351a2132e56e6ac191af9b978bb/intel/WinIntelPE64.py#L930-L1139 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/hostingsvcs/utils/paginator.py | python | APIPaginator.__init__ | (self, client, url, query_params={}, *args, **kwargs) | Initialize the paginator.
Once initialized, the first page will be fetched automatically.
Args:
client (reviewboard.hostingsvcs.service.HostingServiceClient):
The hosting service client used to make requests.
url (unicode):
The URL used to make ... | Initialize the paginator. | [
"Initialize",
"the",
"paginator",
"."
] | def __init__(self, client, url, query_params={}, *args, **kwargs):
"""Initialize the paginator.
Once initialized, the first page will be fetched automatically.
Args:
client (reviewboard.hostingsvcs.service.HostingServiceClient):
The hosting service client used to ma... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"url",
",",
"query_params",
"=",
"{",
"}",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"APIPaginator",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/hostingsvcs/utils/paginator.py#L221-L263 | ||
mlcommons/training | 4a4d5a0b7efe99c680306b1940749211d4238a84 | rnn_translator/pytorch/seq2seq/train/fp_optimizers.py | python | Fp16Optimizer.__init__ | (self, fp16_model, grad_clip=float('inf'), loss_scale=8192,
dls_downscale=2, dls_upscale=2, dls_upscale_interval=128) | Constructor for the Fp16Optimizer.
:param fp16_model: model (previously casted to half)
:param grad_clip: coefficient for gradient clipping, max L2 norm of the
gradients
:param loss_scale: initial loss scale
:param dls_downscale: loss downscale factor, loss scale is divided ... | Constructor for the Fp16Optimizer. | [
"Constructor",
"for",
"the",
"Fp16Optimizer",
"."
] | def __init__(self, fp16_model, grad_clip=float('inf'), loss_scale=8192,
dls_downscale=2, dls_upscale=2, dls_upscale_interval=128):
"""
Constructor for the Fp16Optimizer.
:param fp16_model: model (previously casted to half)
:param grad_clip: coefficient for gradient clip... | [
"def",
"__init__",
"(",
"self",
",",
"fp16_model",
",",
"grad_clip",
"=",
"float",
"(",
"'inf'",
")",
",",
"loss_scale",
"=",
"8192",
",",
"dls_downscale",
"=",
"2",
",",
"dls_upscale",
"=",
"2",
",",
"dls_upscale_interval",
"=",
"128",
")",
":",
"loggin... | https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/rnn_translator/pytorch/seq2seq/train/fp_optimizers.py#L37-L61 | ||
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/compute/manager.py | python | ComputeVirtAPI.update_compute_provider_status | (self, context, rp_uuid, enabled) | Used to add/remove the COMPUTE_STATUS_DISABLED trait on the provider
:param context: nova auth RequestContext
:param rp_uuid: UUID of a compute node resource provider in Placement
:param enabled: True if the node is enabled in which case the trait
would be removed, False if the node... | Used to add/remove the COMPUTE_STATUS_DISABLED trait on the provider | [
"Used",
"to",
"add",
"/",
"remove",
"the",
"COMPUTE_STATUS_DISABLED",
"trait",
"on",
"the",
"provider"
] | def update_compute_provider_status(self, context, rp_uuid, enabled):
"""Used to add/remove the COMPUTE_STATUS_DISABLED trait on the provider
:param context: nova auth RequestContext
:param rp_uuid: UUID of a compute node resource provider in Placement
:param enabled: True if the node is... | [
"def",
"update_compute_provider_status",
"(",
"self",
",",
"context",
",",
"rp_uuid",
",",
"enabled",
")",
":",
"trait_name",
"=",
"os_traits",
".",
"COMPUTE_STATUS_DISABLED",
"# Get the current traits (and generation) for the provider.",
"# TODO(mriedem): Leverage the ProviderTr... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/compute/manager.py#L495-L528 | ||
PennyLaneAI/pennylane | 1275736f790ced1d778858ed383448d4a43a4cdd | pennylane/hf/hartree_fock.py | python | hf_energy | (mol) | return energy | r"""Return a function that computes the Hartree-Fock energy.
Args:
mol (Molecule): the molecule object
Returns:
function: function that computes the Hartree-Fock energy
**Example**
>>> symbols = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]], requires_grad... | r"""Return a function that computes the Hartree-Fock energy. | [
"r",
"Return",
"a",
"function",
"that",
"computes",
"the",
"Hartree",
"-",
"Fock",
"energy",
"."
] | def hf_energy(mol):
r"""Return a function that computes the Hartree-Fock energy.
Args:
mol (Molecule): the molecule object
Returns:
function: function that computes the Hartree-Fock energy
**Example**
>>> symbols = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0... | [
"def",
"hf_energy",
"(",
"mol",
")",
":",
"def",
"energy",
"(",
"*",
"args",
")",
":",
"r\"\"\"Compute the Hartree-Fock energy.\n\n Args:\n args (array[array[float]]): initial values of the differentiable parameters\n\n Returns:\n float: the Hartree-Fock... | https://github.com/PennyLaneAI/pennylane/blob/1275736f790ced1d778858ed383448d4a43a4cdd/pennylane/hf/hartree_fock.py#L226-L263 | |
pjkundert/cpppo | 4c217b6c06b88bede3888cc5ea2731f271a95086 | tools/waits.py | python | existence.truth | ( self, predicate ) | return True | Waits for predicate to evaluate. We'll keep doubling the delay (exponential backoff) 'til we
get to 1/2 the timeout, when we'll begin using 1/2 the remaining timeout.
The only valid states are that that the file doesn't exist, or that it exists and is
readable. Everything else (eg. exists but... | Waits for predicate to evaluate. We'll keep doubling the delay (exponential backoff) 'til we
get to 1/2 the timeout, when we'll begin using 1/2 the remaining timeout. | [
"Waits",
"for",
"predicate",
"to",
"evaluate",
".",
"We",
"ll",
"keep",
"doubling",
"the",
"delay",
"(",
"exponential",
"backoff",
")",
"til",
"we",
"get",
"to",
"1",
"/",
"2",
"the",
"timeout",
"when",
"we",
"ll",
"begin",
"using",
"1",
"/",
"2",
"t... | def truth( self, predicate ):
"""Waits for predicate to evaluate. We'll keep doubling the delay (exponential backoff) 'til we
get to 1/2 the timeout, when we'll begin using 1/2 the remaining timeout.
The only valid states are that that the file doesn't exist, or that it exists and is
r... | [
"def",
"truth",
"(",
"self",
",",
"predicate",
")",
":",
"delay",
"=",
"0",
"found",
"=",
"None",
"while",
"found",
"!=",
"self",
".",
"presence",
":",
"found",
"=",
"bool",
"(",
"predicate",
"(",
")",
")",
"if",
"found",
"!=",
"self",
".",
"presen... | https://github.com/pjkundert/cpppo/blob/4c217b6c06b88bede3888cc5ea2731f271a95086/tools/waits.py#L185-L210 | |
mautrix/telegram | 9f48eca5a6654bc38012cb761ecaaaf416aabdd0 | mautrix_telegram/portal.py | python | Portal.try_handle_telegram_reactions | (
self,
source: au.AbstractUser,
msg_id: TelegramID,
data: MessageReactions,
dbm: DBMessage | None = None,
) | [] | async def try_handle_telegram_reactions(
self,
source: au.AbstractUser,
msg_id: TelegramID,
data: MessageReactions,
dbm: DBMessage | None = None,
) -> None:
try:
await self.handle_telegram_reactions(source, msg_id, data, dbm)
except Exception:
... | [
"async",
"def",
"try_handle_telegram_reactions",
"(",
"self",
",",
"source",
":",
"au",
".",
"AbstractUser",
",",
"msg_id",
":",
"TelegramID",
",",
"data",
":",
"MessageReactions",
",",
"dbm",
":",
"DBMessage",
"|",
"None",
"=",
"None",
",",
")",
"->",
"No... | https://github.com/mautrix/telegram/blob/9f48eca5a6654bc38012cb761ecaaaf416aabdd0/mautrix_telegram/portal.py#L2766-L2776 | ||||
DSE-MSU/DeepRobust | 2bcde200a5969dae32cddece66206a52c87c43e8 | deeprobust/image/netmodels/densenet.py | python | DenseNet.__init__ | (self, block, nblocks, growth_rate=12, reduction=0.5, num_classes=10) | [] | def __init__(self, block, nblocks, growth_rate=12, reduction=0.5, num_classes=10):
super(DenseNet, self).__init__()
self.growth_rate = growth_rate
num_planes = 2*growth_rate
self.conv1 = nn.Conv2d(3, num_planes, kernel_size=3, padding=1, bias=False)
self.dense1 = self._make_den... | [
"def",
"__init__",
"(",
"self",
",",
"block",
",",
"nblocks",
",",
"growth_rate",
"=",
"12",
",",
"reduction",
"=",
"0.5",
",",
"num_classes",
"=",
"10",
")",
":",
"super",
"(",
"DenseNet",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
... | https://github.com/DSE-MSU/DeepRobust/blob/2bcde200a5969dae32cddece66206a52c87c43e8/deeprobust/image/netmodels/densenet.py#L48-L77 | ||||
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/io/tf/lite/flatbuffers/MatrixDiagOptions.py | python | MatrixDiagOptionsEnd | (builder) | return builder.EndObject() | [] | def MatrixDiagOptionsEnd(builder): return builder.EndObject() | [
"def",
"MatrixDiagOptionsEnd",
"(",
"builder",
")",
":",
"return",
"builder",
".",
"EndObject",
"(",
")"
] | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/MatrixDiagOptions.py#L28-L28 | |||
dcsync/pycobalt | d3a630bfadaeeb6c99aad28f226abe48f6b4acca | pycobalt/aggressor.py | python | ssh_command_register | (*args, fork=None, sync=True) | return engine.call('ssh_command_register', args, fork=fork, sync=sync) | r"""
Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
Register help information for an SSH console command.
Arguments
$1 - the command
$2 - the short description of the command
$3 - the long-form help for the command.
Example
s... | r"""
Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: | [
"r",
"Documentation",
"from",
"https",
":",
"//",
"www",
".",
"cobaltstrike",
".",
"com",
"/",
"aggressor",
"-",
"script",
"/",
"functions",
".",
"html",
":"
] | def ssh_command_register(*args, fork=None, sync=True):
r"""
Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
Register help information for an SSH console command.
Arguments
$1 - the command
$2 - the short description of the command
$3 - th... | [
"def",
"ssh_command_register",
"(",
"*",
"args",
",",
"fork",
"=",
"None",
",",
"sync",
"=",
"True",
")",
":",
"return",
"engine",
".",
"call",
"(",
"'ssh_command_register'",
",",
"args",
",",
"fork",
"=",
"fork",
",",
"sync",
"=",
"sync",
")"
] | https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L6471-L6492 | |
ricequant/rqalpha | d8b345ca3fde299e061c6a89c1f2c362c3584c96 | rqalpha/core/strategy_context.py | python | RunInfo.slippage | (self) | return self._slippage | 滑点水平 | 滑点水平 | [
"滑点水平"
] | def slippage(self):
# type: () -> float
"""
滑点水平
"""
return self._slippage | [
"def",
"slippage",
"(",
"self",
")",
":",
"# type: () -> float",
"return",
"self",
".",
"_slippage"
] | https://github.com/ricequant/rqalpha/blob/d8b345ca3fde299e061c6a89c1f2c362c3584c96/rqalpha/core/strategy_context.py#L92-L97 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py | python | AtraceAgent._collect_trace_data | (self) | return output | Reads the output from atrace and stops the trace. | Reads the output from atrace and stops the trace. | [
"Reads",
"the",
"output",
"from",
"atrace",
"and",
"stops",
"the",
"trace",
"."
] | def _collect_trace_data(self):
"""Reads the output from atrace and stops the trace."""
result = self._stop_collect_trace()
data_start = re.search(TRACE_START_REGEXP, result)
if data_start:
data_start = data_start.end(0)
else:
raise IOError('Unable to get atrace data. Did you forget adb ... | [
"def",
"_collect_trace_data",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_stop_collect_trace",
"(",
")",
"data_start",
"=",
"re",
".",
"search",
"(",
"TRACE_START_REGEXP",
",",
"result",
")",
"if",
"data_start",
":",
"data_start",
"=",
"data_start",
... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/systrace/systrace/tracing_agents/atrace_agent.py#L260-L270 | |
google-research/recsim | 55e50e4be736d222ffe8c2477ed1981b40f91605 | recsim/simulator/environment.py | python | MultiUserEnvironment.reset | (self) | return (user_obs, self._current_documents) | Resets the environment and return the first observation.
Returns:
user_obs: An array of floats representing observations of the user's
current state
doc_obs: An OrderedDict of document observations keyed by document ids | Resets the environment and return the first observation. | [
"Resets",
"the",
"environment",
"and",
"return",
"the",
"first",
"observation",
"."
] | def reset(self):
"""Resets the environment and return the first observation.
Returns:
user_obs: An array of floats representing observations of the user's
current state
doc_obs: An OrderedDict of document observations keyed by document ids
"""
for user_model in self.user_model:
... | [
"def",
"reset",
"(",
"self",
")",
":",
"for",
"user_model",
"in",
"self",
".",
"user_model",
":",
"user_model",
".",
"reset",
"(",
")",
"user_obs",
"=",
"[",
"user_model",
".",
"create_observation",
"(",
")",
"for",
"user_model",
"in",
"self",
".",
"user... | https://github.com/google-research/recsim/blob/55e50e4be736d222ffe8c2477ed1981b40f91605/recsim/simulator/environment.py#L238-L255 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/app_manager/models.py | python | LazyBlobDoc.save | (self, **params) | [] | def save(self, **params):
def super_save():
super(LazyBlobDoc, self).save(**params)
if self._LAZY_ATTACHMENTS:
with self.atomic_blobs(super_save):
for name, info in self._LAZY_ATTACHMENTS.items():
if not info['content_type']:
... | [
"def",
"save",
"(",
"self",
",",
"*",
"*",
"params",
")",
":",
"def",
"super_save",
"(",
")",
":",
"super",
"(",
"LazyBlobDoc",
",",
"self",
")",
".",
"save",
"(",
"*",
"*",
"params",
")",
"if",
"self",
".",
"_LAZY_ATTACHMENTS",
":",
"with",
"self"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/models.py#L3971-L3985 | ||||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/mail/imap4.py | python | MessageProducer.__init__ | (self, msg, buffer = None, scheduler = None) | Produce this message.
@param msg: The message I am to produce.
@type msg: L{IMessage}
@param buffer: A buffer to hold the message in. If None, I will
use a L{tempfile.TemporaryFile}.
@type buffer: file-like | Produce this message. | [
"Produce",
"this",
"message",
"."
] | def __init__(self, msg, buffer = None, scheduler = None):
"""Produce this message.
@param msg: The message I am to produce.
@type msg: L{IMessage}
@param buffer: A buffer to hold the message in. If None, I will
use a L{tempfile.TemporaryFile}.
@type buffer: file-li... | [
"def",
"__init__",
"(",
"self",
",",
"msg",
",",
"buffer",
"=",
"None",
",",
"scheduler",
"=",
"None",
")",
":",
"self",
".",
"msg",
"=",
"msg",
"if",
"buffer",
"is",
"None",
":",
"buffer",
"=",
"tempfile",
".",
"TemporaryFile",
"(",
")",
"self",
"... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/mail/imap4.py#L5278-L5295 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/_pyio.py | python | BufferedReader.__init__ | (self, raw, buffer_size=DEFAULT_BUFFER_SIZE) | Create a new buffered reader using the given readable raw IO object. | Create a new buffered reader using the given readable raw IO object. | [
"Create",
"a",
"new",
"buffered",
"reader",
"using",
"the",
"given",
"readable",
"raw",
"IO",
"object",
"."
] | def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE):
"""Create a new buffered reader using the given readable raw IO object.
"""
if not raw.readable():
raise OSError('"raw" argument must be readable.')
_BufferedIOMixin.__init__(self, raw)
if buffer_size <= 0:
... | [
"def",
"__init__",
"(",
"self",
",",
"raw",
",",
"buffer_size",
"=",
"DEFAULT_BUFFER_SIZE",
")",
":",
"if",
"not",
"raw",
".",
"readable",
"(",
")",
":",
"raise",
"OSError",
"(",
"'\"raw\" argument must be readable.'",
")",
"_BufferedIOMixin",
".",
"__init__",
... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/_pyio.py#L928-L939 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/models/lookups.py | python | YearComparisonLookup.get_rhs_op | (self, connection, rhs) | return connection.operators[self.lookup_name] % rhs | [] | def get_rhs_op(self, connection, rhs):
return connection.operators[self.lookup_name] % rhs | [
"def",
"get_rhs_op",
"(",
"self",
",",
"connection",
",",
"rhs",
")",
":",
"return",
"connection",
".",
"operators",
"[",
"self",
".",
"lookup_name",
"]",
"%",
"rhs"
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/models/lookups.py#L569-L570 | |||
peeringdb/peeringdb | 47c6a699267b35663898f8d261159bdae9720f04 | peeringdb_server/models.py | python | IXFMemberData.netixlan | (self) | return self._netixlan | Will either return a matching existing netixlan
instance (asn,ip4,ip6) or a new netixlan if
a matching netixlan does not currently exist.
Any new netixlan will NOT be saved at this point.
Note that the netixlan that matched may be currently
soft-deleted (status=="deleted"). | Will either return a matching existing netixlan
instance (asn,ip4,ip6) or a new netixlan if
a matching netixlan does not currently exist. | [
"Will",
"either",
"return",
"a",
"matching",
"existing",
"netixlan",
"instance",
"(",
"asn",
"ip4",
"ip6",
")",
"or",
"a",
"new",
"netixlan",
"if",
"a",
"matching",
"netixlan",
"does",
"not",
"currently",
"exist",
"."
] | def netixlan(self):
"""
Will either return a matching existing netixlan
instance (asn,ip4,ip6) or a new netixlan if
a matching netixlan does not currently exist.
Any new netixlan will NOT be saved at this point.
Note that the netixlan that matched may be currently
... | [
"def",
"netixlan",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_netixlan\"",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"for_deletion\"",
")",
":",
"self",
".",
"for_deletion",
"=",
"self",
".",
"remote_data_missing",
"... | https://github.com/peeringdb/peeringdb/blob/47c6a699267b35663898f8d261159bdae9720f04/peeringdb_server/models.py#L3522-L3570 | |
scientifichackers/ampy | dd4ca50b57c3bd24decc8ca8059be8d9ee48a1a0 | ampy/cli.py | python | rm | (remote_file) | Remove a file from the board.
Remove the specified file from the board's filesystem. Must specify one
argument which is the path to the file to delete. Note that this can't
delete directories which have files inside them, but can delete empty
directories.
For example to delete main.py from the r... | Remove a file from the board. | [
"Remove",
"a",
"file",
"from",
"the",
"board",
"."
] | def rm(remote_file):
"""Remove a file from the board.
Remove the specified file from the board's filesystem. Must specify one
argument which is the path to the file to delete. Note that this can't
delete directories which have files inside them, but can delete empty
directories.
For example ... | [
"def",
"rm",
"(",
"remote_file",
")",
":",
"# Delete the provided file/directory on the board.",
"board_files",
"=",
"files",
".",
"Files",
"(",
"_board",
")",
"board_files",
".",
"rm",
"(",
"remote_file",
")"
] | https://github.com/scientifichackers/ampy/blob/dd4ca50b57c3bd24decc8ca8059be8d9ee48a1a0/ampy/cli.py#L284-L298 | ||
SJ001/AI-Feynman | a05bc4a5be23d6eb3e1d0b2f7eb1ab5b78a920ad | aifeynman/get_pareto.py | python | ParetoSet.plot | (self) | Plotting the Pareto frontier. | Plotting the Pareto frontier. | [
"Plotting",
"the",
"Pareto",
"frontier",
"."
] | def plot(self):
"""Plotting the Pareto frontier."""
array = self.to_array()
plt.figure(figsize=(8, 6))
plt.plot(array[:, 0], array[:, 1], 'r.')
plt.show() | [
"def",
"plot",
"(",
"self",
")",
":",
"array",
"=",
"self",
".",
"to_array",
"(",
")",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"8",
",",
"6",
")",
")",
"plt",
".",
"plot",
"(",
"array",
"[",
":",
",",
"0",
"]",
",",
"array",
"[",
":... | https://github.com/SJ001/AI-Feynman/blob/a05bc4a5be23d6eb3e1d0b2f7eb1ab5b78a920ad/aifeynman/get_pareto.py#L246-L251 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/index.py | python | InstallationCandidate.__eq__ | (self, other) | return self._compare(other, lambda s, o: s == o) | [] | def __eq__(self, other):
return self._compare(other, lambda s, o: s == o) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"_compare",
"(",
"other",
",",
"lambda",
"s",
",",
"o",
":",
"s",
"==",
"o",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/index.py#L82-L83 | |||
Luodian/MADAN | 7a2918da44f5203b72652bc4cba0e70057482114 | cyclegan/data/base_data_loader.py | python | BaseDataLoader.initialize | (self, opt) | [] | def initialize(self, opt):
self.opt = opt
pass | [
"def",
"initialize",
"(",
"self",
",",
"opt",
")",
":",
"self",
".",
"opt",
"=",
"opt",
"pass"
] | https://github.com/Luodian/MADAN/blob/7a2918da44f5203b72652bc4cba0e70057482114/cyclegan/data/base_data_loader.py#L5-L7 | ||||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/_backend_tk.py | python | raise_msg_to_str | (msg) | return msg | msg is a return arg from a raise. Join with new lines | msg is a return arg from a raise. Join with new lines | [
"msg",
"is",
"a",
"return",
"arg",
"from",
"a",
"raise",
".",
"Join",
"with",
"new",
"lines"
] | def raise_msg_to_str(msg):
"""msg is a return arg from a raise. Join with new lines"""
if not isinstance(msg, str):
msg = '\n'.join(map(str, msg))
return msg | [
"def",
"raise_msg_to_str",
"(",
"msg",
")",
":",
"if",
"not",
"isinstance",
"(",
"msg",
",",
"str",
")",
":",
"msg",
"=",
"'\\n'",
".",
"join",
"(",
"map",
"(",
"str",
",",
"msg",
")",
")",
"return",
"msg"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/_backend_tk.py#L57-L61 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/gui/utils/qt/qelement_edit.py | python | QNodeElementEdit.on_focus_callback | (self, eids, nids, name) | the callback method for ``on_focus`` | the callback method for ``on_focus`` | [
"the",
"callback",
"method",
"for",
"on_focus"
] | def on_focus_callback(self, eids, nids, name):
"""the callback method for ``on_focus``"""
raise NotImplementedError('write_patran_syntax_dict callback') | [
"def",
"on_focus_callback",
"(",
"self",
",",
"eids",
",",
"nids",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'write_patran_syntax_dict callback'",
")"
] | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/gui/utils/qt/qelement_edit.py#L64-L66 | ||
google/pytype | fa43edc95dd42ade6e3147d6580d63e778c9d506 | pytype/state.py | python | split_conditions | (node, var) | return (_restrict_condition(node, var.bindings, True),
_restrict_condition(node, var.bindings, False)) | Return a pair of conditions for the value being true and false. | Return a pair of conditions for the value being true and false. | [
"Return",
"a",
"pair",
"of",
"conditions",
"for",
"the",
"value",
"being",
"true",
"and",
"false",
"."
] | def split_conditions(node, var):
"""Return a pair of conditions for the value being true and false."""
return (_restrict_condition(node, var.bindings, True),
_restrict_condition(node, var.bindings, False)) | [
"def",
"split_conditions",
"(",
"node",
",",
"var",
")",
":",
"return",
"(",
"_restrict_condition",
"(",
"node",
",",
"var",
".",
"bindings",
",",
"True",
")",
",",
"_restrict_condition",
"(",
"node",
",",
"var",
".",
"bindings",
",",
"False",
")",
")"
] | https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/state.py#L331-L334 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/utils/__init__.py | python | captured_stdout | () | return captured_output('stdout') | Capture the output of sys.stdout:
with captured_stdout() as stdout:
print('hello')
self.assertEqual(stdout.getvalue(), 'hello\n')
Taken from Lib/support/__init__.py in the CPython repo. | Capture the output of sys.stdout: | [
"Capture",
"the",
"output",
"of",
"sys",
".",
"stdout",
":"
] | def captured_stdout():
"""Capture the output of sys.stdout:
with captured_stdout() as stdout:
print('hello')
self.assertEqual(stdout.getvalue(), 'hello\n')
Taken from Lib/support/__init__.py in the CPython repo.
"""
return captured_output('stdout') | [
"def",
"captured_stdout",
"(",
")",
":",
"return",
"captured_output",
"(",
"'stdout'",
")"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/utils/__init__.py#L798-L807 | |
armijnhemel/binaryanalysis-ng | 34c655ed71d3d022ee49c4e1271002b2ebf40001 | src/parsers/media/au/UnpackParser.py | python | AuUnpackParser.set_metadata_and_labels | (self) | sets metadata and labels for the unpackresults | sets metadata and labels for the unpackresults | [
"sets",
"metadata",
"and",
"labels",
"for",
"the",
"unpackresults"
] | def set_metadata_and_labels(self):
"""sets metadata and labels for the unpackresults"""
labels = [ 'au', 'audio' ]
metadata = {}
if self.data.header.comment != '':
metadata['comment'] = self.data.header.comment
self.unpack_results.set_metadata(metadata)
self.... | [
"def",
"set_metadata_and_labels",
"(",
"self",
")",
":",
"labels",
"=",
"[",
"'au'",
",",
"'audio'",
"]",
"metadata",
"=",
"{",
"}",
"if",
"self",
".",
"data",
".",
"header",
".",
"comment",
"!=",
"''",
":",
"metadata",
"[",
"'comment'",
"]",
"=",
"s... | https://github.com/armijnhemel/binaryanalysis-ng/blob/34c655ed71d3d022ee49c4e1271002b2ebf40001/src/parsers/media/au/UnpackParser.py#L63-L71 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/point/__init__.py | python | MinutPointClient.is_available | (self, device_id) | return device_id in self._client.device_ids | Return device availability. | Return device availability. | [
"Return",
"device",
"availability",
"."
] | def is_available(self, device_id):
"""Return device availability."""
if not self._is_available:
return False
return device_id in self._client.device_ids | [
"def",
"is_available",
"(",
"self",
",",
"device_id",
")",
":",
"if",
"not",
"self",
".",
"_is_available",
":",
"return",
"False",
"return",
"device_id",
"in",
"self",
".",
"_client",
".",
"device_ids"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/point/__init__.py#L228-L232 | |
pytorch/fairseq | 1575f30dd0a9f7b3c499db0b4767aa4e9f79056c | fairseq/data/audio/data_cfg.py | python | S2TDataConfig.speaker_set_filename | (self) | return self.config.get("speaker_set_filename", None) | speaker set file under data root | speaker set file under data root | [
"speaker",
"set",
"file",
"under",
"data",
"root"
] | def speaker_set_filename(self):
"""speaker set file under data root"""
return self.config.get("speaker_set_filename", None) | [
"def",
"speaker_set_filename",
"(",
"self",
")",
":",
"return",
"self",
".",
"config",
".",
"get",
"(",
"\"speaker_set_filename\"",
",",
"None",
")"
] | https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/fairseq/data/audio/data_cfg.py#L51-L53 | |
nobody132/masr | cf324178982d5a96cfd6a8384b8dfd077d9eab50 | decoder.py | python | Decoder.decode | (self, probs, sizes=None) | Given a matrix of character probabilities, returns the decoder's
best guess of the transcription
Arguments:
probs: Tensor of character probabilities, where probs[c,t]
is the probability of character c at time t
sizes(optional): Size of each sequence i... | Given a matrix of character probabilities, returns the decoder's
best guess of the transcription | [
"Given",
"a",
"matrix",
"of",
"character",
"probabilities",
"returns",
"the",
"decoder",
"s",
"best",
"guess",
"of",
"the",
"transcription"
] | def decode(self, probs, sizes=None):
"""
Given a matrix of character probabilities, returns the decoder's
best guess of the transcription
Arguments:
probs: Tensor of character probabilities, where probs[c,t]
is the probability of character c at ti... | [
"def",
"decode",
"(",
"self",
",",
"probs",
",",
"sizes",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/nobody132/masr/blob/cf324178982d5a96cfd6a8384b8dfd077d9eab50/decoder.py#L60-L72 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/persisted/journal/base.py | python | Journal._reallyExecute | (self, index, command, runTime) | return result | Callback called when logging command is done. | Callback called when logging command is done. | [
"Callback",
"called",
"when",
"logging",
"command",
"is",
"done",
"."
] | def _reallyExecute(self, index, command, runTime):
"""Callback called when logging command is done."""
result = command.execute(self.journaledService, runTime)
self.latestIndex = index
return result | [
"def",
"_reallyExecute",
"(",
"self",
",",
"index",
",",
"command",
",",
"runTime",
")",
":",
"result",
"=",
"command",
".",
"execute",
"(",
"self",
".",
"journaledService",
",",
"runTime",
")",
"self",
".",
"latestIndex",
"=",
"index",
"return",
"result"
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/persisted/journal/base.py#L54-L58 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/distutils/command/bdist_msi.py | python | bdist_msi.add_find_python | (self) | Adds code to the installer to compute the location of Python.
Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
registry for each version of Python.
Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
else from PYTHON.MACHINE.X.Y.
Properti... | Adds code to the installer to compute the location of Python. | [
"Adds",
"code",
"to",
"the",
"installer",
"to",
"compute",
"the",
"location",
"of",
"Python",
"."
] | def add_find_python(self):
"""Adds code to the installer to compute the location of Python.
Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
registry for each version of Python.
Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
else from... | [
"def",
"add_find_python",
"(",
"self",
")",
":",
"start",
"=",
"402",
"for",
"ver",
"in",
"self",
".",
"versions",
":",
"install_path",
"=",
"r\"SOFTWARE\\Python\\PythonCore\\%s\\InstallPath\"",
"%",
"ver",
"machine_reg",
"=",
"\"python.machine.\"",
"+",
"ver",
"u... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/distutils/command/bdist_msi.py#L323-L375 | ||
python-pillow/Pillow | fd2b07c454b20e1e9af0cea64923b21250f8f8d6 | src/PIL/ImageDraw.py | python | ImageDraw.__init__ | (self, im, mode=None) | Create a drawing instance.
:param im: The image to draw in.
:param mode: Optional mode to use for color values. For RGB
images, this argument can be RGB or RGBA (to blend the
drawing into the image). For all other modes, this argument
must be the same as the image mod... | Create a drawing instance. | [
"Create",
"a",
"drawing",
"instance",
"."
] | def __init__(self, im, mode=None):
"""
Create a drawing instance.
:param im: The image to draw in.
:param mode: Optional mode to use for color values. For RGB
images, this argument can be RGB or RGBA (to blend the
drawing into the image). For all other modes, thi... | [
"def",
"__init__",
"(",
"self",
",",
"im",
",",
"mode",
"=",
"None",
")",
":",
"im",
".",
"load",
"(",
")",
"if",
"im",
".",
"readonly",
":",
"im",
".",
"_copy",
"(",
")",
"# make it writeable",
"blend",
"=",
"0",
"if",
"mode",
"is",
"None",
":",... | https://github.com/python-pillow/Pillow/blob/fd2b07c454b20e1e9af0cea64923b21250f8f8d6/src/PIL/ImageDraw.py#L47-L87 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/functions/hypergeometric.py | python | Hypergeometric._evalf_ | (self, a, b, z, parent, algorithm=None) | return mpmath_utils.call(hyper, aa, bb, z, parent=parent) | TESTS::
sage: hypergeometric([1, 1], [2], -1).n()
0.693147180559945
sage: hypergeometric([], [], RealField(100)(1))
2.7182818284590452353602874714 | TESTS:: | [
"TESTS",
"::"
] | def _evalf_(self, a, b, z, parent, algorithm=None):
"""
TESTS::
sage: hypergeometric([1, 1], [2], -1).n()
0.693147180559945
sage: hypergeometric([], [], RealField(100)(1))
2.7182818284590452353602874714
"""
if not isinstance(a, tuple) or ... | [
"def",
"_evalf_",
"(",
"self",
",",
"a",
",",
"b",
",",
"z",
",",
"parent",
",",
"algorithm",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"tuple",
")",
"or",
"not",
"isinstance",
"(",
"b",
",",
"tuple",
")",
":",
"raise",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/hypergeometric.py#L349-L364 | |
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/dictionary/pronunciation.py | python | PronunciationDictionaryMixin._write_fst_text_disambiguated | (
self, multispeaker_dictionary: Optional[MultispeakerDictionaryMixin] = None
) | Write the text L_disambig.fst file to the temporary directory
Parameters
----------
multispeaker_dictionary: MultispeakerDictionaryMixin, optional
Main dictionary with phone mappings | Write the text L_disambig.fst file to the temporary directory | [
"Write",
"the",
"text",
"L_disambig",
".",
"fst",
"file",
"to",
"the",
"temporary",
"directory"
] | def _write_fst_text_disambiguated(
self, multispeaker_dictionary: Optional[MultispeakerDictionaryMixin] = None
) -> None:
"""
Write the text L_disambig.fst file to the temporary directory
Parameters
----------
multispeaker_dictionary: MultispeakerDictionaryMixin, opt... | [
"def",
"_write_fst_text_disambiguated",
"(",
"self",
",",
"multispeaker_dictionary",
":",
"Optional",
"[",
"MultispeakerDictionaryMixin",
"]",
"=",
"None",
")",
"->",
"None",
":",
"lexicon_fst_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dictio... | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/dictionary/pronunciation.py#L779-L872 | ||
cobrateam/splinter | a3f30f53d886709e60218e46b521cbd87e9caadd | splinter/driver/__init__.py | python | DriverAPI.find_option_by_value | (self, value) | Find ``<option>`` elements by their value.
Returns an instance of :class:`ElementList <splinter.element_list.ElementList>`
Arguments:
value (str): value to use in the search query. | Find ``<option>`` elements by their value. | [
"Find",
"<option",
">",
"elements",
"by",
"their",
"value",
"."
] | def find_option_by_value(self, value):
"""
Find ``<option>`` elements by their value.
Returns an instance of :class:`ElementList <splinter.element_list.ElementList>`
Arguments:
value (str): value to use in the search query.
"""
raise NotImplementedError(
... | [
"def",
"find_option_by_value",
"(",
"self",
",",
"value",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"%s doesn't support finding options by value.\"",
"%",
"self",
".",
"driver_name",
")"
] | https://github.com/cobrateam/splinter/blob/a3f30f53d886709e60218e46b521cbd87e9caadd/splinter/driver/__init__.py#L278-L289 | ||
PythonCharmers/python-future | 80523f383fbba1c6de0551e19d0277e73e69573c | src/future/backports/urllib/request.py | python | parse_http_list | (s) | return [part.strip() for part in res] | Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Neither commas nor quotes count if they are escaped.
O... | Parse lists as described by RFC 2068 Section 2. | [
"Parse",
"lists",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"."
] | def parse_http_list(s):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Neither commas nor quotes c... | [
"def",
"parse_http_list",
"(",
"s",
")",
":",
"res",
"=",
"[",
"]",
"part",
"=",
"''",
"escape",
"=",
"quote",
"=",
"False",
"for",
"cur",
"in",
"s",
":",
"if",
"escape",
":",
"part",
"+=",
"cur",
"escape",
"=",
"False",
"continue",
"if",
"quote",
... | https://github.com/PythonCharmers/python-future/blob/80523f383fbba1c6de0551e19d0277e73e69573c/src/future/backports/urllib/request.py#L1371-L1412 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/newsletters/forms.py | python | MarketingStep2EmailFilterForm.filter_email | (self, request, queryset) | return queryset | [] | def filter_email(self, request, queryset):
search_criteria = request.GET.get('search_criteria')
q = request.GET.get('q')
query = {search_criteria: q}
queryset = queryset.filter(**query)
return queryset | [
"def",
"filter_email",
"(",
"self",
",",
"request",
",",
"queryset",
")",
":",
"search_criteria",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'search_criteria'",
")",
"q",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'q'",
")",
"query",
"=",
"{",
... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/newsletters/forms.py#L249-L255 | |||
pymeasure/pymeasure | b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e | pymeasure/instruments/srs/sr570.py | python | SR570.blank_front | (self) | Blanks the frontend output of the device | Blanks the frontend output of the device | [
"Blanks",
"the",
"frontend",
"output",
"of",
"the",
"device"
] | def blank_front(self):
""""Blanks the frontend output of the device"""
self.front_blanked = True | [
"def",
"blank_front",
"(",
"self",
")",
":",
"self",
".",
"front_blanked",
"=",
"True"
] | https://github.com/pymeasure/pymeasure/blob/b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e/pymeasure/instruments/srs/sr570.py#L202-L204 | ||
shekkizh/TensorflowProjects | 5bd5563a5310df0b87725d989e84d49da0ea8c00 | Misc/Deblurring.py | python | read_cifar10 | (filename_queue) | return result | [] | def read_cifar10(filename_queue):
class CIFAR10Record(object):
pass
result = CIFAR10Record()
# Dimensions of the images in the CIFAR-10 dataset.
# See http://www.cs.toronto.edu/~kriz/cifar.html for a description of the
# input format.
label_bytes = 1 # 2 for CIFAR-100
result.heigh... | [
"def",
"read_cifar10",
"(",
"filename_queue",
")",
":",
"class",
"CIFAR10Record",
"(",
"object",
")",
":",
"pass",
"result",
"=",
"CIFAR10Record",
"(",
")",
"# Dimensions of the images in the CIFAR-10 dataset.",
"# See http://www.cs.toronto.edu/~kriz/cifar.html for a descriptio... | https://github.com/shekkizh/TensorflowProjects/blob/5bd5563a5310df0b87725d989e84d49da0ea8c00/Misc/Deblurring.py#L73-L114 | |||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/plugin_base/item_list.py | python | ItemList._clear_list | (self) | Abstract method for clearing item list | Abstract method for clearing item list | [
"Abstract",
"method",
"for",
"clearing",
"item",
"list"
] | def _clear_list(self):
"""Abstract method for clearing item list"""
pass | [
"def",
"_clear_list",
"(",
"self",
")",
":",
"pass"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugin_base/item_list.py#L1046-L1048 | ||
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.84/Libs/x86smt/solver_cvc3.py | python | Solver.UConstFromExpr | (self, exp) | return tmp | return an unsigned long from a CONSTANT BITVECTOR expression | return an unsigned long from a CONSTANT BITVECTOR expression | [
"return",
"an",
"unsigned",
"long",
"from",
"a",
"CONSTANT",
"BITVECTOR",
"expression"
] | def UConstFromExpr(self, exp):
"""return an unsigned long from a CONSTANT BITVECTOR expression"""
if self.getKind(exp) != self._BVCONST:
return None
tmp = int(self.exprString(exp)[4:], 2)
return tmp | [
"def",
"UConstFromExpr",
"(",
"self",
",",
"exp",
")",
":",
"if",
"self",
".",
"getKind",
"(",
"exp",
")",
"!=",
"self",
".",
"_BVCONST",
":",
"return",
"None",
"tmp",
"=",
"int",
"(",
"self",
".",
"exprString",
"(",
"exp",
")",
"[",
"4",
":",
"]... | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.84/Libs/x86smt/solver_cvc3.py#L680-L685 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/requests/utils.py | python | unquote_header_value | (value, is_filename=False) | return value | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting. | [
"r",
"Unquotes",
"a",
"header",
"value",
".",
"(",
"Reversal",
"of",
":",
"func",
":",
"quote_header_value",
")",
".",
"This",
"does",
"not",
"use",
"the",
"real",
"unquoting",
"but",
"what",
"browsers",
"are",
"actually",
"using",
"for",
"quoting",
"."
] | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str
"""
if value and value[0]... | [
"def",
"unquote_header_value",
"(",
"value",
",",
"is_filename",
"=",
"False",
")",
":",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
":",
"# this is not the real unquoting, but fixing this so that the",
"# RFC i... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/requests/utils.py#L377-L399 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/lib2to3/pytree.py | python | BasePattern.generate_matches | (self, nodes) | Generator yielding all matches for this pattern.
Default implementation for non-wildcard patterns. | Generator yielding all matches for this pattern. | [
"Generator",
"yielding",
"all",
"matches",
"for",
"this",
"pattern",
"."
] | def generate_matches(self, nodes):
"""
Generator yielding all matches for this pattern.
Default implementation for non-wildcard patterns.
"""
r = {}
if nodes and self.match(nodes[0], r):
yield 1, r | [
"def",
"generate_matches",
"(",
"self",
",",
"nodes",
")",
":",
"r",
"=",
"{",
"}",
"if",
"nodes",
"and",
"self",
".",
"match",
"(",
"nodes",
"[",
"0",
"]",
",",
"r",
")",
":",
"yield",
"1",
",",
"r"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/lib2to3/pytree.py#L523-L531 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/cluster/_kmeans.py | python | _kmeans_single_elkan | (
X,
sample_weight,
centers_init,
max_iter=300,
verbose=False,
x_squared_norms=None,
tol=1e-4,
n_threads=1,
) | return labels, inertia, centers, i + 1 | A single run of k-means elkan, assumes preparation completed prior.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
The observations to cluster. If sparse matrix, must be in CSR format.
sample_weight : array-like of shape (n_samples,)
The weights for... | A single run of k-means elkan, assumes preparation completed prior. | [
"A",
"single",
"run",
"of",
"k",
"-",
"means",
"elkan",
"assumes",
"preparation",
"completed",
"prior",
"."
] | def _kmeans_single_elkan(
X,
sample_weight,
centers_init,
max_iter=300,
verbose=False,
x_squared_norms=None,
tol=1e-4,
n_threads=1,
):
"""A single run of k-means elkan, assumes preparation completed prior.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_sa... | [
"def",
"_kmeans_single_elkan",
"(",
"X",
",",
"sample_weight",
",",
"centers_init",
",",
"max_iter",
"=",
"300",
",",
"verbose",
"=",
"False",
",",
"x_squared_norms",
"=",
"None",
",",
"tol",
"=",
"1e-4",
",",
"n_threads",
"=",
"1",
",",
")",
":",
"n_sam... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/cluster/_kmeans.py#L390-L548 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/multiprocessing/util.py | python | Finalize.cancel | (self) | Cancel finalization of the object | Cancel finalization of the object | [
"Cancel",
"finalization",
"of",
"the",
"object"
] | def cancel(self):
'''
Cancel finalization of the object
'''
try:
del _finalizer_registry[self._key]
except KeyError:
pass
else:
self._weakref = self._callback = self._args = \
self._kwargs = self._key = None | [
"def",
"cancel",
"(",
"self",
")",
":",
"try",
":",
"del",
"_finalizer_registry",
"[",
"self",
".",
"_key",
"]",
"except",
"KeyError",
":",
"pass",
"else",
":",
"self",
".",
"_weakref",
"=",
"self",
".",
"_callback",
"=",
"self",
".",
"_args",
"=",
"... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/multiprocessing/util.py#L212-L222 | ||
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | scripts/update_managed_policies.py | python | json_serial | (obj) | JSON serializer for objects not serializable by default json code | JSON serializer for objects not serializable by default json code | [
"JSON",
"serializer",
"for",
"objects",
"not",
"serializable",
"by",
"default",
"json",
"code"
] | def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime):
serial = obj.isoformat()
return serial
raise TypeError("Type not serializable") | [
"def",
"json_serial",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"datetime",
")",
":",
"serial",
"=",
"obj",
".",
"isoformat",
"(",
")",
"return",
"serial",
"raise",
"TypeError",
"(",
"\"Type not serializable\"",
")"
] | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/scripts/update_managed_policies.py#L17-L23 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/cv/nets/__init__.py | python | darknet53 | (input, num_classes=1000) | return model(input) | [] | def darknet53(input, num_classes=1000):
model = DarkNet(depth=53, num_classes=num_classes, bn_act='relu')
return model(input) | [
"def",
"darknet53",
"(",
"input",
",",
"num_classes",
"=",
"1000",
")",
":",
"model",
"=",
"DarkNet",
"(",
"depth",
"=",
"53",
",",
"num_classes",
"=",
"num_classes",
",",
"bn_act",
"=",
"'relu'",
")",
"return",
"model",
"(",
"input",
")"
] | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/nets/__init__.py#L79-L81 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/pyasn1/type/namedtype.py | python | NamedTypes.getTypeByPosition | (self, idx) | Return ASN.1 type object by its position in fields set.
Parameters
----------
idx: :py:class:`int`
Field index
Returns
-------
:
ASN.1 type
Raises
------
: :class:`~pyasn1.error.PyAsn1Error`
If given position ... | Return ASN.1 type object by its position in fields set. | [
"Return",
"ASN",
".",
"1",
"type",
"object",
"by",
"its",
"position",
"in",
"fields",
"set",
"."
] | def getTypeByPosition(self, idx):
"""Return ASN.1 type object by its position in fields set.
Parameters
----------
idx: :py:class:`int`
Field index
Returns
-------
:
ASN.1 type
Raises
------
: :class:`~pyasn1.erro... | [
"def",
"getTypeByPosition",
"(",
"self",
",",
"idx",
")",
":",
"try",
":",
"return",
"self",
".",
"__namedTypes",
"[",
"idx",
"]",
".",
"asn1Object",
"except",
"IndexError",
":",
"raise",
"error",
".",
"PyAsn1Error",
"(",
"'Type position out of range'",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pyasn1/type/namedtype.py#L281-L303 | ||
JoinMarket-Org/joinmarket-clientserver | 8b3d21f226185e31aa10e8e16cdfc719cea4a98e | jmclient/jmclient/wallet.py | python | FidelityBondMixin.add_burner_output | (self, path, txhex, block_height, merkle_branch,
block_index, write=True) | merkle_branch = None means it was unavailable because of pruning | merkle_branch = None means it was unavailable because of pruning | [
"merkle_branch",
"=",
"None",
"means",
"it",
"was",
"unavailable",
"because",
"of",
"pruning"
] | def add_burner_output(self, path, txhex, block_height, merkle_branch,
block_index, write=True):
"""
merkle_branch = None means it was unavailable because of pruning
"""
if self._BURNER_OUTPUT_STORAGE_KEY not in self._storage.data:
self._storage.data[self._BURNER_O... | [
"def",
"add_burner_output",
"(",
"self",
",",
"path",
",",
"txhex",
",",
"block_height",
",",
"merkle_branch",
",",
"block_index",
",",
"write",
"=",
"True",
")",
":",
"if",
"self",
".",
"_BURNER_OUTPUT_STORAGE_KEY",
"not",
"in",
"self",
".",
"_storage",
"."... | https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/8b3d21f226185e31aa10e8e16cdfc719cea4a98e/jmclient/jmclient/wallet.py#L2509-L2523 | ||
theislab/anndata | 664e32b0aa6625fe593370d37174384c05abfd4e | anndata/_core/anndata.py | python | AnnData.varm_keys | (self) | return list(self._varm.keys()) | List keys of variable annotation :attr:`varm`. | List keys of variable annotation :attr:`varm`. | [
"List",
"keys",
"of",
"variable",
"annotation",
":",
"attr",
":",
"varm",
"."
] | def varm_keys(self) -> List[str]:
"""List keys of variable annotation :attr:`varm`."""
return list(self._varm.keys()) | [
"def",
"varm_keys",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_varm",
".",
"keys",
"(",
")",
")"
] | https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/anndata.py#L1013-L1015 | |
blasty/moneyshot | 0541356cca38e57ec03a30b6dff1d38c0c7dfd00 | outputter.py | python | python | (buf, array_name = 'shellcode', row_width = 16, fancy = False) | return out | [] | def python(buf, array_name = 'shellcode', row_width = 16, fancy = False):
lines = []
out = ""
for i in range(0, len(buf), row_width):
j = 0
linebuf = ''
while (j < row_width and (i+j) < len(buf)):
linebuf += "\\x%02x" % ( ord(buf[i+j]) )
j = j + 1
lines.append(linebuf);
for i in range(0, len(lines)... | [
"def",
"python",
"(",
"buf",
",",
"array_name",
"=",
"'shellcode'",
",",
"row_width",
"=",
"16",
",",
"fancy",
"=",
"False",
")",
":",
"lines",
"=",
"[",
"]",
"out",
"=",
"\"\"",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"buf",
")",
... | https://github.com/blasty/moneyshot/blob/0541356cca38e57ec03a30b6dff1d38c0c7dfd00/outputter.py#L256-L293 | |||
akanimax/T2F | e0fc1876b9ecac22be294fefd85234ddf365549c | implementation/networks/InferSent/encoder/models.py | python | ClassificationNet.encode | (self, s1) | return emb | [] | def encode(self, s1):
emb = self.encoder(s1)
return emb | [
"def",
"encode",
"(",
"self",
",",
"s1",
")",
":",
"emb",
"=",
"self",
".",
"encoder",
"(",
"s1",
")",
"return",
"emb"
] | https://github.com/akanimax/T2F/blob/e0fc1876b9ecac22be294fefd85234ddf365549c/implementation/networks/InferSent/encoder/models.py#L890-L892 | |||
econ-ark/HARK | 9562cafef854d9c3d6b4aba2540e3e442ba6ec6c | HARK/ConsumptionSaving/ConsAggShockModel.py | python | KrusellSmithEconomy.reset | (self) | Reset the economy to prepare for a new simulation. Sets the time index
of aggregate shocks to zero and runs Market.reset(). | Reset the economy to prepare for a new simulation. Sets the time index
of aggregate shocks to zero and runs Market.reset(). | [
"Reset",
"the",
"economy",
"to",
"prepare",
"for",
"a",
"new",
"simulation",
".",
"Sets",
"the",
"time",
"index",
"of",
"aggregate",
"shocks",
"to",
"zero",
"and",
"runs",
"Market",
".",
"reset",
"()",
"."
] | def reset(self):
"""
Reset the economy to prepare for a new simulation. Sets the time index
of aggregate shocks to zero and runs Market.reset().
"""
self.Shk_idx = 0
Market.reset(self) | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"Shk_idx",
"=",
"0",
"Market",
".",
"reset",
"(",
"self",
")"
] | https://github.com/econ-ark/HARK/blob/9562cafef854d9c3d6b4aba2540e3e442ba6ec6c/HARK/ConsumptionSaving/ConsAggShockModel.py#L2886-L2892 | ||
LabPy/lantz | 3e878e3f765a4295b0089d04e241d4beb7b8a65b | lantz/drivers/ni/daqmx/base.py | python | Task.configure_trigger_analog_edge_start | (self, source, slope='rising', level=1.0) | Configures the task to start acquiring or generating samples
when an analog signal crosses the level you specify.
:param source:
The name of a channel or terminal where there is an analog
signal to use as the source of the trigger. For E Series
devices, if you use a chann... | Configures the task to start acquiring or generating samples
when an analog signal crosses the level you specify. | [
"Configures",
"the",
"task",
"to",
"start",
"acquiring",
"or",
"generating",
"samples",
"when",
"an",
"analog",
"signal",
"crosses",
"the",
"level",
"you",
"specify",
"."
] | def configure_trigger_analog_edge_start(self, source, slope='rising', level=1.0):
"""
Configures the task to start acquiring or generating samples
when an analog signal crosses the level you specify.
:param source:
The name of a channel or terminal where there is an analog
... | [
"def",
"configure_trigger_analog_edge_start",
"(",
"self",
",",
"source",
",",
"slope",
"=",
"'rising'",
",",
"level",
"=",
"1.0",
")",
":",
"self",
".",
"lib",
".",
"CfgAnlgEdgeStartTrig",
"(",
"source",
",",
"slope",
",",
"level",
")"
] | https://github.com/LabPy/lantz/blob/3e878e3f765a4295b0089d04e241d4beb7b8a65b/lantz/drivers/ni/daqmx/base.py#L873-L903 | ||
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/toolbar.py | python | ToolbarTreeWidget.__init__ | (self, parent) | [] | def __init__(self, parent):
standard.TreeView.__init__(self, parent)
self.setDragEnabled(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly)
self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.setDropIndicatorShown(True)
self.setRootIsDec... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"standard",
".",
"TreeView",
".",
"__init__",
"(",
"self",
",",
"parent",
")",
"self",
".",
"setDragEnabled",
"(",
"True",
")",
"self",
".",
"setDragDropMode",
"(",
"QtWidgets",
".",
"QAbstractItemVi... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/toolbar.py#L517-L529 | ||||
mfarragher/appelpy | 6ba8b123abb8b4e9d5968841b8ce9eb5088d763b | appelpy/linear_model.py | python | WLS.results | (self) | return self._results | statsmodels.regression.linear_model.RegressionResultsWrapper object
The object contains many details on the fit of the regression model.
There are dozens of attributes that store such information.
For a neater summary of the model, use these class attributes:
- results_output: the objec... | statsmodels.regression.linear_model.RegressionResultsWrapper object
The object contains many details on the fit of the regression model.
There are dozens of attributes that store such information. | [
"statsmodels",
".",
"regression",
".",
"linear_model",
".",
"RegressionResultsWrapper",
"object",
"The",
"object",
"contains",
"many",
"details",
"on",
"the",
"fit",
"of",
"the",
"regression",
"model",
".",
"There",
"are",
"dozens",
"of",
"attributes",
"that",
"... | def results(self):
"""statsmodels.regression.linear_model.RegressionResultsWrapper object
The object contains many details on the fit of the regression model.
There are dozens of attributes that store such information.
For a neater summary of the model, use these class attributes:
... | [
"def",
"results",
"(",
"self",
")",
":",
"return",
"self",
".",
"_results"
] | https://github.com/mfarragher/appelpy/blob/6ba8b123abb8b4e9d5968841b8ce9eb5088d763b/appelpy/linear_model.py#L203-L214 | |
x0rz/EQGRP_Lost_in_Translation | 6692b1486f562f027567a49523b8c151a4050988 | windows/fuzzbunch/coli.py | python | CommandlineWrapper.__call__ | (self, argv) | Effectively "main" from Commandlinewrapper | Effectively "main" from Commandlinewrapper | [
"Effectively",
"main",
"from",
"Commandlinewrapper"
] | def __call__(self, argv):
"""Effectively "main" from Commandlinewrapper"""
logConfig = None
context = {}
rendezvous = None
try:
(opts, args) = self.__coli_parser.parse_args(argv)
if opts.InConfig is None:
raise ExploitConfigError("You must ... | [
"def",
"__call__",
"(",
"self",
",",
"argv",
")",
":",
"logConfig",
"=",
"None",
"context",
"=",
"{",
"}",
"rendezvous",
"=",
"None",
"try",
":",
"(",
"opts",
",",
"args",
")",
"=",
"self",
".",
"__coli_parser",
".",
"parse_args",
"(",
"argv",
")",
... | https://github.com/x0rz/EQGRP_Lost_in_Translation/blob/6692b1486f562f027567a49523b8c151a4050988/windows/fuzzbunch/coli.py#L57-L117 | ||
gradientinstitute/aboleth | 53a3de23dce4d607ffec92be936e83d2dd7ebb3c | aboleth/layers.py | python | EmbedVariational.__init__ | (self, output_dim, n_categories, prior_std=1.,
learn_prior=False, full=False) | Create and instance of a variational dense embedding layer. | Create and instance of a variational dense embedding layer. | [
"Create",
"and",
"instance",
"of",
"a",
"variational",
"dense",
"embedding",
"layer",
"."
] | def __init__(self, output_dim, n_categories, prior_std=1.,
learn_prior=False, full=False):
"""Create and instance of a variational dense embedding layer."""
assert n_categories >= 2, "Need 2 or more categories for embedding!"
self.output_dim = output_dim
self.n_categorie... | [
"def",
"__init__",
"(",
"self",
",",
"output_dim",
",",
"n_categories",
",",
"prior_std",
"=",
"1.",
",",
"learn_prior",
"=",
"False",
",",
"full",
"=",
"False",
")",
":",
"assert",
"n_categories",
">=",
"2",
",",
"\"Need 2 or more categories for embedding!\"",
... | https://github.com/gradientinstitute/aboleth/blob/53a3de23dce4d607ffec92be936e83d2dd7ebb3c/aboleth/layers.py#L681-L689 | ||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/stores/nosql/mongo/store/properties.py | python | MongoRegexesStore.add_regex | (self, name, regex) | return self.add_property(name, regex) | [] | def add_regex(self, name, regex):
return self.add_property(name, regex) | [
"def",
"add_regex",
"(",
"self",
",",
"name",
",",
"regex",
")",
":",
"return",
"self",
".",
"add_property",
"(",
"name",
",",
"regex",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/nosql/mongo/store/properties.py#L163-L164 | |||
klen/aioauth-client | 7672e66053cfd6973261f40741916d2fd52ff97e | aioauth_client/__init__.py | python | OAuth2Client.request | (self, method: str, url: str, params: t.Dict = None, headers: t.Dict = None,
access_token: str = None, **options) | return self._request(method, url, headers=headers, params=params, **options) | Request OAuth2 resource. | Request OAuth2 resource. | [
"Request",
"OAuth2",
"resource",
"."
] | def request(self, method: str, url: str, params: t.Dict = None, headers: t.Dict = None,
access_token: str = None, **options) -> t.Awaitable[t.Union[t.Dict, str]]:
"""Request OAuth2 resource."""
url = self._get_url(url)
headers = headers or {
'Accept': 'application/jso... | [
"def",
"request",
"(",
"self",
",",
"method",
":",
"str",
",",
"url",
":",
"str",
",",
"params",
":",
"t",
".",
"Dict",
"=",
"None",
",",
"headers",
":",
"t",
".",
"Dict",
"=",
"None",
",",
"access_token",
":",
"str",
"=",
"None",
",",
"*",
"*"... | https://github.com/klen/aioauth-client/blob/7672e66053cfd6973261f40741916d2fd52ff97e/aioauth_client/__init__.py#L309-L321 | |
wutianyiRosun/CGNet | cfccea377a6f0a659e807e8759c82dbffba02d7f | model/ESPNet.py | python | CBR.forward | (self, input) | return output | :param input: input feature map
:return: transformed feature map | :param input: input feature map
:return: transformed feature map | [
":",
"param",
"input",
":",
"input",
"feature",
"map",
":",
"return",
":",
"transformed",
"feature",
"map"
] | def forward(self, input):
'''
:param input: input feature map
:return: transformed feature map
'''
output = self.conv(input)
output = self.bn(output)
output = self.act(output)
return output | [
"def",
"forward",
"(",
"self",
",",
"input",
")",
":",
"output",
"=",
"self",
".",
"conv",
"(",
"input",
")",
"output",
"=",
"self",
".",
"bn",
"(",
"output",
")",
"output",
"=",
"self",
".",
"act",
"(",
"output",
")",
"return",
"output"
] | https://github.com/wutianyiRosun/CGNet/blob/cfccea377a6f0a659e807e8759c82dbffba02d7f/model/ESPNet.py#L26-L34 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3db/hrm.py | python | hrm_competency_controller | () | return current.rest_controller("hrm", "competency",
# @ToDo: Create these if-required
#csv_stylesheet = ("hrm", "competency.xsl"),
#csv_template = ("hrm", "competency"),
) | RESTful CRUD controller
- used for Searching for people by Skill
- used for Adding/Editing on Profile page | RESTful CRUD controller
- used for Searching for people by Skill
- used for Adding/Editing on Profile page | [
"RESTful",
"CRUD",
"controller",
"-",
"used",
"for",
"Searching",
"for",
"people",
"by",
"Skill",
"-",
"used",
"for",
"Adding",
"/",
"Editing",
"on",
"Profile",
"page"
] | def hrm_competency_controller():
"""
RESTful CRUD controller
- used for Searching for people by Skill
- used for Adding/Editing on Profile page
"""
T = current.T
s3db = current.s3db
s3 = current.response.s3
def prep(r):
if r.method in ("create", "create.popup"... | [
"def",
"hrm_competency_controller",
"(",
")",
":",
"T",
"=",
"current",
".",
"T",
"s3db",
"=",
"current",
".",
"s3db",
"s3",
"=",
"current",
".",
"response",
".",
"s3",
"def",
"prep",
"(",
"r",
")",
":",
"if",
"r",
".",
"method",
"in",
"(",
"\"crea... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/hrm.py#L7693-L7790 | |
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbALiYun.ecs_aliyuncs_com_DescribeSecurityGroups_2013_01_10 | (
self,
region_id,
page_number='1',
page_size='10'
) | return self._top_request(
"ecs.aliyuncs.com.DescribeSecurityGroups.2013-01-10",
{
"RegionId": region_id,
"PageNumber": page_number,
"PageSize": page_size
}
) | 查询安全组列表
!!!该接口已在官方文档下线,请谨慎使用!!!
分页查询用户定义的所有安全组基本信息。每页的数量默认为10条,数据按照安全组ID降序排列。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=22433
:param region_id: 数据中心id
:param page_number: 当前页码,起始值为1,默认值为1
:param page_size: 分页查询时设置的每页行数,最大值50,默认值为10 | 查询安全组列表
!!!该接口已在官方文档下线,请谨慎使用!!! | [
"查询安全组列表",
"!!!该接口已在官方文档下线,请谨慎使用!!!"
] | def ecs_aliyuncs_com_DescribeSecurityGroups_2013_01_10(
self,
region_id,
page_number='1',
page_size='10'
):
"""
查询安全组列表
!!!该接口已在官方文档下线,请谨慎使用!!!
分页查询用户定义的所有安全组基本信息。每页的数量默认为10条,数据按照安全组ID降序排列。
文档地址:https://open-doc.dingtalk.com/do... | [
"def",
"ecs_aliyuncs_com_DescribeSecurityGroups_2013_01_10",
"(",
"self",
",",
"region_id",
",",
"page_number",
"=",
"'1'",
",",
"page_size",
"=",
"'10'",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"ecs.aliyuncs.com.DescribeSecurityGroups.2013-01-10\"",
",",
... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L36921-L36945 | |
eliben/pyelftools | 8f7a0becaface09435c4374947548b7851e3d1a2 | elftools/dwarf/lineprogram.py | python | LineProgram.__getitem__ | (self, name) | return self.header[name] | Implement dict-like access to header entries | Implement dict-like access to header entries | [
"Implement",
"dict",
"-",
"like",
"access",
"to",
"header",
"entries"
] | def __getitem__(self, name):
""" Implement dict-like access to header entries
"""
return self.header[name] | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"header",
"[",
"name",
"]"
] | https://github.com/eliben/pyelftools/blob/8f7a0becaface09435c4374947548b7851e3d1a2/elftools/dwarf/lineprogram.py#L121-L124 | |
oddt/oddt | 8cf555820d97a692ade81c101ebe10e28bcb3722 | oddt/pandas.py | python | ChemDataFrame.to_sdf | (self,
filepath_or_buffer=None,
update_properties=True,
molecule_column=None,
columns=None) | return _mol_writer(self,
filepath_or_buffer=filepath_or_buffer,
update_properties=update_properties,
fmt='sdf',
molecule_column=molecule_column,
columns=columns) | Write DataFrame to SDF file.
.. versionadded:: 0.3
Parameters
----------
filepath_or_buffer : string or None
File path
update_properties : bool, optional (default=True)
Switch to update properties from the DataFrames to the molecules
while w... | Write DataFrame to SDF file. | [
"Write",
"DataFrame",
"to",
"SDF",
"file",
"."
] | def to_sdf(self,
filepath_or_buffer=None,
update_properties=True,
molecule_column=None,
columns=None):
"""Write DataFrame to SDF file.
.. versionadded:: 0.3
Parameters
----------
filepath_or_buffer : string or None
... | [
"def",
"to_sdf",
"(",
"self",
",",
"filepath_or_buffer",
"=",
"None",
",",
"update_properties",
"=",
"True",
",",
"molecule_column",
"=",
"None",
",",
"columns",
"=",
"None",
")",
":",
"molecule_column",
"=",
"molecule_column",
"or",
"self",
".",
"_molecule_co... | https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/pandas.py#L379-L410 | |
minio/minio-py | b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3 | minio/notificationconfig.py | python | TopicConfig.fromxml | (cls, element) | return cls(
topic,
events,
config_id,
prefix_filter_rule,
suffix_filter_rule
) | Create new object with values from XML element. | Create new object with values from XML element. | [
"Create",
"new",
"object",
"with",
"values",
"from",
"XML",
"element",
"."
] | def fromxml(cls, element):
"""Create new object with values from XML element."""
topic = findtext(element, "Topic", True)
(events, config_id, prefix_filter_rule,
suffix_filter_rule) = cls.parsexml(element)
return cls(
topic,
events,
config_id,... | [
"def",
"fromxml",
"(",
"cls",
",",
"element",
")",
":",
"topic",
"=",
"findtext",
"(",
"element",
",",
"\"Topic\"",
",",
"True",
")",
"(",
"events",
",",
"config_id",
",",
"prefix_filter_rule",
",",
"suffix_filter_rule",
")",
"=",
"cls",
".",
"parsexml",
... | https://github.com/minio/minio-py/blob/b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3/minio/notificationconfig.py#L243-L254 | |
the4thdoctor/pg_chameleon | 9d80212541559c8d0a42b3e7c1b2c67bb7606411 | pg_chameleon/lib/sql_util.py | python | sql_token.parse_sql | (self, sql_string) | The method cleans and parses the sql string
A regular expression replaces all the default value definitions with a space.
Then the statements are split in a list using the statement separator;
For each statement a set of regular expressions remove the comments, single and multi line... | The method cleans and parses the sql string
A regular expression replaces all the default value definitions with a space.
Then the statements are split in a list using the statement separator; | [
"The",
"method",
"cleans",
"and",
"parses",
"the",
"sql",
"string",
"A",
"regular",
"expression",
"replaces",
"all",
"the",
"default",
"value",
"definitions",
"with",
"a",
"space",
".",
"Then",
"the",
"statements",
"are",
"split",
"in",
"a",
"list",
"using",... | def parse_sql(self, sql_string):
"""
The method cleans and parses the sql string
A regular expression replaces all the default value definitions with a space.
Then the statements are split in a list using the statement separator;
For each statement a set of regul... | [
"def",
"parse_sql",
"(",
"self",
",",
"sql_string",
")",
":",
"statements",
"=",
"sql_string",
".",
"split",
"(",
"';'",
")",
"for",
"statement",
"in",
"statements",
":",
"stat_dic",
"=",
"{",
"}",
"stat_cleanup",
"=",
"re",
".",
"sub",
"(",
"r'/\\*.*?\\... | https://github.com/the4thdoctor/pg_chameleon/blob/9d80212541559c8d0a42b3e7c1b2c67bb7606411/pg_chameleon/lib/sql_util.py#L423-L514 | ||
sagemath/sagenb | 67a73cbade02639bc08265f28f3165442113ad4d | sagenb/notebook/worksheet.py | python | after_first_word | (s) | return s[i.start() + 1:] | r"""
Return everything after the first whitespace in the string s.
Returns the empty string if there is nothing after the first
whitespace.
INPUT:
- ``s`` - string
OUTPUT: a string
EXAMPLES::
sage: from sagenb.notebook.worksheet import after_first_word
sage: after_first... | r"""
Return everything after the first whitespace in the string s.
Returns the empty string if there is nothing after the first
whitespace. | [
"r",
"Return",
"everything",
"after",
"the",
"first",
"whitespace",
"in",
"the",
"string",
"s",
".",
"Returns",
"the",
"empty",
"string",
"if",
"there",
"is",
"nothing",
"after",
"the",
"first",
"whitespace",
"."
] | def after_first_word(s):
r"""
Return everything after the first whitespace in the string s.
Returns the empty string if there is nothing after the first
whitespace.
INPUT:
- ``s`` - string
OUTPUT: a string
EXAMPLES::
sage: from sagenb.notebook.worksheet import after_first_w... | [
"def",
"after_first_word",
"(",
"s",
")",
":",
"i",
"=",
"whitespace",
".",
"search",
"(",
"s",
")",
"if",
"i",
"is",
"None",
":",
"return",
"''",
"return",
"s",
"[",
"i",
".",
"start",
"(",
")",
"+",
"1",
":",
"]"
] | https://github.com/sagemath/sagenb/blob/67a73cbade02639bc08265f28f3165442113ad4d/sagenb/notebook/worksheet.py#L4392-L4415 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/translator/transform.py | python | transform_extend_with_char_count | (self, block_subset) | Transforms lst += char*count to extend_with_char_count | Transforms lst += char*count to extend_with_char_count | [
"Transforms",
"lst",
"+",
"=",
"char",
"*",
"count",
"to",
"extend_with_char_count"
] | def transform_extend_with_char_count(self, block_subset):
"""Transforms lst += char*count to extend_with_char_count"""
for block in block_subset:
mul_sources = {} # maps b to (char, count) in the above notation
for i in range(len(block.operations)):
op = block.operations[i]
... | [
"def",
"transform_extend_with_char_count",
"(",
"self",
",",
"block_subset",
")",
":",
"for",
"block",
"in",
"block_subset",
":",
"mul_sources",
"=",
"{",
"}",
"# maps b to (char, count) in the above notation",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"block",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/translator/transform.py#L84-L106 | ||
rotki/rotki | aafa446815cdd5e9477436d1b02bee7d01b398c8 | rotkehlchen/externalapis/cryptocompare.py | python | Cryptocompare.set_database | (self, database: 'DBHandler') | If the cryptocompare instance was initialized without a DB this sets its DB | If the cryptocompare instance was initialized without a DB this sets its DB | [
"If",
"the",
"cryptocompare",
"instance",
"was",
"initialized",
"without",
"a",
"DB",
"this",
"sets",
"its",
"DB"
] | def set_database(self, database: 'DBHandler') -> None:
"""If the cryptocompare instance was initialized without a DB this sets its DB"""
msg = 'set_database was called on a cryptocompare instance that already has a DB'
assert self.db is None, msg
self.db = database | [
"def",
"set_database",
"(",
"self",
",",
"database",
":",
"'DBHandler'",
")",
"->",
"None",
":",
"msg",
"=",
"'set_database was called on a cryptocompare instance that already has a DB'",
"assert",
"self",
".",
"db",
"is",
"None",
",",
"msg",
"self",
".",
"db",
"=... | https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/externalapis/cryptocompare.py#L251-L255 | ||
mvantellingen/localshop | 19422b82915e66b62f8c0207a74a6a36613796c6 | src/localshop/utils.py | python | no_duplicates | (function, *args, **kwargs) | return wrapper | Makes sure that no duplicated tasks are enqueued. | Makes sure that no duplicated tasks are enqueued. | [
"Makes",
"sure",
"that",
"no",
"duplicated",
"tasks",
"are",
"enqueued",
"."
] | def no_duplicates(function, *args, **kwargs):
"""
Makes sure that no duplicated tasks are enqueued.
"""
@wraps(function)
def wrapper(self, *args, **kwargs):
key = generate_key(function, *args, **kwargs)
try:
function(self, *args, **kwargs)
finally:
log... | [
"def",
"no_duplicates",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"@",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"generate_key",
"(",
... | https://github.com/mvantellingen/localshop/blob/19422b82915e66b62f8c0207a74a6a36613796c6/src/localshop/utils.py#L25-L38 | |
lunixbochs/ActualVim | 1f555ce719e49d6584f0e35e9f0db2f216b98fa5 | lib/asyncio/transports.py | python | WriteTransport.get_write_buffer_size | (self) | Return the current size of the write buffer. | Return the current size of the write buffer. | [
"Return",
"the",
"current",
"size",
"of",
"the",
"write",
"buffer",
"."
] | def get_write_buffer_size(self):
"""Return the current size of the write buffer."""
raise NotImplementedError | [
"def",
"get_write_buffer_size",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/lunixbochs/ActualVim/blob/1f555ce719e49d6584f0e35e9f0db2f216b98fa5/lib/asyncio/transports.py#L89-L91 | ||
brmson/dataset-factoid-webquestions | 668890853388010fe6ae9a5eb035a7917b88933b | scripts/rawimport.py | python | questions_pproc | (questions, ch) | return qs_main, qs_fb | Post-process raw json data, outputting main and freebase-specific data sets. | Post-process raw json data, outputting main and freebase-specific data sets. | [
"Post",
"-",
"process",
"raw",
"json",
"data",
"outputting",
"main",
"and",
"freebase",
"-",
"specific",
"data",
"sets",
"."
] | def questions_pproc(questions, ch):
""" Post-process raw json data, outputting main and freebase-specific data sets. """
qs_main = []
qs_fb = []
for i, q in enumerate(questions):
q_main = {'qId': 'wq%c%06d' % (ch, i),
'qText': q['utterance'],
'answers': list(t... | [
"def",
"questions_pproc",
"(",
"questions",
",",
"ch",
")",
":",
"qs_main",
"=",
"[",
"]",
"qs_fb",
"=",
"[",
"]",
"for",
"i",
",",
"q",
"in",
"enumerate",
"(",
"questions",
")",
":",
"q_main",
"=",
"{",
"'qId'",
":",
"'wq%c%06d'",
"%",
"(",
"ch",
... | https://github.com/brmson/dataset-factoid-webquestions/blob/668890853388010fe6ae9a5eb035a7917b88933b/scripts/rawimport.py#L29-L41 | |
quantmind/pulsar | fee44e871954aa6ca36d00bb5a3739abfdb89b26 | pulsar/apps/wsgi/content.py | python | Html.hasClass | (self, cn) | return classes and cn in classes | ``True`` if ``cn`` is a class of self. | ``True`` if ``cn`` is a class of self. | [
"True",
"if",
"cn",
"is",
"a",
"class",
"of",
"self",
"."
] | def hasClass(self, cn):
'''``True`` if ``cn`` is a class of self.'''
classes = self._classes
return classes and cn in classes | [
"def",
"hasClass",
"(",
"self",
",",
"cn",
")",
":",
"classes",
"=",
"self",
".",
"_classes",
"return",
"classes",
"and",
"cn",
"in",
"classes"
] | https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/wsgi/content.py#L381-L384 | |
mikedh/trimesh | 6b1e05616b44e6dd708d9bc748b211656ebb27ec | trimesh/points.py | python | PointCloud.copy | (self) | return copied | Safely get a copy of the current point cloud.
Copied objects will have emptied caches to avoid memory
issues and so may be slow on initial operations until
caches are regenerated.
Current object will *not* have its cache cleared.
Returns
---------
copied : trim... | Safely get a copy of the current point cloud. | [
"Safely",
"get",
"a",
"copy",
"of",
"the",
"current",
"point",
"cloud",
"."
] | def copy(self):
"""
Safely get a copy of the current point cloud.
Copied objects will have emptied caches to avoid memory
issues and so may be slow on initial operations until
caches are regenerated.
Current object will *not* have its cache cleared.
Returns
... | [
"def",
"copy",
"(",
"self",
")",
":",
"copied",
"=",
"PointCloud",
"(",
"vertices",
"=",
"None",
")",
"# copy vertex and face data",
"copied",
".",
"_data",
".",
"data",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"_data",
".",
"data",
")",
"# get me... | https://github.com/mikedh/trimesh/blob/6b1e05616b44e6dd708d9bc748b211656ebb27ec/trimesh/points.py#L443-L468 | |
bmc/munkres | 23d11c83057c7d93fa7f4ebfa191f9b746374792 | munkres.py | python | Munkres.__find_star_in_col | (self, col: Sequence[AnyNum]) | return row | Find the first starred element in the specified row. Returns
the row index, or -1 if no starred element was found. | Find the first starred element in the specified row. Returns
the row index, or -1 if no starred element was found. | [
"Find",
"the",
"first",
"starred",
"element",
"in",
"the",
"specified",
"row",
".",
"Returns",
"the",
"row",
"index",
"or",
"-",
"1",
"if",
"no",
"starred",
"element",
"was",
"found",
"."
] | def __find_star_in_col(self, col: Sequence[AnyNum]) -> int:
"""
Find the first starred element in the specified row. Returns
the row index, or -1 if no starred element was found.
"""
row = -1
for i in range(self.n):
if self.marked[i][col] == 1:
... | [
"def",
"__find_star_in_col",
"(",
"self",
",",
"col",
":",
"Sequence",
"[",
"AnyNum",
"]",
")",
"->",
"int",
":",
"row",
"=",
"-",
"1",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"if",
"self",
".",
"marked",
"[",
"i",
"]",
"[",... | https://github.com/bmc/munkres/blob/23d11c83057c7d93fa7f4ebfa191f9b746374792/munkres.py#L392-L403 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py | python | Misc.winfo_width | (self) | return getint(
self.tk.call('winfo', 'width', self._w)) | Return the width of this widget. | Return the width of this widget. | [
"Return",
"the",
"width",
"of",
"this",
"widget",
"."
] | def winfo_width(self):
"""Return the width of this widget."""
return getint(
self.tk.call('winfo', 'width', self._w)) | [
"def",
"winfo_width",
"(",
"self",
")",
":",
"return",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'width'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py#L895-L898 | |
TesterlifeRaymond/BeautifulReport | e13ea7bc3109e8f88279f1033e309b6f909d800d | BeautifulReport.py | python | BeautifulReport.output_report | (self) | 生成测试报告到指定路径下
:return: | 生成测试报告到指定路径下
:return: | [
"生成测试报告到指定路径下",
":",
"return",
":"
] | def output_report(self):
"""
生成测试报告到指定路径下
:return:
"""
template_path = self.config_tmp_path
override_path = os.path.abspath(self.log_path) if \
os.path.abspath(self.log_path).endswith('/') else \
os.path.abspath(self.log_path) + '/'
... | [
"def",
"output_report",
"(",
"self",
")",
":",
"template_path",
"=",
"self",
".",
"config_tmp_path",
"override_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"log_path",
")",
"if",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
... | https://github.com/TesterlifeRaymond/BeautifulReport/blob/e13ea7bc3109e8f88279f1033e309b6f909d800d/BeautifulReport.py#L368-L388 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v2beta2_metric_spec.py | python | V2beta2MetricSpec.resource | (self, resource) | Sets the resource of this V2beta2MetricSpec.
:param resource: The resource of this V2beta2MetricSpec. # noqa: E501
:type: V2beta2ResourceMetricSource | Sets the resource of this V2beta2MetricSpec. | [
"Sets",
"the",
"resource",
"of",
"this",
"V2beta2MetricSpec",
"."
] | def resource(self, resource):
"""Sets the resource of this V2beta2MetricSpec.
:param resource: The resource of this V2beta2MetricSpec. # noqa: E501
:type: V2beta2ResourceMetricSource
"""
self._resource = resource | [
"def",
"resource",
"(",
"self",
",",
"resource",
")",
":",
"self",
".",
"_resource",
"=",
"resource"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v2beta2_metric_spec.py#L148-L156 | ||
holoviz/holoviews | cc6b27f01710402fdfee2aeef1507425ca78c91f | holoviews/core/util.py | python | sort_topologically | (graph) | return list(itertools.takewhile(lambda x: x is not None,
(names_by_level.get(i, None)
for i in itertools.count()))) | Stackless topological sorting.
graph = {
3: [1],
5: [3],
4: [2],
6: [4],
}
sort_topologically(graph)
[[1, 2], [3, 4], [5, 6]] | Stackless topological sorting. | [
"Stackless",
"topological",
"sorting",
"."
] | def sort_topologically(graph):
"""
Stackless topological sorting.
graph = {
3: [1],
5: [3],
4: [2],
6: [4],
}
sort_topologically(graph)
[[1, 2], [3, 4], [5, 6]]
"""
levels_by_name = {}
names_by_level = defaultdict(list)
def add_level_to_name(nam... | [
"def",
"sort_topologically",
"(",
"graph",
")",
":",
"levels_by_name",
"=",
"{",
"}",
"names_by_level",
"=",
"defaultdict",
"(",
"list",
")",
"def",
"add_level_to_name",
"(",
"name",
",",
"level",
")",
":",
"levels_by_name",
"[",
"name",
"]",
"=",
"level",
... | https://github.com/holoviz/holoviews/blob/cc6b27f01710402fdfee2aeef1507425ca78c91f/holoviews/core/util.py#L1271-L1321 | |
Pylons/substanced | a897f4a0518c51b6e093cc5af39fa326f23752c2 | substanced/dump/__init__.py | python | _DumpAndLoad.load | (
self,
directory,
parent=None,
subresources=True,
verbose=False,
dry_run=False,
registry=None
) | return first | Load a dump of a resource and return the resource. | Load a dump of a resource and return the resource. | [
"Load",
"a",
"dump",
"of",
"a",
"resource",
"and",
"return",
"the",
"resource",
"."
] | def load(
self,
directory,
parent=None,
subresources=True,
verbose=False,
dry_run=False,
registry=None
):
""" Load a dump of a resource and return the resource."""
if registry is None:
registry = get_current_registry()
... | [
"def",
"load",
"(",
"self",
",",
"directory",
",",
"parent",
"=",
"None",
",",
"subresources",
"=",
"True",
",",
"verbose",
"=",
"False",
",",
"dry_run",
"=",
"False",
",",
"registry",
"=",
"None",
")",
":",
"if",
"registry",
"is",
"None",
":",
"regi... | https://github.com/Pylons/substanced/blob/a897f4a0518c51b6e093cc5af39fa326f23752c2/substanced/dump/__init__.py#L191-L250 | |
paulwinex/pw_MultiScriptEditor | e447e99f87cb07e238baf693b7e124e50efdbc51 | multi_script_editor/jedi/evaluate/helpers.py | python | search_call_signatures | (user_stmt, position) | return call, index | Returns the function Call that matches the position before. | Returns the function Call that matches the position before. | [
"Returns",
"the",
"function",
"Call",
"that",
"matches",
"the",
"position",
"before",
"."
] | def search_call_signatures(user_stmt, position):
"""
Returns the function Call that matches the position before.
"""
debug.speed('func_call start')
call, index = None, 0
if user_stmt is not None and isinstance(user_stmt, pr.Statement):
# some parts will of the statement will be removed
... | [
"def",
"search_call_signatures",
"(",
"user_stmt",
",",
"position",
")",
":",
"debug",
".",
"speed",
"(",
"'func_call start'",
")",
"call",
",",
"index",
"=",
"None",
",",
"0",
"if",
"user_stmt",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"user_stmt",
... | https://github.com/paulwinex/pw_MultiScriptEditor/blob/e447e99f87cb07e238baf693b7e124e50efdbc51/multi_script_editor/jedi/evaluate/helpers.py#L114-L128 | |
dpgaspar/Flask-AppBuilder | 557249f33b66d02a48c1322ef21324b815abe18e | flask_appbuilder/cli.py | python | fab | () | FAB flask group commands | FAB flask group commands | [
"FAB",
"flask",
"group",
"commands"
] | def fab():
""" FAB flask group commands"""
pass | [
"def",
"fab",
"(",
")",
":",
"pass"
] | https://github.com/dpgaspar/Flask-AppBuilder/blob/557249f33b66d02a48c1322ef21324b815abe18e/flask_appbuilder/cli.py#L32-L34 | ||
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | Common/libpsutil/py2.6-glibc-2.12-pre/psutil/__init__.py | python | _assert_pid_not_reused | (fun) | return wrapper | Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused. | Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused. | [
"Decorator",
"which",
"raises",
"NoSuchProcess",
"in",
"case",
"a",
"process",
"is",
"no",
"longer",
"running",
"or",
"its",
"PID",
"has",
"been",
"reused",
"."
] | def _assert_pid_not_reused(fun):
"""Decorator which raises NoSuchProcess in case a process is no
longer running or its PID has been reused.
"""
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
if not self.is_running():
raise NoSuchProcess(self.pid, self._name)
re... | [
"def",
"_assert_pid_not_reused",
"(",
"fun",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fun",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"rais... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Common/libpsutil/py2.6-glibc-2.12-pre/psutil/__init__.py#L265-L274 | |
ambakick/Person-Detection-and-Tracking | f925394ac29b5cf321f1ce89a71b193381519a0b | core/prefetcher.py | python | prefetch | (tensor_dict, capacity) | return prefetch_queue | Creates a prefetch queue for tensors.
Creates a FIFO queue to asynchronously enqueue tensor_dicts and returns a
dequeue op that evaluates to a tensor_dict. This function is useful in
prefetching preprocessed tensors so that the data is readily available for
consumers.
Example input pipeline when you don't n... | Creates a prefetch queue for tensors. | [
"Creates",
"a",
"prefetch",
"queue",
"for",
"tensors",
"."
] | def prefetch(tensor_dict, capacity):
"""Creates a prefetch queue for tensors.
Creates a FIFO queue to asynchronously enqueue tensor_dicts and returns a
dequeue op that evaluates to a tensor_dict. This function is useful in
prefetching preprocessed tensors so that the data is readily available for
consumers.
... | [
"def",
"prefetch",
"(",
"tensor_dict",
",",
"capacity",
")",
":",
"names",
"=",
"list",
"(",
"tensor_dict",
".",
"keys",
"(",
")",
")",
"dtypes",
"=",
"[",
"t",
".",
"dtype",
"for",
"t",
"in",
"tensor_dict",
".",
"values",
"(",
")",
"]",
"shapes",
... | https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/core/prefetcher.py#L20-L61 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/datastore/datastore_query.py | python | PropertyFilter._to_pb | (self) | return self._filter | Returns the internal only pb representation. | Returns the internal only pb representation. | [
"Returns",
"the",
"internal",
"only",
"pb",
"representation",
"."
] | def _to_pb(self):
"""Returns the internal only pb representation."""
return self._filter | [
"def",
"_to_pb",
"(",
"self",
")",
":",
"return",
"self",
".",
"_filter"
] | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/datastore/datastore_query.py#L365-L367 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/treewalkers/dom.py | python | TreeWalker.getParentNode | (self, node) | return node.parentNode | [] | def getParentNode(self, node):
return node.parentNode | [
"def",
"getParentNode",
"(",
"self",
",",
"node",
")",
":",
"return",
"node",
".",
"parentNode"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/treewalkers/dom.py#L42-L43 | |||
Mindwerks/worldengine | 64dff8eb7824ce46b5b6cb8006bcef21822ef144 | worldengine/model/world.py | python | World.has_biome | (self) | return 'biome' in self.layers | [] | def has_biome(self):
return 'biome' in self.layers | [
"def",
"has_biome",
"(",
"self",
")",
":",
"return",
"'biome'",
"in",
"self",
".",
"layers"
] | https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/model/world.py#L912-L913 | |||
vipul-sharma20/sharingan | 25504394fccbade08a3903adfebeccab61410340 | sharingan/main.py | python | Image._crop_poly | (self, name, *args, **kwargs) | Crop by the coordinates of mouse clicks
:returns: None | Crop by the coordinates of mouse clicks | [
"Crop",
"by",
"the",
"coordinates",
"of",
"mouse",
"clicks"
] | def _crop_poly(self, name, *args, **kwargs):
"""
Crop by the coordinates of mouse clicks
:returns: None
"""
mask = np.zeros(self.gray.shape, dtype=np.uint8)
roi_corners = np.array([self.path], dtype=np.int32)
channel_count = 2
ignore_mask_color = (255,) *... | [
"def",
"_crop_poly",
"(",
"self",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mask",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"gray",
".",
"shape",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"roi_corners",
"=",
"np",
"... | https://github.com/vipul-sharma20/sharingan/blob/25504394fccbade08a3903adfebeccab61410340/sharingan/main.py#L184-L198 | ||
heldersepu/GMapCatcher | 0fcd85742d54449d679acf52cc019e93fdc402fe | gmapcatcher/pyGPSD/nmea/serial/serialposix.py | python | PosixSerial.flush | (self) | Flush of file like objects. In this case, wait until all data
is written. | Flush of file like objects. In this case, wait until all data
is written. | [
"Flush",
"of",
"file",
"like",
"objects",
".",
"In",
"this",
"case",
"wait",
"until",
"all",
"data",
"is",
"written",
"."
] | def flush(self):
"""Flush of file like objects. In this case, wait until all data
is written."""
self.drainOutput() | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"drainOutput",
"(",
")"
] | https://github.com/heldersepu/GMapCatcher/blob/0fcd85742d54449d679acf52cc019e93fdc402fe/gmapcatcher/pyGPSD/nmea/serial/serialposix.py#L487-L490 | ||
dannguyen/watson-word-watcher | c487291b0efee6da3a5de470c7bffae5728ffb3b | foo/wrangle.py | python | extract_line_level_data | (data) | return lines | data (dict): as derived from standard Watson API JSON
returns: a list of dictionary, each sub-list representing a line:
{
"start": 1.42,
"end": 3.8,
"confidence": 0.999,
"words": [
{
"text": "Hello",
"start": 1.42,
"end": 2... | data (dict): as derived from standard Watson API JSON | [
"data",
"(",
"dict",
")",
":",
"as",
"derived",
"from",
"standard",
"Watson",
"API",
"JSON"
] | def extract_line_level_data(data):
"""
data (dict): as derived from standard Watson API JSON
returns: a list of dictionary, each sub-list representing a line:
{
"start": 1.42,
"end": 3.8,
"confidence": 0.999,
"words": [
{
"text": "Hello",
... | [
"def",
"extract_line_level_data",
"(",
"data",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"result",
"in",
"data",
"[",
"'results'",
"]",
":",
"if",
"result",
".",
"get",
"(",
"'alternatives'",
")",
":",
"# just pick best alternative",
"alt",
"=",
"result",
"... | https://github.com/dannguyen/watson-word-watcher/blob/c487291b0efee6da3a5de470c7bffae5728ffb3b/foo/wrangle.py#L158-L202 | |
ant4g0nist/lisa.py | fb74a309a314d041d4902944a8d449650afc76db | lisa.py | python | Mach.__init__ | (self, debugger) | [] | def __init__(self, debugger):
self.magic = Mach.Magic()
self.content = None
self.path = None
self.debugger = debugger | [
"def",
"__init__",
"(",
"self",
",",
"debugger",
")",
":",
"self",
".",
"magic",
"=",
"Mach",
".",
"Magic",
"(",
")",
"self",
".",
"content",
"=",
"None",
"self",
".",
"path",
"=",
"None",
"self",
".",
"debugger",
"=",
"debugger"
] | https://github.com/ant4g0nist/lisa.py/blob/fb74a309a314d041d4902944a8d449650afc76db/lisa.py#L1065-L1069 | ||||
jim-easterbrook/pywws | 31519ade415545e9cd711237b98aad33d070c1f9 | src/pywws/sqlite3data.py | python | CoreStore.__delitem__ | (self, i) | Delete the data item or items with index i.
i must be a datetime object or a slice. If i is a single datetime
then a value with that index must exist. | Delete the data item or items with index i.
i must be a datetime object or a slice. If i is a single datetime
then a value with that index must exist. | [
"Delete",
"the",
"data",
"item",
"or",
"items",
"with",
"index",
"i",
".",
"i",
"must",
"be",
"a",
"datetime",
"object",
"or",
"a",
"slice",
".",
"If",
"i",
"is",
"a",
"single",
"datetime",
"then",
"a",
"value",
"with",
"that",
"index",
"must",
"exis... | def __delitem__(self, i):
"""Delete the data item or items with index i.
i must be a datetime object or a slice. If i is a single datetime
then a value with that index must exist.
"""
predicate, multi, params = self._predicate(i)
with self._connection as con:
... | [
"def",
"__delitem__",
"(",
"self",
",",
"i",
")",
":",
"predicate",
",",
"multi",
",",
"params",
"=",
"self",
".",
"_predicate",
"(",
"i",
")",
"with",
"self",
".",
"_connection",
"as",
"con",
":",
"if",
"con",
".",
"execute",
"(",
"\"DELETE FROM {} {}... | https://github.com/jim-easterbrook/pywws/blob/31519ade415545e9cd711237b98aad33d070c1f9/src/pywws/sqlite3data.py#L410-L422 | ||
d2l-ai/d2l-en | 39a7d4174534740b2387b0dc5eb22f409b82ee10 | d2l/mxnet.py | python | RNNLMScratch.forward | (self, X, state=None) | return self.output_layer(rnn_outputs) | Defined in :numref:`sec_rnn-scratch` | Defined in :numref:`sec_rnn-scratch` | [
"Defined",
"in",
":",
"numref",
":",
"sec_rnn",
"-",
"scratch"
] | def forward(self, X, state=None):
"""Defined in :numref:`sec_rnn-scratch`"""
embs = self.one_hot(X)
rnn_outputs, _ = self.rnn(embs, state)
return self.output_layer(rnn_outputs) | [
"def",
"forward",
"(",
"self",
",",
"X",
",",
"state",
"=",
"None",
")",
":",
"embs",
"=",
"self",
".",
"one_hot",
"(",
"X",
")",
"rnn_outputs",
",",
"_",
"=",
"self",
".",
"rnn",
"(",
"embs",
",",
"state",
")",
"return",
"self",
".",
"output_lay... | https://github.com/d2l-ai/d2l-en/blob/39a7d4174534740b2387b0dc5eb22f409b82ee10/d2l/mxnet.py#L736-L740 | |
vmware-archive/liota | 9dde472542edd6d1ee01f66e7d78161dfa993f8f | liota/entities/edge_systems/general_edge_system.py | python | GeneralEdgeSystem.__init__ | (self, name) | Init method for GeneralEdgeSystem
:param name: GeneralEdgeSystem name | Init method for GeneralEdgeSystem
:param name: GeneralEdgeSystem name | [
"Init",
"method",
"for",
"GeneralEdgeSystem",
":",
"param",
"name",
":",
"GeneralEdgeSystem",
"name"
] | def __init__(self, name):
"""
Init method for GeneralEdgeSystem
:param name: GeneralEdgeSystem name
"""
super(GeneralEdgeSystem, self).__init__(
name=name,
entity_id=systemUUID().get_uuid(name)
) | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"super",
"(",
"GeneralEdgeSystem",
",",
"self",
")",
".",
"__init__",
"(",
"name",
"=",
"name",
",",
"entity_id",
"=",
"systemUUID",
"(",
")",
".",
"get_uuid",
"(",
"name",
")",
")"
] | https://github.com/vmware-archive/liota/blob/9dde472542edd6d1ee01f66e7d78161dfa993f8f/liota/entities/edge_systems/general_edge_system.py#L41-L49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.