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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vespene-io/_old_vespene | c0fbb217dfc5155bf974ab9e06fd43e539da63e0 | vespene/workers/builder.py | python | BuildLord.checkout_and_record_scm_info | (self) | Perform a Source Control checkout and record the user and revision. | Perform a Source Control checkout and record the user and revision. | [
"Perform",
"a",
"Source",
"Control",
"checkout",
"and",
"record",
"the",
"user",
"and",
"revision",
"."
] | def checkout_and_record_scm_info(self):
"""
Perform a Source Control checkout and record the user and revision.
"""
output = self.scm_manager.checkout()
self.build.append_output(output)
self.build.revision_username = self.scm_manager.get_last_commit_user()
self.b... | [
"def",
"checkout_and_record_scm_info",
"(",
"self",
")",
":",
"output",
"=",
"self",
".",
"scm_manager",
".",
"checkout",
"(",
")",
"self",
".",
"build",
".",
"append_output",
"(",
"output",
")",
"self",
".",
"build",
".",
"revision_username",
"=",
"self",
... | https://github.com/vespene-io/_old_vespene/blob/c0fbb217dfc5155bf974ab9e06fd43e539da63e0/vespene/workers/builder.py#L73-L80 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cls/v20201016/models.py | python | ModifyAlarmNoticeRequest.__init__ | (self) | r"""
:param AlarmNoticeId: 告警通知模板ID。
:type AlarmNoticeId: str
:param Name: 告警模板名称。
:type Name: str
:param Type: 告警模板的类型。可选值:
<br><li> Trigger - 告警触发
<br><li> Recovery - 告警恢复
<br><li> All - 告警触发和告警恢复
:type Type: str
:param NoticeReceivers: 告警模板接收者信息。
:type ... | r"""
:param AlarmNoticeId: 告警通知模板ID。
:type AlarmNoticeId: str
:param Name: 告警模板名称。
:type Name: str
:param Type: 告警模板的类型。可选值:
<br><li> Trigger - 告警触发
<br><li> Recovery - 告警恢复
<br><li> All - 告警触发和告警恢复
:type Type: str
:param NoticeReceivers: 告警模板接收者信息。
:type ... | [
"r",
":",
"param",
"AlarmNoticeId",
":",
"告警通知模板ID。",
":",
"type",
"AlarmNoticeId",
":",
"str",
":",
"param",
"Name",
":",
"告警模板名称。",
":",
"type",
"Name",
":",
"str",
":",
"param",
"Type",
":",
"告警模板的类型。可选值:",
"<br",
">",
"<li",
">",
"Trigger",
"-",
"告... | def __init__(self):
r"""
:param AlarmNoticeId: 告警通知模板ID。
:type AlarmNoticeId: str
:param Name: 告警模板名称。
:type Name: str
:param Type: 告警模板的类型。可选值:
<br><li> Trigger - 告警触发
<br><li> Recovery - 告警恢复
<br><li> All - 告警触发和告警恢复
:type Type: str
:param NoticeReceiver... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"AlarmNoticeId",
"=",
"None",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"Type",
"=",
"None",
"self",
".",
"NoticeReceivers",
"=",
"None",
"self",
".",
"WebCallbacks",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cls/v20201016/models.py#L3901-L3921 | ||
presslabs/z3 | 965898cccddd351ce4c56402a215c3bda9f37b5e | z3/snap.py | python | PairManager._decompress | (self, cmd, s3_snap) | return "{} | {}".format(decompress_cmd, cmd) | Adds the appropriate command to decompress the zfs stream
This is determined from the metadata of the s3_snap. | Adds the appropriate command to decompress the zfs stream
This is determined from the metadata of the s3_snap. | [
"Adds",
"the",
"appropriate",
"command",
"to",
"decompress",
"the",
"zfs",
"stream",
"This",
"is",
"determined",
"from",
"the",
"metadata",
"of",
"the",
"s3_snap",
"."
] | def _decompress(self, cmd, s3_snap):
"""Adds the appropriate command to decompress the zfs stream
This is determined from the metadata of the s3_snap.
"""
compressor = COMPRESSORS.get(s3_snap.compressor)
if compressor is None:
return cmd
decompress_cmd = compr... | [
"def",
"_decompress",
"(",
"self",
",",
"cmd",
",",
"s3_snap",
")",
":",
"compressor",
"=",
"COMPRESSORS",
".",
"get",
"(",
"s3_snap",
".",
"compressor",
")",
"if",
"compressor",
"is",
"None",
":",
"return",
"cmd",
"decompress_cmd",
"=",
"compressor",
"[",... | https://github.com/presslabs/z3/blob/965898cccddd351ce4c56402a215c3bda9f37b5e/z3/snap.py#L319-L327 | |
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/apsw/tools/shell.py | python | Shell.command_print | (self, cmd) | print STRING: print the literal STRING
If more than one argument is supplied then they are printed
space separated. You can use backslash escapes such as \\n
and \\t. | print STRING: print the literal STRING | [
"print",
"STRING",
":",
"print",
"the",
"literal",
"STRING"
] | def command_print(self, cmd):
"""print STRING: print the literal STRING
If more than one argument is supplied then they are printed
space separated. You can use backslash escapes such as \\n
and \\t.
"""
self.write(self.stdout, " ".join([self.fixup_backslashes(i) for i ... | [
"def",
"command_print",
"(",
"self",
",",
"cmd",
")",
":",
"self",
".",
"write",
"(",
"self",
".",
"stdout",
",",
"\" \"",
".",
"join",
"(",
"[",
"self",
".",
"fixup_backslashes",
"(",
"i",
")",
"for",
"i",
"in",
"cmd",
"]",
")",
"+",
"\"\\n\"",
... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/apsw/tools/shell.py#L2042-L2049 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/flows/general/administrative.py | python | ExecuteCommand.Start | (self) | Call the execute function on the client. | Call the execute function on the client. | [
"Call",
"the",
"execute",
"function",
"on",
"the",
"client",
"."
] | def Start(self):
"""Call the execute function on the client."""
self.CallClient(
server_stubs.ExecuteCommand,
cmd=self.args.cmd,
args=shlex.split(self.args.command_line),
time_limit=self.args.time_limit,
next_state=compatibility.GetName(self.Confirmation)) | [
"def",
"Start",
"(",
"self",
")",
":",
"self",
".",
"CallClient",
"(",
"server_stubs",
".",
"ExecuteCommand",
",",
"cmd",
"=",
"self",
".",
"args",
".",
"cmd",
",",
"args",
"=",
"shlex",
".",
"split",
"(",
"self",
".",
"args",
".",
"command_line",
")... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/flows/general/administrative.py#L457-L464 | ||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/graph/primitives.py | python | Graph.applyGrid | (self, subplot) | Apply the Grid to the subplot such that it goes below the data. | Apply the Grid to the subplot such that it goes below the data. | [
"Apply",
"the",
"Grid",
"to",
"the",
"subplot",
"such",
"that",
"it",
"goes",
"below",
"the",
"data",
"."
] | def applyGrid(self, subplot):
'''
Apply the Grid to the subplot such that it goes below the data.
'''
if self.grid and self.colorGrid is not None: # None is another way to hide grid
subplot.set_axisbelow(True)
subplot.grid(True, which='major', color=getColor(sel... | [
"def",
"applyGrid",
"(",
"self",
",",
"subplot",
")",
":",
"if",
"self",
".",
"grid",
"and",
"self",
".",
"colorGrid",
"is",
"not",
"None",
":",
"# None is another way to hide grid",
"subplot",
".",
"set_axisbelow",
"(",
"True",
")",
"subplot",
".",
"grid",
... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/graph/primitives.py#L388-L401 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/pdb2pka/ligandclean/ligff.py | python | initialize | (definition, ligdesc, pdblist, verbose=0) | return protein, definition, Lig | Initialize a ligand calculation by adding ligand atoms to the definition.
This code adapted from pdb2pka/pka.py to work with existing PDB2PQR code.
Parameters
definition: The definition object for PDB2PQR
ligdesc: A file desciptor the desired ligand file (string)
... | Initialize a ligand calculation by adding ligand atoms to the definition.
This code adapted from pdb2pka/pka.py to work with existing PDB2PQR code. | [
"Initialize",
"a",
"ligand",
"calculation",
"by",
"adding",
"ligand",
"atoms",
"to",
"the",
"definition",
".",
"This",
"code",
"adapted",
"from",
"pdb2pka",
"/",
"pka",
".",
"py",
"to",
"work",
"with",
"existing",
"PDB2PQR",
"code",
"."
] | def initialize(definition, ligdesc, pdblist, verbose=0):
"""
Initialize a ligand calculation by adding ligand atoms to the definition.
This code adapted from pdb2pka/pka.py to work with existing PDB2PQR code.
Parameters
definition: The definition object for PDB2PQR
... | [
"def",
"initialize",
"(",
"definition",
",",
"ligdesc",
",",
"pdblist",
",",
"verbose",
"=",
"0",
")",
":",
"Lig",
"=",
"ligand_charge_handler",
"(",
")",
"Lig",
".",
"read",
"(",
"ligdesc",
")",
"atomnamelist",
"=",
"[",
"]",
"for",
"atom",
"in",
"Lig... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/pdb2pka/ligandclean/ligff.py#L9-L132 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/trunking/v1/trunk/phone_number.py | python | PhoneNumberInstance.api_version | (self) | return self._properties['api_version'] | :returns: The API version used to start a new TwiML session
:rtype: unicode | :returns: The API version used to start a new TwiML session
:rtype: unicode | [
":",
"returns",
":",
"The",
"API",
"version",
"used",
"to",
"start",
"a",
"new",
"TwiML",
"session",
":",
"rtype",
":",
"unicode"
] | def api_version(self):
"""
:returns: The API version used to start a new TwiML session
:rtype: unicode
"""
return self._properties['api_version'] | [
"def",
"api_version",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'api_version'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/trunking/v1/trunk/phone_number.py#L338-L343 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/signal_handlers.py | python | post_delete_signal_handler | (instance, **kwargs) | [] | def post_delete_signal_handler(instance, **kwargs):
index.remove_object(instance) | [
"def",
"post_delete_signal_handler",
"(",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"index",
".",
"remove_object",
"(",
"instance",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/signal_handlers.py#L18-L19 | ||||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/delicious/alp/request/requests/packages/oauthlib/oauth1/rfc5849/__init__.py | python | Server.validate_access_token | (self, client_key, access_token) | Validates that supplied access token is registered and valid.
Note that if the dummy access token is supplied it should validate in
the same or nearly the same amount of time as a valid one.
Bad:
if access_token == self.dummy_access_token:
return False
... | Validates that supplied access token is registered and valid. | [
"Validates",
"that",
"supplied",
"access",
"token",
"is",
"registered",
"and",
"valid",
"."
] | def validate_access_token(self, client_key, access_token):
"""Validates that supplied access token is registered and valid.
Note that if the dummy access token is supplied it should validate in
the same or nearly the same amount of time as a valid one.
Bad:
if access_token... | [
"def",
"validate_access_token",
"(",
"self",
",",
"client_key",
",",
"access_token",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Subclasses must implement this function.\"",
")"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/delicious/alp/request/requests/packages/oauthlib/oauth1/rfc5849/__init__.py#L528-L546 | ||
TwitchIO/TwitchIO | b5eb585b9b52d4966784f0d1ae947077a90ec0c7 | twitchio/chatter.py | python | Chatter.mention | (self) | return f"@{self._display_name}" | Mentions the users display name by prefixing it with '@ | Mentions the users display name by prefixing it with ' | [
"Mentions",
"the",
"users",
"display",
"name",
"by",
"prefixing",
"it",
"with"
] | def mention(self) -> str:
"""Mentions the users display name by prefixing it with '@'"""
return f"@{self._display_name}" | [
"def",
"mention",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"@{self._display_name}\""
] | https://github.com/TwitchIO/TwitchIO/blob/b5eb585b9b52d4966784f0d1ae947077a90ec0c7/twitchio/chatter.py#L168-L170 | |
RealHacker/leetcode-solutions | 50b21ea270dd095bef0b21e4e8bd79c1f279a85a | 022_generate_parentheses/generate_parentheses.py | python | Solution.generateParenthesis | (self, n) | return self.result | :type n: int
:rtype: List[str] | :type n: int
:rtype: List[str] | [
":",
"type",
"n",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"str",
"]"
] | def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
self.result = []
self.generate("", n, n)
return self.result | [
"def",
"generateParenthesis",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"result",
"=",
"[",
"]",
"self",
".",
"generate",
"(",
"\"\"",
",",
"n",
",",
"n",
")",
"return",
"self",
".",
"result"
] | https://github.com/RealHacker/leetcode-solutions/blob/50b21ea270dd095bef0b21e4e8bd79c1f279a85a/022_generate_parentheses/generate_parentheses.py#L2-L9 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/dtdparser.py | python | DTDParser.set_dtd_object | (self,dtd) | Tells the parser where to mirror PE information (in addition to
what goes to the DTD consumer and where to get PE information. | Tells the parser where to mirror PE information (in addition to
what goes to the DTD consumer and where to get PE information. | [
"Tells",
"the",
"parser",
"where",
"to",
"mirror",
"PE",
"information",
"(",
"in",
"addition",
"to",
"what",
"goes",
"to",
"the",
"DTD",
"consumer",
"and",
"where",
"to",
"get",
"PE",
"information",
"."
] | def set_dtd_object(self,dtd):
"""Tells the parser where to mirror PE information (in addition to
what goes to the DTD consumer and where to get PE information."""
self.dtd=dtd | [
"def",
"set_dtd_object",
"(",
"self",
",",
"dtd",
")",
":",
"self",
".",
"dtd",
"=",
"dtd"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/dtdparser.py#L223-L226 | ||
alan-turing-institute/sktime | 79cc513346b1257a6f3fa8e4ed855b5a2a7de716 | sktime/classification/base.py | python | _check_classifier_input | (
X,
y=None,
enforce_min_instances=1,
) | return X_metadata | Check whether input X and y are valid formats with minimum data.
Raises a ValueError if the input is not valid.
Parameters
----------
X : check whether conformant with any sktime Panel mtype specification
y : check whether a pd.Series or np.array
enforce_min_instances : int, optional (default=... | Check whether input X and y are valid formats with minimum data. | [
"Check",
"whether",
"input",
"X",
"and",
"y",
"are",
"valid",
"formats",
"with",
"minimum",
"data",
"."
] | def _check_classifier_input(
X,
y=None,
enforce_min_instances=1,
):
"""Check whether input X and y are valid formats with minimum data.
Raises a ValueError if the input is not valid.
Parameters
----------
X : check whether conformant with any sktime Panel mtype specification
y : ch... | [
"def",
"_check_classifier_input",
"(",
"X",
",",
"y",
"=",
"None",
",",
"enforce_min_instances",
"=",
"1",
",",
")",
":",
"# Check X is valid input type and recover the data characteristics",
"X_valid",
",",
"_",
",",
"X_metadata",
"=",
"check_is_scitype",
"(",
"X",
... | https://github.com/alan-turing-institute/sktime/blob/79cc513346b1257a6f3fa8e4ed855b5a2a7de716/sktime/classification/base.py#L387-L446 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py | python | flatten_mask | (mask) | return np.array([_ for _ in flattened], dtype=bool) | Returns a completely flattened version of the mask, where nested fields
are collapsed.
Parameters
----------
mask : array_like
Input array, which will be interpreted as booleans.
Returns
-------
flattened_mask : ndarray of bools
The flattened input.
Examples
------... | Returns a completely flattened version of the mask, where nested fields
are collapsed. | [
"Returns",
"a",
"completely",
"flattened",
"version",
"of",
"the",
"mask",
"where",
"nested",
"fields",
"are",
"collapsed",
"."
] | def flatten_mask(mask):
"""
Returns a completely flattened version of the mask, where nested fields
are collapsed.
Parameters
----------
mask : array_like
Input array, which will be interpreted as booleans.
Returns
-------
flattened_mask : ndarray of bools
The flatt... | [
"def",
"flatten_mask",
"(",
"mask",
")",
":",
"def",
"_flatmask",
"(",
"mask",
")",
":",
"\"Flatten the mask and returns a (maybe nested) sequence of booleans.\"",
"mnames",
"=",
"mask",
".",
"dtype",
".",
"names",
"if",
"mnames",
"is",
"not",
"None",
":",
"return... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py#L1764-L1818 | |
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | linkcheck/i18n.py | python | get_locale | () | return (loc, encoding) | Search the default platform locale and norm it.
@returns (locale, encoding)
@rtype (string, string) | Search the default platform locale and norm it. | [
"Search",
"the",
"default",
"platform",
"locale",
"and",
"norm",
"it",
"."
] | def get_locale ():
"""Search the default platform locale and norm it.
@returns (locale, encoding)
@rtype (string, string)"""
try:
loc, encoding = locale.getdefaultlocale()
except ValueError:
# locale configuration is broken - ignore that
loc, encoding = None, None
if loc ... | [
"def",
"get_locale",
"(",
")",
":",
"try",
":",
"loc",
",",
"encoding",
"=",
"locale",
".",
"getdefaultlocale",
"(",
")",
"except",
"ValueError",
":",
"# locale configuration is broken - ignore that",
"loc",
",",
"encoding",
"=",
"None",
",",
"None",
"if",
"lo... | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/i18n.py#L147-L162 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | TrustedTeamsRequestAction.is_accepted | (self) | return self._tag == 'accepted' | Check if the union tag is ``accepted``.
:rtype: bool | Check if the union tag is ``accepted``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"accepted",
"."
] | def is_accepted(self):
"""
Check if the union tag is ``accepted``.
:rtype: bool
"""
return self._tag == 'accepted' | [
"def",
"is_accepted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'accepted'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L70959-L70965 | |
sfepy/sfepy | 02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25 | sfepy/discrete/fem/utils.py | python | refine_mesh | (filename, level) | return filename | Uniformly refine `level`-times a mesh given by `filename`.
The refined mesh is saved to a file with name constructed from base
name of `filename` and `level`-times appended `'_r'` suffix.
Parameters
----------
filename : str
The mesh file name.
level : int
The refinement level. | Uniformly refine `level`-times a mesh given by `filename`. | [
"Uniformly",
"refine",
"level",
"-",
"times",
"a",
"mesh",
"given",
"by",
"filename",
"."
] | def refine_mesh(filename, level):
"""
Uniformly refine `level`-times a mesh given by `filename`.
The refined mesh is saved to a file with name constructed from base
name of `filename` and `level`-times appended `'_r'` suffix.
Parameters
----------
filename : str
The mesh file name.... | [
"def",
"refine_mesh",
"(",
"filename",
",",
"level",
")",
":",
"import",
"os",
"from",
"sfepy",
".",
"base",
".",
"base",
"import",
"output",
"from",
"sfepy",
".",
"discrete",
".",
"fem",
"import",
"Mesh",
",",
"FEDomain",
"if",
"level",
">",
"0",
":",... | https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/fem/utils.py#L312-L344 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pip/_internal/configuration.py | python | Configuration._normalized_keys | (self, section, items) | return normalized | Normalizes items to construct a dictionary with normalized keys.
This routine is where the names become keys and are made the same
regardless of source - configuration files or environment. | Normalizes items to construct a dictionary with normalized keys. | [
"Normalizes",
"items",
"to",
"construct",
"a",
"dictionary",
"with",
"normalized",
"keys",
"."
] | def _normalized_keys(self, section, items):
# type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any]
"""Normalizes items to construct a dictionary with normalized keys.
This routine is where the names become keys and are made the same
regardless of source - configuration files or envi... | [
"def",
"_normalized_keys",
"(",
"self",
",",
"section",
",",
"items",
")",
":",
"# type: (str, Iterable[Tuple[str, Any]]) -> Dict[str, Any]",
"normalized",
"=",
"{",
"}",
"for",
"name",
",",
"val",
"in",
"items",
":",
"key",
"=",
"section",
"+",
"\".\"",
"+",
... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_internal/configuration.py#L343-L354 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/user_data_service/client.py | python | UserDataServiceClient.parse_common_folder_path | (path: str) | return m.groupdict() if m else {} | Parse a folder path into its component segments. | Parse a folder path into its component segments. | [
"Parse",
"a",
"folder",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_folder_path(path: str) -> Dict[str, str]:
"""Parse a folder path into its component segments."""
m = re.match(r"^folders/(?P<folder>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_folder_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^folders/(?P<folder>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
"(",
")",
"if",
"m"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/user_data_service/client.py#L176-L179 | |
Cog-Creators/Red-DiscordBot | b05933274a11fb097873ab0d1b246d37b06aa306 | redbot/cogs/audio/core/commands/equalizer.py | python | EqualizerCommands.command_equalizer_save | (self, ctx: commands.Context, eq_preset: str = None) | Save the current eq settings to a preset. | Save the current eq settings to a preset. | [
"Save",
"the",
"current",
"eq",
"settings",
"to",
"a",
"preset",
"."
] | async def command_equalizer_save(self, ctx: commands.Context, eq_preset: str = None):
"""Save the current eq settings to a preset."""
if not self._player_check(ctx):
return await self.send_embed_msg(ctx, title=_("Nothing playing."))
dj_enabled = self._dj_status_cache.setdefault(
... | [
"async",
"def",
"command_equalizer_save",
"(",
"self",
",",
"ctx",
":",
"commands",
".",
"Context",
",",
"eq_preset",
":",
"str",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_player_check",
"(",
"ctx",
")",
":",
"return",
"await",
"self",
".",
"s... | https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/cogs/audio/core/commands/equalizer.py#L225-L303 | ||
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | paddlespeech/s2t/training/reporter.py | python | Summary.make_statistics | (self) | return mean, std | Computes and returns the mean and standard deviation values.
Returns:
tuple: Mean and standard deviation values. | Computes and returns the mean and standard deviation values.
Returns:
tuple: Mean and standard deviation values. | [
"Computes",
"and",
"returns",
"the",
"mean",
"and",
"standard",
"deviation",
"values",
".",
"Returns",
":",
"tuple",
":",
"Mean",
"and",
"standard",
"deviation",
"values",
"."
] | def make_statistics(self):
"""Computes and returns the mean and standard deviation values.
Returns:
tuple: Mean and standard deviation values.
"""
x, n = self._x, self._n
mean = x / n
var = self._x2 / n - mean * mean
std = math.sqrt(var)
return... | [
"def",
"make_statistics",
"(",
"self",
")",
":",
"x",
",",
"n",
"=",
"self",
".",
"_x",
",",
"self",
".",
"_n",
"mean",
"=",
"x",
"/",
"n",
"var",
"=",
"self",
".",
"_x2",
"/",
"n",
"-",
"mean",
"*",
"mean",
"std",
"=",
"math",
".",
"sqrt",
... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/s2t/training/reporter.py#L80-L89 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/ioloop.py | python | IOLoop.add_callback | (self, callback: Callable, *args: Any, **kwargs: Any) | Calls the given callback on the next I/O loop iteration.
It is safe to call this method from any thread at any time,
except from a signal handler. Note that this is the **only**
method in `IOLoop` that makes this thread-safety guarantee; all
other interaction with the `IOLoop` must be ... | Calls the given callback on the next I/O loop iteration. | [
"Calls",
"the",
"given",
"callback",
"on",
"the",
"next",
"I",
"/",
"O",
"loop",
"iteration",
"."
] | def add_callback(self, callback: Callable, *args: Any, **kwargs: Any) -> None:
"""Calls the given callback on the next I/O loop iteration.
It is safe to call this method from any thread at any time,
except from a signal handler. Note that this is the **only**
method in `IOLoop` that ma... | [
"def",
"add_callback",
"(",
"self",
",",
"callback",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/ioloop.py#L631-L644 | ||
openstack/trove | be86b79119d16ee77f596172f43b0c97cb2617bd | trove/guestagent/datastore/postgres/service.py | python | PostgresConnection.query | (self, query, identifiers=None, data_values=None) | return self._execute_stmt(query, identifiers, data_values, True) | Execute a query and return the result set. | Execute a query and return the result set. | [
"Execute",
"a",
"query",
"and",
"return",
"the",
"result",
"set",
"."
] | def query(self, query, identifiers=None, data_values=None):
"""Execute a query and return the result set.
"""
return self._execute_stmt(query, identifiers, data_values, True) | [
"def",
"query",
"(",
"self",
",",
"query",
",",
"identifiers",
"=",
"None",
",",
"data_values",
"=",
"None",
")",
":",
"return",
"self",
".",
"_execute_stmt",
"(",
"query",
",",
"identifiers",
",",
"data_values",
",",
"True",
")"
] | https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/guestagent/datastore/postgres/service.py#L765-L768 | |
Fenixin/Minecraft-Region-Fixer | bfafd378ceb65116e4ea48cab24f1e6394051978 | regionfixer_core/world.py | python | World.fix_problematic_chunks | (self, status) | return counter | Try to fix all the chunks with the given status.
Inputs:
- status -- Integer with the chunk status to remove. See CHUNK_STATUSES in constants.py
for a list of possible statuses.
Return:
- counter -- Integer with the number of chunks fixed.
This ... | Try to fix all the chunks with the given status. | [
"Try",
"to",
"fix",
"all",
"the",
"chunks",
"with",
"the",
"given",
"status",
"."
] | def fix_problematic_chunks(self, status):
""" Try to fix all the chunks with the given status.
Inputs:
- status -- Integer with the chunk status to remove. See CHUNK_STATUSES in constants.py
for a list of possible statuses.
Return:
- counter -- I... | [
"def",
"fix_problematic_chunks",
"(",
"self",
",",
"status",
")",
":",
"counter",
"=",
"0",
"for",
"regionset",
"in",
"self",
".",
"regionsets",
":",
"counter",
"+=",
"regionset",
".",
"fix_problematic_chunks",
"(",
"status",
")",
"return",
"counter"
] | https://github.com/Fenixin/Minecraft-Region-Fixer/blob/bfafd378ceb65116e4ea48cab24f1e6394051978/regionfixer_core/world.py#L1435-L1452 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cam/v20190116/models.py | python | GetPolicyResponse.__init__ | (self) | r"""
:param PolicyName: 策略名
注意:此字段可能返回 null,表示取不到有效值。
:type PolicyName: str
:param Description: 策略描述
注意:此字段可能返回 null,表示取不到有效值。
:type Description: str
:param Type: 1 表示自定义策略,2 表示预设策略
注意:此字段可能返回 null,表示取不到有效值。
:type Type: int
:param AddTime: 创建时间
注意:此字段可能返回 null,表示取... | r"""
:param PolicyName: 策略名
注意:此字段可能返回 null,表示取不到有效值。
:type PolicyName: str
:param Description: 策略描述
注意:此字段可能返回 null,表示取不到有效值。
:type Description: str
:param Type: 1 表示自定义策略,2 表示预设策略
注意:此字段可能返回 null,表示取不到有效值。
:type Type: int
:param AddTime: 创建时间
注意:此字段可能返回 null,表示取... | [
"r",
":",
"param",
"PolicyName",
":",
"策略名",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"PolicyName",
":",
"str",
":",
"param",
"Description",
":",
"策略描述",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"Description",
":",
"str",
":",
"param",
"Type",
":",
"... | def __init__(self):
r"""
:param PolicyName: 策略名
注意:此字段可能返回 null,表示取不到有效值。
:type PolicyName: str
:param Description: 策略描述
注意:此字段可能返回 null,表示取不到有效值。
:type Description: str
:param Type: 1 表示自定义策略,2 表示预设策略
注意:此字段可能返回 null,表示取不到有效值。
:type Type: int
:param AddTi... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"PolicyName",
"=",
"None",
"self",
".",
"Description",
"=",
"None",
"self",
".",
"Type",
"=",
"None",
"self",
".",
"AddTime",
"=",
"None",
"self",
".",
"UpdateTime",
"=",
"None",
"self",
".",
"Po... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cam/v20190116/models.py#L2014-L2051 | ||
robotframework/RIDE | 6e8a50774ff33dead3a2757a11b0b4418ab205c0 | src/robotide/lib/robot/api/logger.py | python | write | (msg, level='INFO', html=False) | Writes the message to the log file using the given level.
Valid log levels are ``TRACE``, ``DEBUG``, ``INFO`` (default since RF
2.9.1), ``WARN``, and ``ERROR`` (new in RF 2.9). Additionally it is
possible to use ``HTML`` pseudo log level that logs the message as HTML
using the ``INFO`` level.
Inst... | Writes the message to the log file using the given level. | [
"Writes",
"the",
"message",
"to",
"the",
"log",
"file",
"using",
"the",
"given",
"level",
"."
] | def write(msg, level='INFO', html=False):
"""Writes the message to the log file using the given level.
Valid log levels are ``TRACE``, ``DEBUG``, ``INFO`` (default since RF
2.9.1), ``WARN``, and ``ERROR`` (new in RF 2.9). Additionally it is
possible to use ``HTML`` pseudo log level that logs the messag... | [
"def",
"write",
"(",
"msg",
",",
"level",
"=",
"'INFO'",
",",
"html",
"=",
"False",
")",
":",
"if",
"EXECUTION_CONTEXTS",
".",
"current",
"is",
"not",
"None",
":",
"librarylogger",
".",
"write",
"(",
"msg",
",",
"level",
",",
"html",
")",
"else",
":"... | https://github.com/robotframework/RIDE/blob/6e8a50774ff33dead3a2757a11b0b4418ab205c0/src/robotide/lib/robot/api/logger.py#L75-L97 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/src/utilities.py | python | getFFfile | (name) | return "" | Grab the forcefield file. May or may not residue in the dat/
directory. | Grab the forcefield file. May or may not residue in the dat/
directory. | [
"Grab",
"the",
"forcefield",
"file",
".",
"May",
"or",
"may",
"not",
"residue",
"in",
"the",
"dat",
"/",
"directory",
"."
] | def getFFfile(name):
"""
Grab the forcefield file. May or may not residue in the dat/
directory.
"""
if name is None:
return ''
path = ""
dirs = sys.path + ["dat"]
if name in ["amber", "charmm", "parse", "tyl06", "peoepb", "swanson"]: name = name.upper()
n... | [
"def",
"getFFfile",
"(",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"''",
"path",
"=",
"\"\"",
"dirs",
"=",
"sys",
".",
"path",
"+",
"[",
"\"dat\"",
"]",
"if",
"name",
"in",
"[",
"\"amber\"",
",",
"\"charmm\"",
",",
"\"parse\"",
"... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/src/utilities.py#L165-L196 | |
adamreeve/npTDMS | bf4d2f65872347fde4fe7fcbb4135f466e87323e | nptdms/tdms_segment.py | python | InterleavedDataReader.read_channel_data_chunks | (self, file, data_objects, channel_path, chunk_offset, stop_chunk) | return [data_chunk_to_channel_chunk(chunk, channel_path) for chunk in all_chunks] | Read multiple data chunks for a single channel at once | Read multiple data chunks for a single channel at once | [
"Read",
"multiple",
"data",
"chunks",
"for",
"a",
"single",
"channel",
"at",
"once"
] | def read_channel_data_chunks(self, file, data_objects, channel_path, chunk_offset, stop_chunk):
""" Read multiple data chunks for a single channel at once
"""
num_chunks = stop_chunk - chunk_offset
all_chunks = self.read_data_chunks(file, data_objects, num_chunks)
return [data_ch... | [
"def",
"read_channel_data_chunks",
"(",
"self",
",",
"file",
",",
"data_objects",
",",
"channel_path",
",",
"chunk_offset",
",",
"stop_chunk",
")",
":",
"num_chunks",
"=",
"stop_chunk",
"-",
"chunk_offset",
"all_chunks",
"=",
"self",
".",
"read_data_chunks",
"(",
... | https://github.com/adamreeve/npTDMS/blob/bf4d2f65872347fde4fe7fcbb4135f466e87323e/nptdms/tdms_segment.py#L433-L438 | |
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/topi/cuda/nms.py | python | _get_sorted_indices | (data, data_buf, score_index, score_shape) | return _dispatch_sort(score_tensor) | Extract a 1D score tensor from the packed input and do argsort on it. | Extract a 1D score tensor from the packed input and do argsort on it. | [
"Extract",
"a",
"1D",
"score",
"tensor",
"from",
"the",
"packed",
"input",
"and",
"do",
"argsort",
"on",
"it",
"."
] | def _get_sorted_indices(data, data_buf, score_index, score_shape):
"""Extract a 1D score tensor from the packed input and do argsort on it."""
score_buf = tvm.tir.decl_buffer(score_shape, data.dtype, "score_buf", data_alignment=8)
score_tensor = te.extern(
[score_shape],
[data],
lamb... | [
"def",
"_get_sorted_indices",
"(",
"data",
",",
"data_buf",
",",
"score_index",
",",
"score_shape",
")",
":",
"score_buf",
"=",
"tvm",
".",
"tir",
".",
"decl_buffer",
"(",
"score_shape",
",",
"data",
".",
"dtype",
",",
"\"score_buf\"",
",",
"data_alignment",
... | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/topi/cuda/nms.py#L643-L660 | |
happinesslz/TANet | 2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f | second.pytorch_with_TANet/second/core/preprocess.py | python | DataBasePreprocessor.__init__ | (self, preprocessors) | [] | def __init__(self, preprocessors):
self._preprocessors = preprocessors | [
"def",
"__init__",
"(",
"self",
",",
"preprocessors",
")",
":",
"self",
".",
"_preprocessors",
"=",
"preprocessors"
] | https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/second.pytorch_with_TANet/second/core/preprocess.py#L99-L100 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scattergl/legendgrouptitle/_font.py | python | Font.family | (self) | return self["family"] | HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they a... | HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they a... | [
"HTML",
"font",
"family",
"-",
"the",
"typeface",
"that",
"will",
"be",
"applied",
"by",
"the",
"web",
"browser",
".",
"The",
"web",
"browser",
"will",
"only",
"be",
"able",
"to",
"apply",
"a",
"font",
"if",
"it",
"is",
"available",
"on",
"the",
"syste... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scattergl/legendgrouptitle/_font.py#L73-L95 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/timeseries/periodograms/lombscargle/_statistics.py | python | inv_fap_naive | (fap, fmax, t, y, dy, normalization='standard') | return inv_fap_single(fap_s, N, normalization) | Inverse FAP based on estimated number of indep frequencies | Inverse FAP based on estimated number of indep frequencies | [
"Inverse",
"FAP",
"based",
"on",
"estimated",
"number",
"of",
"indep",
"frequencies"
] | def inv_fap_naive(fap, fmax, t, y, dy, normalization='standard'):
"""Inverse FAP based on estimated number of indep frequencies"""
fap = np.asarray(fap)
N = len(t)
T = max(t) - min(t)
N_eff = fmax * T
# fap_s = 1 - (1 - fap) ** (1 / N_eff)
# Ignore divide by zero no np.log - fine to let it r... | [
"def",
"inv_fap_naive",
"(",
"fap",
",",
"fmax",
",",
"t",
",",
"y",
",",
"dy",
",",
"normalization",
"=",
"'standard'",
")",
":",
"fap",
"=",
"np",
".",
"asarray",
"(",
"fap",
")",
"N",
"=",
"len",
"(",
"t",
")",
"T",
"=",
"max",
"(",
"t",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/timeseries/periodograms/lombscargle/_statistics.py#L280-L290 | |
hupili/snsapi | 129529b89f38cbee253a23e5ed31dae2a0ea4254 | snsapi/third/feedparser.py | python | _parse_date_hungarian | (dateString) | return _parse_date_w3dtf(w3dtfdate) | Parse a string according to a Hungarian 8-bit date format. | Parse a string according to a Hungarian 8-bit date format. | [
"Parse",
"a",
"string",
"according",
"to",
"a",
"Hungarian",
"8",
"-",
"bit",
"date",
"format",
"."
] | def _parse_date_hungarian(dateString):
'''Parse a string according to a Hungarian 8-bit date format.'''
m = _hungarian_date_format_re.match(dateString)
if not m or m.group(2) not in _hungarian_months:
return None
month = _hungarian_months[m.group(2)]
day = m.group(3)
if len(day) == 1:
... | [
"def",
"_parse_date_hungarian",
"(",
"dateString",
")",
":",
"m",
"=",
"_hungarian_date_format_re",
".",
"match",
"(",
"dateString",
")",
"if",
"not",
"m",
"or",
"m",
".",
"group",
"(",
"2",
")",
"not",
"in",
"_hungarian_months",
":",
"return",
"None",
"mo... | https://github.com/hupili/snsapi/blob/129529b89f38cbee253a23e5ed31dae2a0ea4254/snsapi/third/feedparser.py#L3329-L3345 | |
pyocd/pyOCD | 7d164d99e816c4ef6c99f257014543188a0ca5a6 | pyocd/core/memory_interface.py | python | MemoryInterface.write_memory | (self, addr, data, transfer_size=32) | ! @brief Write a single memory location.
By default the transfer size is a word. | ! | [
"!"
] | def write_memory(self, addr, data, transfer_size=32):
"""! @brief Write a single memory location.
By default the transfer size is a word."""
raise NotImplementedError() | [
"def",
"write_memory",
"(",
"self",
",",
"addr",
",",
"data",
",",
"transfer_size",
"=",
"32",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/pyocd/pyOCD/blob/7d164d99e816c4ef6c99f257014543188a0ca5a6/pyocd/core/memory_interface.py#L22-L26 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.pop | (self, key=-1) | return value | Removes and returns an item at a given index. Similar to list.pop(). | Removes and returns an item at a given index. Similar to list.pop(). | [
"Removes",
"and",
"returns",
"an",
"item",
"at",
"a",
"given",
"index",
".",
"Similar",
"to",
"list",
".",
"pop",
"()",
"."
] | def pop(self, key=-1):
"""Removes and returns an item at a given index. Similar to list.pop()."""
value = self._values[key]
self.__delitem__(key)
return value | [
"def",
"pop",
"(",
"self",
",",
"key",
"=",
"-",
"1",
")",
":",
"value",
"=",
"self",
".",
"_values",
"[",
"key",
"]",
"self",
".",
"__delitem__",
"(",
"key",
")",
"return",
"value"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/containers.py#L299-L303 | |
anchore/anchore-engine | bb18b70e0cbcad58beb44cd439d00067d8f7ea8b | anchore_engine/clients/services/internal.py | python | InternalServiceClient.round_robin_call_api | (
self,
method: callable,
path: str,
path_params=None,
query_params=None,
extra_headers=None,
body=None,
) | Invoke the api against service endpoints until the first non-exception response is received. Will only try another instnace
if the first is unsuccessfully delivered, e.g. cannot connect. Any valid HTTP response is considered a successful dispatch.
:param method:
:param path:
:param body... | Invoke the api against service endpoints until the first non-exception response is received. Will only try another instnace
if the first is unsuccessfully delivered, e.g. cannot connect. Any valid HTTP response is considered a successful dispatch. | [
"Invoke",
"the",
"api",
"against",
"service",
"endpoints",
"until",
"the",
"first",
"non",
"-",
"exception",
"response",
"is",
"received",
".",
"Will",
"only",
"try",
"another",
"instnace",
"if",
"the",
"first",
"is",
"unsuccessfully",
"delivered",
"e",
".",
... | def round_robin_call_api(
self,
method: callable,
path: str,
path_params=None,
query_params=None,
extra_headers=None,
body=None,
):
"""
Invoke the api against service endpoints until the first non-exception response is received. Will only try a... | [
"def",
"round_robin_call_api",
"(",
"self",
",",
"method",
":",
"callable",
",",
"path",
":",
"str",
",",
"path_params",
"=",
"None",
",",
"query_params",
"=",
"None",
",",
"extra_headers",
"=",
"None",
",",
"body",
"=",
"None",
",",
")",
":",
"urls",
... | https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/clients/services/internal.py#L340-L386 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/util/data_io.py | python | DataIO.transform | (self, data_inst) | return self.reader.read_data(data_inst, "transform") | [] | def transform(self, data_inst):
return self.reader.read_data(data_inst, "transform") | [
"def",
"transform",
"(",
"self",
",",
"data_inst",
")",
":",
"return",
"self",
".",
"reader",
".",
"read_data",
"(",
"data_inst",
",",
"\"transform\"",
")"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/util/data_io.py#L894-L895 | |||
yongzhuo/Keras-TextClassification | 640e3f44f90d9d8046546f7e1a93a29ebe5c8d30 | keras_textclassification/m03_CharCNN/graph_yoon_kim.py | python | Highway.get_config | (self) | return config | [] | def get_config(self):
config = super().get_config()
config['activation'] = self.activation
config['transform_gate_bias'] = self.transform_gate_bias
return config | [
"def",
"get_config",
"(",
"self",
")",
":",
"config",
"=",
"super",
"(",
")",
".",
"get_config",
"(",
")",
"config",
"[",
"'activation'",
"]",
"=",
"self",
".",
"activation",
"config",
"[",
"'transform_gate_bias'",
"]",
"=",
"self",
".",
"transform_gate_bi... | https://github.com/yongzhuo/Keras-TextClassification/blob/640e3f44f90d9d8046546f7e1a93a29ebe5c8d30/keras_textclassification/m03_CharCNN/graph_yoon_kim.py#L169-L173 | |||
AndroBugs/AndroBugs_Framework | 7fd3a2cb1cf65a9af10b7ed2129701d4451493fe | tools/modified/androguard/core/analysis/ganalysis.py | python | DiGraph.in_degree | (self, nbunch=None, weight=None) | Return the in-degree of a node or nodes.
The node in-degree is the number of edges pointing in to the node.
Parameters
----------
nbunch : iterable container, optional (default=all nodes)
A container of nodes. The container will be iterated
through once.
... | Return the in-degree of a node or nodes. | [
"Return",
"the",
"in",
"-",
"degree",
"of",
"a",
"node",
"or",
"nodes",
"."
] | def in_degree(self, nbunch=None, weight=None):
"""Return the in-degree of a node or nodes.
The node in-degree is the number of edges pointing in to the node.
Parameters
----------
nbunch : iterable container, optional (default=all nodes)
A container of nodes. The c... | [
"def",
"in_degree",
"(",
"self",
",",
"nbunch",
"=",
"None",
",",
"weight",
"=",
"None",
")",
":",
"if",
"nbunch",
"in",
"self",
":",
"# return a single node",
"return",
"next",
"(",
"self",
".",
"in_degree_iter",
"(",
"nbunch",
",",
"weight",
")",
")",
... | https://github.com/AndroBugs/AndroBugs_Framework/blob/7fd3a2cb1cf65a9af10b7ed2129701d4451493fe/tools/modified/androguard/core/analysis/ganalysis.py#L2782-L2822 | ||
dmnfarrell/tkintertable | f3fc8950aaa0f087de100d671ce13c24006d9639 | tkintertable/TableModels.py | python | TableModel.getRecColNames | (self, rowIndex, ColIndex) | return (recname, colname) | Returns the rec and col name as a tuple | Returns the rec and col name as a tuple | [
"Returns",
"the",
"rec",
"and",
"col",
"name",
"as",
"a",
"tuple"
] | def getRecColNames(self, rowIndex, ColIndex):
"""Returns the rec and col name as a tuple"""
recname = self.getRecName(rowIndex)
colname = self.getColumnName(ColIndex)
return (recname, colname) | [
"def",
"getRecColNames",
"(",
"self",
",",
"rowIndex",
",",
"ColIndex",
")",
":",
"recname",
"=",
"self",
".",
"getRecName",
"(",
"rowIndex",
")",
"colname",
"=",
"self",
".",
"getColumnName",
"(",
"ColIndex",
")",
"return",
"(",
"recname",
",",
"colname",... | https://github.com/dmnfarrell/tkintertable/blob/f3fc8950aaa0f087de100d671ce13c24006d9639/tkintertable/TableModels.py#L677-L681 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/pbc/dft/cdft.py | python | fast_iao_mullikan_pop | (mf,cell,a=None) | return mf.mulliken_pop(pmol, dm, s=numpy.eye(pmol.nao_nr())) | Input: mf -- a preconverged mean fild object
Returns: mullikan populaion analysis in the basisIAO a | Input: mf -- a preconverged mean fild object
Returns: mullikan populaion analysis in the basisIAO a | [
"Input",
":",
"mf",
"--",
"a",
"preconverged",
"mean",
"fild",
"object",
"Returns",
":",
"mullikan",
"populaion",
"analysis",
"in",
"the",
"basisIAO",
"a"
] | def fast_iao_mullikan_pop(mf,cell,a=None):
'''
Input: mf -- a preconverged mean fild object
Returns: mullikan populaion analysis in the basisIAO a
'''
#
# here we convert the density matrix to the IAO basis
#
if a is None:
a = numpy.eye(mf.make_rdm1().shape[1])
#converts the... | [
"def",
"fast_iao_mullikan_pop",
"(",
"mf",
",",
"cell",
",",
"a",
"=",
"None",
")",
":",
"#",
"# here we convert the density matrix to the IAO basis",
"#",
"if",
"a",
"is",
"None",
":",
"a",
"=",
"numpy",
".",
"eye",
"(",
"mf",
".",
"make_rdm1",
"(",
")",
... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/pbc/dft/cdft.py#L74-L98 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/util.py | python | SubprocessMixin.reader | (self, stream, context) | Read lines from a subprocess' output stream and either pass to a progress
callable (if specified) or write progress information to sys.stderr. | Read lines from a subprocess' output stream and either pass to a progress
callable (if specified) or write progress information to sys.stderr. | [
"Read",
"lines",
"from",
"a",
"subprocess",
"output",
"stream",
"and",
"either",
"pass",
"to",
"a",
"progress",
"callable",
"(",
"if",
"specified",
")",
"or",
"write",
"progress",
"information",
"to",
"sys",
".",
"stderr",
"."
] | def reader(self, stream, context):
"""
Read lines from a subprocess' output stream and either pass to a progress
callable (if specified) or write progress information to sys.stderr.
"""
progress = self.progress
verbose = self.verbose
while True:
s = st... | [
"def",
"reader",
"(",
"self",
",",
"stream",
",",
"context",
")",
":",
"progress",
"=",
"self",
".",
"progress",
"verbose",
"=",
"self",
".",
"verbose",
"while",
"True",
":",
"s",
"=",
"stream",
".",
"readline",
"(",
")",
"if",
"not",
"s",
":",
"br... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/distlib/util.py#L1714-L1733 | ||
ydkhatri/mac_apt | 729630c8bbe7a73cce3ca330305d3301a919cb07 | plugins/helpers/spotlight_parser.py | python | FileMetaDataListing.ConvertEpochToUtcDateStr | (self, value) | return "" | Convert Epoch microseconds timestamp to string | Convert Epoch microseconds timestamp to string | [
"Convert",
"Epoch",
"microseconds",
"timestamp",
"to",
"string"
] | def ConvertEpochToUtcDateStr(self, value):
'''Convert Epoch microseconds timestamp to string'''
try:
return datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=value/1000000.)
except OverflowError:
pass
return "" | [
"def",
"ConvertEpochToUtcDateStr",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"return",
"datetime",
".",
"datetime",
"(",
"1970",
",",
"1",
",",
"1",
")",
"+",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"value",
"/",
"1000000.",
")",
"exc... | https://github.com/ydkhatri/mac_apt/blob/729630c8bbe7a73cce3ca330305d3301a919cb07/plugins/helpers/spotlight_parser.py#L111-L117 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/__init__.py | python | AccountInstance.conferences | (self) | return self._proxy.conferences | Access the conferences
:returns: twilio.rest.api.v2010.account.conference.ConferenceList
:rtype: twilio.rest.api.v2010.account.conference.ConferenceList | Access the conferences | [
"Access",
"the",
"conferences"
] | def conferences(self):
"""
Access the conferences
:returns: twilio.rest.api.v2010.account.conference.ConferenceList
:rtype: twilio.rest.api.v2010.account.conference.ConferenceList
"""
return self._proxy.conferences | [
"def",
"conferences",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"conferences"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/__init__.py#L832-L839 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/version.py | python | _parse_letter_version | (letter, number) | [] | def _parse_letter_version(letter, number):
if letter:
# We consider there to be an implicit 0 in a pre-release if there is
# not a numeral associated with it.
if number is None:
number = 0
# We normalize any letters to their lower case form
letter = letter.lower(... | [
"def",
"_parse_letter_version",
"(",
"letter",
",",
"number",
")",
":",
"if",
"letter",
":",
"# We consider there to be an implicit 0 in a pre-release if there is",
"# not a numeral associated with it.",
"if",
"number",
"is",
"None",
":",
"number",
"=",
"0",
"# We normalize... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/version.py#L298-L326 | ||||
traveller59/second.pytorch | 3aba19c9688274f75ebb5e576f65cfe54773c021 | second/core/non_max_suppression/nms_gpu.py | python | rotate_iou_gpu_eval | (boxes, query_boxes, criterion=-1, device_id=0) | return iou.astype(boxes.dtype) | rotated box iou running in gpu. 8x faster than cpu version
(take 5ms in one example with numba.cuda code).
convert from [this project](
https://github.com/hongzhenwang/RRPN-revise/tree/master/lib/rotation).
Args:
boxes (float tensor: [N, 5]): rbboxes. format: centers, dims,
... | rotated box iou running in gpu. 8x faster than cpu version
(take 5ms in one example with numba.cuda code).
convert from [this project](
https://github.com/hongzhenwang/RRPN-revise/tree/master/lib/rotation).
Args:
boxes (float tensor: [N, 5]): rbboxes. format: centers, dims,
... | [
"rotated",
"box",
"iou",
"running",
"in",
"gpu",
".",
"8x",
"faster",
"than",
"cpu",
"version",
"(",
"take",
"5ms",
"in",
"one",
"example",
"with",
"numba",
".",
"cuda",
"code",
")",
".",
"convert",
"from",
"[",
"this",
"project",
"]",
"(",
"https",
... | def rotate_iou_gpu_eval(boxes, query_boxes, criterion=-1, device_id=0):
"""rotated box iou running in gpu. 8x faster than cpu version
(take 5ms in one example with numba.cuda code).
convert from [this project](
https://github.com/hongzhenwang/RRPN-revise/tree/master/lib/rotation).
Args:
... | [
"def",
"rotate_iou_gpu_eval",
"(",
"boxes",
",",
"query_boxes",
",",
"criterion",
"=",
"-",
"1",
",",
"device_id",
"=",
"0",
")",
":",
"box_dtype",
"=",
"boxes",
".",
"dtype",
"boxes",
"=",
"boxes",
".",
"astype",
"(",
"np",
".",
"float32",
")",
"query... | https://github.com/traveller59/second.pytorch/blob/3aba19c9688274f75ebb5e576f65cfe54773c021/second/core/non_max_suppression/nms_gpu.py#L605-L640 | |
PhoenixDL/rising | 6de193375dcaac35605163c35cec259c9a2116d1 | rising/transforms/painting.py | python | RandomInOrOutpainting.__init__ | (
self,
prob: float = 0.5,
n: int = 5,
maxv: float = 1.0,
minv: float = 0.0,
keys: Sequence = ("data",),
grad: bool = False,
**kwargs
) | Args:
minv, maxv: range of uniform noise
prob: probability of outpainting, probability of inpainting is 1-prob.
n: number of local patches to randomize in case of inpainting
keys: the keys corresponding to the values to distort
grad: enable gradient computatio... | Args:
minv, maxv: range of uniform noise
prob: probability of outpainting, probability of inpainting is 1-prob.
n: number of local patches to randomize in case of inpainting
keys: the keys corresponding to the values to distort
grad: enable gradient computatio... | [
"Args",
":",
"minv",
"maxv",
":",
"range",
"of",
"uniform",
"noise",
"prob",
":",
"probability",
"of",
"outpainting",
"probability",
"of",
"inpainting",
"is",
"1",
"-",
"prob",
".",
"n",
":",
"number",
"of",
"local",
"patches",
"to",
"randomize",
"in",
"... | def __init__(
self,
prob: float = 0.5,
n: int = 5,
maxv: float = 1.0,
minv: float = 0.0,
keys: Sequence = ("data",),
grad: bool = False,
**kwargs
):
"""
Args:
minv, maxv: range of uniform noise
prob: probability ... | [
"def",
"__init__",
"(",
"self",
",",
"prob",
":",
"float",
"=",
"0.5",
",",
"n",
":",
"int",
"=",
"5",
",",
"maxv",
":",
"float",
"=",
"1.0",
",",
"minv",
":",
"float",
"=",
"0.0",
",",
"keys",
":",
"Sequence",
"=",
"(",
"\"data\"",
",",
")",
... | https://github.com/PhoenixDL/rising/blob/6de193375dcaac35605163c35cec259c9a2116d1/rising/transforms/painting.py#L82-L106 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyCompleter.py | python | PupyModCompleter.get_optional_nargs | (self, name) | return 1 | [] | def get_optional_nargs(self, name):
if "action" in self.conf["optional_args"]:
action=self.conf["optional_args"]["action"]
if action=="store_true" or action=="store_false":
return 0
return 1 | [
"def",
"get_optional_nargs",
"(",
"self",
",",
"name",
")",
":",
"if",
"\"action\"",
"in",
"self",
".",
"conf",
"[",
"\"optional_args\"",
"]",
":",
"action",
"=",
"self",
".",
"conf",
"[",
"\"optional_args\"",
"]",
"[",
"\"action\"",
"]",
"if",
"action",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyCompleter.py#L133-L138 | |||
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Engine/Core/multi_circuit.py | python | MultiCircuit.set_state | (self, t) | Set the profiles state at the index t as the default values. | Set the profiles state at the index t as the default values. | [
"Set",
"the",
"profiles",
"state",
"at",
"the",
"index",
"t",
"as",
"the",
"default",
"values",
"."
] | def set_state(self, t):
"""
Set the profiles state at the index t as the default values.
"""
for bus in self.buses:
bus.set_state(t) | [
"def",
"set_state",
"(",
"self",
",",
"t",
")",
":",
"for",
"bus",
"in",
"self",
".",
"buses",
":",
"bus",
".",
"set_state",
"(",
"t",
")"
] | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Core/multi_circuit.py#L1710-L1715 | ||
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/sem/relextract.py | python | extract_rels | (subjclass, objclass, doc, corpus="ace", pattern=None, window=10) | return list(filter(relfilter, reldicts)) | Filter the output of ``semi_rel2reldict`` according to specified NE classes and a filler pattern.
The parameters ``subjclass`` and ``objclass`` can be used to restrict the
Named Entities to particular types (any of 'LOCATION', 'ORGANIZATION',
'PERSON', 'DURATION', 'DATE', 'CARDINAL', 'PERCENT', 'MONEY', 'M... | Filter the output of ``semi_rel2reldict`` according to specified NE classes and a filler pattern. | [
"Filter",
"the",
"output",
"of",
"semi_rel2reldict",
"according",
"to",
"specified",
"NE",
"classes",
"and",
"a",
"filler",
"pattern",
"."
] | def extract_rels(subjclass, objclass, doc, corpus="ace", pattern=None, window=10):
"""
Filter the output of ``semi_rel2reldict`` according to specified NE classes and a filler pattern.
The parameters ``subjclass`` and ``objclass`` can be used to restrict the
Named Entities to particular types (any of '... | [
"def",
"extract_rels",
"(",
"subjclass",
",",
"objclass",
",",
"doc",
",",
"corpus",
"=",
"\"ace\"",
",",
"pattern",
"=",
"None",
",",
"window",
"=",
"10",
")",
":",
"if",
"subjclass",
"and",
"subjclass",
"not",
"in",
"NE_CLASSES",
"[",
"corpus",
"]",
... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/sem/relextract.py#L202-L260 | |
frobelbest/BANet | 4015642c9dfe8287c5f146d7a90df594625f2560 | legacy/deeptam/python/deeptam_tracker/tracker.py | python | TrackerCore.set_keyframe | (self, key_image, key_depth, key_pose) | Sets the keyframe
key_pose: Pose
key_image: np.array
Channels first(r,g,b), normalized in range [-0.5, 0.5]
key_depth: np.array
[height, width], inverse depth [1/m] | Sets the keyframe
key_pose: Pose
key_image: np.array
Channels first(r,g,b), normalized in range [-0.5, 0.5]
key_depth: np.array
[height, width], inverse depth [1/m] | [
"Sets",
"the",
"keyframe",
"key_pose",
":",
"Pose",
"key_image",
":",
"np",
".",
"array",
"Channels",
"first",
"(",
"r",
"g",
"b",
")",
"normalized",
"in",
"range",
"[",
"-",
"0",
".",
"5",
"0",
".",
"5",
"]",
"key_depth",
":",
"np",
".",
"array",
... | def set_keyframe(self, key_image, key_depth, key_pose):
""" Sets the keyframe
key_pose: Pose
key_image: np.array
Channels first(r,g,b), normalized in range [-0.5, 0.5]
key_depth: np.array
[height, width], inverse depth [1/m]
"""... | [
"def",
"set_keyframe",
"(",
"self",
",",
"key_image",
",",
"key_depth",
",",
"key_pose",
")",
":",
"self",
".",
"_key_pose",
"=",
"key_pose",
"self",
".",
"_key_image",
"=",
"np",
".",
"squeeze",
"(",
"key_image",
")",
"[",
"np",
".",
"newaxis",
",",
"... | https://github.com/frobelbest/BANet/blob/4015642c9dfe8287c5f146d7a90df594625f2560/legacy/deeptam/python/deeptam_tracker/tracker.py#L256-L270 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py | python | BaseRequest.path_shift | (self, shift=1) | Shift path segments from :attr:`path` to :attr:`script_name` and
vice versa.
:param shift: The number of path segments to shift. May be negative
to change the shift direction. (default: 1) | Shift path segments from :attr:`path` to :attr:`script_name` and
vice versa. | [
"Shift",
"path",
"segments",
"from",
":",
"attr",
":",
"path",
"to",
":",
"attr",
":",
"script_name",
"and",
"vice",
"versa",
"."
] | def path_shift(self, shift=1):
''' Shift path segments from :attr:`path` to :attr:`script_name` and
vice versa.
:param shift: The number of path segments to shift. May be negative
to change the shift direction. (default: 1)
'''
script = self.envir... | [
"def",
"path_shift",
"(",
"self",
",",
"shift",
"=",
"1",
")",
":",
"script",
"=",
"self",
".",
"environ",
".",
"get",
"(",
"'SCRIPT_NAME'",
",",
"'/'",
")",
"self",
"[",
"'SCRIPT_NAME'",
"]",
",",
"self",
"[",
"'PATH_INFO'",
"]",
"=",
"path_shift",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py#L1136-L1144 | ||
fedora-infra/bodhi | 2b1df12d85eb2e575d8e481a3936c4f92d1fe29a | bodhi/client/__init__.py | python | _validate_edit_update | (
ctx: click.core.Context, param: typing.Union[click.core.Option, click.core.Parameter],
value: str) | Validate the update argument given to the updates edit command.
The update argument can only be an update id.
Args:
ctx: The click Context. Unused.
param: The name of the parameter being validated. Unused.
value: The value of the value being validated.
Returns:
The value if... | Validate the update argument given to the updates edit command. | [
"Validate",
"the",
"update",
"argument",
"given",
"to",
"the",
"updates",
"edit",
"command",
"."
] | def _validate_edit_update(
ctx: click.core.Context, param: typing.Union[click.core.Option, click.core.Parameter],
value: str) -> str:
"""
Validate the update argument given to the updates edit command.
The update argument can only be an update id.
Args:
ctx: The click Context. ... | [
"def",
"_validate_edit_update",
"(",
"ctx",
":",
"click",
".",
"core",
".",
"Context",
",",
"param",
":",
"typing",
".",
"Union",
"[",
"click",
".",
"core",
".",
"Option",
",",
"click",
".",
"core",
".",
"Parameter",
"]",
",",
"value",
":",
"str",
")... | https://github.com/fedora-infra/bodhi/blob/2b1df12d85eb2e575d8e481a3936c4f92d1fe29a/bodhi/client/__init__.py#L461-L481 | ||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/authn_context/ippword.py | python | security_audit_from_string | (xml_string) | return saml2.create_class_from_xml_string(SecurityAudit, xml_string) | [] | def security_audit_from_string(xml_string):
return saml2.create_class_from_xml_string(SecurityAudit, xml_string) | [
"def",
"security_audit_from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"SecurityAudit",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/authn_context/ippword.py#L1778-L1779 | |||
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/readers/sar_c_safe.py | python | SAFEGRD._change_quantity | (data, quantity) | return data | Change quantity to dB if needed. | Change quantity to dB if needed. | [
"Change",
"quantity",
"to",
"dB",
"if",
"needed",
"."
] | def _change_quantity(data, quantity):
"""Change quantity to dB if needed."""
if quantity == 'dB':
data.data = 10 * np.log10(data.data)
data.attrs['units'] = 'dB'
else:
data.attrs['units'] = '1'
return data | [
"def",
"_change_quantity",
"(",
"data",
",",
"quantity",
")",
":",
"if",
"quantity",
"==",
"'dB'",
":",
"data",
".",
"data",
"=",
"10",
"*",
"np",
".",
"log10",
"(",
"data",
".",
"data",
")",
"data",
".",
"attrs",
"[",
"'units'",
"]",
"=",
"'dB'",
... | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/sar_c_safe.py#L576-L584 | |
PyLops/pylops | 33eb807c6f429dd2efe697627c0d3955328af81f | pylops/utils/backend.py | python | get_complex_dtype | (dtype) | return (np.ones(1, dtype=dtype) + 1j * np.ones(1, dtype=dtype)).dtype | Returns a complex type in the precision of the input type.
Parameters
----------
dtype : :obj:`numpy.dtype`
Input dtype.
Returns
-------
complex_dtype : :obj:`numpy.dtype`
Complex output type. | Returns a complex type in the precision of the input type. | [
"Returns",
"a",
"complex",
"type",
"in",
"the",
"precision",
"of",
"the",
"input",
"type",
"."
] | def get_complex_dtype(dtype):
"""Returns a complex type in the precision of the input type.
Parameters
----------
dtype : :obj:`numpy.dtype`
Input dtype.
Returns
-------
complex_dtype : :obj:`numpy.dtype`
Complex output type.
"""
return (np.ones(1, dtype=dtype) + 1j... | [
"def",
"get_complex_dtype",
"(",
"dtype",
")",
":",
"return",
"(",
"np",
".",
"ones",
"(",
"1",
",",
"dtype",
"=",
"dtype",
")",
"+",
"1j",
"*",
"np",
".",
"ones",
"(",
"1",
",",
"dtype",
"=",
"dtype",
")",
")",
".",
"dtype"
] | https://github.com/PyLops/pylops/blob/33eb807c6f429dd2efe697627c0d3955328af81f/pylops/utils/backend.py#L337-L350 | |
unioslo/zabbix-cli | 4400fe4cb0987a027f32bdb74ac3de3fd8c78973 | zabbix_cli/cli.py | python | zabbixcli.do_show_usergroup_permissions | (self, args) | DESCRIPTION
This command show usergroup permissions information
COMMAND:
show_usergroup_permissions [usergroup]
[usergroup]:
----------------
Usergroup that will be displayed. | DESCRIPTION
This command show usergroup permissions information | [
"DESCRIPTION",
"This",
"command",
"show",
"usergroup",
"permissions",
"information"
] | def do_show_usergroup_permissions(self, args):
"""
DESCRIPTION
This command show usergroup permissions information
COMMAND:
show_usergroup_permissions [usergroup]
[usergroup]:
----------------
Usergroup that will be displayed.
"""
result... | [
"def",
"do_show_usergroup_permissions",
"(",
"self",
",",
"args",
")",
":",
"result_columns",
"=",
"{",
"}",
"result_columns_key",
"=",
"0",
"try",
":",
"arg_list",
"=",
"shlex",
".",
"split",
"(",
"args",
")",
"except",
"ValueError",
"as",
"e",
":",
"prin... | https://github.com/unioslo/zabbix-cli/blob/4400fe4cb0987a027f32bdb74ac3de3fd8c78973/zabbix_cli/cli.py#L4965-L5042 | ||
mims-harvard/nimfa | 3564bf6fe46b4904e828ac1d9b99f5af1fc25ed1 | nimfa/examples/recommendations.py | python | run | () | Run SNMF/R on the MovieLens data set.
Factorization is run on `ua.base`, `ua.test` and `ub.base`, `ub.test` data set. This is MovieLens's data set split
of the data into training and test set. Both test data sets are disjoint and with exactly 10 ratings per user
in the test set. | Run SNMF/R on the MovieLens data set.
Factorization is run on `ua.base`, `ua.test` and `ub.base`, `ub.test` data set. This is MovieLens's data set split
of the data into training and test set. Both test data sets are disjoint and with exactly 10 ratings per user
in the test set. | [
"Run",
"SNMF",
"/",
"R",
"on",
"the",
"MovieLens",
"data",
"set",
".",
"Factorization",
"is",
"run",
"on",
"ua",
".",
"base",
"ua",
".",
"test",
"and",
"ub",
".",
"base",
"ub",
".",
"test",
"data",
"set",
".",
"This",
"is",
"MovieLens",
"s",
"data"... | def run():
"""
Run SNMF/R on the MovieLens data set.
Factorization is run on `ua.base`, `ua.test` and `ub.base`, `ub.test` data set. This is MovieLens's data set split
of the data into training and test set. Both test data sets are disjoint and with exactly 10 ratings per user
in the test set.... | [
"def",
"run",
"(",
")",
":",
"for",
"data_set",
"in",
"[",
"'ua'",
",",
"'ub'",
"]",
":",
"V",
"=",
"read",
"(",
"data_set",
")",
"W",
",",
"H",
"=",
"factorize",
"(",
"V",
")",
"rmse",
"(",
"W",
",",
"H",
",",
"data_set",
")"
] | https://github.com/mims-harvard/nimfa/blob/3564bf6fe46b4904e828ac1d9b99f5af1fc25ed1/nimfa/examples/recommendations.py#L58-L69 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/pydoc.py | python | importfile | (path) | return module | Import a Python source file or compiled file given its path. | Import a Python source file or compiled file given its path. | [
"Import",
"a",
"Python",
"source",
"file",
"or",
"compiled",
"file",
"given",
"its",
"path",
"."
] | def importfile(path):
"""Import a Python source file or compiled file given its path."""
magic = imp.get_magic()
file = open(path, 'r')
if file.read(len(magic)) == magic:
kind = imp.PY_COMPILED
else:
kind = imp.PY_SOURCE
file.close()
filename = os.path.basename(path)
name... | [
"def",
"importfile",
"(",
"path",
")",
":",
"magic",
"=",
"imp",
".",
"get_magic",
"(",
")",
"file",
"=",
"open",
"(",
"path",
",",
"'r'",
")",
"if",
"file",
".",
"read",
"(",
"len",
"(",
"magic",
")",
")",
"==",
"magic",
":",
"kind",
"=",
"imp... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/pydoc.py#L249-L266 | |
tensorflow/tensorboard | 61d11d99ef034c30ba20b6a7840c8eededb9031c | tensorboard/plugins/text_v2/text_v2_plugin.py | python | TextV2Plugin.frontend_metadata | (self) | return base_plugin.FrontendMetadata(
is_ng_component=True, tab_name="Text v2", disable_reload=False
) | [] | def frontend_metadata(self):
return base_plugin.FrontendMetadata(
is_ng_component=True, tab_name="Text v2", disable_reload=False
) | [
"def",
"frontend_metadata",
"(",
"self",
")",
":",
"return",
"base_plugin",
".",
"FrontendMetadata",
"(",
"is_ng_component",
"=",
"True",
",",
"tab_name",
"=",
"\"Text v2\"",
",",
"disable_reload",
"=",
"False",
")"
] | https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/text_v2/text_v2_plugin.py#L128-L131 | |||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | math/fmath.py | python | egypt | (n,d) | return parts | Egyptian fractions.\nARGS: ({numerator},{denominator}) | Egyptian fractions.\nARGS: ({numerator},{denominator}) | [
"Egyptian",
"fractions",
".",
"\\",
"nARGS",
":",
"(",
"{",
"numerator",
"}",
"{",
"denominator",
"}",
")"
] | def egypt(n,d):
'''Egyptian fractions.\nARGS: ({numerator},{denominator})'''
f = fr.Fraction(n,d)
e = int(f)
f -= e
parts = [e]
while(f.numerator>1):
e = fr.Fraction(1, int(m.ceil(1/f)))
parts.append(e)
f -= e
parts.append(f)
return parts | [
"def",
"egypt",
"(",
"n",
",",
"d",
")",
":",
"f",
"=",
"fr",
".",
"Fraction",
"(",
"n",
",",
"d",
")",
"e",
"=",
"int",
"(",
"f",
")",
"f",
"-=",
"e",
"parts",
"=",
"[",
"e",
"]",
"while",
"(",
"f",
".",
"numerator",
">",
"1",
")",
":"... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/math/fmath.py#L194-L205 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/pydoc.py | python | Helper.listtopics | (self) | [] | def listtopics(self):
self.output.write('''
Here is a list of available topics. Enter any topic name to get more help.
''')
self.list(self.topics.keys()) | [
"def",
"listtopics",
"(",
"self",
")",
":",
"self",
".",
"output",
".",
"write",
"(",
"'''\nHere is a list of available topics. Enter any topic name to get more help.\n\n'''",
")",
"self",
".",
"list",
"(",
"self",
".",
"topics",
".",
"keys",
"(",
")",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/pydoc.py#L2015-L2020 | ||||
boto/botocore | f36f59394263539ed31f5a8ceb552a85354a552c | botocore/paginate.py | python | PageIterator._parse_starting_token_deprecated | (self) | return self._convert_deprecated_starting_token(next_token), index | This handles parsing of old style starting tokens, and attempts to
coerce them into the new style. | This handles parsing of old style starting tokens, and attempts to
coerce them into the new style. | [
"This",
"handles",
"parsing",
"of",
"old",
"style",
"starting",
"tokens",
"and",
"attempts",
"to",
"coerce",
"them",
"into",
"the",
"new",
"style",
"."
] | def _parse_starting_token_deprecated(self):
"""
This handles parsing of old style starting tokens, and attempts to
coerce them into the new style.
"""
log.debug("Attempting to fall back to old starting token parser. For "
"token: %s" % self._starting_token)
... | [
"def",
"_parse_starting_token_deprecated",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"\"Attempting to fall back to old starting token parser. For \"",
"\"token: %s\"",
"%",
"self",
".",
"_starting_token",
")",
"if",
"self",
".",
"_starting_token",
"is",
"None",
"... | https://github.com/boto/botocore/blob/f36f59394263539ed31f5a8ceb552a85354a552c/botocore/paginate.py#L510-L536 | |
elbayadm/attn2d | 982653439dedc7306e484e00b3dfb90e2cd7c9e1 | fairseq/file_utils.py | python | split_s3_path | (url) | return bucket_name, s3_path | Split a full s3 path into the bucket name and path. | Split a full s3 path into the bucket name and path. | [
"Split",
"a",
"full",
"s3",
"path",
"into",
"the",
"bucket",
"name",
"and",
"path",
"."
] | def split_s3_path(url):
"""Split a full s3 path into the bucket name and path."""
parsed = urlparse(url)
if not parsed.netloc or not parsed.path:
raise ValueError("bad s3 path {}".format(url))
bucket_name = parsed.netloc
s3_path = parsed.path
# Remove '/' at beginning of path.
if s3_... | [
"def",
"split_s3_path",
"(",
"url",
")",
":",
"parsed",
"=",
"urlparse",
"(",
"url",
")",
"if",
"not",
"parsed",
".",
"netloc",
"or",
"not",
"parsed",
".",
"path",
":",
"raise",
"ValueError",
"(",
"\"bad s3 path {}\"",
".",
"format",
"(",
"url",
")",
"... | https://github.com/elbayadm/attn2d/blob/982653439dedc7306e484e00b3dfb90e2cd7c9e1/fairseq/file_utils.py#L164-L174 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/core/context_processors.py | python | media | (request) | return {'MEDIA_URL': settings.MEDIA_URL} | Adds media-related context variables to the context. | Adds media-related context variables to the context. | [
"Adds",
"media",
"-",
"related",
"context",
"variables",
"to",
"the",
"context",
"."
] | def media(request):
"""
Adds media-related context variables to the context.
"""
return {'MEDIA_URL': settings.MEDIA_URL} | [
"def",
"media",
"(",
"request",
")",
":",
"return",
"{",
"'MEDIA_URL'",
":",
"settings",
".",
"MEDIA_URL",
"}"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/core/context_processors.py#L76-L81 | |
diefenbach/django-lfs | 3bbcb3453d324c181ec68d11d5d35115a60a2fd5 | lfs/core/models.py | python | Shop.get_format_info | (self) | return {
"product_cols": self.product_cols,
"product_rows": self.product_rows,
"category_cols": self.category_cols,
} | Returns the global format info. | Returns the global format info. | [
"Returns",
"the",
"global",
"format",
"info",
"."
] | def get_format_info(self):
"""Returns the global format info.
"""
return {
"product_cols": self.product_cols,
"product_rows": self.product_rows,
"category_cols": self.category_cols,
} | [
"def",
"get_format_info",
"(",
"self",
")",
":",
"return",
"{",
"\"product_cols\"",
":",
"self",
".",
"product_cols",
",",
"\"product_rows\"",
":",
"self",
".",
"product_rows",
",",
"\"category_cols\"",
":",
"self",
".",
"category_cols",
",",
"}"
] | https://github.com/diefenbach/django-lfs/blob/3bbcb3453d324c181ec68d11d5d35115a60a2fd5/lfs/core/models.py#L205-L212 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/db/api.py | python | migration_get | (context, migration_id) | return IMPL.migration_get(context, migration_id) | Finds a migration by the id. | Finds a migration by the id. | [
"Finds",
"a",
"migration",
"by",
"the",
"id",
"."
] | def migration_get(context, migration_id):
"""Finds a migration by the id."""
return IMPL.migration_get(context, migration_id) | [
"def",
"migration_get",
"(",
"context",
",",
"migration_id",
")",
":",
"return",
"IMPL",
".",
"migration_get",
"(",
"context",
",",
"migration_id",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/db/api.py#L393-L395 | |
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/reader/models.py | python | RUserStory.mark_story_hash_unread | (cls, user, story_hash, r=None, s=None, ps=None) | return feed_id, list(friend_ids) | [] | def mark_story_hash_unread(cls, user, story_hash, r=None, s=None, ps=None):
if not r:
r = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_POOL)
if not s:
s = redis.Redis(connection_pool=settings.REDIS_POOL)
if not ps:
ps = redis.Redis(connection_pool=set... | [
"def",
"mark_story_hash_unread",
"(",
"cls",
",",
"user",
",",
"story_hash",
",",
"r",
"=",
"None",
",",
"s",
"=",
"None",
",",
"ps",
"=",
"None",
")",
":",
"if",
"not",
"r",
":",
"r",
"=",
"redis",
".",
"Redis",
"(",
"connection_pool",
"=",
"setti... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/reader/models.py#L1087-L1108 | |||
python-amazon-mws/python-amazon-mws | 2d56045cdec69329f7cc0496ad37ae18115fedf0 | mws/apis/subscriptions.py | python | Subscriptions.list_registered_destinations | (self, marketplace_id) | return self.make_request(
"ListRegisteredDestinations",
{"MarketplaceId": marketplace_id},
) | Lists all current destinations that you have registered.
Docs:
https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html | Lists all current destinations that you have registered. | [
"Lists",
"all",
"current",
"destinations",
"that",
"you",
"have",
"registered",
"."
] | def list_registered_destinations(self, marketplace_id):
"""Lists all current destinations that you have registered.
Docs:
https://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html
"""
return self.make_request(
"ListRe... | [
"def",
"list_registered_destinations",
"(",
"self",
",",
"marketplace_id",
")",
":",
"return",
"self",
".",
"make_request",
"(",
"\"ListRegisteredDestinations\"",
",",
"{",
"\"MarketplaceId\"",
":",
"marketplace_id",
"}",
",",
")"
] | https://github.com/python-amazon-mws/python-amazon-mws/blob/2d56045cdec69329f7cc0496ad37ae18115fedf0/mws/apis/subscriptions.py#L85-L94 | |
raveberry/raveberry | df0186c94b238b57de86d3fd5c595dcd08a7c708 | backend/core/user_manager.py | python | is_admin | (user: AbstractUser) | return user.is_superuser | Determines whether the given user is the admin. | Determines whether the given user is the admin. | [
"Determines",
"whether",
"the",
"given",
"user",
"is",
"the",
"admin",
"."
] | def is_admin(user: AbstractUser) -> bool:
"""Determines whether the given user is the admin."""
return user.is_superuser | [
"def",
"is_admin",
"(",
"user",
":",
"AbstractUser",
")",
"->",
"bool",
":",
"return",
"user",
".",
"is_superuser"
] | https://github.com/raveberry/raveberry/blob/df0186c94b238b57de86d3fd5c595dcd08a7c708/backend/core/user_manager.py#L25-L27 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/operator.py | python | floordiv | (a, b) | return a // b | Same as a // b. | Same as a // b. | [
"Same",
"as",
"a",
"//",
"b",
"."
] | def floordiv(a, b):
"Same as a // b."
return a // b | [
"def",
"floordiv",
"(",
"a",
",",
"b",
")",
":",
"return",
"a",
"//",
"b"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/operator.py#L83-L85 | |
automl/Auto-PyTorch | 06e67de5017b4cccad9398e24a3d9f0bd8176da3 | autoPyTorch/pipeline/base_pipeline.py | python | BasePipeline.predict | (self, X: np.ndarray, batch_size: Optional[int] = None) | return self.named_steps['network'].predict(loader) | Predict the output using the selected model.
Args:
X (np.ndarray): input data to the array
batch_size (Optional[int]): batch_size controls whether the pipeline will be
called on small chunks of the data. Useful when calling the
predict method on the whole... | Predict the output using the selected model. | [
"Predict",
"the",
"output",
"using",
"the",
"selected",
"model",
"."
] | def predict(self, X: np.ndarray, batch_size: Optional[int] = None) -> np.ndarray:
"""Predict the output using the selected model.
Args:
X (np.ndarray): input data to the array
batch_size (Optional[int]): batch_size controls whether the pipeline will be
called on ... | [
"def",
"predict",
"(",
"self",
",",
"X",
":",
"np",
".",
"ndarray",
",",
"batch_size",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"np",
".",
"ndarray",
":",
"# Pre-process X",
"if",
"batch_size",
"is",
"None",
":",
"warnings",
".",
"wa... | https://github.com/automl/Auto-PyTorch/blob/06e67de5017b4cccad9398e24a3d9f0bd8176da3/autoPyTorch/pipeline/base_pipeline.py#L177-L196 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/core/blockstorage_client.py | python | BlockstorageClient.__init__ | (self, config, **kwargs) | Creates a new service client
:param dict config:
Configuration keys and values as per `SDK and Tool Configuration <https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm>`__.
The :py:meth:`~oci.config.from_file` method can be used to load configuration from a file. Alternative... | Creates a new service client | [
"Creates",
"a",
"new",
"service",
"client"
] | def __init__(self, config, **kwargs):
"""
Creates a new service client
:param dict config:
Configuration keys and values as per `SDK and Tool Configuration <https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm>`__.
The :py:meth:`~oci.config.from_file` method ... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"*",
"*",
"kwargs",
")",
":",
"validate_config",
"(",
"config",
",",
"signer",
"=",
"kwargs",
".",
"get",
"(",
"'signer'",
")",
")",
"if",
"'signer'",
"in",
"kwargs",
":",
"signer",
"=",
"kwargs",
"... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/blockstorage_client.py#L28-L105 | ||
geatpy-dev/geatpy | 49a1d23f36e4a3418ad7adc0e3a20247def53401 | geatpy/PsyPopulation.py | python | PsyPopulation.copy | (self) | return PsyPopulation(self.Encodings,
self.Fields,
self.sizes,
self.Chroms,
self.ObjV,
self.FitnV,
self.CV,
self.Phen,... | copy : function - 种群的复制
用法:
假设pop是一个种群矩阵,那么:pop1 = pop.copy()即可完成对pop种群的复制。 | copy : function - 种群的复制
用法:
假设pop是一个种群矩阵,那么:pop1 = pop.copy()即可完成对pop种群的复制。 | [
"copy",
":",
"function",
"-",
"种群的复制",
"用法",
":",
"假设pop是一个种群矩阵,那么:pop1",
"=",
"pop",
".",
"copy",
"()",
"即可完成对pop种群的复制。"
] | def copy(self):
"""
copy : function - 种群的复制
用法:
假设pop是一个种群矩阵,那么:pop1 = pop.copy()即可完成对pop种群的复制。
"""
return PsyPopulation(self.Encodings,
self.Fields,
self.sizes,
self... | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"PsyPopulation",
"(",
"self",
".",
"Encodings",
",",
"self",
".",
"Fields",
",",
"self",
".",
"sizes",
",",
"self",
".",
"Chroms",
",",
"self",
".",
"ObjV",
",",
"self",
".",
"FitnV",
",",
"self",
"."... | https://github.com/geatpy-dev/geatpy/blob/49a1d23f36e4a3418ad7adc0e3a20247def53401/geatpy/PsyPopulation.py#L179-L196 | |
cleverhans-lab/cleverhans | e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d | cleverhans_v3.1.0/cleverhans/picklable_model.py | python | GroupNorm.set_input_shape | (self, shape) | [] | def set_input_shape(self, shape):
self.input_shape = shape
self.output_shape = shape
channels = shape[-1]
self.channels = channels
self.actual_num_groups = min(self.channels, self.num_groups)
extra_dims = (self.channels // self.actual_num_groups, self.actual_num_groups)
... | [
"def",
"set_input_shape",
"(",
"self",
",",
"shape",
")",
":",
"self",
".",
"input_shape",
"=",
"shape",
"self",
".",
"output_shape",
"=",
"shape",
"channels",
"=",
"shape",
"[",
"-",
"1",
"]",
"self",
".",
"channels",
"=",
"channels",
"self",
".",
"ac... | https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/cleverhans/picklable_model.py#L755-L767 | ||||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/ctp/futures/ApiStruct.py | python | ExchangeOrder.__init__ | (self, OrderPriceType=OPT_AnyPrice, Direction=D_Buy, CombOffsetFlag='', CombHedgeFlag='', LimitPrice=0.0, VolumeTotalOriginal=0, TimeCondition=TC_IOC, GTDDate='', VolumeCondition=VC_AV, MinVolume=0, ContingentCondition=CC_Immediately, StopPrice=0.0, ForceCloseReason=FCC_NotForceClose, IsAutoSuspend=0, BusinessUnit='', ... | [] | def __init__(self, OrderPriceType=OPT_AnyPrice, Direction=D_Buy, CombOffsetFlag='', CombHedgeFlag='', LimitPrice=0.0, VolumeTotalOriginal=0, TimeCondition=TC_IOC, GTDDate='', VolumeCondition=VC_AV, MinVolume=0, ContingentCondition=CC_Immediately, StopPrice=0.0, ForceCloseReason=FCC_NotForceClose, IsAutoSuspend=0, Busin... | [
"def",
"__init__",
"(",
"self",
",",
"OrderPriceType",
"=",
"OPT_AnyPrice",
",",
"Direction",
"=",
"D_Buy",
",",
"CombOffsetFlag",
"=",
"''",
",",
"CombHedgeFlag",
"=",
"''",
",",
"LimitPrice",
"=",
"0.0",
",",
"VolumeTotalOriginal",
"=",
"0",
",",
"TimeCond... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/ApiStruct.py#L2611-L2653 | ||||
suavecode/SUAVE | 4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5 | trunk/SUAVE/Analyses/Aerodynamics/AVL.py | python | AVL.initialize | (self) | Initializes the surrogate needed for AVL.
Assumptions:
None
Source:
N/A
Inputs:
None
Outputs:
None
Properties Used:
self.geometry | Initializes the surrogate needed for AVL. | [
"Initializes",
"the",
"surrogate",
"needed",
"for",
"AVL",
"."
] | def initialize(self):
"""Initializes the surrogate needed for AVL.
Assumptions:
None
Source:
N/A
Inputs:
None
Outputs:
None
Properties Used:
self.geometry
"""
super(AVL, self).initialize()
# unpack
... | [
"def",
"initialize",
"(",
"self",
")",
":",
"super",
"(",
"AVL",
",",
"self",
")",
".",
"initialize",
"(",
")",
"# unpack",
"sv",
"=",
"self",
".",
"settings",
".",
"number_spanwise_vortices",
"cv",
"=",
"self",
".",
"settings",
".",
"number_chordwise_vort... | https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Analyses/Aerodynamics/AVL.py#L113-L148 | ||
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | alembic/versions/11470abae0d6_add_key_notify_to_issue_keys.py | python | downgrade | () | Remove the key_notify column. | Remove the key_notify column. | [
"Remove",
"the",
"key_notify",
"column",
"."
] | def downgrade():
''' Remove the key_notify column.
'''
op.drop_column('issue_keys', 'key_notify') | [
"def",
"downgrade",
"(",
")",
":",
"op",
".",
"drop_column",
"(",
"'issue_keys'",
",",
"'key_notify'",
")"
] | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/alembic/versions/11470abae0d6_add_key_notify_to_issue_keys.py#L33-L36 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/db/models/query_utils.py | python | DeferredAttribute.__set__ | (self, instance, value) | Deferred loading attributes can be set normally (which means there will
never be a database lookup involved. | Deferred loading attributes can be set normally (which means there will
never be a database lookup involved. | [
"Deferred",
"loading",
"attributes",
"can",
"be",
"set",
"normally",
"(",
"which",
"means",
"there",
"will",
"never",
"be",
"a",
"database",
"lookup",
"involved",
"."
] | def __set__(self, instance, value):
"""
Deferred loading attributes can be set normally (which means there will
never be a database lookup involved.
"""
instance.__dict__[self.field_name] = value | [
"def",
"__set__",
"(",
"self",
",",
"instance",
",",
"value",
")",
":",
"instance",
".",
"__dict__",
"[",
"self",
".",
"field_name",
"]",
"=",
"value"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/db/models/query_utils.py#L120-L125 | ||
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/IPy.py | python | IPint.strCompressed | (self, wantprefixlen = None) | Return a string representation in compressed format using '::' Notation.
>>> IP('127.0.0.1').strCompressed()
'127.0.0.1'
>>> IP('2001:0658:022a:cafe:0200::1').strCompressed()
'2001:658:22a:cafe:200::1'
>>> IP('ffff:ffff:ffff:ffff:ffff:f:f:fffc/127').strCompressed()
'ffff... | Return a string representation in compressed format using '::' Notation. | [
"Return",
"a",
"string",
"representation",
"in",
"compressed",
"format",
"using",
"::",
"Notation",
"."
] | def strCompressed(self, wantprefixlen = None):
"""Return a string representation in compressed format using '::' Notation.
>>> IP('127.0.0.1').strCompressed()
'127.0.0.1'
>>> IP('2001:0658:022a:cafe:0200::1').strCompressed()
'2001:658:22a:cafe:200::1'
>>> IP('ffff:ffff:f... | [
"def",
"strCompressed",
"(",
"self",
",",
"wantprefixlen",
"=",
"None",
")",
":",
"if",
"self",
".",
"WantPrefixLen",
"==",
"None",
"and",
"wantprefixlen",
"==",
"None",
":",
"wantprefixlen",
"=",
"1",
"if",
"self",
".",
"_ipversion",
"==",
"4",
":",
"re... | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/IPy.py#L362-L405 | ||
MIC-DKFZ/nnUNet | cd9cb633e14e5d27aec43ea21c958449437c99b2 | nnunet/training/network_training/nnUNetTrainerV2.py | python | nnUNetTrainerV2.on_epoch_end | (self) | return continue_training | overwrite patient-based early stopping. Always run to 1000 epochs
:return: | overwrite patient-based early stopping. Always run to 1000 epochs
:return: | [
"overwrite",
"patient",
"-",
"based",
"early",
"stopping",
".",
"Always",
"run",
"to",
"1000",
"epochs",
":",
"return",
":"
] | def on_epoch_end(self):
"""
overwrite patient-based early stopping. Always run to 1000 epochs
:return:
"""
super().on_epoch_end()
continue_training = self.epoch < self.max_num_epochs
# it can rarely happen that the momentum of nnUNetTrainerV2 is too high for some... | [
"def",
"on_epoch_end",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"on_epoch_end",
"(",
")",
"continue_training",
"=",
"self",
".",
"epoch",
"<",
"self",
".",
"max_num_epochs",
"# it can rarely happen that the momentum of nnUNetTrainerV2 is too high for some dataset. I... | https://github.com/MIC-DKFZ/nnUNet/blob/cd9cb633e14e5d27aec43ea21c958449437c99b2/nnunet/training/network_training/nnUNetTrainerV2.py#L408-L426 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/elasticsearch/client/cat.py | python | CatClient.indices | (self, index=None, params=None) | return data | The indices command provides a cross-section of each index.
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-indices.html>`_
:arg index: A comma-separated list of index names to limit the returned
information
:arg bytes: The unit in which to display byte va... | The indices command provides a cross-section of each index.
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-indices.html>`_ | [
"The",
"indices",
"command",
"provides",
"a",
"cross",
"-",
"section",
"of",
"each",
"index",
".",
"<http",
":",
"//",
"www",
".",
"elasticsearch",
".",
"org",
"/",
"guide",
"/",
"en",
"/",
"elasticsearch",
"/",
"reference",
"/",
"master",
"/",
"cat",
... | def indices(self, index=None, params=None):
"""
The indices command provides a cross-section of each index.
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-indices.html>`_
:arg index: A comma-separated list of index names to limit the returned
info... | [
"def",
"indices",
"(",
"self",
",",
"index",
"=",
"None",
",",
"params",
"=",
"None",
")",
":",
"_",
",",
"data",
"=",
"self",
".",
"transport",
".",
"perform_request",
"(",
"'GET'",
",",
"_make_path",
"(",
"'_cat'",
",",
"'indices'",
",",
"index",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/elasticsearch/client/cat.py#L97-L117 | |
Yinzo/SmartQQBot | 450ebcaecabdcd8a14532d22ac109bc9f6c75c9b | src/smart_qq_plugins/tucao.py | python | TucaoCore.load | (self, group_id) | :type group_id: int, 用于读取指定群的吐槽存档 | :type group_id: int, 用于读取指定群的吐槽存档 | [
":",
"type",
"group_id",
":",
"int",
"用于读取指定群的吐槽存档"
] | def load(self, group_id):
"""
:type group_id: int, 用于读取指定群的吐槽存档
"""
global TUCAO_PATH
if str(group_id) in set(self.tucao_dict.keys()):
return
tucao_file_path = TUCAO_PATH + str(group_id) + ".tucao"
if not os.path.isdir(TUCAO_PATH):
os.make... | [
"def",
"load",
"(",
"self",
",",
"group_id",
")",
":",
"global",
"TUCAO_PATH",
"if",
"str",
"(",
"group_id",
")",
"in",
"set",
"(",
"self",
".",
"tucao_dict",
".",
"keys",
"(",
")",
")",
":",
"return",
"tucao_file_path",
"=",
"TUCAO_PATH",
"+",
"str",
... | https://github.com/Yinzo/SmartQQBot/blob/450ebcaecabdcd8a14532d22ac109bc9f6c75c9b/src/smart_qq_plugins/tucao.py#L36-L56 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/polynomial/laurent_polynomial_ring.py | python | LaurentPolynomialRing_univariate._repr_ | (self) | return "Univariate Laurent Polynomial Ring in %s over %s"%(self._R.variable_name(), self._R.base_ring()) | TESTS::
sage: LaurentPolynomialRing(QQ,'x') # indirect doctest
Univariate Laurent Polynomial Ring in x over Rational Field | TESTS:: | [
"TESTS",
"::"
] | def _repr_(self):
"""
TESTS::
sage: LaurentPolynomialRing(QQ,'x') # indirect doctest
Univariate Laurent Polynomial Ring in x over Rational Field
"""
return "Univariate Laurent Polynomial Ring in %s over %s"%(self._R.variable_name(), self._R.base_ring()) | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"\"Univariate Laurent Polynomial Ring in %s over %s\"",
"%",
"(",
"self",
".",
"_R",
".",
"variable_name",
"(",
")",
",",
"self",
".",
"_R",
".",
"base_ring",
"(",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/laurent_polynomial_ring.py#L900-L907 | |
tslearn-team/tslearn | 6c93071b385a89112b82799ae5870daeca1ab88b | tslearn/clustering/kmeans.py | python | _k_init_metric | (X, n_clusters, cdist_metric, random_state,
n_local_trials=None) | return centers | Init n_clusters seeds according to k-means++ with a custom distance
metric.
Parameters
----------
X : array, shape (n_samples, n_timestamps, n_features)
The data to pick seeds for.
n_clusters : integer
The number of seeds to choose
cdist_metric : function
Function to b... | Init n_clusters seeds according to k-means++ with a custom distance
metric. | [
"Init",
"n_clusters",
"seeds",
"according",
"to",
"k",
"-",
"means",
"++",
"with",
"a",
"custom",
"distance",
"metric",
"."
] | def _k_init_metric(X, n_clusters, cdist_metric, random_state,
n_local_trials=None):
"""Init n_clusters seeds according to k-means++ with a custom distance
metric.
Parameters
----------
X : array, shape (n_samples, n_timestamps, n_features)
The data to pick seeds for.
... | [
"def",
"_k_init_metric",
"(",
"X",
",",
"n_clusters",
",",
"cdist_metric",
",",
"random_state",
",",
"n_local_trials",
"=",
"None",
")",
":",
"n_samples",
",",
"n_timestamps",
",",
"n_features",
"=",
"X",
".",
"shape",
"centers",
"=",
"numpy",
".",
"empty",
... | https://github.com/tslearn-team/tslearn/blob/6c93071b385a89112b82799ae5870daeca1ab88b/tslearn/clustering/kmeans.py#L50-L133 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/Phylo/PhyloXML.py | python | Events.__iter__ | (self) | return iter(self.keys()) | Iterate over the keys present in a Events dict. | Iterate over the keys present in a Events dict. | [
"Iterate",
"over",
"the",
"keys",
"present",
"in",
"a",
"Events",
"dict",
"."
] | def __iter__(self):
"""Iterate over the keys present in a Events dict."""
return iter(self.keys()) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"keys",
"(",
")",
")"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Phylo/PhyloXML.py#L919-L921 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/dicttoxml.py | python | convert_none | (key, val, attr_type, attr={}) | return '<%s%s></%s>' % (key, attrstring, key) | Converts a null value into an XML element | Converts a null value into an XML element | [
"Converts",
"a",
"null",
"value",
"into",
"an",
"XML",
"element"
] | def convert_none(key, val, attr_type, attr={}):
"""Converts a null value into an XML element"""
LOG.info('Inside convert_none(): key="%s"' % (unicode_me(key)))
key, attr = make_valid_xml_name(key, attr)
if attr_type:
attr['type'] = get_xml_type(val)
attrstring = make_attrstring(attr)
r... | [
"def",
"convert_none",
"(",
"key",
",",
"val",
",",
"attr_type",
",",
"attr",
"=",
"{",
"}",
")",
":",
"LOG",
".",
"info",
"(",
"'Inside convert_none(): key=\"%s\"'",
"%",
"(",
"unicode_me",
"(",
"key",
")",
")",
")",
"key",
",",
"attr",
"=",
"make_val... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/dicttoxml.py#L247-L256 | |
Accenture/AmpliGraph | 97a0bb6b6b74531cb4e2f71fc6c5a8b18a445cfa | ampligraph/datasets/sqlite_adapter.py | python | SQLiteAdapter.get_db_name | (self) | return self.dbname | Returns the db name | Returns the db name | [
"Returns",
"the",
"db",
"name"
] | def get_db_name(self):
"""Returns the db name
"""
return self.dbname | [
"def",
"get_db_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"dbname"
] | https://github.com/Accenture/AmpliGraph/blob/97a0bb6b6b74531cb4e2f71fc6c5a8b18a445cfa/ampligraph/datasets/sqlite_adapter.py#L52-L55 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/hmac.py | python | HMAC.update | (self, msg) | Update this hashing object with the string msg. | Update this hashing object with the string msg. | [
"Update",
"this",
"hashing",
"object",
"with",
"the",
"string",
"msg",
"."
] | def update(self, msg):
"""Update this hashing object with the string msg.
"""
self.inner.update(msg) | [
"def",
"update",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"inner",
".",
"update",
"(",
"msg",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/hmac.py#L83-L86 | ||
ni/nidaqmx-python | 62fc6b48cbbb330fe1bcc9aedadc86610a1269b6 | nidaqmx/_task_modules/channels/di_channel.py | python | DIChannel.di_usb_xfer_req_count | (self, val) | [] | def di_usb_xfer_req_count(self, val):
cfunc = lib_importer.windll.DAQmxSetDIUsbXferReqCount
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str,
... | [
"def",
"di_usb_xfer_req_count",
"(",
"self",
",",
"val",
")",
":",
"cfunc",
"=",
"lib_importer",
".",
"windll",
".",
"DAQmxSetDIUsbXferReqCount",
"if",
"cfunc",
".",
"argtypes",
"is",
"None",
":",
"with",
"cfunc",
".",
"arglock",
":",
"if",
"cfunc",
".",
"... | https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/di_channel.py#L746-L757 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/qtconsole/qtconsoleapp.py | python | JupyterQtConsoleApp.new_frontend_connection | (self, connection_file) | return widget | Create and return a new frontend attached to an existing kernel.
Parameters
----------
connection_file : str
The connection_file path this frontend is to connect to | Create and return a new frontend attached to an existing kernel. | [
"Create",
"and",
"return",
"a",
"new",
"frontend",
"attached",
"to",
"an",
"existing",
"kernel",
"."
] | def new_frontend_connection(self, connection_file):
"""Create and return a new frontend attached to an existing kernel.
Parameters
----------
connection_file : str
The connection_file path this frontend is to connect to
"""
kernel_client = self.kernel_client_... | [
"def",
"new_frontend_connection",
"(",
"self",
",",
"connection_file",
")",
":",
"kernel_client",
"=",
"self",
".",
"kernel_client_class",
"(",
"connection_file",
"=",
"connection_file",
",",
"config",
"=",
"self",
".",
"config",
",",
")",
"kernel_client",
".",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/qtconsole/qtconsoleapp.py#L209-L232 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/SearchKippt/alp/request/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.__reversed__ | (self) | od.__reversed__() <==> reversed(od) | od.__reversed__() <==> reversed(od) | [
"od",
".",
"__reversed__",
"()",
"<",
"==",
">",
"reversed",
"(",
"od",
")"
] | def __reversed__(self):
'od.__reversed__() <==> reversed(od)'
root = self.__root
curr = root[0]
while curr is not root:
yield curr[2]
curr = curr[0] | [
"def",
"__reversed__",
"(",
"self",
")",
":",
"root",
"=",
"self",
".",
"__root",
"curr",
"=",
"root",
"[",
"0",
"]",
"while",
"curr",
"is",
"not",
"root",
":",
"yield",
"curr",
"[",
"2",
"]",
"curr",
"=",
"curr",
"[",
"0",
"]"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/requests/packages/urllib3/packages/ordered_dict.py#L72-L78 | ||
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/quota.py | python | QuotaEngine.get_defaults | (self, context) | return self._driver.get_defaults(context, self._resources) | Retrieve the default quotas.
:param context: The request context, for access checks. | Retrieve the default quotas. | [
"Retrieve",
"the",
"default",
"quotas",
"."
] | def get_defaults(self, context):
"""Retrieve the default quotas.
:param context: The request context, for access checks.
"""
return self._driver.get_defaults(context, self._resources) | [
"def",
"get_defaults",
"(",
"self",
",",
"context",
")",
":",
"return",
"self",
".",
"_driver",
".",
"get_defaults",
"(",
"context",
",",
"self",
".",
"_resources",
")"
] | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/quota.py#L881-L887 | |
AllenInstitute/bmtk | 9c02811a4e1e8695c25de658301d9477bb289298 | bmtk/builder/network_builder.py | python | NetworkBuilder.__getattr__ | (self, item) | return getattr(self.adaptor, item) | Catch-all for adaptor attributes | Catch-all for adaptor attributes | [
"Catch",
"-",
"all",
"for",
"adaptor",
"attributes"
] | def __getattr__(self, item):
"""Catch-all for adaptor attributes"""
return getattr(self.adaptor, item) | [
"def",
"__getattr__",
"(",
"self",
",",
"item",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"adaptor",
",",
"item",
")"
] | https://github.com/AllenInstitute/bmtk/blob/9c02811a4e1e8695c25de658301d9477bb289298/bmtk/builder/network_builder.py#L353-L355 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/accounts/errors.py | python | UserQueryError.__init__ | (self, msg) | Initialize the error.
Args:
msg (unicode):
The error message to display. | Initialize the error. | [
"Initialize",
"the",
"error",
"."
] | def __init__(self, msg):
"""Initialize the error.
Args:
msg (unicode):
The error message to display.
"""
super(Exception, self).__init__(
'Error while populating users from the auth backend: %s'
% msg) | [
"def",
"__init__",
"(",
"self",
",",
"msg",
")",
":",
"super",
"(",
"Exception",
",",
"self",
")",
".",
"__init__",
"(",
"'Error while populating users from the auth backend: %s'",
"%",
"msg",
")"
] | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/accounts/errors.py#L13-L22 | ||
Pattio/DeepSwarm | a0e85ff296c2496a2a46e017a05bbd3980b4150b | deepswarm/storage.py | python | Storage.record_model_performance | (self, path_hash, cost) | Records how many times the model cost didn't improve.
Args:
path_hash: hash value associated with the model.
cost: cost value associated with the model. | Records how many times the model cost didn't improve. | [
"Records",
"how",
"many",
"times",
"the",
"model",
"cost",
"didn",
"t",
"improve",
"."
] | def record_model_performance(self, path_hash, cost):
"""Records how many times the model cost didn't improve.
Args:
path_hash: hash value associated with the model.
cost: cost value associated with the model.
"""
model_hash = self.path_lookup.get(path_hash)
... | [
"def",
"record_model_performance",
"(",
"self",
",",
"path_hash",
",",
"cost",
")",
":",
"model_hash",
"=",
"self",
".",
"path_lookup",
".",
"get",
"(",
"path_hash",
")",
"old_cost",
",",
"no_improvements",
"=",
"self",
".",
"models",
".",
"get",
"(",
"mod... | https://github.com/Pattio/DeepSwarm/blob/a0e85ff296c2496a2a46e017a05bbd3980b4150b/deepswarm/storage.py#L170-L183 | ||
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/vieweditor/vieweditorshape.py | python | EditPointShape.get_edit_point | (self, p, view_scale=1.0) | return None | [] | def get_edit_point(self, p, view_scale=1.0):
for ep in self.edit_points:
if ep.hit(p, view_scale) == True:
return ep
return None | [
"def",
"get_edit_point",
"(",
"self",
",",
"p",
",",
"view_scale",
"=",
"1.0",
")",
":",
"for",
"ep",
"in",
"self",
".",
"edit_points",
":",
"if",
"ep",
".",
"hit",
"(",
"p",
",",
"view_scale",
")",
"==",
"True",
":",
"return",
"ep",
"return",
"Non... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/vieweditor/vieweditorshape.py#L190-L194 | |||
Emptyset110/dHydra | 8ec44994ff4dda8bf1ec40e38dd068b757945933 | dHydra/core/Controller.py | python | controller | (func) | return _controller | [] | def controller(func):
def _controller(
query_arguments,
body_arguments,
get_query_argument,
get_body_argument
):
result = func(
query_arguments,
body_arguments,
get_query_argument,
get_body_argument
)... | [
"def",
"controller",
"(",
"func",
")",
":",
"def",
"_controller",
"(",
"query_arguments",
",",
"body_arguments",
",",
"get_query_argument",
",",
"get_body_argument",
")",
":",
"result",
"=",
"func",
"(",
"query_arguments",
",",
"body_arguments",
",",
"get_query_ar... | https://github.com/Emptyset110/dHydra/blob/8ec44994ff4dda8bf1ec40e38dd068b757945933/dHydra/core/Controller.py#L4-L18 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/gui/frames.py | python | MainFrame.updateProgressBar | (self, x, y) | @type x: Integer
@param x: Number of fuzz cases sent so far
@type y: Integer
@param y: Total number of fuzz cases | [] | def updateProgressBar(self, x, y):
'''
@type x: Integer
@param x: Number of fuzz cases sent so far
@type y: Integer
@param y: Total number of fuzz cases
'''
self.testsSentTxtCtrl.SetLabel(" Sent %d/%d test cases" % (x, y))
val = float(x)/float(y) ... | [
"def",
"updateProgressBar",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"self",
".",
"testsSentTxtCtrl",
".",
"SetLabel",
"(",
"\" Sent %d/%d test cases\"",
"%",
"(",
"x",
",",
"y",
")",
")",
"val",
"=",
"float",
"(",
"x",
")",
"/",
"float",
"(",
"y",... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/gui/frames.py#L440-L450 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.