nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/modules/storage/partitioning/base_partitioning.py
python
PartitioningTask._handle_storage_error
(self, exception, message)
Handle the storage error. :param exception: an exception to handle :param message: an error message to use :raise: StorageConfigurationError
Handle the storage error.
[ "Handle", "the", "storage", "error", "." ]
def _handle_storage_error(self, exception, message): """Handle the storage error. :param exception: an exception to handle :param message: an error message to use :raise: StorageConfigurationError """ log.error("Storage configuration has failed: %s", message) # ...
[ "def", "_handle_storage_error", "(", "self", ",", "exception", ",", "message", ")", ":", "log", ".", "error", "(", "\"Storage configuration has failed: %s\"", ",", "message", ")", "# Reset the boot loader configuration.", "# FIXME: Handle the boot loader reset in a better way."...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/storage/partitioning/base_partitioning.py#L70-L83
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/collections/__init__.py
python
Counter.update
(*args, **kwds)
Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch') >>> c.update(d) ...
Like dict.update() but add counts instead of replacing them.
[ "Like", "dict", ".", "update", "()", "but", "add", "counts", "instead", "of", "replacing", "them", "." ]
def update(*args, **kwds): '''Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch'...
[ "def", "update", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "# The regular dict.update() operation makes no sense here because the", "# replace behavior results in the some of original untouched counts", "# being mixed-in with all of the other counts for a mismash that", "# doesn...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/collections/__init__.py#L584-L622
zestedesavoir/zds-site
2ba922223c859984a413cc6c108a8aa4023b113e
zds/tutorialv2/managers.py
python
PublishedContentManager.__get_list
(self, subcategories=None, tags=None, content_type=None, with_comments_count=True)
return queryset
:param subcategories: subcategories, filters with OR :type subcategories: list of zds.utils.models.SubCategory :param tags: tags, filters with AND :type tags: list of zds.utils.models.Tag :param content_type: type of content, filters with OR :type content_type: list of str ...
:param subcategories: subcategories, filters with OR :type subcategories: list of zds.utils.models.SubCategory :param tags: tags, filters with AND :type tags: list of zds.utils.models.Tag :param content_type: type of content, filters with OR :type content_type: list of str ...
[ ":", "param", "subcategories", ":", "subcategories", "filters", "with", "OR", ":", "type", "subcategories", ":", "list", "of", "zds", ".", "utils", ".", "models", ".", "SubCategory", ":", "param", "tags", ":", "tags", "filters", "with", "AND", ":", "type",...
def __get_list(self, subcategories=None, tags=None, content_type=None, with_comments_count=True): """ :param subcategories: subcategories, filters with OR :type subcategories: list of zds.utils.models.SubCategory :param tags: tags, filters with AND :type tags: list of zds.utils.m...
[ "def", "__get_list", "(", "self", ",", "subcategories", "=", "None", ",", "tags", "=", "None", ",", "content_type", "=", "None", ",", "with_comments_count", "=", "True", ")", ":", "queryset", "=", "self", ".", "filter", "(", "must_redirect", "=", "False", ...
https://github.com/zestedesavoir/zds-site/blob/2ba922223c859984a413cc6c108a8aa4023b113e/zds/tutorialv2/managers.py#L11-L63
OpenXenManager/openxenmanager
1cb5c1cb13358ba584856e99a94f9669d17670ff
src/OXM/window_menuitem.py
python
oxcWindowMenuItem.on_m_add_to_pool_activate
(self, widget, data=None)
Called from "Add To pool" menuitem (server)
Called from "Add To pool" menuitem (server)
[ "Called", "from", "Add", "To", "pool", "menuitem", "(", "server", ")" ]
def on_m_add_to_pool_activate(self, widget, data=None): """ Called from "Add To pool" menuitem (server) """ for i in range(2, len(self.builder.get_object("menu_add_to_pool").get_children())): self.builder.get_object("menu_add_to_pool").remove( self.builder.get...
[ "def", "on_m_add_to_pool_activate", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "for", "i", "in", "range", "(", "2", ",", "len", "(", "self", ".", "builder", ".", "get_object", "(", "\"menu_add_to_pool\"", ")", ".", "get_children", "(...
https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_menuitem.py#L172-L194
wakatime/legacy-python-cli
9b64548b16ab5ef16603d9a6c2620a16d0df8d46
wakatime/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.__init__
(self, *args, **kwds)
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
[ "Initialize", "an", "ordered", "dictionary", ".", "Signature", "is", "the", "same", "as", "for", "regular", "dictionaries", "but", "keyword", "arguments", "are", "not", "recommended", "because", "their", "insertion", "order", "is", "arbitrary", "." ]
def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "raise", "TypeError", "(", "'expected at most 1 arguments, got %d'", "%", "len", "(", "args", ")", ")", "try", ":", "self...
https://github.com/wakatime/legacy-python-cli/blob/9b64548b16ab5ef16603d9a6c2620a16d0df8d46/wakatime/packages/urllib3/packages/ordered_dict.py#L28-L42
serge-sans-paille/pythran
f9f73aa5a965adc4ebcb91a439784dbe9ef911fa
docs/papers/sc2013/bench/pythran/matmul.py
python
matrix_multiply
(m0, m1)
return new_matrix
omp parallel for private(i,j,k,r)
omp parallel for private(i,j,k,r)
[ "omp", "parallel", "for", "private", "(", "i", "j", "k", "r", ")" ]
def matrix_multiply(m0, m1): new_matrix = numpy.zeros((m0.shape[0],m1.shape[1])) "omp parallel for private(i,j,k,r)" for i in xrange(m0.shape[0]): for j in xrange(m1.shape[1]): r=0 for k in xrange(m1.shape[0]): r += m0[i,k]*m1[k,j] new_matrix[i,j]=...
[ "def", "matrix_multiply", "(", "m0", ",", "m1", ")", ":", "new_matrix", "=", "numpy", ".", "zeros", "(", "(", "m0", ".", "shape", "[", "0", "]", ",", "m1", ".", "shape", "[", "1", "]", ")", ")", "for", "i", "in", "xrange", "(", "m0", ".", "sh...
https://github.com/serge-sans-paille/pythran/blob/f9f73aa5a965adc4ebcb91a439784dbe9ef911fa/docs/papers/sc2013/bench/pythran/matmul.py#L4-L13
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/abstract/abstractscene.py
python
AbstractScene.worldLayer
(self)
return None
\remarks [virtual] returns the base world layer for the scene \return <cross3d.SceneLayer> || None
\remarks [virtual] returns the base world layer for the scene \return <cross3d.SceneLayer> || None
[ "\\", "remarks", "[", "virtual", "]", "returns", "the", "base", "world", "layer", "for", "the", "scene", "\\", "return", "<cross3d", ".", "SceneLayer", ">", "||", "None" ]
def worldLayer(self): """ \remarks [virtual] returns the base world layer for the scene \return <cross3d.SceneLayer> || None """ lay = self._nativeWorldLayer() if (lay): from cross3d import SceneLayer return SceneLayer(self, lay) return None
[ "def", "worldLayer", "(", "self", ")", ":", "lay", "=", "self", ".", "_nativeWorldLayer", "(", ")", "if", "(", "lay", ")", ":", "from", "cross3d", "import", "SceneLayer", "return", "SceneLayer", "(", "self", ",", "lay", ")", "return", "None" ]
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/abstract/abstractscene.py#L2517-L2526
A-bone1/Attention-ocr-Chinese-Version
a08d4e587e73bb013cd22eadae250dbbf9cff7d4
python/metrics.py
python
char_accuracy
(predictions, targets, rej_char, streaming=False)
Computes character level accuracy. Both predictions and targets should have the same shape [batch_size x seq_length]. Args: predictions: predicted characters ids. targets: ground truth character ids. rej_char: the character id used to mark an empty element (end of sequence). streaming: if True, ...
Computes character level accuracy.
[ "Computes", "character", "level", "accuracy", "." ]
def char_accuracy(predictions, targets, rej_char, streaming=False): """Computes character level accuracy. Both predictions and targets should have the same shape [batch_size x seq_length]. Args: predictions: predicted characters ids. targets: ground truth character ids. rej_char: the character id ...
[ "def", "char_accuracy", "(", "predictions", ",", "targets", ",", "rej_char", ",", "streaming", "=", "False", ")", ":", "with", "tf", ".", "variable_scope", "(", "'CharAccuracy'", ")", ":", "predictions", ".", "get_shape", "(", ")", ".", "assert_is_compatible_w...
https://github.com/A-bone1/Attention-ocr-Chinese-Version/blob/a08d4e587e73bb013cd22eadae250dbbf9cff7d4/python/metrics.py#L21-L50
Aceinna/gnss-ins-sim
e8a0495af21c12628cdf106a7c54a0fc7bd0b12a
gnss_ins_sim/attitude/attitude.py
python
rot_y
(angle)
return ry
Coordinate transformation matrix from the original frame to the frame after rotation when rotating about y axis Args: angle: rotation angle, rad Returns: ry: 3x3 orthogonal matrix
Coordinate transformation matrix from the original frame to the frame after rotation when rotating about y axis Args: angle: rotation angle, rad Returns: ry: 3x3 orthogonal matrix
[ "Coordinate", "transformation", "matrix", "from", "the", "original", "frame", "to", "the", "frame", "after", "rotation", "when", "rotating", "about", "y", "axis", "Args", ":", "angle", ":", "rotation", "angle", "rad", "Returns", ":", "ry", ":", "3x3", "ortho...
def rot_y(angle): """ Coordinate transformation matrix from the original frame to the frame after rotation when rotating about y axis Args: angle: rotation angle, rad Returns: ry: 3x3 orthogonal matrix """ sangle = math.sin(angle) cangle = math.cos(angle) ry = np.arra...
[ "def", "rot_y", "(", "angle", ")", ":", "sangle", "=", "math", ".", "sin", "(", "angle", ")", "cangle", "=", "math", ".", "cos", "(", "angle", ")", "ry", "=", "np", ".", "array", "(", "[", "[", "cangle", ",", "0.0", ",", "-", "sangle", "]", "...
https://github.com/Aceinna/gnss-ins-sim/blob/e8a0495af21c12628cdf106a7c54a0fc7bd0b12a/gnss_ins_sim/attitude/attitude.py#L633-L647
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/UpdateEntriesBySearch/Scripts/MarkAsNoteBySearch/MarkAsNoteBySearch.py
python
iterate_entries
(incident_id: Optional[str], query_filter: Dict[str, Any], entry_filter: Optional[EntryFilter] = None)
Iterate war room entries :param incident_id: The incident ID to search entries from. :param query_filter: Filters to search entries. :param entry_filter: Filters to filter entries. :return: An iterator to retrieve entries.
Iterate war room entries
[ "Iterate", "war", "room", "entries" ]
def iterate_entries(incident_id: Optional[str], query_filter: Dict[str, Any], entry_filter: Optional[EntryFilter] = None) -> Iterator[Entry]: """ Iterate war room entries :param incident_id: The incident ID to search entries from. :param query_filter: Filters to search entries. ...
[ "def", "iterate_entries", "(", "incident_id", ":", "Optional", "[", "str", "]", ",", "query_filter", ":", "Dict", "[", "str", ",", "Any", "]", ",", "entry_filter", ":", "Optional", "[", "EntryFilter", "]", "=", "None", ")", "->", "Iterator", "[", "Entry"...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/UpdateEntriesBySearch/Scripts/MarkAsNoteBySearch/MarkAsNoteBySearch.py#L120-L163
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/network/iputil.py
python
is_valid_ipv6
(ip)
return True
Return True if given ip is a valid IPv6 address.
Return True if given ip is a valid IPv6 address.
[ "Return", "True", "if", "given", "ip", "is", "a", "valid", "IPv6", "address", "." ]
def is_valid_ipv6 (ip): """ Return True if given ip is a valid IPv6 address. """ # XXX this is not complete: check ipv6 and ipv4 semantics too here if not (_ipv6_re.match(ip) or _ipv6_ipv4_re.match(ip) or _ipv6_abbr_re.match(ip) or _ipv6_ipv4_abbr_re.match(ip)): return False ...
[ "def", "is_valid_ipv6", "(", "ip", ")", ":", "# XXX this is not complete: check ipv6 and ipv4 semantics too here", "if", "not", "(", "_ipv6_re", ".", "match", "(", "ip", ")", "or", "_ipv6_ipv4_re", ".", "match", "(", "ip", ")", "or", "_ipv6_abbr_re", ".", "match",...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/network/iputil.py#L114-L122
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/multiprocessing/connection.py
python
_ConnectionBase.recv_bytes
(self, maxlength=None)
return buf.getvalue()
Receive bytes data as a bytes object.
Receive bytes data as a bytes object.
[ "Receive", "bytes", "data", "as", "a", "bytes", "object", "." ]
def recv_bytes(self, maxlength=None): """ Receive bytes data as a bytes object. """ self._check_closed() self._check_readable() if maxlength is not None and maxlength < 0: raise ValueError("negative maxlength") buf = self._recv_bytes(maxlength) ...
[ "def", "recv_bytes", "(", "self", ",", "maxlength", "=", "None", ")", ":", "self", ".", "_check_closed", "(", ")", "self", ".", "_check_readable", "(", ")", "if", "maxlength", "is", "not", "None", "and", "maxlength", "<", "0", ":", "raise", "ValueError",...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/multiprocessing/connection.py#L208-L219
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/types/misc.py
python
Omitted.value
(self)
return self._value
[]
def value(self): return self._value
[ "def", "value", "(", "self", ")", ":", "return", "self", ".", "_value" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/types/misc.py#L102-L103
mechboxes/mech
2f74584670715e5c67442dd057ca10709f7e6712
mech/vmrun.py
python
VMrun.suspend
(self, mode='soft', quiet=False)
return self.vmrun('suspend', self.vmx_file, mode, quiet=quiet)
Suspend a VM or Team
Suspend a VM or Team
[ "Suspend", "a", "VM", "or", "Team" ]
def suspend(self, mode='soft', quiet=False): '''Suspend a VM or Team''' return self.vmrun('suspend', self.vmx_file, mode, quiet=quiet)
[ "def", "suspend", "(", "self", ",", "mode", "=", "'soft'", ",", "quiet", "=", "False", ")", ":", "return", "self", ".", "vmrun", "(", "'suspend'", ",", "self", ".", "vmx_file", ",", "mode", ",", "quiet", "=", "quiet", ")" ]
https://github.com/mechboxes/mech/blob/2f74584670715e5c67442dd057ca10709f7e6712/mech/vmrun.py#L186-L188
djblets/djblets
0496e1ec49e43d43d776768c9fc5b6f8af56ec2c
djblets/datagrid/grids.py
python
Column.setup_state
(self, state)
Set up any state that may be needed for the column. This is called once per column per datagrid instance. By default, no additional state is set up. Subclasses can override this to set any variables they may need. Args: state (StatefulColumn): The state for...
Set up any state that may be needed for the column.
[ "Set", "up", "any", "state", "that", "may", "be", "needed", "for", "the", "column", "." ]
def setup_state(self, state): """Set up any state that may be needed for the column. This is called once per column per datagrid instance. By default, no additional state is set up. Subclasses can override this to set any variables they may need. Args: state (State...
[ "def", "setup_state", "(", "self", ",", "state", ")", ":", "pass" ]
https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/datagrid/grids.py#L239-L251
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/distlib/metadata.py
python
Metadata.name_and_version
(self)
return _get_name_and_version(self.name, self.version, True)
[]
def name_and_version(self): return _get_name_and_version(self.name, self.version, True)
[ "def", "name_and_version", "(", "self", ")", ":", "return", "_get_name_and_version", "(", "self", ".", "name", ",", "self", ".", "version", ",", "True", ")" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/distlib/metadata.py#L804-L805
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/twitter/api.py
python
Api.GetFriendIDs
(self, user_id=None, screen_name=None, cursor=None, count=None, stringify_ids=False, total_count=None)
return self._GetFriendFollowerIDs(url, user_id, screen_name, cursor, count, stringify_ids, ...
Fetch a sequence of user ids, one for each friend. Returns a list of all the given user's friends' IDs. If no user_id or screen_name is given, the friends will be those of the authenticated user. Args: user_id: The id of the user to retrieve the id list for. [Optio...
Fetch a sequence of user ids, one for each friend. Returns a list of all the given user's friends' IDs. If no user_id or screen_name is given, the friends will be those of the authenticated user.
[ "Fetch", "a", "sequence", "of", "user", "ids", "one", "for", "each", "friend", ".", "Returns", "a", "list", "of", "all", "the", "given", "user", "s", "friends", "IDs", ".", "If", "no", "user_id", "or", "screen_name", "is", "given", "the", "friends", "w...
def GetFriendIDs(self, user_id=None, screen_name=None, cursor=None, count=None, stringify_ids=False, total_count=None): """ Fetch a sequence of user ids, one for each friend. Ret...
[ "def", "GetFriendIDs", "(", "self", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ",", "cursor", "=", "None", ",", "count", "=", "None", ",", "stringify_ids", "=", "False", ",", "total_count", "=", "None", ")", ":", "url", "=", "'%s/fri...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/twitter/api.py#L2392-L2434
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/backends/DatabaseChooser.py
python
DatabaseChooser.change_db_cb
(self, *args)
[]
def change_db_cb (self, *args): self.current_db = None text = cb.cb_get_active_text(self.dbComboBox) if not text: return for db in self.possible_dbs: if text.lower().find(db.lower()) >= 0: self.current_db = db break if self....
[ "def", "change_db_cb", "(", "self", ",", "*", "args", ")", ":", "self", ".", "current_db", "=", "None", "text", "=", "cb", ".", "cb_get_active_text", "(", "self", ".", "dbComboBox", ")", "if", "not", "text", ":", "return", "for", "db", "in", "self", ...
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/backends/DatabaseChooser.py#L80-L102
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/number_field/number_field.py
python
NumberField_generic.change_generator
(self, alpha, name=None, names=None)
return K, from_K, to_K
r""" Given the number field self, construct another isomorphic number field `K` generated by the element alpha of self, along with isomorphisms from `K` to self and from self to `K`. EXAMPLES:: sage: L.<i> = NumberField(x^2 + 1); L Number Field in i with...
r""" Given the number field self, construct another isomorphic number field `K` generated by the element alpha of self, along with isomorphisms from `K` to self and from self to `K`.
[ "r", "Given", "the", "number", "field", "self", "construct", "another", "isomorphic", "number", "field", "K", "generated", "by", "the", "element", "alpha", "of", "self", "along", "with", "isomorphisms", "from", "K", "to", "self", "and", "from", "self", "to",...
def change_generator(self, alpha, name=None, names=None): r""" Given the number field self, construct another isomorphic number field `K` generated by the element alpha of self, along with isomorphisms from `K` to self and from self to `K`. EXAMPLES:: sage: ...
[ "def", "change_generator", "(", "self", ",", "alpha", ",", "name", "=", "None", ",", "names", "=", "None", ")", ":", "if", "names", "is", "not", "None", ":", "name", "=", "names", "alpha", "=", "self", "(", "alpha", ")", "K", ",", "from_K", "=", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/number_field.py#L2310-L2377
pkumza/LibRadar
2fa3891123e5fd97d631fbe14bf029714c328ca3
LibRadar/lib_tagging.py
python
Tagger.get_potential_list
(self)
return self.features
[]
def get_potential_list(self): logger.debug("Searching in database. Need a few seconds.") # Yeah, use 'keys' function may block a while, but lib_tagging.py is designed for professional use only. # Up to now, do not like to support multi-threading. f_cnt = self.db.hgetall(name=DB_FEATURE_...
[ "def", "get_potential_list", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Searching in database. Need a few seconds.\"", ")", "# Yeah, use 'keys' function may block a while, but lib_tagging.py is designed for professional use only.", "# Up to now, do not like to support multi-thr...
https://github.com/pkumza/LibRadar/blob/2fa3891123e5fd97d631fbe14bf029714c328ca3/LibRadar/lib_tagging.py#L74-L94
nasa-jpl-memex/memex-explorer
d2910496238359b3676b4467721017fc82f0b324
source/apps/crawl_space/views.py
python
DeleteCrawlView.get_object
(self)
return Crawl.objects.get(project=self.get_project(), slug=self.kwargs['crawl_slug'])
[]
def get_object(self): return Crawl.objects.get(project=self.get_project(), slug=self.kwargs['crawl_slug'])
[ "def", "get_object", "(", "self", ")", ":", "return", "Crawl", ".", "objects", ".", "get", "(", "project", "=", "self", ".", "get_project", "(", ")", ",", "slug", "=", "self", ".", "kwargs", "[", "'crawl_slug'", "]", ")" ]
https://github.com/nasa-jpl-memex/memex-explorer/blob/d2910496238359b3676b4467721017fc82f0b324/source/apps/crawl_space/views.py#L324-L326
sqlmapproject/sqlmap
3b07b70864624dff4c29dcaa8a61c78e7f9189f7
thirdparty/clientform/clientform.py
python
ListControl.set_single
(self, selected, by_label=None)
Deprecated: set the selection of the single item in this control. Raises ItemCountError if the control does not contain only one item. by_label argument is ignored, and included only for backwards compatibility.
Deprecated: set the selection of the single item in this control.
[ "Deprecated", ":", "set", "the", "selection", "of", "the", "single", "item", "in", "this", "control", "." ]
def set_single(self, selected, by_label=None): """Deprecated: set the selection of the single item in this control. Raises ItemCountError if the control does not contain only one item. by_label argument is ignored, and included only for backwards compatibility. """ dep...
[ "def", "set_single", "(", "self", ",", "selected", ",", "by_label", "=", "None", ")", ":", "deprecation", "(", "\"control.items[0].selected = <boolean>\"", ")", "if", "len", "(", "self", ".", "items", ")", "!=", "1", ":", "raise", "ItemCountError", "(", "\"'...
https://github.com/sqlmapproject/sqlmap/blob/3b07b70864624dff4c29dcaa8a61c78e7f9189f7/thirdparty/clientform/clientform.py#L1967-L1981
LMFDB/lmfdb
6cf48a4c18a96e6298da6ae43f587f96845bcb43
lmfdb/verify/mf_newspaces.py
python
mf_newspaces.check_box_count
(self)
return accumulate_failures(self.check_count(box['newspace_count'], self._box_query(box)) for box in db.mf_boxes.search())
there should be exactly one row for every newspace in mf_boxes; for each box performing mf_newspaces.count(box query) should match newspace_count for box, and mf_newspaces.count() should be the sum of these
there should be exactly one row for every newspace in mf_boxes; for each box performing mf_newspaces.count(box query) should match newspace_count for box, and mf_newspaces.count() should be the sum of these
[ "there", "should", "be", "exactly", "one", "row", "for", "every", "newspace", "in", "mf_boxes", ";", "for", "each", "box", "performing", "mf_newspaces", ".", "count", "(", "box", "query", ")", "should", "match", "newspace_count", "for", "box", "and", "mf_new...
def check_box_count(self): """ there should be exactly one row for every newspace in mf_boxes; for each box performing mf_newspaces.count(box query) should match newspace_count for box, and mf_newspaces.count() should be the sum of these """ # TIME about 20s ...
[ "def", "check_box_count", "(", "self", ")", ":", "# TIME about 20s", "return", "accumulate_failures", "(", "self", ".", "check_count", "(", "box", "[", "'newspace_count'", "]", ",", "self", ".", "_box_query", "(", "box", ")", ")", "for", "box", "in", "db", ...
https://github.com/LMFDB/lmfdb/blob/6cf48a4c18a96e6298da6ae43f587f96845bcb43/lmfdb/verify/mf_newspaces.py#L40-L49
abhisharma404/vault
0303cf425f028ce38cfaf40640d625861b7c805a
src/lib/others/info_gathering/finder/finding_comment.py
python
FindingComments.find_comment
(self)
[]
def find_comment(self): source_code = self.get_soure_code() for comment in self.comment_list: comments = re.findall(comment, source_code) self.found_comments[comment] = comments
[ "def", "find_comment", "(", "self", ")", ":", "source_code", "=", "self", ".", "get_soure_code", "(", ")", "for", "comment", "in", "self", ".", "comment_list", ":", "comments", "=", "re", ".", "findall", "(", "comment", ",", "source_code", ")", "self", "...
https://github.com/abhisharma404/vault/blob/0303cf425f028ce38cfaf40640d625861b7c805a/src/lib/others/info_gathering/finder/finding_comment.py#L20-L24
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/users_entity.py
python
UsersEntity.generated
(self)
return self._generated
Gets the generated of this UsersEntity. When this content was generated. :return: The generated of this UsersEntity. :rtype: str
Gets the generated of this UsersEntity. When this content was generated.
[ "Gets", "the", "generated", "of", "this", "UsersEntity", ".", "When", "this", "content", "was", "generated", "." ]
def generated(self): """ Gets the generated of this UsersEntity. When this content was generated. :return: The generated of this UsersEntity. :rtype: str """ return self._generated
[ "def", "generated", "(", "self", ")", ":", "return", "self", ".", "_generated" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/users_entity.py#L57-L65
dmishin/tsp-solver
e743b7c3b225cdd279fb9f906422b056e713fb5f
tsp_solver/greedy_numpy.py
python
pairs_by_dist_np
(N, distances)
return pairs[["f1","f2"]]
optimized version of pairs_by_dist, using numpy
optimized version of pairs_by_dist, using numpy
[ "optimized", "version", "of", "pairs_by_dist", "using", "numpy" ]
def pairs_by_dist_np(N, distances): """optimized version of pairs_by_dist, using numpy""" pairs = numpy.zeros( (N*(N-1)//2, ), dtype=('f4, i2, i2') ) idx = 0 for i in xrange(N): row_size = i dist_i = distances[i] pairs[idx:(idx+row_size)] = [ (dist_i[j], i, j) ...
[ "def", "pairs_by_dist_np", "(", "N", ",", "distances", ")", ":", "pairs", "=", "numpy", ".", "zeros", "(", "(", "N", "*", "(", "N", "-", "1", ")", "//", "2", ",", ")", ",", "dtype", "=", "(", "'f4, i2, i2'", ")", ")", "idx", "=", "0", "for", ...
https://github.com/dmishin/tsp-solver/blob/e743b7c3b225cdd279fb9f906422b056e713fb5f/tsp_solver/greedy_numpy.py#L11-L23
ShreyAmbesh/Traffic-Rule-Violation-Detection-System
ae0c327ce014ce6a427da920b5798a0d4bbf001e
inputs.py
python
create_eval_input_fn
(eval_config, eval_input_config, model_config)
return _eval_input_fn
Creates an eval `input` function for `Estimator`. Args: eval_config: An eval_pb2.EvalConfig. eval_input_config: An input_reader_pb2.InputReader. model_config: A model_pb2.DetectionModel. Returns: `input_fn` for `Estimator` in EVAL mode.
Creates an eval `input` function for `Estimator`.
[ "Creates", "an", "eval", "input", "function", "for", "Estimator", "." ]
def create_eval_input_fn(eval_config, eval_input_config, model_config): """Creates an eval `input` function for `Estimator`. Args: eval_config: An eval_pb2.EvalConfig. eval_input_config: An input_reader_pb2.InputReader. model_config: A model_pb2.DetectionModel. Returns: `input_fn` for `Estimator...
[ "def", "create_eval_input_fn", "(", "eval_config", ",", "eval_input_config", ",", "model_config", ")", ":", "def", "_eval_input_fn", "(", "params", "=", "None", ")", ":", "\"\"\"Returns `features` and `labels` tensor dictionaries for evaluation.\n\n Args:\n params: Parame...
https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/inputs.py#L273-L389
sripathikrishnan/redis-rdb-tools
548b11ec3c81a603f5b321228d07a61a0b940159
rdbtools/callbacks.py
python
_unix_timestamp
(dt)
return calendar.timegm(dt.utctimetuple())
[]
def _unix_timestamp(dt): return calendar.timegm(dt.utctimetuple())
[ "def", "_unix_timestamp", "(", "dt", ")", ":", "return", "calendar", ".", "timegm", "(", "dt", ".", "utctimetuple", "(", ")", ")" ]
https://github.com/sripathikrishnan/redis-rdb-tools/blob/548b11ec3c81a603f5b321228d07a61a0b940159/rdbtools/callbacks.py#L361-L362
rll/rllab
ba78e4c16dc492982e648f117875b22af3965579
sandbox/rocky/tf/optimizers/conjugate_gradient_optimizer.py
python
ConjugateGradientOptimizer.update_opt
(self, loss, target, leq_constraint, inputs, extra_inputs=None, constraint_name="constraint", *args, **kwargs)
:param loss: Symbolic expression for the loss function. :param target: A parameterized object to optimize over. It should implement methods of the :class:`rllab.core.paramerized.Parameterized` class. :param leq_constraint: A constraint provided as a tuple (f, epsilon), of the form f(*inputs) <= ...
:param loss: Symbolic expression for the loss function. :param target: A parameterized object to optimize over. It should implement methods of the :class:`rllab.core.paramerized.Parameterized` class. :param leq_constraint: A constraint provided as a tuple (f, epsilon), of the form f(*inputs) <= ...
[ ":", "param", "loss", ":", "Symbolic", "expression", "for", "the", "loss", "function", ".", ":", "param", "target", ":", "A", "parameterized", "object", "to", "optimize", "over", ".", "It", "should", "implement", "methods", "of", "the", ":", "class", ":", ...
def update_opt(self, loss, target, leq_constraint, inputs, extra_inputs=None, constraint_name="constraint", *args, **kwargs): """ :param loss: Symbolic expression for the loss function. :param target: A parameterized object to optimize over. It should implement methods of the ...
[ "def", "update_opt", "(", "self", ",", "loss", ",", "target", ",", "leq_constraint", ",", "inputs", ",", "extra_inputs", "=", "None", ",", "constraint_name", "=", "\"constraint\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "inputs", "=", "tupl...
https://github.com/rll/rllab/blob/ba78e4c16dc492982e648f117875b22af3965579/sandbox/rocky/tf/optimizers/conjugate_gradient_optimizer.py#L166-L222
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/elements.py
python
UnaryExpression._order_by_label_element
(self)
[]
def _order_by_label_element(self): if self.modifier in (operators.desc_op, operators.asc_op): return self.element._order_by_label_element else: return None
[ "def", "_order_by_label_element", "(", "self", ")", ":", "if", "self", ".", "modifier", "in", "(", "operators", ".", "desc_op", ",", "operators", ".", "asc_op", ")", ":", "return", "self", ".", "element", ".", "_order_by_label_element", "else", ":", "return"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/elements.py#L2779-L2783
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py
python
ElasticsearchSearchBackend.add_type
(self, model)
[]
def add_type(self, model): self.get_index_for_model(model).add_model(model)
[ "def", "add_type", "(", "self", ",", "model", ")", ":", "self", ".", "get_index_for_model", "(", "model", ")", ".", "add_model", "(", "model", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py#L799-L800
nipreps/mriqc
ad8813035136acc1a80c96ac1fbbdde1d82b14ee
mriqc/interfaces/anatomical.py
python
artifact_mask
(imdata, airdata, distance, zscore=10.0)
return qi1_img
Computes a mask of artifacts found in the air region
Computes a mask of artifacts found in the air region
[ "Computes", "a", "mask", "of", "artifacts", "found", "in", "the", "air", "region" ]
def artifact_mask(imdata, airdata, distance, zscore=10.0): """Computes a mask of artifacts found in the air region""" from statsmodels.robust.scale import mad if not np.issubdtype(airdata.dtype, np.integer): airdata[airdata < 0.95] = 0 airdata[airdata > 0.0] = 1 bg_img = imdata * airda...
[ "def", "artifact_mask", "(", "imdata", ",", "airdata", ",", "distance", ",", "zscore", "=", "10.0", ")", ":", "from", "statsmodels", ".", "robust", ".", "scale", "import", "mad", "if", "not", "np", ".", "issubdtype", "(", "airdata", ".", "dtype", ",", ...
https://github.com/nipreps/mriqc/blob/ad8813035136acc1a80c96ac1fbbdde1d82b14ee/mriqc/interfaces/anatomical.py#L455-L485
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/api/datastore.py
python
IsInTransaction
()
return isinstance(_GetConnection(), datastore_rpc.TransactionalConnection)
Determine whether already running in transaction. Returns: True if already running in transaction, else False.
Determine whether already running in transaction.
[ "Determine", "whether", "already", "running", "in", "transaction", "." ]
def IsInTransaction(): """Determine whether already running in transaction. Returns: True if already running in transaction, else False. """ return isinstance(_GetConnection(), datastore_rpc.TransactionalConnection)
[ "def", "IsInTransaction", "(", ")", ":", "return", "isinstance", "(", "_GetConnection", "(", ")", ",", "datastore_rpc", ".", "TransactionalConnection", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/datastore.py#L2681-L2688
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/item_access_token_invalidate_request.py
python
ItemAccessTokenInvalidateRequest.openapi_types
()
return { 'access_token': (str,), # noqa: E501 'client_id': (str,), # noqa: E501 'secret': (str,), # noqa: E501 }
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
[ "This", "must", "be", "a", "method", "because", "a", "model", "may", "have", "properties", "that", "are", "of", "type", "self", "this", "must", "run", "after", "the", "class", "is", "loaded" ]
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ retu...
[ "def", "openapi_types", "(", ")", ":", "return", "{", "'access_token'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'client_id'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'secret'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "}" ]
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/item_access_token_invalidate_request.py#L63-L76
materialsproject/fireworks
83a907c19baf2a5c9fdcf63996f9797c3c85b785
fireworks/core/firework.py
python
Firework.state
(self, state)
Setter for the the FW state, which triggers updated_on change Args: state (str): the state to set for the FW
Setter for the the FW state, which triggers updated_on change
[ "Setter", "for", "the", "the", "FW", "state", "which", "triggers", "updated_on", "change" ]
def state(self, state): """ Setter for the the FW state, which triggers updated_on change Args: state (str): the state to set for the FW """ self._state = state self.updated_on = datetime.utcnow()
[ "def", "state", "(", "self", ",", "state", ")", ":", "self", ".", "_state", "=", "state", "self", ".", "updated_on", "=", "datetime", ".", "utcnow", "(", ")" ]
https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/core/firework.py#L303-L311
prody/ProDy
b24bbf58aa8fffe463c8548ae50e3955910e5b7f
prody/atomic/subset.py
python
AtomSubset.iterAtoms
(self)
Yield atoms.
Yield atoms.
[ "Yield", "atoms", "." ]
def iterAtoms(self): """Yield atoms.""" ag = self._ag acsi = self.getACSIndex() for index in self._indices: yield Atom(ag=ag, index=index, acsi=acsi)
[ "def", "iterAtoms", "(", "self", ")", ":", "ag", "=", "self", ".", "_ag", "acsi", "=", "self", ".", "getACSIndex", "(", ")", "for", "index", "in", "self", ".", "_indices", ":", "yield", "Atom", "(", "ag", "=", "ag", ",", "index", "=", "index", ",...
https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/atomic/subset.py#L116-L122
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/olefile/olefile.py
python
OleMetadata.parse_properties
(self, olefile)
Parse standard properties of an OLE file, from the streams ``\\x05SummaryInformation`` and ``\\x05DocumentSummaryInformation``, if present. Properties are converted to strings, integers or python datetime objects. If a property is not present, its value is set to None.
Parse standard properties of an OLE file, from the streams ``\\x05SummaryInformation`` and ``\\x05DocumentSummaryInformation``, if present. Properties are converted to strings, integers or python datetime objects. If a property is not present, its value is set to None.
[ "Parse", "standard", "properties", "of", "an", "OLE", "file", "from", "the", "streams", "\\\\", "x05SummaryInformation", "and", "\\\\", "x05DocumentSummaryInformation", "if", "present", ".", "Properties", "are", "converted", "to", "strings", "integers", "or", "pytho...
def parse_properties(self, olefile): """ Parse standard properties of an OLE file, from the streams ``\\x05SummaryInformation`` and ``\\x05DocumentSummaryInformation``, if present. Properties are converted to strings, integers or python datetime objects. If a property is ...
[ "def", "parse_properties", "(", "self", ",", "olefile", ")", ":", "# first set all attributes to None:", "for", "attrib", "in", "(", "self", ".", "SUMMARY_ATTRIBS", "+", "self", ".", "DOCSUM_ATTRIBS", ")", ":", "setattr", "(", "self", ",", "attrib", ",", "None...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/olefile/olefile.py#L684-L714
deepset-ai/haystack
79fdda8a7cf393d774803608a4874f2a6e63cf6f
haystack/nodes/retriever/text2sparql.py
python
Text2SparqlRetriever.__init__
(self, knowledge_graph, model_name_or_path, top_k: int = 1)
Init the Retriever by providing a knowledge graph and a pre-trained BART model :param knowledge_graph: An instance of BaseKnowledgeGraph on which to execute SPARQL queries. :param model_name_or_path: Name of or path to a pre-trained BartForConditionalGeneration model. :param top_k: How many SPA...
Init the Retriever by providing a knowledge graph and a pre-trained BART model
[ "Init", "the", "Retriever", "by", "providing", "a", "knowledge", "graph", "and", "a", "pre", "-", "trained", "BART", "model" ]
def __init__(self, knowledge_graph, model_name_or_path, top_k: int = 1): """ Init the Retriever by providing a knowledge graph and a pre-trained BART model :param knowledge_graph: An instance of BaseKnowledgeGraph on which to execute SPARQL queries. :param model_name_or_path: Name of or...
[ "def", "__init__", "(", "self", ",", "knowledge_graph", ",", "model_name_or_path", ",", "top_k", ":", "int", "=", "1", ")", ":", "# save init parameters to enable export of component config as YAML", "self", ".", "set_config", "(", "knowledge_graph", "=", "knowledge_gra...
https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/haystack/nodes/retriever/text2sparql.py#L17-L32
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/base64.py
python
standard_b64encode
(s)
return b64encode(s)
Encode bytes-like object s using the standard Base64 alphabet. The result is returned as a bytes object.
Encode bytes-like object s using the standard Base64 alphabet.
[ "Encode", "bytes", "-", "like", "object", "s", "using", "the", "standard", "Base64", "alphabet", "." ]
def standard_b64encode(s): """Encode bytes-like object s using the standard Base64 alphabet. The result is returned as a bytes object. """ return b64encode(s)
[ "def", "standard_b64encode", "(", "s", ")", ":", "return", "b64encode", "(", "s", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/base64.py#L90-L95
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
Lib/SimpleHTTPServer.py
python
SimpleHTTPRequestHandler.copyfile
(self, source, outputfile)
Copy all data between two file objects. The SOURCE argument is a file object open for reading (or anything with a read() method) and the DESTINATION argument is a file object open for writing (or anything with a write() method). The only reason for overriding this would be to c...
Copy all data between two file objects.
[ "Copy", "all", "data", "between", "two", "file", "objects", "." ]
def copyfile(self, source, outputfile): """Copy all data between two file objects. The SOURCE argument is a file object open for reading (or anything with a read() method) and the DESTINATION argument is a file object open for writing (or anything with a write() method). ...
[ "def", "copyfile", "(", "self", ",", "source", ",", "outputfile", ")", ":", "shutil", ".", "copyfileobj", "(", "source", ",", "outputfile", ")" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/SimpleHTTPServer.py#L168-L182
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/registry/models/versioned_flow_snapshot.py
python
VersionedFlowSnapshot.external_controller_services
(self, external_controller_services)
Sets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. :param external_controller_services: The external_controller_services of this VersionedFlowS...
Sets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow.
[ "Sets", "the", "external_controller_services", "of", "this", "VersionedFlowSnapshot", ".", "The", "information", "about", "controller", "services", "that", "exist", "outside", "this", "versioned", "flow", "but", "are", "referenced", "by", "components", "within", "the"...
def external_controller_services(self, external_controller_services): """ Sets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. :p...
[ "def", "external_controller_services", "(", "self", ",", "external_controller_services", ")", ":", "self", ".", "_external_controller_services", "=", "external_controller_services" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/registry/models/versioned_flow_snapshot.py#L146-L155
InvestmentSystems/static-frame
0b19d6969bf6c17fb0599871aca79eb3b52cf2ed
static_frame/core/quilt.py
python
Quilt.get
(self, key: tp.Hashable, default: tp.Optional[Series] = None, )
return self.__getitem__(key)
Return the value found at the columns key, else the default if the key is not found. This method is implemented to complete the dictionary-like interface.
Return the value found at the columns key, else the default if the key is not found. This method is implemented to complete the dictionary-like interface.
[ "Return", "the", "value", "found", "at", "the", "columns", "key", "else", "the", "default", "if", "the", "key", "is", "not", "found", ".", "This", "method", "is", "implemented", "to", "complete", "the", "dictionary", "-", "like", "interface", "." ]
def get(self, key: tp.Hashable, default: tp.Optional[Series] = None, ) -> tp.Optional[Series]: ''' Return the value found at the columns key, else the default if the key is not found. This method is implemented to complete the dictionary-like interface. ''' ...
[ "def", "get", "(", "self", ",", "key", ":", "tp", ".", "Hashable", ",", "default", ":", "tp", ".", "Optional", "[", "Series", "]", "=", "None", ",", ")", "->", "tp", ".", "Optional", "[", "Series", "]", ":", "if", "self", ".", "_assign_axis", ":"...
https://github.com/InvestmentSystems/static-frame/blob/0b19d6969bf6c17fb0599871aca79eb3b52cf2ed/static_frame/core/quilt.py#L689-L700
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/s3transfer/copies.py
python
CopyObjectTask._main
(self, client, copy_source, bucket, key, extra_args, callbacks, size)
:param client: The client to use when calling PutObject :param copy_source: The CopySource parameter to use :param bucket: The name of the bucket to copy to :param key: The name of the key to copy to :param extra_args: A dictionary of any extra arguments that may be used in t...
:param client: The client to use when calling PutObject :param copy_source: The CopySource parameter to use :param bucket: The name of the bucket to copy to :param key: The name of the key to copy to :param extra_args: A dictionary of any extra arguments that may be used in t...
[ ":", "param", "client", ":", "The", "client", "to", "use", "when", "calling", "PutObject", ":", "param", "copy_source", ":", "The", "CopySource", "parameter", "to", "use", ":", "param", "bucket", ":", "The", "name", "of", "the", "bucket", "to", "copy", "...
def _main(self, client, copy_source, bucket, key, extra_args, callbacks, size): """ :param client: The client to use when calling PutObject :param copy_source: The CopySource parameter to use :param bucket: The name of the bucket to copy to :param key: The name of t...
[ "def", "_main", "(", "self", ",", "client", ",", "copy_source", ",", "bucket", ",", "key", ",", "extra_args", ",", "callbacks", ",", "size", ")", ":", "client", ".", "copy_object", "(", "CopySource", "=", "copy_source", ",", "Bucket", "=", "bucket", ",",...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/s3transfer/copies.py#L271-L288
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/python/components.py
python
_ProxyDescriptor.__get__
(self, oself, type=None)
return getattr(original, self.attributeName)
Retrieve the C{self.attributeName} property from L{oself}.
Retrieve the C{self.attributeName} property from L{oself}.
[ "Retrieve", "the", "C", "{", "self", ".", "attributeName", "}", "property", "from", "L", "{", "oself", "}", "." ]
def __get__(self, oself, type=None): """ Retrieve the C{self.attributeName} property from L{oself}. """ if oself is None: return _ProxiedClassMethod(self.attributeName, self.originalAttribute) original = getattr(oself, self.origi...
[ "def", "__get__", "(", "self", ",", "oself", ",", "type", "=", "None", ")", ":", "if", "oself", "is", "None", ":", "return", "_ProxiedClassMethod", "(", "self", ".", "attributeName", ",", "self", ".", "originalAttribute", ")", "original", "=", "getattr", ...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/python/components.py#L410-L418
alanhamlett/pip-update-requirements
ce875601ef278c8ce00ad586434a978731525561
pur/packages/pip/_vendor/webencodings/__init__.py
python
ascii_lower
(string)
return string.encode('utf8').lower().decode('utf8')
r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive <http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_ matching of encoding labels. The same matching is also ...
r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z.
[ "r", "Transform", "(", "only", ")", "ASCII", "letters", "to", "lower", "case", ":", "A", "-", "Z", "is", "mapped", "to", "a", "-", "z", "." ]
def ascii_lower(string): r"""Transform (only) ASCII letters to lower case: A-Z is mapped to a-z. :param string: An Unicode string. :returns: A new Unicode string. This is used for `ASCII case-insensitive <http://encoding.spec.whatwg.org/#ascii-case-insensitive>`_ matching of encoding labels. ...
[ "def", "ascii_lower", "(", "string", ")", ":", "# This turns out to be faster than unicode.translate()", "return", "string", ".", "encode", "(", "'utf8'", ")", ".", "lower", "(", ")", ".", "decode", "(", "'utf8'", ")" ]
https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/webencodings/__init__.py#L35-L58
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/contrib/extended_room.py
python
ExtendedRoom.return_appearance
(self, looker, **kwargs)
return super(ExtendedRoom, self).return_appearance(looker, **kwargs)
This is called when e.g. the look command wants to retrieve the description of this object. Args: looker (Object): The object looking at us. **kwargs (dict): Arbitrary, optional arguments for users overriding the call (unused by default). Returns: ...
This is called when e.g. the look command wants to retrieve the description of this object.
[ "This", "is", "called", "when", "e", ".", "g", ".", "the", "look", "command", "wants", "to", "retrieve", "the", "description", "of", "this", "object", "." ]
def return_appearance(self, looker, **kwargs): """ This is called when e.g. the look command wants to retrieve the description of this object. Args: looker (Object): The object looking at us. **kwargs (dict): Arbitrary, optional arguments for users ...
[ "def", "return_appearance", "(", "self", ",", "looker", ",", "*", "*", "kwargs", ")", ":", "# ensures that our description is current based on time/season", "self", ".", "update_current_description", "(", ")", "# run the normal return_appearance method, now that desc is updated."...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/extended_room.py#L271-L288
argoai/argoverse-api
575c222e7d7fa0c56bdc9dc20f71464c4bea2e6d
argoverse/utils/make_att_files.py
python
save_bev_img
( path_output_vis: str, list_bboxes: List[Any], list_difficulty_att: List[Any], dataset_name: str, log_id: str, lidar_timestamp: int, pc: np.ndarray, )
Plot results on bev images and save
Plot results on bev images and save
[ "Plot", "results", "on", "bev", "images", "and", "save" ]
def save_bev_img( path_output_vis: str, list_bboxes: List[Any], list_difficulty_att: List[Any], dataset_name: str, log_id: str, lidar_timestamp: int, pc: np.ndarray, ) -> None: """ Plot results on bev images and save """ image_size = 2000 image_scale = 10 img = np.zer...
[ "def", "save_bev_img", "(", "path_output_vis", ":", "str", ",", "list_bboxes", ":", "List", "[", "Any", "]", ",", "list_difficulty_att", ":", "List", "[", "Any", "]", ",", "dataset_name", ":", "str", ",", "log_id", ":", "str", ",", "lidar_timestamp", ":", ...
https://github.com/argoai/argoverse-api/blob/575c222e7d7fa0c56bdc9dc20f71464c4bea2e6d/argoverse/utils/make_att_files.py#L41-L147
google/timesketch
1ce6b60e125d104e6644947c6f1dbe1b82ac76b6
api_client/python/timesketch_api_client/client.py
python
TimesketchApi._create_session
( self, username, password, verify, client_id, client_secret, auth_mode)
return session
Create authenticated HTTP session for server communication. Args: username: User to authenticate as. password: User password. verify: Verify server SSL certificate. client_id: The client ID if OAUTH auth is used. client_secret: The OAUTH client secret...
Create authenticated HTTP session for server communication.
[ "Create", "authenticated", "HTTP", "session", "for", "server", "communication", "." ]
def _create_session( self, username, password, verify, client_id, client_secret, auth_mode): """Create authenticated HTTP session for server communication. Args: username: User to authenticate as. password: User password. verify: Verify server...
[ "def", "_create_session", "(", "self", ",", "username", ",", "password", ",", "verify", ",", "client_id", ",", "client_secret", ",", "auth_mode", ")", ":", "if", "auth_mode", "==", "'oauth'", ":", "return", "self", ".", "_create_oauth_session", "(", "client_id...
https://github.com/google/timesketch/blob/1ce6b60e125d104e6644947c6f1dbe1b82ac76b6/api_client/python/timesketch_api_client/client.py#L277-L318
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/site-packages/docutils/utils/math/math2html.py
python
HybridFunction.writepos
(self, pos)
return result
Write all params as read in the parse position.
Write all params as read in the parse position.
[ "Write", "all", "params", "as", "read", "in", "the", "parse", "position", "." ]
def writepos(self, pos): "Write all params as read in the parse position." result = [] while not pos.finished(): if pos.checkskip('$'): param = self.writeparam(pos) if param: result.append(param) elif pos.checkskip('f'): function = self.writefunction(pos) ...
[ "def", "writepos", "(", "self", ",", "pos", ")", ":", "result", "=", "[", "]", "while", "not", "pos", ".", "finished", "(", ")", ":", "if", "pos", ".", "checkskip", "(", "'$'", ")", ":", "param", "=", "self", ".", "writeparam", "(", "pos", ")", ...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/docutils/utils/math/math2html.py#L4837-L4856
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/scapy/scapy/contrib/gsm_um.py
python
pagingRequestType2
(MobileId_presence=0)
return packet
PAGING REQUEST TYPE 2 Section 9.1.23
PAGING REQUEST TYPE 2 Section 9.1.23
[ "PAGING", "REQUEST", "TYPE", "2", "Section", "9", ".", "1", ".", "23" ]
def pagingRequestType2(MobileId_presence=0): """PAGING REQUEST TYPE 2 Section 9.1.23""" a = L2PseudoLength() b = TpPd(pd=0x6) c = MessageType(mesType=0x22) # 00100010 d = PageModeAndChannelNeeded() f = MobileId() g = MobileId() packet = a / b / c / d / f / g if MobileId_presence is...
[ "def", "pagingRequestType2", "(", "MobileId_presence", "=", "0", ")", ":", "a", "=", "L2PseudoLength", "(", ")", "b", "=", "TpPd", "(", "pd", "=", "0x6", ")", "c", "=", "MessageType", "(", "mesType", "=", "0x22", ")", "# 00100010", "d", "=", "PageModeA...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/scapy/scapy/contrib/gsm_um.py#L868-L882
x3omdax/PenBox
3b77c697e67f3e8ee7e2c3c4103e5d7350b2d98f
Versions/V3.2/penbox.py
python
TNscan.getJoomla
(self)
get all joomla websites using bing search the attacker may bruteforce or scan them
get all joomla websites using bing search the attacker may bruteforce or scan them
[ "get", "all", "joomla", "websites", "using", "bing", "search", "the", "attacker", "may", "bruteforce", "or", "scan", "them" ]
def getJoomla(self) : """ get all joomla websites using bing search the attacker may bruteforce or scan them """ lista = [] page = 1 while page <= 101: bing = "http://www.bing.com/search?q=ip%3A" + self.serverip + "+index.php?option=com&count...
[ "def", "getJoomla", "(", "self", ")", ":", "lista", "=", "[", "]", "page", "=", "1", "while", "page", "<=", "101", ":", "bing", "=", "\"http://www.bing.com/search?q=ip%3A\"", "+", "self", ".", "serverip", "+", "\"+index.php?option=com&count=50&first=\"", "+", ...
https://github.com/x3omdax/PenBox/blob/3b77c697e67f3e8ee7e2c3c4103e5d7350b2d98f/Versions/V3.2/penbox.py#L1076-L1098
fedora-infra/bodhi
2b1df12d85eb2e575d8e481a3936c4f92d1fe29a
bodhi/server/tasks/composer.py
python
ComposerThread.modify_bugs
(self)
Mark bugs on each Update as modified.
Mark bugs on each Update as modified.
[ "Mark", "bugs", "on", "each", "Update", "as", "modified", "." ]
def modify_bugs(self): """Mark bugs on each Update as modified.""" log.info('Updating bugs') for update in self.compose.updates: log.debug('Modifying bugs for %s', update.alias) update.modify_bugs()
[ "def", "modify_bugs", "(", "self", ")", ":", "log", ".", "info", "(", "'Updating bugs'", ")", "for", "update", "in", "self", ".", "compose", ".", "updates", ":", "log", ".", "debug", "(", "'Modifying bugs for %s'", ",", "update", ".", "alias", ")", "upda...
https://github.com/fedora-infra/bodhi/blob/2b1df12d85eb2e575d8e481a3936c4f92d1fe29a/bodhi/server/tasks/composer.py#L717-L722
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/packages/all/pupyutils/netcreds.py
python
Netcreds.mail_decode
(self, src_ip_port, dst_ip_port, mail_creds)
Decode base64 mail creds
Decode base64 mail creds
[ "Decode", "base64", "mail", "creds" ]
def mail_decode(self, src_ip_port, dst_ip_port, mail_creds): ''' Decode base64 mail creds ''' try: decoded = base64.b64decode(mail_creds).replace('\x00', ' ').decode('utf8') decoded = decoded.replace('\x00', ' ') except TypeError: decoded = Non...
[ "def", "mail_decode", "(", "self", ",", "src_ip_port", ",", "dst_ip_port", ",", "mail_creds", ")", ":", "try", ":", "decoded", "=", "base64", ".", "b64decode", "(", "mail_creds", ")", ".", "replace", "(", "'\\x00'", ",", "' '", ")", ".", "decode", "(", ...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/all/pupyutils/netcreds.py#L434-L448
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/imghdr.py
python
test_rast
(h, f)
Sun raster file
Sun raster file
[ "Sun", "raster", "file" ]
def test_rast(h, f): """Sun raster file""" if h[:4] == '\x59\xA6\x6A\x95': return 'rast'
[ "def", "test_rast", "(", "h", ",", "f", ")", ":", "if", "h", "[", ":", "4", "]", "==", "'\\x59\\xA6\\x6A\\x95'", ":", "return", "'rast'" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/imghdr.py#L102-L105
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/gettext.py
python
_expand_lang
(loc)
return ret
[]
def _expand_lang(loc): import locale loc = locale.normalize(loc) COMPONENT_CODESET = 1 << 0 COMPONENT_TERRITORY = 1 << 1 COMPONENT_MODIFIER = 1 << 2 # split up the locale into its base components mask = 0 pos = loc.find('@') if pos >= 0: modifier = loc[pos:] loc = ...
[ "def", "_expand_lang", "(", "loc", ")", ":", "import", "locale", "loc", "=", "locale", ".", "normalize", "(", "loc", ")", "COMPONENT_CODESET", "=", "1", "<<", "0", "COMPONENT_TERRITORY", "=", "1", "<<", "1", "COMPONENT_MODIFIER", "=", "1", "<<", "2", "# ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/gettext.py#L211-L250
ivelum/djangoql
0788a1d4f496b19267facbad006ee63cb78c2de3
djangoql/schema.py
python
DjangoQLField.validate
(self, value)
[]
def validate(self, value): if not self.nullable and value is None: raise DjangoQLSchemaError( 'Field %s is not nullable, ' "can't compare it to None" % self.name, ) if value is not None and type(value) not in self.value_types: if self.n...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "nullable", "and", "value", "is", "None", ":", "raise", "DjangoQLSchemaError", "(", "'Field %s is not nullable, '", "\"can't compare it to None\"", "%", "self", ".", "name", ",", ...
https://github.com/ivelum/djangoql/blob/0788a1d4f496b19267facbad006ee63cb78c2de3/djangoql/schema.py#L144-L168
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/core_v1_api.py
python
CoreV1Api.list_resource_quota_for_all_namespaces_with_http_info
(self, **kwargs)
return self.api_client.call_api( '/api/v1/resourcequotas', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='V1ResourceQuotaList', # noqa: E501...
list_resource_quota_for_all_namespaces # noqa: E501 list or watch objects of kind ResourceQuota # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_resource_quota_for_all_namespace...
list_resource_quota_for_all_namespaces # noqa: E501
[ "list_resource_quota_for_all_namespaces", "#", "noqa", ":", "E501" ]
def list_resource_quota_for_all_namespaces_with_http_info(self, **kwargs): # noqa: E501 """list_resource_quota_for_all_namespaces # noqa: E501 list or watch objects of kind ResourceQuota # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTT...
[ "def", "list_resource_quota_for_all_namespaces_with_http_info", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'allow_watch_bookmarks'", ",", "'_continue'", ",", "'field_selector'", ...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/core_v1_api.py#L17502-L17621
msg-systems/holmes-extractor
fc536f32a5cd02a53d1c32f771adc14227d09f38
holmes_extractor/manager.py
python
Manager.register_search_phrase
(self, search_phrase_text:str, label:str=None)
return search_phrase
Registers and returns a new search phrase. Parameters: search_phrase_text -- the raw search phrase text. label -- a label for the search phrase which need *not* be unique. Defaults to the raw search phrase text.
Registers and returns a new search phrase.
[ "Registers", "and", "returns", "a", "new", "search", "phrase", "." ]
def register_search_phrase(self, search_phrase_text:str, label:str=None) -> SearchPhrase: """Registers and returns a new search phrase. Parameters: search_phrase_text -- the raw search phrase text. label -- a label for the search phrase which need *not* be unique. Defaults to the raw ...
[ "def", "register_search_phrase", "(", "self", ",", "search_phrase_text", ":", "str", ",", "label", ":", "str", "=", "None", ")", "->", "SearchPhrase", ":", "search_phrase", "=", "self", ".", "internal_get_search_phrase", "(", "search_phrase_text", ",", "label", ...
https://github.com/msg-systems/holmes-extractor/blob/fc536f32a5cd02a53d1c32f771adc14227d09f38/holmes_extractor/manager.py#L311-L330
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_volume.py
python
Volume.showscale
(self)
return self["showscale"]
Determines whether or not a colorbar is displayed for this trace. The 'showscale' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not a colorbar is displayed for this trace. The 'showscale' property must be specified as a bool (either True, or False)
[ "Determines", "whether", "or", "not", "a", "colorbar", "is", "displayed", "for", "this", "trace", ".", "The", "showscale", "property", "must", "be", "specified", "as", "a", "bool", "(", "either", "True", "or", "False", ")" ]
def showscale(self): """ Determines whether or not a colorbar is displayed for this trace. The 'showscale' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["showscale"]
[ "def", "showscale", "(", "self", ")", ":", "return", "self", "[", "\"showscale\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_volume.py#L1301-L1313
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/FeedMicrosoftIntune/Integrations/FeedMicrosoftIntune/FeedMicrosoftIntune.py
python
fetch_indicators_command
(client: Client, params: Dict[str, str])
return indicators
Wrapper for fetching indicators from the feed to the Indicators tab. Args: client: Client object with request params: demisto.params() Returns: Indicators.
Wrapper for fetching indicators from the feed to the Indicators tab.
[ "Wrapper", "for", "fetching", "indicators", "from", "the", "feed", "to", "the", "Indicators", "tab", "." ]
def fetch_indicators_command(client: Client, params: Dict[str, str]) -> List[Dict]: """Wrapper for fetching indicators from the feed to the Indicators tab. Args: client: Client object with request params: demisto.params() Returns: Indicators. """ feed_tags = argToList(param...
[ "def", "fetch_indicators_command", "(", "client", ":", "Client", ",", "params", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "List", "[", "Dict", "]", ":", "feed_tags", "=", "argToList", "(", "params", ".", "get", "(", "'feedTags'", ",", "''", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FeedMicrosoftIntune/Integrations/FeedMicrosoftIntune/FeedMicrosoftIntune.py#L159-L171
codypierce/pyemu
f3fe115cc99e38c9d9c5e0d659d1fe5b8e19eac4
lib/pefile.py
python
PE.get_offset_from_rva
(self, rva)
return s.get_offset_from_rva(rva)
Get the file offset corresponding to this rva. Given a rva , this method will find the section where the data lies and return the offset within the file.
Get the file offset corresponding to this rva. Given a rva , this method will find the section where the data lies and return the offset within the file.
[ "Get", "the", "file", "offset", "corresponding", "to", "this", "rva", ".", "Given", "a", "rva", "this", "method", "will", "find", "the", "section", "where", "the", "data", "lies", "and", "return", "the", "offset", "within", "the", "file", "." ]
def get_offset_from_rva(self, rva): """Get the file offset corresponding to this rva. Given a rva , this method will find the section where the data lies and return the offset within the file. """ s = self.get_section_by_rva(rva) if not s: ...
[ "def", "get_offset_from_rva", "(", "self", ",", "rva", ")", ":", "s", "=", "self", ".", "get_section_by_rva", "(", "rva", ")", "if", "not", "s", ":", "raise", "PEFormatError", ",", "'data at RVA can\\'t be fetched. Corrupted header?'", "return", "s", ".", "get_o...
https://github.com/codypierce/pyemu/blob/f3fe115cc99e38c9d9c5e0d659d1fe5b8e19eac4/lib/pefile.py#L2513-L2525
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/plat-mac/bundlebuilder.py
python
AppBuilder.reportMissing
(self)
[]
def reportMissing(self): missing = [name for name in self.missingModules if name not in MAYMISS_MODULES] if self.maybeMissingModules: maybe = self.maybeMissingModules else: maybe = [name for name in missing if "." in name] missing = [name for n...
[ "def", "reportMissing", "(", "self", ")", ":", "missing", "=", "[", "name", "for", "name", "in", "self", ".", "missingModules", "if", "name", "not", "in", "MAYMISS_MODULES", "]", "if", "self", ".", "maybeMissingModules", ":", "maybe", "=", "self", ".", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-mac/bundlebuilder.py#L695-L717
opendistro-for-elasticsearch/opendistro-build
b8f35fef21be74050cbd17d6054fb98332990cdb
elasticsearch/AMI/lib/ODFEInstaller.py
python
ODFEInstaller._get_SSH_client
(self)
return ssh
used to get ssh client created by paramiko args: none returns: pramiko ssh client
used to get ssh client created by paramiko args: none returns: pramiko ssh client
[ "used", "to", "get", "ssh", "client", "created", "by", "paramiko", "args", ":", "none", "returns", ":", "pramiko", "ssh", "client" ]
def _get_SSH_client(self): """ used to get ssh client created by paramiko args: none returns: pramiko ssh client """ ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) private_key = paramiko.RSAKey.from_private_key_file(se...
[ "def", "_get_SSH_client", "(", "self", ")", ":", "ssh", "=", "paramiko", ".", "SSHClient", "(", ")", "ssh", ".", "set_missing_host_key_policy", "(", "paramiko", ".", "AutoAddPolicy", "(", ")", ")", "private_key", "=", "paramiko", ".", "RSAKey", ".", "from_pr...
https://github.com/opendistro-for-elasticsearch/opendistro-build/blob/b8f35fef21be74050cbd17d6054fb98332990cdb/elasticsearch/AMI/lib/ODFEInstaller.py#L72-L82
Sandmann79/xbmc
42d276765701d43572219b94198dfba9971aba2a
script.module.pyautogui/lib/pyautogui/__init__.py
python
run
(commandStr, _ssCount=None)
Run a series of PyAutoGUI function calls according to a mini-language made for this function. The `commandStr` is composed of character commands that represent PyAutoGUI function calls. For example, `run('ccg-20,+0c')` clicks the mouse twice, then makes the mouse cursor go 20 pixels to the left, then c...
Run a series of PyAutoGUI function calls according to a mini-language made for this function. The `commandStr` is composed of character commands that represent PyAutoGUI function calls.
[ "Run", "a", "series", "of", "PyAutoGUI", "function", "calls", "according", "to", "a", "mini", "-", "language", "made", "for", "this", "function", ".", "The", "commandStr", "is", "composed", "of", "character", "commands", "that", "represent", "PyAutoGUI", "func...
def run(commandStr, _ssCount=None): """Run a series of PyAutoGUI function calls according to a mini-language made for this function. The `commandStr` is composed of character commands that represent PyAutoGUI function calls. For example, `run('ccg-20,+0c')` clicks the mouse twice, then makes the mo...
[ "def", "run", "(", "commandStr", ",", "_ssCount", "=", "None", ")", ":", "# run(\"ccc\") straight forward", "# run(\"susu\") if 's' then peek at the next character", "global", "PAUSE", "if", "_ssCount", "is", "None", ":", "_ssCount", "=", "[", "0", "]", "# Setting th...
https://github.com/Sandmann79/xbmc/blob/42d276765701d43572219b94198dfba9971aba2a/script.module.pyautogui/lib/pyautogui/__init__.py#L2068-L2126
fortharris/Pcode
147962d160a834c219e12cb456abc130826468e4
rope/contrib/generate.py
python
_FunctionGenerationInfo.is_method
(self)
return self.primary is not None and \ isinstance(self.primary.get_object().get_type(), pyobjects.PyClass)
[]
def is_method(self): return self.primary is not None and \ isinstance(self.primary.get_object().get_type(), pyobjects.PyClass)
[ "def", "is_method", "(", "self", ")", ":", "return", "self", ".", "primary", "is", "not", "None", "and", "isinstance", "(", "self", ".", "primary", ".", "get_object", "(", ")", ".", "get_type", "(", ")", ",", "pyobjects", ".", "PyClass", ")" ]
https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/contrib/generate.py#L309-L311
log2timeline/plaso
fe2e316b8c76a0141760c0f2f181d84acb83abc2
plaso/multi_process/engine.py
python
MultiProcessEngine._TerminateProcess
(self, process)
Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate.
Terminate a process.
[ "Terminate", "a", "process", "." ]
def _TerminateProcess(self, process): """Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate. """ pid = process.pid logger.warning('Terminating process: (PID: {0:d}).'.format(pid)) process.terminate() # Wait for the process to exit. process.join(tim...
[ "def", "_TerminateProcess", "(", "self", ",", "process", ")", ":", "pid", "=", "process", ".", "pid", "logger", ".", "warning", "(", "'Terminating process: (PID: {0:d}).'", ".", "format", "(", "pid", ")", ")", "process", ".", "terminate", "(", ")", "# Wait f...
https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/multi_process/engine.py#L419-L434
edgewall/trac
beb3e4eaf1e0a456d801a50a8614ecab06de29fc
trac/config.py
python
Section.getint
(self, key, default='')
Return the value of the specified option as integer. If the specified option can not be converted to an integer, a `ConfigurationError` exception is raised. Valid default input is a string or an int. Returns an int.
Return the value of the specified option as integer.
[ "Return", "the", "value", "of", "the", "specified", "option", "as", "integer", "." ]
def getint(self, key, default=''): """Return the value of the specified option as integer. If the specified option can not be converted to an integer, a `ConfigurationError` exception is raised. Valid default input is a string or an int. Returns an int. """ value = self...
[ "def", "getint", "(", "self", ",", "key", ",", "default", "=", "''", ")", ":", "value", "=", "self", ".", "get", "(", "key", ",", "default", ")", "try", ":", "return", "_getint", "(", "value", ")", "except", "ValueError", ":", "raise", "Configuration...
https://github.com/edgewall/trac/blob/beb3e4eaf1e0a456d801a50a8614ecab06de29fc/trac/config.py#L517-L532
intel/CeTune
fdc523971dc6d52cbbefb24ff9504fdc934b31ca
visualizer/visualizer.py
python
Visualizer.dataparse
(self,data)
return rows
[]
def dataparse(self,data): #print data rows = [] list_data = [] for i in data.keys(): list_data.append(data[i]) for i in list_data: row = [] row.extend(re.findall('id=(.*?)>',re.search('(<tr.*?>)', i, re.S).group(1),re.S)) row.extend...
[ "def", "dataparse", "(", "self", ",", "data", ")", ":", "#print data", "rows", "=", "[", "]", "list_data", "=", "[", "]", "for", "i", "in", "data", ".", "keys", "(", ")", ":", "list_data", ".", "append", "(", "data", "[", "i", "]", ")", "for", ...
https://github.com/intel/CeTune/blob/fdc523971dc6d52cbbefb24ff9504fdc934b31ca/visualizer/visualizer.py#L87-L100
intel/virtual-storage-manager
00706ab9701acbd0d5e04b19cc80c6b66a2973b8
source/vsm/vsm/openstack/common/rpc/amqp.py
python
ConnectionContext._done
(self)
If the connection came from a pool, clean it up and put it back. If it did not come from a pool, close it.
If the connection came from a pool, clean it up and put it back. If it did not come from a pool, close it.
[ "If", "the", "connection", "came", "from", "a", "pool", "clean", "it", "up", "and", "put", "it", "back", ".", "If", "it", "did", "not", "come", "from", "a", "pool", "close", "it", "." ]
def _done(self): """If the connection came from a pool, clean it up and put it back. If it did not come from a pool, close it. """ if self.connection: if self.pooled: # Reset the connection so it's ready for the next caller # to grab from the p...
[ "def", "_done", "(", "self", ")", ":", "if", "self", ".", "connection", ":", "if", "self", ".", "pooled", ":", "# Reset the connection so it's ready for the next caller", "# to grab from the pool", "self", ".", "connection", ".", "reset", "(", ")", "self", ".", ...
https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/vsm/vsm/openstack/common/rpc/amqp.py#L128-L143
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/SSD/balancap-SSD-Tensorflow/nets/vgg.py
python
vgg_arg_scope
(weight_decay=0.0005)
Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope.
Defines the VGG arg scope.
[ "Defines", "the", "VGG", "arg", "scope", "." ]
def vgg_arg_scope(weight_decay=0.0005): """Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope. """ with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=s...
[ "def", "vgg_arg_scope", "(", "weight_decay", "=", "0.0005", ")", ":", "with", "slim", ".", "arg_scope", "(", "[", "slim", ".", "conv2d", ",", "slim", ".", "fully_connected", "]", ",", "activation_fn", "=", "tf", ".", "nn", ".", "relu", ",", "weights_regu...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/SSD/balancap-SSD-Tensorflow/nets/vgg.py#L49-L63
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/colorbar.py
python
Colorbar.update_bruteforce
(self, mappable)
Destroy and rebuild the colorbar. This is intended to become obsolete, and will probably be deprecated and then removed. It is not called when the pyplot.colorbar function or the Figure.colorbar method are used to create the colorbar.
Destroy and rebuild the colorbar. This is intended to become obsolete, and will probably be deprecated and then removed. It is not called when the pyplot.colorbar function or the Figure.colorbar method are used to create the colorbar.
[ "Destroy", "and", "rebuild", "the", "colorbar", ".", "This", "is", "intended", "to", "become", "obsolete", "and", "will", "probably", "be", "deprecated", "and", "then", "removed", ".", "It", "is", "not", "called", "when", "the", "pyplot", ".", "colorbar", ...
def update_bruteforce(self, mappable): ''' Destroy and rebuild the colorbar. This is intended to become obsolete, and will probably be deprecated and then removed. It is not called when the pyplot.colorbar function or the Figure.colorbar method are used to create the co...
[ "def", "update_bruteforce", "(", "self", ",", "mappable", ")", ":", "# We are using an ugly brute-force method: clearing and", "# redrawing the whole thing. The problem is that if any", "# properties have been changed by methods other than the", "# colorbar methods, those changes will be lost...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/colorbar.py#L1146-L1173
dhtech/swboot
b741e8f90f3941a7619e12addf337bed1d299204
http/cookiejar.py
python
DefaultCookiePolicy.set_allowed_domains
(self, allowed_domains)
Set the sequence of allowed domains, or None.
Set the sequence of allowed domains, or None.
[ "Set", "the", "sequence", "of", "allowed", "domains", "or", "None", "." ]
def set_allowed_domains(self, allowed_domains): """Set the sequence of allowed domains, or None.""" if allowed_domains is not None: allowed_domains = tuple(allowed_domains) self._allowed_domains = allowed_domains
[ "def", "set_allowed_domains", "(", "self", ",", "allowed_domains", ")", ":", "if", "allowed_domains", "is", "not", "None", ":", "allowed_domains", "=", "tuple", "(", "allowed_domains", ")", "self", ".", "_allowed_domains", "=", "allowed_domains" ]
https://github.com/dhtech/swboot/blob/b741e8f90f3941a7619e12addf337bed1d299204/http/cookiejar.py#L928-L932
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/decimal.py
python
Decimal.__format__
(self, specifier, context=None, _localeconv=None)
return _format_number(self._sign, intpart, fracpart, exp, spec)
Format a Decimal instance according to the given specifier. The specifier should be a standard format specifier, with the form described in PEP 3101. Formatting types 'e', 'E', 'f', 'F', 'g', 'G', 'n' and '%' are supported. If the formatting type is omitted it defaults to 'g' or 'G', ...
Format a Decimal instance according to the given specifier.
[ "Format", "a", "Decimal", "instance", "according", "to", "the", "given", "specifier", "." ]
def __format__(self, specifier, context=None, _localeconv=None): """Format a Decimal instance according to the given specifier. The specifier should be a standard format specifier, with the form described in PEP 3101. Formatting types 'e', 'E', 'f', 'F', 'g', 'G', 'n' and '%' are suppo...
[ "def", "__format__", "(", "self", ",", "specifier", ",", "context", "=", "None", ",", "_localeconv", "=", "None", ")", ":", "# Note: PEP 3101 says that if the type is not present then", "# there should be at least one digit after the decimal point.", "# We take the liberty of ign...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/decimal.py#L3616-L3694
zhaozhiyong19890102/Python-Machine-Learning-Algorithm
c427ffa5782d7410387e98a3998a491b0bc51ccb
Chapter_5 Random Forest/random_forests_train.py
python
random_forest_training
(data_train, trees_num)
return trees_result, trees_feature
构建随机森林 input: data_train(list):训练数据 trees_num(int):分类树的个数 output: trees_result(list):每一棵树的最好划分 trees_feature(list):每一棵树中对原始特征的选择
构建随机森林 input: data_train(list):训练数据 trees_num(int):分类树的个数 output: trees_result(list):每一棵树的最好划分 trees_feature(list):每一棵树中对原始特征的选择
[ "构建随机森林", "input", ":", "data_train", "(", "list", ")", ":", "训练数据", "trees_num", "(", "int", ")", ":", "分类树的个数", "output", ":", "trees_result", "(", "list", ")", ":", "每一棵树的最好划分", "trees_feature", "(", "list", ")", ":", "每一棵树中对原始特征的选择" ]
def random_forest_training(data_train, trees_num): '''构建随机森林 input: data_train(list):训练数据 trees_num(int):分类树的个数 output: trees_result(list):每一棵树的最好划分 trees_feature(list):每一棵树中对原始特征的选择 ''' trees_result = [] # 构建好每一棵树的最好划分 trees_feature = [] n = np.shape(data_train)[1]...
[ "def", "random_forest_training", "(", "data_train", ",", "trees_num", ")", ":", "trees_result", "=", "[", "]", "# 构建好每一棵树的最好划分", "trees_feature", "=", "[", "]", "n", "=", "np", ".", "shape", "(", "data_train", ")", "[", "1", "]", "# 样本的维数", "if", "n", ">...
https://github.com/zhaozhiyong19890102/Python-Machine-Learning-Algorithm/blob/c427ffa5782d7410387e98a3998a491b0bc51ccb/Chapter_5 Random Forest/random_forests_train.py#L56-L81
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/sms/models.py
python
MessagingEvent.create_structured_sms_subevent
(self, case_id)
return obj
[]
def create_structured_sms_subevent(self, case_id): obj = MessagingSubEvent.objects.create( parent=self, date=datetime.utcnow(), recipient_type=self.recipient_type, recipient_id=self.recipient_id, content_type=MessagingEvent.CONTENT_SMS_SURVEY, ...
[ "def", "create_structured_sms_subevent", "(", "self", ",", "case_id", ")", ":", "obj", "=", "MessagingSubEvent", ".", "objects", ".", "create", "(", "parent", "=", "self", ",", "date", "=", "datetime", ".", "utcnow", "(", ")", ",", "recipient_type", "=", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/sms/models.py#L1198-L1211
cournape/Bento
37de23d784407a7c98a4a15770ffc570d5f32d70
bento/backends/waf_tools/blas_lapack.py
python
check_fortran
(context)
[]
def check_fortran(context): opts = context.waf_options_context conf = context.waf_context opts.load("compiler_fc") Options.options.check_fc = "gfortran" conf.load("compiler_fc") conf.load("ordered_c", tooldir=[WAF_TOOLDIR]) conf.check_fortran_verbose_flag() conf.check_fortran_clib()
[ "def", "check_fortran", "(", "context", ")", ":", "opts", "=", "context", ".", "waf_options_context", "conf", "=", "context", ".", "waf_context", "opts", ".", "load", "(", "\"compiler_fc\"", ")", "Options", ".", "options", ".", "check_fc", "=", "\"gfortran\"",...
https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/backends/waf_tools/blas_lapack.py#L133-L144
jobovy/galpy
8e6a230bbe24ce16938db10053f92eb17fe4bb52
galpy/util/coords.py
python
cov_vxyz_to_galcencyl
(cov_vxyz, phi, Xsun=1., Zsun=0.)
return cov_galcencyl
NAME: cov_vxyz_to_galcencyl PURPOSE: propagate uncertainties in vxyz to galactocentric cylindrical coordinates INPUT: cov_vxyz - uncertainty covariance in U,V,W phi - angular position of star in galactocentric cylindrical coords OUTPUT: cov(vR,vT,vz) [3,3] HIS...
NAME:
[ "NAME", ":" ]
def cov_vxyz_to_galcencyl(cov_vxyz, phi, Xsun=1., Zsun=0.): """ NAME: cov_vxyz_to_galcencyl PURPOSE: propagate uncertainties in vxyz to galactocentric cylindrical coordinates INPUT: cov_vxyz - uncertainty covariance in U,V,W phi - angular position of star in galactocent...
[ "def", "cov_vxyz_to_galcencyl", "(", "cov_vxyz", ",", "phi", ",", "Xsun", "=", "1.", ",", "Zsun", "=", "0.", ")", ":", "cov_galcenrect", "=", "cov_vxyz_to_galcenrect", "(", "cov_vxyz", ",", "Xsun", "=", "Xsun", ",", "Zsun", "=", "Zsun", ")", "cov_galcencyl...
https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/util/coords.py#L872-L901
NoGameNoLife00/mybolg
afe17ea5bfe405e33766e5682c43a4262232ee12
libs/werkzeug/routing.py
python
Map.is_endpoint_expecting
(self, endpoint, *arguments)
return False
Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatically added if not pro...
Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatically added if not pro...
[ "Iterate", "over", "all", "rules", "and", "check", "if", "the", "endpoint", "expects", "the", "arguments", "provided", ".", "This", "is", "for", "example", "useful", "if", "you", "have", "some", "URLs", "that", "expect", "a", "language", "code", "and", "ot...
def is_endpoint_expecting(self, endpoint, *arguments): """Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that t...
[ "def", "is_endpoint_expecting", "(", "self", ",", "endpoint", ",", "*", "arguments", ")", ":", "self", ".", "update", "(", ")", "arguments", "=", "set", "(", "arguments", ")", "for", "rule", "in", "self", ".", "_rules_by_endpoint", "[", "endpoint", "]", ...
https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/werkzeug/routing.py#L1068-L1086
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
gitsome/lib/github3/repos/branch.py
python
Branch.protect
(self, enforcement=None, status_checks=None)
return True
Enable force push protection and configure status check enforcement. See: http://git.io/v4Gvu :param str enforcement: (optional), Specifies the enforcement level of the status checks. Must be one of 'off', 'non_admins', or 'everyone'. Use `None` or omit to use the already assoc...
Enable force push protection and configure status check enforcement.
[ "Enable", "force", "push", "protection", "and", "configure", "status", "check", "enforcement", "." ]
def protect(self, enforcement=None, status_checks=None): """Enable force push protection and configure status check enforcement. See: http://git.io/v4Gvu :param str enforcement: (optional), Specifies the enforcement level of the status checks. Must be one of 'off', 'non_admins', or...
[ "def", "protect", "(", "self", ",", "enforcement", "=", "None", ",", "status_checks", "=", "None", ")", ":", "previous_values", "=", "self", ".", "protection", "[", "'required_status_checks'", "]", "if", "enforcement", "is", "None", ":", "enforcement", "=", ...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/gitsome/lib/github3/repos/branch.py#L61-L84
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/object_detection/core/box_list_ops.py
python
visualize_boxes_in_image
(image, boxlist, normalized=False, scope=None)
Overlay bounding box list on image. Currently this visualization plots a 1 pixel thick red bounding box on top of the image. Note that tf.image.draw_bounding_boxes essentially is 1 indexed. Args: image: an image tensor with shape [height, width, 3] boxlist: a BoxList normalized: (boolean) specify...
Overlay bounding box list on image.
[ "Overlay", "bounding", "box", "list", "on", "image", "." ]
def visualize_boxes_in_image(image, boxlist, normalized=False, scope=None): """Overlay bounding box list on image. Currently this visualization plots a 1 pixel thick red bounding box on top of the image. Note that tf.image.draw_bounding_boxes essentially is 1 indexed. Args: image: an image tensor with ...
[ "def", "visualize_boxes_in_image", "(", "image", ",", "boxlist", ",", "normalized", "=", "False", ",", "scope", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "scope", ",", "'VisualizeBoxesInImage'", ")", ":", "if", "not", "normalized", ":", ...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/object_detection/core/box_list_ops.py#L598-L624
kylebebak/Requester
4a9f9f051fa5fc951a8f7ad098a328261ca2db97
deps/urllib3/util/retry.py
python
Retry.get_retry_after
(self, response)
return self.parse_retry_after(retry_after)
Get the value of Retry-After in seconds.
Get the value of Retry-After in seconds.
[ "Get", "the", "value", "of", "Retry", "-", "After", "in", "seconds", "." ]
def get_retry_after(self, response): """ Get the value of Retry-After in seconds. """ retry_after = response.getheader("Retry-After") if retry_after is None: return None return self.parse_retry_after(retry_after)
[ "def", "get_retry_after", "(", "self", ",", "response", ")", ":", "retry_after", "=", "response", ".", "getheader", "(", "\"Retry-After\"", ")", "if", "retry_after", "is", "None", ":", "return", "None", "return", "self", ".", "parse_retry_after", "(", "retry_a...
https://github.com/kylebebak/Requester/blob/4a9f9f051fa5fc951a8f7ad098a328261ca2db97/deps/urllib3/util/retry.py#L233-L241
jhetherly/EnglishSpeechUpsampler
1265fa3ec68fa1e662b5d7f9c61ca730f9beee99
optimizers.py
python
setup_optimizer
(lr, loss, opt, using_batch_norm=True, opt_args={}, min_args={})
return train_step
[]
def setup_optimizer(lr, loss, opt, using_batch_norm=True, opt_args={}, min_args={}): if using_batch_norm: update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) with tf.control_dependencies(update_ops): # Ensures that we execute the update_ops before performing ...
[ "def", "setup_optimizer", "(", "lr", ",", "loss", ",", "opt", ",", "using_batch_norm", "=", "True", ",", "opt_args", "=", "{", "}", ",", "min_args", "=", "{", "}", ")", ":", "if", "using_batch_norm", ":", "update_ops", "=", "tf", ".", "get_collection", ...
https://github.com/jhetherly/EnglishSpeechUpsampler/blob/1265fa3ec68fa1e662b5d7f9c61ca730f9beee99/optimizers.py#L21-L33
EelcoHoogendoorn/Numpy_arraysetops_EP
84dc8114bf8a79c3acb3f7f59128247b9fc97243
numpy_indexed/grouping.py
python
GroupBy.__call__
(self, values)
return self.unique, self.split(values)
not sure how i feel about this. explicit is better than implict?
not sure how i feel about this. explicit is better than implict?
[ "not", "sure", "how", "i", "feel", "about", "this", ".", "explicit", "is", "better", "than", "implict?" ]
def __call__(self, values): """not sure how i feel about this. explicit is better than implict?""" return self.unique, self.split(values)
[ "def", "__call__", "(", "self", ",", "values", ")", ":", "return", "self", ".", "unique", ",", "self", ".", "split", "(", "values", ")" ]
https://github.com/EelcoHoogendoorn/Numpy_arraysetops_EP/blob/84dc8114bf8a79c3acb3f7f59128247b9fc97243/numpy_indexed/grouping.py#L186-L188
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/prepared.py
python
PreparedGeometryFactory.create
(self, geom)
return PreparedGeometry(geom)
* Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}. * * @param geom the geometry to prepare * @return the prepared geometry
* Creates a new {
[ "*", "Creates", "a", "new", "{" ]
def create(self, geom): """ * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}. * * @param geom the geometry to prepare * @return the prepared geometry """ tid = geom.type_id if tid in [ GeomTypeId.G...
[ "def", "create", "(", "self", ",", "geom", ")", ":", "tid", "=", "geom", ".", "type_id", "if", "tid", "in", "[", "GeomTypeId", ".", "GEOS_MULTIPOINT", ",", "GeomTypeId", ".", "GEOS_POINT", "]", ":", "return", "PreparedPoint", "(", "geom", ")", "if", "t...
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/prepared.py#L1229-L1257
ionelmc/python-hunter
4e4064bf5bf30ecd1fa69abb1b6b5df8b8b66b45
src/hunter/predicates.py
python
Query.__call__
(self, event)
return True
Handles event. Returns True if all criteria matched.
Handles event. Returns True if all criteria matched.
[ "Handles", "event", ".", "Returns", "True", "if", "all", "criteria", "matched", "." ]
def __call__(self, event): """ Handles event. Returns True if all criteria matched. """ for key, value in self.query_eq: evalue = event[key] if evalue != value: return False for key, value in self.query_in: evalue = event[key] ...
[ "def", "__call__", "(", "self", ",", "event", ")", ":", "for", "key", ",", "value", "in", "self", ".", "query_eq", ":", "evalue", "=", "event", "[", "key", "]", "if", "evalue", "!=", "value", ":", "return", "False", "for", "key", ",", "value", "in"...
https://github.com/ionelmc/python-hunter/blob/4e4064bf5bf30ecd1fa69abb1b6b5df8b8b66b45/src/hunter/predicates.py#L187-L232
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/Cymulate/Integrations/Cymulate_v2/Cymulate_v2.py
python
get_immediate_threat_assessment_status_command
(client: Client, assessment_id: str)
return command_results
Retrieve the immediate threats status. Args: client (Client): Cymulate client. assessment_id (str): The ID of the assessment to retrieve the status to. Returns: CommandResults: A CommandResults object that is then passed to 'return_results', containing the asses...
Retrieve the immediate threats status.
[ "Retrieve", "the", "immediate", "threats", "status", "." ]
def get_immediate_threat_assessment_status_command(client: Client, assessment_id: str) -> CommandResults: """Retrieve the immediate threats status. Args: client (Client): Cymulate client. assessment_id (str): The ID of the assessment to retriev...
[ "def", "get_immediate_threat_assessment_status_command", "(", "client", ":", "Client", ",", "assessment_id", ":", "str", ")", "->", "CommandResults", ":", "endpoint", "=", "ENDPOINT_DICT", ".", "get", "(", "'immediate-threats'", ")", "raw_response", "=", "client", "...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Cymulate/Integrations/Cymulate_v2/Cymulate_v2.py#L1221-L1248
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/styling.py
python
Style.child_removed
(self, child)
A reimplemented child removed event handler. This will notify the :class:`StyleCache` if the :class:`Setter` children of the style have changed.
A reimplemented child removed event handler.
[ "A", "reimplemented", "child", "removed", "event", "handler", "." ]
def child_removed(self, child): """ A reimplemented child removed event handler. This will notify the :class:`StyleCache` if the :class:`Setter` children of the style have changed. """ super(Style, self).child_removed(child) if self.is_initialized and isinstance(child, ...
[ "def", "child_removed", "(", "self", ",", "child", ")", ":", "super", "(", "Style", ",", "self", ")", ".", "child_removed", "(", "child", ")", "if", "self", ".", "is_initialized", "and", "isinstance", "(", "child", ",", "Setter", ")", ":", "StyleCache", ...
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/styling.py#L194-L203
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/utils/http.py
python
parse_http_date_safe
(date)
Same as parse_http_date, but returns None if the input is invalid.
Same as parse_http_date, but returns None if the input is invalid.
[ "Same", "as", "parse_http_date", "but", "returns", "None", "if", "the", "input", "is", "invalid", "." ]
def parse_http_date_safe(date): """ Same as parse_http_date, but returns None if the input is invalid. """ try: return parse_http_date(date) except Exception: pass
[ "def", "parse_http_date_safe", "(", "date", ")", ":", "try", ":", "return", "parse_http_date", "(", "date", ")", "except", "Exception", ":", "pass" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/utils/http.py#L183-L190
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/cookielib.py
python
CookieJar.extract_cookies
(self, response, request)
Extract cookies from response, where allowable given the request.
Extract cookies from response, where allowable given the request.
[ "Extract", "cookies", "from", "response", "where", "allowable", "given", "the", "request", "." ]
def extract_cookies(self, response, request): """Extract cookies from response, where allowable given the request.""" _debug("extract_cookies: %s", response.info()) self._cookies_lock.acquire() try: self._policy._now = self._now = int(time.time()) for cookie in s...
[ "def", "extract_cookies", "(", "self", ",", "response", ",", "request", ")", ":", "_debug", "(", "\"extract_cookies: %s\"", ",", "response", ".", "info", "(", ")", ")", "self", ".", "_cookies_lock", ".", "acquire", "(", ")", "try", ":", "self", ".", "_po...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/cookielib.py#L1651-L1663
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/ldap3/operation/abandon.py
python
abandon_request_to_dict
(request)
return {'messageId': str(request)}
[]
def abandon_request_to_dict(request): return {'messageId': str(request)}
[ "def", "abandon_request_to_dict", "(", "request", ")", ":", "return", "{", "'messageId'", ":", "str", "(", "request", ")", "}" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/operation/abandon.py#L35-L36
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/noarch/hyper/packages/rfc3986/uri.py
python
URIReference.is_absolute
(self)
return bool(ABSOLUTE_URI_MATCHER.match(self.unsplit()))
Determine if this URI Reference is an absolute URI. See http://tools.ietf.org/html/rfc3986#section-4.3 for explanation. :returns: ``True`` if it is an absolute URI, ``False`` otherwise. :rtype: bool
Determine if this URI Reference is an absolute URI.
[ "Determine", "if", "this", "URI", "Reference", "is", "an", "absolute", "URI", "." ]
def is_absolute(self): """Determine if this URI Reference is an absolute URI. See http://tools.ietf.org/html/rfc3986#section-4.3 for explanation. :returns: ``True`` if it is an absolute URI, ``False`` otherwise. :rtype: bool """ return bool(ABSOLUTE_URI_MATCHER.match(se...
[ "def", "is_absolute", "(", "self", ")", ":", "return", "bool", "(", "ABSOLUTE_URI_MATCHER", ".", "match", "(", "self", ".", "unsplit", "(", ")", ")", ")" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/hyper/packages/rfc3986/uri.py#L143-L151
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py
python
Searcher.document
(self, **kw)
Convenience method returns the stored fields of a document matching the given keyword arguments, where the keyword keys are field names and the values are terms that must appear in the field. This method is equivalent to:: searcher.stored_fields(searcher.document_number(<keyword ar...
Convenience method returns the stored fields of a document matching the given keyword arguments, where the keyword keys are field names and the values are terms that must appear in the field.
[ "Convenience", "method", "returns", "the", "stored", "fields", "of", "a", "document", "matching", "the", "given", "keyword", "arguments", "where", "the", "keyword", "keys", "are", "field", "names", "and", "the", "values", "are", "terms", "that", "must", "appea...
def document(self, **kw): """Convenience method returns the stored fields of a document matching the given keyword arguments, where the keyword keys are field names and the values are terms that must appear in the field. This method is equivalent to:: searcher.stored_fields...
[ "def", "document", "(", "self", ",", "*", "*", "kw", ")", ":", "for", "p", "in", "self", ".", "documents", "(", "*", "*", "kw", ")", ":", "return", "p" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/searching.py#L337-L359
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/zwave/websocket_api.py
python
websocket_get_config
(hass, connection, msg)
Get Z-Wave configuration.
Get Z-Wave configuration.
[ "Get", "Z", "-", "Wave", "configuration", "." ]
def websocket_get_config(hass, connection, msg): """Get Z-Wave configuration.""" config = hass.data[DATA_ZWAVE_CONFIG] connection.send_result( msg[ID], { CONF_AUTOHEAL: config[CONF_AUTOHEAL], CONF_DEBUG: config[CONF_DEBUG], CONF_POLLING_INTERVAL: config[CO...
[ "def", "websocket_get_config", "(", "hass", ",", "connection", ",", "msg", ")", ":", "config", "=", "hass", ".", "data", "[", "DATA_ZWAVE_CONFIG", "]", "connection", ".", "send_result", "(", "msg", "[", "ID", "]", ",", "{", "CONF_AUTOHEAL", ":", "config", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/zwave/websocket_api.py#L32-L43
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/utils/cache.py
python
patch_response_headers
(response, cache_timeout=None)
Adds some useful headers to the given HttpResponse object: ETag, Last-Modified, Expires and Cache-Control Each header is only added if it isn't already set. cache_timeout is in seconds. The CACHE_MIDDLEWARE_SECONDS setting is used by default.
Adds some useful headers to the given HttpResponse object: ETag, Last-Modified, Expires and Cache-Control
[ "Adds", "some", "useful", "headers", "to", "the", "given", "HttpResponse", "object", ":", "ETag", "Last", "-", "Modified", "Expires", "and", "Cache", "-", "Control" ]
def patch_response_headers(response, cache_timeout=None): """ Adds some useful headers to the given HttpResponse object: ETag, Last-Modified, Expires and Cache-Control Each header is only added if it isn't already set. cache_timeout is in seconds. The CACHE_MIDDLEWARE_SECONDS setting is used ...
[ "def", "patch_response_headers", "(", "response", ",", "cache_timeout", "=", "None", ")", ":", "if", "cache_timeout", "is", "None", ":", "cache_timeout", "=", "settings", ".", "CACHE_MIDDLEWARE_SECONDS", "if", "cache_timeout", "<", "0", ":", "cache_timeout", "=", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/utils/cache.py#L100-L123
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/parametertree/Parameter.py
python
Parameter.hide
(self)
Hide this parameter. It and its children will no longer be visible in any ParameterTree widgets it is connected to.
Hide this parameter. It and its children will no longer be visible in any ParameterTree widgets it is connected to.
[ "Hide", "this", "parameter", ".", "It", "and", "its", "children", "will", "no", "longer", "be", "visible", "in", "any", "ParameterTree", "widgets", "it", "is", "connected", "to", "." ]
def hide(self): """Hide this parameter. It and its children will no longer be visible in any ParameterTree widgets it is connected to.""" self.show(False)
[ "def", "hide", "(", "self", ")", ":", "self", ".", "show", "(", "False", ")" ]
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/parametertree/Parameter.py#L713-L716
openai/iaf
ad33fe4872bf6e4b4f387e709a625376bb8b0d9d
graphy/ndict.py
python
flatten
(ds, raiseOnDuplicateKeys=True)
return result
[]
def flatten(ds, raiseOnDuplicateKeys=True): if isinstance(ds, dict): return ds assert (isinstance(ds, list) or isinstance(ds, tuple)) result = {} for d in ds: if (isinstance(d, list) or isinstance(d, tuple)): # recursion d = flatten(d, raiseOnDuplicateKeys) assert...
[ "def", "flatten", "(", "ds", ",", "raiseOnDuplicateKeys", "=", "True", ")", ":", "if", "isinstance", "(", "ds", ",", "dict", ")", ":", "return", "ds", "assert", "(", "isinstance", "(", "ds", ",", "list", ")", "or", "isinstance", "(", "ds", ",", "tupl...
https://github.com/openai/iaf/blob/ad33fe4872bf6e4b4f387e709a625376bb8b0d9d/graphy/ndict.py#L147-L161
jgyates/genmon
2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e
genmonlib/controller.py
python
GeneratorController.GetExternalCTData
(self)
return None
[]
def GetExternalCTData(self): try: if not self.UseExternalCTData: return None if self.ExternalCTData != None: with self.ExternalDataLock: return self.ExternalCTData.copy() else: return None except Exce...
[ "def", "GetExternalCTData", "(", "self", ")", ":", "try", ":", "if", "not", "self", ".", "UseExternalCTData", ":", "return", "None", "if", "self", ".", "ExternalCTData", "!=", "None", ":", "with", "self", ".", "ExternalDataLock", ":", "return", "self", "."...
https://github.com/jgyates/genmon/blob/2cb2ed2945f55cd8c259b09ccfa9a51e23f1341e/genmonlib/controller.py#L1722-L1734
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/views/generic/detail.py
python
SingleObjectMixin.get_context_object_name
(self, obj)
Get the name to use for the object.
Get the name to use for the object.
[ "Get", "the", "name", "to", "use", "for", "the", "object", "." ]
def get_context_object_name(self, obj): """ Get the name to use for the object. """ if self.context_object_name: return self.context_object_name elif isinstance(obj, models.Model): return obj._meta.model_name else: return None
[ "def", "get_context_object_name", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "context_object_name", ":", "return", "self", ".", "context_object_name", "elif", "isinstance", "(", "obj", ",", "models", ".", "Model", ")", ":", "return", "obj", ".", ...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/views/generic/detail.py#L85-L94
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/logging/__init__.py
python
LoggerAdapter.error
(self, msg, *args, **kwargs)
Delegate an error call to the underlying logger.
Delegate an error call to the underlying logger.
[ "Delegate", "an", "error", "call", "to", "the", "underlying", "logger", "." ]
def error(self, msg, *args, **kwargs): """ Delegate an error call to the underlying logger. """ self.log(ERROR, msg, *args, **kwargs)
[ "def", "error", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "ERROR", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/logging/__init__.py#L1616-L1620
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/mlb/teams.py
python
Team.saves
(self)
return self._saves
Returns an ``int`` of the total number of saves a team has accumulated during the season.
Returns an ``int`` of the total number of saves a team has accumulated during the season.
[ "Returns", "an", "int", "of", "the", "total", "number", "of", "saves", "a", "team", "has", "accumulated", "during", "the", "season", "." ]
def saves(self): """ Returns an ``int`` of the total number of saves a team has accumulated during the season. """ return self._saves
[ "def", "saves", "(", "self", ")", ":", "return", "self", ".", "_saves" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/mlb/teams.py#L1062-L1067