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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_storage_os_persistent_volume_source.py | python | V1StorageOSPersistentVolumeSource.secret_ref | (self) | return self._secret_ref | Gets the secret_ref of this V1StorageOSPersistentVolumeSource.
SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.
:return: The secret_ref of this V1StorageOSPersistentVolumeSource.
:rtype: V1ObjectReference | Gets the secret_ref of this V1StorageOSPersistentVolumeSource.
SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted. | [
"Gets",
"the",
"secret_ref",
"of",
"this",
"V1StorageOSPersistentVolumeSource",
".",
"SecretRef",
"specifies",
"the",
"secret",
"to",
"use",
"for",
"obtaining",
"the",
"StorageOS",
"API",
"credentials",
".",
"If",
"not",
"specified",
"default",
"values",
"will",
"... | def secret_ref(self):
"""
Gets the secret_ref of this V1StorageOSPersistentVolumeSource.
SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.
:return: The secret_ref of this V1StorageOSPersistentVolumeSou... | [
"def",
"secret_ref",
"(",
"self",
")",
":",
"return",
"self",
".",
"_secret_ref"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_storage_os_persistent_volume_source.py#L102-L110 | |
PennyLaneAI/pennylane | 1275736f790ced1d778858ed383448d4a43a4cdd | pennylane/math/multi_dispatch.py | python | where | (condition, x=None, y=None) | return np.where(condition, x, y, like=_multi_dispatch([condition, x, y])) | Returns elements chosen from x or y depending on a boolean tensor condition,
or the indices of entries satisfying the condition.
The input tensors ``condition``, ``x``, and ``y`` must all be broadcastable to the same shape.
Args:
condition (tensor_like[bool]): A boolean tensor. Where ``True`` , el... | Returns elements chosen from x or y depending on a boolean tensor condition,
or the indices of entries satisfying the condition. | [
"Returns",
"elements",
"chosen",
"from",
"x",
"or",
"y",
"depending",
"on",
"a",
"boolean",
"tensor",
"condition",
"or",
"the",
"indices",
"of",
"entries",
"satisfying",
"the",
"condition",
"."
] | def where(condition, x=None, y=None):
"""Returns elements chosen from x or y depending on a boolean tensor condition,
or the indices of entries satisfying the condition.
The input tensors ``condition``, ``x``, and ``y`` must all be broadcastable to the same shape.
Args:
condition (tensor_like[... | [
"def",
"where",
"(",
"condition",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
")",
":",
"if",
"x",
"is",
"None",
"and",
"y",
"is",
"None",
":",
"interface",
"=",
"_multi_dispatch",
"(",
"[",
"condition",
"]",
")",
"return",
"np",
".",
"where",
... | https://github.com/PennyLaneAI/pennylane/blob/1275736f790ced1d778858ed383448d4a43a4cdd/pennylane/math/multi_dispatch.py#L447-L514 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailusers/wagtail_hooks.py | python | register_permissions | () | return Permission.objects.filter(user_permissions | group_permissions) | [] | def register_permissions():
user_permissions = Q(content_type__app_label=AUTH_USER_APP_LABEL, codename__in=[
'add_%s' % AUTH_USER_MODEL_NAME.lower(),
'change_%s' % AUTH_USER_MODEL_NAME.lower(),
'delete_%s' % AUTH_USER_MODEL_NAME.lower(),
])
group_permissions = Q(content_type__app_lab... | [
"def",
"register_permissions",
"(",
")",
":",
"user_permissions",
"=",
"Q",
"(",
"content_type__app_label",
"=",
"AUTH_USER_APP_LABEL",
",",
"codename__in",
"=",
"[",
"'add_%s'",
"%",
"AUTH_USER_MODEL_NAME",
".",
"lower",
"(",
")",
",",
"'change_%s'",
"%",
"AUTH_U... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailusers/wagtail_hooks.py#L74-L82 | |||
econchick/mayhem | a3cbc49c43cb957bf309d283d87afc9085bc26dd | part-3/mayhem_5.py | python | consume | (queue) | Consumer client to simulate subscribing to a publisher.
Args:
queue (asyncio.Queue): Queue from which to consume messages. | Consumer client to simulate subscribing to a publisher. | [
"Consumer",
"client",
"to",
"simulate",
"subscribing",
"to",
"a",
"publisher",
"."
] | async def consume(queue):
"""Consumer client to simulate subscribing to a publisher.
Args:
queue (asyncio.Queue): Queue from which to consume messages.
"""
while True:
msg = await queue.get()
# commenting out to not interfer with the faked exceptions in
# `restart_host` ... | [
"async",
"def",
"consume",
"(",
"queue",
")",
":",
"while",
"True",
":",
"msg",
"=",
"await",
"queue",
".",
"get",
"(",
")",
"# commenting out to not interfer with the faked exceptions in",
"# `restart_host` and `save`",
"# if random.randrange(1, 20) == 3:",
"# raise Ex... | https://github.com/econchick/mayhem/blob/a3cbc49c43cb957bf309d283d87afc9085bc26dd/part-3/mayhem_5.py#L162-L175 | ||
GeekLiB/caffe-model | f21e52032c92f36eb6622846f6e6710bcd3f2054 | seg/score_seg.py | python | compute_hist | (val_list) | return hist | [] | def compute_hist(val_list):
hist = np.zeros((n_class, n_class))
for idx in val_list:
print idx
label = cv2.imread(gt_root + idx + '.png', 0)
gt = label.flatten()
tmp = cv2.imread(pre_root + idx + '.png', 0)
if label.shape != tmp.shape:
pre = cv2.resize(tmp, (... | [
"def",
"compute_hist",
"(",
"val_list",
")",
":",
"hist",
"=",
"np",
".",
"zeros",
"(",
"(",
"n_class",
",",
"n_class",
")",
")",
"for",
"idx",
"in",
"val_list",
":",
"print",
"idx",
"label",
"=",
"cv2",
".",
"imread",
"(",
"gt_root",
"+",
"idx",
"... | https://github.com/GeekLiB/caffe-model/blob/f21e52032c92f36eb6622846f6e6710bcd3f2054/seg/score_seg.py#L15-L32 | |||
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/gslib/commands/versioning.py | python | VersioningCommand._SetVersioning | (self) | Gets versioning configuration for a bucket. | Gets versioning configuration for a bucket. | [
"Gets",
"versioning",
"configuration",
"for",
"a",
"bucket",
"."
] | def _SetVersioning(self):
"""Gets versioning configuration for a bucket."""
versioning_arg = self.args[0].lower()
if versioning_arg not in ('on', 'off'):
raise CommandException('Argument to "%s set" must be either [on|off]'
% (self.command_name))
url_args = self.args[1... | [
"def",
"_SetVersioning",
"(",
"self",
")",
":",
"versioning_arg",
"=",
"self",
".",
"args",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",
"versioning_arg",
"not",
"in",
"(",
"'on'",
",",
"'off'",
")",
":",
"raise",
"CommandException",
"(",
"'Argument to \... | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/gslib/commands/versioning.py#L110-L139 | ||
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | googlecodejam/2017/Fashion Show/fashion_show.py | python | merge_solutions | (rook_solution, bishop_solution) | return solution | [] | def merge_solutions(rook_solution, bishop_solution):
n = len(rook_solution)
solution = []
for ir in range(n):
row = []
for ic in range(n):
if rook_solution[ir][ic] == '.':
row.append(bishop_solution[ir][ic])
elif bishop_solution[ir][ic] == '+':
... | [
"def",
"merge_solutions",
"(",
"rook_solution",
",",
"bishop_solution",
")",
":",
"n",
"=",
"len",
"(",
"rook_solution",
")",
"solution",
"=",
"[",
"]",
"for",
"ir",
"in",
"range",
"(",
"n",
")",
":",
"row",
"=",
"[",
"]",
"for",
"ic",
"in",
"range",... | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/googlecodejam/2017/Fashion Show/fashion_show.py#L43-L56 | |||
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/langintel.py | python | LangIntel.cb_blob_detail_from_elem_and_buf | (self, elem, buf) | [] | def cb_blob_detail_from_elem_and_buf(self, elem, buf):
if elem.get("lang") != buf.lang: # multi-lang doc
return "%s Code in %s" % (elem.get("lang"), buf.path)
else:
dir, base = os.path.split(buf.path)
if dir:
return "%s (%s)" % (base, dir)
... | [
"def",
"cb_blob_detail_from_elem_and_buf",
"(",
"self",
",",
"elem",
",",
"buf",
")",
":",
"if",
"elem",
".",
"get",
"(",
"\"lang\"",
")",
"!=",
"buf",
".",
"lang",
":",
"# multi-lang doc",
"return",
"\"%s Code in %s\"",
"%",
"(",
"elem",
".",
"get",
"(",
... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/langintel.py#L106-L114 | ||||
IntelAI/nauta | bbedb114a755cf1f43b834a58fc15fb6e3a4b291 | applications/cli/commands/experiment/common.py | python | validate_env_paramater | (ctx, param, value) | [] | def validate_env_paramater(ctx, param, value):
try:
if value:
for param in value:
key, t_value = param.split("=")
if not key or not t_value:
raise ValueError
return value
except Exception as exe:
raise click.BadParameter(Tex... | [
"def",
"validate_env_paramater",
"(",
"ctx",
",",
"param",
",",
"value",
")",
":",
"try",
":",
"if",
"value",
":",
"for",
"param",
"in",
"value",
":",
"key",
",",
"t_value",
"=",
"param",
".",
"split",
"(",
"\"=\"",
")",
"if",
"not",
"key",
"or",
"... | https://github.com/IntelAI/nauta/blob/bbedb114a755cf1f43b834a58fc15fb6e3a4b291/applications/cli/commands/experiment/common.py#L765-L774 | ||||
songhengyang/face_landmark_factory | b33285ac5c0a01bee978103ed1f14c3b9061278e | data_generate/Landmark_utils.py | python | show_landmark | (face, landmark) | view face with landmark for visualization | view face with landmark for visualization | [
"view",
"face",
"with",
"landmark",
"for",
"visualization"
] | def show_landmark(face, landmark):
"""
view face with landmark for visualization
"""
face_copied = face.copy().astype(np.uint8)
for (x, y) in landmark:
xx = int(face.shape[0]*x)
yy = int(face.shape[1]*y)
cv2.circle(face_copied, (xx, yy), 2, (0,0,0), -1)
cv2.imshow("fa... | [
"def",
"show_landmark",
"(",
"face",
",",
"landmark",
")",
":",
"face_copied",
"=",
"face",
".",
"copy",
"(",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
"for",
"(",
"x",
",",
"y",
")",
"in",
"landmark",
":",
"xx",
"=",
"int",
"(",
"face",
... | https://github.com/songhengyang/face_landmark_factory/blob/b33285ac5c0a01bee978103ed1f14c3b9061278e/data_generate/Landmark_utils.py#L11-L21 | ||
akfamily/akshare | 590e50eece9ec067da3538c7059fd660b71f1339 | akshare/fx/currency_investing.py | python | _currency_name_url | () | return name_code_dict | 货币键值对
:return: 货币键值对
:rtype: dict | 货币键值对
:return: 货币键值对
:rtype: dict | [
"货币键值对",
":",
"return",
":",
"货币键值对",
":",
"rtype",
":",
"dict"
] | def _currency_name_url() -> dict:
"""
货币键值对
:return: 货币键值对
:rtype: dict
"""
url = "https://cn.investing.com/currencies/"
res = requests.post(url, headers=short_headers)
data_table = pd.read_html(res.text)[0].iloc[:, 1:] # 实时货币行情
data_table.columns = ["中文名称", "英文名称", "最新", "最高", "最低"... | [
"def",
"_currency_name_url",
"(",
")",
"->",
"dict",
":",
"url",
"=",
"\"https://cn.investing.com/currencies/\"",
"res",
"=",
"requests",
".",
"post",
"(",
"url",
",",
"headers",
"=",
"short_headers",
")",
"data_table",
"=",
"pd",
".",
"read_html",
"(",
"res",... | https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/fx/currency_investing.py#L19-L35 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_linux/systrace/catapult/third_party/pyserial/serial/rfc2217.py | python | PortManager._telnetNegotiateOption | (self, command, option) | Process incoming DO, DONT, WILL, WONT. | Process incoming DO, DONT, WILL, WONT. | [
"Process",
"incoming",
"DO",
"DONT",
"WILL",
"WONT",
"."
] | def _telnetNegotiateOption(self, command, option):
"""Process incoming DO, DONT, WILL, WONT."""
# check our registered telnet options and forward command to them
# they know themselves if they have to answer or not
known = False
for item in self._telnet_options:
# can... | [
"def",
"_telnetNegotiateOption",
"(",
"self",
",",
"command",
",",
"option",
")",
":",
"# check our registered telnet options and forward command to them",
"# they know themselves if they have to answer or not",
"known",
"=",
"False",
"for",
"item",
"in",
"self",
".",
"_telne... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/third_party/pyserial/serial/rfc2217.py#L1092-L1109 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/logging/config.py | python | BaseConfigurator.configure_custom | (self, config) | return result | Configure an object with a user-supplied factory. | Configure an object with a user-supplied factory. | [
"Configure",
"an",
"object",
"with",
"a",
"user",
"-",
"supplied",
"factory",
"."
] | def configure_custom(self, config):
"""Configure an object with a user-supplied factory."""
c = config.pop('()')
if not hasattr(c, '__call__') and hasattr(types, 'ClassType') and type(c) != types.ClassType:
c = self.resolve(c)
props = config.pop('.', None)
# Check for... | [
"def",
"configure_custom",
"(",
"self",
",",
"config",
")",
":",
"c",
"=",
"config",
".",
"pop",
"(",
"'()'",
")",
"if",
"not",
"hasattr",
"(",
"c",
",",
"'__call__'",
")",
"and",
"hasattr",
"(",
"types",
",",
"'ClassType'",
")",
"and",
"type",
"(",
... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/logging/config.py#L472-L484 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/carddav/datastore/query/filter.py | python | FilterChildBase._deserialize | (self, data) | Convert a JSON compatible serialization of this object into the actual object. | Convert a JSON compatible serialization of this object into the actual object. | [
"Convert",
"a",
"JSON",
"compatible",
"serialization",
"of",
"this",
"object",
"into",
"the",
"actual",
"object",
"."
] | def _deserialize(self, data):
"""
Convert a JSON compatible serialization of this object into the actual object.
"""
self.propfilter_test = data["propfilter_test"]
self.qualifier = FilterBase.deserialize(data["qualifier"]) if data["qualifier"] else None
self.filters = [Fi... | [
"def",
"_deserialize",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"propfilter_test",
"=",
"data",
"[",
"\"propfilter_test\"",
"]",
"self",
".",
"qualifier",
"=",
"FilterBase",
".",
"deserialize",
"(",
"data",
"[",
"\"qualifier\"",
"]",
")",
"if",
"da... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/carddav/datastore/query/filter.py#L200-L208 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/meteo_france/weather.py | python | MeteoFranceWeather.humidity | (self) | return self.coordinator.data.current_forecast["humidity"] | Return the humidity. | Return the humidity. | [
"Return",
"the",
"humidity",
"."
] | def humidity(self):
"""Return the humidity."""
return self.coordinator.data.current_forecast["humidity"] | [
"def",
"humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"current_forecast",
"[",
"\"humidity\"",
"]"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/meteo_france/weather.py#L125-L127 | |
inpanel/inpanel | be53d86a72e30dd5476780ed5ba334315a23004b | lib/pyDes.py | python | des.__create_sub_keys | (self) | Create the 16 subkeys K[1] to K[16] from the given key | Create the 16 subkeys K[1] to K[16] from the given key | [
"Create",
"the",
"16",
"subkeys",
"K",
"[",
"1",
"]",
"to",
"K",
"[",
"16",
"]",
"from",
"the",
"given",
"key"
] | def __create_sub_keys(self):
"""Create the 16 subkeys K[1] to K[16] from the given key"""
key = self.__permutate(
des.__pc1, self.__String_to_BitList(self.getKey()))
i = 0
# Split into Left and Right sections
self.L = key[:28]
self.R = key[28:]
while i... | [
"def",
"__create_sub_keys",
"(",
"self",
")",
":",
"key",
"=",
"self",
".",
"__permutate",
"(",
"des",
".",
"__pc1",
",",
"self",
".",
"__String_to_BitList",
"(",
"self",
".",
"getKey",
"(",
")",
")",
")",
"i",
"=",
"0",
"# Split into Left and Right sectio... | https://github.com/inpanel/inpanel/blob/be53d86a72e30dd5476780ed5ba334315a23004b/lib/pyDes.py#L468-L491 | ||
jesse-ai/jesse | 28759547138fbc76dff12741204833e39c93b083 | jesse/utils.py | python | qty_to_size | (qty: float, price: float) | return qty * price | converts quantity to position-size
example: requesting 2 shares at the price of %50 would return $100
:param qty: float
:param price: float
:return: float | converts quantity to position-size
example: requesting 2 shares at the price of %50 would return $100 | [
"converts",
"quantity",
"to",
"position",
"-",
"size",
"example",
":",
"requesting",
"2",
"shares",
"at",
"the",
"price",
"of",
"%50",
"would",
"return",
"$100"
] | def qty_to_size(qty: float, price: float) -> float:
"""
converts quantity to position-size
example: requesting 2 shares at the price of %50 would return $100
:param qty: float
:param price: float
:return: float
"""
if math.isnan(qty) or math.isnan(price):
raise TypeError()
... | [
"def",
"qty_to_size",
"(",
"qty",
":",
"float",
",",
"price",
":",
"float",
")",
"->",
"float",
":",
"if",
"math",
".",
"isnan",
"(",
"qty",
")",
"or",
"math",
".",
"isnan",
"(",
"price",
")",
":",
"raise",
"TypeError",
"(",
")",
"return",
"qty",
... | https://github.com/jesse-ai/jesse/blob/28759547138fbc76dff12741204833e39c93b083/jesse/utils.py#L129-L141 | |
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/storage/interface.py | python | BaseStore.AddAttributeContainer | (self, container) | Adds a new attribute container.
Args:
container (AttributeContainer): attribute container.
Raises:
OSError: if the store cannot be written to.
IOError: if the store cannot be written to. | Adds a new attribute container. | [
"Adds",
"a",
"new",
"attribute",
"container",
"."
] | def AddAttributeContainer(self, container):
"""Adds a new attribute container.
Args:
container (AttributeContainer): attribute container.
Raises:
OSError: if the store cannot be written to.
IOError: if the store cannot be written to.
"""
self._RaiseIfNotWritable()
self._Write... | [
"def",
"AddAttributeContainer",
"(",
"self",
",",
"container",
")",
":",
"self",
".",
"_RaiseIfNotWritable",
"(",
")",
"self",
".",
"_WriteNewAttributeContainer",
"(",
"container",
")"
] | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/storage/interface.py#L174-L185 | ||
happinesslz/TANet | 2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f | second.pytorch_with_TANet/second/kittiviewer/viewer.py | python | KittiViewer.on_plotButtonPressed | (self) | [] | def on_plotButtonPressed(self):
if self.kitti_infos is None:
self.error("you must load Kitti Infos first.")
return
image_idx = int(self.w_imgidx.text())
if self.plot_all(image_idx):
self.current_idx = self.image_idxes.index(image_idx) | [
"def",
"on_plotButtonPressed",
"(",
"self",
")",
":",
"if",
"self",
".",
"kitti_infos",
"is",
"None",
":",
"self",
".",
"error",
"(",
"\"you must load Kitti Infos first.\"",
")",
"return",
"image_idx",
"=",
"int",
"(",
"self",
".",
"w_imgidx",
".",
"text",
"... | https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/second.pytorch_with_TANet/second/kittiviewer/viewer.py#L1405-L1411 | ||||
microsoft/nni | 31f11f51249660930824e888af0d4e022823285c | nni/algorithms/compression/pytorch/pruning/transformer_pruner.py | python | TransformerHeadPruner.update_mask | (self) | Calculate and update masks for each masking group. If global_sort is set, the masks for all groups are
calculated altogether, and then the groups are updated individually. | Calculate and update masks for each masking group. If global_sort is set, the masks for all groups are
calculated altogether, and then the groups are updated individually. | [
"Calculate",
"and",
"update",
"masks",
"for",
"each",
"masking",
"group",
".",
"If",
"global_sort",
"is",
"set",
"the",
"masks",
"for",
"all",
"groups",
"are",
"calculated",
"altogether",
"and",
"then",
"the",
"groups",
"are",
"updated",
"individually",
"."
] | def update_mask(self):
"""
Calculate and update masks for each masking group. If global_sort is set, the masks for all groups are
calculated altogether, and then the groups are updated individually.
"""
masks_for_all_groups = None
if self.global_sort:
masks_fo... | [
"def",
"update_mask",
"(",
"self",
")",
":",
"masks_for_all_groups",
"=",
"None",
"if",
"self",
".",
"global_sort",
":",
"masks_for_all_groups",
"=",
"self",
".",
"_calc_mask_global",
"(",
")",
"assert",
"len",
"(",
"masks_for_all_groups",
")",
"==",
"len",
"(... | https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/algorithms/compression/pytorch/pruning/transformer_pruner.py#L266-L286 | ||
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/plotting/glass_brain_files/svg_to_json_converter.py | python | SVGToJSONConverter._get_bounds | (self, paths) | return xmin, xmax, ymin, ymax | [] | def _get_bounds(self, paths):
points = [pt for path in paths for item in path['items']
for pt in item['pts']]
x_coords = [pt[0] for pt in points]
y_coords = [pt[1] for pt in points]
xmin, xmax = min(x_coords), max(x_coords)
ymin, ymax = min(y_coords), max(y_coo... | [
"def",
"_get_bounds",
"(",
"self",
",",
"paths",
")",
":",
"points",
"=",
"[",
"pt",
"for",
"path",
"in",
"paths",
"for",
"item",
"in",
"path",
"[",
"'items'",
"]",
"for",
"pt",
"in",
"item",
"[",
"'pts'",
"]",
"]",
"x_coords",
"=",
"[",
"pt",
"[... | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/plotting/glass_brain_files/svg_to_json_converter.py#L71-L80 | |||
compiler-explorer/infra | 949b6bc12981c3953162aca5bae9047f6bb8f114 | bin/lib/cli/instances.py | python | instances | () | Instance management commands. | Instance management commands. | [
"Instance",
"management",
"commands",
"."
] | def instances():
"""Instance management commands.""" | [
"def",
"instances",
"(",
")",
":"
] | https://github.com/compiler-explorer/infra/blob/949b6bc12981c3953162aca5bae9047f6bb8f114/bin/lib/cli/instances.py#L23-L24 | ||
mlflow/mlflow | 364aca7daf0fcee3ec407ae0b1b16d9cb3085081 | mlflow/sklearn/__init__.py | python | _AutologgingMetricsManager.get_run_id_and_dataset_name_for_metric_api_call | (self, call_pos_args, call_kwargs) | return run_id, dataset_name | Given a metric api call (include the called metric function, and call arguments)
Register the call information (arguments dict) into the `metric_api_call_arg_dict_list_map`
and return a tuple of (run_id, eval_dataset_name) | Given a metric api call (include the called metric function, and call arguments)
Register the call information (arguments dict) into the `metric_api_call_arg_dict_list_map`
and return a tuple of (run_id, eval_dataset_name) | [
"Given",
"a",
"metric",
"api",
"call",
"(",
"include",
"the",
"called",
"metric",
"function",
"and",
"call",
"arguments",
")",
"Register",
"the",
"call",
"information",
"(",
"arguments",
"dict",
")",
"into",
"the",
"metric_api_call_arg_dict_list_map",
"and",
"re... | def get_run_id_and_dataset_name_for_metric_api_call(self, call_pos_args, call_kwargs):
"""
Given a metric api call (include the called metric function, and call arguments)
Register the call information (arguments dict) into the `metric_api_call_arg_dict_list_map`
and return a tuple of (r... | [
"def",
"get_run_id_and_dataset_name_for_metric_api_call",
"(",
"self",
",",
"call_pos_args",
",",
"call_kwargs",
")",
":",
"call_arg_list",
"=",
"list",
"(",
"call_pos_args",
")",
"+",
"list",
"(",
"call_kwargs",
".",
"values",
"(",
")",
")",
"dataset_id_list",
"=... | https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/sklearn/__init__.py#L800-L821 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/tdscf/rhf.py | python | TDA.gen_vind | (self, mf) | return gen_tda_hop(mf, singlet=self.singlet, wfnsym=self.wfnsym) | Compute Ax | Compute Ax | [
"Compute",
"Ax"
] | def gen_vind(self, mf):
'''Compute Ax'''
return gen_tda_hop(mf, singlet=self.singlet, wfnsym=self.wfnsym) | [
"def",
"gen_vind",
"(",
"self",
",",
"mf",
")",
":",
"return",
"gen_tda_hop",
"(",
"mf",
",",
"singlet",
"=",
"self",
".",
"singlet",
",",
"wfnsym",
"=",
"self",
".",
"wfnsym",
")"
] | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/tdscf/rhf.py#L771-L773 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/hardware/crs/optical.py | python | OptiCAL._read_eeprom | (self, start, stop) | return "".join([self._read_eeprom_single(i)
for i in range(start, stop + 1)]) | read contents of eeprom between start and stop inclusive
:Parameters:
start : int
address in the range 0<i<100
stop : int
address in the range 0<i<100
:Returns:
(string of bytes) - each character in the ran... | read contents of eeprom between start and stop inclusive | [
"read",
"contents",
"of",
"eeprom",
"between",
"start",
"and",
"stop",
"inclusive"
] | def _read_eeprom(self, start, stop):
""" read contents of eeprom between start and stop inclusive
:Parameters:
start : int
address in the range 0<i<100
stop : int
address in the range 0<i<100
:Returns:
... | [
"def",
"_read_eeprom",
"(",
"self",
",",
"start",
",",
"stop",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"[",
"self",
".",
"_read_eeprom_single",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"start",
",",
"stop",
"+",
"1",
")",
"]",
")"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/hardware/crs/optical.py#L268-L281 | |
Veil-Framework/Veil | c825577bbc97db04be5c47e004369038491f6b7a | lib/common/completer.py | python | PayloadCompleter.complete | (self, text, state) | return results[state] | Generic readline completion entry point. | Generic readline completion entry point. | [
"Generic",
"readline",
"completion",
"entry",
"point",
"."
] | def complete(self, text, state):
"""
Generic readline completion entry point.
"""
buffer = readline.get_line_buffer()
line = readline.get_line_buffer().split()
# show all commands
if not line:
return [c + ' ' for c in self.commands][state]
#... | [
"def",
"complete",
"(",
"self",
",",
"text",
",",
"state",
")",
":",
"buffer",
"=",
"readline",
".",
"get_line_buffer",
"(",
")",
"line",
"=",
"readline",
".",
"get_line_buffer",
"(",
")",
".",
"split",
"(",
")",
"# show all commands",
"if",
"not",
"line... | https://github.com/Veil-Framework/Veil/blob/c825577bbc97db04be5c47e004369038491f6b7a/lib/common/completer.py#L226-L254 | |
MDAnalysis/mdanalysis | 3488df3cdb0c29ed41c4fb94efe334b541e31b21 | package/MDAnalysis/coordinates/base.py | python | Timestep.__eq__ | (self, other) | return True | Compare with another Timestep
.. versionadded:: 0.11.0 | Compare with another Timestep | [
"Compare",
"with",
"another",
"Timestep"
] | def __eq__(self, other):
"""Compare with another Timestep
.. versionadded:: 0.11.0
"""
if not isinstance(other, Timestep):
return False
if not self.frame == other.frame:
return False
if not self.n_atoms == other.n_atoms:
return False... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Timestep",
")",
":",
"return",
"False",
"if",
"not",
"self",
".",
"frame",
"==",
"other",
".",
"frame",
":",
"return",
"False",
"if",
"not",
"self",
... | https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/coordinates/base.py#L410-L451 | |
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/ADT/MolKit/pdb2pqr/src/aa.py | python | GLY.__init__ | (self, atoms, ref) | Initialize the class
Parameters
atoms: A list of Atom objects to be stored in this class
(list) | Initialize the class | [
"Initialize",
"the",
"class"
] | def __init__(self, atoms, ref):
"""
Initialize the class
Parameters
atoms: A list of Atom objects to be stored in this class
(list)
"""
Amino.__init__(self, atoms, ref)
self.reference = ref | [
"def",
"__init__",
"(",
"self",
",",
"atoms",
",",
"ref",
")",
":",
"Amino",
".",
"__init__",
"(",
"self",
",",
"atoms",
",",
"ref",
")",
"self",
".",
"reference",
"=",
"ref"
] | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/ADT/MolKit/pdb2pqr/src/aa.py#L336-L345 | ||
jiaaro/pydub | 7b0d27a4eb7246324601ff1a120397eeddfa3ee5 | pydub/silence.py | python | split_on_silence | (audio_segment, min_silence_len=1000, silence_thresh=-16, keep_silence=100,
seek_step=1) | return [
audio_segment[ max(start,0) : min(end,len(audio_segment)) ]
for start,end in output_ranges
] | Returns list of audio segments from splitting audio_segment on silent sections
audio_segment - original pydub.AudioSegment() object
min_silence_len - (in ms) minimum length of a silence to be used for
a split. default: 1000ms
silence_thresh - (in dBFS) anything quieter than this will be
c... | Returns list of audio segments from splitting audio_segment on silent sections | [
"Returns",
"list",
"of",
"audio",
"segments",
"from",
"splitting",
"audio_segment",
"on",
"silent",
"sections"
] | def split_on_silence(audio_segment, min_silence_len=1000, silence_thresh=-16, keep_silence=100,
seek_step=1):
"""
Returns list of audio segments from splitting audio_segment on silent sections
audio_segment - original pydub.AudioSegment() object
min_silence_len - (in ms) minimum l... | [
"def",
"split_on_silence",
"(",
"audio_segment",
",",
"min_silence_len",
"=",
"1000",
",",
"silence_thresh",
"=",
"-",
"16",
",",
"keep_silence",
"=",
"100",
",",
"seek_step",
"=",
"1",
")",
":",
"# from the itertools documentation",
"def",
"pairwise",
"(",
"ite... | https://github.com/jiaaro/pydub/blob/7b0d27a4eb7246324601ff1a120397eeddfa3ee5/pydub/silence.py#L112-L163 | |
pyqteval/evlal_win | ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92 | pyinstaller-2.0/PyInstaller/lib/pefile.py | python | PE.get_word_at_rva | (self, rva) | Return the word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | Return the word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | [
"Return",
"the",
"word",
"value",
"at",
"the",
"given",
"RVA",
".",
"Returns",
"None",
"if",
"the",
"value",
"can",
"t",
"be",
"read",
"i",
".",
"e",
".",
"the",
"RVA",
"can",
"t",
"be",
"mapped",
"to",
"a",
"file",
"offset",
"."
] | def get_word_at_rva(self, rva):
"""Return the word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset.
"""
try:
return self.get_word_from_data(self.get_data(rva)[:2], 0)
except PEFor... | [
"def",
"get_word_at_rva",
"(",
"self",
",",
"rva",
")",
":",
"try",
":",
"return",
"self",
".",
"get_word_from_data",
"(",
"self",
".",
"get_data",
"(",
"rva",
")",
"[",
":",
"2",
"]",
",",
"0",
")",
"except",
"PEFormatError",
":",
"return",
"None"
] | https://github.com/pyqteval/evlal_win/blob/ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92/pyinstaller-2.0/PyInstaller/lib/pefile.py#L4273-L4283 | ||
scikit-build/scikit-build | 078a74e08f5b6e9a39cd8bec3a8d238a684ec450 | skbuild/setuptools_wrap.py | python | strip_package | (package_parts, module_file) | return (module_file[len(package) + 1:]
if package != "" and module_dir.startswith(package)
else module_file) | Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a
``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting
from the left, this function will strip the parts of the path
matching the package parts and return a new string
(e.g ``jaz/rock/roll.py``).
The function will work as expected for e... | Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a
``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting
from the left, this function will strip the parts of the path
matching the package parts and return a new string
(e.g ``jaz/rock/roll.py``). | [
"Given",
"package_parts",
"(",
"e",
".",
"g",
".",
"[",
"foo",
"bar",
"]",
")",
"and",
"a",
"module_file",
"(",
"e",
".",
"g",
".",
"foo",
"/",
"bar",
"/",
"jaz",
"/",
"rock",
"/",
"roll",
".",
"py",
")",
"starting",
"from",
"the",
"left",
"thi... | def strip_package(package_parts, module_file):
"""Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a
``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting
from the left, this function will strip the parts of the path
matching the package parts and return a new string
(e.g ``jaz/rock/rol... | [
"def",
"strip_package",
"(",
"package_parts",
",",
"module_file",
")",
":",
"if",
"not",
"package_parts",
"or",
"os",
".",
"path",
".",
"isabs",
"(",
"module_file",
")",
":",
"return",
"module_file",
"package",
"=",
"\"/\"",
".",
"join",
"(",
"package_parts"... | https://github.com/scikit-build/scikit-build/blob/078a74e08f5b6e9a39cd8bec3a8d238a684ec450/skbuild/setuptools_wrap.py#L263-L283 | |
holoviz/holoviews | cc6b27f01710402fdfee2aeef1507425ca78c91f | holoviews/plotting/bokeh/element.py | python | ElementPlot._init_glyph | (self, plot, mapping, properties) | return renderer, renderer.glyph | Returns a Bokeh glyph object. | Returns a Bokeh glyph object. | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
plot_method = self._plot_methods.get('batched' if self.batched else 'single')
if isinstance(plot_method, tuple):
# Handle alternative ... | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
")",
":",
"properties",
"=",
"mpl_to_bokeh",
"(",
"properties",
")",
"plot_method",
"=",
"self",
".",
"_plot_methods",
".",
"get",
"(",
"'batched'",
"if",
"self",
".",
"batc... | https://github.com/holoviz/holoviews/blob/cc6b27f01710402fdfee2aeef1507425ca78c91f/holoviews/plotting/bokeh/element.py#L1034-L1046 | |
libp2p/py-libp2p | d2c2a5f933244ecf005d7422d5a93972ce681f64 | libp2p/protocol_muxer/multiselect_client.py | python | MultiselectClient.handshake | (self, communicator: IMultiselectCommunicator) | Ensure that the client and multiselect are both using the same
multiselect protocol.
:param stream: stream to communicate with multiselect over
:raise MultiselectClientError: raised when handshake failed | Ensure that the client and multiselect are both using the same
multiselect protocol. | [
"Ensure",
"that",
"the",
"client",
"and",
"multiselect",
"are",
"both",
"using",
"the",
"same",
"multiselect",
"protocol",
"."
] | async def handshake(self, communicator: IMultiselectCommunicator) -> None:
"""
Ensure that the client and multiselect are both using the same
multiselect protocol.
:param stream: stream to communicate with multiselect over
:raise MultiselectClientError: raised when handshake fai... | [
"async",
"def",
"handshake",
"(",
"self",
",",
"communicator",
":",
"IMultiselectCommunicator",
")",
"->",
"None",
":",
"try",
":",
"await",
"communicator",
".",
"write",
"(",
"MULTISELECT_PROTOCOL_ID",
")",
"except",
"MultiselectCommunicatorError",
"as",
"error",
... | https://github.com/libp2p/py-libp2p/blob/d2c2a5f933244ecf005d7422d5a93972ce681f64/libp2p/protocol_muxer/multiselect_client.py#L17-L36 | ||
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/utils/error.py | python | _get_name | (exc: BaseException) | return name | Get a suitable exception name as a string. | Get a suitable exception name as a string. | [
"Get",
"a",
"suitable",
"exception",
"name",
"as",
"a",
"string",
"."
] | def _get_name(exc: BaseException) -> str:
"""Get a suitable exception name as a string."""
prefixes = ['qutebrowser', 'builtins']
name = utils.qualname(exc.__class__)
for prefix in prefixes:
if name.startswith(prefix):
name = name[len(prefix) + 1:]
break
return name | [
"def",
"_get_name",
"(",
"exc",
":",
"BaseException",
")",
"->",
"str",
":",
"prefixes",
"=",
"[",
"'qutebrowser'",
",",
"'builtins'",
"]",
"name",
"=",
"utils",
".",
"qualname",
"(",
"exc",
".",
"__class__",
")",
"for",
"prefix",
"in",
"prefixes",
":",
... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/utils/error.py#L27-L35 | |
uclnlp/jack | 9e5ffbd4fb2b0bd6b816fe6e14b9045ac776bb8e | jack/core/input_module.py | python | InputModule.load | (self, path) | Load the state of this module. Default is that there is no state, so nothing to load. | Load the state of this module. Default is that there is no state, so nothing to load. | [
"Load",
"the",
"state",
"of",
"this",
"module",
".",
"Default",
"is",
"that",
"there",
"is",
"no",
"state",
"so",
"nothing",
"to",
"load",
"."
] | def load(self, path):
"""Load the state of this module. Default is that there is no state, so nothing to load."""
pass | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"pass"
] | https://github.com/uclnlp/jack/blob/9e5ffbd4fb2b0bd6b816fe6e14b9045ac776bb8e/jack/core/input_module.py#L101-L103 | ||
google-research/mixmatch | 1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e | fully_supervised/lib/train.py | python | ClassifyFullySupervised.tune | (self, train_nimg) | [] | def tune(self, train_nimg):
batch = FLAGS.batch
train_labeled = self.dataset.train_labeled.batch(batch).prefetch(16)
train_labeled = train_labeled.make_one_shot_iterator().get_next()
for _ in trange(0, train_nimg, batch, leave=False, unit='img', unit_scale=batch, desc='Tuning'):
... | [
"def",
"tune",
"(",
"self",
",",
"train_nimg",
")",
":",
"batch",
"=",
"FLAGS",
".",
"batch",
"train_labeled",
"=",
"self",
".",
"dataset",
".",
"train_labeled",
".",
"batch",
"(",
"batch",
")",
".",
"prefetch",
"(",
"16",
")",
"train_labeled",
"=",
"t... | https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/fully_supervised/lib/train.py#L68-L76 | ||||
rlpy/rlpy | af25d2011fff1d61cb7c5cc8992549808f0c6103 | rlpy/Tools/GeneralTools.py | python | addNewElementForAllActions | (weight_vec, actions_num, newElem=None) | :param weight_vec: The weight vector (often feature weights from
representation) used for s-a pairs
(i.e, len(weight_vec) = actions_num * numFeats)
:param actions_num: The total number of possible actions
:param newElem: (Optional) The weights associated with each action of the
feature t... | :param weight_vec: The weight vector (often feature weights from
representation) used for s-a pairs
(i.e, len(weight_vec) = actions_num * numFeats)
:param actions_num: The total number of possible actions
:param newElem: (Optional) The weights associated with each action of the
feature t... | [
":",
"param",
"weight_vec",
":",
"The",
"weight",
"vector",
"(",
"often",
"feature",
"weights",
"from",
"representation",
")",
"used",
"for",
"s",
"-",
"a",
"pairs",
"(",
"i",
".",
"e",
"len",
"(",
"weight_vec",
")",
"=",
"actions_num",
"*",
"numFeats",
... | def addNewElementForAllActions(weight_vec, actions_num, newElem=None):
"""
:param weight_vec: The weight vector (often feature weights from
representation) used for s-a pairs
(i.e, len(weight_vec) = actions_num * numFeats)
:param actions_num: The total number of possible actions
:param n... | [
"def",
"addNewElementForAllActions",
"(",
"weight_vec",
",",
"actions_num",
",",
"newElem",
"=",
"None",
")",
":",
"if",
"newElem",
"is",
"None",
":",
"newElem",
"=",
"np",
".",
"zeros",
"(",
"(",
"actions_num",
",",
"1",
")",
")",
"if",
"len",
"(",
"w... | https://github.com/rlpy/rlpy/blob/af25d2011fff1d61cb7c5cc8992549808f0c6103/rlpy/Tools/GeneralTools.py#L812-L840 | ||
theislab/anndata | 664e32b0aa6625fe593370d37174384c05abfd4e | anndata/_core/anndata.py | python | AnnData.__repr__ | (self) | [] | def __repr__(self) -> str:
if self.is_view:
return "View of " + self._gen_repr(self.n_obs, self.n_vars)
else:
return self._gen_repr(self.n_obs, self.n_vars) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"is_view",
":",
"return",
"\"View of \"",
"+",
"self",
".",
"_gen_repr",
"(",
"self",
".",
"n_obs",
",",
"self",
".",
"n_vars",
")",
"else",
":",
"return",
"self",
".",
"_gen_r... | https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/anndata.py#L575-L579 | ||||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/conch/insults/helper.py | python | _FormattingState.wantOne | (self, **kw) | return self._withAttribute(k, v) | Add a character attribute to a copy of this formatting state.
@param kw: An optional attribute name and value can be provided with
a keyword argument.
@return: A formatting state instance with the new attribute.
@see: L{DefaultFormattingState._withAttribute}. | Add a character attribute to a copy of this formatting state. | [
"Add",
"a",
"character",
"attribute",
"to",
"a",
"copy",
"of",
"this",
"formatting",
"state",
"."
] | def wantOne(self, **kw):
"""
Add a character attribute to a copy of this formatting state.
@param kw: An optional attribute name and value can be provided with
a keyword argument.
@return: A formatting state instance with the new attribute.
@see: L{DefaultFormattin... | [
"def",
"wantOne",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"k",
",",
"v",
"=",
"kw",
".",
"popitem",
"(",
")",
"return",
"self",
".",
"_withAttribute",
"(",
"k",
",",
"v",
")"
] | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/conch/insults/helper.py#L72-L84 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/reports/commtrack/util.py | python | get_product_ids_for_program | (domain, program_id) | return list(qs) | [] | def get_product_ids_for_program(domain, program_id):
qs = SQLProduct.objects.filter(
domain=domain, program_id=program_id
).values_list('product_id', flat=True)
return list(qs) | [
"def",
"get_product_ids_for_program",
"(",
"domain",
",",
"program_id",
")",
":",
"qs",
"=",
"SQLProduct",
".",
"objects",
".",
"filter",
"(",
"domain",
"=",
"domain",
",",
"program_id",
"=",
"program_id",
")",
".",
"values_list",
"(",
"'product_id'",
",",
"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/commtrack/util.py#L54-L58 | |||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/packages/urllib3/connectionpool.py | python | HTTPSConnectionPool._new_conn | (self) | return self._prepare_conn(conn) | Return a fresh :class:`httplib.HTTPSConnection`. | Return a fresh :class:`httplib.HTTPSConnection`. | [
"Return",
"a",
"fresh",
":",
"class",
":",
"httplib",
".",
"HTTPSConnection",
"."
] | def _new_conn(self):
"""
Return a fresh :class:`httplib.HTTPSConnection`.
"""
self.num_connections += 1
log.info("Starting new HTTPS connection (%d): %s"
% (self.num_connections, self.host))
if not self.ConnectionCls or self.ConnectionCls is DummyConnect... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"self",
".",
"num_connections",
"+=",
"1",
"log",
".",
"info",
"(",
"\"Starting new HTTPS connection (%d): %s\"",
"%",
"(",
"self",
".",
"num_connections",
",",
"self",
".",
"host",
")",
")",
"if",
"not",
"self",
... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/packages/urllib3/connectionpool.py#L752-L774 | |
coldfix/udiskie | 5a1f18f63b9fdd82c7c9487ee42c7e829449f13b | udiskie/cli.py | python | Value.__call__ | (self, args) | return args[self._name] | Get the value of the command line argument. | Get the value of the command line argument. | [
"Get",
"the",
"value",
"of",
"the",
"command",
"line",
"argument",
"."
] | def __call__(self, args):
"""Get the value of the command line argument."""
return args[self._name] | [
"def",
"__call__",
"(",
"self",
",",
"args",
")",
":",
"return",
"args",
"[",
"self",
".",
"_name",
"]"
] | https://github.com/coldfix/udiskie/blob/5a1f18f63b9fdd82c7c9487ee42c7e829449f13b/udiskie/cli.py#L71-L73 | |
AstusRush/AMaDiA | e2ad87318d9dd30bc24428e05c29cb32a29c83aa | External_Libraries/python_control_master/control/frdata.py | python | FrequencyResponseData.feedback | (self, other=1, sign=-1) | return FRD(fresp, other.omega, smooth=(self.ifunc is not None)) | Feedback interconnection between two FRD objects. | Feedback interconnection between two FRD objects. | [
"Feedback",
"interconnection",
"between",
"two",
"FRD",
"objects",
"."
] | def feedback(self, other=1, sign=-1):
"""Feedback interconnection between two FRD objects."""
other = _convertToFRD(other, omega=self.omega)
if (self.outputs != other.inputs or self.inputs != other.outputs):
raise ValueError(
"FRD.feedback, inputs/outputs mismatch")... | [
"def",
"feedback",
"(",
"self",
",",
"other",
"=",
"1",
",",
"sign",
"=",
"-",
"1",
")",
":",
"other",
"=",
"_convertToFRD",
"(",
"other",
",",
"omega",
"=",
"self",
".",
"omega",
")",
"if",
"(",
"self",
".",
"outputs",
"!=",
"other",
".",
"input... | https://github.com/AstusRush/AMaDiA/blob/e2ad87318d9dd30bc24428e05c29cb32a29c83aa/External_Libraries/python_control_master/control/frdata.py#L428-L451 | |
menpo/menpo | a61500656c4fc2eea82497684f13cc31a605550b | menpo/transform/base/composable.py | python | ComposableTransform.compose_after | (self, transform) | r"""
A :map:`Transform` that represents **this** transform
composed **after** the given transform::
c = a.compose_after(b)
c.apply(p) == a.apply(b.apply(p))
``a`` and ``b`` are left unchanged.
This corresponds to the usual mathematical formalism for the compose... | r"""
A :map:`Transform` that represents **this** transform
composed **after** the given transform:: | [
"r",
"A",
":",
"map",
":",
"Transform",
"that",
"represents",
"**",
"this",
"**",
"transform",
"composed",
"**",
"after",
"**",
"the",
"given",
"transform",
"::"
] | def compose_after(self, transform):
r"""
A :map:`Transform` that represents **this** transform
composed **after** the given transform::
c = a.compose_after(b)
c.apply(p) == a.apply(b.apply(p))
``a`` and ``b`` are left unchanged.
This corresponds to the ... | [
"def",
"compose_after",
"(",
"self",
",",
"transform",
")",
":",
"if",
"isinstance",
"(",
"transform",
",",
"self",
".",
"composes_with",
")",
":",
"return",
"self",
".",
"_compose_after",
"(",
"transform",
")",
"else",
":",
"# best we can do is a TransformChain... | https://github.com/menpo/menpo/blob/a61500656c4fc2eea82497684f13cc31a605550b/menpo/transform/base/composable.py#L71-L103 | ||
gpoore/pythontex | d0beafa088161957508809464b0ab331b1681c6e | pythontex/pythontex3.py | python | set_upgrade_compatibility | (data, old, temp_data) | When upgrading, modify settings to maintain backward compatibility when
possible and important | When upgrading, modify settings to maintain backward compatibility when
possible and important | [
"When",
"upgrading",
"modify",
"settings",
"to",
"maintain",
"backward",
"compatibility",
"when",
"possible",
"and",
"important"
] | def set_upgrade_compatibility(data, old, temp_data):
'''
When upgrading, modify settings to maintain backward compatibility when
possible and important
'''
if (old['version'].startswith('v') and
not data['settings']['workingdirset'] and
data['settings']['outputdir'] != '.'):
... | [
"def",
"set_upgrade_compatibility",
"(",
"data",
",",
"old",
",",
"temp_data",
")",
":",
"if",
"(",
"old",
"[",
"'version'",
"]",
".",
"startswith",
"(",
"'v'",
")",
"and",
"not",
"data",
"[",
"'settings'",
"]",
"[",
"'workingdirset'",
"]",
"and",
"data"... | https://github.com/gpoore/pythontex/blob/d0beafa088161957508809464b0ab331b1681c6e/pythontex/pythontex3.py#L530-L539 | ||
runawayhorse001/LearningApacheSpark | 67f3879dce17553195f094f5728b94a01badcf24 | pyspark/rdd.py | python | RDD.isEmpty | (self) | return self.getNumPartitions() == 0 or len(self.take(1)) == 0 | Returns true if and only if the RDD contains no elements at all.
.. note:: an RDD may be empty even when it has at least 1 partition.
>>> sc.parallelize([]).isEmpty()
True
>>> sc.parallelize([1]).isEmpty()
False | Returns true if and only if the RDD contains no elements at all. | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"RDD",
"contains",
"no",
"elements",
"at",
"all",
"."
] | def isEmpty(self):
"""
Returns true if and only if the RDD contains no elements at all.
.. note:: an RDD may be empty even when it has at least 1 partition.
>>> sc.parallelize([]).isEmpty()
True
>>> sc.parallelize([1]).isEmpty()
False
"""
return ... | [
"def",
"isEmpty",
"(",
"self",
")",
":",
"return",
"self",
".",
"getNumPartitions",
"(",
")",
"==",
"0",
"or",
"len",
"(",
"self",
".",
"take",
"(",
"1",
")",
")",
"==",
"0"
] | https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/rdd.py#L1383-L1394 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow/Segmentation/UNet_3D_Medical/model/losses.py | python | dice_loss | (predictions,
targets,
squared_pred=False,
smooth=1e-5,
top_smooth=0.0) | return 1 - tf.reduce_mean(dice, axis=0) | Dice
:param predictions: Predicted labels
:param targets: Ground truth labels
:param squared_pred: Square the predicate
:param smooth: Smooth term for denominator
:param top_smooth: Smooth term for numerator
:return: loss | Dice | [
"Dice"
] | def dice_loss(predictions,
targets,
squared_pred=False,
smooth=1e-5,
top_smooth=0.0):
""" Dice
:param predictions: Predicted labels
:param targets: Ground truth labels
:param squared_pred: Square the predicate
:param smooth: Smooth term for de... | [
"def",
"dice_loss",
"(",
"predictions",
",",
"targets",
",",
"squared_pred",
"=",
"False",
",",
"smooth",
"=",
"1e-5",
",",
"top_smooth",
"=",
"0.0",
")",
":",
"is_channels_first",
"=",
"False",
"n_len",
"=",
"len",
"(",
"predictions",
".",
"get_shape",
"(... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Segmentation/UNet_3D_Medical/model/losses.py#L69-L100 | |
Chia-Network/chia-blockchain | 34d44c1324ae634a0896f7b02eaa2802af9526cd | chia/util/permissions.py | python | verify_file_permissions | (path: Path, mask: int) | return (mode & mask == 0, mode) | Check that the file's permissions are properly restricted, as compared to the
permission mask | Check that the file's permissions are properly restricted, as compared to the
permission mask | [
"Check",
"that",
"the",
"file",
"s",
"permissions",
"are",
"properly",
"restricted",
"as",
"compared",
"to",
"the",
"permission",
"mask"
] | def verify_file_permissions(path: Path, mask: int) -> Tuple[bool, int]:
"""
Check that the file's permissions are properly restricted, as compared to the
permission mask
"""
if not path.exists():
raise Exception(f"file {path} does not exist")
mode = os.stat(path).st_mode & 0o777
ret... | [
"def",
"verify_file_permissions",
"(",
"path",
":",
"Path",
",",
"mask",
":",
"int",
")",
"->",
"Tuple",
"[",
"bool",
",",
"int",
"]",
":",
"if",
"not",
"path",
".",
"exists",
"(",
")",
":",
"raise",
"Exception",
"(",
"f\"file {path} does not exist\"",
"... | https://github.com/Chia-Network/chia-blockchain/blob/34d44c1324ae634a0896f7b02eaa2802af9526cd/chia/util/permissions.py#L6-L15 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/tile/device_tracker.py | python | TileDeviceTracker._handle_coordinator_update | (self) | Respond to a DataUpdateCoordinator update. | Respond to a DataUpdateCoordinator update. | [
"Respond",
"to",
"a",
"DataUpdateCoordinator",
"update",
"."
] | def _handle_coordinator_update(self) -> None:
"""Respond to a DataUpdateCoordinator update."""
self._update_from_latest_data()
self.async_write_ha_state() | [
"def",
"_handle_coordinator_update",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_update_from_latest_data",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tile/device_tracker.py#L132-L135 | ||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/androwarn/androwarn/search/malicious_behaviours/remote_connection.py | python | detect_Socket_use | (x) | return formatted_str | @param x : a VMAnalysis instance
@rtype : a list of formatted strings | [] | def detect_Socket_use(x) :
"""
@param x : a VMAnalysis instance
@rtype : a list of formatted strings
"""
formatted_str = []
structural_analysis_results = x.tainted_packages.search_methods("Ljava/net/Socket","<init>", ".")
for result in xrange(len(structural_analysis_results)) :
registers = data_flow_a... | [
"def",
"detect_Socket_use",
"(",
"x",
")",
":",
"formatted_str",
"=",
"[",
"]",
"structural_analysis_results",
"=",
"x",
".",
"tainted_packages",
".",
"search_methods",
"(",
"\"Ljava/net/Socket\"",
",",
"\"<init>\"",
",",
"\".\"",
")",
"for",
"result",
"in",
"xr... | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/androwarn/androwarn/search/malicious_behaviours/remote_connection.py#L37-L58 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/IPython/utils/process.py | python | abbrev_cwd | () | return (drivepart + (
cwd == '/' and '/' or tail)) | Return abbreviated version of cwd, e.g. d:mydir | Return abbreviated version of cwd, e.g. d:mydir | [
"Return",
"abbreviated",
"version",
"of",
"cwd",
"e",
".",
"g",
".",
"d",
":",
"mydir"
] | def abbrev_cwd():
""" Return abbreviated version of cwd, e.g. d:mydir """
cwd = os.getcwd().replace('\\','/')
drivepart = ''
tail = cwd
if sys.platform == 'win32':
if len(cwd) < 4:
return cwd
drivepart,tail = os.path.splitdrive(cwd)
parts = tail.split('/')
if le... | [
"def",
"abbrev_cwd",
"(",
")",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"drivepart",
"=",
"''",
"tail",
"=",
"cwd",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"if",
"len",
"(",
"cwd"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/utils/process.py#L53-L69 | |
schissmantics/yolo-tf2 | 90e14f1bf8a0a87b32367aa1411e417fa9800167 | yolo_tf2/core/evaluator.py | python | Evaluator.predict_dataset | (self, dataset, workers=16, split='train', batch_size=64) | return pd.concat(predictions) | Predict entire dataset.
Args:
dataset: MapDataset object.
workers: Parallel predictions.
split: str representation of the dataset 'train' or 'valid'
batch_size: Prediction batch size.
Returns:
pandas DataFrame with entire dataset predictions. | Predict entire dataset.
Args:
dataset: MapDataset object.
workers: Parallel predictions.
split: str representation of the dataset 'train' or 'valid'
batch_size: Prediction batch size. | [
"Predict",
"entire",
"dataset",
".",
"Args",
":",
"dataset",
":",
"MapDataset",
"object",
".",
"workers",
":",
"Parallel",
"predictions",
".",
"split",
":",
"str",
"representation",
"of",
"the",
"dataset",
"train",
"or",
"valid",
"batch_size",
":",
"Prediction... | def predict_dataset(self, dataset, workers=16, split='train', batch_size=64):
"""
Predict entire dataset.
Args:
dataset: MapDataset object.
workers: Parallel predictions.
split: str representation of the dataset 'train' or 'valid'
batch_size: Predi... | [
"def",
"predict_dataset",
"(",
"self",
",",
"dataset",
",",
"workers",
"=",
"16",
",",
"split",
"=",
"'train'",
",",
"batch_size",
"=",
"64",
")",
":",
"predictions",
"=",
"[",
"]",
"sizes",
"=",
"{",
"'train'",
":",
"self",
".",
"train_dataset_size",
... | https://github.com/schissmantics/yolo-tf2/blob/90e14f1bf8a0a87b32367aa1411e417fa9800167/yolo_tf2/core/evaluator.py#L97-L141 | |
scikit-video/scikit-video | 87c7113a84b50679d9853ba81ba34b557f516b05 | skvideo/measure/Li3DDCT.py | python | Li3DDCT_features | (videoData) | return np.hstack((Sfeats, Gammafeats, Energy1feats, Energy2feats, Distfeats)) | Computes No-reference features from the Spatiotemporal Statistics for Video Quality Assessment paper. [#f1]_
Since this is a referenceless image quality algorithm, only 1 video is needed. This function provides the raw features pooled over an entire video.
Parameters
----------
videoData : ndarray
... | Computes No-reference features from the Spatiotemporal Statistics for Video Quality Assessment paper. [#f1]_ | [
"Computes",
"No",
"-",
"reference",
"features",
"from",
"the",
"Spatiotemporal",
"Statistics",
"for",
"Video",
"Quality",
"Assessment",
"paper",
".",
"[",
"#f1",
"]",
"_"
] | def Li3DDCT_features(videoData):
"""Computes No-reference features from the Spatiotemporal Statistics for Video Quality Assessment paper. [#f1]_
Since this is a referenceless image quality algorithm, only 1 video is needed. This function provides the raw features pooled over an entire video.
Parameters
... | [
"def",
"Li3DDCT_features",
"(",
"videoData",
")",
":",
"videoData",
"=",
"vshape",
"(",
"videoData",
")",
"T",
",",
"M",
",",
"N",
",",
"C",
"=",
"videoData",
".",
"shape",
"assert",
"C",
"==",
"1",
",",
"\"called with video having %d channels. Please supply o... | https://github.com/scikit-video/scikit-video/blob/87c7113a84b50679d9853ba81ba34b557f516b05/skvideo/measure/Li3DDCT.py#L9-L108 | |
stevearc/dql | 9666cfba19773c20c7b4be29adc7d6179cf00d44 | dql/grammar/parsed_primitives.py | python | eval_interval | (result) | return relativedelta(**kwargs) | Evaluate an interval expression | Evaluate an interval expression | [
"Evaluate",
"an",
"interval",
"expression"
] | def eval_interval(result):
"""Evaluate an interval expression"""
kwargs = {
"years": 0,
"months": 0,
"weeks": 0,
"days": 0,
"hours": 0,
"minutes": 0,
"seconds": 0,
"microseconds": 0,
}
for i in range(1, len(result), 2):
amount, key ... | [
"def",
"eval_interval",
"(",
"result",
")",
":",
"kwargs",
"=",
"{",
"\"years\"",
":",
"0",
",",
"\"months\"",
":",
"0",
",",
"\"weeks\"",
":",
"0",
",",
"\"days\"",
":",
"0",
",",
"\"hours\"",
":",
"0",
",",
"\"minutes\"",
":",
"0",
",",
"\"seconds\... | https://github.com/stevearc/dql/blob/9666cfba19773c20c7b4be29adc7d6179cf00d44/dql/grammar/parsed_primitives.py#L92-L126 | |
deepmind/spriteworld | ace9e186ee9a819e8f4de070bd11cf27e2265b63 | spriteworld/factor_distributions.py | python | Intersection.__init__ | (self, components, index_for_sampling=0) | Construct intersection of component distributions.
Samples are generated by sampling from one of the components and then doing
rejection with the others, so if the component being sampled has some
non-uniformity (e.g. a mixture with non-uniform probs), that non-uniformity
will be inherited by the inter... | Construct intersection of component distributions. | [
"Construct",
"intersection",
"of",
"component",
"distributions",
"."
] | def __init__(self, components, index_for_sampling=0):
"""Construct intersection of component distributions.
Samples are generated by sampling from one of the components and then doing
rejection with the others, so if the component being sampled has some
non-uniformity (e.g. a mixture with non-uniform p... | [
"def",
"__init__",
"(",
"self",
",",
"components",
",",
"index_for_sampling",
"=",
"0",
")",
":",
"self",
".",
"components",
"=",
"components",
"self",
".",
"index_for_sampling",
"=",
"index_for_sampling",
"self",
".",
"_keys",
"=",
"components",
"[",
"0",
"... | https://github.com/deepmind/spriteworld/blob/ace9e186ee9a819e8f4de070bd11cf27e2265b63/spriteworld/factor_distributions.py#L215-L238 | ||
a312863063/seeprettyface-generator-yellow | c75b95b56c40036d00b35f3e140cc4a45598e077 | dnnlib/tflib/autosummary.py | python | _create_var | (name: str, value_expr: TfExpression) | return update_op | Internal helper for creating autosummary accumulators. | Internal helper for creating autosummary accumulators. | [
"Internal",
"helper",
"for",
"creating",
"autosummary",
"accumulators",
"."
] | def _create_var(name: str, value_expr: TfExpression) -> TfExpression:
"""Internal helper for creating autosummary accumulators."""
assert not _finalized
name_id = name.replace("/", "_")
v = tf.cast(value_expr, _dtype)
if v.shape.is_fully_defined():
size = np.prod(tfutil.shape_to_list(v.shap... | [
"def",
"_create_var",
"(",
"name",
":",
"str",
",",
"value_expr",
":",
"TfExpression",
")",
"->",
"TfExpression",
":",
"assert",
"not",
"_finalized",
"name_id",
"=",
"name",
".",
"replace",
"(",
"\"/\"",
",",
"\"_\"",
")",
"v",
"=",
"tf",
".",
"cast",
... | https://github.com/a312863063/seeprettyface-generator-yellow/blob/c75b95b56c40036d00b35f3e140cc4a45598e077/dnnlib/tflib/autosummary.py#L42-L71 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/_pyio.py | python | IOBase.writable | (self) | return False | Return whether object was opened for writing.
If False, write() and truncate() will raise IOError. | Return whether object was opened for writing. | [
"Return",
"whether",
"object",
"was",
"opened",
"for",
"writing",
"."
] | def writable(self):
"""Return whether object was opened for writing.
If False, write() and truncate() will raise IOError.
"""
return False | [
"def",
"writable",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/_pyio.py#L393-L398 | |
earthgecko/skyline | 12754424de72593e29eb21009fb1ae3f07f3abff | skyline/webapp/ionosphere_backend.py | python | get_matched_id_resources | (matched_id, matched_by, metric, requested_timestamp) | return matched_details, True, fail_msg, trace, matched_details_object, graph_image_file | Get the Ionosphere matched details of a features profile or layer
:param matched_id: the matched id
:type id: int
:param matched_by: either features_profile, layers or motif
:type id: str
:param metric: metric base_name
:type id: str
:param requested_timestamp: the timestamp of the features... | Get the Ionosphere matched details of a features profile or layer | [
"Get",
"the",
"Ionosphere",
"matched",
"details",
"of",
"a",
"features",
"profile",
"or",
"layer"
] | def get_matched_id_resources(matched_id, matched_by, metric, requested_timestamp):
"""
Get the Ionosphere matched details of a features profile or layer
:param matched_id: the matched id
:type id: int
:param matched_by: either features_profile, layers or motif
:type id: str
:param metric: m... | [
"def",
"get_matched_id_resources",
"(",
"matched_id",
",",
"matched_by",
",",
"metric",
",",
"requested_timestamp",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"skyline_app_logger",
")",
"function_str",
"=",
"'ionoshere_backend.py :: get_matched_id_resource... | https://github.com/earthgecko/skyline/blob/12754424de72593e29eb21009fb1ae3f07f3abff/skyline/webapp/ionosphere_backend.py#L5199-L5721 | |
amaranth-lang/amaranth | 7d611b8fc1d9e58853ff268ec38ff8f4131a9774 | amaranth/sim/core.py | python | Simulator.write_vcd | (self, vcd_file, gtkw_file=None, *, traces=()) | return self._engine.write_vcd(vcd_file=vcd_file, gtkw_file=gtkw_file, traces=traces) | Write waveforms to a Value Change Dump file, optionally populating a GTKWave save file.
This method returns a context manager. It can be used as: ::
sim = Simulator(frag)
sim.add_clock(1e-6)
with sim.write_vcd("dump.vcd", "dump.gtkw"):
sim.run_until(1e-3)
... | Write waveforms to a Value Change Dump file, optionally populating a GTKWave save file. | [
"Write",
"waveforms",
"to",
"a",
"Value",
"Change",
"Dump",
"file",
"optionally",
"populating",
"a",
"GTKWave",
"save",
"file",
"."
] | def write_vcd(self, vcd_file, gtkw_file=None, *, traces=()):
"""Write waveforms to a Value Change Dump file, optionally populating a GTKWave save file.
This method returns a context manager. It can be used as: ::
sim = Simulator(frag)
sim.add_clock(1e-6)
with sim.wr... | [
"def",
"write_vcd",
"(",
"self",
",",
"vcd_file",
",",
"gtkw_file",
"=",
"None",
",",
"*",
",",
"traces",
"=",
"(",
")",
")",
":",
"if",
"self",
".",
"_engine",
".",
"now",
"!=",
"0",
":",
"for",
"file",
"in",
"(",
"vcd_file",
",",
"gtkw_file",
"... | https://github.com/amaranth-lang/amaranth/blob/7d611b8fc1d9e58853ff268ec38ff8f4131a9774/amaranth/sim/core.py#L193-L218 | |
hvac/hvac | ec048ded30d21c13c21cfa950d148c8bfc1467b0 | hvac/v1/__init__.py | python | Client.create_token | (
self,
role=None,
token_id=None,
policies=None,
meta=None,
no_parent=False,
lease=None,
display_name=None,
num_uses=None,
no_default_policy=False,
ttl=None,
orphan=False,
wrap_ttl=None,
renewable=None,
... | POST /auth/token/create
POST /auth/token/create/<role>
POST /auth/token/create-orphan
:param role:
:type role:
:param token_id:
:type token_id:
:param policies:
:type policies:
:param meta:
:type meta:
:param no_parent:
:... | POST /auth/token/create | [
"POST",
"/",
"auth",
"/",
"token",
"/",
"create"
] | def create_token(
self,
role=None,
token_id=None,
policies=None,
meta=None,
no_parent=False,
lease=None,
display_name=None,
num_uses=None,
no_default_policy=False,
ttl=None,
orphan=False,
wrap_ttl=None,
renew... | [
"def",
"create_token",
"(",
"self",
",",
"role",
"=",
"None",
",",
"token_id",
"=",
"None",
",",
"policies",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"no_parent",
"=",
"False",
",",
"lease",
"=",
"None",
",",
"display_name",
"=",
"None",
",",
"num... | https://github.com/hvac/hvac/blob/ec048ded30d21c13c21cfa950d148c8bfc1467b0/hvac/v1/__init__.py#L321-L417 | ||
jorgebastida/gordon | 4c1cd0c4dea2499d98115672095714592f80f7aa | gordon/actions.py | python | InjectContextAndUploadToS3.prepare_file | (self, filename) | return tmpfile | [] | def prepare_file(self, filename):
context_to_inject = enrich_references(self.context_to_inject or {}, self.context)
context_destinaton = self.context_destinaton or '.context'
_, tmpfile = tempfile.mkstemp(suffix='.{}'.format(self.filename.rsplit('.', 1)[1]))
shutil.copyfile(self.filename... | [
"def",
"prepare_file",
"(",
"self",
",",
"filename",
")",
":",
"context_to_inject",
"=",
"enrich_references",
"(",
"self",
".",
"context_to_inject",
"or",
"{",
"}",
",",
"self",
".",
"context",
")",
"context_destinaton",
"=",
"self",
".",
"context_destinaton",
... | https://github.com/jorgebastida/gordon/blob/4c1cd0c4dea2499d98115672095714592f80f7aa/gordon/actions.py#L261-L272 | |||
FSecureLABS/drozer | df11e6e63fbaefa9b58ed1e42533ddf76241d7e1 | src/drozer/console/session.py | python | Session.__module | (self, key) | Gets a module instance, by identifier, and initialises it with the
required session parameters. | Gets a module instance, by identifier, and initialises it with the
required session parameters. | [
"Gets",
"a",
"module",
"instance",
"by",
"identifier",
"and",
"initialises",
"it",
"with",
"the",
"required",
"session",
"parameters",
"."
] | def __module(self, key):
"""
Gets a module instance, by identifier, and initialises it with the
required session parameters.
"""
module = None
try:
module = self.modules.get(self.__module_name(key))
except KeyError:
pass
if modul... | [
"def",
"__module",
"(",
"self",
",",
"key",
")",
":",
"module",
"=",
"None",
"try",
":",
"module",
"=",
"self",
".",
"modules",
".",
"get",
"(",
"self",
".",
"__module_name",
"(",
"key",
")",
")",
"except",
"KeyError",
":",
"pass",
"if",
"module",
... | https://github.com/FSecureLABS/drozer/blob/df11e6e63fbaefa9b58ed1e42533ddf76241d7e1/src/drozer/console/session.py#L619-L641 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/ARC2.py | python | new | (key, mode, *args, **kwargs) | return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs) | Create a new RC2 cipher.
:param key:
The secret key to use in the symmetric cipher.
Its length can vary from 5 to 128 bytes.
:type key: bytes, bytearray, memoryview
:param mode:
The chaining mode to use for encryption or decryption.
:type mode: One of the supported ``MODE_*`` c... | Create a new RC2 cipher. | [
"Create",
"a",
"new",
"RC2",
"cipher",
"."
] | def new(key, mode, *args, **kwargs):
"""Create a new RC2 cipher.
:param key:
The secret key to use in the symmetric cipher.
Its length can vary from 5 to 128 bytes.
:type key: bytes, bytearray, memoryview
:param mode:
The chaining mode to use for encryption or decryption.
:... | [
"def",
"new",
"(",
"key",
",",
"mode",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_create_cipher",
"(",
"sys",
".",
"modules",
"[",
"__name__",
"]",
",",
"key",
",",
"mode",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/ARC2.py#L95-L155 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/client/ssh/wrapper/__init__.py | python | FunctionWrapper.get | (self, cmd, default) | Mirrors behavior of dict.get | Mirrors behavior of dict.get | [
"Mirrors",
"behavior",
"of",
"dict",
".",
"get"
] | def get(self, cmd, default):
"""
Mirrors behavior of dict.get
"""
if cmd in self:
return self[cmd]
else:
return default | [
"def",
"get",
"(",
"self",
",",
"cmd",
",",
"default",
")",
":",
"if",
"cmd",
"in",
"self",
":",
"return",
"self",
"[",
"cmd",
"]",
"else",
":",
"return",
"default"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/client/ssh/wrapper/__init__.py#L171-L178 | ||
zedshaw/fuqit | 7d3d2890e4898d74ec165799c55b6ce6be38d206 | fuqit/data/__init__.py | python | dburl2dict | (url) | return out | Takes a URL to a database and parses it into an equivalent dictionary.
>>> dburl2dict('postgres://james:day@serverfarm.example.net:5432/mygreatdb')
{'pw': 'day', 'dbn': 'postgres', 'db': 'mygreatdb', 'host': 'serverfarm.example.net', 'user': 'james', 'port': '5432'}
>>> dburl2dict('postgres... | Takes a URL to a database and parses it into an equivalent dictionary.
>>> dburl2dict('postgres://james:day | [
"Takes",
"a",
"URL",
"to",
"a",
"database",
"and",
"parses",
"it",
"into",
"an",
"equivalent",
"dictionary",
".",
">>>",
"dburl2dict",
"(",
"postgres",
":",
"//",
"james",
":",
"day"
] | def dburl2dict(url):
"""
Takes a URL to a database and parses it into an equivalent dictionary.
>>> dburl2dict('postgres://james:day@serverfarm.example.net:5432/mygreatdb')
{'pw': 'day', 'dbn': 'postgres', 'db': 'mygreatdb', 'host': 'serverfarm.example.net', 'user': 'james', 'port': '5432'}... | [
"def",
"dburl2dict",
"(",
"url",
")",
":",
"dbn",
",",
"rest",
"=",
"url",
".",
"split",
"(",
"'://'",
",",
"1",
")",
"user",
",",
"rest",
"=",
"rest",
".",
"split",
"(",
"':'",
",",
"1",
")",
"pw",
",",
"rest",
"=",
"rest",
".",
"split",
"("... | https://github.com/zedshaw/fuqit/blob/7d3d2890e4898d74ec165799c55b6ce6be38d206/fuqit/data/__init__.py#L1137-L1162 | |
10XGenomics/cellranger | a83c753ce641db6409a59ad817328354fbe7187e | tenkit/lib/python/tenkit/bio_io.py | python | get_record_passes_filters | (record) | return (filter_field is None or (filter_field is not None and (len(filter_field) == 1 and filter_field[0] == "PASS")) or filter_field == []) | Record passes any VCF filtering | Record passes any VCF filtering | [
"Record",
"passes",
"any",
"VCF",
"filtering"
] | def get_record_passes_filters(record):
''' Record passes any VCF filtering '''
filter_field = get_record_filters(record)
return (filter_field is None or (filter_field is not None and (len(filter_field) == 1 and filter_field[0] == "PASS")) or filter_field == []) | [
"def",
"get_record_passes_filters",
"(",
"record",
")",
":",
"filter_field",
"=",
"get_record_filters",
"(",
"record",
")",
"return",
"(",
"filter_field",
"is",
"None",
"or",
"(",
"filter_field",
"is",
"not",
"None",
"and",
"(",
"len",
"(",
"filter_field",
")"... | https://github.com/10XGenomics/cellranger/blob/a83c753ce641db6409a59ad817328354fbe7187e/tenkit/lib/python/tenkit/bio_io.py#L315-L318 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/idlelib/sidebar.py | python | WrappedLineHeightChangeDelegator.__init__ | (self, callback) | callback - Callable, will be called when an insert, delete or replace
action on the text widget may require updating the shell
sidebar. | callback - Callable, will be called when an insert, delete or replace
action on the text widget may require updating the shell
sidebar. | [
"callback",
"-",
"Callable",
"will",
"be",
"called",
"when",
"an",
"insert",
"delete",
"or",
"replace",
"action",
"on",
"the",
"text",
"widget",
"may",
"require",
"updating",
"the",
"shell",
"sidebar",
"."
] | def __init__(self, callback):
"""
callback - Callable, will be called when an insert, delete or replace
action on the text widget may require updating the shell
sidebar.
"""
Delegator.__init__(self)
self.callback = callback | [
"def",
"__init__",
"(",
"self",
",",
"callback",
")",
":",
"Delegator",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"callback",
"=",
"callback"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/idlelib/sidebar.py#L365-L372 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/contrib/admin/sites.py | python | AdminSite.register | (self, model_or_iterable, admin_class=None, **options) | Registers the given model(s) with the given admin class.
The model(s) should be Model classes, not instances.
If an admin class isn't given, it will use ModelAdmin (the default
admin options). If keyword arguments are given -- e.g., list_display --
they'll be applied as options to the ... | Registers the given model(s) with the given admin class. | [
"Registers",
"the",
"given",
"model",
"(",
"s",
")",
"with",
"the",
"given",
"admin",
"class",
"."
] | def register(self, model_or_iterable, admin_class=None, **options):
"""
Registers the given model(s) with the given admin class.
The model(s) should be Model classes, not instances.
If an admin class isn't given, it will use ModelAdmin (the default
admin options). If keyword ar... | [
"def",
"register",
"(",
"self",
",",
"model_or_iterable",
",",
"admin_class",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"if",
"not",
"admin_class",
":",
"admin_class",
"=",
"ModelAdmin",
"# Don't import the humongous validation code unless required",
"if",
"a... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/admin/sites.py#L52-L101 | ||
usnistgov/fipy | 6809b180b41a11de988a48655575df7e142c93b9 | fipy/variables/interfaceAreaVariable.py | python | _InterfaceAreaVariable.__init__ | (self, distanceVar) | Creates an `_InterfaceAreaVariable` object.
Parameters
----------
distanceVar : ~fipy.variables.distanceVariable.DistanceVariable | Creates an `_InterfaceAreaVariable` object. | [
"Creates",
"an",
"_InterfaceAreaVariable",
"object",
"."
] | def __init__(self, distanceVar):
"""
Creates an `_InterfaceAreaVariable` object.
Parameters
----------
distanceVar : ~fipy.variables.distanceVariable.DistanceVariable
"""
CellVariable.__init__(self, distanceVar.mesh, hasOld=False)
self.distanceVar = self.... | [
"def",
"__init__",
"(",
"self",
",",
"distanceVar",
")",
":",
"CellVariable",
".",
"__init__",
"(",
"self",
",",
"distanceVar",
".",
"mesh",
",",
"hasOld",
"=",
"False",
")",
"self",
".",
"distanceVar",
"=",
"self",
".",
"_requires",
"(",
"distanceVar",
... | https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/variables/interfaceAreaVariable.py#L11-L20 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/docx/text/paragraph.py | python | Paragraph.style | (self) | return self.part.get_style(style_id, WD_STYLE_TYPE.PARAGRAPH) | Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragraph style
object. Assigning |No... | Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragraph style
object. Assigning |No... | [
"Read",
"/",
"Write",
".",
"|_ParagraphStyle|",
"object",
"representing",
"the",
"style",
"assigned",
"to",
"this",
"paragraph",
".",
"If",
"no",
"explicit",
"style",
"is",
"assigned",
"to",
"this",
"paragraph",
"its",
"value",
"is",
"the",
"default",
"paragra... | def style(self):
"""
Read/Write. |_ParagraphStyle| object representing the style assigned
to this paragraph. If no explicit style is assigned to this
paragraph, its value is the default paragraph style for the document.
A paragraph style name can be assigned in lieu of a paragrap... | [
"def",
"style",
"(",
"self",
")",
":",
"style_id",
"=",
"self",
".",
"_p",
".",
"style",
"return",
"self",
".",
"part",
".",
"get_style",
"(",
"style_id",
",",
"WD_STYLE_TYPE",
".",
"PARAGRAPH",
")"
] | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/docx/text/paragraph.py#L96-L106 | |
Kozea/pygal | 8267b03535ff55789a30bf66b798302adad88623 | pygal/graph/graph.py | python | Graph._set_view | (self) | Assign a view to current graph | Assign a view to current graph | [
"Assign",
"a",
"view",
"to",
"current",
"graph"
] | def _set_view(self):
"""Assign a view to current graph"""
if self.logarithmic:
if self._dual:
view_class = XYLogView
else:
view_class = LogView
else:
view_class = ReverseView if self.inverse_y_axis else View
self.view =... | [
"def",
"_set_view",
"(",
"self",
")",
":",
"if",
"self",
".",
"logarithmic",
":",
"if",
"self",
".",
"_dual",
":",
"view_class",
"=",
"XYLogView",
"else",
":",
"view_class",
"=",
"LogView",
"else",
":",
"view_class",
"=",
"ReverseView",
"if",
"self",
"."... | https://github.com/Kozea/pygal/blob/8267b03535ff55789a30bf66b798302adad88623/pygal/graph/graph.py#L54-L67 | ||
garnaat/kappa | a06a0047cc51f6a210beec4028a5fbe8ebcd5c53 | kappa/event_source/s3.py | python | S3EventSource.remove | (self, function) | [] | def remove(self, function):
notification_spec = self._get_notification_spec(function)
LOG.debug('removing s3 notification')
response = self._s3.call(
'get_bucket_notification_configuration',
Bucket=self._get_bucket_name())
LOG.debug(response)
if 'Lambda... | [
"def",
"remove",
"(",
"self",
",",
"function",
")",
":",
"notification_spec",
"=",
"self",
".",
"_get_notification_spec",
"(",
"function",
")",
"LOG",
".",
"debug",
"(",
"'removing s3 notification'",
")",
"response",
"=",
"self",
".",
"_s3",
".",
"call",
"("... | https://github.com/garnaat/kappa/blob/a06a0047cc51f6a210beec4028a5fbe8ebcd5c53/kappa/event_source/s3.py#L114-L135 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/pyasn1/type/univ.py | python | OctetString.__iter__ | (self) | return iter(self._value) | [] | def __iter__(self):
return iter(self._value) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_value",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pyasn1/type/univ.py#L1000-L1001 | |||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py | python | ParserElement.__rand__ | (self, other ) | return other & self | Implementation of & operator when left operand is not a C{L{ParserElement}} | Implementation of & operator when left operand is not a C{L{ParserElement}} | [
"Implementation",
"of",
"&",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
"C",
"{",
"L",
"{",
"ParserElement",
"}}"
] | def __rand__(self, other ):
"""
Implementation of & operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn(... | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py#L1986-L1996 | |
peplin/pygatt | 70c68684ca5a2c5cbd8c4f6f039503fe9b848d24 | pygatt/backends/gatttool/gatttool.py | python | is_windows | () | return platform.system() == 'Windows' | [] | def is_windows():
return platform.system() == 'Windows' | [
"def",
"is_windows",
"(",
")",
":",
"return",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'"
] | https://github.com/peplin/pygatt/blob/70c68684ca5a2c5cbd8c4f6f039503fe9b848d24/pygatt/backends/gatttool/gatttool.py#L30-L31 | |||
abingham/traad | 770924d9df89037c9a21f1946096aec35685f73d | traad/bottle.py | python | parse_date | (ims) | Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. | Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. | [
"Parse",
"rfc1123",
"rfc850",
"and",
"asctime",
"timestamps",
"and",
"return",
"UTC",
"epoch",
"."
] | def parse_date(ims):
""" Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. """
try:
ts = email.utils.parsedate_tz(ims)
return time.mktime(ts[:8] + (0,)) - (ts[9] or 0) - time.timezone
except (TypeError, ValueError, IndexError, OverflowError):
return None | [
"def",
"parse_date",
"(",
"ims",
")",
":",
"try",
":",
"ts",
"=",
"email",
".",
"utils",
".",
"parsedate_tz",
"(",
"ims",
")",
"return",
"time",
".",
"mktime",
"(",
"ts",
"[",
":",
"8",
"]",
"+",
"(",
"0",
",",
")",
")",
"-",
"(",
"ts",
"[",
... | https://github.com/abingham/traad/blob/770924d9df89037c9a21f1946096aec35685f73d/traad/bottle.py#L2399-L2405 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | add_partition_args.__init__ | (self, new_part=None,) | [] | def __init__(self, new_part=None,):
self.new_part = new_part | [
"def",
"__init__",
"(",
"self",
",",
"new_part",
"=",
"None",
",",
")",
":",
"self",
".",
"new_part",
"=",
"new_part"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L16464-L16465 | ||||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_13/pyasn1/codec/ber/decoder.py | python | BooleanDecoder._createComponent | (self, asn1Spec, tagSet, value=None) | return IntegerDecoder._createComponent(self, asn1Spec, tagSet, value and 1 or 0) | [] | def _createComponent(self, asn1Spec, tagSet, value=None):
return IntegerDecoder._createComponent(self, asn1Spec, tagSet, value and 1 or 0) | [
"def",
"_createComponent",
"(",
"self",
",",
"asn1Spec",
",",
"tagSet",
",",
"value",
"=",
"None",
")",
":",
"return",
"IntegerDecoder",
".",
"_createComponent",
"(",
"self",
",",
"asn1Spec",
",",
"tagSet",
",",
"value",
"and",
"1",
"or",
"0",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/pyasn1/codec/ber/decoder.py#L114-L115 | |||
devassistant/devassistant | 2dbfeaa666a64127263664d18969c55d19ecc83e | devassistant/argument.py | python | Argument.get_gui_hint | (self, hint) | Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint).
Args:
hint: name of the hint to get value for
Returns:
value of the hint specified in yaml or a sensible default | Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint). | [
"Returns",
"the",
"value",
"for",
"specified",
"gui",
"hint",
"(",
"or",
"a",
"sensible",
"default",
"value",
"if",
"this",
"argument",
"doesn",
"t",
"specify",
"the",
"hint",
")",
"."
] | def get_gui_hint(self, hint):
"""Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint).
Args:
hint: name of the hint to get value for
Returns:
value of the hint specified in yaml or a sensible default
... | [
"def",
"get_gui_hint",
"(",
"self",
",",
"hint",
")",
":",
"if",
"hint",
"==",
"'type'",
":",
"# 'self.kwargs.get('nargs') == 0' is there for default_iff_used, which may",
"# have nargs: 0, so that it works similarly to 'store_const'",
"if",
"self",
".",
"kwargs",
".",
"get",... | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/argument.py#L67-L108 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/tsa/statespace/mlemodel.py | python | MLEResults.get_prediction | (self, start=None, end=None, dynamic=False,
information_set='predicted', signal_only=False,
index=None, exog=None, extend_model=None,
extend_kwargs=None, **kwargs) | return PredictionResultsWrapper(PredictionResults(
self, prediction_results, information_set=information_set,
signal_only=signal_only, row_labels=prediction_index)) | r"""
In-sample prediction and out-of-sample forecasting
Parameters
----------
start : int, str, or datetime, optional
Zero-indexed observation number at which to start forecasting,
i.e., the first forecast is start. Can also be a date string to
parse ... | r"""
In-sample prediction and out-of-sample forecasting | [
"r",
"In",
"-",
"sample",
"prediction",
"and",
"out",
"-",
"of",
"-",
"sample",
"forecasting"
] | def get_prediction(self, start=None, end=None, dynamic=False,
information_set='predicted', signal_only=False,
index=None, exog=None, extend_model=None,
extend_kwargs=None, **kwargs):
r"""
In-sample prediction and out-of-sample forecast... | [
"def",
"get_prediction",
"(",
"self",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"dynamic",
"=",
"False",
",",
"information_set",
"=",
"'predicted'",
",",
"signal_only",
"=",
"False",
",",
"index",
"=",
"None",
",",
"exog",
"=",
"None",
"... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/tsa/statespace/mlemodel.py#L3226-L3319 | |
CalebBell/fluids | dbbdd1d5ea3c458bd68dd8e21cf6281a0ec3fc80 | fluids/friction.py | python | Avci_Karagoz_2009 | (Re, eD) | return 6.4*(log(Re) - log(1 + 0.01*Re*eD*(1+10*sqrt(eD))))**-2.4 | r'''Calculates Darcy friction factor using the method in Avci and Karagoz
(2009) [2]_ as shown in [1]_.
.. math::
f_D = \frac{6.4} {\left\{\ln(Re) - \ln\left[
1 + 0.01Re\frac{\epsilon}{D}\left(1 + 10(\frac{\epsilon}{D})^{0.5}
\right)\right]\right\}^{2.4}}
Parameters
----------
... | r'''Calculates Darcy friction factor using the method in Avci and Karagoz
(2009) [2]_ as shown in [1]_. | [
"r",
"Calculates",
"Darcy",
"friction",
"factor",
"using",
"the",
"method",
"in",
"Avci",
"and",
"Karagoz",
"(",
"2009",
")",
"[",
"2",
"]",
"_",
"as",
"shown",
"in",
"[",
"1",
"]",
"_",
"."
] | def Avci_Karagoz_2009(Re, eD):
r'''Calculates Darcy friction factor using the method in Avci and Karagoz
(2009) [2]_ as shown in [1]_.
.. math::
f_D = \frac{6.4} {\left\{\ln(Re) - \ln\left[
1 + 0.01Re\frac{\epsilon}{D}\left(1 + 10(\frac{\epsilon}{D})^{0.5}
\right)\right]\right\}^{2.... | [
"def",
"Avci_Karagoz_2009",
"(",
"Re",
",",
"eD",
")",
":",
"return",
"6.4",
"*",
"(",
"log",
"(",
"Re",
")",
"-",
"log",
"(",
"1",
"+",
"0.01",
"*",
"Re",
"*",
"eD",
"*",
"(",
"1",
"+",
"10",
"*",
"sqrt",
"(",
"eD",
")",
")",
")",
")",
"... | https://github.com/CalebBell/fluids/blob/dbbdd1d5ea3c458bd68dd8e21cf6281a0ec3fc80/fluids/friction.py#L1556-L1596 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/protocols/basic.py | python | LineReceiver.clearLineBuffer | (self) | return b | Clear buffered data.
@return: All of the cleared buffered data.
@rtype: C{str} | Clear buffered data. | [
"Clear",
"buffered",
"data",
"."
] | def clearLineBuffer(self):
"""
Clear buffered data.
@return: All of the cleared buffered data.
@rtype: C{str}
"""
b = self.__buffer
self.__buffer = ""
return b | [
"def",
"clearLineBuffer",
"(",
"self",
")",
":",
"b",
"=",
"self",
".",
"__buffer",
"self",
".",
"__buffer",
"=",
"\"\"",
"return",
"b"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/protocols/basic.py#L531-L540 | |
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/views/generic/dates.py | python | YearMixin.get_year_format | (self) | return self.year_format | Get a year format string in strptime syntax to be used to parse the
year from url variables. | Get a year format string in strptime syntax to be used to parse the
year from url variables. | [
"Get",
"a",
"year",
"format",
"string",
"in",
"strptime",
"syntax",
"to",
"be",
"used",
"to",
"parse",
"the",
"year",
"from",
"url",
"variables",
"."
] | def get_year_format(self):
"""
Get a year format string in strptime syntax to be used to parse the
year from url variables.
"""
return self.year_format | [
"def",
"get_year_format",
"(",
"self",
")",
":",
"return",
"self",
".",
"year_format"
] | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/views/generic/dates.py#L23-L28 | |
dequinns/ScrapydArt | 82bd59779cae3c0284d7c36781c8d963ffa5c547 | build/lib/scrapydart/webtools.py | python | time_ranks_table | (self, index=0) | return table | 爬虫运行时间排行 从高到低
:param index: 排行榜数量
:return: 符合排行榜数的<table>表格 | 爬虫运行时间排行 从高到低
:param index: 排行榜数量
:return: 符合排行榜数的<table>表格 | [
"爬虫运行时间排行",
"从高到低",
":",
"param",
"index",
":",
"排行榜数量",
":",
"return",
":",
"符合排行榜数的<table",
">",
"表格"
] | def time_ranks_table(self, index=0):
"""爬虫运行时间排行 从高到低
:param index: 排行榜数量
:return: 符合排行榜数的<table>表格
"""
tds = []
rps = time_rank(self, index=index)
for i, r in enumerate(rps):
aps = "<tr><td><i>{key}</i></td><td>{spider}</td><td>{number}</td></tr>".format(
key=i, spider=r... | [
"def",
"time_ranks_table",
"(",
"self",
",",
"index",
"=",
"0",
")",
":",
"tds",
"=",
"[",
"]",
"rps",
"=",
"time_rank",
"(",
"self",
",",
"index",
"=",
"index",
")",
"for",
"i",
",",
"r",
"in",
"enumerate",
"(",
"rps",
")",
":",
"aps",
"=",
"\... | https://github.com/dequinns/ScrapydArt/blob/82bd59779cae3c0284d7c36781c8d963ffa5c547/build/lib/scrapydart/webtools.py#L73-L85 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py | python | Manifest.__init__ | (self, base=None) | Initialise an instance.
:param base: The base directory to explore under. | Initialise an instance. | [
"Initialise",
"an",
"instance",
"."
] | def __init__(self, base=None):
"""
Initialise an instance.
:param base: The base directory to explore under.
"""
self.base = os.path.abspath(os.path.normpath(base or os.getcwd()))
self.prefix = self.base + os.sep
self.allfiles = None
self.files = set() | [
"def",
"__init__",
"(",
"self",
",",
"base",
"=",
"None",
")",
":",
"self",
".",
"base",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"base",
"or",
"os",
".",
"getcwd",
"(",
")",
")",
")",
"self",
".",
... | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py#L42-L51 | ||
smokeleeteveryday/CTF_WRITEUPS | 4683f0d41c92c4ed407cc3dd3b1760c68a05943f | 2015/BACKDOORCTF/crypto/rsanne/solution/rsanne.py | python | do_decrypt | (rsakey, ciphertext) | return plaintext | [] | def do_decrypt(rsakey, ciphertext):
rsakey = PKCS1_OAEP.new(rsakey)
plaintext = rsakey.decrypt(b64decode(ciphertext))
return plaintext | [
"def",
"do_decrypt",
"(",
"rsakey",
",",
"ciphertext",
")",
":",
"rsakey",
"=",
"PKCS1_OAEP",
".",
"new",
"(",
"rsakey",
")",
"plaintext",
"=",
"rsakey",
".",
"decrypt",
"(",
"b64decode",
"(",
"ciphertext",
")",
")",
"return",
"plaintext"
] | https://github.com/smokeleeteveryday/CTF_WRITEUPS/blob/4683f0d41c92c4ed407cc3dd3b1760c68a05943f/2015/BACKDOORCTF/crypto/rsanne/solution/rsanne.py#L36-L39 | |||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/decimal.py | python | Context.sqrt | (self, a) | return a.sqrt(context=self) | Square root of a non-negative number to context precision.
If the result must be inexact, it is rounded using the round-half-even
algorithm.
>>> ExtendedContext.sqrt(Decimal('0'))
Decimal('0')
>>> ExtendedContext.sqrt(Decimal('-0'))
Decimal('-0')
>>> ExtendedCon... | Square root of a non-negative number to context precision. | [
"Square",
"root",
"of",
"a",
"non",
"-",
"negative",
"number",
"to",
"context",
"precision",
"."
] | def sqrt(self, a):
"""Square root of a non-negative number to context precision.
If the result must be inexact, it is rounded using the round-half-even
algorithm.
>>> ExtendedContext.sqrt(Decimal('0'))
Decimal('0')
>>> ExtendedContext.sqrt(Decimal('-0'))
Decimal... | [
"def",
"sqrt",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"sqrt",
"(",
"context",
"=",
"self",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/decimal.py#L5292-L5322 | |
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/setuptools/command/upload.py | python | upload._prompt_for_password | (self) | Prompt for a password on the tty. Suppress Exceptions. | Prompt for a password on the tty. Suppress Exceptions. | [
"Prompt",
"for",
"a",
"password",
"on",
"the",
"tty",
".",
"Suppress",
"Exceptions",
"."
] | def _prompt_for_password(self):
"""
Prompt for a password on the tty. Suppress Exceptions.
"""
try:
return getpass.getpass()
except (Exception, KeyboardInterrupt):
pass | [
"def",
"_prompt_for_password",
"(",
"self",
")",
":",
"try",
":",
"return",
"getpass",
".",
"getpass",
"(",
")",
"except",
"(",
"Exception",
",",
"KeyboardInterrupt",
")",
":",
"pass"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/setuptools/command/upload.py#L31-L38 | ||
BYU-PCCL/holodeck | 521c1c828f47abe7fc24b027fb907eaf26495aed | src/holodeck/util.py | python | draw_arrow | (env, start, end, color=None, thickness=10.0) | Draws a debug arrow in the world
Args:
env (:class:`~holodeck.environments.HolodeckEnvironment`): Environment to draw in.
start (:obj:`list` of :obj:`float`): The start ``[x, y, z]`` location of the line.
(see :ref:`coordinate-system`)
end (:obj:`list` of :obj:`float`): The end ... | Draws a debug arrow in the world | [
"Draws",
"a",
"debug",
"arrow",
"in",
"the",
"world"
] | def draw_arrow(env, start, end, color=None, thickness=10.0):
"""Draws a debug arrow in the world
Args:
env (:class:`~holodeck.environments.HolodeckEnvironment`): Environment to draw in.
start (:obj:`list` of :obj:`float`): The start ``[x, y, z]`` location of the line.
(see :ref:`coo... | [
"def",
"draw_arrow",
"(",
"env",
",",
"start",
",",
"end",
",",
"color",
"=",
"None",
",",
"thickness",
"=",
"10.0",
")",
":",
"color",
"=",
"[",
"255",
",",
"0",
",",
"0",
"]",
"if",
"color",
"is",
"None",
"else",
"color",
"command_to_send",
"=",
... | https://github.com/BYU-PCCL/holodeck/blob/521c1c828f47abe7fc24b027fb907eaf26495aed/src/holodeck/util.py#L119-L132 | ||
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/optimize/_zeros_py.py | python | bisect | (f, a, b, args=(),
xtol=_xtol, rtol=_rtol, maxiter=_iter,
full_output=False, disp=True) | return results_c(full_output, r) | Find root of a function within an interval using bisection.
Basic bisection routine to find a zero of the function `f` between the
arguments `a` and `b`. `f(a)` and `f(b)` cannot have the same signs.
Slow but sure.
Parameters
----------
f : function
Python function returning a number. ... | Find root of a function within an interval using bisection. | [
"Find",
"root",
"of",
"a",
"function",
"within",
"an",
"interval",
"using",
"bisection",
"."
] | def bisect(f, a, b, args=(),
xtol=_xtol, rtol=_rtol, maxiter=_iter,
full_output=False, disp=True):
"""
Find root of a function within an interval using bisection.
Basic bisection routine to find a zero of the function `f` between the
arguments `a` and `b`. `f(a)` and `f(b)` cannot... | [
"def",
"bisect",
"(",
"f",
",",
"a",
",",
"b",
",",
"args",
"=",
"(",
")",
",",
"xtol",
"=",
"_xtol",
",",
"rtol",
"=",
"_rtol",
",",
"maxiter",
"=",
"_iter",
",",
"full_output",
"=",
"False",
",",
"disp",
"=",
"True",
")",
":",
"if",
"not",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/optimize/_zeros_py.py#L475-L557 | |
coreemu/core | 7e18a7a72023a69a92ad61d87461bd659ba27f7c | daemon/core/config.py | python | ConfigGroup.__init__ | (self, name: str, start: int, stop: int) | Creates a ConfigGroup object.
:param name: configuration group display name
:param start: configurations start index for this group
:param stop: configurations stop index for this group | Creates a ConfigGroup object. | [
"Creates",
"a",
"ConfigGroup",
"object",
"."
] | def __init__(self, name: str, start: int, stop: int) -> None:
"""
Creates a ConfigGroup object.
:param name: configuration group display name
:param start: configurations start index for this group
:param stop: configurations stop index for this group
"""
self.na... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"start",
":",
"int",
",",
"stop",
":",
"int",
")",
"->",
"None",
":",
"self",
".",
"name",
":",
"str",
"=",
"name",
"self",
".",
"start",
":",
"int",
"=",
"start",
"self",
".",
"stop... | https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/config.py#L24-L34 | ||
hildogjr/KiCost | 227f246d8c0f5dab145390d15c94ee2c3d6c790c | kicost/kicost_kicadplugin.py | python | install_kicost | () | return | Install KiCost. | Install KiCost. | [
"Install",
"KiCost",
"."
] | def install_kicost():
'''Install KiCost.'''
import pip
pip.main(['install', 'kicost'])
return | [
"def",
"install_kicost",
"(",
")",
":",
"import",
"pip",
"pip",
".",
"main",
"(",
"[",
"'install'",
",",
"'kicost'",
"]",
")",
"return"
] | https://github.com/hildogjr/KiCost/blob/227f246d8c0f5dab145390d15c94ee2c3d6c790c/kicost/kicost_kicadplugin.py#L56-L60 | |
pnprog/goreviewpartner | cbcc486cd4c51fb6fc3bc0a1eab61ff34298dadf | gomill/ringmasters.py | python | Ringmaster.warn | (self, s) | Log a message and say it on the 'warnings' channel. | Log a message and say it on the 'warnings' channel. | [
"Log",
"a",
"message",
"and",
"say",
"it",
"on",
"the",
"warnings",
"channel",
"."
] | def warn(self, s):
"""Log a message and say it on the 'warnings' channel."""
self.log(s)
self.presenter.say('warnings', s) | [
"def",
"warn",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"log",
"(",
"s",
")",
"self",
".",
"presenter",
".",
"say",
"(",
"'warnings'",
",",
"s",
")"
] | https://github.com/pnprog/goreviewpartner/blob/cbcc486cd4c51fb6fc3bc0a1eab61ff34298dadf/gomill/ringmasters.py#L322-L325 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/geometry/lattice_polytope.py | python | set_palp_dimension | (d) | r"""
Set the dimension for PALP calls to ``d``.
INPUT:
- ``d`` -- an integer from the list [4,5,6,11] or ``None``.
OUTPUT:
- none.
PALP has many hard-coded limits, which must be specified before
compilation, one of them is dimension. Sage includes several versions with
different dim... | r"""
Set the dimension for PALP calls to ``d``. | [
"r",
"Set",
"the",
"dimension",
"for",
"PALP",
"calls",
"to",
"d",
"."
] | def set_palp_dimension(d):
r"""
Set the dimension for PALP calls to ``d``.
INPUT:
- ``d`` -- an integer from the list [4,5,6,11] or ``None``.
OUTPUT:
- none.
PALP has many hard-coded limits, which must be specified before
compilation, one of them is dimension. Sage includes several ... | [
"def",
"set_palp_dimension",
"(",
"d",
")",
":",
"global",
"_palp_dimension",
"_palp_dimension",
"=",
"d"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/lattice_polytope.py#L5805-L5848 | ||
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/misc/validation.py | python | human_password_strength | (password) | return hint, color | Converts password strength to a human message | Converts password strength to a human message | [
"Converts",
"password",
"strength",
"to",
"a",
"human",
"message"
] | def human_password_strength(password):
""" Converts password strength to a human message """
strength = password_strength(password)
length = len(password)
if length == 0:
hint = ''
color = ''
elif length < 6:
hint = _('Password is too short')
color = 'darkred'
eli... | [
"def",
"human_password_strength",
"(",
"password",
")",
":",
"strength",
"=",
"password_strength",
"(",
"password",
")",
"length",
"=",
"len",
"(",
"password",
")",
"if",
"length",
"==",
"0",
":",
"hint",
"=",
"''",
"color",
"=",
"''",
"elif",
"length",
... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/misc/validation.py#L136-L158 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/uuid.py | python | uuid5 | (namespace, name) | return UUID(bytes=hash[:16], version=5) | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | [
"Generate",
"a",
"UUID",
"from",
"the",
"SHA",
"-",
"1",
"hash",
"of",
"a",
"namespace",
"UUID",
"and",
"a",
"name",
"."
] | def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
from hashlib import sha1
hash = sha1(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=5) | [
"def",
"uuid5",
"(",
"namespace",
",",
"name",
")",
":",
"from",
"hashlib",
"import",
"sha1",
"hash",
"=",
"sha1",
"(",
"namespace",
".",
"bytes",
"+",
"name",
")",
".",
"digest",
"(",
")",
"return",
"UUID",
"(",
"bytes",
"=",
"hash",
"[",
":",
"16... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/uuid.py#L549-L553 | |
PixarAnimationStudios/OpenTimelineIO | 990a54ccbe6488180a93753370fc87902b982962 | src/opentimelineview/timeline_widget.py | python | CompositionWidget._adjust_scene_size | (self) | [] | def _adjust_scene_size(self):
scene_range = self.composition.trimmed_range()
start_time = otio.opentime.to_seconds(scene_range.start_time)
duration = otio.opentime.to_seconds(scene_range.end_time_exclusive())
if isinstance(self.composition, otio.schema.Stack):
# non audio t... | [
"def",
"_adjust_scene_size",
"(",
"self",
")",
":",
"scene_range",
"=",
"self",
".",
"composition",
".",
"trimmed_range",
"(",
")",
"start_time",
"=",
"otio",
".",
"opentime",
".",
"to_seconds",
"(",
"scene_range",
".",
"start_time",
")",
"duration",
"=",
"o... | https://github.com/PixarAnimationStudios/OpenTimelineIO/blob/990a54ccbe6488180a93753370fc87902b982962/src/opentimelineview/timeline_widget.py#L131-L178 | ||||
lukemelas/EfficientNet-PyTorch | 7e8b0d312162f335785fb5dcfa1df29a75a1783a | tf_to_pytorch/convert_tf_to_pt/original_tf/eval_ckpt_main_tf1.py | python | EvalCkptDriver.run_inference | (self, ckpt_dir, image_files, labels) | Build and run inference on the target images and labels. | Build and run inference on the target images and labels. | [
"Build",
"and",
"run",
"inference",
"on",
"the",
"target",
"images",
"and",
"labels",
"."
] | def run_inference(self, ckpt_dir, image_files, labels):
"""Build and run inference on the target images and labels."""
with tf.Graph().as_default(), tf.Session() as sess:
images, labels = self.build_dataset(image_files, labels, False)
probs = self.build_model(images, is_training=False)
sess.r... | [
"def",
"run_inference",
"(",
"self",
",",
"ckpt_dir",
",",
"image_files",
",",
"labels",
")",
":",
"with",
"tf",
".",
"Graph",
"(",
")",
".",
"as_default",
"(",
")",
",",
"tf",
".",
"Session",
"(",
")",
"as",
"sess",
":",
"images",
",",
"labels",
"... | https://github.com/lukemelas/EfficientNet-PyTorch/blob/7e8b0d312162f335785fb5dcfa1df29a75a1783a/tf_to_pytorch/convert_tf_to_pt/original_tf/eval_ckpt_main_tf1.py#L121-L139 | ||
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | cellular_automata/conways_game_of_life.py | python | generate_images | (cells: list[list[int]], frames: int) | return images | Generates a list of images of subsequent Game of Life states. | Generates a list of images of subsequent Game of Life states. | [
"Generates",
"a",
"list",
"of",
"images",
"of",
"subsequent",
"Game",
"of",
"Life",
"states",
"."
] | def generate_images(cells: list[list[int]], frames: int) -> list[Image.Image]:
"""
Generates a list of images of subsequent Game of Life states.
"""
images = []
for _ in range(frames):
# Create output image
img = Image.new("RGB", (len(cells[0]), len(cells)))
pixels = img.load... | [
"def",
"generate_images",
"(",
"cells",
":",
"list",
"[",
"list",
"[",
"int",
"]",
"]",
",",
"frames",
":",
"int",
")",
"->",
"list",
"[",
"Image",
".",
"Image",
"]",
":",
"images",
"=",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"frames",
")",
... | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/cellular_automata/conways_game_of_life.py#L73-L92 | |
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.__repr__ | (self, _repr_running={}) | od.__repr__() <==> repr(od) | od.__repr__() <==> repr(od) | [
"od",
".",
"__repr__",
"()",
"<",
"==",
">",
"repr",
"(",
"od",
")"
] | def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
... | [
"def",
"__repr__",
"(",
"self",
",",
"_repr_running",
"=",
"{",
"}",
")",
":",
"call_key",
"=",
"id",
"(",
"self",
")",
",",
"_get_ident",
"(",
")",
"if",
"call_key",
"in",
"_repr_running",
":",
"return",
"'...'",
"_repr_running",
"[",
"call_key",
"]",
... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/packages/urllib3/packages/ordered_dict.py#L197-L208 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.