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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/webapp2-2.5.1/webapp2_extras/i18n.py | python | format_time | (time=None, format=None, rebase=True) | return get_i18n().format_time(time, format, rebase) | See :meth:`I18n.format_time`. | See :meth:`I18n.format_time`. | [
"See",
":",
"meth",
":",
"I18n",
".",
"format_time",
"."
] | def format_time(time=None, format=None, rebase=True):
"""See :meth:`I18n.format_time`."""
return get_i18n().format_time(time, format, rebase) | [
"def",
"format_time",
"(",
"time",
"=",
"None",
",",
"format",
"=",
"None",
",",
"rebase",
"=",
"True",
")",
":",
"return",
"get_i18n",
"(",
")",
".",
"format_time",
"(",
"time",
",",
"format",
",",
"rebase",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/webapp2-2.5.1/webapp2_extras/i18n.py#L741-L743 | |
peering-manager/peering-manager | 62c870fb9caa6dfc056feb77c595d45bc3c4988a | messaging/filters.py | python | EmailFilterSet.search | (self, queryset, name, value) | return queryset.filter(
Q(name__icontains=value)
| Q(subject__icontains=value)
| Q(template__icontains=value)
) | [] | def search(self, queryset, name, value):
if not value.strip():
return queryset
return queryset.filter(
Q(name__icontains=value)
| Q(subject__icontains=value)
| Q(template__icontains=value)
) | [
"def",
"search",
"(",
"self",
",",
"queryset",
",",
"name",
",",
"value",
")",
":",
"if",
"not",
"value",
".",
"strip",
"(",
")",
":",
"return",
"queryset",
"return",
"queryset",
".",
"filter",
"(",
"Q",
"(",
"name__icontains",
"=",
"value",
")",
"|"... | https://github.com/peering-manager/peering-manager/blob/62c870fb9caa6dfc056feb77c595d45bc3c4988a/messaging/filters.py#L73-L80 | |||
boto/boto | b2a6f08122b2f1b89888d2848e730893595cd001 | boto/kms/layer1.py | python | KMSConnection.update_key_description | (self, key_id, description) | return self.make_request(action='UpdateKeyDescription',
body=json.dumps(params)) | :type key_id: string
:param key_id:
:type description: string
:param description: | [] | def update_key_description(self, key_id, description):
"""
:type key_id: string
:param key_id:
:type description: string
:param description:
"""
params = {'KeyId': key_id, 'Description': description, }
return self.make_request(action='UpdateKey... | [
"def",
"update_key_description",
"(",
"self",
",",
"key_id",
",",
"description",
")",
":",
"params",
"=",
"{",
"'KeyId'",
":",
"key_id",
",",
"'Description'",
":",
"description",
",",
"}",
"return",
"self",
".",
"make_request",
"(",
"action",
"=",
"'UpdateKe... | https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/kms/layer1.py#L783-L796 | ||
interpretml/interpret-community | 84d86b7514fd9812f1497329bf1c4c9fc864370e | python/interpret_community/common/warnings_suppressor.py | python | shap_warnings_suppressor.__enter__ | (self) | return log | Begins suppressing shap warnings. | Begins suppressing shap warnings. | [
"Begins",
"suppressing",
"shap",
"warnings",
"."
] | def __enter__(self):
"""Begins suppressing shap warnings."""
if self._entered:
raise RuntimeError("Cannot enter %r twice" % self)
self._entered = True
self._tf_warnings_suppressor.__enter__()
log = self._catch_warnings.__enter__()
warnings.filterwarnings('igno... | [
"def",
"__enter__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_entered",
":",
"raise",
"RuntimeError",
"(",
"\"Cannot enter %r twice\"",
"%",
"self",
")",
"self",
".",
"_entered",
"=",
"True",
"self",
".",
"_tf_warnings_suppressor",
".",
"__enter__",
"(",
"... | https://github.com/interpretml/interpret-community/blob/84d86b7514fd9812f1497329bf1c4c9fc864370e/python/interpret_community/common/warnings_suppressor.py#L51-L59 | |
rspivak/lsbasi | 07e1a14516156a21ebe2d82e0bae4bba5ad73dd6 | part9/python/spi.py | python | Parser.term | (self) | return node | term : factor ((MUL | DIV) factor)* | term : factor ((MUL | DIV) factor)* | [
"term",
":",
"factor",
"((",
"MUL",
"|",
"DIV",
")",
"factor",
")",
"*"
] | def term(self):
"""term : factor ((MUL | DIV) factor)*"""
node = self.factor()
while self.current_token.type in (MUL, DIV):
token = self.current_token
if token.type == MUL:
self.eat(MUL)
elif token.type == DIV:
self.eat(DIV)
... | [
"def",
"term",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"factor",
"(",
")",
"while",
"self",
".",
"current_token",
".",
"type",
"in",
"(",
"MUL",
",",
"DIV",
")",
":",
"token",
"=",
"self",
".",
"current_token",
"if",
"token",
".",
"type",
... | https://github.com/rspivak/lsbasi/blob/07e1a14516156a21ebe2d82e0bae4bba5ad73dd6/part9/python/spi.py#L320-L333 | |
pyexcel/pyexcel | c1c99d4724e5c2adc6b714116a050287e07e1835 | pyexcel/internal/source_plugin.py | python | SourcePluginManager.get_book_source | (self, **keywords) | return self.get_a_plugin(
target=constants.BOOK, action=constants.READ_ACTION, **keywords
) | obtain a book read source plugin for signature functions | obtain a book read source plugin for signature functions | [
"obtain",
"a",
"book",
"read",
"source",
"plugin",
"for",
"signature",
"functions"
] | def get_book_source(self, **keywords):
"""obtain a book read source plugin for signature functions"""
return self.get_a_plugin(
target=constants.BOOK, action=constants.READ_ACTION, **keywords
) | [
"def",
"get_book_source",
"(",
"self",
",",
"*",
"*",
"keywords",
")",
":",
"return",
"self",
".",
"get_a_plugin",
"(",
"target",
"=",
"constants",
".",
"BOOK",
",",
"action",
"=",
"constants",
".",
"READ_ACTION",
",",
"*",
"*",
"keywords",
")"
] | https://github.com/pyexcel/pyexcel/blob/c1c99d4724e5c2adc6b714116a050287e07e1835/pyexcel/internal/source_plugin.py#L83-L87 | |
PacktPublishing/Expert-Python-Programming_Second-Edition | 2ccdbd302dea96aecc3aef04aaf08b0cb937f30a | chapter2/lists.py | python | evens_using_for_loop | (count) | return evens | Calculate evens using for loop | Calculate evens using for loop | [
"Calculate",
"evens",
"using",
"for",
"loop"
] | def evens_using_for_loop(count):
""" Calculate evens using for loop """
evens = []
for i in range(count):
if i % 2 == 0:
evens.append(i)
return evens | [
"def",
"evens_using_for_loop",
"(",
"count",
")",
":",
"evens",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"count",
")",
":",
"if",
"i",
"%",
"2",
"==",
"0",
":",
"evens",
".",
"append",
"(",
"i",
")",
"return",
"evens"
] | https://github.com/PacktPublishing/Expert-Python-Programming_Second-Edition/blob/2ccdbd302dea96aecc3aef04aaf08b0cb937f30a/chapter2/lists.py#L7-L13 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/apk_helper.py | python | ApkHelper.GetAbis | (self) | Returns a list of ABIs in the apk (empty list if no native code). | Returns a list of ABIs in the apk (empty list if no native code). | [
"Returns",
"a",
"list",
"of",
"ABIs",
"in",
"the",
"apk",
"(",
"empty",
"list",
"if",
"no",
"native",
"code",
")",
"."
] | def GetAbis(self):
"""Returns a list of ABIs in the apk (empty list if no native code)."""
# Use lib/* to determine the compatible ABIs.
libs = set()
for path in self._ListApkPaths():
path_tokens = path.split('/')
if len(path_tokens) >= 2 and path_tokens[0] == 'lib':
libs.add(path_to... | [
"def",
"GetAbis",
"(",
"self",
")",
":",
"# Use lib/* to determine the compatible ABIs.",
"libs",
"=",
"set",
"(",
")",
"for",
"path",
"in",
"self",
".",
"_ListApkPaths",
"(",
")",
":",
"path_tokens",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"if",
"len"... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/apk_helper.py#L251-L272 | ||
ultrabug/py3status | 80ec45a9db0712b0de55f83291c321f6fceb6a6d | py3status/py3.py | python | Py3.get_color_names_list | (self, format_string, matches=None) | return list(found) | Returns a list of color names in ``format_string``.
:param format_string: Accepts a format string.
:param matches: Filter results with a string or a list of strings.
If ``matches`` is provided then it is used to filter the result
using fnmatch so the following patterns can be used:
... | Returns a list of color names in ``format_string``. | [
"Returns",
"a",
"list",
"of",
"color",
"names",
"in",
"format_string",
"."
] | def get_color_names_list(self, format_string, matches=None):
"""
Returns a list of color names in ``format_string``.
:param format_string: Accepts a format string.
:param matches: Filter results with a string or a list of strings.
If ``matches`` is provided then it is used to f... | [
"def",
"get_color_names_list",
"(",
"self",
",",
"format_string",
",",
"matches",
"=",
"None",
")",
":",
"if",
"not",
"getattr",
"(",
"self",
".",
"_py3status_module",
",",
"\"thresholds\"",
",",
"None",
")",
":",
"return",
"[",
"]",
"elif",
"not",
"format... | https://github.com/ultrabug/py3status/blob/80ec45a9db0712b0de55f83291c321f6fceb6a6d/py3status/py3.py#L685-L723 | |
inpanel/inpanel | be53d86a72e30dd5476780ed5ba334315a23004b | lib/tornado/web.py | python | RequestHandler._execute | (self, transforms, *args, **kwargs) | Executes this request with the given output transforms. | Executes this request with the given output transforms. | [
"Executes",
"this",
"request",
"with",
"the",
"given",
"output",
"transforms",
"."
] | def _execute(self, transforms, *args, **kwargs):
"""Executes this request with the given output transforms."""
self._transforms = transforms
try:
if self.request.method not in self.SUPPORTED_METHODS:
raise HTTPError(405)
# If XSRF cookies are turned on, re... | [
"def",
"_execute",
"(",
"self",
",",
"transforms",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_transforms",
"=",
"transforms",
"try",
":",
"if",
"self",
".",
"request",
".",
"method",
"not",
"in",
"self",
".",
"SUPPORTED_METHODS... | https://github.com/inpanel/inpanel/blob/be53d86a72e30dd5476780ed5ba334315a23004b/lib/tornado/web.py#L1005-L1025 | ||
rlpy/rlpy | af25d2011fff1d61cb7c5cc8992549808f0c6103 | rlpy/Domains/HelicopterHover.py | python | HelicopterHoverExtended._in_body_coord | (self, p, q) | return q_p[1:] | q is the inverse quaternion of the rotation of the helicopter in world coordinates | q is the inverse quaternion of the rotation of the helicopter in world coordinates | [
"q",
"is",
"the",
"inverse",
"quaternion",
"of",
"the",
"rotation",
"of",
"the",
"helicopter",
"in",
"world",
"coordinates"
] | def _in_body_coord(self, p, q):
"""
q is the inverse quaternion of the rotation of the helicopter in world coordinates
"""
q_pos = np.zeros((4))
q_pos[1:] = p
q_p = trans.quaternion_multiply(trans.quaternion_multiply(q, q_pos),
tran... | [
"def",
"_in_body_coord",
"(",
"self",
",",
"p",
",",
"q",
")",
":",
"q_pos",
"=",
"np",
".",
"zeros",
"(",
"(",
"4",
")",
")",
"q_pos",
"[",
"1",
":",
"]",
"=",
"p",
"q_p",
"=",
"trans",
".",
"quaternion_multiply",
"(",
"trans",
".",
"quaternion_... | https://github.com/rlpy/rlpy/blob/af25d2011fff1d61cb7c5cc8992549808f0c6103/rlpy/Domains/HelicopterHover.py#L226-L234 | |
Mindwerks/worldengine | 64dff8eb7824ce46b5b6cb8006bcef21822ef144 | worldengine/basic_map_operations.py | python | distance | (pa, pb) | return math.sqrt((ax - bx) ** 2 + (ay - by) ** 2) | [] | def distance(pa, pb):
ax, ay = pa
bx, by = pb
return math.sqrt((ax - bx) ** 2 + (ay - by) ** 2) | [
"def",
"distance",
"(",
"pa",
",",
"pb",
")",
":",
"ax",
",",
"ay",
"=",
"pa",
"bx",
",",
"by",
"=",
"pb",
"return",
"math",
".",
"sqrt",
"(",
"(",
"ax",
"-",
"bx",
")",
"**",
"2",
"+",
"(",
"ay",
"-",
"by",
")",
"**",
"2",
")"
] | https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/basic_map_operations.py#L4-L7 | |||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/google_ads_service/client.py | python | GoogleAdsServiceClient.parse_campaign_criterion_path | (path: str) | return m.groupdict() if m else {} | Parse a campaign_criterion path into its component segments. | Parse a campaign_criterion path into its component segments. | [
"Parse",
"a",
"campaign_criterion",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_campaign_criterion_path(path: str) -> Dict[str, str]:
"""Parse a campaign_criterion path into its component segments."""
m = re.match(
r"^customers/(?P<customer_id>.+?)/campaignCriteria/(?P<campaign_id>.+?)~(?P<criterion_id>.+?)$",
path,
)
return m.group... | [
"def",
"parse_campaign_criterion_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^customers/(?P<customer_id>.+?)/campaignCriteria/(?P<campaign_id>.+?)~(?P<criterion_id>.+?)$\"",
",",
"path",
"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/google_ads_service/client.py#L1087-L1093 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/models/signals/staticipaddress.py | python | post_delete_remake_sip_for_bmc | (sender, instance, **kwargs) | Now that the StaticIPAddress instance is gone, ask each BMC that was
using it to make a new one.
When a StaticIPAddress is deleted, any BMC models sharing it will
automatically set their ip_address links to None. They are then recreated
here in post_delete. | Now that the StaticIPAddress instance is gone, ask each BMC that was
using it to make a new one. | [
"Now",
"that",
"the",
"StaticIPAddress",
"instance",
"is",
"gone",
"ask",
"each",
"BMC",
"that",
"was",
"using",
"it",
"to",
"make",
"a",
"new",
"one",
"."
] | def post_delete_remake_sip_for_bmc(sender, instance, **kwargs):
"""Now that the StaticIPAddress instance is gone, ask each BMC that was
using it to make a new one.
When a StaticIPAddress is deleted, any BMC models sharing it will
automatically set their ip_address links to None. They are then recreated... | [
"def",
"post_delete_remake_sip_for_bmc",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"bmc",
"in",
"instance",
".",
"__previous_bmcs",
":",
"# This BMC model instance was created in pre_delete and hasn't been",
"# updated to reflect the just execu... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/models/signals/staticipaddress.py#L44-L59 | ||
CPJKU/madmom | 3bc8334099feb310acfce884ebdb76a28e01670d | madmom/evaluation/chords.py | python | reduce_to_triads | (chords, keep_bass=False) | return reduced_chords | Reduce chords to triads.
The function follows the reduction rules implemented in [1]_. If a chord
chord does not contain a third, major second or fourth, it is reduced to
a power chord. If it does not contain neither a third nor a fifth, it is
reduced to a single note "chord".
Parameters
-----... | Reduce chords to triads. | [
"Reduce",
"chords",
"to",
"triads",
"."
] | def reduce_to_triads(chords, keep_bass=False):
"""
Reduce chords to triads.
The function follows the reduction rules implemented in [1]_. If a chord
chord does not contain a third, major second or fourth, it is reduced to
a power chord. If it does not contain neither a third nor a fifth, it is
... | [
"def",
"reduce_to_triads",
"(",
"chords",
",",
"keep_bass",
"=",
"False",
")",
":",
"unison",
"=",
"chords",
"[",
"'intervals'",
"]",
"[",
":",
",",
"0",
"]",
".",
"astype",
"(",
"bool",
")",
"maj_sec",
"=",
"chords",
"[",
"'intervals'",
"]",
"[",
":... | https://github.com/CPJKU/madmom/blob/3bc8334099feb310acfce884ebdb76a28e01670d/madmom/evaluation/chords.py#L428-L491 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/robotparser.py | python | RobotFileParser.can_fetch | (self, useragent, url) | return True | using the parsed robots.txt decide if useragent can fetch url | using the parsed robots.txt decide if useragent can fetch url | [
"using",
"the",
"parsed",
"robots",
".",
"txt",
"decide",
"if",
"useragent",
"can",
"fetch",
"url"
] | def can_fetch(self, useragent, url):
"""using the parsed robots.txt decide if useragent can fetch url"""
if self.disallow_all:
return False
if self.allow_all:
return True
# Until the robots.txt file has been read or found not
# to exist, we must assume th... | [
"def",
"can_fetch",
"(",
"self",
",",
"useragent",
",",
"url",
")",
":",
"if",
"self",
".",
"disallow_all",
":",
"return",
"False",
"if",
"self",
".",
"allow_all",
":",
"return",
"True",
"# Until the robots.txt file has been read or found not",
"# to exist, we must ... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/robotparser.py#L130-L159 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/jinja2/utils.py | python | LRUCache.clear | (self) | Clear the cache. | Clear the cache. | [
"Clear",
"the",
"cache",
"."
] | def clear(self):
"""Clear the cache."""
self._wlock.acquire()
try:
self._mapping.clear()
self._queue.clear()
finally:
self._wlock.release() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_wlock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_mapping",
".",
"clear",
"(",
")",
"self",
".",
"_queue",
".",
"clear",
"(",
")",
"finally",
":",
"self",
".",
"_wlock",
".",
"relea... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/jinja2/utils.py#L369-L376 | ||
apple/coremltools | 141a83af482fcbdd5179807c9eaff9a7999c2c49 | deps/protobuf/python/google/protobuf/internal/python_message.py | python | _ExtensionDict.__getitem__ | (self, extension_handle) | return result | Returns the current value of the given extension handle. | Returns the current value of the given extension handle. | [
"Returns",
"the",
"current",
"value",
"of",
"the",
"given",
"extension",
"handle",
"."
] | def __getitem__(self, extension_handle):
"""Returns the current value of the given extension handle."""
_VerifyExtensionHandle(self._extended_message, extension_handle)
result = self._extended_message._fields.get(extension_handle)
if result is not None:
return result
if extension_handle.lab... | [
"def",
"__getitem__",
"(",
"self",
",",
"extension_handle",
")",
":",
"_VerifyExtensionHandle",
"(",
"self",
".",
"_extended_message",
",",
"extension_handle",
")",
"result",
"=",
"self",
".",
"_extended_message",
".",
"_fields",
".",
"get",
"(",
"extension_handle... | https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/deps/protobuf/python/google/protobuf/internal/python_message.py#L1441-L1472 | |
vcheckzen/FODI | 3bb23644938a33c3fdfb9611a622e35ed4ce6532 | back-end-py/main/3rd/Crypto/Cipher/_mode_ccm.py | python | CcmMode.encrypt | (self, plaintext, output=None) | return self._cipher.encrypt(plaintext, output=output) | Encrypt data with the key set at initialization.
A cipher object is stateful: once you have encrypted a message
you cannot encrypt (or decrypt) another message using the same
object.
This method can be called only **once** if ``msg_len`` was
not passed at initialization.
... | Encrypt data with the key set at initialization. | [
"Encrypt",
"data",
"with",
"the",
"key",
"set",
"at",
"initialization",
"."
] | def encrypt(self, plaintext, output=None):
"""Encrypt data with the key set at initialization.
A cipher object is stateful: once you have encrypted a message
you cannot encrypt (or decrypt) another message using the same
object.
This method can be called only **once** if ``msg_... | [
"def",
"encrypt",
"(",
"self",
",",
"plaintext",
",",
"output",
"=",
"None",
")",
":",
"if",
"self",
".",
"encrypt",
"not",
"in",
"self",
".",
"_next",
":",
"raise",
"TypeError",
"(",
"\"encrypt() can only be called after\"",
"\" initialization or an update()\"",
... | https://github.com/vcheckzen/FODI/blob/3bb23644938a33c3fdfb9611a622e35ed4ce6532/back-end-py/main/3rd/Crypto/Cipher/_mode_ccm.py#L302-L373 | |
brightmart/multi-label_classification | b5febe17eaf9d937d71cabab56c5da48ee68f7b5 | bert/modeling.py | python | BertModel.get_sequence_output | (self) | return self.sequence_output | Gets final hidden layer of encoder.
Returns:
float Tensor of shape [batch_size, seq_length, hidden_size] corresponding
to the final hidden of the transformer encoder. | Gets final hidden layer of encoder. | [
"Gets",
"final",
"hidden",
"layer",
"of",
"encoder",
"."
] | def get_sequence_output(self):
"""Gets final hidden layer of encoder.
Returns:
float Tensor of shape [batch_size, seq_length, hidden_size] corresponding
to the final hidden of the transformer encoder.
"""
return self.sequence_output | [
"def",
"get_sequence_output",
"(",
"self",
")",
":",
"return",
"self",
".",
"sequence_output"
] | https://github.com/brightmart/multi-label_classification/blob/b5febe17eaf9d937d71cabab56c5da48ee68f7b5/bert/modeling.py#L237-L244 | |
City-Bureau/city-scrapers | b295d0aa612e3979a9fccab7c5f55ecea9ed074c | city_scrapers/spiders/il_governors_state_university.py | python | IlGovernorsStateUniversitySpider._parse_links | (self, item, response) | return links | Parse or generate links. | Parse or generate links. | [
"Parse",
"or",
"generate",
"links",
"."
] | def _parse_links(self, item, response):
"""Parse or generate links."""
links = []
# the links to the agenda, if present, are in the third and fourth columns
for col in [2, 3]:
for link_parent in item[col].xpath("a"):
link_ext = link_parent.css("::attr(href)").... | [
"def",
"_parse_links",
"(",
"self",
",",
"item",
",",
"response",
")",
":",
"links",
"=",
"[",
"]",
"# the links to the agenda, if present, are in the third and fourth columns",
"for",
"col",
"in",
"[",
"2",
",",
"3",
"]",
":",
"for",
"link_parent",
"in",
"item"... | https://github.com/City-Bureau/city-scrapers/blob/b295d0aa612e3979a9fccab7c5f55ecea9ed074c/city_scrapers/spiders/il_governors_state_university.py#L227-L238 | |
geex-arts/django-jet | 06ab6436d8add9aafcf771df40358409564e6bcb | jet/dashboard/dashboard.py | python | DashboardUrls.get_urls | (self) | return self._urls | [] | def get_urls(self):
return self._urls | [
"def",
"get_urls",
"(",
"self",
")",
":",
"return",
"self",
".",
"_urls"
] | https://github.com/geex-arts/django-jet/blob/06ab6436d8add9aafcf771df40358409564e6bcb/jet/dashboard/dashboard.py#L308-L309 | |||
kerlomz/captcha_platform | f7d719bd1239a987996e266bd7fe35c96003b378 | sdk/onnx/sdk.py | python | ModelConfig.category_extract | (param) | [] | def category_extract(param):
if isinstance(param, list):
return param
if isinstance(param, str):
if param in SIMPLE_CATEGORY_MODEL.keys():
return SIMPLE_CATEGORY_MODEL.get(param)
raise ValueError(
"Category set configuration error, cust... | [
"def",
"category_extract",
"(",
"param",
")",
":",
"if",
"isinstance",
"(",
"param",
",",
"list",
")",
":",
"return",
"param",
"if",
"isinstance",
"(",
"param",
",",
"str",
")",
":",
"if",
"param",
"in",
"SIMPLE_CATEGORY_MODEL",
".",
"keys",
"(",
")",
... | https://github.com/kerlomz/captcha_platform/blob/f7d719bd1239a987996e266bd7fe35c96003b378/sdk/onnx/sdk.py#L249-L257 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pyparsing-2.3.1-py3.7.egg/pyparsing.py | python | ParseResults.copy | ( self ) | return ret | Returns a new copy of a :class:`ParseResults` object. | Returns a new copy of a :class:`ParseResults` object. | [
"Returns",
"a",
"new",
"copy",
"of",
"a",
":",
"class",
":",
"ParseResults",
"object",
"."
] | def copy( self ):
"""
Returns a new copy of a :class:`ParseResults` object.
"""
ret = ParseResults( self.__toklist )
ret.__tokdict = dict(self.__tokdict.items())
ret.__parent = self.__parent
ret.__accumNames.update( self.__accumNames )
ret.__name = self.__... | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"ParseResults",
"(",
"self",
".",
"__toklist",
")",
"ret",
".",
"__tokdict",
"=",
"dict",
"(",
"self",
".",
"__tokdict",
".",
"items",
"(",
")",
")",
"ret",
".",
"__parent",
"=",
"self",
".",
"__par... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pyparsing-2.3.1-py3.7.egg/pyparsing.py#L875-L884 | |
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/dialects/mysql/types.py | python | TINYINT.__init__ | (self, display_width=None, **kw) | Construct a TINYINT.
:param display_width: Optional, maximum display width for this number.
:param unsigned: a boolean, optional.
:param zerofill: Optional. If true, values will be stored as strings
left-padded with zeros. Note that this does not effect the values
returned... | Construct a TINYINT. | [
"Construct",
"a",
"TINYINT",
"."
] | def __init__(self, display_width=None, **kw):
"""Construct a TINYINT.
:param display_width: Optional, maximum display width for this number.
:param unsigned: a boolean, optional.
:param zerofill: Optional. If true, values will be stored as strings
left-padded with zeros. Not... | [
"def",
"__init__",
"(",
"self",
",",
"display_width",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"super",
"(",
"TINYINT",
",",
"self",
")",
".",
"__init__",
"(",
"display_width",
"=",
"display_width",
",",
"*",
"*",
"kw",
")"
] | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/dialects/mysql/types.py#L320-L333 | ||
moonnejs/uiKLine | 08646956bd1d729c88d5d2617bf0599eb3efb3d1 | uiKLine.py | python | KLineWidget.updateSig | (self,sig) | 刷新买卖信号 | 刷新买卖信号 | [
"刷新买卖信号"
] | def updateSig(self,sig):
"""刷新买卖信号"""
self.listSig = sig
self.plotMark() | [
"def",
"updateSig",
"(",
"self",
",",
"sig",
")",
":",
"self",
".",
"listSig",
"=",
"sig",
"self",
".",
"plotMark",
"(",
")"
] | https://github.com/moonnejs/uiKLine/blob/08646956bd1d729c88d5d2617bf0599eb3efb3d1/uiKLine.py#L728-L731 | ||
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/modules/data_pump/data_pump.py | python | DataPumpJob._maybe_create_course_dataset | (self, service, bigquery_settings) | Create dataset within BigQuery if it's not already there. | Create dataset within BigQuery if it's not already there. | [
"Create",
"dataset",
"within",
"BigQuery",
"if",
"it",
"s",
"not",
"already",
"there",
"."
] | def _maybe_create_course_dataset(self, service, bigquery_settings):
"""Create dataset within BigQuery if it's not already there."""
datasets = service.datasets()
try:
datasets.get(projectId=bigquery_settings.project_id,
datasetId=bigquery_settings.dataset_id)... | [
"def",
"_maybe_create_course_dataset",
"(",
"self",
",",
"service",
",",
"bigquery_settings",
")",
":",
"datasets",
"=",
"service",
".",
"datasets",
"(",
")",
"try",
":",
"datasets",
".",
"get",
"(",
"projectId",
"=",
"bigquery_settings",
".",
"project_id",
",... | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/data_pump/data_pump.py#L445-L459 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/generators.py | python | rubik | (n) | return g | Return permutations for an nxn Rubik's cube.
Permutations returned are for rotation of each of the slice
from the face up to the last face for each of the 3 sides (in this order):
front, right and bottom. Hence, the first n - 1 permutations are for the
slices from the front. | Return permutations for an nxn Rubik's cube. | [
"Return",
"permutations",
"for",
"an",
"nxn",
"Rubik",
"s",
"cube",
"."
] | def rubik(n):
"""Return permutations for an nxn Rubik's cube.
Permutations returned are for rotation of each of the slice
from the face up to the last face for each of the 3 sides (in this order):
front, right and bottom. Hence, the first n - 1 permutations are for the
slices from the front.
""... | [
"def",
"rubik",
"(",
"n",
")",
":",
"if",
"n",
"<",
"2",
":",
"raise",
"ValueError",
"(",
"'dimension of cube must be > 1'",
")",
"# 1-based reference to rows and columns in Matrix",
"def",
"getr",
"(",
"f",
",",
"i",
")",
":",
"return",
"faces",
"[",
"f",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/generators.py#L130-L313 | |
Blockstream/satellite | ceb46a00e176c43a6b4170359f6948663a0616bb | blocksatcli/api/msg.py | python | ApiMsg.serialize | (self, target='original') | Serialize data to stdout
Args:
target : Target bytes array to print (original, encapsulated or
encrypted). | Serialize data to stdout | [
"Serialize",
"data",
"to",
"stdout"
] | def serialize(self, target='original'):
"""Serialize data to stdout
Args:
target : Target bytes array to print (original, encapsulated or
encrypted).
"""
data = self.get_data(target)
assert (isinstance(data, bytes))
sys.stdout.buffer.wri... | [
"def",
"serialize",
"(",
"self",
",",
"target",
"=",
"'original'",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"target",
")",
"assert",
"(",
"isinstance",
"(",
"data",
",",
"bytes",
")",
")",
"sys",
".",
"stdout",
".",
"buffer",
".",
"write"... | https://github.com/Blockstream/satellite/blob/ceb46a00e176c43a6b4170359f6948663a0616bb/blocksatcli/api/msg.py#L491-L502 | ||
photonlines/Python-Prolog-Interpreter | 1e208bf20b332ab92b50e1926afe365f95f66811 | prologpy/interpreter.py | python | Variable.substitute_variable_bindings | (self, variable_bindings) | return self | Fetch the currently bound variable value for our variable and return the
substituted bindings if our variable is mapped. If our variable isn't mapped,
we simply return the variable as the substitute. | Fetch the currently bound variable value for our variable and return the
substituted bindings if our variable is mapped. If our variable isn't mapped,
we simply return the variable as the substitute. | [
"Fetch",
"the",
"currently",
"bound",
"variable",
"value",
"for",
"our",
"variable",
"and",
"return",
"the",
"substituted",
"bindings",
"if",
"our",
"variable",
"is",
"mapped",
".",
"If",
"our",
"variable",
"isn",
"t",
"mapped",
"we",
"simply",
"return",
"th... | def substitute_variable_bindings(self, variable_bindings):
"""Fetch the currently bound variable value for our variable and return the
substituted bindings if our variable is mapped. If our variable isn't mapped,
we simply return the variable as the substitute. """
bound_variable_value =... | [
"def",
"substitute_variable_bindings",
"(",
"self",
",",
"variable_bindings",
")",
":",
"bound_variable_value",
"=",
"variable_bindings",
".",
"get",
"(",
"self",
")",
"if",
"bound_variable_value",
":",
"return",
"bound_variable_value",
".",
"substitute_variable_bindings"... | https://github.com/photonlines/Python-Prolog-Interpreter/blob/1e208bf20b332ab92b50e1926afe365f95f66811/prologpy/interpreter.py#L125-L136 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/logging/__init__.py | python | Filterer.__init__ | (self) | Initialize the list of filters to be an empty list. | Initialize the list of filters to be an empty list. | [
"Initialize",
"the",
"list",
"of",
"filters",
"to",
"be",
"an",
"empty",
"list",
"."
] | def __init__(self):
"""
Initialize the list of filters to be an empty list.
"""
self.filters = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"filters",
"=",
"[",
"]"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/logging/__init__.py#L673-L677 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/customer_user_access_service/client.py | python | CustomerUserAccessServiceClient.from_service_account_file | (cls, filename: str, *args, **kwargs) | return cls(*args, **kwargs) | Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the con... | Creates an instance of this client using the provided credentials
file. | [
"Creates",
"an",
"instance",
"of",
"this",
"client",
"using",
"the",
"provided",
"credentials",
"file",
"."
] | def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass ... | [
"def",
"from_service_account_file",
"(",
"cls",
",",
"filename",
":",
"str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"credentials",
"=",
"service_account",
".",
"Credentials",
".",
"from_service_account_file",
"(",
"filename",
")",
"kwargs",
"[",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/customer_user_access_service/client.py#L135-L152 | |
MichaelGrupp/evo | c65af3b69188aaadbbd7b5f99ac7973d74343d65 | evo/core/transformations.py | python | quaternion_from_euler | (ai, aj, ak, axes='sxyz') | return q | Return quaternion from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
>>> numpy.allclose(q, [0.435953, 0.310622, -0.718287, 0.444435])
True | Return quaternion from Euler angles and axis sequence. | [
"Return",
"quaternion",
"from",
"Euler",
"angles",
"and",
"axis",
"sequence",
"."
] | def quaternion_from_euler(ai, aj, ak, axes='sxyz'):
"""Return quaternion from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
>>> numpy.allclose(q, [0.435953, 0... | [
"def",
"quaternion_from_euler",
"(",
"ai",
",",
"aj",
",",
"ak",
",",
"axes",
"=",
"'sxyz'",
")",
":",
"try",
":",
"firstaxis",
",",
"parity",
",",
"repetition",
",",
"frame",
"=",
"_AXES2TUPLE",
"[",
"axes",
".",
"lower",
"(",
")",
"]",
"except",
"(... | https://github.com/MichaelGrupp/evo/blob/c65af3b69188aaadbbd7b5f99ac7973d74343d65/evo/core/transformations.py#L1185-L1239 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/combinatorics/perm_groups.py | python | _stabilizer | (degree, generators, alpha) | return [_af_new(x) for x in stab_gens] | r"""Return the stabilizer subgroup of ``alpha``.
The stabilizer of `\alpha` is the group `G_\alpha =
\{g \in G | g(\alpha) = \alpha\}`.
For a proof of correctness, see [1], p.79.
degree : degree of G
generators : generators of G
Examples
========
>>> from sympy.combinatorics ... | r"""Return the stabilizer subgroup of ``alpha``. | [
"r",
"Return",
"the",
"stabilizer",
"subgroup",
"of",
"alpha",
"."
] | def _stabilizer(degree, generators, alpha):
r"""Return the stabilizer subgroup of ``alpha``.
The stabilizer of `\alpha` is the group `G_\alpha =
\{g \in G | g(\alpha) = \alpha\}`.
For a proof of correctness, see [1], p.79.
degree : degree of G
generators : generators of G
Examples... | [
"def",
"_stabilizer",
"(",
"degree",
",",
"generators",
",",
"alpha",
")",
":",
"orb",
"=",
"[",
"alpha",
"]",
"table",
"=",
"{",
"alpha",
":",
"list",
"(",
"range",
"(",
"degree",
")",
")",
"}",
"table_inv",
"=",
"{",
"alpha",
":",
"list",
"(",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/perm_groups.py#L4961-L5008 | |
Ericsson/codechecker | c4e43f62dc3acbf71d3109b337db7c97f7852f43 | analyzer/codechecker_analyzer/analyzer_context.py | python | Context.__init_env | (self) | Set environment variables. | Set environment variables. | [
"Set",
"environment",
"variables",
"."
] | def __init_env(self):
""" Set environment variables. """
# Get generic package specific environment variables.
self.logger_bin = os.environ.get(self.env_vars['cc_logger_bin'])
self.logger_file = os.environ.get(self.env_vars['cc_logger_file'])
self.logger_compilers = os.environ.ge... | [
"def",
"__init_env",
"(",
"self",
")",
":",
"# Get generic package specific environment variables.",
"self",
".",
"logger_bin",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"self",
".",
"env_vars",
"[",
"'cc_logger_bin'",
"]",
")",
"self",
".",
"logger_file",
"="... | https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/analyzer/codechecker_analyzer/analyzer_context.py#L106-L114 | ||
mikedh/trimesh | 6b1e05616b44e6dd708d9bc748b211656ebb27ec | trimesh/base.py | python | Trimesh.face_adjacency_edges | (self) | return self._cache['face_adjacency_edges'] | Returns the edges that are shared by the adjacent faces.
Returns
--------
edges : (n, 2) int
Vertex indices which correspond to face_adjacency | Returns the edges that are shared by the adjacent faces. | [
"Returns",
"the",
"edges",
"that",
"are",
"shared",
"by",
"the",
"adjacent",
"faces",
"."
] | def face_adjacency_edges(self):
"""
Returns the edges that are shared by the adjacent faces.
Returns
--------
edges : (n, 2) int
Vertex indices which correspond to face_adjacency
"""
# this value is calculated as a byproduct of the face adjacency
... | [
"def",
"face_adjacency_edges",
"(",
"self",
")",
":",
"# this value is calculated as a byproduct of the face adjacency",
"populate",
"=",
"self",
".",
"face_adjacency",
"return",
"self",
".",
"_cache",
"[",
"'face_adjacency_edges'",
"]"
] | https://github.com/mikedh/trimesh/blob/6b1e05616b44e6dd708d9bc748b211656ebb27ec/trimesh/base.py#L1333-L1344 | |
SeldonIO/alibi | ce961caf995d22648a8338857822c90428af4765 | alibi/explainers/backends/pytorch/cfrl_base.py | python | PtCounterfactualRLDataset.__init__ | (self,
X: np.ndarray,
preprocessor: Callable,
predictor: Callable,
conditional_func: Callable,
batch_size: int) | Constructor.
Parameters
----------
X
Array of input instances. The input should NOT be preprocessed as it will be preprocessed when calling
the `preprocessor` function.
preprocessor
Preprocessor function. This function correspond to the preprocessing ... | Constructor. | [
"Constructor",
"."
] | def __init__(self,
X: np.ndarray,
preprocessor: Callable,
predictor: Callable,
conditional_func: Callable,
batch_size: int) -> None:
"""
Constructor.
Parameters
----------
X
Array of... | [
"def",
"__init__",
"(",
"self",
",",
"X",
":",
"np",
".",
"ndarray",
",",
"preprocessor",
":",
"Callable",
",",
"predictor",
":",
"Callable",
",",
"conditional_func",
":",
"Callable",
",",
"batch_size",
":",
"int",
")",
"->",
"None",
":",
"super",
"(",
... | https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/backends/pytorch/cfrl_base.py#L26-L73 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py | python | _mboxMMDFMessage.get_flags | (self) | return self.get('Status', '') + self.get('X-Status', '') | Return as a string the flags that are set. | Return as a string the flags that are set. | [
"Return",
"as",
"a",
"string",
"the",
"flags",
"that",
"are",
"set",
"."
] | def get_flags(self):
"""Return as a string the flags that are set."""
return self.get('Status', '') + self.get('X-Status', '') | [
"def",
"get_flags",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"'Status'",
",",
"''",
")",
"+",
"self",
".",
"get",
"(",
"'X-Status'",
",",
"''",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py#L1552-L1554 | |
EricSteinberger/PokerRL | e02ea667061b96912e424231da071b6f20a262f7 | PokerRL/game/_/look_up_table.py | python | _LutGetterHoldem.get_idx_2_hole_card_LUT | (self) | return self.cpp_backend.get_idx_2_hole_card_lut() | [] | def get_idx_2_hole_card_LUT(self):
return self.cpp_backend.get_idx_2_hole_card_lut() | [
"def",
"get_idx_2_hole_card_LUT",
"(",
"self",
")",
":",
"return",
"self",
".",
"cpp_backend",
".",
"get_idx_2_hole_card_lut",
"(",
")"
] | https://github.com/EricSteinberger/PokerRL/blob/e02ea667061b96912e424231da071b6f20a262f7/PokerRL/game/_/look_up_table.py#L115-L116 | |||
JinpengLI/deep_ocr | 450148c0c51b3565a96ac2f3c94ee33022e55307 | deep_ocr/ocrolib/morph.py | python | spread_labels | (labels,maxdist=9999999) | return spread | Spread the given labels to the background | Spread the given labels to the background | [
"Spread",
"the",
"given",
"labels",
"to",
"the",
"background"
] | def spread_labels(labels,maxdist=9999999):
"""Spread the given labels to the background"""
distances,features = morphology.distance_transform_edt(labels==0,return_distances=1,return_indices=1)
indexes = features[0]*labels.shape[1]+features[1]
spread = labels.ravel()[indexes.ravel()].reshape(*labels.shap... | [
"def",
"spread_labels",
"(",
"labels",
",",
"maxdist",
"=",
"9999999",
")",
":",
"distances",
",",
"features",
"=",
"morphology",
".",
"distance_transform_edt",
"(",
"labels",
"==",
"0",
",",
"return_distances",
"=",
"1",
",",
"return_indices",
"=",
"1",
")"... | https://github.com/JinpengLI/deep_ocr/blob/450148c0c51b3565a96ac2f3c94ee33022e55307/deep_ocr/ocrolib/morph.py#L127-L133 | |
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/excel.py | python | Range.insert_range | (self, shift) | return self._get_range('insert_range', method='POST', shift=shift.capitalize()) | Inserts a cell or a range of cells into the worksheet in place of this range,
and shifts the other cells to make space.
:param str shift: Specifies which way to shift the cells. The possible values are: down, right.
:return: new Range instance at the now blank space | Inserts a cell or a range of cells into the worksheet in place of this range,
and shifts the other cells to make space.
:param str shift: Specifies which way to shift the cells. The possible values are: down, right.
:return: new Range instance at the now blank space | [
"Inserts",
"a",
"cell",
"or",
"a",
"range",
"of",
"cells",
"into",
"the",
"worksheet",
"in",
"place",
"of",
"this",
"range",
"and",
"shifts",
"the",
"other",
"cells",
"to",
"make",
"space",
".",
":",
"param",
"str",
"shift",
":",
"Specifies",
"which",
... | def insert_range(self, shift):
"""
Inserts a cell or a range of cells into the worksheet in place of this range,
and shifts the other cells to make space.
:param str shift: Specifies which way to shift the cells. The possible values are: down, right.
:return: new Range instance a... | [
"def",
"insert_range",
"(",
"self",
",",
"shift",
")",
":",
"return",
"self",
".",
"_get_range",
"(",
"'insert_range'",
",",
"method",
"=",
"'POST'",
",",
"shift",
"=",
"shift",
".",
"capitalize",
"(",
")",
")"
] | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/excel.py#L788-L795 | |
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/core/serializers/xml_serializer.py | python | Serializer.end_object | (self, obj) | Called after handling all fields for an object. | Called after handling all fields for an object. | [
"Called",
"after",
"handling",
"all",
"fields",
"for",
"an",
"object",
"."
] | def end_object(self, obj):
"""
Called after handling all fields for an object.
"""
self.indent(1)
self.xml.endElement("object") | [
"def",
"end_object",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"indent",
"(",
"1",
")",
"self",
".",
"xml",
".",
"endElement",
"(",
"\"object\"",
")"
] | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/core/serializers/xml_serializer.py#L60-L65 | ||
vaexio/vaex | 6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac | packages/vaex-core/vaex/logging.py | python | set_log_level_info | (loggers=["vaex"]) | set log level to info | set log level to info | [
"set",
"log",
"level",
"to",
"info"
] | def set_log_level_info(loggers=["vaex"]):
"""set log level to info"""
set_log_level(loggers, logging.INFO) | [
"def",
"set_log_level_info",
"(",
"loggers",
"=",
"[",
"\"vaex\"",
"]",
")",
":",
"set_log_level",
"(",
"loggers",
",",
"logging",
".",
"INFO",
")"
] | https://github.com/vaexio/vaex/blob/6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac/packages/vaex-core/vaex/logging.py#L25-L27 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/pex_builder.py | python | PEXBuilder.freeze | (self, bytecode_compile=True) | Freeze the PEX.
:param bytecode_compile: If True, precompile .py files into .pyc files when freezing code.
Freezing the PEX writes all the necessary metadata and environment bootstrapping code. It may
only be called once and renders the PEXBuilder immutable. | Freeze the PEX. | [
"Freeze",
"the",
"PEX",
"."
] | def freeze(self, bytecode_compile=True):
"""Freeze the PEX.
:param bytecode_compile: If True, precompile .py files into .pyc files when freezing code.
Freezing the PEX writes all the necessary metadata and environment bootstrapping code. It may
only be called once and renders the PEXB... | [
"def",
"freeze",
"(",
"self",
",",
"bytecode_compile",
"=",
"True",
")",
":",
"self",
".",
"_ensure_unfrozen",
"(",
"\"Freezing the environment\"",
")",
"self",
".",
"_prepare_bootstrap",
"(",
")",
"self",
".",
"_prepare_code",
"(",
")",
"if",
"bytecode_compile"... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/pex_builder.py#L598-L611 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/idlelib/rpc.py | python | RPCServer.handle_error | (self, request, client_address) | Override TCPServer method
Error message goes to __stderr__. No error message if exiting
normally or socket raised EOF. Other exceptions not handled in
server code will cause os._exit. | Override TCPServer method
Error message goes to __stderr__. No error message if exiting
normally or socket raised EOF. Other exceptions not handled in
server code will cause os._exit. | [
"Override",
"TCPServer",
"method",
"Error",
"message",
"goes",
"to",
"__stderr__",
".",
"No",
"error",
"message",
"if",
"exiting",
"normally",
"or",
"socket",
"raised",
"EOF",
".",
"Other",
"exceptions",
"not",
"handled",
"in",
"server",
"code",
"will",
"cause... | def handle_error(self, request, client_address):
"""Override TCPServer method
Error message goes to __stderr__. No error message if exiting
normally or socket raised EOF. Other exceptions not handled in
server code will cause os._exit.
"""
try:
... | [
"def",
"handle_error",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"try",
":",
"raise",
"except",
"SystemExit",
":",
"raise",
"except",
":",
"erf",
"=",
"sys",
".",
"__stderr__",
"print",
">>",
"erf",
",",
"'\\n'",
"+",
"'-'",
"*",
"4... | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/idlelib/rpc.py#L89-L111 | ||
openembedded/bitbake | 98407efc8c670abd71d3fa88ec3776ee9b5c38f3 | lib/layerindexlib/__init__.py | python | LayerIndex._parse_params | (self, params) | return param_dict | Take a parameter list, return a dictionary of parameters.
Expected to be called from the data of urllib.parse.urlparse(url).params
If there are two conflicting parameters, last in wins... | Take a parameter list, return a dictionary of parameters. | [
"Take",
"a",
"parameter",
"list",
"return",
"a",
"dictionary",
"of",
"parameters",
"."
] | def _parse_params(self, params):
'''Take a parameter list, return a dictionary of parameters.
Expected to be called from the data of urllib.parse.urlparse(url).params
If there are two conflicting parameters, last in wins...
'''
param_dict = {}
for param in params... | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
")",
":",
"param_dict",
"=",
"{",
"}",
"for",
"param",
"in",
"params",
".",
"split",
"(",
"';'",
")",
":",
"if",
"not",
"param",
":",
"continue",
"item",
"=",
"param",
".",
"split",
"(",
"'='",
",... | https://github.com/openembedded/bitbake/blob/98407efc8c670abd71d3fa88ec3776ee9b5c38f3/lib/layerindexlib/__init__.py#L83-L99 | |
Azure/azure-iot-sdk-python | 51fa810907373fd2134af49bd03d3977ca7a9a8d | azure-iot-hub/azure/iot/hub/iothub_configuration_manager.py | python | IoTHubConfigurationManager.create_configuration | (self, configuration) | return self.protocol.configuration.create_or_update(configuration.id, configuration) | Creates a configuration for devices or modules of an IoTHub.
:param str configuration_id: The id of the configuration.
:param Configuration configuration: The configuration to create.
:raises: `HttpOperationError<msrest.exceptions.HttpOperationError>`
if the HTTP response status is... | Creates a configuration for devices or modules of an IoTHub. | [
"Creates",
"a",
"configuration",
"for",
"devices",
"or",
"modules",
"of",
"an",
"IoTHub",
"."
] | def create_configuration(self, configuration):
"""Creates a configuration for devices or modules of an IoTHub.
:param str configuration_id: The id of the configuration.
:param Configuration configuration: The configuration to create.
:raises: `HttpOperationError<msrest.exceptions.HttpO... | [
"def",
"create_configuration",
"(",
"self",
",",
"configuration",
")",
":",
"return",
"self",
".",
"protocol",
".",
"configuration",
".",
"create_or_update",
"(",
"configuration",
".",
"id",
",",
"configuration",
")"
] | https://github.com/Azure/azure-iot-sdk-python/blob/51fa810907373fd2134af49bd03d3977ca7a9a8d/azure-iot-hub/azure/iot/hub/iothub_configuration_manager.py#L85-L96 | |
theislab/anndata | 664e32b0aa6625fe593370d37174384c05abfd4e | anndata/_core/sparse_dataset.py | python | get_backed_class | (format_str: str) | [] | def get_backed_class(format_str: str) -> Type[BackedSparseMatrix]:
for fmt, backed_class, _ in FORMATS:
if format_str == fmt:
return backed_class
raise ValueError(f"Format string {format_str} is not supported.") | [
"def",
"get_backed_class",
"(",
"format_str",
":",
"str",
")",
"->",
"Type",
"[",
"BackedSparseMatrix",
"]",
":",
"for",
"fmt",
",",
"backed_class",
",",
"_",
"in",
"FORMATS",
":",
"if",
"format_str",
"==",
"fmt",
":",
"return",
"backed_class",
"raise",
"V... | https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/sparse_dataset.py#L223-L227 | ||||
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/modules/vmware/__init__.py | python | VMware.preferencePages | () | return [VMwarePreferencesPage, VMwareVMPreferencesPage] | Returns the preference pages for this module.
:returns: QWidget object list | Returns the preference pages for this module. | [
"Returns",
"the",
"preference",
"pages",
"for",
"this",
"module",
"."
] | def preferencePages():
"""
Returns the preference pages for this module.
:returns: QWidget object list
"""
from .pages.vmware_preferences_page import VMwarePreferencesPage
from .pages.vmware_vm_preferences_page import VMwareVMPreferencesPage
return [VMwarePrefer... | [
"def",
"preferencePages",
"(",
")",
":",
"from",
".",
"pages",
".",
"vmware_preferences_page",
"import",
"VMwarePreferencesPage",
"from",
".",
"pages",
".",
"vmware_vm_preferences_page",
"import",
"VMwareVMPreferencesPage",
"return",
"[",
"VMwarePreferencesPage",
",",
"... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/modules/vmware/__init__.py#L270-L279 | |
Walleclipse/ChineseAddress_OCR | ca7929c72cbac09c71501f06bf16c387f42f00cf | ctpn/lib/roi_data_layer/minibatch.py | python | _get_bbox_regression_labels | (bbox_target_data, num_classes) | return bbox_targets, bbox_inside_weights | Bounding-box regression targets are stored in a compact form in the
roidb.
This function expands those targets into the 4-of-4*K representation used
by the network (i.e. only one class has non-zero targets). The loss weights
are similarly expanded.
Returns:
bbox_target_data (ndarray): N x ... | Bounding-box regression targets are stored in a compact form in the
roidb. | [
"Bounding",
"-",
"box",
"regression",
"targets",
"are",
"stored",
"in",
"a",
"compact",
"form",
"in",
"the",
"roidb",
"."
] | def _get_bbox_regression_labels(bbox_target_data, num_classes):
"""Bounding-box regression targets are stored in a compact form in the
roidb.
This function expands those targets into the 4-of-4*K representation used
by the network (i.e. only one class has non-zero targets). The loss weights
are sim... | [
"def",
"_get_bbox_regression_labels",
"(",
"bbox_target_data",
",",
"num_classes",
")",
":",
"clss",
"=",
"bbox_target_data",
"[",
":",
",",
"0",
"]",
"bbox_targets",
"=",
"np",
".",
"zeros",
"(",
"(",
"clss",
".",
"size",
",",
"4",
"*",
"num_classes",
")"... | https://github.com/Walleclipse/ChineseAddress_OCR/blob/ca7929c72cbac09c71501f06bf16c387f42f00cf/ctpn/lib/roi_data_layer/minibatch.py#L156-L178 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListItem.DeleteWindow | (self) | Deletes the window associated to the item (if any). | Deletes the window associated to the item (if any). | [
"Deletes",
"the",
"window",
"associated",
"to",
"the",
"item",
"(",
"if",
"any",
")",
"."
] | def DeleteWindow(self):
""" Deletes the window associated to the item (if any). """
if self._wnd:
listCtrl = self._wnd.GetParent()
if self in listCtrl._itemWithWindow:
listCtrl._itemWithWindow.remove(self)
self._wnd.Destroy()
self._wnd = N... | [
"def",
"DeleteWindow",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wnd",
":",
"listCtrl",
"=",
"self",
".",
"_wnd",
".",
"GetParent",
"(",
")",
"if",
"self",
"in",
"listCtrl",
".",
"_itemWithWindow",
":",
"listCtrl",
".",
"_itemWithWindow",
".",
"remove"... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L1984-L1992 | ||
travisgoodspeed/goodfet | 1750cc1e8588af5470385e52fa098ca7364c2863 | contrib/reCAN/mainDisplay.py | python | DisplayApp.idInfo | (self) | This method will open an info box for the user
to gain information on a known arbID | This method will open an info box for the user
to gain information on a known arbID | [
"This",
"method",
"will",
"open",
"an",
"info",
"box",
"for",
"the",
"user",
"to",
"gain",
"information",
"on",
"a",
"known",
"arbID"
] | def idInfo(self):
""" This method will open an info box for the user
to gain information on a known arbID"""
infoBox = info(parent=self.root, title="Information Gathered")
pass | [
"def",
"idInfo",
"(",
"self",
")",
":",
"infoBox",
"=",
"info",
"(",
"parent",
"=",
"self",
".",
"root",
",",
"title",
"=",
"\"Information Gathered\"",
")",
"pass"
] | https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/contrib/reCAN/mainDisplay.py#L2704-L2708 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/serverless/v1/service/function/function_version/__init__.py | python | FunctionVersionPage.__repr__ | (self) | return '<Twilio.Serverless.V1.FunctionVersionPage>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Serverless.V1.FunctionVersionPage>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Serverless.V1.FunctionVersionPage>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/serverless/v1/service/function/function_version/__init__.py#L195-L202 | |
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/deeplab/core/resnet_v1_beta.py | python | root_block_fn_for_beta_variant | (net, depth_multiplier=1.0) | return net | Gets root_block_fn for beta variant.
ResNet-v1 beta variant modifies the first original 7x7 convolution to three
3x3 convolutions.
Args:
net: A tensor of size [batch, height, width, channels], input to the model.
depth_multiplier: Controls the number of convolution output channels for
each input c... | Gets root_block_fn for beta variant. | [
"Gets",
"root_block_fn",
"for",
"beta",
"variant",
"."
] | def root_block_fn_for_beta_variant(net, depth_multiplier=1.0):
"""Gets root_block_fn for beta variant.
ResNet-v1 beta variant modifies the first original 7x7 convolution to three
3x3 convolutions.
Args:
net: A tensor of size [batch, height, width, channels], input to the model.
depth_multiplier: Contr... | [
"def",
"root_block_fn_for_beta_variant",
"(",
"net",
",",
"depth_multiplier",
"=",
"1.0",
")",
":",
"net",
"=",
"conv2d_ws",
".",
"conv2d_same",
"(",
"net",
",",
"int",
"(",
"64",
"*",
"depth_multiplier",
")",
",",
"3",
",",
"stride",
"=",
"2",
",",
"sco... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/deeplab/core/resnet_v1_beta.py#L154-L176 | |
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/bot/minimizer/minimizer.py | python | Testcase.get_current_testcase_data | (self) | return self.minimizer.token_combiner(self.get_required_tokens()) | Return the current test case data. | Return the current test case data. | [
"Return",
"the",
"current",
"test",
"case",
"data",
"."
] | def get_current_testcase_data(self):
"""Return the current test case data."""
return self.minimizer.token_combiner(self.get_required_tokens()) | [
"def",
"get_current_testcase_data",
"(",
"self",
")",
":",
"return",
"self",
".",
"minimizer",
".",
"token_combiner",
"(",
"self",
".",
"get_required_tokens",
"(",
")",
")"
] | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/bot/minimizer/minimizer.py#L177-L179 | |
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/vector/__init__.py | python | Cluster.__init__ | (self, *args, **kwargs) | A nested list of Cluster and Vector objects,
returned from hierarchical() clustering. | A nested list of Cluster and Vector objects,
returned from hierarchical() clustering. | [
"A",
"nested",
"list",
"of",
"Cluster",
"and",
"Vector",
"objects",
"returned",
"from",
"hierarchical",
"()",
"clustering",
"."
] | def __init__(self, *args, **kwargs):
""" A nested list of Cluster and Vector objects,
returned from hierarchical() clustering.
"""
list.__init__(self, *args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"list",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/__init__.py#L2094-L2098 | ||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | docs/refman/loaderbase.py | python | LoaderBase.input_files | (self) | return list(self._input_files) | [] | def input_files(self) -> T.List[Path]:
return list(self._input_files) | [
"def",
"input_files",
"(",
"self",
")",
"->",
"T",
".",
"List",
"[",
"Path",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_input_files",
")"
] | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/docs/refman/loaderbase.py#L198-L199 | |||
dmis-lab/biobert | 036f683797251328893b8f1dd6b0a3f5af29c922 | run_re.py | python | BioBERTDDIProcessor.get_train_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_train_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | [
"def",
"get_train_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"train.tsv\"",
")",
")",
",",
"\"train\"",
")"
] | https://github.com/dmis-lab/biobert/blob/036f683797251328893b8f1dd6b0a3f5af29c922/run_re.py#L380-L383 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/html5lib/treebuilders/_base.py | python | TreeBuilder.clearActiveFormattingElements | (self) | [] | def clearActiveFormattingElements(self):
entry = self.activeFormattingElements.pop()
while self.activeFormattingElements and entry != Marker:
entry = self.activeFormattingElements.pop() | [
"def",
"clearActiveFormattingElements",
"(",
"self",
")",
":",
"entry",
"=",
"self",
".",
"activeFormattingElements",
".",
"pop",
"(",
")",
"while",
"self",
".",
"activeFormattingElements",
"and",
"entry",
"!=",
"Marker",
":",
"entry",
"=",
"self",
".",
"activ... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/html5lib/treebuilders/_base.py#L227-L230 | ||||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_pslinux.py | python | Process.status | (self) | [] | def status(self):
with open("/proc/%s/status" % self.pid, 'rb') as f:
for line in f:
if line.startswith(b"State:"):
letter = line.split()[1]
if PY3:
letter = letter.decode()
# XXX is '?' legit? (we're... | [
"def",
"status",
"(",
"self",
")",
":",
"with",
"open",
"(",
"\"/proc/%s/status\"",
"%",
"self",
".",
"pid",
",",
"'rb'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"line",
".",
"startswith",
"(",
"b\"State:\"",
")",
":",
"letter",
"... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_pslinux.py#L1133-L1142 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/waterfall/increasing/_marker.py | python | Marker.color | (self) | return self["color"] | Sets the marker color of all increasing values.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,10... | Sets the marker color of all increasing values.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,10... | [
"Sets",
"the",
"marker",
"color",
"of",
"all",
"increasing",
"values",
".",
"The",
"color",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"... | def color(self):
"""
Sets the marker color of all increasing values.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/waterfall/increasing/_marker.py#L16-L66 | |
tjweir/liftbook | e977a7face13ade1a4558e1909a6951d2f8928dd | elyxer.py | python | HybridFunction.writeparam | (self, pos) | return self.params[name].value | Write a single param of the form $0, $x... | Write a single param of the form $0, $x... | [
"Write",
"a",
"single",
"param",
"of",
"the",
"form",
"$0",
"$x",
"..."
] | def writeparam(self, pos):
"Write a single param of the form $0, $x..."
name = '$' + pos.skipcurrent()
if not name in self.params:
Trace.error('Unknown parameter ' + name)
return None
if not self.params[name]:
return None
if pos.checkskip('.'):
self.params[name].value.type = ... | [
"def",
"writeparam",
"(",
"self",
",",
"pos",
")",
":",
"name",
"=",
"'$'",
"+",
"pos",
".",
"skipcurrent",
"(",
")",
"if",
"not",
"name",
"in",
"self",
".",
"params",
":",
"Trace",
".",
"error",
"(",
"'Unknown parameter '",
"+",
"name",
")",
"return... | https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L4802-L4812 | |
otsaloma/gaupol | 6dec7826654d223c71a8d3279dcd967e95c46714 | gaupol/dialogs/preview_error.py | python | PreviewErrorDialog._init_dialog | (self, parent) | Initialize the dialog. | Initialize the dialog. | [
"Initialize",
"the",
"dialog",
"."
] | def _init_dialog(self, parent):
"""Initialize the dialog."""
self.add_button(_("_Close"), Gtk.ResponseType.CLOSE)
self.set_default_response(Gtk.ResponseType.CLOSE)
self.set_transient_for(parent)
self.set_modal(True) | [
"def",
"_init_dialog",
"(",
"self",
",",
"parent",
")",
":",
"self",
".",
"add_button",
"(",
"_",
"(",
"\"_Close\"",
")",
",",
"Gtk",
".",
"ResponseType",
".",
"CLOSE",
")",
"self",
".",
"set_default_response",
"(",
"Gtk",
".",
"ResponseType",
".",
"CLOS... | https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/gaupol/dialogs/preview_error.py#L43-L48 | ||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/sqlalchemy/ext/associationproxy.py | python | AssociationProxy.contains | (self, obj) | Produce a proxied 'contains' expression using EXISTS.
This expression will be a composed product
using the :meth:`.RelationshipProperty.Comparator.any`
, :meth:`.RelationshipProperty.Comparator.has`,
and/or :meth:`.RelationshipProperty.Comparator.contains`
operators of the under... | Produce a proxied 'contains' expression using EXISTS. | [
"Produce",
"a",
"proxied",
"contains",
"expression",
"using",
"EXISTS",
"."
] | def contains(self, obj):
"""Produce a proxied 'contains' expression using EXISTS.
This expression will be a composed product
using the :meth:`.RelationshipProperty.Comparator.any`
, :meth:`.RelationshipProperty.Comparator.has`,
and/or :meth:`.RelationshipProperty.Comparator.cont... | [
"def",
"contains",
"(",
"self",
",",
"obj",
")",
":",
"if",
"self",
".",
"scalar",
"and",
"not",
"self",
".",
"_value_is_scalar",
":",
"return",
"self",
".",
"_comparator",
".",
"has",
"(",
"getattr",
"(",
"self",
".",
"target_class",
",",
"self",
".",... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/ext/associationproxy.py#L409-L424 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/fabmetheus_tools/interpret_plugins/xml_plugins/artofillusion.py | python | processElementNode | (elementNode) | Process the xml element. | Process the xml element. | [
"Process",
"the",
"xml",
"element",
"."
] | def processElementNode(elementNode):
"Process the xml element."
evaluate.processArchivable(group.Group, elementNode) | [
"def",
"processElementNode",
"(",
"elementNode",
")",
":",
"evaluate",
".",
"processArchivable",
"(",
"group",
".",
"Group",
",",
"elementNode",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/fabmetheus_tools/interpret_plugins/xml_plugins/artofillusion.py#L87-L89 | ||
netbox-community/netbox | 50309d3ab3da2212343e1d9feaf47e497df9c3cb | netbox/dcim/tables/devices.py | python | get_interface_state_attribute | (record) | Get interface enabled state as string to attach to <tr/> DOM element. | Get interface enabled state as string to attach to <tr/> DOM element. | [
"Get",
"interface",
"enabled",
"state",
"as",
"string",
"to",
"attach",
"to",
"<tr",
"/",
">",
"DOM",
"element",
"."
] | def get_interface_state_attribute(record):
"""
Get interface enabled state as string to attach to <tr/> DOM element.
"""
if record.enabled:
return "enabled"
else:
return "disabled" | [
"def",
"get_interface_state_attribute",
"(",
"record",
")",
":",
"if",
"record",
".",
"enabled",
":",
"return",
"\"enabled\"",
"else",
":",
"return",
"\"disabled\""
] | https://github.com/netbox-community/netbox/blob/50309d3ab3da2212343e1d9feaf47e497df9c3cb/netbox/dcim/tables/devices.py#L60-L67 | ||
electronut/pp | 7cb85df1e4bd68bd7cbc9a961409d8c362f15aeb | conway/conway.py | python | addGlider | (i, j, grid) | adds a glider with top left cell at (i, j) | adds a glider with top left cell at (i, j) | [
"adds",
"a",
"glider",
"with",
"top",
"left",
"cell",
"at",
"(",
"i",
"j",
")"
] | def addGlider(i, j, grid):
"""adds a glider with top left cell at (i, j)"""
glider = np.array([[0, 0, 255],
[255, 0, 255],
[0, 255, 255]])
grid[i:i+3, j:j+3] = glider | [
"def",
"addGlider",
"(",
"i",
",",
"j",
",",
"grid",
")",
":",
"glider",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"0",
",",
"255",
"]",
",",
"[",
"255",
",",
"0",
",",
"255",
"]",
",",
"[",
"0",
",",
"255",
",",
"255",
"]",
"]"... | https://github.com/electronut/pp/blob/7cb85df1e4bd68bd7cbc9a961409d8c362f15aeb/conway/conway.py#L22-L27 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_subject_rules_review_status.py | python | V1SubjectRulesReviewStatus.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_subject_rules_review_status.py#L193-L195 | |
wikimedia/pywikibot | 81a01ffaec7271bf5b4b170f85a80388420a4e78 | pywikibot/tools/djvu.py | python | DjVuFile._get_page_info | (self, force=False) | return self._page_info | Return a dict of tuples (id, (size, dpi)) for all pages of djvu file.
:param force: if True, refresh the cached data
:type force: bool | Return a dict of tuples (id, (size, dpi)) for all pages of djvu file. | [
"Return",
"a",
"dict",
"of",
"tuples",
"(",
"id",
"(",
"size",
"dpi",
"))",
"for",
"all",
"pages",
"of",
"djvu",
"file",
"."
] | def _get_page_info(self, force=False):
"""
Return a dict of tuples (id, (size, dpi)) for all pages of djvu file.
:param force: if True, refresh the cached data
:type force: bool
"""
if not hasattr(self, '_page_info'):
self._page_info = {}
res, st... | [
"def",
"_get_page_info",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_page_info'",
")",
":",
"self",
".",
"_page_info",
"=",
"{",
"}",
"res",
",",
"stdoutdata",
"=",
"_call_cmd",
"(",
"[",
"'djvudump'"... | https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/tools/djvu.py#L146-L185 | |
aiven/pghoard | 1de0d2e33bf087b7ce3b6af556bbf941acfac3a4 | pghoard/monitoring/prometheus.py | python | PrometheusClient.timing | (self, metric, value, tags=None) | [] | def timing(self, metric, value, tags=None):
self._update(metric, value, tags) | [
"def",
"timing",
"(",
"self",
",",
"metric",
",",
"value",
",",
"tags",
"=",
"None",
")",
":",
"self",
".",
"_update",
"(",
"metric",
",",
"value",
",",
"tags",
")"
] | https://github.com/aiven/pghoard/blob/1de0d2e33bf087b7ce3b6af556bbf941acfac3a4/pghoard/monitoring/prometheus.py#L20-L21 | ||||
chrivers/pyjaco | 8ad793dce34ab7aed3b973aae729d6a943a2381c | pyjaco/formater.py | python | Formater.write | (self, text, indent=True, newline=True) | Writes the string text to the buffer with indentation and a newline if not specified otherwise. | Writes the string text to the buffer with indentation and a newline if not specified otherwise. | [
"Writes",
"the",
"string",
"text",
"to",
"the",
"buffer",
"with",
"indentation",
"and",
"a",
"newline",
"if",
"not",
"specified",
"otherwise",
"."
] | def write(self, text, indent=True, newline=True):
"""
Writes the string text to the buffer with indentation and a newline if not specified otherwise.
"""
if indent:
self.__buffer.append(self.__indent_temp)
self.__buffer.append(text)
if newline:
sel... | [
"def",
"write",
"(",
"self",
",",
"text",
",",
"indent",
"=",
"True",
",",
"newline",
"=",
"True",
")",
":",
"if",
"indent",
":",
"self",
".",
"__buffer",
".",
"append",
"(",
"self",
".",
"__indent_temp",
")",
"self",
".",
"__buffer",
".",
"append",
... | https://github.com/chrivers/pyjaco/blob/8ad793dce34ab7aed3b973aae729d6a943a2381c/pyjaco/formater.py#L56-L64 | ||
jet-admin/jet-django | 9bd4536e02d581d39890d56190e8cc966e2714a4 | jet_django/deps/rest_framework/serializers.py | python | HyperlinkedModelSerializer.build_nested_field | (self, field_name, relation_info, nested_depth) | return field_class, field_kwargs | Create nested fields for forward and reverse relationships. | Create nested fields for forward and reverse relationships. | [
"Create",
"nested",
"fields",
"for",
"forward",
"and",
"reverse",
"relationships",
"."
] | def build_nested_field(self, field_name, relation_info, nested_depth):
"""
Create nested fields for forward and reverse relationships.
"""
class NestedSerializer(HyperlinkedModelSerializer):
class Meta:
model = relation_info.related_model
depth... | [
"def",
"build_nested_field",
"(",
"self",
",",
"field_name",
",",
"relation_info",
",",
"nested_depth",
")",
":",
"class",
"NestedSerializer",
"(",
"HyperlinkedModelSerializer",
")",
":",
"class",
"Meta",
":",
"model",
"=",
"relation_info",
".",
"related_model",
"... | https://github.com/jet-admin/jet-django/blob/9bd4536e02d581d39890d56190e8cc966e2714a4/jet_django/deps/rest_framework/serializers.py#L1600-L1613 | |
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | lib/layer/data.py | python | SimplePaintingLayer.flood_fill | (self, fill_args, dst_layer=None) | return self._surface.flood_fill(fill_args, dst=dst_layer._surface) | Fills a point on the surface with a color
:param fill_args: Parameters common to all fill calls
:type fill_args: lib.floodfill.FloodFillArguments
:param dst_layer: Optional target layer (default is self!)
:type dst_layer: StrokemappedPaintingLayer
The `tolerance` parameter cont... | Fills a point on the surface with a color | [
"Fills",
"a",
"point",
"on",
"the",
"surface",
"with",
"a",
"color"
] | def flood_fill(self, fill_args, dst_layer=None):
"""Fills a point on the surface with a color
:param fill_args: Parameters common to all fill calls
:type fill_args: lib.floodfill.FloodFillArguments
:param dst_layer: Optional target layer (default is self!)
:type dst_layer: Strok... | [
"def",
"flood_fill",
"(",
"self",
",",
"fill_args",
",",
"dst_layer",
"=",
"None",
")",
":",
"if",
"dst_layer",
"is",
"None",
":",
"dst_layer",
"=",
"self",
"dst_layer",
".",
"autosave_dirty",
"=",
"True",
"# XXX hmm, not working?",
"return",
"self",
".",
"_... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/layer/data.py#L1323-L1344 | |
nteract/scrapbook | 3c74e63f7df99cca3148182454797792aede4b9b | scrapbook/encoders.py | python | TextEncoder.encode | (self, scrap, **kwargs) | return scrap | [] | def encode(self, scrap, **kwargs):
if not isinstance(scrap.data, six.string_types):
# TODO: set encoder information to save as encoding
scrap = scrap._replace(data=str(scrap.data))
return scrap | [
"def",
"encode",
"(",
"self",
",",
"scrap",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"scrap",
".",
"data",
",",
"six",
".",
"string_types",
")",
":",
"# TODO: set encoder information to save as encoding",
"scrap",
"=",
"scrap",
".",... | https://github.com/nteract/scrapbook/blob/3c74e63f7df99cca3148182454797792aede4b9b/scrapbook/encoders.py#L170-L174 | |||
chartbeat-labs/textacy | 40cd12fe953ef8be5958cff93ad8762262f3b757 | src/textacy/lang_id/lang_identifier.py | python | LangIdentifier.save_model | (self) | Save trained :attr:`LangIdentifier.model` to disk, as bytes. | Save trained :attr:`LangIdentifier.model` to disk, as bytes. | [
"Save",
"trained",
":",
"attr",
":",
"LangIdentifier",
".",
"model",
"to",
"disk",
"as",
"bytes",
"."
] | def save_model(self):
"""Save trained :attr:`LangIdentifier.model` to disk, as bytes."""
LOGGER.info("saving LangIdentifier model to %s", self.model_fpath)
self.model.to_disk(self.model_fpath) | [
"def",
"save_model",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"\"saving LangIdentifier model to %s\"",
",",
"self",
".",
"model_fpath",
")",
"self",
".",
"model",
".",
"to_disk",
"(",
"self",
".",
"model_fpath",
")"
] | https://github.com/chartbeat-labs/textacy/blob/40cd12fe953ef8be5958cff93ad8762262f3b757/src/textacy/lang_id/lang_identifier.py#L112-L115 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/hunterdouglas_powerview/cover.py | python | PowerViewShade.async_set_cover_position | (self, **kwargs) | Move the shade to a specific position. | Move the shade to a specific position. | [
"Move",
"the",
"shade",
"to",
"a",
"specific",
"position",
"."
] | async def async_set_cover_position(self, **kwargs):
"""Move the shade to a specific position."""
if ATTR_POSITION not in kwargs:
return
await self._async_move(kwargs[ATTR_POSITION]) | [
"async",
"def",
"async_set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_POSITION",
"not",
"in",
"kwargs",
":",
"return",
"await",
"self",
".",
"_async_move",
"(",
"kwargs",
"[",
"ATTR_POSITION",
"]",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/hunterdouglas_powerview/cover.py#L174-L178 | ||
zedshaw/lamson | 8a8ad546ea746b129fa5f069bf9278f87d01473a | examples/librelist/app/handlers/admin.py | python | CONFIRMING_SUBSCRIBE | (message, list_name=None, id_number=None, host=None) | [] | def CONFIRMING_SUBSCRIBE(message, list_name=None, id_number=None, host=None):
original = CONFIRM.verify(list_name, message['from'], id_number)
if original:
mailinglist.add_subscriber(message['from'], list_name)
msg = view.respond(locals(), "mail/subscribed.msg",
From... | [
"def",
"CONFIRMING_SUBSCRIBE",
"(",
"message",
",",
"list_name",
"=",
"None",
",",
"id_number",
"=",
"None",
",",
"host",
"=",
"None",
")",
":",
"original",
"=",
"CONFIRM",
".",
"verify",
"(",
"list_name",
",",
"message",
"[",
"'from'",
"]",
",",
"id_num... | https://github.com/zedshaw/lamson/blob/8a8ad546ea746b129fa5f069bf9278f87d01473a/examples/librelist/app/handlers/admin.py#L72-L89 | ||||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/tkinter/__init__.py | python | PanedWindow.__init__ | (self, master=None, cnf={}, **kw) | Construct a panedwindow widget with the parent MASTER.
STANDARD OPTIONS
background, borderwidth, cursor, height,
orient, relief, width
WIDGET-SPECIFIC OPTIONS
handlepad, handlesize, opaqueresize,
sashcursor, sashpad, sashrelief,
sashwidth, ... | Construct a panedwindow widget with the parent MASTER. | [
"Construct",
"a",
"panedwindow",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct a panedwindow widget with the parent MASTER.
STANDARD OPTIONS
background, borderwidth, cursor, height,
orient, relief, width
WIDGET-SPECIFIC OPTIONS
handlepad, handlesize, opaqueresize,
... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'panedwindow'",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/tkinter/__init__.py#L3799-L3813 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/sulley/impacket/nmb.py | python | NBResourceRecord.get_unit_id | (self) | return self.unit_id | [] | def get_unit_id(self):
return self.unit_id | [
"def",
"get_unit_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"unit_id"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/nmb.py#L187-L188 | |||
Gallopsled/pwntools | 1573957cc8b1957399b7cc9bfae0c6f80630d5d4 | pwnlib/filesystem/ssh.py | python | SSHPath.absolute | (self) | return self._new(os.path.join(self.ssh.cwd, path)) | Return the absolute path to a file, preserving e.g. "../".
The current working directory is determined via the :class:`.ssh`
member :attr:`.ssh.cwd`.
Example:
>>> f = SSHPath('absA/../absB/file', ssh=ssh_conn)
>>> f.absolute().path # doctest: +ELLIPSIS
... | Return the absolute path to a file, preserving e.g. "../".
The current working directory is determined via the :class:`.ssh`
member :attr:`.ssh.cwd`. | [
"Return",
"the",
"absolute",
"path",
"to",
"a",
"file",
"preserving",
"e",
".",
"g",
".",
"..",
"/",
".",
"The",
"current",
"working",
"directory",
"is",
"determined",
"via",
"the",
":",
"class",
":",
".",
"ssh",
"member",
":",
"attr",
":",
".",
"ssh... | def absolute(self):
"""Return the absolute path to a file, preserving e.g. "../".
The current working directory is determined via the :class:`.ssh`
member :attr:`.ssh.cwd`.
Example:
>>> f = SSHPath('absA/../absB/file', ssh=ssh_conn)
>>> f.absolute().... | [
"def",
"absolute",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"self",
".",
"path",
")",
"if",
"self",
".",
"is_absolute",
"(",
")",
":",
"return",
"self",
".",
"_new",
"(",
"path",
")",
"return",
"self",
".",
"_n... | https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/filesystem/ssh.py#L355-L371 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/rarfile.py | python | rar3_s2k | (psw, salt) | return key_le, iv | String-to-key hash for RAR3. | String-to-key hash for RAR3. | [
"String",
"-",
"to",
"-",
"key",
"hash",
"for",
"RAR3",
"."
] | def rar3_s2k(psw, salt):
"""String-to-key hash for RAR3.
"""
if not isinstance(psw, unicode):
psw = psw.decode('utf8')
seed = psw.encode('utf-16le') + salt
iv = EMPTY
h = sha1()
for i in range(16):
for j in range(0x4000):
cnt = S_LONG.pack(i * 0x4000 + j)
... | [
"def",
"rar3_s2k",
"(",
"psw",
",",
"salt",
")",
":",
"if",
"not",
"isinstance",
"(",
"psw",
",",
"unicode",
")",
":",
"psw",
"=",
"psw",
".",
"decode",
"(",
"'utf8'",
")",
"seed",
"=",
"psw",
".",
"encode",
"(",
"'utf-16le'",
")",
"+",
"salt",
"... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/rarfile.py#L2684-L2700 | |
lgalke/vec4ir | 69cbacc8eb574563fc1910b9e033826ffd639ca2 | vec4ir/bm25.py | python | VectorizerMixin._char_wb_ngrams | (self, text_document) | return ngrams | Whitespace sensitive char-n-gram tokenization.
Tokenize text_document into a sequence of character n-grams
excluding any whitespace (operating only inside word boundaries) | Whitespace sensitive char-n-gram tokenization. | [
"Whitespace",
"sensitive",
"char",
"-",
"n",
"-",
"gram",
"tokenization",
"."
] | def _char_wb_ngrams(self, text_document):
"""Whitespace sensitive char-n-gram tokenization.
Tokenize text_document into a sequence of character n-grams
excluding any whitespace (operating only inside word boundaries)"""
# normalize white spaces
text_document = self._white_spaces... | [
"def",
"_char_wb_ngrams",
"(",
"self",
",",
"text_document",
")",
":",
"# normalize white spaces",
"text_document",
"=",
"self",
".",
"_white_spaces",
".",
"sub",
"(",
"\" \"",
",",
"text_document",
")",
"min_n",
",",
"max_n",
"=",
"self",
".",
"ngram_range",
... | https://github.com/lgalke/vec4ir/blob/69cbacc8eb574563fc1910b9e033826ffd639ca2/vec4ir/bm25.py#L152-L173 | |
jankrepl/deepdow | eb6c85845c45f89e0743b8e8c29ddb69cb78da4f | deepdow/losses.py | python | Quantile.__repr__ | (self) | return "{}(returns_channel={})".format(self.__class__.__name__, self.returns_channel) | Generate representation string. | Generate representation string. | [
"Generate",
"representation",
"string",
"."
] | def __repr__(self):
"""Generate representation string."""
return "{}(returns_channel={})".format(self.__class__.__name__, self.returns_channel) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"{}(returns_channel={})\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"returns_channel",
")"
] | https://github.com/jankrepl/deepdow/blob/eb6c85845c45f89e0743b8e8c29ddb69cb78da4f/deepdow/losses.py#L648-L650 | |
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/utilities/array.py | python | as_float | (a, dtype=None) | return dtype(a) | Converts given :math:`a` variable to *numeric* using given type.
Parameters
----------
a : object
Variable to convert.
dtype : object
Type to use for conversion, default to the type defined by the
:attr:`colour.constant.DEFAULT_INT_DTYPE` attribute. In the event where
:m... | Converts given :math:`a` variable to *numeric* using given type. | [
"Converts",
"given",
":",
"math",
":",
"a",
"variable",
"to",
"*",
"numeric",
"*",
"using",
"given",
"type",
"."
] | def as_float(a, dtype=None):
"""
Converts given :math:`a` variable to *numeric* using given type.
Parameters
----------
a : object
Variable to convert.
dtype : object
Type to use for conversion, default to the type defined by the
:attr:`colour.constant.DEFAULT_INT_DTYPE`... | [
"def",
"as_float",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"DEFAULT_FLOAT_DTYPE",
"attest",
"(",
"dtype",
"in",
"np",
".",
"sctypes",
"[",
"'float'",
"]",
",",
"'\"dtype\" must be one of the following ty... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/utilities/array.py#L538-L581 | |
geopython/pycsw | 43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc | pycsw/core/admin.py | python | get_sysprof | () | return '''pycsw system profile
--------------------
Python version: %s
os: %s
SQLAlchemy: %s
Shapely: %s
lxml: %s
libxml2: %s
pyproj: %s
OWSLib: %s''' % (sys.version_info, sys.platform, vsqlalchemy,
vshapely, etree.__version__, etree.LIBXML_VERSION,
... | Get versions of dependencies | Get versions of dependencies | [
"Get",
"versions",
"of",
"dependencies"
] | def get_sysprof():
"""Get versions of dependencies"""
none = 'Module not found'
try:
import sqlalchemy
vsqlalchemy = sqlalchemy.__version__
except ImportError:
vsqlalchemy = none
try:
import pyproj
vpyproj = pyproj.__version__
except ImportError:
... | [
"def",
"get_sysprof",
"(",
")",
":",
"none",
"=",
"'Module not found'",
"try",
":",
"import",
"sqlalchemy",
"vsqlalchemy",
"=",
"sqlalchemy",
".",
"__version__",
"except",
"ImportError",
":",
"vsqlalchemy",
"=",
"none",
"try",
":",
"import",
"pyproj",
"vpyproj",... | https://github.com/geopython/pycsw/blob/43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc/pycsw/core/admin.py#L577-L624 | |
moinwiki/moin | 568f223231aadecbd3b21a701ec02271f8d8021d | src/moin/converters/html_out.py | python | Converter.visit_moinpage_nowiki | (self, elem) | return self.new_copy(html.div, elem) | Avoid creation of a div used only for its data-lineno attrib. | Avoid creation of a div used only for its data-lineno attrib. | [
"Avoid",
"creation",
"of",
"a",
"div",
"used",
"only",
"for",
"its",
"data",
"-",
"lineno",
"attrib",
"."
] | def visit_moinpage_nowiki(self, elem):
"""
Avoid creation of a div used only for its data-lineno attrib.
"""
if elem.attrib.get(html.data_lineno, None) and isinstance(elem[0][0], ET.Element):
# {{{#!wiki\ntext\n}}}
elem[0][0].attrib[html.data_lineno] = elem.attrib... | [
"def",
"visit_moinpage_nowiki",
"(",
"self",
",",
"elem",
")",
":",
"if",
"elem",
".",
"attrib",
".",
"get",
"(",
"html",
".",
"data_lineno",
",",
"None",
")",
"and",
"isinstance",
"(",
"elem",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"ET",
".",
"Element... | https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/converters/html_out.py#L247-L262 | |
gnome-terminator/terminator | ca335e45eb1a4ea7c22fe0d515bb270e9a0e12a1 | terminatorlib/factory.py | python | Factory.make_terminal | (self, **kwargs) | return(terminal.Terminal()) | Make a Terminal | Make a Terminal | [
"Make",
"a",
"Terminal"
] | def make_terminal(self, **kwargs):
"""Make a Terminal"""
from . import terminal
return(terminal.Terminal()) | [
"def",
"make_terminal",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"import",
"terminal",
"return",
"(",
"terminal",
".",
"Terminal",
"(",
")",
")"
] | https://github.com/gnome-terminator/terminator/blob/ca335e45eb1a4ea7c22fe0d515bb270e9a0e12a1/terminatorlib/factory.py#L102-L105 | |
Dman95/SASM | 7e3ae6da1c219a68e26d38939338567e5c27151a | Windows/MinGW64/opt/lib/python2.7/sysconfig.py | python | _init_posix | (vars) | Initialize the module as appropriate for POSIX systems. | Initialize the module as appropriate for POSIX systems. | [
"Initialize",
"the",
"module",
"as",
"appropriate",
"for",
"POSIX",
"systems",
"."
] | def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# _sysconfigdata is generated at build time, see _generate_posix_vars()
from _sysconfigdata import build_time_vars
vars.update(build_time_vars) | [
"def",
"_init_posix",
"(",
"vars",
")",
":",
"# _sysconfigdata is generated at build time, see _generate_posix_vars()",
"from",
"_sysconfigdata",
"import",
"build_time_vars",
"vars",
".",
"update",
"(",
"build_time_vars",
")"
] | https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/opt/lib/python2.7/sysconfig.py#L354-L358 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/heightmap.py | python | addHeightsByBitmap | (heights, textLines) | Add heights by bitmap. | Add heights by bitmap. | [
"Add",
"heights",
"by",
"bitmap",
"."
] | def addHeightsByBitmap(heights, textLines):
'Add heights by bitmap.'
for line in textLines[3:]:
for integerWord in line.split():
heights.append(float(integerWord)) | [
"def",
"addHeightsByBitmap",
"(",
"heights",
",",
"textLines",
")",
":",
"for",
"line",
"in",
"textLines",
"[",
"3",
":",
"]",
":",
"for",
"integerWord",
"in",
"line",
".",
"split",
"(",
")",
":",
"heights",
".",
"append",
"(",
"float",
"(",
"integerWo... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/heightmap.py#L32-L36 | ||
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/pdb.py | python | Pdb.do_next | (self, arg) | return 1 | n(ext)
Continue execution until the next line in the current function
is reached or it returns. | n(ext)
Continue execution until the next line in the current function
is reached or it returns. | [
"n",
"(",
"ext",
")",
"Continue",
"execution",
"until",
"the",
"next",
"line",
"in",
"the",
"current",
"function",
"is",
"reached",
"or",
"it",
"returns",
"."
] | def do_next(self, arg):
"""n(ext)
Continue execution until the next line in the current function
is reached or it returns.
"""
self.set_next(self.curframe)
return 1 | [
"def",
"do_next",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"set_next",
"(",
"self",
".",
"curframe",
")",
"return",
"1"
] | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/pdb.py#L1010-L1016 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/distutils/ccompiler.py | python | gen_lib_options | (compiler, library_dirs, runtime_library_dirs, libraries) | return lib_opts | Generate linker options for searching library directories and
linking with specific libraries. 'libraries' and 'library_dirs' are,
respectively, lists of library names (not filenames!) and search
directories. Returns a list of command-line options suitable for use
with some compiler (depending on the ... | Generate linker options for searching library directories and
linking with specific libraries. 'libraries' and 'library_dirs' are,
respectively, lists of library names (not filenames!) and search
directories. Returns a list of command-line options suitable for use
with some compiler (depending on the ... | [
"Generate",
"linker",
"options",
"for",
"searching",
"library",
"directories",
"and",
"linking",
"with",
"specific",
"libraries",
".",
"libraries",
"and",
"library_dirs",
"are",
"respectively",
"lists",
"of",
"library",
"names",
"(",
"not",
"filenames!",
")",
"and... | def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries):
"""Generate linker options for searching library directories and
linking with specific libraries. 'libraries' and 'library_dirs' are,
respectively, lists of library names (not filenames!) and search
directories. Returns a l... | [
"def",
"gen_lib_options",
"(",
"compiler",
",",
"library_dirs",
",",
"runtime_library_dirs",
",",
"libraries",
")",
":",
"lib_opts",
"=",
"[",
"]",
"for",
"dir",
"in",
"library_dirs",
":",
"lib_opts",
".",
"append",
"(",
"compiler",
".",
"library_dir_option",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/distutils/ccompiler.py#L1082-L1118 | |
henkelis/sonospy | 841f52010fd6e1e932d8f1a8896ad4e5a0667b8a | sonospy/brisa/upnp/soap.py | python | parse_soap_call | (data) | return method_name, args, kwargs, ns | Parses a soap call and returns a 4-tuple.
@param data: raw soap XML call data
@type data: string
@return: 4-tuple (method_name, args, kwargs, namespace)
@rtype: tuple | Parses a soap call and returns a 4-tuple. | [
"Parses",
"a",
"soap",
"call",
"and",
"returns",
"a",
"4",
"-",
"tuple",
"."
] | def parse_soap_call(data):
""" Parses a soap call and returns a 4-tuple.
@param data: raw soap XML call data
@type data: string
@return: 4-tuple (method_name, args, kwargs, namespace)
@rtype: tuple
"""
log.debug(data)
tree = parse_xml(data)
body = tree.find('{http://schemas.xmlsoap... | [
"def",
"parse_soap_call",
"(",
"data",
")",
":",
"log",
".",
"debug",
"(",
"data",
")",
"tree",
"=",
"parse_xml",
"(",
"data",
")",
"body",
"=",
"tree",
".",
"find",
"(",
"'{http://schemas.xmlsoap.org/soap/envelope/}Body'",
")",
"method",
"=",
"body",
".",
... | https://github.com/henkelis/sonospy/blob/841f52010fd6e1e932d8f1a8896ad4e5a0667b8a/sonospy/brisa/upnp/soap.py#L413-L447 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/filters/_filterlist.py | python | FilterList.fix | (self, line) | return new_line.replace('"', '"') | sanitize the custom filter name, if needed | sanitize the custom filter name, if needed | [
"sanitize",
"the",
"custom",
"filter",
"name",
"if",
"needed"
] | def fix(self, line):
""" sanitize the custom filter name, if needed """
new_line = line.strip()
new_line = new_line.replace('&', '&')
new_line = new_line.replace('>', '>')
new_line = new_line.replace('<', '<')
return new_line.replace('"', '"') | [
"def",
"fix",
"(",
"self",
",",
"line",
")",
":",
"new_line",
"=",
"line",
".",
"strip",
"(",
")",
"new_line",
"=",
"new_line",
".",
"replace",
"(",
"'&'",
",",
"'&'",
")",
"new_line",
"=",
"new_line",
".",
"replace",
"(",
"'>'",
",",
"'>'",
... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/filters/_filterlist.py#L116-L122 | |
coreylynch/pyFM | 0696c980993889a9429e4ab0b6c7dc8be6dac4de | pyfm/pylibfm.py | python | FM._bool_to_int | (self, bool_arg) | Map bool to int for cython | Map bool to int for cython | [
"Map",
"bool",
"to",
"int",
"for",
"cython"
] | def _bool_to_int(self, bool_arg):
"""Map bool to int for cython"""
if bool_arg == True:
return 1
else:
return 0 | [
"def",
"_bool_to_int",
"(",
"self",
",",
"bool_arg",
")",
":",
"if",
"bool_arg",
"==",
"True",
":",
"return",
"1",
"else",
":",
"return",
"0"
] | https://github.com/coreylynch/pyFM/blob/0696c980993889a9429e4ab0b6c7dc8be6dac4de/pyfm/pylibfm.py#L126-L131 | ||
slim1017/VaDE | eca52b4b57e32a68f578de7a54eda5d39907b0fe | training.py | python | standardize_input_data | (data, names, shapes=None,
check_batch_dim=True,
exception_prefix='') | return arrays | Users may pass data as a list of arrays, dictionary of arrays,
or as a single array. We normalize this to an ordered list of
arrays (same order as `names`), while checking that the provided
arrays have shapes that match the network's expectations. | Users may pass data as a list of arrays, dictionary of arrays,
or as a single array. We normalize this to an ordered list of
arrays (same order as `names`), while checking that the provided
arrays have shapes that match the network's expectations. | [
"Users",
"may",
"pass",
"data",
"as",
"a",
"list",
"of",
"arrays",
"dictionary",
"of",
"arrays",
"or",
"as",
"a",
"single",
"array",
".",
"We",
"normalize",
"this",
"to",
"an",
"ordered",
"list",
"of",
"arrays",
"(",
"same",
"order",
"as",
"names",
")"... | def standardize_input_data(data, names, shapes=None,
check_batch_dim=True,
exception_prefix=''):
'''Users may pass data as a list of arrays, dictionary of arrays,
or as a single array. We normalize this to an ordered list of
arrays (same order as `names`... | [
"def",
"standardize_input_data",
"(",
"data",
",",
"names",
",",
"shapes",
"=",
"None",
",",
"check_batch_dim",
"=",
"True",
",",
"exception_prefix",
"=",
"''",
")",
":",
"if",
"type",
"(",
"data",
")",
"is",
"dict",
":",
"arrays",
"=",
"[",
"]",
"for"... | https://github.com/slim1017/VaDE/blob/eca52b4b57e32a68f578de7a54eda5d39907b0fe/training.py#L24-L109 | |
Garvit244/Leetcode | a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29 | 200-300q/297.py | python | Codec.deserialize | (self, data) | return buildTree(preorder) | Decodes your encoded data to tree.
:type data: str
:rtype: TreeNode | Decodes your encoded data to tree.
:type data: str
:rtype: TreeNode | [
"Decodes",
"your",
"encoded",
"data",
"to",
"tree",
".",
":",
"type",
"data",
":",
"str",
":",
"rtype",
":",
"TreeNode"
] | def deserialize(self, data):
"""Decodes your encoded data to tree.
:type data: str
:rtype: TreeNode
"""
def buildTree(preorder):
value = preorder.pop(0)
if value == '#':
return None
node = TreeNode... | [
"def",
"deserialize",
"(",
"self",
",",
"data",
")",
":",
"def",
"buildTree",
"(",
"preorder",
")",
":",
"value",
"=",
"preorder",
".",
"pop",
"(",
"0",
")",
"if",
"value",
"==",
"'#'",
":",
"return",
"None",
"node",
"=",
"TreeNode",
"(",
"int",
"(... | https://github.com/Garvit244/Leetcode/blob/a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29/200-300q/297.py#L48-L66 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/locale.py | python | _grouping_intervals | (grouping) | [] | def _grouping_intervals(grouping):
last_interval = None
for interval in grouping:
# if grouping is -1, we are done
if interval == CHAR_MAX:
return
# 0: re-use last group ad infinitum
if interval == 0:
if last_interval is None:
raise ValueEr... | [
"def",
"_grouping_intervals",
"(",
"grouping",
")",
":",
"last_interval",
"=",
"None",
"for",
"interval",
"in",
"grouping",
":",
"# if grouping is -1, we are done",
"if",
"interval",
"==",
"CHAR_MAX",
":",
"return",
"# 0: re-use last group ad infinitum",
"if",
"interval... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/locale.py#L122-L135 | ||||
intel/fMBT | a221c55cd7b6367aa458781b134ae155aa47a71f | utils/fmbtwindows.py | python | _run | (command, expectedExitStatus=None) | return exitStatus, out, err | Execute command in child process, return status, stdout, stderr. | Execute command in child process, return status, stdout, stderr. | [
"Execute",
"command",
"in",
"child",
"process",
"return",
"status",
"stdout",
"stderr",
"."
] | def _run(command, expectedExitStatus=None):
"""
Execute command in child process, return status, stdout, stderr.
"""
if type(command) == str:
shell = True
else:
shell = False
try:
p = subprocess.Popen(command, shell=shell,
stdout=subprocess.P... | [
"def",
"_run",
"(",
"command",
",",
"expectedExitStatus",
"=",
"None",
")",
":",
"if",
"type",
"(",
"command",
")",
"==",
"str",
":",
"shell",
"=",
"True",
"else",
":",
"shell",
"=",
"False",
"try",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"... | https://github.com/intel/fMBT/blob/a221c55cd7b6367aa458781b134ae155aa47a71f/utils/fmbtwindows.py#L73-L107 | |
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/idlelib/ColorDelegator.py | python | any | (name, alternates) | return '(?P<%s>' % name + '|'.join(alternates) + ')' | Return a named group pattern matching list of alternates. | Return a named group pattern matching list of alternates. | [
"Return",
"a",
"named",
"group",
"pattern",
"matching",
"list",
"of",
"alternates",
"."
] | def any(name, alternates):
"""Return a named group pattern matching list of alternates."""
return '(?P<%s>' % name + '|'.join(alternates) + ')' | [
"def",
"any",
"(",
"name",
",",
"alternates",
")",
":",
"return",
"'(?P<%s>'",
"%",
"name",
"+",
"'|'",
".",
"join",
"(",
"alternates",
")",
"+",
"')'"
] | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/idlelib/ColorDelegator.py#L15-L17 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py | python | NumberGenerator.getdependentcounter | (self, type, master) | return self.counters[type] | Get (or create) a counter of the given type that depends on another. | Get (or create) a counter of the given type that depends on another. | [
"Get",
"(",
"or",
"create",
")",
"a",
"counter",
"of",
"the",
"given",
"type",
"that",
"depends",
"on",
"another",
"."
] | def getdependentcounter(self, type, master):
"Get (or create) a counter of the given type that depends on another."
if not type in self.counters or not self.counters[type].master:
self.counters[type] = self.createdependent(type, master)
return self.counters[type] | [
"def",
"getdependentcounter",
"(",
"self",
",",
"type",
",",
"master",
")",
":",
"if",
"not",
"type",
"in",
"self",
".",
"counters",
"or",
"not",
"self",
".",
"counters",
"[",
"type",
"]",
".",
"master",
":",
"self",
".",
"counters",
"[",
"type",
"]"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L3376-L3380 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.