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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/core/configuration/system.py | python | SystemSection.can_activate_keyboard | (self) | return self._is_boot_iso or self._is_booted_os | Can we activate the keyboard?
FIXME: This is a temporary workaround. | Can we activate the keyboard? | [
"Can",
"we",
"activate",
"the",
"keyboard?"
] | def can_activate_keyboard(self):
"""Can we activate the keyboard?
FIXME: This is a temporary workaround.
"""
return self._is_boot_iso or self._is_booted_os | [
"def",
"can_activate_keyboard",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_boot_iso",
"or",
"self",
".",
"_is_booted_os"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/configuration/system.py#L110-L115 | |
crits/crits_services | c7abf91f1865d913cffad4b966599da204f8ae43 | taxii_service/handlers.py | python | has_cybox_repr | (obj) | Determine if this indicator is of a type that can
successfully be converted to a CybOX object.
:return The CybOX representation if possible, else False. | Determine if this indicator is of a type that can
successfully be converted to a CybOX object. | [
"Determine",
"if",
"this",
"indicator",
"is",
"of",
"a",
"type",
"that",
"can",
"successfully",
"be",
"converted",
"to",
"a",
"CybOX",
"object",
"."
] | def has_cybox_repr(obj):
"""
Determine if this indicator is of a type that can
successfully be converted to a CybOX object.
:return The CybOX representation if possible, else False.
"""
try:
rep = make_cybox_object(obj.ind_type, obj.value)
return rep
except:
return F... | [
"def",
"has_cybox_repr",
"(",
"obj",
")",
":",
"try",
":",
"rep",
"=",
"make_cybox_object",
"(",
"obj",
".",
"ind_type",
",",
"obj",
".",
"value",
")",
"return",
"rep",
"except",
":",
"return",
"False"
] | https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/taxii_service/handlers.py#L1374-L1385 | ||
fgsect/unicorefuzz | f5b27a6dda601ef18cb166f79eb121be8e7b88bd | unicorefuzz/x64utils.py | python | get_msr | (uc: Uc, scratch: int, msr: int) | return (edx << 32) | (eax & 0xFFFFFFFF) | fetch the contents of the given model-specific register (MSR).
this will clobber some memory at the given scratch address, as it emits some code. | fetch the contents of the given model-specific register (MSR).
this will clobber some memory at the given scratch address, as it emits some code. | [
"fetch",
"the",
"contents",
"of",
"the",
"given",
"model",
"-",
"specific",
"register",
"(",
"MSR",
")",
".",
"this",
"will",
"clobber",
"some",
"memory",
"at",
"the",
"given",
"scratch",
"address",
"as",
"it",
"emits",
"some",
"code",
"."
] | def get_msr(uc: Uc, scratch: int, msr: int) -> int:
"""
fetch the contents of the given model-specific register (MSR).
this will clobber some memory at the given scratch address, as it emits some code.
"""
# save clobbered registers
orax = uc.reg_read(UC_X86_REG_RAX)
ordx = uc.reg_read(UC_X8... | [
"def",
"get_msr",
"(",
"uc",
":",
"Uc",
",",
"scratch",
":",
"int",
",",
"msr",
":",
"int",
")",
"->",
"int",
":",
"# save clobbered registers",
"orax",
"=",
"uc",
".",
"reg_read",
"(",
"UC_X86_REG_RAX",
")",
"ordx",
"=",
"uc",
".",
"reg_read",
"(",
... | https://github.com/fgsect/unicorefuzz/blob/f5b27a6dda601ef18cb166f79eb121be8e7b88bd/unicorefuzz/x64utils.py#L50-L75 | |
epfl-lts2/pygsp | a3412ce7696c02c8a55439e89d0c9ab8ae863269 | pygsp/features.py | python | compute_norm_tig | (g, **kwargs) | return np.linalg.norm(tig, axis=1, ord=2) | r"""
Compute the :math:`\ell_2` norm of the Tig.
See :func:`compute_tig`.
Parameters
----------
g: Filter
The filter or filter bank.
kwargs: dict
Additional parameters to be passed to the
:func:`pygsp.filters.Filter.filter` method. | r"""
Compute the :math:`\ell_2` norm of the Tig.
See :func:`compute_tig`. | [
"r",
"Compute",
"the",
":",
"math",
":",
"\\",
"ell_2",
"norm",
"of",
"the",
"Tig",
".",
"See",
":",
"func",
":",
"compute_tig",
"."
] | def compute_norm_tig(g, **kwargs):
r"""
Compute the :math:`\ell_2` norm of the Tig.
See :func:`compute_tig`.
Parameters
----------
g: Filter
The filter or filter bank.
kwargs: dict
Additional parameters to be passed to the
:func:`pygsp.filters.Filter.filter` method.
... | [
"def",
"compute_norm_tig",
"(",
"g",
",",
"*",
"*",
"kwargs",
")",
":",
"tig",
"=",
"compute_tig",
"(",
"g",
",",
"*",
"*",
"kwargs",
")",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"tig",
",",
"axis",
"=",
"1",
",",
"ord",
"=",
"2",
")"
... | https://github.com/epfl-lts2/pygsp/blob/a3412ce7696c02c8a55439e89d0c9ab8ae863269/pygsp/features.py#L47-L61 | |
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/platforms/pololu/pololu_ticcmd_wrapper.py | python | PololuTiccmdWrapper.set_max_acceleration | (self, acceleration) | Set the max acceleration of the stepper.
Args:
----
acceleration (number): The maximum acceleration of the stepper in microsteps per 100 s^2 | Set the max acceleration of the stepper. | [
"Set",
"the",
"max",
"acceleration",
"of",
"the",
"stepper",
"."
] | def set_max_acceleration(self, acceleration):
"""Set the max acceleration of the stepper.
Args:
----
acceleration (number): The maximum acceleration of the stepper in microsteps per 100 s^2
"""
self._ticcmd('--max-accel', str(int(acceleration))) | [
"def",
"set_max_acceleration",
"(",
"self",
",",
"acceleration",
")",
":",
"self",
".",
"_ticcmd",
"(",
"'--max-accel'",
",",
"str",
"(",
"int",
"(",
"acceleration",
")",
")",
")"
] | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/pololu/pololu_ticcmd_wrapper.py#L168-L175 | ||
InvestmentSystems/static-frame | 0b19d6969bf6c17fb0599871aca79eb3b52cf2ed | static_frame/core/frame.py | python | Frame.index | (self) | return self._index | The ``IndexBase`` instance assigned for row labels. | The ``IndexBase`` instance assigned for row labels. | [
"The",
"IndexBase",
"instance",
"assigned",
"for",
"row",
"labels",
"."
] | def index(self) -> Index:
'''The ``IndexBase`` instance assigned for row labels.
'''
return self._index | [
"def",
"index",
"(",
"self",
")",
"->",
"Index",
":",
"return",
"self",
".",
"_index"
] | https://github.com/InvestmentSystems/static-frame/blob/0b19d6969bf6c17fb0599871aca79eb3b52cf2ed/static_frame/core/frame.py#L4126-L4129 | |
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/gtk_extras/dialog_extras.py | python | ImageSelectorDialog.post_dialog | (self) | [] | def post_dialog (self):
self.preview = Gtk.Image()
self.fsd.set_preview_widget(self.preview)
self.fsd.connect('selection-changed',self.update_preview)
self.preview.show() | [
"def",
"post_dialog",
"(",
"self",
")",
":",
"self",
".",
"preview",
"=",
"Gtk",
".",
"Image",
"(",
")",
"self",
".",
"fsd",
".",
"set_preview_widget",
"(",
"self",
".",
"preview",
")",
"self",
".",
"fsd",
".",
"connect",
"(",
"'selection-changed'",
",... | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/gtk_extras/dialog_extras.py#L1116-L1120 | ||||
suavecode/SUAVE | 4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5 | trunk/SUAVE/Plugins/pint/unit.py | python | UnitRegistry.disable_contexts | (self, n=None) | Disable the last n enabled contexts. | Disable the last n enabled contexts. | [
"Disable",
"the",
"last",
"n",
"enabled",
"contexts",
"."
] | def disable_contexts(self, n=None):
"""Disable the last n enabled contexts.
"""
if n is None:
n = len(self._contexts)
self._active_ctx.remove_contexts(n) | [
"def",
"disable_contexts",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"len",
"(",
"self",
".",
"_contexts",
")",
"self",
".",
"_active_ctx",
".",
"remove_contexts",
"(",
"n",
")"
] | https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Plugins/pint/unit.py#L520-L525 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/rsa-3.4.2/rsa/key.py | python | AbstractKey.save_pkcs1 | (self, format='PEM') | return method() | Saves the public key in PKCS#1 DER or PEM format.
:param format: the format to save; 'PEM' or 'DER'
:returns: the DER- or PEM-encoded public key. | Saves the public key in PKCS#1 DER or PEM format. | [
"Saves",
"the",
"public",
"key",
"in",
"PKCS#1",
"DER",
"or",
"PEM",
"format",
"."
] | def save_pkcs1(self, format='PEM'):
"""Saves the public key in PKCS#1 DER or PEM format.
:param format: the format to save; 'PEM' or 'DER'
:returns: the DER- or PEM-encoded public key.
"""
methods = {
'PEM': self._save_pkcs1_pem,
'DER': self._save_pkcs1_... | [
"def",
"save_pkcs1",
"(",
"self",
",",
"format",
"=",
"'PEM'",
")",
":",
"methods",
"=",
"{",
"'PEM'",
":",
"self",
".",
"_save_pkcs1_pem",
",",
"'DER'",
":",
"self",
".",
"_save_pkcs1_der",
",",
"}",
"method",
"=",
"self",
".",
"_assert_format_exists",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/rsa-3.4.2/rsa/key.py#L89-L102 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/object_detection/core/box_list_ops.py | python | matched_intersection | (boxlist1, boxlist2, scope=None) | Compute intersection areas between corresponding boxes in two boxlists.
Args:
boxlist1: BoxList holding N boxes
boxlist2: BoxList holding N boxes
scope: name scope.
Returns:
a tensor with shape [N] representing pairwise intersections | Compute intersection areas between corresponding boxes in two boxlists. | [
"Compute",
"intersection",
"areas",
"between",
"corresponding",
"boxes",
"in",
"two",
"boxlists",
"."
] | def matched_intersection(boxlist1, boxlist2, scope=None):
"""Compute intersection areas between corresponding boxes in two boxlists.
Args:
boxlist1: BoxList holding N boxes
boxlist2: BoxList holding N boxes
scope: name scope.
Returns:
a tensor with shape [N] representing pairwise intersections
... | [
"def",
"matched_intersection",
"(",
"boxlist1",
",",
"boxlist2",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'MatchedIntersection'",
")",
":",
"y_min1",
",",
"x_min1",
",",
"y_max1",
",",
"x_max1",
"=",
"tf",
... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/object_detection/core/box_list_ops.py#L228-L250 | ||
newfies-dialer/newfies-dialer | 8168b3dd43e9f5ce73a2645b3229def1b2815d47 | newfies/dialer_campaign/function_def.py | python | get_phonebook_list | (user) | return result_list | Return phonebook list of logged in user | Return phonebook list of logged in user | [
"Return",
"phonebook",
"list",
"of",
"logged",
"in",
"user"
] | def get_phonebook_list(user):
"""Return phonebook list of logged in user"""
phonebook_list = Phonebook.objects.filter(user=user).order_by('id')
result_list = []
for phonebook in phonebook_list:
contacts_in_phonebook = phonebook.phonebook_contacts()
nbcontact = " -> %d contact(s)" % (cont... | [
"def",
"get_phonebook_list",
"(",
"user",
")",
":",
"phonebook_list",
"=",
"Phonebook",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"user",
")",
".",
"order_by",
"(",
"'id'",
")",
"result_list",
"=",
"[",
"]",
"for",
"phonebook",
"in",
"phonebook_list... | https://github.com/newfies-dialer/newfies-dialer/blob/8168b3dd43e9f5ce73a2645b3229def1b2815d47/newfies/dialer_campaign/function_def.py#L26-L35 | |
joaomatosf/jexboss | 338b531a2a2aee9d294f394086d6718b60526350 | jexboss.py | python | is_proxy_ok | () | [] | def is_proxy_ok():
print_and_flush(GREEN + "\n ** Checking proxy: %s **\n\n" % gl_args.proxy)
headers = {"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Connection": "keep-alive",
"User-Agent": get_random_user_agent()}
try:
r = gl_http_poo... | [
"def",
"is_proxy_ok",
"(",
")",
":",
"print_and_flush",
"(",
"GREEN",
"+",
"\"\\n ** Checking proxy: %s **\\n\\n\"",
"%",
"gl_args",
".",
"proxy",
")",
"headers",
"=",
"{",
"\"Accept\"",
":",
"\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"",
",",
"\"C... | https://github.com/joaomatosf/jexboss/blob/338b531a2a2aee9d294f394086d6718b60526350/jexboss.py#L130-L157 | ||||
shellphish/ictf-framework | c0384f12060cf47442a52f516c6e78bd722f208a | database/api/scripts.py | python | script_new | () | return json.dumps({"result": "success",
"id": script_id}) | The ``/script/new`` endpoint requires authentication.
It add a script to the database, and initializes its state.
Note that this endpoint requires a POST request.
It can be reached at
``/script/new?secret=<API_SECRET>``.
It requires the following inputs:
- name, an optional name of the scrip... | The ``/script/new`` endpoint requires authentication.
It add a script to the database, and initializes its state. | [
"The",
"/",
"script",
"/",
"new",
"endpoint",
"requires",
"authentication",
".",
"It",
"add",
"a",
"script",
"to",
"the",
"database",
"and",
"initializes",
"its",
"state",
"."
] | def script_new():
"""The ``/script/new`` endpoint requires authentication.
It add a script to the database, and initializes its state.
Note that this endpoint requires a POST request.
It can be reached at
``/script/new?secret=<API_SECRET>``.
It requires the following inputs:
- name, an o... | [
"def",
"script_new",
"(",
")",
":",
"upload_id",
"=",
"request",
".",
"form",
".",
"get",
"(",
"\"upload_id\"",
")",
"filename",
"=",
"request",
".",
"form",
".",
"get",
"(",
"\"filename\"",
")",
"type_",
"=",
"request",
".",
"form",
".",
"get",
"(",
... | https://github.com/shellphish/ictf-framework/blob/c0384f12060cf47442a52f516c6e78bd722f208a/database/api/scripts.py#L407-L471 | |
cbanack/comic-vine-scraper | 8a7071796c61a9483079ad0e9ade56fcb7596bcd | src/py/gui/forms/searchform.py | python | SearchForm.__key_was_released | (self, sender, args) | Called whenever the user releases any key on this form. | Called whenever the user releases any key on this form. | [
"Called",
"whenever",
"the",
"user",
"releases",
"any",
"key",
"on",
"this",
"form",
"."
] | def __key_was_released(self, sender, args):
''' Called whenever the user releases any key on this form. '''
# unhighlight the skip button bold whenever the user releases control key
if args.KeyCode == Keys.ControlKey:
self.__pressing_controlkey = False;
self.__skip_button.Text... | [
"def",
"__key_was_released",
"(",
"self",
",",
"sender",
",",
"args",
")",
":",
"# unhighlight the skip button bold whenever the user releases control key",
"if",
"args",
".",
"KeyCode",
"==",
"Keys",
".",
"ControlKey",
":",
"self",
".",
"__pressing_controlkey",
"=",
... | https://github.com/cbanack/comic-vine-scraper/blob/8a7071796c61a9483079ad0e9ade56fcb7596bcd/src/py/gui/forms/searchform.py#L249-L255 | ||
divamgupta/image-segmentation-keras | dc830bbd76371aaedbf8cb997bdedca388c544c4 | keras_segmentation/predict.py | python | set_video | (inp, video_name) | return cap, video, fps | [] | def set_video(inp, video_name):
cap = cv2.VideoCapture(inp)
fps = int(cap.get(cv2.CAP_PROP_FPS))
video_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
video_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
size = (video_width, video_height)
fourcc = cv2.VideoWriter_fourcc(*"XVID")
video = cv2... | [
"def",
"set_video",
"(",
"inp",
",",
"video_name",
")",
":",
"cap",
"=",
"cv2",
".",
"VideoCapture",
"(",
"inp",
")",
"fps",
"=",
"int",
"(",
"cap",
".",
"get",
"(",
"cv2",
".",
"CAP_PROP_FPS",
")",
")",
"video_width",
"=",
"int",
"(",
"cap",
".",
... | https://github.com/divamgupta/image-segmentation-keras/blob/dc830bbd76371aaedbf8cb997bdedca388c544c4/keras_segmentation/predict.py#L217-L225 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/ldap3/utils/log.py | python | set_library_log_activation_level | (logging_level) | [] | def set_library_log_activation_level(logging_level):
if isinstance(logging_level, int):
global _logging_level
_logging_level = logging_level
else:
if log_enabled(ERROR):
log(ERROR, 'invalid library log activation level <%s> ', logging_level)
raise ValueError('invalid ... | [
"def",
"set_library_log_activation_level",
"(",
"logging_level",
")",
":",
"if",
"isinstance",
"(",
"logging_level",
",",
"int",
")",
":",
"global",
"_logging_level",
"_logging_level",
"=",
"logging_level",
"else",
":",
"if",
"log_enabled",
"(",
"ERROR",
")",
":",... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/utils/log.py#L138-L145 | ||||
crdoconnor/strictyaml | b456066a763285532fd75cd274d4a275d8499d6c | strictyaml/utils.py | python | is_infinity | (value) | return compile(r"^[-+]?\.?(?:inf|Inf|INF)$").match(value) is not None | Is string a valid representation for positive or negative infinity?
Valid formats are:
[+/-]inf, [+/-]INF, [+/-]Inf, [+/-].inf, [+/-].INF and [+/-].Inf
>>> is_infinity(".inf")
True
>>> is_infinity("+.INF")
True
>>> is_infinity("-.Inf")
True
>>> is_infinity("Inf")
True
>... | Is string a valid representation for positive or negative infinity? | [
"Is",
"string",
"a",
"valid",
"representation",
"for",
"positive",
"or",
"negative",
"infinity?"
] | def is_infinity(value):
"""
Is string a valid representation for positive or negative infinity?
Valid formats are:
[+/-]inf, [+/-]INF, [+/-]Inf, [+/-].inf, [+/-].INF and [+/-].Inf
>>> is_infinity(".inf")
True
>>> is_infinity("+.INF")
True
>>> is_infinity("-.Inf")
True
>>... | [
"def",
"is_infinity",
"(",
"value",
")",
":",
"return",
"compile",
"(",
"r\"^[-+]?\\.?(?:inf|Inf|INF)$\"",
")",
".",
"match",
"(",
"value",
")",
"is",
"not",
"None"
] | https://github.com/crdoconnor/strictyaml/blob/b456066a763285532fd75cd274d4a275d8499d6c/strictyaml/utils.py#L135-L163 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/sysconfig.py | python | get_config_var | (name) | return get_config_vars().get(name) | Return the value of a single variable using the dictionary returned by
'get_config_vars()'.
Equivalent to get_config_vars().get(name) | Return the value of a single variable using the dictionary returned by
'get_config_vars()'. | [
"Return",
"the",
"value",
"of",
"a",
"single",
"variable",
"using",
"the",
"dictionary",
"returned",
"by",
"get_config_vars",
"()",
"."
] | def get_config_var(name):
"""Return the value of a single variable using the dictionary returned by
'get_config_vars()'.
Equivalent to get_config_vars().get(name)
"""
return get_config_vars().get(name) | [
"def",
"get_config_var",
"(",
"name",
")",
":",
"return",
"get_config_vars",
"(",
")",
".",
"get",
"(",
"name",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/sysconfig.py#L516-L522 | |
greatscottgadgets/luna | 08b035c9c2b053d7edffb0d220d948b5c2ca927e | luna/gateware/interface/flash.py | python | ECP5ConfigurationFlashInterface.__init__ | (self, *, bus, use_cs=False) | Params:
bus -- The SPI bus object to connect to.
use_cs -- Whether or not the CS line should be passed through to the target device. | Params:
bus -- The SPI bus object to connect to.
use_cs -- Whether or not the CS line should be passed through to the target device. | [
"Params",
":",
"bus",
"--",
"The",
"SPI",
"bus",
"object",
"to",
"connect",
"to",
".",
"use_cs",
"--",
"Whether",
"or",
"not",
"the",
"CS",
"line",
"should",
"be",
"passed",
"through",
"to",
"the",
"target",
"device",
"."
] | def __init__(self, *, bus, use_cs=False):
""" Params:
bus -- The SPI bus object to connect to.
use_cs -- Whether or not the CS line should be passed through to the target device.
"""
self.bus = bus
self.use_cs = use_cs
#
# I/O port
#
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"bus",
",",
"use_cs",
"=",
"False",
")",
":",
"self",
".",
"bus",
"=",
"bus",
"self",
".",
"use_cs",
"=",
"use_cs",
"#",
"# I/O port",
"#",
"self",
".",
"sck",
"=",
"Signal",
"(",
")",
"self",
".",
... | https://github.com/greatscottgadgets/luna/blob/08b035c9c2b053d7edffb0d220d948b5c2ca927e/luna/gateware/interface/flash.py#L27-L42 | ||
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/misc/crashdialog.py | python | dump_exception_info | (exc, pages, cmdhist, qobjects) | Dump exception info to stderr.
Args:
exc: An exception tuple (type, value, traceback)
pages: A list of lists of the open pages (URLs as strings)
cmdhist: A list with the command history (as strings)
qobjects: A list of all QObjects as string. | Dump exception info to stderr. | [
"Dump",
"exception",
"info",
"to",
"stderr",
"."
] | def dump_exception_info(exc, pages, cmdhist, qobjects):
"""Dump exception info to stderr.
Args:
exc: An exception tuple (type, value, traceback)
pages: A list of lists of the open pages (URLs as strings)
cmdhist: A list with the command history (as strings)
qobjects: A list of a... | [
"def",
"dump_exception_info",
"(",
"exc",
",",
"pages",
",",
"cmdhist",
",",
"qobjects",
")",
":",
"print",
"(",
"file",
"=",
"sys",
".",
"stderr",
")",
"print",
"(",
"\"\\n\\n===== Handling exception with --no-err-windows... =====\\n\\n\"",
",",
"file",
"=",
"sys... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/misc/crashdialog.py#L641-L677 | ||
inasafe/inasafe | 355eb2ce63f516b9c26af0c86a24f99e53f63f87 | safe/report/extractors/composer.py | python | QGISComposerContext.substitution_map | (self) | return self._substitution_map | Substitution map.
:return: Substitution map containing dict mapping used in QGIS
Composition template
:rtype: dict | Substitution map. | [
"Substitution",
"map",
"."
] | def substitution_map(self):
"""Substitution map.
:return: Substitution map containing dict mapping used in QGIS
Composition template
:rtype: dict
"""
return self._substitution_map | [
"def",
"substitution_map",
"(",
"self",
")",
":",
"return",
"self",
".",
"_substitution_map"
] | https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/report/extractors/composer.py#L57-L64 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/player/gdi/cache.py | python | BrushCache.get | (self, idx: int) | [] | def get(self, idx: int) -> QBrush:
if idx in self.entries:
return self.entries[idx]
else:
return None | [
"def",
"get",
"(",
"self",
",",
"idx",
":",
"int",
")",
"->",
"QBrush",
":",
"if",
"idx",
"in",
"self",
".",
"entries",
":",
"return",
"self",
".",
"entries",
"[",
"idx",
"]",
"else",
":",
"return",
"None"
] | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/player/gdi/cache.py#L89-L93 | ||||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/masked/timectrl.py | python | TimeCtrl.SetInsertionPoint | (self, pos) | This override records the specified position and associated cell before
calling base class' function. This is necessary to handle the optional
spin button, because the insertion point is lost when the focus shifts
to the spin button. | This override records the specified position and associated cell before
calling base class' function. This is necessary to handle the optional
spin button, because the insertion point is lost when the focus shifts
to the spin button. | [
"This",
"override",
"records",
"the",
"specified",
"position",
"and",
"associated",
"cell",
"before",
"calling",
"base",
"class",
"function",
".",
"This",
"is",
"necessary",
"to",
"handle",
"the",
"optional",
"spin",
"button",
"because",
"the",
"insertion",
"poi... | def SetInsertionPoint(self, pos):
"""
This override records the specified position and associated cell before
calling base class' function. This is necessary to handle the optional
spin button, because the insertion point is lost when the focus shifts
to the spin button.
... | [
"def",
"SetInsertionPoint",
"(",
"self",
",",
"pos",
")",
":",
"## dbg('TimeCtrl::SetInsertionPoint', pos, indent=1)",
"BaseMaskedTextCtrl",
".",
"SetInsertionPoint",
"(",
"self",
",",
"pos",
")",
"# (causes EVT_TEXT event to fire)",
"self",
".",
"__posCurrent",
"=",... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/masked/timectrl.py#L1187-L1196 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/idlelib/AutoComplete.py | python | AutoComplete.fetch_completions | (self, what, mode) | Return a pair of lists of completions for something. The first list
is a sublist of the second. Both are sorted.
If there is a Python subprocess, get the comp. list there. Otherwise,
either fetch_completions() is running in the subprocess itself or it
was called in an IDLE EditorWindow... | Return a pair of lists of completions for something. The first list
is a sublist of the second. Both are sorted. | [
"Return",
"a",
"pair",
"of",
"lists",
"of",
"completions",
"for",
"something",
".",
"The",
"first",
"list",
"is",
"a",
"sublist",
"of",
"the",
"second",
".",
"Both",
"are",
"sorted",
"."
] | def fetch_completions(self, what, mode):
"""Return a pair of lists of completions for something. The first list
is a sublist of the second. Both are sorted.
If there is a Python subprocess, get the comp. list there. Otherwise,
either fetch_completions() is running in the subprocess its... | [
"def",
"fetch_completions",
"(",
"self",
",",
"what",
",",
"mode",
")",
":",
"try",
":",
"rpcclt",
"=",
"self",
".",
"editwin",
".",
"flist",
".",
"pyshell",
".",
"interp",
".",
"rpcclt",
"except",
":",
"rpcclt",
"=",
"None",
"if",
"rpcclt",
":",
"re... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/idlelib/AutoComplete.py#L166-L223 | ||
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | server/pulp/server/controllers/repository.py | python | download_deferred | () | Downloads all the units with entries in the DeferredDownload collection. | Downloads all the units with entries in the DeferredDownload collection. | [
"Downloads",
"all",
"the",
"units",
"with",
"entries",
"in",
"the",
"DeferredDownload",
"collection",
"."
] | def download_deferred():
"""
Downloads all the units with entries in the DeferredDownload collection.
"""
task_description = _('Download Cached On-Demand Content')
deferred_content_units = _get_deferred_content_units()
download_requests = _create_download_requests(deferred_content_units)
dow... | [
"def",
"download_deferred",
"(",
")",
":",
"task_description",
"=",
"_",
"(",
"'Download Cached On-Demand Content'",
")",
"deferred_content_units",
"=",
"_get_deferred_content_units",
"(",
")",
"download_requests",
"=",
"_create_download_requests",
"(",
"deferred_content_unit... | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/server/pulp/server/controllers/repository.py#L1440-L1452 | ||
robcarver17/pysystemtrade | b0385705b7135c52d39cb6d2400feece881bcca9 | syscore/text.py | python | sort_dict_by_underscore_length | (other_args) | return sorted_list_of_dicts | Sort dict according to keys and presence of leading underscores
:param other_args: dict
:return: list of dict. First element is dict of all keys with no leading underscores.
Second element is dict of all keys with 1 leading underscore...and so on | Sort dict according to keys and presence of leading underscores | [
"Sort",
"dict",
"according",
"to",
"keys",
"and",
"presence",
"of",
"leading",
"underscores"
] | def sort_dict_by_underscore_length(other_args):
"""
Sort dict according to keys and presence of leading underscores
:param other_args: dict
:return: list of dict. First element is dict of all keys with no leading underscores.
Second element is dict of all keys with 1 leading underscore...a... | [
"def",
"sort_dict_by_underscore_length",
"(",
"other_args",
")",
":",
"other_arg_keys",
"=",
"list",
"(",
"other_args",
".",
"keys",
"(",
")",
")",
"other_arg_keys_sorted",
"=",
"sort_keywords_by_underscore_length",
"(",
"other_arg_keys",
")",
"sorted_list_of_dicts",
"=... | https://github.com/robcarver17/pysystemtrade/blob/b0385705b7135c52d39cb6d2400feece881bcca9/syscore/text.py#L5-L21 | |
llcshappy/Monocular-3D-Human-Pose | 29bc314737d549d112b15d6fdd144338fbf6cab0 | 3DLabelGen/Left2Right/predict_right_pose_1.py | python | create_model | ( session, batch_size ) | return model | Create model and initialize it or load its parameters in a session
Args
session: tensorflow session
actions: list of string. Actions to train/test on
batch_size: integer. Number of examples in each batch
Returns
model: The created (or loaded) model
Raises
ValueError if asked to load a model, ... | Create model and initialize it or load its parameters in a session | [
"Create",
"model",
"and",
"initialize",
"it",
"or",
"load",
"its",
"parameters",
"in",
"a",
"session"
] | def create_model( session, batch_size ):
"""
Create model and initialize it or load its parameters in a session
Args
session: tensorflow session
actions: list of string. Actions to train/test on
batch_size: integer. Number of examples in each batch
Returns
model: The created (or loaded) model
... | [
"def",
"create_model",
"(",
"session",
",",
"batch_size",
")",
":",
"model",
"=",
"linear_model",
".",
"LinearModel",
"(",
"FLAGS",
".",
"linear_size",
",",
"FLAGS",
".",
"num_layers",
",",
"FLAGS",
".",
"residual",
",",
"FLAGS",
".",
"batch_norm",
",",
"F... | https://github.com/llcshappy/Monocular-3D-Human-Pose/blob/29bc314737d549d112b15d6fdd144338fbf6cab0/3DLabelGen/Left2Right/predict_right_pose_1.py#L76-L131 | |
Galvant/InstrumentKit | 6d216bd7f8e9ec7918762fe5fb7a306d5bd0eb1f | instruments/newport/newportesp301.py | python | NewportESP301Axis.feedback_configuration | (self) | return int(self._newport_cmd("ZB?", target=self._axis_id)[:-2], 16) | Gets/sets the axis Feedback configuration
:type: `int` | Gets/sets the axis Feedback configuration | [
"Gets",
"/",
"sets",
"the",
"axis",
"Feedback",
"configuration"
] | def feedback_configuration(self):
"""
Gets/sets the axis Feedback configuration
:type: `int`
"""
return int(self._newport_cmd("ZB?", target=self._axis_id)[:-2], 16) | [
"def",
"feedback_configuration",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"_newport_cmd",
"(",
"\"ZB?\"",
",",
"target",
"=",
"self",
".",
"_axis_id",
")",
"[",
":",
"-",
"2",
"]",
",",
"16",
")"
] | https://github.com/Galvant/InstrumentKit/blob/6d216bd7f8e9ec7918762fe5fb7a306d5bd0eb1f/instruments/newport/newportesp301.py#L919-L925 | |
iotaledger/iota.py | f596c1ac0d9bcbceda1cf6109cd921943a6599b3 | iota/crypto/signing.py | python | KeyIterator.advance | (self) | Advances the generator without creating a key. | Advances the generator without creating a key. | [
"Advances",
"the",
"generator",
"without",
"creating",
"a",
"key",
"."
] | def advance(self) -> None:
"""
Advances the generator without creating a key.
"""
self.current += self.step | [
"def",
"advance",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"current",
"+=",
"self",
".",
"step"
] | https://github.com/iotaledger/iota.py/blob/f596c1ac0d9bcbceda1cf6109cd921943a6599b3/iota/crypto/signing.py#L310-L314 | ||
SHI-Labs/Decoupled-Classification-Refinement | 16202b48eb9cbf79a9b130a98e8c209d4f24693e | faster_rcnn_dcr/symbols/resnet_v1_101_rcnn_dcn_dcr_res2.py | python | resnet_v1_101_rcnn_dcn_dcr_res2.get_symbol | (self, cfg, is_train=True) | return group | [] | def get_symbol(self, cfg, is_train=True):
if not is_train:
return self.get_symbol_test(cfg, is_train=False)
# config alias for convenient
num_classes = cfg.dataset.NUM_CLASSES
num_reg_classes = (2 if cfg.CLASS_AGNOSTIC else num_classes)
num_anchors = cfg.network.NUM... | [
"def",
"get_symbol",
"(",
"self",
",",
"cfg",
",",
"is_train",
"=",
"True",
")",
":",
"if",
"not",
"is_train",
":",
"return",
"self",
".",
"get_symbol_test",
"(",
"cfg",
",",
"is_train",
"=",
"False",
")",
"# config alias for convenient",
"num_classes",
"=",... | https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/faster_rcnn_dcr/symbols/resnet_v1_101_rcnn_dcn_dcr_res2.py#L1481-L1676 | |||
wwqgtxx/wwqLyParse | 33136508e52821babd9294fdecffbdf02d73a6fc | wwqLyParse/common/js_engine.py | python | VM.call | (self, function_name, *args) | return await self.communicate({
"action": "call",
"functionName": function_name,
"args": args
}) | Call a function and return the result.
:param str function_name: The function to call.
:param args: Function arguments.
function_name can include "." to call functions on an object. However,
it is called like:
.. code-block:: javascript
var func = vm.run("function... | Call a function and return the result. | [
"Call",
"a",
"function",
"and",
"return",
"the",
"result",
"."
] | async def call(self, function_name, *args):
"""Call a function and return the result.
:param str function_name: The function to call.
:param args: Function arguments.
function_name can include "." to call functions on an object. However,
it is called like:
.. code-bloc... | [
"async",
"def",
"call",
"(",
"self",
",",
"function_name",
",",
"*",
"args",
")",
":",
"return",
"await",
"self",
".",
"communicate",
"(",
"{",
"\"action\"",
":",
"\"call\"",
",",
"\"functionName\"",
":",
"function_name",
",",
"\"args\"",
":",
"args",
"}",... | https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/common/js_engine.py#L146-L166 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/serene/preprocessing.py | python | filter_evidence_fn | (
example, y_input) | Filter out claims/evidence that have zero length.
Args:
example: The encoded example
y_input: Unused, contains the label, included for API compat
Returns:
True to preserve example, False to filter it out | Filter out claims/evidence that have zero length. | [
"Filter",
"out",
"claims",
"/",
"evidence",
"that",
"have",
"zero",
"length",
"."
] | def filter_evidence_fn(
example, y_input):
# pylint: disable=unused-argument
"""Filter out claims/evidence that have zero length.
Args:
example: The encoded example
y_input: Unused, contains the label, included for API compat
Returns:
True to preserve example, False to filter it out
"""
# B... | [
"def",
"filter_evidence_fn",
"(",
"example",
",",
"y_input",
")",
":",
"# pylint: disable=unused-argument",
"# Bert encodes text in evidence_text_word_ids.",
"# Word embedding model uses evidence_text.",
"if",
"'evidence_text_word_ids'",
"in",
"example",
":",
"evidence_length",
"="... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/serene/preprocessing.py#L81-L104 | ||
dictation-toolbox/aenea | dfd679720b90f92340d4a8cbd4603cab37f18804 | client/aenea/alias.py | python | Alias.discard | (self, string_or_alias) | Remove string_or_alias if it is present. | Remove string_or_alias if it is present. | [
"Remove",
"string_or_alias",
"if",
"it",
"is",
"present",
"."
] | def discard(self, string_or_alias):
"""Remove string_or_alias if it is present."""
self._regex = None
sora = string_or_alias
if sora in self._map:
for alias in self._map[sora]:
del self._rmap[alias]
del self._map[string_or... | [
"def",
"discard",
"(",
"self",
",",
"string_or_alias",
")",
":",
"self",
".",
"_regex",
"=",
"None",
"sora",
"=",
"string_or_alias",
"if",
"sora",
"in",
"self",
".",
"_map",
":",
"for",
"alias",
"in",
"self",
".",
"_map",
"[",
"sora",
"]",
":",
"del"... | https://github.com/dictation-toolbox/aenea/blob/dfd679720b90f92340d4a8cbd4603cab37f18804/client/aenea/alias.py#L117-L131 | ||
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/inspect.py | python | getmoduleinfo | (path) | Get the module name, suffix, mode, and module type for a given file. | Get the module name, suffix, mode, and module type for a given file. | [
"Get",
"the",
"module",
"name",
"suffix",
"mode",
"and",
"module",
"type",
"for",
"a",
"given",
"file",
"."
] | def getmoduleinfo(path):
"""Get the module name, suffix, mode, and module type for a given file."""
warnings.warn('inspect.getmoduleinfo() is deprecated', DeprecationWarning,
2)
with warnings.catch_warnings():
warnings.simplefilter('ignore', PendingDeprecationWarning)
impor... | [
"def",
"getmoduleinfo",
"(",
"path",
")",
":",
"warnings",
".",
"warn",
"(",
"'inspect.getmoduleinfo() is deprecated'",
",",
"DeprecationWarning",
",",
"2",
")",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"'ig... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/inspect.py#L628-L641 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/widgets/playback.py | python | SeekProgressBar.do_size_allocate | (self, allocation) | Recalculates the marker points | Recalculates the marker points | [
"Recalculates",
"the",
"marker",
"points"
] | def do_size_allocate(self, allocation):
"""
Recalculates the marker points
"""
oldallocation = self.get_allocation()
Gtk.EventBox.do_size_allocate(self, allocation)
if allocation != oldallocation:
for marker in self._points:
self._points[mark... | [
"def",
"do_size_allocate",
"(",
"self",
",",
"allocation",
")",
":",
"oldallocation",
"=",
"self",
".",
"get_allocation",
"(",
")",
"Gtk",
".",
"EventBox",
".",
"do_size_allocate",
"(",
"self",
",",
"allocation",
")",
"if",
"allocation",
"!=",
"oldallocation",... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/widgets/playback.py#L790-L800 | ||
openimages/dataset | 077282972acd0ad8628f1526760ad239a38a8a97 | downloader.py | python | download_all_images | (args) | Downloads all images specified in the input file. | Downloads all images specified in the input file. | [
"Downloads",
"all",
"images",
"specified",
"in",
"the",
"input",
"file",
"."
] | def download_all_images(args):
"""Downloads all images specified in the input file."""
bucket = boto3.resource(
's3', config=botocore.config.Config(
signature_version=botocore.UNSIGNED)).Bucket(BUCKET_NAME)
download_folder = args['download_folder'] or os.getcwd()
if not os.path.exists(download... | [
"def",
"download_all_images",
"(",
"args",
")",
":",
"bucket",
"=",
"boto3",
".",
"resource",
"(",
"'s3'",
",",
"config",
"=",
"botocore",
".",
"config",
".",
"Config",
"(",
"signature_version",
"=",
"botocore",
".",
"UNSIGNED",
")",
")",
".",
"Bucket",
... | https://github.com/openimages/dataset/blob/077282972acd0ad8628f1526760ad239a38a8a97/downloader.py#L78-L107 | ||
google-research/tensorflow_constrained_optimization | 723d63f8567aaa988c4ce4761152beee2b462e1d | tensorflow_constrained_optimization/python/rates/deferred_tensor.py | python | DeferredTensorInputList.__add__ | (self, other) | return result | Appends two `DeferredTensorInputList`s. | Appends two `DeferredTensorInputList`s. | [
"Appends",
"two",
"DeferredTensorInputList",
"s",
"."
] | def __add__(self, other):
"""Appends two `DeferredTensorInputList`s."""
result = DeferredTensorInputList(self)
for element in other:
result.append(element)
return result | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"result",
"=",
"DeferredTensorInputList",
"(",
"self",
")",
"for",
"element",
"in",
"other",
":",
"result",
".",
"append",
"(",
"element",
")",
"return",
"result"
] | https://github.com/google-research/tensorflow_constrained_optimization/blob/723d63f8567aaa988c4ce4761152beee2b462e1d/tensorflow_constrained_optimization/python/rates/deferred_tensor.py#L786-L791 | |
chubin/cheat.sh | 46d1a5f73c6b88da15d809154245dbf234e9479e | lib/adapter/adapter.py | python | Adapter.save_state | (cls, state) | Save state `state` of the repository.
Must be called after the cache clean up. | Save state `state` of the repository.
Must be called after the cache clean up. | [
"Save",
"state",
"state",
"of",
"the",
"repository",
".",
"Must",
"be",
"called",
"after",
"the",
"cache",
"clean",
"up",
"."
] | def save_state(cls, state):
"""
Save state `state` of the repository.
Must be called after the cache clean up.
"""
local_repository_dir = cls.local_repository_location()
state_filename = os.path.join(local_repository_dir, '.cached_revision')
open(state_filename, '... | [
"def",
"save_state",
"(",
"cls",
",",
"state",
")",
":",
"local_repository_dir",
"=",
"cls",
".",
"local_repository_location",
"(",
")",
"state_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"local_repository_dir",
",",
"'.cached_revision'",
")",
"open",
... | https://github.com/chubin/cheat.sh/blob/46d1a5f73c6b88da15d809154245dbf234e9479e/lib/adapter/adapter.py#L270-L277 | ||
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/search_agents/muzero/utils.py | python | dcg_score | (relevances: List[float]) | return float(
sum([
relevance / np.log2(i + 2) for i, relevance in enumerate(relevances)
])) | DCG score computation.
Args:
relevances: List[float], The list of relevance scores.
Returns:
The discounted cumulative gain for k == len(relevances). | DCG score computation. | [
"DCG",
"score",
"computation",
"."
] | def dcg_score(relevances: List[float]) -> float:
"""DCG score computation.
Args:
relevances: List[float], The list of relevance scores.
Returns:
The discounted cumulative gain for k == len(relevances).
"""
return float(
sum([
relevance / np.log2(i + 2) for i, relevance in enumerate(r... | [
"def",
"dcg_score",
"(",
"relevances",
":",
"List",
"[",
"float",
"]",
")",
"->",
"float",
":",
"return",
"float",
"(",
"sum",
"(",
"[",
"relevance",
"/",
"np",
".",
"log2",
"(",
"i",
"+",
"2",
")",
"for",
"i",
",",
"relevance",
"in",
"enumerate",
... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/search_agents/muzero/utils.py#L130-L142 | |
JustDoPython/python-100-day | 4e75007195aa4cdbcb899aeb06b9b08996a4606c | wsfriends/wxfriends.py | python | WxFriends.show | (self) | [] | def show(self):
labels = self.province_dict.keys()
means = self.province_dict.values()
index = np.arange(len(labels)) + 1
# 方块宽度
width = 0.5
# 透明度
opacity = 0.4
fig, ax = plt.subplots()
rects = ax.bar(index + width, means, width, alpha=opacity, col... | [
"def",
"show",
"(",
"self",
")",
":",
"labels",
"=",
"self",
".",
"province_dict",
".",
"keys",
"(",
")",
"means",
"=",
"self",
".",
"province_dict",
".",
"values",
"(",
")",
"index",
"=",
"np",
".",
"arange",
"(",
"len",
"(",
"labels",
")",
")",
... | https://github.com/JustDoPython/python-100-day/blob/4e75007195aa4cdbcb899aeb06b9b08996a4606c/wsfriends/wxfriends.py#L76-L99 | ||||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/site-packages/setuptools/command/bdist_egg.py | python | bdist_egg.copy_metadata_to | (self, target_dir) | Copy metadata (egg info) to the target_dir | Copy metadata (egg info) to the target_dir | [
"Copy",
"metadata",
"(",
"egg",
"info",
")",
"to",
"the",
"target_dir"
] | def copy_metadata_to(self, target_dir):
"Copy metadata (egg info) to the target_dir"
# normalize the path (so that a forward-slash in egg_info will
# match using startswith below)
norm_egg_info = os.path.normpath(self.egg_info)
prefix = os.path.join(norm_egg_info, '')
for... | [
"def",
"copy_metadata_to",
"(",
"self",
",",
"target_dir",
")",
":",
"# normalize the path (so that a forward-slash in egg_info will",
"# match using startswith below)",
"norm_egg_info",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"self",
".",
"egg_info",
")",
"prefix",... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/setuptools/command/bdist_egg.py#L286-L296 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/urllib3/_collections.py | python | HTTPHeaderDict.add | (self, key, val) | Adds a (name, value) pair, doesn't overwrite the value if it already
exists.
>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz' | Adds a (name, value) pair, doesn't overwrite the value if it already
exists. | [
"Adds",
"a",
"(",
"name",
"value",
")",
"pair",
"doesn",
"t",
"overwrite",
"the",
"value",
"if",
"it",
"already",
"exists",
"."
] | def add(self, key, val):
"""Adds a (name, value) pair, doesn't overwrite the value if it already
exists.
>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz'
"""
key_lower = key.lower()
new_vals = [ke... | [
"def",
"add",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"key_lower",
"=",
"key",
".",
"lower",
"(",
")",
"new_vals",
"=",
"[",
"key",
",",
"val",
"]",
"# Keep the common case aka no item present as fast as possible",
"vals",
"=",
"self",
".",
"_containe... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/urllib3/_collections.py#L208-L222 | ||
rwl/PYPOWER | f5be0406aa54dcebded075de075454f99e2a46e6 | pypower/dSbus_dV.py | python | dSbus_dV | (Ybus, V) | return dS_dVm, dS_dVa | Computes partial derivatives of power injection w.r.t. voltage.
Returns two matrices containing partial derivatives of the complex bus
power injections w.r.t voltage magnitude and voltage angle respectively
(for all buses). If C{Ybus} is a sparse matrix, the return values will be
also. The following ex... | Computes partial derivatives of power injection w.r.t. voltage. | [
"Computes",
"partial",
"derivatives",
"of",
"power",
"injection",
"w",
".",
"r",
".",
"t",
".",
"voltage",
"."
] | def dSbus_dV(Ybus, V):
"""Computes partial derivatives of power injection w.r.t. voltage.
Returns two matrices containing partial derivatives of the complex bus
power injections w.r.t voltage magnitude and voltage angle respectively
(for all buses). If C{Ybus} is a sparse matrix, the return values will... | [
"def",
"dSbus_dV",
"(",
"Ybus",
",",
"V",
")",
":",
"ib",
"=",
"range",
"(",
"len",
"(",
"V",
")",
")",
"if",
"issparse",
"(",
"Ybus",
")",
":",
"Ibus",
"=",
"Ybus",
"*",
"V",
"diagV",
"=",
"sparse",
"(",
"(",
"V",
",",
"(",
"ib",
",",
"ib"... | https://github.com/rwl/PYPOWER/blob/f5be0406aa54dcebded075de075454f99e2a46e6/pypower/dSbus_dV.py#L12-L71 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/xml/sax/saxutils.py | python | XMLFilterBase.parse | (self, source) | [] | def parse(self, source):
self._parent.setContentHandler(self)
self._parent.setErrorHandler(self)
self._parent.setEntityResolver(self)
self._parent.setDTDHandler(self)
self._parent.parse(source) | [
"def",
"parse",
"(",
"self",
",",
"source",
")",
":",
"self",
".",
"_parent",
".",
"setContentHandler",
"(",
"self",
")",
"self",
".",
"_parent",
".",
"setErrorHandler",
"(",
"self",
")",
"self",
".",
"_parent",
".",
"setEntityResolver",
"(",
"self",
")"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/xml/sax/saxutils.py#L278-L283 | ||||
aleju/imgaug | 0101108d4fed06bc5056c4a03e2bcb0216dac326 | imgaug/augmenters/blend.py | python | FrequencyNoiseAlpha | (exponent=(-4, 4), first=None, second=None,
per_channel=False, size_px_max=(4, 16),
upscale_method=None,
iterations=(1, 3), aggregation_method=["avg", "max"],
sigmoid=0.5, sigmoid_thresh=None,
seed=No... | return BlendAlphaFrequencyNoise(
exponent=exponent,
foreground=first,
background=second,
per_channel=per_channel,
size_px_max=size_px_max,
upscale_method=upscale_method,
iterations=iterations,
aggregation_method=aggregation_method,
sigmoid=sigmoid,... | See :class:`BlendAlphaFrequencyNoise`.
Deprecated since 0.4.0. | See :class:`BlendAlphaFrequencyNoise`. | [
"See",
":",
"class",
":",
"BlendAlphaFrequencyNoise",
"."
] | def FrequencyNoiseAlpha(exponent=(-4, 4), first=None, second=None,
per_channel=False, size_px_max=(4, 16),
upscale_method=None,
iterations=(1, 3), aggregation_method=["avg", "max"],
sigmoid=0.5, sigmoid_thresh=None,
... | [
"def",
"FrequencyNoiseAlpha",
"(",
"exponent",
"=",
"(",
"-",
"4",
",",
"4",
")",
",",
"first",
"=",
"None",
",",
"second",
"=",
"None",
",",
"per_channel",
"=",
"False",
",",
"size_px_max",
"=",
"(",
"4",
",",
"16",
")",
",",
"upscale_method",
"=",
... | https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/blend.py#L4023-L4048 | |
sabri-zaki/EasY_HaCk | 2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9 | .modules/.sqlmap/thirdparty/fcrypt/fcrypt.py | python | _test | () | return doctest.testmod(fcrypt) | Run doctest on fcrypt module. | Run doctest on fcrypt module. | [
"Run",
"doctest",
"on",
"fcrypt",
"module",
"."
] | def _test():
"""Run doctest on fcrypt module."""
import doctest, fcrypt
return doctest.testmod(fcrypt) | [
"def",
"_test",
"(",
")",
":",
"import",
"doctest",
",",
"fcrypt",
"return",
"doctest",
".",
"testmod",
"(",
"fcrypt",
")"
] | https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/thirdparty/fcrypt/fcrypt.py#L609-L612 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_container.py | python | V1Container.__ne__ | (self, other) | return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | Returns true if both objects are not equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"not",
"equal"
] | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, V1Container):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1Container",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_container.py#L694-L699 | |
nsacyber/WALKOFF | 52d3311abe99d64cd2a902eb998c5e398efe0e07 | common/walkoff_client/walkoff_client/api/apps_api.py | python | AppsApi.create_app_api | (self, app_api, **kwargs) | return self.create_app_api_with_http_info(app_api, **kwargs) | Create app api # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_app_api(app_api, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request async... | Create app api # noqa: E501 | [
"Create",
"app",
"api",
"#",
"noqa",
":",
"E501"
] | def create_app_api(self, app_api, **kwargs): # noqa: E501
"""Create app api # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_app_api(app_api, async_req=True)
>>> resul... | [
"def",
"create_app_api",
"(",
"self",
",",
"app_api",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"create_app_api_with_http_info",
"(",
"app_api",
",",
"*",
"*",
"kwargs... | https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/api/apps_api.py#L40-L62 | |
ktbyers/pynet | f01ca44afe1db1e64828fc93028f67410174719e | pyth_ans_ecourse/class8/ex5_db_show_version.py | python | main | () | Use Netmiko to connect to each of the devices in the database. Execute
'show version' on each device. | Use Netmiko to connect to each of the devices in the database. Execute
'show version' on each device. | [
"Use",
"Netmiko",
"to",
"connect",
"to",
"each",
"of",
"the",
"devices",
"in",
"the",
"database",
".",
"Execute",
"show",
"version",
"on",
"each",
"device",
"."
] | def main():
'''
Use Netmiko to connect to each of the devices in the database. Execute
'show version' on each device.
'''
django.setup()
start_time = datetime.now()
devices = NetworkDevice.objects.all()
for a_device in devices:
show_version(a_device)
elapsed_time = datetime... | [
"def",
"main",
"(",
")",
":",
"django",
".",
"setup",
"(",
")",
"start_time",
"=",
"datetime",
".",
"now",
"(",
")",
"devices",
"=",
"NetworkDevice",
".",
"objects",
".",
"all",
"(",
")",
"for",
"a_device",
"in",
"devices",
":",
"show_version",
"(",
... | https://github.com/ktbyers/pynet/blob/f01ca44afe1db1e64828fc93028f67410174719e/pyth_ans_ecourse/class8/ex5_db_show_version.py#L29-L42 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/idlelib/configDialog.py | python | ConfigDialog.AddChangedItem | (self, typ, section, item, value) | [] | def AddChangedItem(self, typ, section, item, value):
value = str(value) #make sure we use a string
if section not in self.changedItems[typ]:
self.changedItems[typ][section] = {}
self.changedItems[typ][section][item] = value | [
"def",
"AddChangedItem",
"(",
"self",
",",
"typ",
",",
"section",
",",
"item",
",",
"value",
")",
":",
"value",
"=",
"str",
"(",
"value",
")",
"#make sure we use a string",
"if",
"section",
"not",
"in",
"self",
".",
"changedItems",
"[",
"typ",
"]",
":",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/configDialog.py#L623-L627 | ||||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/reportlab/src/reportlab/graphics/charts/axes.py | python | sample5c | () | return drawing | Sample drawing, xvalue/yvalue axes, y connected at right of x. | Sample drawing, xvalue/yvalue axes, y connected at right of x. | [
"Sample",
"drawing",
"xvalue",
"/",
"yvalue",
"axes",
"y",
"connected",
"at",
"right",
"of",
"x",
"."
] | def sample5c():
"Sample drawing, xvalue/yvalue axes, y connected at right of x."
drawing = Drawing(400, 200)
data = [(10, 20, 30, 42)]
xAxis = XValueAxis()
xAxis.setPosition(50, 50, 300)
xAxis.configure(data)
yAxis = YValueAxis()
yAxis.setPosition(50, 50, 125)
yAxis.joinAxis = xAxis
... | [
"def",
"sample5c",
"(",
")",
":",
"drawing",
"=",
"Drawing",
"(",
"400",
",",
"200",
")",
"data",
"=",
"[",
"(",
"10",
",",
"20",
",",
"30",
",",
"42",
")",
"]",
"xAxis",
"=",
"XValueAxis",
"(",
")",
"xAxis",
".",
"setPosition",
"(",
"50",
",",... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/src/reportlab/graphics/charts/axes.py#L2161-L2175 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/pysaml2-4.9.0/src/saml2/assertion.py | python | _authn_context_decl_ref | (decl_ref, authn_auth=None) | return factory(saml.AuthnContext,
authn_context_decl_ref=decl_ref,
authenticating_authority=factory(
saml.AuthenticatingAuthority, text=authn_auth)) | Construct the authn context with a authn context declaration reference
:param decl_ref: The authn context declaration reference
:param authn_auth: Authenticating Authority
:return: An AuthnContext instance | Construct the authn context with a authn context declaration reference
:param decl_ref: The authn context declaration reference
:param authn_auth: Authenticating Authority
:return: An AuthnContext instance | [
"Construct",
"the",
"authn",
"context",
"with",
"a",
"authn",
"context",
"declaration",
"reference",
":",
"param",
"decl_ref",
":",
"The",
"authn",
"context",
"declaration",
"reference",
":",
"param",
"authn_auth",
":",
"Authenticating",
"Authority",
":",
"return"... | def _authn_context_decl_ref(decl_ref, authn_auth=None):
"""
Construct the authn context with a authn context declaration reference
:param decl_ref: The authn context declaration reference
:param authn_auth: Authenticating Authority
:return: An AuthnContext instance
"""
return factory(saml.Au... | [
"def",
"_authn_context_decl_ref",
"(",
"decl_ref",
",",
"authn_auth",
"=",
"None",
")",
":",
"return",
"factory",
"(",
"saml",
".",
"AuthnContext",
",",
"authn_context_decl_ref",
"=",
"decl_ref",
",",
"authenticating_authority",
"=",
"factory",
"(",
"saml",
".",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/assertion.py#L620-L630 | |
KoreLogicSecurity/mastiff | 04d569e4fa59513572e77c74b049cad82f9b0310 | mastiff/plugins/output/__init__.py | python | table.addtitle | (self, title=None) | Add a title to the table. | Add a title to the table. | [
"Add",
"a",
"title",
"to",
"the",
"table",
"."
] | def addtitle(self, title=None):
""" Add a title to the table. """
if title is not None:
self.title = title
else:
self.title = '' | [
"def",
"addtitle",
"(",
"self",
",",
"title",
"=",
"None",
")",
":",
"if",
"title",
"is",
"not",
"None",
":",
"self",
".",
"title",
"=",
"title",
"else",
":",
"self",
".",
"title",
"=",
"''"
] | https://github.com/KoreLogicSecurity/mastiff/blob/04d569e4fa59513572e77c74b049cad82f9b0310/mastiff/plugins/output/__init__.py#L87-L92 | ||
nschloe/quadpy | c4c076d8ddfa968486a2443a95e2fb3780dcde0f | src/quadpy/t2/_lyness_jespersen.py | python | lyness_jespersen_02 | () | return T2Scheme("Lyness-Jespersen 2", d, 2, source) | [] | def lyness_jespersen_02():
d = {
"centroid": [[frac(3, 4)]],
"vertex": [[frac(1, 12)]],
}
return T2Scheme("Lyness-Jespersen 2", d, 2, source) | [
"def",
"lyness_jespersen_02",
"(",
")",
":",
"d",
"=",
"{",
"\"centroid\"",
":",
"[",
"[",
"frac",
"(",
"3",
",",
"4",
")",
"]",
"]",
",",
"\"vertex\"",
":",
"[",
"[",
"frac",
"(",
"1",
",",
"12",
")",
"]",
"]",
",",
"}",
"return",
"T2Scheme",
... | https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/t2/_lyness_jespersen.py#L27-L32 | |||
ecdavis/pants | 88129d24020e95b71e8d0260a111dc0b457b0676 | pants/contrib/irc.py | python | BaseIRC.send_command | (self, command, *args, **kwargs) | Send a command to the remote endpoint.
========= ======== ============
Argument Default Description
========= ======== ============
command The command to send.
\*args *Optional.* A list of arguments to send with the command.
_prefix ... | Send a command to the remote endpoint. | [
"Send",
"a",
"command",
"to",
"the",
"remote",
"endpoint",
"."
] | def send_command(self, command, *args, **kwargs):
"""
Send a command to the remote endpoint.
========= ======== ============
Argument Default Description
========= ======== ============
command The command to send.
\*args *Opti... | [
"def",
"send_command",
"(",
"self",
",",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"args",
"=",
"list",
"(",
"args",
")",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"args",
")",
")",
":",
"arg",
"=",
... | https://github.com/ecdavis/pants/blob/88129d24020e95b71e8d0260a111dc0b457b0676/pants/contrib/irc.py#L172-L206 | ||
OpenMDAO/OpenMDAO | f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd | openmdao/components/linear_system_comp.py | python | LinearSystemComp.__init__ | (self, **kwargs) | Intialize the LinearSystemComp component. | Intialize the LinearSystemComp component. | [
"Intialize",
"the",
"LinearSystemComp",
"component",
"."
] | def __init__(self, **kwargs):
"""
Intialize the LinearSystemComp component.
"""
super().__init__(**kwargs)
self._lup = None
self._no_check_partials = True | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"_lup",
"=",
"None",
"self",
".",
"_no_check_partials",
"=",
"True"
] | https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/components/linear_system_comp.py#L28-L35 | ||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/pytz/tzinfo.py | python | StaticTzInfo.localize | (self, dt, is_dst=False) | return dt.replace(tzinfo=self) | Convert naive time to local time | Convert naive time to local time | [
"Convert",
"naive",
"time",
"to",
"local",
"time"
] | def localize(self, dt, is_dst=False):
'''Convert naive time to local time'''
if dt.tzinfo is not None:
raise ValueError('Not naive datetime (tzinfo is already set)')
return dt.replace(tzinfo=self) | [
"def",
"localize",
"(",
"self",
",",
"dt",
",",
"is_dst",
"=",
"False",
")",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"'Not naive datetime (tzinfo is already set)'",
")",
"return",
"dt",
".",
"replace",
"(",
"tz... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/pytz/tzinfo.py#L112-L116 | |
microsoft/MPNet | 081523a788c1556f28dd90cbc629810f48b083fb | pretraining/fairseq/data/concat_dataset.py | python | ConcatDataset.ordered_indices | (self) | return np.argsort(self.sizes) | Returns indices sorted by length. So less padding is needed. | Returns indices sorted by length. So less padding is needed. | [
"Returns",
"indices",
"sorted",
"by",
"length",
".",
"So",
"less",
"padding",
"is",
"needed",
"."
] | def ordered_indices(self):
"""
Returns indices sorted by length. So less padding is needed.
"""
return np.argsort(self.sizes) | [
"def",
"ordered_indices",
"(",
"self",
")",
":",
"return",
"np",
".",
"argsort",
"(",
"self",
".",
"sizes",
")"
] | https://github.com/microsoft/MPNet/blob/081523a788c1556f28dd90cbc629810f48b083fb/pretraining/fairseq/data/concat_dataset.py#L87-L91 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/contrib/_securetransport/low_level.py | python | _temporary_keychain | () | return keychain, tempdirectory | This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, including calling
SecKeychainDelete.... | This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, including calling
SecKeychainDelete. | [
"This",
"function",
"creates",
"a",
"temporary",
"Mac",
"keychain",
"that",
"we",
"can",
"use",
"to",
"work",
"with",
"credentials",
".",
"This",
"keychain",
"uses",
"a",
"one",
"-",
"time",
"password",
"and",
"a",
"temporary",
"file",
"to",
"store",
"the"... | def _temporary_keychain():
"""
This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, i... | [
"def",
"_temporary_keychain",
"(",
")",
":",
"# Unfortunately, SecKeychainCreate requires a path to a keychain. This",
"# means we cannot use mkstemp to use a generic temporary file. Instead,",
"# we're going to create a temporary directory and a filename to use there.",
"# This filename will be 8 r... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/contrib/_securetransport/low_level.py#L171-L208 | |
JinnLynn/genpac | 2f466d28f403a9a5624e02edcd538475fe475fc8 | genpac/formats.py | python | FmtBase.tpl | (self) | return text_type(self._default_tpl) | [] | def tpl(self):
if self.options.template:
return text_type(TemplateFile(self.options.template))
return text_type(self._default_tpl) | [
"def",
"tpl",
"(",
"self",
")",
":",
"if",
"self",
".",
"options",
".",
"template",
":",
"return",
"text_type",
"(",
"TemplateFile",
"(",
"self",
".",
"options",
".",
"template",
")",
")",
"return",
"text_type",
"(",
"self",
".",
"_default_tpl",
")"
] | https://github.com/JinnLynn/genpac/blob/2f466d28f403a9a5624e02edcd538475fe475fc8/genpac/formats.py#L48-L51 | |||
benedekrozemberczki/DANMF | 6726fbfb9a1d4f8a19650ee89773e1c544329321 | src/danmf.py | python | DANMF.update_V | (self, i) | Updating right hand factors.
:param i: Layer index. | Updating right hand factors.
:param i: Layer index. | [
"Updating",
"right",
"hand",
"factors",
".",
":",
"param",
"i",
":",
"Layer",
"index",
"."
] | def update_V(self, i):
"""
Updating right hand factors.
:param i: Layer index.
"""
if i < self.p-1:
Vu = 2*self.A.dot(self.P).T
Vd = self.P.T.dot(self.P).dot(self.V_s[i])+self.V_s[i]
self.V_s[i] = self.V_s[i] * Vu/np.maximum(Vd, 10**-10)
... | [
"def",
"update_V",
"(",
"self",
",",
"i",
")",
":",
"if",
"i",
"<",
"self",
".",
"p",
"-",
"1",
":",
"Vu",
"=",
"2",
"*",
"self",
".",
"A",
".",
"dot",
"(",
"self",
".",
"P",
")",
".",
"T",
"Vd",
"=",
"self",
".",
"P",
".",
"T",
".",
... | https://github.com/benedekrozemberczki/DANMF/blob/6726fbfb9a1d4f8a19650ee89773e1c544329321/src/danmf.py#L98-L111 | ||
frappe/erpnext | 9d36e30ef7043b391b5ed2523b8288bf46c45d18 | erpnext/manufacturing/doctype/work_order/work_order.py | python | WorkOrder.update_reserved_qty_for_production | (self, items=None) | update reserved_qty_for_production in bins | update reserved_qty_for_production in bins | [
"update",
"reserved_qty_for_production",
"in",
"bins"
] | def update_reserved_qty_for_production(self, items=None):
'''update reserved_qty_for_production in bins'''
for d in self.required_items:
if d.source_warehouse:
stock_bin = get_bin(d.item_code, d.source_warehouse)
stock_bin.update_reserved_qty_for_production() | [
"def",
"update_reserved_qty_for_production",
"(",
"self",
",",
"items",
"=",
"None",
")",
":",
"for",
"d",
"in",
"self",
".",
"required_items",
":",
"if",
"d",
".",
"source_warehouse",
":",
"stock_bin",
"=",
"get_bin",
"(",
"d",
".",
"item_code",
",",
"d",... | https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/manufacturing/doctype/work_order/work_order.py#L648-L653 | ||
lena-voita/the-story-of-heads | efaa0dd520400baa760654b5b85396c203d3cbb7 | lib/train/tickers.py | python | DevSubscriber.after_dev_run | (self, dev_name, dev_run_values) | Called each dev step after evaluating ops and provides their results | Called each dev step after evaluating ops and provides their results | [
"Called",
"each",
"dev",
"step",
"after",
"evaluating",
"ops",
"and",
"provides",
"their",
"results"
] | def after_dev_run(self, dev_name, dev_run_values):
"""
Called each dev step after evaluating ops and provides their results
"""
pass | [
"def",
"after_dev_run",
"(",
"self",
",",
"dev_name",
",",
"dev_run_values",
")",
":",
"pass"
] | https://github.com/lena-voita/the-story-of-heads/blob/efaa0dd520400baa760654b5b85396c203d3cbb7/lib/train/tickers.py#L206-L210 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/bz2.py | python | BZ2File.readline | (self, size=-1) | return self._buffer.readline(size) | Read a line of uncompressed bytes from the file.
The terminating newline (if present) is retained. If size is
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF. | Read a line of uncompressed bytes from the file. | [
"Read",
"a",
"line",
"of",
"uncompressed",
"bytes",
"from",
"the",
"file",
"."
] | def readline(self, size=-1):
"""Read a line of uncompressed bytes from the file.
The terminating newline (if present) is retained. If size is
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF.
"""
... | [
"def",
"readline",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"size",
",",
"int",
")",
":",
"if",
"not",
"hasattr",
"(",
"size",
",",
"\"__index__\"",
")",
":",
"raise",
"TypeError",
"(",
"\"Integer argument expe... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/bz2.py#L186-L198 | |
readthedocs/readthedocs.org | 0852d7c10d725d954d3e9a93513171baa1116d9f | readthedocs/projects/tasks.py | python | UpdateDocsTaskStep.setup_python_environment | (self) | Build the virtualenv and install the project into it.
Always build projects with a virtualenv.
:param build_env: Build environment to pass commands and execution through. | Build the virtualenv and install the project into it. | [
"Build",
"the",
"virtualenv",
"and",
"install",
"the",
"project",
"into",
"it",
"."
] | def setup_python_environment(self):
"""
Build the virtualenv and install the project into it.
Always build projects with a virtualenv.
:param build_env: Build environment to pass commands and execution through.
"""
self.build_env.update_build(state=BUILD_STATE_INSTALLIN... | [
"def",
"setup_python_environment",
"(",
"self",
")",
":",
"self",
".",
"build_env",
".",
"update_build",
"(",
"state",
"=",
"BUILD_STATE_INSTALLING",
")",
"# Check if the python version/build image in the current venv is the",
"# same to be used in this build and if it differs, wip... | https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/projects/tasks.py#L1145-L1172 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | linkcheck/checker/fileurl.py | python | FileUrl.is_directory | (self) | return os.path.isdir(filename) and not os.path.islink(filename) | Check if file is a directory.
@return: True iff file is a directory
@rtype: bool | Check if file is a directory. | [
"Check",
"if",
"file",
"is",
"a",
"directory",
"."
] | def is_directory (self):
"""
Check if file is a directory.
@return: True iff file is a directory
@rtype: bool
"""
filename = self.get_os_filename()
return os.path.isdir(filename) and not os.path.islink(filename) | [
"def",
"is_directory",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"get_os_filename",
"(",
")",
"return",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
"and",
"not",
"os",
".",
"path",
".",
"islink",
"(",
"filename",
")"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/fileurl.py#L233-L241 | |
jasperproject/jasper-client | 85accbb30a2bc97995ab7991d71941885b848cfa | client/app_utils.py | python | sendEmail | (SUBJECT, BODY, TO, FROM, SENDER, PASSWORD, SMTP_SERVER) | Sends an HTML email. | Sends an HTML email. | [
"Sends",
"an",
"HTML",
"email",
"."
] | def sendEmail(SUBJECT, BODY, TO, FROM, SENDER, PASSWORD, SMTP_SERVER):
"""Sends an HTML email."""
for body_charset in 'US-ASCII', 'ISO-8859-1', 'UTF-8':
try:
BODY.encode(body_charset)
except UnicodeError:
pass
else:
break
msg = MIMEText(BODY.encode... | [
"def",
"sendEmail",
"(",
"SUBJECT",
",",
"BODY",
",",
"TO",
",",
"FROM",
",",
"SENDER",
",",
"PASSWORD",
",",
"SMTP_SERVER",
")",
":",
"for",
"body_charset",
"in",
"'US-ASCII'",
",",
"'ISO-8859-1'",
",",
"'UTF-8'",
":",
"try",
":",
"BODY",
".",
"encode",... | https://github.com/jasperproject/jasper-client/blob/85accbb30a2bc97995ab7991d71941885b848cfa/client/app_utils.py#L9-L28 | ||
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/worker/WorkerQuests.py | python | WorkerQuests._post_move_location_routine | (self, timestamp: float) | [] | def _post_move_location_routine(self, timestamp: float):
if self._stop_worker_event.is_set():
raise InternalStopWorkerException
position_type = self._mapping_manager.routemanager_get_position_type(self._routemanager_name,
... | [
"def",
"_post_move_location_routine",
"(",
"self",
",",
"timestamp",
":",
"float",
")",
":",
"if",
"self",
".",
"_stop_worker_event",
".",
"is_set",
"(",
")",
":",
"raise",
"InternalStopWorkerException",
"position_type",
"=",
"self",
".",
"_mapping_manager",
".",
... | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/worker/WorkerQuests.py#L257-L287 | ||||
saymedia/remoteobjects | d250e9a0e53c53744cb16c5fb2dc136df3785c1f | remoteobjects/promise.py | python | PromiseObject._set_api_data | (self, value) | [] | def _set_api_data(self, value):
self.__dict__['api_data'] = value | [
"def",
"_set_api_data",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"__dict__",
"[",
"'api_data'",
"]",
"=",
"value"
] | https://github.com/saymedia/remoteobjects/blob/d250e9a0e53c53744cb16c5fb2dc136df3785c1f/remoteobjects/promise.py#L139-L140 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/polyclasses.py | python | DMP.eject | (f, dom, front=False) | return f.__class__(F, dom, f.lev - len(dom.symbols)) | Eject selected generators into the ground domain. | Eject selected generators into the ground domain. | [
"Eject",
"selected",
"generators",
"into",
"the",
"ground",
"domain",
"."
] | def eject(f, dom, front=False):
"""Eject selected generators into the ground domain. """
F = dmp_eject(f.rep, f.lev, dom, front=front)
return f.__class__(F, dom, f.lev - len(dom.symbols)) | [
"def",
"eject",
"(",
"f",
",",
"dom",
",",
"front",
"=",
"False",
")",
":",
"F",
"=",
"dmp_eject",
"(",
"f",
".",
"rep",
",",
"f",
".",
"lev",
",",
"dom",
",",
"front",
"=",
"front",
")",
"return",
"f",
".",
"__class__",
"(",
"F",
",",
"dom",... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/polyclasses.py#L348-L351 | |
wangheda/youtube-8m | 07e54b387ee027cb58b0c14f5eb7c88cfa516d58 | youtube-8m-zhangteng/eval_embedding.py | python | get_input_evaluation_tensors | (reader,
data_pattern,
batch_size=1024,
num_readers=1) | Creates the section of the graph which reads the evaluation data.
Args:
reader: A class which parses the training data.
data_pattern: A 'glob' style path to the data files.
batch_size: How many examples to process at a time.
num_readers: How many I/O threads to use.
Returns:
A tuple containing... | Creates the section of the graph which reads the evaluation data. | [
"Creates",
"the",
"section",
"of",
"the",
"graph",
"which",
"reads",
"the",
"evaluation",
"data",
"."
] | def get_input_evaluation_tensors(reader,
data_pattern,
batch_size=1024,
num_readers=1):
"""Creates the section of the graph which reads the evaluation data.
Args:
reader: A class which parses the training data.
... | [
"def",
"get_input_evaluation_tensors",
"(",
"reader",
",",
"data_pattern",
",",
"batch_size",
"=",
"1024",
",",
"num_readers",
"=",
"1",
")",
":",
"logging",
".",
"info",
"(",
"\"Using batch size of \"",
"+",
"str",
"(",
"batch_size",
")",
"+",
"\" for evaluatio... | https://github.com/wangheda/youtube-8m/blob/07e54b387ee027cb58b0c14f5eb7c88cfa516d58/youtube-8m-zhangteng/eval_embedding.py#L81-L117 | ||
gnuradio/pybombs | 17044241bf835b93571026b112f179f2db7448a4 | pybombs/commands/autoconfig.py | python | AutoConfigurator._auto_config_makewidth | (self) | return multiprocessing.cpu_count() | Automatically set: makewidth | Automatically set: makewidth | [
"Automatically",
"set",
":",
"makewidth"
] | def _auto_config_makewidth(self):
" Automatically set: makewidth "
import multiprocessing
return multiprocessing.cpu_count() | [
"def",
"_auto_config_makewidth",
"(",
"self",
")",
":",
"import",
"multiprocessing",
"return",
"multiprocessing",
".",
"cpu_count",
"(",
")"
] | https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/commands/autoconfig.py#L41-L44 | |
facetoe/zenpy | e614e973aa4d3c4c2a0b91767c2d8565f48ec717 | zenpy/lib/api_objects/__init__.py | python | SuspendedTicket.brand | (self) | | Comment: The id of the brand this ticket is associated with - only applicable for enterprise accounts | | Comment: The id of the brand this ticket is associated with - only applicable for enterprise accounts | [
"|",
"Comment",
":",
"The",
"id",
"of",
"the",
"brand",
"this",
"ticket",
"is",
"associated",
"with",
"-",
"only",
"applicable",
"for",
"enterprise",
"accounts"
] | def brand(self):
"""
| Comment: The id of the brand this ticket is associated with - only applicable for enterprise accounts
"""
if self.api and self.brand_id:
return self.api._get_brand(self.brand_id) | [
"def",
"brand",
"(",
"self",
")",
":",
"if",
"self",
".",
"api",
"and",
"self",
".",
"brand_id",
":",
"return",
"self",
".",
"api",
".",
"_get_brand",
"(",
"self",
".",
"brand_id",
")"
] | https://github.com/facetoe/zenpy/blob/e614e973aa4d3c4c2a0b91767c2d8565f48ec717/zenpy/lib/api_objects/__init__.py#L3646-L3651 | ||
itayhubara/BinaryNet.pytorch | b99870af6e73992896ab5db5ea26b83d2adb1201 | models/resnet_binary.py | python | Bottleneck.forward | (self, x) | return out | [] | def forward(self, x):
residual = x
import pdb; pdb.set_trace()
out = self.conv1(x)
out = self.bn1(out)
out = self.tanh(out)
out = self.conv2(out)
out = self.bn2(out)
out = self.tanh(out)
out = self.conv3(out)
out = self.bn3(out)
... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"residual",
"=",
"x",
"import",
"pdb",
"pdb",
".",
"set_trace",
"(",
")",
"out",
"=",
"self",
".",
"conv1",
"(",
"x",
")",
"out",
"=",
"self",
".",
"bn1",
"(",
"out",
")",
"out",
"=",
"self",
... | https://github.com/itayhubara/BinaryNet.pytorch/blob/b99870af6e73992896ab5db5ea26b83d2adb1201/models/resnet_binary.py#L85-L107 | |||
SeldonIO/alibi | ce961caf995d22648a8338857822c90428af4765 | alibi/explainers/backends/tensorflow/cfrl_base.py | python | encode | (X: Union[tf.Tensor, np.ndarray], encoder: keras.Model, **kwargs) | return encoder(X, training=False) | Encodes the input tensor.
Parameters
----------
X
Input to be encoded.
encoder
Pretrained encoder network.
Returns
-------
Input encoding. | Encodes the input tensor. | [
"Encodes",
"the",
"input",
"tensor",
"."
] | def encode(X: Union[tf.Tensor, np.ndarray], encoder: keras.Model, **kwargs) -> tf.Tensor:
"""
Encodes the input tensor.
Parameters
----------
X
Input to be encoded.
encoder
Pretrained encoder network.
Returns
-------
Input encoding.
"""
return encoder(X,... | [
"def",
"encode",
"(",
"X",
":",
"Union",
"[",
"tf",
".",
"Tensor",
",",
"np",
".",
"ndarray",
"]",
",",
"encoder",
":",
"keras",
".",
"Model",
",",
"*",
"*",
"kwargs",
")",
"->",
"tf",
".",
"Tensor",
":",
"return",
"encoder",
"(",
"X",
",",
"tr... | https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/backends/tensorflow/cfrl_base.py#L236-L251 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pip/_internal/req/req_uninstall.py | python | compress_for_output_listing | (paths) | return will_remove, will_skip | Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
at the end - to signify that all it's contents are removed.
The second set contains files that wou... | Returns a tuple of 2 sets of which paths to display to user | [
"Returns",
"a",
"tuple",
"of",
"2",
"sets",
"of",
"which",
"paths",
"to",
"display",
"to",
"user"
] | def compress_for_output_listing(paths):
# type: (Iterable[str]) -> Tuple[Set[str], Set[str]]
"""Returns a tuple of 2 sets of which paths to display to user
The first set contains paths that would be deleted. Files of a package
are not added and the top-level directory of the package has a '*' added
... | [
"def",
"compress_for_output_listing",
"(",
"paths",
")",
":",
"# type: (Iterable[str]) -> Tuple[Set[str], Set[str]]",
"will_remove",
"=",
"set",
"(",
"paths",
")",
"will_skip",
"=",
"set",
"(",
")",
"# Determine folders and files",
"folders",
"=",
"set",
"(",
")",
"fi... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_internal/req/req_uninstall.py#L151-L199 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py | python | HyperbolicGeodesicKM.plot | (self, boundary=True, **options) | return pic | r"""
Plot ``self``.
EXAMPLES::
sage: HyperbolicPlane().KM().get_geodesic((0,0), (1,0)).plot() # optional - sage.plot
Graphics object consisting of 2 graphics primitives
.. PLOT::
KM = HyperbolicPlane().KM()
sphinx_plot(KM.get_geodesic((0,0), (... | r"""
Plot ``self``. | [
"r",
"Plot",
"self",
"."
] | def plot(self, boundary=True, **options):
r"""
Plot ``self``.
EXAMPLES::
sage: HyperbolicPlane().KM().get_geodesic((0,0), (1,0)).plot() # optional - sage.plot
Graphics object consisting of 2 graphics primitives
.. PLOT::
KM = HyperbolicPlane().KM(... | [
"def",
"plot",
"(",
"self",
",",
"boundary",
"=",
"True",
",",
"*",
"*",
"options",
")",
":",
"opts",
"=",
"{",
"'axes'",
":",
"False",
",",
"'aspect_ratio'",
":",
"1",
"}",
"opts",
".",
"update",
"(",
"self",
".",
"graphics_options",
"(",
")",
")"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py#L2297-L2318 | |
Yonsm/.homeassistant | 4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26 | custom_components/xiaomi_fan_circulator/fan.py | python | XiaomiFanFA1.async_set_preset_mode | (self, preset_mode: str) | Set the speed of the fan. | Set the speed of the fan. | [
"Set",
"the",
"speed",
"of",
"the",
"fan",
"."
] | async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set the speed of the fan."""
if self.supported_features & SUPPORT_PRESET_MODE == 0:
return
if preset_mode.isdigit():
preset_mode = int(preset_mode)
if preset_mode in [SPEED_OFF, 0]:
... | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
":",
"str",
")",
"->",
"None",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_PRESET_MODE",
"==",
"0",
":",
"return",
"if",
"preset_mode",
".",
"isdigit",
"(",
")",
":",
... | https://github.com/Yonsm/.homeassistant/blob/4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26/custom_components/xiaomi_fan_circulator/fan.py#L668-L689 | ||
mlrun/mlrun | 4c120719d64327a34b7ee1ab08fb5e01b258b00a | mlrun/data_types/infer.py | python | infer_schema_from_df | (
df: pd.DataFrame,
features,
entities,
timestamp_key: str = None,
entity_columns=None,
options: InferOptions = InferOptions.Null,
) | return timestamp_key | infer feature set schema from dataframe | infer feature set schema from dataframe | [
"infer",
"feature",
"set",
"schema",
"from",
"dataframe"
] | def infer_schema_from_df(
df: pd.DataFrame,
features,
entities,
timestamp_key: str = None,
entity_columns=None,
options: InferOptions = InferOptions.Null,
):
"""infer feature set schema from dataframe"""
timestamp_fields = []
current_entities = list(entities.keys())
entity_column... | [
"def",
"infer_schema_from_df",
"(",
"df",
":",
"pd",
".",
"DataFrame",
",",
"features",
",",
"entities",
",",
"timestamp_key",
":",
"str",
"=",
"None",
",",
"entity_columns",
"=",
"None",
",",
"options",
":",
"InferOptions",
"=",
"InferOptions",
".",
"Null",... | https://github.com/mlrun/mlrun/blob/4c120719d64327a34b7ee1ab08fb5e01b258b00a/mlrun/data_types/infer.py#L11-L75 | |
openeventdata/mordecai | 9d37110f6cd1275852548fc53fd7a21bb77593f9 | mordecai/geoparse.py | python | Geoparser._feature_most_population | (self, results) | Find the placename with the largest population and return its country.
More population is a rough measure of importance.
Paramaters
----------
results: dict
output of `query_geonames`
Returns
-------
most_pop: str
ISO code of country of p... | Find the placename with the largest population and return its country.
More population is a rough measure of importance. | [
"Find",
"the",
"placename",
"with",
"the",
"largest",
"population",
"and",
"return",
"its",
"country",
".",
"More",
"population",
"is",
"a",
"rough",
"measure",
"of",
"importance",
"."
] | def _feature_most_population(self, results):
"""
Find the placename with the largest population and return its country.
More population is a rough measure of importance.
Paramaters
----------
results: dict
output of `query_geonames`
Returns
-... | [
"def",
"_feature_most_population",
"(",
"self",
",",
"results",
")",
":",
"try",
":",
"populations",
"=",
"[",
"i",
"[",
"'population'",
"]",
"for",
"i",
"in",
"results",
"[",
"'hits'",
"]",
"[",
"'hits'",
"]",
"]",
"most_pop",
"=",
"results",
"[",
"'h... | https://github.com/openeventdata/mordecai/blob/9d37110f6cd1275852548fc53fd7a21bb77593f9/mordecai/geoparse.py#L209-L231 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | calendarserver/tools/obliterate.py | python | ObliterateService.removeRevisionsForHomeResourceID | (self, resourceID) | [] | def removeRevisionsForHomeResourceID(self, resourceID):
if not self.options["dry-run"]:
rev = schema.CALENDAR_OBJECT_REVISIONS
kwds = {"ResourceID": resourceID}
yield Delete(
From=rev,
Where=(
rev.CALENDAR_HOME_RESOURCE_ID =... | [
"def",
"removeRevisionsForHomeResourceID",
"(",
"self",
",",
"resourceID",
")",
":",
"if",
"not",
"self",
".",
"options",
"[",
"\"dry-run\"",
"]",
":",
"rev",
"=",
"schema",
".",
"CALENDAR_OBJECT_REVISIONS",
"kwds",
"=",
"{",
"\"ResourceID\"",
":",
"resourceID",... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/obliterate.py#L427-L436 | ||||
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/datatypes/common_functions.py | python | _sdc_asarray_overload | (data) | return None | [] | def _sdc_asarray_overload(data):
# TODO: extend with other types
if not isinstance(data, types.List):
return None
if isinstance(data.dtype, types.UnicodeType):
def _sdc_asarray_impl(data):
return create_str_arr_from_list(data)
return _sdc_asarray_impl
else:
... | [
"def",
"_sdc_asarray_overload",
"(",
"data",
")",
":",
"# TODO: extend with other types",
"if",
"not",
"isinstance",
"(",
"data",
",",
"types",
".",
"List",
")",
":",
"return",
"None",
"if",
"isinstance",
"(",
"data",
".",
"dtype",
",",
"types",
".",
"Unicod... | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/datatypes/common_functions.py#L556-L581 | |||
poppy-project/pypot | c5d384fe23eef9f6ec98467f6f76626cdf20afb9 | pypot/server/httpserver.py | python | HTTPRobotServer.make_app | (self) | return Application(url_paths) | [] | def make_app(self):
PoppyRequestHandler.restful_robot = self.restful_robot
return Application(url_paths) | [
"def",
"make_app",
"(",
"self",
")",
":",
"PoppyRequestHandler",
".",
"restful_robot",
"=",
"self",
".",
"restful_robot",
"return",
"Application",
"(",
"url_paths",
")"
] | https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/server/httpserver.py#L1116-L1118 | |||
landlab/landlab | a5dd80b8ebfd03d1ba87ef6c4368c409485f222c | landlab/components/network_sediment_transporter/network_sediment_transporter.py | python | NetworkSedimentTransporter._calculate_mean_D_and_rho | (self) | Calculate mean grain size and density on each link | Calculate mean grain size and density on each link | [
"Calculate",
"mean",
"grain",
"size",
"and",
"density",
"on",
"each",
"link"
] | def _calculate_mean_D_and_rho(self):
"""Calculate mean grain size and density on each link"""
current_parcels = self._parcels.dataset.isel(time=self._time_idx)
# In the first full timestep, we need to calc grain size & rho_sed.
# Assume all parcels are in the active layer for the purpo... | [
"def",
"_calculate_mean_D_and_rho",
"(",
"self",
")",
":",
"current_parcels",
"=",
"self",
".",
"_parcels",
".",
"dataset",
".",
"isel",
"(",
"time",
"=",
"self",
".",
"_time_idx",
")",
"# In the first full timestep, we need to calc grain size & rho_sed.",
"# Assume all... | https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/network_sediment_transporter/network_sediment_transporter.py#L466-L501 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/tkinter/__init__.py | python | Variable.trace_add | (self, mode, callback) | return cbname | Define a trace callback for the variable.
Mode is one of "read", "write", "unset", or a list or tuple of
such strings.
Callback must be a function which is called when the variable is
read, written or unset.
Return the name of the callback. | Define a trace callback for the variable. | [
"Define",
"a",
"trace",
"callback",
"for",
"the",
"variable",
"."
] | def trace_add(self, mode, callback):
"""Define a trace callback for the variable.
Mode is one of "read", "write", "unset", or a list or tuple of
such strings.
Callback must be a function which is called when the variable is
read, written or unset.
Return the name of the... | [
"def",
"trace_add",
"(",
"self",
",",
"mode",
",",
"callback",
")",
":",
"cbname",
"=",
"self",
".",
"_register",
"(",
"callback",
")",
"self",
".",
"_tk",
".",
"call",
"(",
"'trace'",
",",
"'add'",
",",
"'variable'",
",",
"self",
".",
"_name",
",",
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/__init__.py#L390-L403 | |
deezer/spleeter | 48e38088370bdc2997040ea3c57f96495bdf75a5 | spleeter/model/__init__.py | python | EstimatorSpecBuilder._build_manual_output_waveform | (self, masked_stft) | return output_waveform | Perform ratio mask separation
:param output_dict: dictionary of estimated spectrogram (key: instrument
name, value: estimated spectrogram of the instrument)
:returns: dictionary of separated waveforms (key: instrument name,
value: estimated waveform of the instrument) | Perform ratio mask separation | [
"Perform",
"ratio",
"mask",
"separation"
] | def _build_manual_output_waveform(self, masked_stft):
"""Perform ratio mask separation
:param output_dict: dictionary of estimated spectrogram (key: instrument
name, value: estimated spectrogram of the instrument)
:returns: dictionary of separated waveforms (key: instrument name,
... | [
"def",
"_build_manual_output_waveform",
"(",
"self",
",",
"masked_stft",
")",
":",
"output_waveform",
"=",
"{",
"}",
"for",
"instrument",
",",
"stft_data",
"in",
"masked_stft",
".",
"items",
"(",
")",
":",
"output_waveform",
"[",
"instrument",
"]",
"=",
"self"... | https://github.com/deezer/spleeter/blob/48e38088370bdc2997040ea3c57f96495bdf75a5/spleeter/model/__init__.py#L469-L481 | |
Amulet-Team/Amulet-Map-Editor | e99619ba6aab855173b9f7c203455944ab97f89a | amulet_map_editor/api/opengl/camera/camera.py | python | Camera.orthographic_clipping | (self, clipping: Tuple[float, float]) | Set the near and far clipping distance when in orthographic mode. | Set the near and far clipping distance when in orthographic mode. | [
"Set",
"the",
"near",
"and",
"far",
"clipping",
"distance",
"when",
"in",
"orthographic",
"mode",
"."
] | def orthographic_clipping(self, clipping: Tuple[float, float]):
"""Set the near and far clipping distance when in orthographic mode."""
self._set_clipping(Projection.TOP_DOWN, clipping) | [
"def",
"orthographic_clipping",
"(",
"self",
",",
"clipping",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
")",
":",
"self",
".",
"_set_clipping",
"(",
"Projection",
".",
"TOP_DOWN",
",",
"clipping",
")"
] | https://github.com/Amulet-Team/Amulet-Map-Editor/blob/e99619ba6aab855173b9f7c203455944ab97f89a/amulet_map_editor/api/opengl/camera/camera.py#L257-L259 | ||
docker-archive/docker-registry | f93b432d3fc7befa508ab27a590e6d0f78c86401 | docker_registry/index.py | python | put_repository_auth | (namespace, repository) | return toolkit.response('OK') | [] | def put_repository_auth(namespace, repository):
return toolkit.response('OK') | [
"def",
"put_repository_auth",
"(",
"namespace",
",",
"repository",
")",
":",
"return",
"toolkit",
".",
"response",
"(",
"'OK'",
")"
] | https://github.com/docker-archive/docker-registry/blob/f93b432d3fc7befa508ab27a590e6d0f78c86401/docker_registry/index.py#L130-L131 | |||
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/utils/blender_ui.py | python | iterActiveSpacesByType | (type) | [] | def iterActiveSpacesByType(type):
for space in iterActiveSpaces():
if space.type == type:
yield space | [
"def",
"iterActiveSpacesByType",
"(",
"type",
")",
":",
"for",
"space",
"in",
"iterActiveSpaces",
"(",
")",
":",
"if",
"space",
".",
"type",
"==",
"type",
":",
"yield",
"space"
] | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/utils/blender_ui.py#L5-L8 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/hqwebapp/views.py | python | CRUDPaginatedViewMixin.paginated_list | (self) | This should return a list (or generator object) of data formatted as follows:
[
{
'itemData': {
'id': <id of item>,
<json dict of item data for the knockout model to use>
},
'template': <knockout template id>
... | This should return a list (or generator object) of data formatted as follows:
[
{
'itemData': {
'id': <id of item>,
<json dict of item data for the knockout model to use>
},
'template': <knockout template id>
... | [
"This",
"should",
"return",
"a",
"list",
"(",
"or",
"generator",
"object",
")",
"of",
"data",
"formatted",
"as",
"follows",
":",
"[",
"{",
"itemData",
":",
"{",
"id",
":",
"<id",
"of",
"item",
">",
"<json",
"dict",
"of",
"item",
"data",
"for",
"the",... | def paginated_list(self):
"""
This should return a list (or generator object) of data formatted as follows:
[
{
'itemData': {
'id': <id of item>,
<json dict of item data for the knockout model to use>
},
... | [
"def",
"paginated_list",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Return a list of data for the request response.\"",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqwebapp/views.py#L1100-L1113 | ||
microsoft/botbuilder-python | 3d410365461dc434df59bdfeaa2f16d28d9df868 | libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py | python | UserTokenOperations.exchange_async | (
self,
user_id,
connection_name,
channel_id,
uri=None,
token=None,
*,
custom_headers=None,
raw=False,
**operation_config
) | return deserialized | :param user_id:
:type user_id: str
:param connection_name:
:type connection_name: str
:param channel_id:
:type channel_id: str
:param uri:
:type uri: str
:param token:
:type token: str
:param dict custom_headers: headers that will be added ... | [] | async def exchange_async(
self,
user_id,
connection_name,
channel_id,
uri=None,
token=None,
*,
custom_headers=None,
raw=False,
**operation_config
):
"""
:param user_id:
:type user_id: str
:param connecti... | [
"async",
"def",
"exchange_async",
"(",
"self",
",",
"user_id",
",",
"connection_name",
",",
"channel_id",
",",
"uri",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
",",
"custom_headers",
"=",
"None",
",",
"raw",
"=",
"False",
",",
"*",
"*",
"operat... | https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botframework-connector/botframework/connector/token_api/aio/operations_async/_user_token_operations_async.py#L348-L430 | ||
jesparza/peepdf | c74dc65c0ac7e506bae4f2582a2435ec50741f40 | PDFCore.py | python | PDFObject.contains | (self, string) | return False | Look for the string inside the object content
@param string: A string
@return: A boolean to specify if the string has been found or not | Look for the string inside the object content | [
"Look",
"for",
"the",
"string",
"inside",
"the",
"object",
"content"
] | def contains(self, string):
'''
Look for the string inside the object content
@param string: A string
@return: A boolean to specify if the string has been found or not
'''
value = str(self.value)
rawValue = str(self.rawValue)
encVa... | [
"def",
"contains",
"(",
"self",
",",
"string",
")",
":",
"value",
"=",
"str",
"(",
"self",
".",
"value",
")",
"rawValue",
"=",
"str",
"(",
"self",
".",
"rawValue",
")",
"encValue",
"=",
"str",
"(",
"self",
".",
"encryptedValue",
")",
"if",
"re",
".... | https://github.com/jesparza/peepdf/blob/c74dc65c0ac7e506bae4f2582a2435ec50741f40/PDFCore.py#L123-L139 | |
JoelBender/bacpypes | 41104c2b565b2ae9a637c941dfb0fe04195c5e96 | py27/bacpypes/debugging.py | python | DebugContents.debug_contents | (self, indent=1, file=sys.stdout, _ids=None) | Debug the contents of an object. | Debug the contents of an object. | [
"Debug",
"the",
"contents",
"of",
"an",
"object",
"."
] | def debug_contents(self, indent=1, file=sys.stdout, _ids=None):
"""Debug the contents of an object."""
if _debug: _log.debug("debug_contents indent=%r file=%r _ids=%r", indent, file, _ids)
klasses = list(self.__class__.__mro__)
klasses.reverse()
if _debug: _log.debug(" - klas... | [
"def",
"debug_contents",
"(",
"self",
",",
"indent",
"=",
"1",
",",
"file",
"=",
"sys",
".",
"stdout",
",",
"_ids",
"=",
"None",
")",
":",
"if",
"_debug",
":",
"_log",
".",
"debug",
"(",
"\"debug_contents indent=%r file=%r _ids=%r\"",
",",
"indent",
",",
... | https://github.com/JoelBender/bacpypes/blob/41104c2b565b2ae9a637c941dfb0fe04195c5e96/py27/bacpypes/debugging.py#L91-L212 | ||
seanbell/opensurfaces | 7f3e987560faa62cd37f821760683ccd1e053c7c | server/mturk/tasks.py | python | mturk_iteration_task | (show_progress=False) | Update votes and start new tasks | Update votes and start new tasks | [
"Update",
"votes",
"and",
"start",
"new",
"tasks"
] | def mturk_iteration_task(show_progress=False):
""" Update votes and start new tasks """
if not settings.MTURK_PIPELINE_ENABLE:
print "mturk_iteration_task: Not running since MTURK_PIPELINE_ENABLE=%s" % (
settings.MTURK_PIPELINE_ENABLE)
return
if not os.path.isfile('manage.py'):
... | [
"def",
"mturk_iteration_task",
"(",
"show_progress",
"=",
"False",
")",
":",
"if",
"not",
"settings",
".",
"MTURK_PIPELINE_ENABLE",
":",
"print",
"\"mturk_iteration_task: Not running since MTURK_PIPELINE_ENABLE=%s\"",
"%",
"(",
"settings",
".",
"MTURK_PIPELINE_ENABLE",
")",... | https://github.com/seanbell/opensurfaces/blob/7f3e987560faa62cd37f821760683ccd1e053c7c/server/mturk/tasks.py#L26-L40 | ||
dulwich/dulwich | 1f66817d712e3563ce1ff53b1218491a2eae39da | dulwich/object_store.py | python | MemoryObjectStore.add_objects | (self, objects, progress=None) | Add a set of objects to this object store.
Args:
objects: Iterable over a list of (object, path) tuples | Add a set of objects to this object store. | [
"Add",
"a",
"set",
"of",
"objects",
"to",
"this",
"object",
"store",
"."
] | def add_objects(self, objects, progress=None):
"""Add a set of objects to this object store.
Args:
objects: Iterable over a list of (object, path) tuples
"""
for obj, path in objects:
self.add_object(obj) | [
"def",
"add_objects",
"(",
"self",
",",
"objects",
",",
"progress",
"=",
"None",
")",
":",
"for",
"obj",
",",
"path",
"in",
"objects",
":",
"self",
".",
"add_object",
"(",
"obj",
")"
] | https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/object_store.py#L996-L1003 | ||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/ipaddress.py | python | IPv6Address.ipv4_mapped | (self) | return IPv4Address(self._ip & 0xFFFFFFFF) | Return the IPv4 mapped address.
Returns:
If the IPv6 address is a v4 mapped address, return the
IPv4 mapped address. Return None otherwise. | Return the IPv4 mapped address. | [
"Return",
"the",
"IPv4",
"mapped",
"address",
"."
] | def ipv4_mapped(self):
"""Return the IPv4 mapped address.
Returns:
If the IPv6 address is a v4 mapped address, return the
IPv4 mapped address. Return None otherwise.
"""
if (self._ip >> 32) != 0xFFFF:
return None
return IPv4Address(self._ip &... | [
"def",
"ipv4_mapped",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_ip",
">>",
"32",
")",
"!=",
"0xFFFF",
":",
"return",
"None",
"return",
"IPv4Address",
"(",
"self",
".",
"_ip",
"&",
"0xFFFFFFFF",
")"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/ipaddress.py#L2142-L2152 | |
h2non/pook | d2970eff5ef7b611e786422145cff4f6d6df412e | pook/api.py | python | disable_network | () | Disables real traffic networking mode in the current mock engine. | Disables real traffic networking mode in the current mock engine. | [
"Disables",
"real",
"traffic",
"networking",
"mode",
"in",
"the",
"current",
"mock",
"engine",
"."
] | def disable_network():
"""
Disables real traffic networking mode in the current mock engine.
"""
_engine.disable_network() | [
"def",
"disable_network",
"(",
")",
":",
"_engine",
".",
"disable_network",
"(",
")"
] | https://github.com/h2non/pook/blob/d2970eff5ef7b611e786422145cff4f6d6df412e/pook/api.py#L266-L270 | ||
ComplianceAsCode/content | 6760a14e7fe3fb34205bd1a165095a9334412e95 | ssg/ext/boolean/boolean.py | python | NOT.__call__ | (self, **kwargs) | return not self.args[0](**kwargs) | Return the evaluated (negated) value for this function. | Return the evaluated (negated) value for this function. | [
"Return",
"the",
"evaluated",
"(",
"negated",
")",
"value",
"for",
"this",
"function",
"."
] | def __call__(self, **kwargs):
"""
Return the evaluated (negated) value for this function.
"""
return not self.args[0](**kwargs) | [
"def",
"__call__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"not",
"self",
".",
"args",
"[",
"0",
"]",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/ComplianceAsCode/content/blob/6760a14e7fe3fb34205bd1a165095a9334412e95/ssg/ext/boolean/boolean.py#L1106-L1110 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/physics/vector/dyadic.py | python | Dyadic.__truediv__ | (self, other) | return self.__mul__(1 / other) | Divides the Dyadic by a sympifyable expression. | Divides the Dyadic by a sympifyable expression. | [
"Divides",
"the",
"Dyadic",
"by",
"a",
"sympifyable",
"expression",
"."
] | def __truediv__(self, other):
"""Divides the Dyadic by a sympifyable expression. """
return self.__mul__(1 / other) | [
"def",
"__truediv__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__mul__",
"(",
"1",
"/",
"other",
")"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/physics/vector/dyadic.py#L110-L112 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/tf/layers/rec.py | python | RecLayer._post_proc_output_cell_strict | (self, y, in_data) | return out_data.placeholder | :param tf.Tensor y: (time,batch,dim)
:param Data in_data:
:rtype: tf.Tensor
:return: (time,batch,dim) or (time,batch,...,dim) | :param tf.Tensor y: (time,batch,dim)
:param Data in_data:
:rtype: tf.Tensor
:return: (time,batch,dim) or (time,batch,...,dim) | [
":",
"param",
"tf",
".",
"Tensor",
"y",
":",
"(",
"time",
"batch",
"dim",
")",
":",
"param",
"Data",
"in_data",
":",
":",
"rtype",
":",
"tf",
".",
"Tensor",
":",
"return",
":",
"(",
"time",
"batch",
"dim",
")",
"or",
"(",
"time",
"batch",
"...",
... | def _post_proc_output_cell_strict(self, y, in_data):
"""
:param tf.Tensor y: (time,batch,dim)
:param Data in_data:
:rtype: tf.Tensor
:return: (time,batch,dim) or (time,batch,...,dim)
"""
if in_data.batch_ndim_dense > 3:
y_shape = tf_util.get_shape(in_data.placeholder)
if not in_d... | [
"def",
"_post_proc_output_cell_strict",
"(",
"self",
",",
"y",
",",
"in_data",
")",
":",
"if",
"in_data",
".",
"batch_ndim_dense",
">",
"3",
":",
"y_shape",
"=",
"tf_util",
".",
"get_shape",
"(",
"in_data",
".",
"placeholder",
")",
"if",
"not",
"in_data",
... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/tf/layers/rec.py#L664-L687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.