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
DasIch/brownie
8e29a9ceb50622e50b7209690d31203ad42ca164
brownie/terminal/__init__.py
python
TerminalWriter.options
(self, text_colour=None, background_colour=None, bold=None, faint=None, standout=None, underline=None, blink=None, indentation=False, escape=None)
A contextmanager which allows you to set certain options for the following writes. :param text_colour: The desired text colour. :param background_colour: The desired background colour. :param bold: If present the text is displayed bold. :pa...
A contextmanager which allows you to set certain options for the following writes.
[ "A", "contextmanager", "which", "allows", "you", "to", "set", "certain", "options", "for", "the", "following", "writes", "." ]
def options(self, text_colour=None, background_colour=None, bold=None, faint=None, standout=None, underline=None, blink=None, indentation=False, escape=None): """ A contextmanager which allows you to set certain options for the following writes. :param te...
[ "def", "options", "(", "self", ",", "text_colour", "=", "None", ",", "background_colour", "=", "None", ",", "bold", "=", "None", ",", "faint", "=", "None", ",", "standout", "=", "None", ",", "underline", "=", "None", ",", "blink", "=", "None", ",", "...
https://github.com/DasIch/brownie/blob/8e29a9ceb50622e50b7209690d31203ad42ca164/brownie/terminal/__init__.py#L236-L320
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/jinja2/filters.py
python
do_lower
(s)
return soft_unicode(s).lower()
Convert a value to lowercase.
Convert a value to lowercase.
[ "Convert", "a", "value", "to", "lowercase", "." ]
def do_lower(s): """Convert a value to lowercase.""" return soft_unicode(s).lower()
[ "def", "do_lower", "(", "s", ")", ":", "return", "soft_unicode", "(", "s", ")", ".", "lower", "(", ")" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/jinja2/filters.py#L106-L108
pydata/xarray
9226c7ac87b3eb246f7a7e49f8f0f23d68951624
xarray/core/formatting.py
python
pretty_print
(x, numchars: int)
return s + " " * max(numchars - len(s), 0)
Given an object `x`, call `str(x)` and format the returned string so that it is numchars long, padding with trailing spaces or truncating with ellipses as necessary
Given an object `x`, call `str(x)` and format the returned string so that it is numchars long, padding with trailing spaces or truncating with ellipses as necessary
[ "Given", "an", "object", "x", "call", "str", "(", "x", ")", "and", "format", "the", "returned", "string", "so", "that", "it", "is", "numchars", "long", "padding", "with", "trailing", "spaces", "or", "truncating", "with", "ellipses", "as", "necessary" ]
def pretty_print(x, numchars: int): """Given an object `x`, call `str(x)` and format the returned string so that it is numchars long, padding with trailing spaces or truncating with ellipses as necessary """ s = maybe_truncate(x, numchars) return s + " " * max(numchars - len(s), 0)
[ "def", "pretty_print", "(", "x", ",", "numchars", ":", "int", ")", ":", "s", "=", "maybe_truncate", "(", "x", ",", "numchars", ")", "return", "s", "+", "\" \"", "*", "max", "(", "numchars", "-", "len", "(", "s", ")", ",", "0", ")" ]
https://github.com/pydata/xarray/blob/9226c7ac87b3eb246f7a7e49f8f0f23d68951624/xarray/core/formatting.py#L20-L26
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_internal/vcs/git.py
python
Git.is_commit_id_equal
(cls, dest: str, name: Optional[str])
return cls.get_revision(dest) == name
Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name.
Return whether the current commit hash equals the given name.
[ "Return", "whether", "the", "current", "commit", "hash", "equals", "the", "given", "name", "." ]
def is_commit_id_equal(cls, dest: str, name: Optional[str]) -> bool: """ Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. """ if not name: # Then avoid an unnecessary subproce...
[ "def", "is_commit_id_equal", "(", "cls", ",", "dest", ":", "str", ",", "name", ":", "Optional", "[", "str", "]", ")", "->", "bool", ":", "if", "not", "name", ":", "# Then avoid an unnecessary subprocess call.", "return", "False", "return", "cls", ".", "get_r...
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_internal/vcs/git.py#L242-L254
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/visualize/owscatterplot.py
python
OWScatterPlot._add_controls
(self)
[]
def _add_controls(self): self._add_controls_axis() self._add_controls_sampling() super()._add_controls() self.gui.add_widget(self.gui.JitterNumericValues, self._effects_box) self.gui.add_widgets( [self.gui.ShowGridLines, self.gui.ToolTipShowsAll, ...
[ "def", "_add_controls", "(", "self", ")", ":", "self", ".", "_add_controls_axis", "(", ")", "self", ".", "_add_controls_sampling", "(", ")", "super", "(", ")", ".", "_add_controls", "(", ")", "self", ".", "gui", ".", "add_widget", "(", "self", ".", "gui"...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owscatterplot.py#L373-L391
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/matrices/common.py
python
MatrixProperties.is_upper
(self)
return all(self[i, j].is_zero for i in range(1, self.rows) for j in range(min(i, self.cols)))
Check if matrix is an upper triangular matrix. True can be returned even if the matrix is not square. Examples ======== >>> from sympy import Matrix >>> m = Matrix(2, 2, [1, 0, 0, 1]) >>> m Matrix([ [1, 0], [0, 1]]) >>> m.is_upper ...
Check if matrix is an upper triangular matrix. True can be returned even if the matrix is not square.
[ "Check", "if", "matrix", "is", "an", "upper", "triangular", "matrix", ".", "True", "can", "be", "returned", "even", "if", "the", "matrix", "is", "not", "square", "." ]
def is_upper(self): """Check if matrix is an upper triangular matrix. True can be returned even if the matrix is not square. Examples ======== >>> from sympy import Matrix >>> m = Matrix(2, 2, [1, 0, 0, 1]) >>> m Matrix([ [1, 0], [0, 1]])...
[ "def", "is_upper", "(", "self", ")", ":", "return", "all", "(", "self", "[", "i", ",", "j", "]", ".", "is_zero", "for", "i", "in", "range", "(", "1", ",", "self", ".", "rows", ")", "for", "j", "in", "range", "(", "min", "(", "i", ",", "self",...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/matrices/common.py#L1896-L1939
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/leo_babel/babel_lib.py
python
otpUnquote
(otp)
return otp
Remove all otp-quoting from a string @param otp: Otp-quoted outline path @param return: Unquoted outline path
Remove all otp-quoting from a string
[ "Remove", "all", "otp", "-", "quoting", "from", "a", "string" ]
def otpUnquote(otp): """ Remove all otp-quoting from a string @param otp: Otp-quoted outline path @param return: Unquoted outline path """ if otp: for un, qu in quoteList: otp = otp.replace(qu, un) return otp
[ "def", "otpUnquote", "(", "otp", ")", ":", "if", "otp", ":", "for", "un", ",", "qu", "in", "quoteList", ":", "otp", "=", "otp", ".", "replace", "(", "qu", ",", "un", ")", "return", "otp" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/leo_babel/babel_lib.py#L102-L114
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/linux/cffi/api.py
python
FFI.from_buffer
(self, python_buffer)
return self._backend.from_buffer(self.BCharA, python_buffer)
Return a <cdata 'char[]'> that points to the data of the given Python object, which must support the buffer interface. Note that this is not meant to be used on the built-in types str, unicode, or bytearray (you can build 'char[]' arrays explicitly) but only on objects containing large q...
Return a <cdata 'char[]'> that points to the data of the given Python object, which must support the buffer interface. Note that this is not meant to be used on the built-in types str, unicode, or bytearray (you can build 'char[]' arrays explicitly) but only on objects containing large q...
[ "Return", "a", "<cdata", "char", "[]", ">", "that", "points", "to", "the", "data", "of", "the", "given", "Python", "object", "which", "must", "support", "the", "buffer", "interface", ".", "Note", "that", "this", "is", "not", "meant", "to", "be", "used", ...
def from_buffer(self, python_buffer): """Return a <cdata 'char[]'> that points to the data of the given Python object, which must support the buffer interface. Note that this is not meant to be used on the built-in types str, unicode, or bytearray (you can build 'char[]' arrays explicitl...
[ "def", "from_buffer", "(", "self", ",", "python_buffer", ")", ":", "return", "self", ".", "_backend", ".", "from_buffer", "(", "self", ".", "BCharA", ",", "python_buffer", ")" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/linux/cffi/api.py#L306-L314
opendevops-cn/codo-cmdb
334fba324512841d84535f31a094717eb5a40acf
libs/server/push_system_user.py
python
PushSystemUser.create_system_user
(self)
Ansible API创建系统用户 :return:
Ansible API创建系统用户 :return:
[ "Ansible", "API创建系统用户", ":", "return", ":" ]
def create_system_user(self): """ Ansible API创建系统用户 :return: """ system_user_list = self.get_system_user() connect_server_list = self.get_asset_info() # print(connect_server_list) # connect_server_list = [('172.16.0.93', 22, 'yanghongfei'), ('172.16.0.219'...
[ "def", "create_system_user", "(", "self", ")", ":", "system_user_list", "=", "self", ".", "get_system_user", "(", ")", "connect_server_list", "=", "self", ".", "get_asset_info", "(", ")", "# print(connect_server_list)", "# connect_server_list = [('172.16.0.93', 22, 'yanghon...
https://github.com/opendevops-cn/codo-cmdb/blob/334fba324512841d84535f31a094717eb5a40acf/libs/server/push_system_user.py#L91-L124
luanfonceca/speakerfight
c9350d84664ac3bad83dd661a2c5d55d1b8cbf5b
deck/templatetags/deck_tags.py
python
is_user_in_jury
(event, user)
return event.jury.users.filter(pk=user.pk).exists()
[]
def is_user_in_jury(event, user): if isinstance(user, AnonymousUser): return False return event.jury.users.filter(pk=user.pk).exists()
[ "def", "is_user_in_jury", "(", "event", ",", "user", ")", ":", "if", "isinstance", "(", "user", ",", "AnonymousUser", ")", ":", "return", "False", "return", "event", ".", "jury", ".", "users", ".", "filter", "(", "pk", "=", "user", ".", "pk", ")", "....
https://github.com/luanfonceca/speakerfight/blob/c9350d84664ac3bad83dd661a2c5d55d1b8cbf5b/deck/templatetags/deck_tags.py#L49-L52
googledatalab/pydatalab
1c86e26a0d24e3bc8097895ddeab4d0607be4c40
datalab/storage/_item.py
python
Item.key
(self)
return self._key
Returns the key of the item.
Returns the key of the item.
[ "Returns", "the", "key", "of", "the", "item", "." ]
def key(self): """Returns the key of the item.""" return self._key
[ "def", "key", "(", "self", ")", ":", "return", "self", ".", "_key" ]
https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/datalab/storage/_item.py#L96-L98
bwbaugh/causeofwhy
4791d29d539da68f20c338a0f7a2a3878c754b54
causeofwhy/indexer.py
python
Index.union
(self, terms)
return pages
Returns set of Page.IDs that contain any term in the term list.
Returns set of Page.IDs that contain any term in the term list.
[ "Returns", "set", "of", "Page", ".", "IDs", "that", "contain", "any", "term", "in", "the", "term", "list", "." ]
def union(self, terms): """Returns set of Page.IDs that contain any term in the term list.""" terms = list(terms) try: # Check that each term is a number (token-ID). _ = [x + 1 for x in terms] except TypeError: # They're not numbers, so we need to conv...
[ "def", "union", "(", "self", ",", "terms", ")", ":", "terms", "=", "list", "(", "terms", ")", "try", ":", "# Check that each term is a number (token-ID).", "_", "=", "[", "x", "+", "1", "for", "x", "in", "terms", "]", "except", "TypeError", ":", "# They'...
https://github.com/bwbaugh/causeofwhy/blob/4791d29d539da68f20c338a0f7a2a3878c754b54/causeofwhy/indexer.py#L212-L230
eliben/code-for-blog
06d6887eccd84ca5703b792a85ab6c1ebfc5393e
2009/py_rd_parser_example/rd_parser_infix_expr.py
python
CalcParser.calc
(self, line)
return val
Parse a new line of input and return its result. Variables defined in previous calls to calc can be used in following ones. ParseError can be raised in case of errors.
Parse a new line of input and return its result.
[ "Parse", "a", "new", "line", "of", "input", "and", "return", "its", "result", "." ]
def calc(self, line): """ Parse a new line of input and return its result. Variables defined in previous calls to calc can be used in following ones. ParseError can be raised in case of errors. """ self.lexer.input(line) self._get_next_token() ...
[ "def", "calc", "(", "self", ",", "line", ")", ":", "self", ".", "lexer", ".", "input", "(", "line", ")", "self", ".", "_get_next_token", "(", ")", "val", "=", "self", ".", "_stmt", "(", ")", "if", "self", ".", "cur_token", ".", "type", "!=", "Non...
https://github.com/eliben/code-for-blog/blob/06d6887eccd84ca5703b792a85ab6c1ebfc5393e/2009/py_rd_parser_example/rd_parser_infix_expr.py#L66-L83
lozuwa/impy
ddfaedf764c1cb2ced7f644a3a065715758874a5
impy/AugmentationConfigurationFile.py
python
AugmentationConfigurationFile.isGeometricConfFile
(self, keys = None)
Check if file is a bounding box configuration file. Args: keys: A list of strings. Returns: A boolean that is true if the conf file is geomtric.
Check if file is a bounding box configuration file. Args: keys: A list of strings. Returns: A boolean that is true if the conf file is geomtric.
[ "Check", "if", "file", "is", "a", "bounding", "box", "configuration", "file", ".", "Args", ":", "keys", ":", "A", "list", "of", "strings", ".", "Returns", ":", "A", "boolean", "that", "is", "true", "if", "the", "conf", "file", "is", "geomtric", "." ]
def isGeometricConfFile(self, keys = None): """ Check if file is a bounding box configuration file. Args: keys: A list of strings. Returns: A boolean that is true if the conf file is geomtric. """ # Assertions if (keys == None): raise ValueError("ERROR: Keys parameter cannot be empty.") if (typ...
[ "def", "isGeometricConfFile", "(", "self", ",", "keys", "=", "None", ")", ":", "# Assertions", "if", "(", "keys", "==", "None", ")", ":", "raise", "ValueError", "(", "\"ERROR: Keys parameter cannot be empty.\"", ")", "if", "(", "type", "(", "keys", ")", "!="...
https://github.com/lozuwa/impy/blob/ddfaedf764c1cb2ced7f644a3a065715758874a5/impy/AugmentationConfigurationFile.py#L273-L292
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
lms/djangoapps/program_enrollments/rest_api/v1/utils.py
python
verify_course_exists_and_in_program
(view_func)
return wrapped_function
Raises: An api error if the course run specified by the `course_id` kwarg in the wrapped function is not part of the curriculum of the program specified by the `program_uuid` kwarg This decorator guarantees existance of the program and course, so wrapping alongside `verify_{program,cour...
Raises: An api error if the course run specified by the `course_id` kwarg in the wrapped function is not part of the curriculum of the program specified by the `program_uuid` kwarg
[ "Raises", ":", "An", "api", "error", "if", "the", "course", "run", "specified", "by", "the", "course_id", "kwarg", "in", "the", "wrapped", "function", "is", "not", "part", "of", "the", "curriculum", "of", "the", "program", "specified", "by", "the", "progra...
def verify_course_exists_and_in_program(view_func): """ Raises: An api error if the course run specified by the `course_id` kwarg in the wrapped function is not part of the curriculum of the program specified by the `program_uuid` kwarg This decorator guarantees existance of the pro...
[ "def", "verify_course_exists_and_in_program", "(", "view_func", ")", ":", "@", "wraps", "(", "view_func", ")", "@", "verify_program_exists", "@", "verify_course_exists", "(", ")", "def", "wrapped_function", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs",...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/program_enrollments/rest_api/v1/utils.py#L145-L171
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/contrib/rpsystem.py
python
ContribRPObject.search
( self, searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref=None, ...
return _AT_SEARCH_RESULT( results, self, query=searchdata, nofound_string=nofound_string, multimatch_string=multimatch_string, )
Returns an Object matching a search string/condition, taking sdescs into account. Perform a standard object search in the database, handling multiple results and lack thereof gracefully. By default, only objects in the current `location` of `self` or its inventory are searched for. ...
Returns an Object matching a search string/condition, taking sdescs into account.
[ "Returns", "an", "Object", "matching", "a", "search", "string", "/", "condition", "taking", "sdescs", "into", "account", "." ]
def search( self, searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref...
[ "def", "search", "(", "self", ",", "searchdata", ",", "global_search", "=", "False", ",", "use_nicks", "=", "True", ",", "typeclass", "=", "None", ",", "location", "=", "None", ",", "attribute_name", "=", "None", ",", "quiet", "=", "False", ",", "exact",...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/rpsystem.py#L1245-L1415
stoq/stoq
c26991644d1affcf96bc2e0a0434796cabdf8448
stoq/lib/status.py
python
ResourceStatusManager.refresh_and_notify
(self, force=False)
return self._refresh_and_notify(force=force)
Refresh the status and notify for changes
Refresh the status and notify for changes
[ "Refresh", "the", "status", "and", "notify", "for", "changes" ]
def refresh_and_notify(self, force=False): """Refresh the status and notify for changes""" # Do not run checks if we are running tests. It breaks the whole suite if os.environ.get('STOQ_TESTSUIT_RUNNING', '0') == '1': return False return self._refresh_and_notify(force=force)
[ "def", "refresh_and_notify", "(", "self", ",", "force", "=", "False", ")", ":", "# Do not run checks if we are running tests. It breaks the whole suite", "if", "os", ".", "environ", ".", "get", "(", "'STOQ_TESTSUIT_RUNNING'", ",", "'0'", ")", "==", "'1'", ":", "retu...
https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoq/lib/status.py#L189-L194
joxeankoret/nightmare
11b22bb7c346611de90f479ee781c9228af453ea
runtime/diff_match_patch.py
python
diff_match_patch.diff_commonOverlap
(self, text1, text2)
Determine if the suffix of one string is the prefix of another. Args: text1 First string. text2 Second string. Returns: The number of characters common to the end of the first string and the start of the second string.
Determine if the suffix of one string is the prefix of another.
[ "Determine", "if", "the", "suffix", "of", "one", "string", "is", "the", "prefix", "of", "another", "." ]
def diff_commonOverlap(self, text1, text2): """Determine if the suffix of one string is the prefix of another. Args: text1 First string. text2 Second string. Returns: The number of characters common to the end of the first string and the start of the second string. """ # Ca...
[ "def", "diff_commonOverlap", "(", "self", ",", "text1", ",", "text2", ")", ":", "# Cache the text lengths to prevent multiple calls.", "text1_length", "=", "len", "(", "text1", ")", "text2_length", "=", "len", "(", "text2", ")", "# Eliminate the null case.", "if", "...
https://github.com/joxeankoret/nightmare/blob/11b22bb7c346611de90f479ee781c9228af453ea/runtime/diff_match_patch.py#L511-L551
Screetsec/BruteSploit
124029d7a4cf35d7017a0f2fa37c8f8e5f32a359
tools/dirsearch/thirdparty/requests/packages/urllib3/fields.py
python
RequestField._render_part
(self, name, value)
return format_header_param(name, value)
Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string.
Overridable helper function to format a single header parameter.
[ "Overridable", "helper", "function", "to", "format", "a", "single", "header", "parameter", "." ]
def _render_part(self, name, value): """ Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string. "...
[ "def", "_render_part", "(", "self", ",", "name", ",", "value", ")", ":", "return", "format_header_param", "(", "name", ",", "value", ")" ]
https://github.com/Screetsec/BruteSploit/blob/124029d7a4cf35d7017a0f2fa37c8f8e5f32a359/tools/dirsearch/thirdparty/requests/packages/urllib3/fields.py#L104-L113
python-gitlab/python-gitlab
4a000b6c41f0a7ef6121c62a4c598edc20973799
gitlab/v4/objects/jobs.py
python
ProjectJob.retry
(self, **kwargs: Any)
return result
Retry the job. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabJobRetryError: If the job could not be retried
Retry the job.
[ "Retry", "the", "job", "." ]
def retry(self, **kwargs: Any) -> Dict[str, Any]: """Retry the job. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabJobRetryError: If the job could not be retried ...
[ "def", "retry", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "path", "=", "f\"{self.manager.path}/{self.get_id()}/retry\"", "result", "=", "self", ".", "manager", ".", "gitlab", ".", "http_post", ...
https://github.com/python-gitlab/python-gitlab/blob/4a000b6c41f0a7ef6121c62a4c598edc20973799/gitlab/v4/objects/jobs.py#L38-L52
Dan-in-CA/SIP
7d08d807d7730bff2b5eaaa57e743665c8b143a6
web/db.py
python
DB.transaction
(self)
return Transaction(self.ctx)
Start a transaction.
Start a transaction.
[ "Start", "a", "transaction", "." ]
def transaction(self): """Start a transaction.""" return Transaction(self.ctx)
[ "def", "transaction", "(", "self", ")", ":", "return", "Transaction", "(", "self", ".", "ctx", ")" ]
https://github.com/Dan-in-CA/SIP/blob/7d08d807d7730bff2b5eaaa57e743665c8b143a6/web/db.py#L1191-L1193
Symbo1/wsltools
0b6e536fc85c707a1c81f0296c4e91ca835396a1
wsltools/utils/faker/providers/__init__.py
python
BaseProvider.random_digit
(self)
return self.generator.random.randint(0, 9)
Returns a random digit/number between 0 and 9.
Returns a random digit/number between 0 and 9.
[ "Returns", "a", "random", "digit", "/", "number", "between", "0", "and", "9", "." ]
def random_digit(self): """ Returns a random digit/number between 0 and 9. """ return self.generator.random.randint(0, 9)
[ "def", "random_digit", "(", "self", ")", ":", "return", "self", ".", "generator", ".", "random", ".", "randint", "(", "0", ",", "9", ")" ]
https://github.com/Symbo1/wsltools/blob/0b6e536fc85c707a1c81f0296c4e91ca835396a1/wsltools/utils/faker/providers/__init__.py#L109-L114
intel/IntelSEAPI
7997a782fd3fa5621e275bd31060f9795564e6ca
runtool/sea_runtool.py
python
bisect_right
(array, value, key=lambda item: item)
return lo
[]
def bisect_right(array, value, key=lambda item: item): #upper_bound, dichotomy, binary search lo = 0 hi = len(array) while lo < hi: mid = (lo + hi) // 2 if value < key(array[mid]): hi = mid else: lo = mid + 1 return lo
[ "def", "bisect_right", "(", "array", ",", "value", ",", "key", "=", "lambda", "item", ":", "item", ")", ":", "#upper_bound, dichotomy, binary search", "lo", "=", "0", "hi", "=", "len", "(", "array", ")", "while", "lo", "<", "hi", ":", "mid", "=", "(", ...
https://github.com/intel/IntelSEAPI/blob/7997a782fd3fa5621e275bd31060f9795564e6ca/runtool/sea_runtool.py#L2378-L2387
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1alpha1_queuing_configuration.py
python
V1alpha1QueuingConfiguration.queues
(self)
return self._queues
Gets the queues of this V1alpha1QueuingConfiguration. # noqa: E501 `queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associate...
Gets the queues of this V1alpha1QueuingConfiguration. # noqa: E501
[ "Gets", "the", "queues", "of", "this", "V1alpha1QueuingConfiguration", ".", "#", "noqa", ":", "E501" ]
def queues(self): """Gets the queues of this V1alpha1QueuingConfiguration. # noqa: E501 `queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the dist...
[ "def", "queues", "(", "self", ")", ":", "return", "self", ".", "_queues" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1alpha1_queuing_configuration.py#L112-L120
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/databases/db.py
python
ClientPathHistory.AddHashEntry
(self, timestamp, hash_entry)
[]
def AddHashEntry(self, timestamp, hash_entry): precondition.AssertType(timestamp, rdfvalue.RDFDatetime) precondition.AssertType(hash_entry, rdf_crypto.Hash) self.hash_entries[timestamp] = hash_entry
[ "def", "AddHashEntry", "(", "self", ",", "timestamp", ",", "hash_entry", ")", ":", "precondition", ".", "AssertType", "(", "timestamp", ",", "rdfvalue", ".", "RDFDatetime", ")", "precondition", ".", "AssertType", "(", "hash_entry", ",", "rdf_crypto", ".", "Has...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/databases/db.py#L551-L554
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/mechanize/_response.py
python
upgrade_response
(response)
return response
Return a copy of response that supports Browser response interface. Browser response interface is that of "seekable responses" (response_seek_wrapper), plus the requirement that responses must be useable after .close() (closeable_response). Accepts responses from both mechanize and urllib2 handlers. ...
Return a copy of response that supports Browser response interface.
[ "Return", "a", "copy", "of", "response", "that", "supports", "Browser", "response", "interface", "." ]
def upgrade_response(response): """Return a copy of response that supports Browser response interface. Browser response interface is that of "seekable responses" (response_seek_wrapper), plus the requirement that responses must be useable after .close() (closeable_response). Accepts responses from...
[ "def", "upgrade_response", "(", "response", ")", ":", "wrapper_class", "=", "get_seek_wrapper_class", "(", "response", ")", "if", "hasattr", "(", "response", ",", "\"closeable_response\"", ")", ":", "if", "not", "hasattr", "(", "response", ",", "\"seek\"", ")", ...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/mechanize/_response.py#L482-L525
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/core/rpcserver.py
python
DelugeRPCProtocol.connectionMade
(self)
This method is called when a new client connects.
This method is called when a new client connects.
[ "This", "method", "is", "called", "when", "a", "new", "client", "connects", "." ]
def connectionMade(self): # NOQA: N802 """ This method is called when a new client connects. """ peer = self.transport.getPeer() log.info('Deluge Client connection made from: %s:%s', peer.host, peer.port) # Set the initial auth level of this session to AUTH_LEVEL_NONE ...
[ "def", "connectionMade", "(", "self", ")", ":", "# NOQA: N802", "peer", "=", "self", ".", "transport", ".", "getPeer", "(", ")", "log", ".", "info", "(", "'Deluge Client connection made from: %s:%s'", ",", "peer", ".", "host", ",", "peer", ".", "port", ")", ...
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/core/rpcserver.py#L161-L170
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/qt_calendar.py
python
QtCalendar.create_widget
(self)
Create the calender widget.
Create the calender widget.
[ "Create", "the", "calender", "widget", "." ]
def create_widget(self): """ Create the calender widget. """ self.widget = QCalendarWidget(self.parent_widget())
[ "def", "create_widget", "(", "self", ")", ":", "self", ".", "widget", "=", "QCalendarWidget", "(", "self", ".", "parent_widget", "(", ")", ")" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/qt_calendar.py#L27-L31
mozilla/http-observatory
169ae7ce44002ce21d7e8c162525f992a198586f
httpobs/scanner/analyzer/headers.py
python
x_xss_protection
(reqs: dict, expectation='x-xss-protection-1-mode-block')
return output
:param reqs: dictionary containing all the request and response objects :param expectation: test expectation x-xss-protection-enabled-mode-block: X-XSS-Protection set to "1; block" [default] x-xss-protection-enabled: X-XSS-Protection set to "1" x-xss-protection-not-needed-due-to-csp: no X-XS...
:param reqs: dictionary containing all the request and response objects :param expectation: test expectation x-xss-protection-enabled-mode-block: X-XSS-Protection set to "1; block" [default] x-xss-protection-enabled: X-XSS-Protection set to "1" x-xss-protection-not-needed-due-to-csp: no X-XS...
[ ":", "param", "reqs", ":", "dictionary", "containing", "all", "the", "request", "and", "response", "objects", ":", "param", "expectation", ":", "test", "expectation", "x", "-", "xss", "-", "protection", "-", "enabled", "-", "mode", "-", "block", ":", "X", ...
def x_xss_protection(reqs: dict, expectation='x-xss-protection-1-mode-block') -> dict: """ :param reqs: dictionary containing all the request and response objects :param expectation: test expectation x-xss-protection-enabled-mode-block: X-XSS-Protection set to "1; block" [default] x-xss-prot...
[ "def", "x_xss_protection", "(", "reqs", ":", "dict", ",", "expectation", "=", "'x-xss-protection-1-mode-block'", ")", "->", "dict", ":", "VALID_DIRECTIVES", "=", "(", "'0'", ",", "'1'", ",", "'mode'", ",", "'report'", ")", "VALID_MODES", "=", "(", "'block'", ...
https://github.com/mozilla/http-observatory/blob/169ae7ce44002ce21d7e8c162525f992a198586f/httpobs/scanner/analyzer/headers.py#L770-L853
markokr/rarfile
55fe778b5207ebba48b8158d2c25d9d536ec89de
rarfile.py
python
UnicodeFilename.enc_byte
(self)
Copy encoded byte.
Copy encoded byte.
[ "Copy", "encoded", "byte", "." ]
def enc_byte(self): """Copy encoded byte.""" try: c = self.encdata[self.encpos] self.encpos += 1 return c except IndexError: self.failed = 1 return 0
[ "def", "enc_byte", "(", "self", ")", ":", "try", ":", "c", "=", "self", ".", "encdata", "[", "self", ".", "encpos", "]", "self", ".", "encpos", "+=", "1", "return", "c", "except", "IndexError", ":", "self", ".", "failed", "=", "1", "return", "0" ]
https://github.com/markokr/rarfile/blob/55fe778b5207ebba48b8158d2c25d9d536ec89de/rarfile.py#L2114-L2122
pika/pika
12dcdf15d0932c388790e0fa990810bfd21b1a32
examples/asynchronous_publisher_example.py
python
ExamplePublisher.on_connection_open
(self, _unused_connection)
This method is called by pika once the connection to RabbitMQ has been established. It passes the handle to the connection object in case we need it, but in this case, we'll just mark it unused. :param pika.SelectConnection _unused_connection: The connection
This method is called by pika once the connection to RabbitMQ has been established. It passes the handle to the connection object in case we need it, but in this case, we'll just mark it unused.
[ "This", "method", "is", "called", "by", "pika", "once", "the", "connection", "to", "RabbitMQ", "has", "been", "established", ".", "It", "passes", "the", "handle", "to", "the", "connection", "object", "in", "case", "we", "need", "it", "but", "in", "this", ...
def on_connection_open(self, _unused_connection): """This method is called by pika once the connection to RabbitMQ has been established. It passes the handle to the connection object in case we need it, but in this case, we'll just mark it unused. :param pika.SelectConnection _unused_co...
[ "def", "on_connection_open", "(", "self", ",", "_unused_connection", ")", ":", "LOGGER", ".", "info", "(", "'Connection opened'", ")", "self", ".", "open_channel", "(", ")" ]
https://github.com/pika/pika/blob/12dcdf15d0932c388790e0fa990810bfd21b1a32/examples/asynchronous_publisher_example.py#L67-L76
philip-huang/PIXOR
2f64e84f72d915f8b5b80d4615bc9a0c881b5dab
srcs/postprocess.py
python
compute_iou
(box, boxes)
return np.array(iou, dtype=np.float32)
Calculates IoU of the given box with the array of the given boxes. box: a polygon boxes: a vector of polygons Note: the areas are passed in rather than calculated here for efficiency. Calculate once in the caller to avoid duplicate work.
Calculates IoU of the given box with the array of the given boxes. box: a polygon boxes: a vector of polygons Note: the areas are passed in rather than calculated here for efficiency. Calculate once in the caller to avoid duplicate work.
[ "Calculates", "IoU", "of", "the", "given", "box", "with", "the", "array", "of", "the", "given", "boxes", ".", "box", ":", "a", "polygon", "boxes", ":", "a", "vector", "of", "polygons", "Note", ":", "the", "areas", "are", "passed", "in", "rather", "than...
def compute_iou(box, boxes): """Calculates IoU of the given box with the array of the given boxes. box: a polygon boxes: a vector of polygons Note: the areas are passed in rather than calculated here for efficiency. Calculate once in the caller to avoid duplicate work. """ # Calculate inters...
[ "def", "compute_iou", "(", "box", ",", "boxes", ")", ":", "# Calculate intersection areas", "iou", "=", "[", "box", ".", "intersection", "(", "b", ")", ".", "area", "/", "box", ".", "union", "(", "b", ")", ".", "area", "for", "b", "in", "boxes", "]",...
https://github.com/philip-huang/PIXOR/blob/2f64e84f72d915f8b5b80d4615bc9a0c881b5dab/srcs/postprocess.py#L43-L53
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/multiprocessing/sharedctypes.py
python
Array
(typecode_or_type, size_or_initializer, **kwds)
return synchronized(obj, lock)
Return a synchronization wrapper for a RawArray
Return a synchronization wrapper for a RawArray
[ "Return", "a", "synchronization", "wrapper", "for", "a", "RawArray" ]
def Array(typecode_or_type, size_or_initializer, **kwds): ''' Return a synchronization wrapper for a RawArray ''' lock = kwds.pop('lock', None) if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawArray(typecode_or_type, size_or_initializer) if loc...
[ "def", "Array", "(", "typecode_or_type", ",", "size_or_initializer", ",", "*", "*", "kwds", ")", ":", "lock", "=", "kwds", ".", "pop", "(", "'lock'", ",", "None", ")", "if", "kwds", ":", "raise", "ValueError", "(", "'unrecognized keyword argument(s): %s'", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/multiprocessing/sharedctypes.py#L108-L122
pyudev/pyudev
d5630bf15692b652db55d626f66274169f3448d5
src/pyudev/device/_device.py
python
Properties.asint
(self, prop)
return int(self[prop])
Get the given property from this device as integer. ``prop`` is a unicode or byte string containing the name of the property. Return the property value as integer. Raise a :exc:`~exceptions.KeyError`, if the given property is not defined for this device, or a :exc:`~exceptions....
Get the given property from this device as integer.
[ "Get", "the", "given", "property", "from", "this", "device", "as", "integer", "." ]
def asint(self, prop): """ Get the given property from this device as integer. ``prop`` is a unicode or byte string containing the name of the property. Return the property value as integer. Raise a :exc:`~exceptions.KeyError`, if the given property is not defined ...
[ "def", "asint", "(", "self", ",", "prop", ")", ":", "return", "int", "(", "self", "[", "prop", "]", ")" ]
https://github.com/pyudev/pyudev/blob/d5630bf15692b652db55d626f66274169f3448d5/src/pyudev/device/_device.py#L1118-L1130
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py
python
_IPAddressBase._report_invalid_netmask
(cls, netmask_str)
[]
def _report_invalid_netmask(cls, netmask_str): msg = '%r is not a valid netmask' % netmask_str raise NetmaskValueError(msg)
[ "def", "_report_invalid_netmask", "(", "cls", ",", "netmask_str", ")", ":", "msg", "=", "'%r is not a valid netmask'", "%", "netmask_str", "raise", "NetmaskValueError", "(", "msg", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py#L594-L596
libertysoft3/saidit
271c7d03adb369f82921d811360b00812e42da24
r2/r2/lib/loid.py
python
LoId._create
(cls, request, context)
return loid
Create and return a new logged out id and timestamp. This also triggers an loid_event in the event pipeline. :param request: current :py:module:`pylons` request object :param context: current :py:module:`pylons` context object :rtype: :py:class:`LoId` :returns: new ``LoId``
Create and return a new logged out id and timestamp.
[ "Create", "and", "return", "a", "new", "logged", "out", "id", "and", "timestamp", "." ]
def _create(cls, request, context): """Create and return a new logged out id and timestamp. This also triggers an loid_event in the event pipeline. :param request: current :py:module:`pylons` request object :param context: current :py:module:`pylons` context object :rtype: :py:...
[ "def", "_create", "(", "cls", ",", "request", ",", "context", ")", ":", "loid", "=", "cls", "(", "request", "=", "request", ",", "context", "=", "context", ",", "new", "=", "True", ",", "loid", "=", "randstr", "(", "LOID_LENGTH", ",", "LOID_CHARSPACE",...
https://github.com/libertysoft3/saidit/blob/271c7d03adb369f82921d811360b00812e42da24/r2/r2/lib/loid.py#L95-L112
HeinleinSupport/check_mk_extensions
aa7d7389b812ed00f91dad61d66fb676284897d8
entropy_avail/lib/check_mk/base/plugins/agent_based/entropy_avail.py
python
parse_entropy_avail
(string_table)
return section
[]
def parse_entropy_avail(string_table): section = {} for line in string_table: try: section[line[0]] = int(line[1]) except ValueError: pass return section
[ "def", "parse_entropy_avail", "(", "string_table", ")", ":", "section", "=", "{", "}", "for", "line", "in", "string_table", ":", "try", ":", "section", "[", "line", "[", "0", "]", "]", "=", "int", "(", "line", "[", "1", "]", ")", "except", "ValueErro...
https://github.com/HeinleinSupport/check_mk_extensions/blob/aa7d7389b812ed00f91dad61d66fb676284897d8/entropy_avail/lib/check_mk/base/plugins/agent_based/entropy_avail.py#L33-L40
rogertrullo/pytorch_convlstm
ed5572e9728fff665f31765d65578d5d283d3d05
conv_lstm.py
python
CLSTM.forward
(self, input, hidden_state)
return next_hidden, current_input
args: hidden_state:list of tuples, one for every layer, each tuple should be hidden_layer_i,c_layer_i input is the tensor of shape seq_len,Batch,Chans,H,W
args: hidden_state:list of tuples, one for every layer, each tuple should be hidden_layer_i,c_layer_i input is the tensor of shape seq_len,Batch,Chans,H,W
[ "args", ":", "hidden_state", ":", "list", "of", "tuples", "one", "for", "every", "layer", "each", "tuple", "should", "be", "hidden_layer_i", "c_layer_i", "input", "is", "the", "tensor", "of", "shape", "seq_len", "Batch", "Chans", "H", "W" ]
def forward(self, input, hidden_state): """ args: hidden_state:list of tuples, one for every layer, each tuple should be hidden_layer_i,c_layer_i input is the tensor of shape seq_len,Batch,Chans,H,W """ current_input = input.transpose(0, 1)#now is seq_len,B,C,H,...
[ "def", "forward", "(", "self", ",", "input", ",", "hidden_state", ")", ":", "current_input", "=", "input", ".", "transpose", "(", "0", ",", "1", ")", "#now is seq_len,B,C,H,W", "#current_input=input", "next_hidden", "=", "[", "]", "#hidden states(h and c)", "seq...
https://github.com/rogertrullo/pytorch_convlstm/blob/ed5572e9728fff665f31765d65578d5d283d3d05/conv_lstm.py#L79-L107
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/python/versions.py
python
_inf.__cmp__
(self, other)
return 1
@param other: Another object. @type other: any @return: 0 if other is inf, 1 otherwise. @rtype: C{int}
@param other: Another object. @type other: any
[ "@param", "other", ":", "Another", "object", ".", "@type", "other", ":", "any" ]
def __cmp__(self, other): """ @param other: Another object. @type other: any @return: 0 if other is inf, 1 otherwise. @rtype: C{int} """ if other is _inf: return 0 return 1
[ "def", "__cmp__", "(", "self", ",", "other", ")", ":", "if", "other", "is", "_inf", ":", "return", "0", "return", "1" ]
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/python/versions.py#L18-L28
shiyanlou/louplus-python
4c61697259e286e3d9116c3299f170d019ba3767
taobei/challenge-04/tbmall/handlers/shop.py
python
update_shop
(id)
return json_response(shop=ShopSchema().dump(shop))
更新店铺
更新店铺
[ "更新店铺" ]
def update_shop(id): """更新店铺 """ data = request.get_json() count = Shop.query.filter(Shop.id == id).update(data) if count == 0: return json_response(ResponseCode.NOT_FOUND) shop = Shop.query.get(id) session.commit() return json_response(shop=ShopSchema().dump(shop))
[ "def", "update_shop", "(", "id", ")", ":", "data", "=", "request", ".", "get_json", "(", ")", "count", "=", "Shop", ".", "query", ".", "filter", "(", "Shop", ".", "id", "==", "id", ")", ".", "update", "(", "data", ")", "if", "count", "==", "0", ...
https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/taobei/challenge-04/tbmall/handlers/shop.py#L48-L60
zopefoundation/Zope
ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb
src/Products/PageTemplates/engine.py
python
RepeatDictWrapper.__call__
(self, key, iterable)
return ri, length
We coerce the iterable to a tuple and return an iterator after registering it in the repeat dictionary.
We coerce the iterable to a tuple and return an iterator after registering it in the repeat dictionary.
[ "We", "coerce", "the", "iterable", "to", "a", "tuple", "and", "return", "an", "iterator", "after", "registering", "it", "in", "the", "repeat", "dictionary", "." ]
def __call__(self, key, iterable): """We coerce the iterable to a tuple and return an iterator after registering it in the repeat dictionary.""" iterable = list(iterable) if iterable is not None else () length = len(iterable) # Insert as repeat item ri = self[key] = Rep...
[ "def", "__call__", "(", "self", ",", "key", ",", "iterable", ")", ":", "iterable", "=", "list", "(", "iterable", ")", "if", "iterable", "is", "not", "None", "else", "(", ")", "length", "=", "len", "(", "iterable", ")", "# Insert as repeat item", "ri", ...
https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/Products/PageTemplates/engine.py#L71-L81
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/common/numberTools.py
python
unitNormalizeProportion
(values: Sequence[int])
return unit
Normalize values within the unit interval, where max is determined by the sum of the series. >>> common.unitNormalizeProportion([0, 3, 4]) [0.0, 0.42857142857142855, 0.5714285714285714] >>> common.unitNormalizeProportion([1, 1, 1]) [0.3333333..., 0.333333..., 0.333333...] On 32-bit computers this...
Normalize values within the unit interval, where max is determined by the sum of the series.
[ "Normalize", "values", "within", "the", "unit", "interval", "where", "max", "is", "determined", "by", "the", "sum", "of", "the", "series", "." ]
def unitNormalizeProportion(values: Sequence[int]) -> List[float]: ''' Normalize values within the unit interval, where max is determined by the sum of the series. >>> common.unitNormalizeProportion([0, 3, 4]) [0.0, 0.42857142857142855, 0.5714285714285714] >>> common.unitNormalizeProportion([1, 1, ...
[ "def", "unitNormalizeProportion", "(", "values", ":", "Sequence", "[", "int", "]", ")", "->", "List", "[", "float", "]", ":", "summation", "=", "0", "for", "x", "in", "values", ":", "if", "x", "<", "0", ":", "raise", "ValueError", "(", "'value members ...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/common/numberTools.py#L666-L697
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/api/mail.py
python
_EmailMessageBase.initialize
(self, **kw)
Keyword initialization. Used to set all fields of the email message using keyword arguments. Args: kw: List of keyword properties as defined by PROPERTIES.
Keyword initialization.
[ "Keyword", "initialization", "." ]
def initialize(self, **kw): """Keyword initialization. Used to set all fields of the email message using keyword arguments. Args: kw: List of keyword properties as defined by PROPERTIES. """ for name, value in kw.iteritems(): setattr(self, name, value)
[ "def", "initialize", "(", "self", ",", "*", "*", "kw", ")", ":", "for", "name", ",", "value", "in", "kw", ".", "iteritems", "(", ")", ":", "setattr", "(", "self", ",", "name", ",", "value", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/mail.py#L774-L783
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/gevent/_sslgte279.py
python
SSLSocket._real_connect
(self, addr, connect_ex)
[]
def _real_connect(self, addr, connect_ex): if self.server_side: raise ValueError("can't connect in server-side mode") # Here we assume that the socket is client-side, and not # connected at the time of the call. We connect it, then wrap it. if self._connected: ra...
[ "def", "_real_connect", "(", "self", ",", "addr", ",", "connect_ex", ")", ":", "if", "self", ".", "server_side", ":", "raise", "ValueError", "(", "\"can't connect in server-side mode\"", ")", "# Here we assume that the socket is client-side, and not", "# connected at the ti...
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/gevent/_sslgte279.py#L582-L603
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/auto_scheduler/measure_record.py
python
save_records
(filename, inputs, results)
Append measure records to file. Parameters ---------- filename : str File name to write log to. inputs: List[MeasureInputs] The MeasureInputs to be written. results: List[MeasureResults] The MeasureResults to be written.
Append measure records to file.
[ "Append", "measure", "records", "to", "file", "." ]
def save_records(filename, inputs, results): """ Append measure records to file. Parameters ---------- filename : str File name to write log to. inputs: List[MeasureInputs] The MeasureInputs to be written. results: List[MeasureResults] The MeasureResults to be writte...
[ "def", "save_records", "(", "filename", ",", "inputs", ",", "results", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "filename", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/auto_scheduler/measure_record.py#L197-L213
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.85/Libs/x86smt/solver_cvc3.py
python
Solver.forallExpr
(self, Bvars, exp)
return self.CVC.vc_forallExpr(self.vc, arr, len(Bvars), exp) | self.get_error()
FORALL (Bvars): exp Bvars is a list of Expr
FORALL (Bvars): exp Bvars is a list of Expr
[ "FORALL", "(", "Bvars", ")", ":", "exp", "Bvars", "is", "a", "list", "of", "Expr" ]
def forallExpr(self, Bvars, exp): """ FORALL (Bvars): exp Bvars is a list of Expr """ arr = (c_ulong * len(Bvars))() c=0 for x in Bvars: arr[c] = x c+=1 return self.CVC.vc_forallExpr(self.vc, arr, len(Bvars), exp) | self.get_error(...
[ "def", "forallExpr", "(", "self", ",", "Bvars", ",", "exp", ")", ":", "arr", "=", "(", "c_ulong", "*", "len", "(", "Bvars", ")", ")", "(", ")", "c", "=", "0", "for", "x", "in", "Bvars", ":", "arr", "[", "c", "]", "=", "x", "c", "+=", "1", ...
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.85/Libs/x86smt/solver_cvc3.py#L587-L598
seomoz/shovel
fc29232b2b8be33972f8fb498a91a67e334f057f
shovel/tasks.py
python
Shovel.__getitem__
(self, key)
return current[split[-1]]
Find a task with the provided name
Find a task with the provided name
[ "Find", "a", "task", "with", "the", "provided", "name" ]
def __getitem__(self, key): '''Find a task with the provided name''' current = self.map split = key.split('.') for module in split[:-1]: if module not in current: raise KeyError('Module not found') current = current[module].map if split[-1]...
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "current", "=", "self", ".", "map", "split", "=", "key", ".", "split", "(", "'.'", ")", "for", "module", "in", "split", "[", ":", "-", "1", "]", ":", "if", "module", "not", "in", "current",...
https://github.com/seomoz/shovel/blob/fc29232b2b8be33972f8fb498a91a67e334f057f/shovel/tasks.py#L101-L111
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/nlp/data/dialogue_state_tracking/sgd/schema.py
python
ServiceSchema.__init__
(self, schema_json: dict, service_id: Optional[int] = None)
Constructor for ServiceSchema. Args: schema_json: schema json dict service_id: service ID
Constructor for ServiceSchema. Args: schema_json: schema json dict service_id: service ID
[ "Constructor", "for", "ServiceSchema", ".", "Args", ":", "schema_json", ":", "schema", "json", "dict", "service_id", ":", "service", "ID" ]
def __init__(self, schema_json: dict, service_id: Optional[int] = None): """ Constructor for ServiceSchema. Args: schema_json: schema json dict service_id: service ID """ self._service_name = schema_json["service_name"] self._description = schema_j...
[ "def", "__init__", "(", "self", ",", "schema_json", ":", "dict", ",", "service_id", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "self", ".", "_service_name", "=", "schema_json", "[", "\"service_name\"", "]", "self", ".", "_description", "=", ...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/nlp/data/dialogue_state_tracking/sgd/schema.py#L33-L78
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/tools/scripttool.py
python
_get_playback_tractor
(length, range_frame_res_str=None, in_frame=-1, out_frame=-1)
return tractor
[]
def _get_playback_tractor(length, range_frame_res_str=None, in_frame=-1, out_frame=-1): # Create tractor and tracks tractor = mlt.Tractor() multitrack = tractor.multitrack() track0 = mlt.Playlist() multitrack.connect(track0, 0) bg_path = respaths.FLUXITY_EMPTY_BG_RES_PATH profile = mltprofi...
[ "def", "_get_playback_tractor", "(", "length", ",", "range_frame_res_str", "=", "None", ",", "in_frame", "=", "-", "1", ",", "out_frame", "=", "-", "1", ")", ":", "# Create tractor and tracks", "tractor", "=", "mlt", ".", "Tractor", "(", ")", "multitrack", "...
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/tools/scripttool.py#L267-L295
inpanel/inpanel
be53d86a72e30dd5476780ed5ba334315a23004b
lib/tornado/web.py
python
RequestHandler.require_setting
(self, name, feature="this feature")
Raises an exception if the given app setting is not defined.
Raises an exception if the given app setting is not defined.
[ "Raises", "an", "exception", "if", "the", "given", "app", "setting", "is", "not", "defined", "." ]
def require_setting(self, name, feature="this feature"): """Raises an exception if the given app setting is not defined.""" if not self.application.settings.get(name): raise Exception("You must define the '%s' setting in your " "application to use %s" % (name, fea...
[ "def", "require_setting", "(", "self", ",", "name", ",", "feature", "=", "\"this feature\"", ")", ":", "if", "not", "self", ".", "application", ".", "settings", ".", "get", "(", "name", ")", ":", "raise", "Exception", "(", "\"You must define the '%s' setting i...
https://github.com/inpanel/inpanel/blob/be53d86a72e30dd5476780ed5ba334315a23004b/lib/tornado/web.py#L973-L977
declare-lab/conv-emotion
0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
TL-ERC/bert_model/layer/encoder.py
python
BaseRNNEncoder.__init__
(self)
Base RNN Encoder Class
Base RNN Encoder Class
[ "Base", "RNN", "Encoder", "Class" ]
def __init__(self): """Base RNN Encoder Class""" super(BaseRNNEncoder, self).__init__()
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "BaseRNNEncoder", ",", "self", ")", ".", "__init__", "(", ")" ]
https://github.com/declare-lab/conv-emotion/blob/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e/TL-ERC/bert_model/layer/encoder.py#L12-L14
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/urllib3/packages/six.py
python
ensure_text
(s, encoding="utf-8", errors="strict")
Coerce *s* to six.text_type. For Python 2: - `unicode` -> `unicode` - `str` -> `unicode` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str`
Coerce *s* to six.text_type.
[ "Coerce", "*", "s", "*", "to", "six", ".", "text_type", "." ]
def ensure_text(s, encoding="utf-8", errors="strict"): """Coerce *s* to six.text_type. For Python 2: - `unicode` -> `unicode` - `str` -> `unicode` For Python 3: - `str` -> `str` - `bytes` -> decoded to `str` """ if isinstance(s, binary_type): return s.decode(encodin...
[ "def", "ensure_text", "(", "s", ",", "encoding", "=", "\"utf-8\"", ",", "errors", "=", "\"strict\"", ")", ":", "if", "isinstance", "(", "s", ",", "binary_type", ")", ":", "return", "s", ".", "decode", "(", "encoding", ",", "errors", ")", "elif", "isins...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/urllib3/packages/six.py#L1015-L1031
magicalraccoon/tootstream
6dd84fc3767ef25df645a599cb632ad3745744df
src/tootstream/toot.py
python
block
(mastodon, rest)
Blocks a user by username or id. ex: block 23 block @user block @user@instance.example.com
Blocks a user by username or id.
[ "Blocks", "a", "user", "by", "username", "or", "id", "." ]
def block(mastodon, rest): """Blocks a user by username or id. ex: block 23 block @user block @user@instance.example.com""" userid = get_userid(mastodon, rest) if isinstance(userid, list): cprint(" multiple matches found:", fg('red')) printUsersShort(userid) elif us...
[ "def", "block", "(", "mastodon", ",", "rest", ")", ":", "userid", "=", "get_userid", "(", "mastodon", ",", "rest", ")", "if", "isinstance", "(", "userid", ",", "list", ")", ":", "cprint", "(", "\" multiple matches found:\"", ",", "fg", "(", "'red'", ")"...
https://github.com/magicalraccoon/tootstream/blob/6dd84fc3767ef25df645a599cb632ad3745744df/src/tootstream/toot.py#L1598-L1616
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/rex.py
python
RexExecutor.append_system_paths
(self)
Append system paths to $PATH.
Append system paths to $PATH.
[ "Append", "system", "paths", "to", "$PATH", "." ]
def append_system_paths(self): """Append system paths to $PATH.""" from rez.shells import Shell, create_shell sh = self.interpreter if isinstance(self.interpreter, Shell) \ else create_shell() paths = sh.get_syspaths() paths_str = os.pathsep.join(paths) self....
[ "def", "append_system_paths", "(", "self", ")", ":", "from", "rez", ".", "shells", "import", "Shell", ",", "create_shell", "sh", "=", "self", ".", "interpreter", "if", "isinstance", "(", "self", ".", "interpreter", ",", "Shell", ")", "else", "create_shell", ...
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/rex.py#L1295-L1303
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/console/Console.py
python
ConsoleWidget.write
(self, strn, html=False, scrollToBottom='auto')
Write a string into the console. If scrollToBottom is 'auto', then the console is automatically scrolled to fit the new text only if it was already at the bottom.
Write a string into the console.
[ "Write", "a", "string", "into", "the", "console", "." ]
def write(self, strn, html=False, scrollToBottom='auto'): """Write a string into the console. If scrollToBottom is 'auto', then the console is automatically scrolled to fit the new text only if it was already at the bottom. """ isGuiThread = QtCore.QThread.currentThread() == QtC...
[ "def", "write", "(", "self", ",", "strn", ",", "html", "=", "False", ",", "scrollToBottom", "=", "'auto'", ")", ":", "isGuiThread", "=", "QtCore", ".", "QThread", ".", "currentThread", "(", ")", "==", "QtCore", ".", "QCoreApplication", ".", "instance", "...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/console/Console.py#L209-L238
initstring/cloud_enum
ca59fa9fba30146736ee7ed5cc8bee195c010cd2
enum_tools/aws_checks.py
python
run_all
(names, args)
Function is called by main program
Function is called by main program
[ "Function", "is", "called", "by", "main", "program" ]
def run_all(names, args): """ Function is called by main program """ print(BANNER) # Use user-supplied AWS region if provided #if not regions: # regions = AWS_REGIONS check_s3_buckets(names, args.threads) check_awsapps(names, args.threads, args.nameserver)
[ "def", "run_all", "(", "names", ",", "args", ")", ":", "print", "(", "BANNER", ")", "# Use user-supplied AWS region if provided", "#if not regions:", "# regions = AWS_REGIONS", "check_s3_buckets", "(", "names", ",", "args", ".", "threads", ")", "check_awsapps", "("...
https://github.com/initstring/cloud_enum/blob/ca59fa9fba30146736ee7ed5cc8bee195c010cd2/enum_tools/aws_checks.py#L121-L131
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/dimse_primitives.py
python
N_DELETE.RequestedSOPClassUID
(self)
return self._RequestedSOPClassUID
Return the *Requested SOP Class UID* as :class:`~pydicom.uid.UID`. Parameters ---------- pydicom.uid.UID, bytes or str The value to use for the *Requested SOP Class UID* parameter.
Return the *Requested SOP Class UID* as :class:`~pydicom.uid.UID`.
[ "Return", "the", "*", "Requested", "SOP", "Class", "UID", "*", "as", ":", "class", ":", "~pydicom", ".", "uid", ".", "UID", "." ]
def RequestedSOPClassUID(self) -> Optional[UID]: """Return the *Requested SOP Class UID* as :class:`~pydicom.uid.UID`. Parameters ---------- pydicom.uid.UID, bytes or str The value to use for the *Requested SOP Class UID* parameter. """ return self._Requested...
[ "def", "RequestedSOPClassUID", "(", "self", ")", "->", "Optional", "[", "UID", "]", ":", "return", "self", ".", "_RequestedSOPClassUID" ]
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/dimse_primitives.py#L2103-L2111
miha-skalic/youtube8mchallenge
65f20e9760ecb582e746e2a16cef6898a0ab6270
model_utils.py
python
SampleRandomFrames
(model_input, num_frames, num_samples)
Samples a random set of frames of size num_samples. Args: model_input: A tensor of size batch_size x max_frames x feature_size num_frames: A tensor of size batch_size x 1 num_samples: A scalar Returns: `model_input`: A tensor of size batch_size x num_samples x feature_size
Samples a random set of frames of size num_samples.
[ "Samples", "a", "random", "set", "of", "frames", "of", "size", "num_samples", "." ]
def SampleRandomFrames(model_input, num_frames, num_samples): """Samples a random set of frames of size num_samples. Args: model_input: A tensor of size batch_size x max_frames x feature_size num_frames: A tensor of size batch_size x 1 num_samples: A scalar Returns: `model_input`: A tensor of si...
[ "def", "SampleRandomFrames", "(", "model_input", ",", "num_frames", ",", "num_samples", ")", ":", "batch_size", "=", "tf", ".", "shape", "(", "model_input", ")", "[", "0", "]", "frame_index", "=", "tf", ".", "cast", "(", "tf", ".", "multiply", "(", "tf",...
https://github.com/miha-skalic/youtube8mchallenge/blob/65f20e9760ecb582e746e2a16cef6898a0ab6270/model_utils.py#L72-L95
alanhamlett/pip-update-requirements
ce875601ef278c8ce00ad586434a978731525561
pur/packages/pip/_vendor/html5lib/treeadapters/genshi.py
python
to_genshi
(walker)
Convert a tree to a genshi tree :arg walker: the treewalker to use to walk the tree to convert it :returns: generator of genshi nodes
Convert a tree to a genshi tree
[ "Convert", "a", "tree", "to", "a", "genshi", "tree" ]
def to_genshi(walker): """Convert a tree to a genshi tree :arg walker: the treewalker to use to walk the tree to convert it :returns: generator of genshi nodes """ text = [] for token in walker: type = token["type"] if type in ("Characters", "SpaceCharacters"): tex...
[ "def", "to_genshi", "(", "walker", ")", ":", "text", "=", "[", "]", "for", "token", "in", "walker", ":", "type", "=", "token", "[", "\"type\"", "]", "if", "type", "in", "(", "\"Characters\"", ",", "\"SpaceCharacters\"", ")", ":", "text", ".", "append",...
https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/html5lib/treeadapters/genshi.py#L7-L54
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/difflib.py
python
Differ._qformat
(self, aline, bline, atags, btags)
r""" Format "?" output and deal with tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print(repr(line)) ... '- \tabcDefg...
r""" Format "?" output and deal with tabs.
[ "r", "Format", "?", "output", "and", "deal", "with", "tabs", "." ]
def _qformat(self, aline, bline, atags, btags): r""" Format "?" output and deal with tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in res...
[ "def", "_qformat", "(", "self", ",", "aline", ",", "bline", ",", "atags", ",", "btags", ")", ":", "atags", "=", "_keep_original_ws", "(", "aline", ",", "atags", ")", ".", "rstrip", "(", ")", "btags", "=", "_keep_original_ws", "(", "bline", ",", "btags"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/difflib.py#L1029-L1054
jeffgortmaker/pyblp
33ad24d8a800b8178aafa47304a822077a607558
pyblp/results/problem_results.py
python
ProblemResults._compute_importance_weights
( self, agents: RecArray, delta: Array, draws: int, ar_constant: float, seed: Optional[int])
return weights, errors
Compute the importance sampling weights associated with a set of agents.
Compute the importance sampling weights associated with a set of agents.
[ "Compute", "the", "importance", "sampling", "weights", "associated", "with", "a", "set", "of", "agents", "." ]
def _compute_importance_weights( self, agents: RecArray, delta: Array, draws: int, ar_constant: float, seed: Optional[int]) -> ( Tuple[Array, List[Error]]): """Compute the importance sampling weights associated with a set of agents.""" errors: List[Error] = [] market_indi...
[ "def", "_compute_importance_weights", "(", "self", ",", "agents", ":", "RecArray", ",", "delta", ":", "Array", ",", "draws", ":", "int", ",", "ar_constant", ":", "float", ",", "seed", ":", "Optional", "[", "int", "]", ")", "->", "(", "Tuple", "[", "Arr...
https://github.com/jeffgortmaker/pyblp/blob/33ad24d8a800b8178aafa47304a822077a607558/pyblp/results/problem_results.py#L1475-L1515
SUSE/DeepSea
9c7fad93915ba1250c40d50c855011e9fe41ed21
srv/salt/_modules/keyring.py
python
secret
(filename)
return gen_secret()
Read the filename and return the key value. If it does not exist, generate one. Note that if used on a file that contains multiple keys, this will always return the first key.
Read the filename and return the key value. If it does not exist, generate one.
[ "Read", "the", "filename", "and", "return", "the", "key", "value", ".", "If", "it", "does", "not", "exist", "generate", "one", "." ]
def secret(filename): """ Read the filename and return the key value. If it does not exist, generate one. Note that if used on a file that contains multiple keys, this will always return the first key. """ if os.path.exists(filename): with open(filename, 'r') as keyring: ...
[ "def", "secret", "(", "filename", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "keyring", ":", "for", "line", "in", "keyring", ":", "if", "'key'", "in", "line",...
https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/salt/_modules/keyring.py#L15-L30
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/websocket/_core.py
python
WebSocket.__iter__
(self)
Allow iteration over websocket, implying sequential `recv` executions.
Allow iteration over websocket, implying sequential `recv` executions.
[ "Allow", "iteration", "over", "websocket", "implying", "sequential", "recv", "executions", "." ]
def __iter__(self): """ Allow iteration over websocket, implying sequential `recv` executions. """ while True: yield self.recv()
[ "def", "__iter__", "(", "self", ")", ":", "while", "True", ":", "yield", "self", ".", "recv", "(", ")" ]
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/websocket/_core.py#L102-L107
MDAnalysis/mdanalysis
3488df3cdb0c29ed41c4fb94efe334b541e31b21
package/MDAnalysis/analysis/psa.py
python
PSAnalysis.save_paths
(self, filename=None)
return filename
Save fitted :attr:`PSAnalysis.paths` to numpy compressed npz files. The data are saved with :func:`numpy.savez_compressed` in the directory specified by :attr:`PSAnalysis.targetdir`. Parameters ---------- filename : str specifies filename [``None``] Return...
Save fitted :attr:`PSAnalysis.paths` to numpy compressed npz files.
[ "Save", "fitted", ":", "attr", ":", "PSAnalysis", ".", "paths", "to", "numpy", "compressed", "npz", "files", "." ]
def save_paths(self, filename=None): """Save fitted :attr:`PSAnalysis.paths` to numpy compressed npz files. The data are saved with :func:`numpy.savez_compressed` in the directory specified by :attr:`PSAnalysis.targetdir`. Parameters ---------- filename : str ...
[ "def", "save_paths", "(", "self", ",", "filename", "=", "None", ")", ":", "filename", "=", "filename", "or", "'path_psa'", "head", "=", "os", ".", "path", ".", "join", "(", "self", ".", "targetdir", ",", "self", ".", "datadirs", "[", "'paths'", "]", ...
https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/analysis/psa.py#L1579-L1613
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/marian/convert_marian_to_pytorch.py
python
lmap
(f, x)
return list(map(f, x))
[]
def lmap(f, x) -> List: return list(map(f, x))
[ "def", "lmap", "(", "f", ",", "x", ")", "->", "List", ":", "return", "list", "(", "map", "(", "f", ",", "x", ")", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/marian/convert_marian_to_pytorch.py#L314-L315
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/pint/context.py
python
ContextChain.graph
(self)
return self._graph
The graph relating
The graph relating
[ "The", "graph", "relating" ]
def graph(self): """The graph relating """ if self._graph is None: self._graph = defaultdict(set) for fr_, to_ in self: self._graph[fr_].add(to_) return self._graph
[ "def", "graph", "(", "self", ")", ":", "if", "self", ".", "_graph", "is", "None", ":", "self", ".", "_graph", "=", "defaultdict", "(", "set", ")", "for", "fr_", ",", "to_", "in", "self", ":", "self", ".", "_graph", "[", "fr_", "]", ".", "add", ...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/pint/context.py#L231-L238
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
chainer_/chainercv2/models/xdensenet_cifar.py
python
xdensenet40_2_k24_bc_svhn
(classes=10, **kwargs)
return get_xdensenet_cifar(classes=classes, blocks=40, growth_rate=24, bottleneck=True, model_name="xdensenet40_2_k24_bc_svhn", **kwargs)
X-DenseNet-BC-40-2 (k=24) model for SVHN from 'Deep Expander Networks: Efficient Deep Networks from Graph Theory,' https://arxiv.org/abs/1711.08757. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to load th...
X-DenseNet-BC-40-2 (k=24) model for SVHN from 'Deep Expander Networks: Efficient Deep Networks from Graph Theory,' https://arxiv.org/abs/1711.08757.
[ "X", "-", "DenseNet", "-", "BC", "-", "40", "-", "2", "(", "k", "=", "24", ")", "model", "for", "SVHN", "from", "Deep", "Expander", "Networks", ":", "Efficient", "Deep", "Networks", "from", "Graph", "Theory", "https", ":", "//", "arxiv", ".", "org", ...
def xdensenet40_2_k24_bc_svhn(classes=10, **kwargs): """ X-DenseNet-BC-40-2 (k=24) model for SVHN from 'Deep Expander Networks: Efficient Deep Networks from Graph Theory,' https://arxiv.org/abs/1711.08757. Parameters: ---------- classes : int, default 10 Number of classification classes...
[ "def", "xdensenet40_2_k24_bc_svhn", "(", "classes", "=", "10", ",", "*", "*", "kwargs", ")", ":", "return", "get_xdensenet_cifar", "(", "classes", "=", "classes", ",", "blocks", "=", "40", ",", "growth_rate", "=", "24", ",", "bottleneck", "=", "True", ",",...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/chainer_/chainercv2/models/xdensenet_cifar.py#L255-L270
dbt-labs/dbt-core
e943b9fc842535e958ef4fd0b8703adc91556bc6
core/dbt/adapters/cache.py
python
_CachedRelation.__deepcopy__
(self, memo)
[]
def __deepcopy__(self, memo): new = self.__class__(self.inner.incorporate()) new.__dict__.update(self.__dict__) new.referenced_by = deepcopy(self.referenced_by, memo)
[ "def", "__deepcopy__", "(", "self", ",", "memo", ")", ":", "new", "=", "self", ".", "__class__", "(", "self", ".", "inner", ".", "incorporate", "(", ")", ")", "new", ".", "__dict__", ".", "update", "(", "self", ".", "__dict__", ")", "new", ".", "re...
https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/adapters/cache.py#L69-L72
mcneel/rhinoscriptsyntax
c49bd0bf24c2513bdcb84d1bf307144489600fd9
Scripts/rhinoscript/application.py
python
Ortho
(enable=None)
return rc
Enables or disables Rhino's ortho modeling aid. Parameters: enable (bool, optional): The new enabled status (True or False). If omitted the current state is returned. Returns: bool: if enable is not specified, then the current ortho status bool: if enable is specified, then the previous ortho ...
Enables or disables Rhino's ortho modeling aid. Parameters: enable (bool, optional): The new enabled status (True or False). If omitted the current state is returned. Returns: bool: if enable is not specified, then the current ortho status bool: if enable is specified, then the previous ortho ...
[ "Enables", "or", "disables", "Rhino", "s", "ortho", "modeling", "aid", ".", "Parameters", ":", "enable", "(", "bool", "optional", ")", ":", "The", "new", "enabled", "status", "(", "True", "or", "False", ")", ".", "If", "omitted", "the", "current", "state...
def Ortho(enable=None): """Enables or disables Rhino's ortho modeling aid. Parameters: enable (bool, optional): The new enabled status (True or False). If omitted the current state is returned. Returns: bool: if enable is not specified, then the current ortho status bool: if enable is spec...
[ "def", "Ortho", "(", "enable", "=", "None", ")", ":", "rc", "=", "modelaid", ".", "Ortho", "if", "enable", "!=", "None", ":", "modelaid", ".", "Ortho", "=", "enable", "return", "rc" ]
https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/application.py#L833-L850
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/splom/_diagonal.py
python
Diagonal.visible
(self)
return self["visible"]
Determines whether or not subplots on the diagonal are displayed. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not subplots on the diagonal are displayed. The 'visible' property must be specified as a bool (either True, or False)
[ "Determines", "whether", "or", "not", "subplots", "on", "the", "diagonal", "are", "displayed", ".", "The", "visible", "property", "must", "be", "specified", "as", "a", "bool", "(", "either", "True", "or", "False", ")" ]
def visible(self): """ Determines whether or not subplots on the diagonal are displayed. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["visible"]
[ "def", "visible", "(", "self", ")", ":", "return", "self", "[", "\"visible\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/splom/_diagonal.py#L16-L28
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarInfo.fromtarfile
(cls, tarfile)
return obj._proc_member(tarfile)
Return the next TarInfo object from TarFile object tarfile.
Return the next TarInfo object from TarFile object tarfile.
[ "Return", "the", "next", "TarInfo", "object", "from", "TarFile", "object", "tarfile", "." ]
def fromtarfile(cls, tarfile): """Return the next TarInfo object from TarFile object tarfile. """ buf = tarfile.fileobj.read(BLOCKSIZE) obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) obj.offset = tarfile.fileobj.tell() - BLOCKSIZE return obj._proc_mem...
[ "def", "fromtarfile", "(", "cls", ",", "tarfile", ")", ":", "buf", "=", "tarfile", ".", "fileobj", ".", "read", "(", "BLOCKSIZE", ")", "obj", "=", "cls", ".", "frombuf", "(", "buf", ",", "tarfile", ".", "encoding", ",", "tarfile", ".", "errors", ")",...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L1283-L1290
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/scripts/depfixer.py
python
Elf.fix_deps
(self, prefix: bytes)
[]
def fix_deps(self, prefix: bytes) -> None: sec = self.find_section(b'.dynstr') deps = [] for i in self.dynamic: if i.d_tag == DT_NEEDED: deps.append(i) for i in deps: offset = sec.sh_offset + i.val self.bf.seek(offset) name ...
[ "def", "fix_deps", "(", "self", ",", "prefix", ":", "bytes", ")", "->", "None", ":", "sec", "=", "self", ".", "find_section", "(", "b'.dynstr'", ")", "deps", "=", "[", "]", "for", "i", "in", "self", ".", "dynamic", ":", "if", "i", ".", "d_tag", "...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/scripts/depfixer.py#L298-L314
LGE-ARC-AdvancedAI/auptimizer
50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617
docs/archive/aup.py
python
BasicConfig.load
(self, filename)
return self
Load config parameters from JSON/pickle file :param filename: file name ends with [.json|.pkl] :type filename: string :return: configuration parsed from file :rtype: aup.BasicConfig
Load config parameters from JSON/pickle file
[ "Load", "config", "parameters", "from", "JSON", "/", "pickle", "file" ]
def load(self, filename): """Load config parameters from JSON/pickle file :param filename: file name ends with [.json|.pkl] :type filename: string :return: configuration parsed from file :rtype: aup.BasicConfig """ name = "_load_" + BasicConfig._get_format(filena...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "name", "=", "\"_load_\"", "+", "BasicConfig", ".", "_get_format", "(", "filename", ")", "func", "=", "getattr", "(", "self", ",", "name", ")", "data", "=", "func", "(", "filename", ")", "if", "t...
https://github.com/LGE-ARC-AdvancedAI/auptimizer/blob/50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617/docs/archive/aup.py#L63-L78
onnx/onnx-coreml
141fc33d7217674ea8bda36494fa8089a543a3f3
onnx_coreml/_operators.py
python
_convert_sub
(builder, node, graph, err)
[]
def _convert_sub(builder, node, graph, err): # type: (NeuralNetworkBuilder, Node, Graph, ErrorHandling) -> None _convert_broadcast_op(builder, node, graph, err, "ADD")
[ "def", "_convert_sub", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "# type: (NeuralNetworkBuilder, Node, Graph, ErrorHandling) -> None", "_convert_broadcast_op", "(", "builder", ",", "node", ",", "graph", ",", "err", ",", "\"ADD\"", ")" ]
https://github.com/onnx/onnx-coreml/blob/141fc33d7217674ea8bda36494fa8089a543a3f3/onnx_coreml/_operators.py#L278-L279
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/solvers/functional/default_functionals.py
python
IndicatorGroupL1UnitBall.__init__
(self, vfspace, exponent=None)
Initialize a new instance. Parameters ---------- vfspace : `ProductSpace` Space of vector fields on which the operator acts. It has to be a product space of identical spaces, i.e. a power space. exponent : non-zero float, optional Exponent...
Initialize a new instance.
[ "Initialize", "a", "new", "instance", "." ]
def __init__(self, vfspace, exponent=None): """Initialize a new instance. Parameters ---------- vfspace : `ProductSpace` Space of vector fields on which the operator acts. It has to be a product space of identical spaces, i.e. a power space. e...
[ "def", "__init__", "(", "self", ",", "vfspace", ",", "exponent", "=", "None", ")", ":", "if", "not", "isinstance", "(", "vfspace", ",", "ProductSpace", ")", ":", "raise", "TypeError", "(", "'`space` must be a `ProductSpace`'", ")", "if", "not", "vfspace", "....
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/solvers/functional/default_functionals.py#L347-L383
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/functions/hyperbolic.py
python
Function_arccsch._eval_numpy_
(self, x)
return arcsinh(1.0 / x)
EXAMPLES:: sage: import numpy sage: a = numpy.linspace(0,1,3) sage: acsch(a) doctest:...: RuntimeWarning: divide by zero encountered in ...divide array([ inf, 1.44363548, 0.88137359])
EXAMPLES::
[ "EXAMPLES", "::" ]
def _eval_numpy_(self, x): """ EXAMPLES:: sage: import numpy sage: a = numpy.linspace(0,1,3) sage: acsch(a) doctest:...: RuntimeWarning: divide by zero encountered in ...divide array([ inf, 1.44363548, 0.88137359]) """ ...
[ "def", "_eval_numpy_", "(", "self", ",", "x", ")", ":", "return", "arcsinh", "(", "1.0", "/", "x", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/hyperbolic.py#L706-L716
nipy/nipy
d16d268938dcd5c15748ca051532c21f57cf8a22
nipy/algorithms/slicetiming/timefuncs.py
python
st_42031
(n_slices, TR)
return st_02413(n_slices, TR)[::-1]
Descend alternate every second slice, starting at last slice Collect slice (`n_slices` - 1) first, slice (`nslices` - 3) second down to bottom (lowest numbered slice). Then return to collect slice (`n_slices` -2), slice (`n_slices` - 4) etc. For example, for 5 slices and a TR of 1: >>> {name}(5,...
Descend alternate every second slice, starting at last slice
[ "Descend", "alternate", "every", "second", "slice", "starting", "at", "last", "slice" ]
def st_42031(n_slices, TR): """Descend alternate every second slice, starting at last slice Collect slice (`n_slices` - 1) first, slice (`nslices` - 3) second down to bottom (lowest numbered slice). Then return to collect slice (`n_slices` -2), slice (`n_slices` - 4) etc. For example, for 5 slice...
[ "def", "st_42031", "(", "n_slices", ",", "TR", ")", ":", "return", "st_02413", "(", "n_slices", ",", "TR", ")", "[", ":", ":", "-", "1", "]" ]
https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/algorithms/slicetiming/timefuncs.py#L174-L188
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/storage/memory_mixins/paged_memory/pages/ultra_page.py
python
UltraPage.store
(self, addr, data: Union[int,SimMemoryObject], size: int=None, endness=None, memory=None, page_addr=None, # pylint: disable=arguments-differ cooperate=False, **kwargs)
[]
def store(self, addr, data: Union[int,SimMemoryObject], size: int=None, endness=None, memory=None, page_addr=None, # pylint: disable=arguments-differ cooperate=False, **kwargs): super().store(addr, data, size=size, endness=endness, memory=memory, cooperate=cooperate, page_addr=page_addr, ...
[ "def", "store", "(", "self", ",", "addr", ",", "data", ":", "Union", "[", "int", ",", "SimMemoryObject", "]", ",", "size", ":", "int", "=", "None", ",", "endness", "=", "None", ",", "memory", "=", "None", ",", "page_addr", "=", "None", ",", "# pyli...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/storage/memory_mixins/paged_memory/pages/ultra_page.py#L106-L170
zalando/expan
49a1ba3d9fdd786e08146f904a631f67484fd2d3
expan/core/statistics.py
python
pooled_std
(std1, n1, std2, n2)
return np.sqrt(((n1 - 1) * std1 ** 2 + (n2 - 1) * std2 ** 2) / (n1 + n2 - 2))
Returns the pooled estimate of standard deviation. For further information visit: http://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/BS704_Confidence_Intervals/BS704_Confidence_Intervals5.html :param std1: standard deviation of first sample :type std1: float :param n1: size of first sample :t...
Returns the pooled estimate of standard deviation.
[ "Returns", "the", "pooled", "estimate", "of", "standard", "deviation", "." ]
def pooled_std(std1, n1, std2, n2): """ Returns the pooled estimate of standard deviation. For further information visit: http://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/BS704_Confidence_Intervals/BS704_Confidence_Intervals5.html :param std1: standard deviation of first sample :type std1: floa...
[ "def", "pooled_std", "(", "std1", ",", "n1", ",", "std2", ",", "n2", ")", ":", "if", "(", "std1", "**", "2", ")", ">", "2.0", "*", "(", "std2", "**", "2", ")", "or", "(", "std1", "**", "2", ")", "<", "0.5", "*", "(", "std2", "**", "2", ")...
https://github.com/zalando/expan/blob/49a1ba3d9fdd786e08146f904a631f67484fd2d3/expan/core/statistics.py#L284-L308
nwcell/psycopg2-windows
5698844286001962f3eeeab58164301898ef48e9
psycopg2/_range.py
python
Range.upper_inf
(self)
return self._upper is None
`!True` if the range doesn't have an upper bound.
`!True` if the range doesn't have an upper bound.
[ "!True", "if", "the", "range", "doesn", "t", "have", "an", "upper", "bound", "." ]
def upper_inf(self): """`!True` if the range doesn't have an upper bound.""" if self._bounds is None: return False return self._upper is None
[ "def", "upper_inf", "(", "self", ")", ":", "if", "self", ".", "_bounds", "is", "None", ":", "return", "False", "return", "self", ".", "_upper", "is", "None" ]
https://github.com/nwcell/psycopg2-windows/blob/5698844286001962f3eeeab58164301898ef48e9/psycopg2/_range.py#L85-L88
man-group/mdf
4b2c78084467791ad883c0b4c53832ad70fc96ef
mdf/lab/__init__.py
python
DataFrameWithShiftSet.__init__
(self, df, shift_set_name, shift_set)
[]
def __init__(self, df, shift_set_name, shift_set): pd.DataFrame.__init__(self, df) self.__shift_set_name = shift_set_name self.__shift_set = dict(shift_set)
[ "def", "__init__", "(", "self", ",", "df", ",", "shift_set_name", ",", "shift_set", ")", ":", "pd", ".", "DataFrame", ".", "__init__", "(", "self", ",", "df", ")", "self", ".", "__shift_set_name", "=", "shift_set_name", "self", ".", "__shift_set", "=", "...
https://github.com/man-group/mdf/blob/4b2c78084467791ad883c0b4c53832ad70fc96ef/mdf/lab/__init__.py#L84-L87
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.makedir
(self, tarinfo, targetpath)
Make a directory called targetpath.
Make a directory called targetpath.
[ "Make", "a", "directory", "called", "targetpath", "." ]
def makedir(self, tarinfo, targetpath): """Make a directory called targetpath. """ try: # Use a safe mode for the directory, the real mode is set # later in _extract_member(). os.mkdir(targetpath, 0o700) except EnvironmentError as e: if e.e...
[ "def", "makedir", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "try", ":", "# Use a safe mode for the directory, the real mode is set", "# later in _extract_member().", "os", ".", "mkdir", "(", "targetpath", ",", "0o700", ")", "except", "EnvironmentError", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2285-L2294
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/fixtures/views.py
python
UploadFixtureAPIResponse.__init__
(self, status, message)
[]
def __init__(self, status, message): assert status in self.response_codes, \ 'status must be in {!r}: {}'.format(list(self.response_codes), status) self.status = status self.message = message
[ "def", "__init__", "(", "self", ",", "status", ",", "message", ")", ":", "assert", "status", "in", "self", ".", "response_codes", ",", "'status must be in {!r}: {}'", ".", "format", "(", "list", "(", "self", ".", "response_codes", ")", ",", "status", ")", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/fixtures/views.py#L396-L400
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
openWrt/files/usr/lib/python2.7/site-packages/tornado/web.py
python
RequestHandler.write
(self, chunk)
Writes the given chunk to the output buffer. To write the output to the network, use the flush() method below. If the given chunk is a dictionary, we write it as JSON and set the Content-Type of the response to be ``application/json``. (if you want to send JSON as a different ``Content...
Writes the given chunk to the output buffer.
[ "Writes", "the", "given", "chunk", "to", "the", "output", "buffer", "." ]
def write(self, chunk): """Writes the given chunk to the output buffer. To write the output to the network, use the flush() method below. If the given chunk is a dictionary, we write it as JSON and set the Content-Type of the response to be ``application/json``. (if you want to...
[ "def", "write", "(", "self", ",", "chunk", ")", ":", "if", "self", ".", "_finished", ":", "raise", "RuntimeError", "(", "\"Cannot write() after finish(). May be caused \"", "\"by using async operations without the \"", "\"@asynchronous decorator.\"", ")", "if", "isinstance...
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/web.py#L497-L520
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
cms/djangoapps/contentstore/views/item.py
python
xblock_view_handler
(request, usage_key_string, view_name)
The restful handler for requests for rendered xblock views. Returns a json object containing two keys: html: The rendered html of the view resources: A list of tuples where the first element is the resource hash, and the second is the resource description
The restful handler for requests for rendered xblock views.
[ "The", "restful", "handler", "for", "requests", "for", "rendered", "xblock", "views", "." ]
def xblock_view_handler(request, usage_key_string, view_name): """ The restful handler for requests for rendered xblock views. Returns a json object containing two keys: html: The rendered html of the view resources: A list of tuples where the first element is the resource hash, and ...
[ "def", "xblock_view_handler", "(", "request", ",", "usage_key_string", ",", "view_name", ")", ":", "usage_key", "=", "usage_key_with_run", "(", "usage_key_string", ")", "if", "not", "has_studio_read_access", "(", "request", ".", "user", ",", "usage_key", ".", "cou...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/cms/djangoapps/contentstore/views/item.py#L329-L454
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/vpc/vpc.py
python
VPC.detach_classic_instance
(self, instance_id, dry_run=False)
return self.connection.detach_classic_link_vpc( vpc_id=self.id, instance_id=instance_id, dry_run=dry_run )
Unlinks a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped. :type intance_id: str :param instance_is: The ID of the VPC to wh...
Unlinks a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped.
[ "Unlinks", "a", "linked", "EC2", "-", "Classic", "instance", "from", "a", "VPC", ".", "After", "the", "instance", "has", "been", "unlinked", "the", "VPC", "security", "groups", "are", "no", "longer", "associated", "with", "it", ".", "An", "instance", "is",...
def detach_classic_instance(self, instance_id, dry_run=False): """ Unlinks a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped....
[ "def", "detach_classic_instance", "(", "self", ",", "instance_id", ",", "dry_run", "=", "False", ")", ":", "return", "self", ".", "connection", ".", "detach_classic_link_vpc", "(", "vpc_id", "=", "self", ".", "id", ",", "instance_id", "=", "instance_id", ",", ...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/vpc/vpc.py#L184-L204
openstack/python-neutronclient
517bef2c5454dde2eba5cc2194ee857be6be7164
neutronclient/v2_0/client.py
python
Client.get_lbaas_agent_hosting_pool
(self, pool, **_params)
return self.get((self.pool_path + self.LOADBALANCER_AGENT) % pool, params=_params)
Fetches a loadbalancer agent hosting a pool.
Fetches a loadbalancer agent hosting a pool.
[ "Fetches", "a", "loadbalancer", "agent", "hosting", "a", "pool", "." ]
def get_lbaas_agent_hosting_pool(self, pool, **_params): """Fetches a loadbalancer agent hosting a pool.""" return self.get((self.pool_path + self.LOADBALANCER_AGENT) % pool, params=_params)
[ "def", "get_lbaas_agent_hosting_pool", "(", "self", ",", "pool", ",", "*", "*", "_params", ")", ":", "return", "self", ".", "get", "(", "(", "self", ".", "pool_path", "+", "self", ".", "LOADBALANCER_AGENT", ")", "%", "pool", ",", "params", "=", "_params"...
https://github.com/openstack/python-neutronclient/blob/517bef2c5454dde2eba5cc2194ee857be6be7164/neutronclient/v2_0/client.py#L1796-L1799
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/SQLAlchemy-1.3.17/examples/performance/large_resultsets.py
python
test_orm_full_objects_list
(n)
Load fully tracked ORM objects into one big list().
Load fully tracked ORM objects into one big list().
[ "Load", "fully", "tracked", "ORM", "objects", "into", "one", "big", "list", "()", "." ]
def test_orm_full_objects_list(n): """Load fully tracked ORM objects into one big list().""" sess = Session(engine) list(sess.query(Customer).limit(n))
[ "def", "test_orm_full_objects_list", "(", "n", ")", ":", "sess", "=", "Session", "(", "engine", ")", "list", "(", "sess", ".", "query", "(", "Customer", ")", ".", "limit", "(", "n", ")", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/examples/performance/large_resultsets.py#L63-L67
ConsenSys/mythril
d00152f8e4d925c7749d63b533152a937e1dd516
mythril/analysis/module/modules/arbitrary_write.py
python
ArbitraryStorage.reset_module
(self)
Resets the module by clearing everything :return:
Resets the module by clearing everything :return:
[ "Resets", "the", "module", "by", "clearing", "everything", ":", "return", ":" ]
def reset_module(self): """ Resets the module by clearing everything :return: """ super().reset_module()
[ "def", "reset_module", "(", "self", ")", ":", "super", "(", ")", ".", "reset_module", "(", ")" ]
https://github.com/ConsenSys/mythril/blob/d00152f8e4d925c7749d63b533152a937e1dd516/mythril/analysis/module/modules/arbitrary_write.py#L30-L35
Kozea/pygal
8267b03535ff55789a30bf66b798302adad88623
pygal/util.py
python
round_to_int
(number, precision)
return rounded
Round a number to a precision
Round a number to a precision
[ "Round", "a", "number", "to", "a", "precision" ]
def round_to_int(number, precision): """Round a number to a precision""" precision = int(precision) rounded = (int(number) + precision / 2) // precision * precision return rounded
[ "def", "round_to_int", "(", "number", ",", "precision", ")", ":", "precision", "=", "int", "(", "precision", ")", "rounded", "=", "(", "int", "(", "number", ")", "+", "precision", "/", "2", ")", "//", "precision", "*", "precision", "return", "rounded" ]
https://github.com/Kozea/pygal/blob/8267b03535ff55789a30bf66b798302adad88623/pygal/util.py#L61-L65
materialsproject/fireworks
83a907c19baf2a5c9fdcf63996f9797c3c85b785
fireworks/features/multi_launcher.py
python
rapidfire_process
( fworker, nlaunches, sleep, loglvl, port, node_list, sub_nproc, timeout, running_ids_dict, local_redirect )
Initializes shared data with multiprocessing parameters and starts a rapidfire. Args: fworker (FWorker): object nlaunches (int): 0 means 'until completion', -1 or "infinite" means to loop forever sleep (int): secs to sleep between rapidfire loop iterations loglvl (str): level at whi...
Initializes shared data with multiprocessing parameters and starts a rapidfire.
[ "Initializes", "shared", "data", "with", "multiprocessing", "parameters", "and", "starts", "a", "rapidfire", "." ]
def rapidfire_process( fworker, nlaunches, sleep, loglvl, port, node_list, sub_nproc, timeout, running_ids_dict, local_redirect ): """ Initializes shared data with multiprocessing parameters and starts a rapidfire. Args: fworker (FWorker): object nlaunches (int): 0 means 'until completi...
[ "def", "rapidfire_process", "(", "fworker", ",", "nlaunches", ",", "sleep", ",", "loglvl", ",", "port", ",", "node_list", ",", "sub_nproc", ",", "timeout", ",", "running_ids_dict", ",", "local_redirect", ")", ":", "ds", "=", "DataServer", "(", "address", "="...
https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/features/multi_launcher.py#L57-L119
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/AzureStorageFileShare/Integrations/AzureStorageFileShare/AzureStorageFileShare.py
python
Client.create_directory_request
(self, share_name: str, directory_name: str, directory_path: str = None)
return response
Create a new directory under the specified share or parent directory. Args: share_name (str): Share name. directory_name (str): New directory name. directory_path (str): The path to the directory. Returns: Response: API response from Azure.
Create a new directory under the specified share or parent directory. Args: share_name (str): Share name. directory_name (str): New directory name. directory_path (str): The path to the directory.
[ "Create", "a", "new", "directory", "under", "the", "specified", "share", "or", "parent", "directory", ".", "Args", ":", "share_name", "(", "str", ")", ":", "Share", "name", ".", "directory_name", "(", "str", ")", ":", "New", "directory", "name", ".", "di...
def create_directory_request(self, share_name: str, directory_name: str, directory_path: str = None) -> Response: """ Create a new directory under the specified share or parent directory. Args: share_name (str): Share name. directory_name (str): New directory name. ...
[ "def", "create_directory_request", "(", "self", ",", "share_name", ":", "str", ",", "directory_name", ":", "str", ",", "directory_path", ":", "str", "=", "None", ")", "->", "Response", ":", "params", "=", "assign_params", "(", "restype", "=", "\"directory\"", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/AzureStorageFileShare/Integrations/AzureStorageFileShare/AzureStorageFileShare.py#L103-L127
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/ext/bulkload/bulkloader_config.py
python
create_transformer_classes
(transformer_spec, config_globals, reserve_keys)
return importer_class, exporter_class
Create an importer and exporter class from a transformer spec. Args: transformer_spec: A bulkloader_parser.TransformerEntry. config_globals: Dict to use to reference globals for code in the config. reserve_keys: Method ReserveKeys(keys) which will advance the id sequence in the datastore beyond e...
Create an importer and exporter class from a transformer spec.
[ "Create", "an", "importer", "and", "exporter", "class", "from", "a", "transformer", "spec", "." ]
def create_transformer_classes(transformer_spec, config_globals, reserve_keys): """Create an importer and exporter class from a transformer spec. Args: transformer_spec: A bulkloader_parser.TransformerEntry. config_globals: Dict to use to reference globals for code in the config. reserve_keys: Method R...
[ "def", "create_transformer_classes", "(", "transformer_spec", ",", "config_globals", ",", "reserve_keys", ")", ":", "if", "transformer_spec", ".", "connector", "in", "CONNECTOR_FACTORIES", ":", "connector_factory", "=", "CONNECTOR_FACTORIES", "[", "transformer_spec", ".",...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/bulkload/bulkloader_config.py#L518-L593
msikma/pokesprite
b9cecdbf8ad1610ed0a0a71a1429f38fc818276c
scripts/gen_docs.py
python
determine_form
(slug, form_name, form_data)
return (form_slug_file, form_slug_display, form_alias)
Return two Pokémon form strings: one for display, and one referencing a file
Return two Pokémon form strings: one for display, and one referencing a file
[ "Return", "two", "Pokémon", "form", "strings", ":", "one", "for", "display", "and", "one", "referencing", "a", "file" ]
def determine_form(slug, form_name, form_data): '''Return two Pokémon form strings: one for display, and one referencing a file''' # The regular form is indicated by a '$', and can be an alias of another one. form_value = '' if form_name == '$' else form_name form_alias = form_data.get('is_alias_of', None) fo...
[ "def", "determine_form", "(", "slug", ",", "form_name", ",", "form_data", ")", ":", "# The regular form is indicated by a '$', and can be an alias of another one.", "form_value", "=", "''", "if", "form_name", "==", "'$'", "else", "form_name", "form_alias", "=", "form_data...
https://github.com/msikma/pokesprite/blob/b9cecdbf8ad1610ed0a0a71a1429f38fc818276c/scripts/gen_docs.py#L371-L386
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/mailbox.py
python
_mboxMMDFMessage.remove_flag
(self, flag)
Unset the given string flag(s) without changing others.
Unset the given string flag(s) without changing others.
[ "Unset", "the", "given", "string", "flag", "(", "s", ")", "without", "changing", "others", "." ]
def remove_flag(self, flag): """Unset the given string flag(s) without changing others.""" if 'Status' in self or 'X-Status' in self: self.set_flags(''.join(set(self.get_flags()) - set(flag)))
[ "def", "remove_flag", "(", "self", ",", "flag", ")", ":", "if", "'Status'", "in", "self", "or", "'X-Status'", "in", "self", ":", "self", ".", "set_flags", "(", "''", ".", "join", "(", "set", "(", "self", ".", "get_flags", "(", ")", ")", "-", "set",...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/mailbox.py#L1638-L1641
Gandi/gandi.cli
5de0605126247e986f8288b467a52710a78e1794
gandi/cli/commands/oper.py
python
list
(gandi, limit, step)
return result
List operations.
List operations.
[ "List", "operations", "." ]
def list(gandi, limit, step): """List operations.""" output_keys = ['id', 'type', 'step'] options = { 'step': step, 'items_per_page': limit, 'sort_by': 'date_created DESC' } result = gandi.oper.list(options) for num, oper in enumerate(reversed(result)): if num: ...
[ "def", "list", "(", "gandi", ",", "limit", ",", "step", ")", ":", "output_keys", "=", "[", "'id'", ",", "'type'", ",", "'step'", "]", "options", "=", "{", "'step'", ":", "step", ",", "'items_per_page'", ":", "limit", ",", "'sort_by'", ":", "'date_creat...
https://github.com/Gandi/gandi.cli/blob/5de0605126247e986f8288b467a52710a78e1794/gandi/cli/commands/oper.py#L23-L39
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/lib/base.py
python
OpenShiftCLI._create
(self, fname)
return self.openshift_cmd(['create', '-f', fname])
call oc create on a filename
call oc create on a filename
[ "call", "oc", "create", "on", "a", "filename" ]
def _create(self, fname): '''call oc create on a filename''' return self.openshift_cmd(['create', '-f', fname])
[ "def", "_create", "(", "self", ",", "fname", ")", ":", "return", "self", ".", "openshift_cmd", "(", "[", "'create'", ",", "'-f'", ",", "fname", "]", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/lib/base.py#L112-L114
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/ex-submodules/casexml/apps/case/xform.py
python
process_cases_with_casedb
(xforms, case_db)
return case_processing_result
[]
def process_cases_with_casedb(xforms, case_db): case_processing_result = _get_or_update_cases(xforms, case_db) cases = case_processing_result.cases xform = xforms[0] _update_sync_logs(xform, cases) try: cases_received.send(sender=None, xform=xform, cases=cases) except Exception as e: ...
[ "def", "process_cases_with_casedb", "(", "xforms", ",", "case_db", ")", ":", "case_processing_result", "=", "_get_or_update_cases", "(", "xforms", ",", "case_db", ")", "cases", "=", "case_processing_result", ".", "cases", "xform", "=", "xforms", "[", "0", "]", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/casexml/apps/case/xform.py#L36-L58
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py
python
HTTPResponse._decode
(self, data, decode_content, flush_decoder)
return data
Decode the data passed in and potentially flush the decoder.
Decode the data passed in and potentially flush the decoder.
[ "Decode", "the", "data", "passed", "in", "and", "potentially", "flush", "the", "decoder", "." ]
def _decode(self, data, decode_content, flush_decoder): """ Decode the data passed in and potentially flush the decoder. """ try: if decode_content and self._decoder: data = self._decoder.decompress(data) except (IOError, zlib.error) as e: ...
[ "def", "_decode", "(", "self", ",", "data", ",", "decode_content", ",", "flush_decoder", ")", ":", "try", ":", "if", "decode_content", "and", "self", ".", "_decoder", ":", "data", "=", "self", ".", "_decoder", ".", "decompress", "(", "data", ")", "except...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py#L186-L203
bslatkin/effectivepython
4ae6f3141291ea137eb29a245bf889dbc8091713
example_code/item_73.py
python
heap_overdue_benchmark
(count)
return print_results(count, tests)
[]
def heap_overdue_benchmark(count): def prepare(): to_add = list(range(count)) random.shuffle(to_add) return [], to_add def run(queue, to_add): for i in to_add: heappush(queue, i) while queue: heappop(queue) tests = timeit.repeat( setu...
[ "def", "heap_overdue_benchmark", "(", "count", ")", ":", "def", "prepare", "(", ")", ":", "to_add", "=", "list", "(", "range", "(", "count", ")", ")", "random", ".", "shuffle", "(", "to_add", ")", "return", "[", "]", ",", "to_add", "def", "run", "(",...
https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_73.py#L291-L310