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
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/contrib/quest.py
python
QuestObject.__init__
(self,tGuess,tGuessSd,pThreshold,beta,delta,gamma,grain=0.01,range=None)
Initialize Quest parameters. Create an instance of QuestObject with all the information necessary to measure threshold. This was converted from the Psychtoolbox's QuestCreate function.
Initialize Quest parameters.
[ "Initialize", "Quest", "parameters", "." ]
def __init__(self,tGuess,tGuessSd,pThreshold,beta,delta,gamma,grain=0.01,range=None): """Initialize Quest parameters. Create an instance of QuestObject with all the information necessary to measure threshold. This was converted from the Psychtoolbox's QuestCreate function. """ ...
[ "def", "__init__", "(", "self", ",", "tGuess", ",", "tGuessSd", ",", "pThreshold", ",", "beta", ",", "delta", ",", "gamma", ",", "grain", "=", "0.01", ",", "range", "=", "None", ")", ":", "super", "(", "QuestObject", ",", "self", ")", ".", "__init__"...
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/contrib/quest.py#L116-L144
Arelle/Arelle
20f3d8a8afd41668e1520799acd333349ce0ba17
arelle/ModelDtsObject.py
python
ModelType.baseXbrliType
(self)
(str) -- The localName of the parent type in the xbrli namespace, if any, otherwise the localName of the parent in the xsd namespace.
(str) -- The localName of the parent type in the xbrli namespace, if any, otherwise the localName of the parent in the xsd namespace.
[ "(", "str", ")", "--", "The", "localName", "of", "the", "parent", "type", "in", "the", "xbrli", "namespace", "if", "any", "otherwise", "the", "localName", "of", "the", "parent", "in", "the", "xsd", "namespace", "." ]
def baseXbrliType(self): """(str) -- The localName of the parent type in the xbrli namespace, if any, otherwise the localName of the parent in the xsd namespace.""" try: return self._baseXbrliType except AttributeError: baseXbrliTypeQname = self.baseXbrliTypeQname ...
[ "def", "baseXbrliType", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_baseXbrliType", "except", "AttributeError", ":", "baseXbrliTypeQname", "=", "self", ".", "baseXbrliTypeQname", "if", "isinstance", "(", "baseXbrliTypeQname", ",", "list", ")", ":...
https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/ModelDtsObject.py#L1177-L1193
datacenter/ACI
9240622e6be03047f48628deacb5450212bd7ebe
configuration-python/generic_code/apicPython/setAutonomousSystemNumber.py
python
set_autonomous_system_number
(bgp_instpol, autonomous_system_number)
Set the number that uniquely identifies an autonomous system
Set the number that uniquely identifies an autonomous system
[ "Set", "the", "number", "that", "uniquely", "identifies", "an", "autonomous", "system" ]
def set_autonomous_system_number(bgp_instpol, autonomous_system_number): """Set the number that uniquely identifies an autonomous system """ bgp_asp = AsP(bgp_instpol, asn=autonomous_system_number)
[ "def", "set_autonomous_system_number", "(", "bgp_instpol", ",", "autonomous_system_number", ")", ":", "bgp_asp", "=", "AsP", "(", "bgp_instpol", ",", "asn", "=", "autonomous_system_number", ")" ]
https://github.com/datacenter/ACI/blob/9240622e6be03047f48628deacb5450212bd7ebe/configuration-python/generic_code/apicPython/setAutonomousSystemNumber.py#L11-L13
intel/virtual-storage-manager
00706ab9701acbd0d5e04b19cc80c6b66a2973b8
source/vsm/vsm/db/sqlalchemy/session.py
python
get_session
(autocommit=True, expire_on_commit=False)
return session
Return a SQLAlchemy session.
Return a SQLAlchemy session.
[ "Return", "a", "SQLAlchemy", "session", "." ]
def get_session(autocommit=True, expire_on_commit=False): """Return a SQLAlchemy session.""" global _MAKER if _MAKER is None: engine = get_engine() _MAKER = get_maker(engine, autocommit, expire_on_commit) session = _MAKER() session.query = vsm.exception.wrap_db_error(session.query)...
[ "def", "get_session", "(", "autocommit", "=", "True", ",", "expire_on_commit", "=", "False", ")", ":", "global", "_MAKER", "if", "_MAKER", "is", "None", ":", "engine", "=", "get_engine", "(", ")", "_MAKER", "=", "get_maker", "(", "engine", ",", "autocommit...
https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/vsm/vsm/db/sqlalchemy/session.py#L38-L49
mtianyan/VueDjangoAntdProBookShop
fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2
third_party/social_core/backends/coursera.py
python
CourseraOAuth2.user_data
(self, access_token, *args, **kwargs)
return self.get_json( 'https://api.coursera.org/api/externalBasicProfiles.v1?q=me', headers=self.get_auth_header(access_token) )
Load user data from the service
Load user data from the service
[ "Load", "user", "data", "from", "the", "service" ]
def user_data(self, access_token, *args, **kwargs): """Load user data from the service""" return self.get_json( 'https://api.coursera.org/api/externalBasicProfiles.v1?q=me', headers=self.get_auth_header(access_token) )
[ "def", "user_data", "(", "self", ",", "access_token", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_json", "(", "'https://api.coursera.org/api/externalBasicProfiles.v1?q=me'", ",", "headers", "=", "self", ".", "get_auth_header", ...
https://github.com/mtianyan/VueDjangoAntdProBookShop/blob/fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2/third_party/social_core/backends/coursera.py#L35-L40
mars-project/mars
6afd7ed86db77f29cc9470485698ef192ecc6d33
mars/utils.py
python
calc_nsplits
(chunk_idx_to_shape: Dict[Tuple[int], Tuple[int]])
return tuple(tileable_nsplits)
Calculate a tiled entity's nsplits. Parameters ---------- chunk_idx_to_shape : Dict type, {chunk_idx: chunk_shape} Returns ------- nsplits
Calculate a tiled entity's nsplits.
[ "Calculate", "a", "tiled", "entity", "s", "nsplits", "." ]
def calc_nsplits(chunk_idx_to_shape: Dict[Tuple[int], Tuple[int]]) -> Tuple[Tuple[int]]: """ Calculate a tiled entity's nsplits. Parameters ---------- chunk_idx_to_shape : Dict type, {chunk_idx: chunk_shape} Returns ------- nsplits """ ndim = len(next(iter(chunk_idx_to_shape)))...
[ "def", "calc_nsplits", "(", "chunk_idx_to_shape", ":", "Dict", "[", "Tuple", "[", "int", "]", ",", "Tuple", "[", "int", "]", "]", ")", "->", "Tuple", "[", "Tuple", "[", "int", "]", "]", ":", "ndim", "=", "len", "(", "next", "(", "iter", "(", "chu...
https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/utils.py#L644-L665
cronyo/cronyo
cd5abab0871b68bf31b18aac934303928130a441
cronyo/vendor/yaml/parser.py
python
Parser.parse_implicit_document_start
(self)
[]
def parse_implicit_document_start(self): # Parse an implicit document. if not self.check_token(DirectiveToken, DocumentStartToken, StreamEndToken): self.tag_handles = self.DEFAULT_TAGS token = self.peek_token() start_mark = end_mark = token.start_mark...
[ "def", "parse_implicit_document_start", "(", "self", ")", ":", "# Parse an implicit document.", "if", "not", "self", ".", "check_token", "(", "DirectiveToken", ",", "DocumentStartToken", ",", "StreamEndToken", ")", ":", "self", ".", "tag_handles", "=", "self", ".", ...
https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/yaml/parser.py#L139-L157
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
PathMetadata.__init__
(self, path, egg_info)
[]
def __init__(self, path, egg_info): self.module_path = path self.egg_info = egg_info
[ "def", "__init__", "(", "self", ",", "path", ",", "egg_info", ")", ":", "self", ".", "module_path", "=", "path", "self", ".", "egg_info", "=", "egg_info" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1827-L1829
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/datastore/datastore_v4_validator.py
python
_EntityValidator.validate_keys
(self, constraint, keys)
Validates a list of keys. Args: constraint: a _ValidationConstraint to apply keys: a list of datastore_v4_pb.Key objects Raises: ValidationError: if any of the keys is invalid
Validates a list of keys.
[ "Validates", "a", "list", "of", "keys", "." ]
def validate_keys(self, constraint, keys): """Validates a list of keys. Args: constraint: a _ValidationConstraint to apply keys: a list of datastore_v4_pb.Key objects Raises: ValidationError: if any of the keys is invalid """ for key in keys: self.validate_key(constraint, k...
[ "def", "validate_keys", "(", "self", ",", "constraint", ",", "keys", ")", ":", "for", "key", "in", "keys", ":", "self", ".", "validate_key", "(", "constraint", ",", "key", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/datastore/datastore_v4_validator.py#L168-L179
mypaint/mypaint
90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33
gui/buttonmap.py
python
button_press_parse
(name)
return button, mods
Converts button press names to a button number & modifier mask. Analogous to `Gtk.accelerator_parse()`. This function parses the strings created by `button_press_name()`, and returns a 2-tuple containing the button number and modifier mask corresponding to `name`. If the parse fails, both values will b...
Converts button press names to a button number & modifier mask.
[ "Converts", "button", "press", "names", "to", "a", "button", "number", "&", "modifier", "mask", "." ]
def button_press_parse(name): """Converts button press names to a button number & modifier mask. Analogous to `Gtk.accelerator_parse()`. This function parses the strings created by `button_press_name()`, and returns a 2-tuple containing the button number and modifier mask corresponding to `name`. If th...
[ "def", "button_press_parse", "(", "name", ")", ":", "if", "name", "is", "None", ":", "return", "(", "0", ",", "0", ")", "name", "=", "str", "(", "name", ")", "try", ":", "mods_s", ",", "button_s", "=", "name", ".", "split", "(", "\"Button\"", ",", ...
https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/gui/buttonmap.py#L72-L95
mozilla/DSAlign
9d36852f0e8ac3c98abb68bf941a9a60ce3f41e4
align/text.py
python
weighted_ngrams
(s, size, direction=0)
return enweight(ngrams(s, size), direction=direction)
Lists all appearances of all N-grams of a string from left to right together with a positional weight value. The positional weight progresses quadratically. :param s: String to decompose :param size: N-gram size :param direction: Order of assigning positional weights to N-grams: direction < 0: W...
Lists all appearances of all N-grams of a string from left to right together with a positional weight value. The positional weight progresses quadratically. :param s: String to decompose :param size: N-gram size :param direction: Order of assigning positional weights to N-grams: direction < 0: W...
[ "Lists", "all", "appearances", "of", "all", "N", "-", "grams", "of", "a", "string", "from", "left", "to", "right", "together", "with", "a", "positional", "weight", "value", ".", "The", "positional", "weight", "progresses", "quadratically", ".", ":", "param",...
def weighted_ngrams(s, size, direction=0): """ Lists all appearances of all N-grams of a string from left to right together with a positional weight value. The positional weight progresses quadratically. :param s: String to decompose :param size: N-gram size :param direction: Order of assigning ...
[ "def", "weighted_ngrams", "(", "s", ",", "size", ",", "direction", "=", "0", ")", ":", "return", "enweight", "(", "ngrams", "(", "s", ",", "size", ")", ",", "direction", "=", "direction", ")" ]
https://github.com/mozilla/DSAlign/blob/9d36852f0e8ac3c98abb68bf941a9a60ce3f41e4/align/text.py#L168-L180
Blosc/bloscpack
5efdadf5b6f61e995df1817943afb9629ce28c89
bloscpack/cli.py
python
BloscPackCustomFormatter._split_lines
(self, text, width)
return text.splitlines()
[]
def _split_lines(self, text, width): return text.splitlines()
[ "def", "_split_lines", "(", "self", ",", "text", ",", "width", ")", ":", "return", "text", ".", "splitlines", "(", ")" ]
https://github.com/Blosc/bloscpack/blob/5efdadf5b6f61e995df1817943afb9629ce28c89/bloscpack/cli.py#L200-L201
huawei-noah/Pretrained-Language-Model
d4694a134bdfacbaef8ff1d99735106bd3b3372b
TinyBERT/task_distill.py
python
WnliProcessor.get_dev_examples
(self, data_dir)
return self._create_examples( self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples( self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/TinyBERT/task_distill.py#L429-L432
openstack/magnum
fa298eeab19b1d87070d72c7c4fb26cd75b0781e
magnum/common/profiler.py
python
WsgiMiddleware.__call__
(self, request)
return request.get_response(self.application)
[]
def __call__(self, request): return request.get_response(self.application)
[ "def", "__call__", "(", "self", ",", "request", ")", ":", "return", "request", ".", "get_response", "(", "self", ".", "application", ")" ]
https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/common/profiler.py#L54-L55
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/viewer/models/data_dictionary.py
python
is_newline_error
(e)
return newline_error == text(e)
Return True is e is a new line error based on the error text. Otherwise return False.
Return True is e is a new line error based on the error text. Otherwise return False.
[ "Return", "True", "is", "e", "is", "a", "new", "line", "error", "based", "on", "the", "error", "text", ".", "Otherwise", "return", "False", "." ]
def is_newline_error(e): """ Return True is e is a new line error based on the error text. Otherwise return False. """ newline_error = u'new-line character seen in unquoted field - do you need'\ u' to open the file in universal-newline mode?' return newline_error == text(e)
[ "def", "is_newline_error", "(", "e", ")", ":", "newline_error", "=", "u'new-line character seen in unquoted field - do you need'", "u' to open the file in universal-newline mode?'", "return", "newline_error", "==", "text", "(", "e", ")" ]
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/viewer/models/data_dictionary.py#L30-L37
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/util/json.py
python
swap_inf_nan
(val)
This takes an arbitrary object and preps it for jsonifying safely, templating Inf/NaN.
This takes an arbitrary object and preps it for jsonifying safely, templating Inf/NaN.
[ "This", "takes", "an", "arbitrary", "object", "and", "preps", "it", "for", "jsonifying", "safely", "templating", "Inf", "/", "NaN", "." ]
def swap_inf_nan(val): """ This takes an arbitrary object and preps it for jsonifying safely, templating Inf/NaN. """ if isinstance(val, str): # basestring first, because it's a sequence and would otherwise get caught below. return val elif isinstance(val, Sequence): return [...
[ "def", "swap_inf_nan", "(", "val", ")", ":", "if", "isinstance", "(", "val", ",", "str", ")", ":", "# basestring first, because it's a sequence and would otherwise get caught below.", "return", "val", "elif", "isinstance", "(", "val", ",", "Sequence", ")", ":", "ret...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/util/json.py#L24-L45
littlecodersh/MyPlatform
6f9a946605466f580205f6e9e96e533720fce578
vendor/requests/utils.py
python
to_native_string
(string, encoding='ascii')
return out
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
[ "Given", "a", "string", "object", "regardless", "of", "type", "returns", "a", "representation", "of", "that", "string", "in", "the", "native", "string", "type", "encoding", "and", "decoding", "where", "necessary", ".", "This", "assumes", "ASCII", "unless", "to...
def to_native_string(string, encoding='ascii'): """ Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ out = None if isinstance(string, builtin_str...
[ "def", "to_native_string", "(", "string", ",", "encoding", "=", "'ascii'", ")", ":", "out", "=", "None", "if", "isinstance", "(", "string", ",", "builtin_str", ")", ":", "out", "=", "string", "else", ":", "if", "is_py2", ":", "out", "=", "string", ".",...
https://github.com/littlecodersh/MyPlatform/blob/6f9a946605466f580205f6e9e96e533720fce578/vendor/requests/utils.py#L690-L706
menpo/menpofit
5f2f45bab26df206d43292fd32d19cd8f62f0443
menpofit/math/fft_utils.py
python
fft_convolve2d_sum
(x, f, mode='same', boundary='constant', fft_filter=False, axis=0, keepdims=True)
r""" Performs fast 2d convolution in the frequency domain convolving each image channel with its corresponding filter channel and summing across the channel axis. Parameters ---------- x : ``(channels, height, width)`` `ndarray` Image. f : ``(channels, height, width)`` `ndarray` ...
r""" Performs fast 2d convolution in the frequency domain convolving each image channel with its corresponding filter channel and summing across the channel axis.
[ "r", "Performs", "fast", "2d", "convolution", "in", "the", "frequency", "domain", "convolving", "each", "image", "channel", "with", "its", "corresponding", "filter", "channel", "and", "summing", "across", "the", "channel", "axis", "." ]
def fft_convolve2d_sum(x, f, mode='same', boundary='constant', fft_filter=False, axis=0, keepdims=True): r""" Performs fast 2d convolution in the frequency domain convolving each image channel with its corresponding filter channel and summing across the channel axis. Paramete...
[ "def", "fft_convolve2d_sum", "(", "x", ",", "f", ",", "mode", "=", "'same'", ",", "boundary", "=", "'constant'", ",", "fft_filter", "=", "False", ",", "axis", "=", "0", ",", "keepdims", "=", "True", ")", ":", "if", "fft_filter", ":", "fft_ext_f", "=", ...
https://github.com/menpo/menpofit/blob/5f2f45bab26df206d43292fd32d19cd8f62f0443/menpofit/math/fft_utils.py#L169-L246
Chia-Network/chia-blockchain
34d44c1324ae634a0896f7b02eaa2802af9526cd
chia/pools/pool_wallet.py
python
PoolWallet.create_from_db
( wallet_state_manager: Any, wallet: Wallet, wallet_info: WalletInfo, name: str = None, )
return self
This creates a PoolWallet from DB. However, all data is already handled by WalletPoolStore, so we don't need to do anything here.
This creates a PoolWallet from DB. However, all data is already handled by WalletPoolStore, so we don't need to do anything here.
[ "This", "creates", "a", "PoolWallet", "from", "DB", ".", "However", "all", "data", "is", "already", "handled", "by", "WalletPoolStore", "so", "we", "don", "t", "need", "to", "do", "anything", "here", "." ]
async def create_from_db( wallet_state_manager: Any, wallet: Wallet, wallet_info: WalletInfo, name: str = None, ): """ This creates a PoolWallet from DB. However, all data is already handled by WalletPoolStore, so we don't need to do anything here. """...
[ "async", "def", "create_from_db", "(", "wallet_state_manager", ":", "Any", ",", "wallet", ":", "Wallet", ",", "wallet_info", ":", "WalletInfo", ",", "name", ":", "str", "=", "None", ",", ")", ":", "self", "=", "PoolWallet", "(", ")", "self", ".", "wallet...
https://github.com/Chia-Network/chia-blockchain/blob/34d44c1324ae634a0896f7b02eaa2802af9526cd/chia/pools/pool_wallet.py#L374-L392
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
p2pool/main.py
python
run
()
[]
def run(): if not hasattr(tcp.Client, 'abortConnection'): print "Twisted doesn't have abortConnection! Upgrade to a newer version of Twisted to avoid memory leaks!" print 'Pausing for 3 seconds...' time.sleep(3) realnets = dict((name, net) for name, net in networks.nets.iteritems() ...
[ "def", "run", "(", ")", ":", "if", "not", "hasattr", "(", "tcp", ".", "Client", ",", "'abortConnection'", ")", ":", "print", "\"Twisted doesn't have abortConnection! Upgrade to a newer version of Twisted to avoid memory leaks!\"", "print", "'Pausing for 3 seconds...'", "time"...
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/p2pool/main.py#L437-L675
lordmauve/pgzero
46a889fb918ccd606d39ba63680386d7f8fcbc5a
pgzero/spellcheck.py
python
distance
(a, b)
return d[la, lb]
Compute the distance between a and b. This is based on Damerau-Levenshtein distance, but we modify the cost of some edits, like insertion or removal of '_', or capitalisation changes.
Compute the distance between a and b.
[ "Compute", "the", "distance", "between", "a", "and", "b", "." ]
def distance(a, b): """Compute the distance between a and b. This is based on Damerau-Levenshtein distance, but we modify the cost of some edits, like insertion or removal of '_', or capitalisation changes. """ d = {} la = len(a) lb = len(b) for i in range(la + 1): d[i, 0] = i ...
[ "def", "distance", "(", "a", ",", "b", ")", ":", "d", "=", "{", "}", "la", "=", "len", "(", "a", ")", "lb", "=", "len", "(", "b", ")", "for", "i", "in", "range", "(", "la", "+", "1", ")", ":", "d", "[", "i", ",", "0", "]", "=", "i", ...
https://github.com/lordmauve/pgzero/blob/46a889fb918ccd606d39ba63680386d7f8fcbc5a/pgzero/spellcheck.py#L8-L43
log2timeline/plaso
fe2e316b8c76a0141760c0f2f181d84acb83abc2
plaso/containers/manager.py
python
AttributeContainersManager.DeregisterAttributeContainer
(cls, attribute_container_class)
Deregisters an attribute container class. The attribute container classes are identified based on their lower case container type. Args: attribute_container_class (type): attribute container class. Raises: KeyError: if attribute container class is not set for the corresponding c...
Deregisters an attribute container class.
[ "Deregisters", "an", "attribute", "container", "class", "." ]
def DeregisterAttributeContainer(cls, attribute_container_class): """Deregisters an attribute container class. The attribute container classes are identified based on their lower case container type. Args: attribute_container_class (type): attribute container class. Raises: KeyError: ...
[ "def", "DeregisterAttributeContainer", "(", "cls", ",", "attribute_container_class", ")", ":", "container_type", "=", "attribute_container_class", ".", "CONTAINER_TYPE", ".", "lower", "(", ")", "if", "container_type", "not", "in", "cls", ".", "_attribute_container_class...
https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/containers/manager.py#L32-L51
ocrbook/ocrinaction
f2b83084c1d1ce67193865c6d2cad162599ae216
chapter-5/synthText/synth_utils.py
python
implicit_plot
(expr, ext_grid, Nx=11, Ny=11, Nz=11, col_isurf=(50/255, 199/255, 152/255))
Function to plot algebraic surfaces described by implicit equations in Mayavi Implicit functions are functions of the form `F(x,y,z) = c` where `c` is an arbitrary constant. Parameters ---------- expr : string The expression `F(x,y,z) - c`; e.g. to plot a unit sphere, the...
Function to plot algebraic surfaces described by implicit equations in Mayavi
[ "Function", "to", "plot", "algebraic", "surfaces", "described", "by", "implicit", "equations", "in", "Mayavi" ]
def implicit_plot(expr, ext_grid, Nx=11, Ny=11, Nz=11, col_isurf=(50/255, 199/255, 152/255)): """ Function to plot algebraic surfaces described by implicit equations in Mayavi Implicit functions are functions of the form `F(x,y,z) = c` where `c` is an arbitrary constant. ...
[ "def", "implicit_plot", "(", "expr", ",", "ext_grid", ",", "Nx", "=", "11", ",", "Ny", "=", "11", ",", "Nz", "=", "11", ",", "col_isurf", "=", "(", "50", "/", "255", ",", "199", "/", "255", ",", "152", "/", "255", ")", ")", ":", "xl", ",", ...
https://github.com/ocrbook/ocrinaction/blob/f2b83084c1d1ce67193865c6d2cad162599ae216/chapter-5/synthText/synth_utils.py#L82-L120
bigmlcom/python
35f69d2f3121f1b3dde43495cf145d4992796ad5
bigml/util.py
python
check_no_training_missings
(input_data, fields, weight_field=None, objective_id=None)
Checks whether some input fields are missing in the input data while not training data has no missings in that field
Checks whether some input fields are missing in the input data while not training data has no missings in that field
[ "Checks", "whether", "some", "input", "fields", "are", "missing", "in", "the", "input", "data", "while", "not", "training", "data", "has", "no", "missings", "in", "that", "field" ]
def check_no_training_missings(input_data, fields, weight_field=None, objective_id=None): """Checks whether some input fields are missing in the input data while not training data has no missings in that field """ for field_id, field in list(fields.items()): if (f...
[ "def", "check_no_training_missings", "(", "input_data", ",", "fields", ",", "weight_field", "=", "None", ",", "objective_id", "=", "None", ")", ":", "for", "field_id", ",", "field", "in", "list", "(", "fields", ".", "items", "(", ")", ")", ":", "if", "("...
https://github.com/bigmlcom/python/blob/35f69d2f3121f1b3dde43495cf145d4992796ad5/bigml/util.py#L558-L572
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/channels/ci_channel.py
python
CIChannel.ci_count_edges_count_reset_active_edge
(self)
return Edge(val.value)
:class:`nidaqmx.constants.Edge`: Specifies on which edge of the signal to reset the count.
:class:`nidaqmx.constants.Edge`: Specifies on which edge of the signal to reset the count.
[ ":", "class", ":", "nidaqmx", ".", "constants", ".", "Edge", ":", "Specifies", "on", "which", "edge", "of", "the", "signal", "to", "reset", "the", "count", "." ]
def ci_count_edges_count_reset_active_edge(self): """ :class:`nidaqmx.constants.Edge`: Specifies on which edge of the signal to reset the count. """ val = ctypes.c_int() cfunc = lib_importer.windll.DAQmxGetCICountEdgesCountResetActiveEdge if cfunc.argtypes is...
[ "def", "ci_count_edges_count_reset_active_edge", "(", "self", ")", ":", "val", "=", "ctypes", ".", "c_int", "(", ")", "cfunc", "=", "lib_importer", ".", "windll", ".", "DAQmxGetCICountEdgesCountResetActiveEdge", "if", "cfunc", ".", "argtypes", "is", "None", ":", ...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L629-L648
Kaggle/kaggle-api
49057db362903d158b1e71a43d888b981dd27159
kaggle/models/license.py
python
License.to_str
(self)
return pprint.pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/Kaggle/kaggle-api/blob/49057db362903d158b1e71a43d888b981dd27159/kaggle/models/license.py#L120-L122
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/graphy/util.py
python
_IsColor
(color)
return True
Try to determine if color is a hex color string. Labels that look like hex colors will match too, unfortunately.
Try to determine if color is a hex color string. Labels that look like hex colors will match too, unfortunately.
[ "Try", "to", "determine", "if", "color", "is", "a", "hex", "color", "string", ".", "Labels", "that", "look", "like", "hex", "colors", "will", "match", "too", "unfortunately", "." ]
def _IsColor(color): """Try to determine if color is a hex color string. Labels that look like hex colors will match too, unfortunately.""" if not isinstance(color, basestring): return False color = color.strip('#') if len(color) != 3 and len(color) != 6: return False hex_letters = '0123456789abcd...
[ "def", "_IsColor", "(", "color", ")", ":", "if", "not", "isinstance", "(", "color", ",", "basestring", ")", ":", "return", "False", "color", "=", "color", ".", "strip", "(", "'#'", ")", "if", "len", "(", "color", ")", "!=", "3", "and", "len", "(", ...
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/graphy/util.py#L1-L13
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/common/openstack_identity.py
python
OpenStackIdentityConnection.clear_cached_auth_context
(self)
Clear the cached authentication context. The context is cleared from fields on this connection and from the external cache, if one is configured.
Clear the cached authentication context.
[ "Clear", "the", "cached", "authentication", "context", "." ]
def clear_cached_auth_context(self): """ Clear the cached authentication context. The context is cleared from fields on this connection and from the external cache, if one is configured. """ self.auth_token = None self.auth_token_expires = None self.auth_...
[ "def", "clear_cached_auth_context", "(", "self", ")", ":", "self", ".", "auth_token", "=", "None", "self", ".", "auth_token_expires", "=", "None", "self", ".", "auth_user_info", "=", "None", "self", ".", "auth_user_roles", "=", "None", "self", ".", "urls", "...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/common/openstack_identity.py#L822-L836
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/external/edb.py
python
Pdb.handle_command_def
(self, line)
return
Handles one command line during command list definition.
Handles one command line during command list definition.
[ "Handles", "one", "command", "line", "during", "command", "list", "definition", "." ]
def handle_command_def(self, line): """Handles one command line during command list definition.""" cmd, arg, line = self.parseline(line) if not cmd: return if cmd == 'silent': self.commands_silent[self.commands_bnum] = True return # continue to handle...
[ "def", "handle_command_def", "(", "self", ",", "line", ")", ":", "cmd", ",", "arg", ",", "line", "=", "self", ".", "parseline", "(", "line", ")", "if", "not", "cmd", ":", "return", "if", "cmd", "==", "'silent'", ":", "self", ".", "commands_silent", "...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/external/edb.py#L542-L568
danecjensen/subscribely
4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0
src/flaskext/gae_mini_profiler/__init__.py
python
GAEMiniProfiler._process_response
(self, response)
return response
Process response and append the profiler code if appropriate.
Process response and append the profiler code if appropriate.
[ "Process", "response", "and", "append", "the", "profiler", "code", "if", "appropriate", "." ]
def _process_response(self, response): """Process response and append the profiler code if appropriate.""" if response.status_code != 200 or not response.is_sequence: return response response_html = response.data.decode(response.charset) profiler_html = self._render_profile...
[ "def", "_process_response", "(", "self", ",", "response", ")", ":", "if", "response", ".", "status_code", "!=", "200", "or", "not", "response", ".", "is_sequence", ":", "return", "response", "response_html", "=", "response", ".", "data", ".", "decode", "(", ...
https://github.com/danecjensen/subscribely/blob/4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0/src/flaskext/gae_mini_profiler/__init__.py#L109-L127
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/kombu/kombu/connection.py
python
Connection.recoverable_channel_errors
(self)
List of channel related exceptions that can be automatically recovered from without re-establishing the connection.
List of channel related exceptions that can be automatically recovered from without re-establishing the connection.
[ "List", "of", "channel", "related", "exceptions", "that", "can", "be", "automatically", "recovered", "from", "without", "re", "-", "establishing", "the", "connection", "." ]
def recoverable_channel_errors(self): """List of channel related exceptions that can be automatically recovered from without re-establishing the connection.""" try: return self.transport.recoverable_channel_errors except AttributeError: return ()
[ "def", "recoverable_channel_errors", "(", "self", ")", ":", "try", ":", "return", "self", ".", "transport", ".", "recoverable_channel_errors", "except", "AttributeError", ":", "return", "(", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/kombu/kombu/connection.py#L795-L801
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/alfred-pushbullet/lib/requests/adapters.py
python
HTTPAdapter.cert_verify
(self, conn, url, verify, cert)
Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :...
Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
[ "Verify", "a", "SSL", "certificate", ".", "This", "method", "should", "not", "be", "called", "from", "user", "code", "and", "is", "only", "exposed", "for", "use", "when", "subclassing", "the", ":", "class", ":", "HTTPAdapter", "<requests", ".", "adapters", ...
def cert_verify(self, conn, url, verify, cert): """Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`. :param conn: The urllib3 connection object associated with...
[ "def", "cert_verify", "(", "self", ",", "conn", ",", "url", ",", "verify", ",", "cert", ")", ":", "if", "url", ".", "lower", "(", ")", ".", "startswith", "(", "'https'", ")", "and", "verify", ":", "cert_loc", "=", "None", "# Allow self-specified cert loc...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/alfred-pushbullet/lib/requests/adapters.py#L164-L204
EtienneCmb/visbrain
b599038e095919dc193b12d5e502d127de7d03c9
visbrain/visuals/hypno_visual.py
python
HypogramVisual._prepare_transforms
(self, view)
Call for the first rendering.
Call for the first rendering.
[ "Call", "for", "the", "first", "rendering", "." ]
def _prepare_transforms(self, view): """Call for the first rendering.""" tr = view.transforms view_vert = view.view_program.vert view_vert['transform'] = tr.get_transform()
[ "def", "_prepare_transforms", "(", "self", ",", "view", ")", ":", "tr", "=", "view", ".", "transforms", "view_vert", "=", "view", ".", "view_program", ".", "vert", "view_vert", "[", "'transform'", "]", "=", "tr", ".", "get_transform", "(", ")" ]
https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/visuals/hypno_visual.py#L204-L208
wuhuikai/FaceSwap
c1e7e7519170cacce21d4255ece98f1d7344ebe5
face_swap.py
python
triangular_affine_matrices
(vertices, src_points, dst_points)
Calculate the affine transformation matrix for each triangle (x,y) vertex from dst_points to src_points :param vertices: array of triplet indices to corners of triangle :param src_points: array of [x, y] points to landmarks for source image :param dst_points: array of [x, y] points to landmarks for dest...
Calculate the affine transformation matrix for each triangle (x,y) vertex from dst_points to src_points :param vertices: array of triplet indices to corners of triangle :param src_points: array of [x, y] points to landmarks for source image :param dst_points: array of [x, y] points to landmarks for dest...
[ "Calculate", "the", "affine", "transformation", "matrix", "for", "each", "triangle", "(", "x", "y", ")", "vertex", "from", "dst_points", "to", "src_points", ":", "param", "vertices", ":", "array", "of", "triplet", "indices", "to", "corners", "of", "triangle", ...
def triangular_affine_matrices(vertices, src_points, dst_points): """ Calculate the affine transformation matrix for each triangle (x,y) vertex from dst_points to src_points :param vertices: array of triplet indices to corners of triangle :param src_points: array of [x, y] points to landmarks for so...
[ "def", "triangular_affine_matrices", "(", "vertices", ",", "src_points", ",", "dst_points", ")", ":", "ones", "=", "[", "1", ",", "1", ",", "1", "]", "for", "tri_indices", "in", "vertices", ":", "src_tri", "=", "np", ".", "vstack", "(", "(", "src_points"...
https://github.com/wuhuikai/FaceSwap/blob/c1e7e7519170cacce21d4255ece98f1d7344ebe5/face_swap.py#L66-L80
devitocodes/devito
6abd441e3f5f091775ad332be6b95e017b8cbd16
devito/operations/interpolators.py
python
LinearInterpolator._interpolation_indices
(self, variables, offset=0, field_offset=0)
return idx_subs, temps
Generate interpolation indices for the DiscreteFunctions in ``variables``.
Generate interpolation indices for the DiscreteFunctions in ``variables``.
[ "Generate", "interpolation", "indices", "for", "the", "DiscreteFunctions", "in", "variables", "." ]
def _interpolation_indices(self, variables, offset=0, field_offset=0): """ Generate interpolation indices for the DiscreteFunctions in ``variables``. """ index_matrix, points = self.sfunction._index_matrix(offset) idx_subs = [] for i, idx in enumerate(index_matrix): ...
[ "def", "_interpolation_indices", "(", "self", ",", "variables", ",", "offset", "=", "0", ",", "field_offset", "=", "0", ")", ":", "index_matrix", ",", "points", "=", "self", ".", "sfunction", ".", "_index_matrix", "(", "offset", ")", "idx_subs", "=", "[", ...
https://github.com/devitocodes/devito/blob/6abd441e3f5f091775ad332be6b95e017b8cbd16/devito/operations/interpolators.py#L172-L208
erevus-cn/pocscan
5fef32b1abe22a9f666ad3aacfd1f99d784cb72d
pocscan/plugins/pocsuite/packages/requests/cookies.py
python
RequestsCookieJar.iterkeys
(self)
Dict-like iterkeys() that returns an iterator of names of cookies from the jar. See itervalues() and iteritems().
Dict-like iterkeys() that returns an iterator of names of cookies from the jar. See itervalues() and iteritems().
[ "Dict", "-", "like", "iterkeys", "()", "that", "returns", "an", "iterator", "of", "names", "of", "cookies", "from", "the", "jar", ".", "See", "itervalues", "()", "and", "iteritems", "()", "." ]
def iterkeys(self): """Dict-like iterkeys() that returns an iterator of names of cookies from the jar. See itervalues() and iteritems().""" for cookie in iter(self): yield cookie.name
[ "def", "iterkeys", "(", "self", ")", ":", "for", "cookie", "in", "iter", "(", "self", ")", ":", "yield", "cookie", ".", "name" ]
https://github.com/erevus-cn/pocscan/blob/5fef32b1abe22a9f666ad3aacfd1f99d784cb72d/pocscan/plugins/pocsuite/packages/requests/cookies.py#L201-L205
littlecodersh/ItChat
d5ce5db32ca15cef8eefa548a438a9fcc4502a6d
itchat/storage/templates.py
python
ChatroomMember.send_raw_msg
(self, msgType, content)
return ReturnValue({'BaseResponse': { 'Ret': -1006, 'ErrMsg': '%s can not send message directly' % \ self.__class__.__name__, }, })
[]
def send_raw_msg(self, msgType, content): return ReturnValue({'BaseResponse': { 'Ret': -1006, 'ErrMsg': '%s can not send message directly' % \ self.__class__.__name__, }, })
[ "def", "send_raw_msg", "(", "self", ",", "msgType", ",", "content", ")", ":", "return", "ReturnValue", "(", "{", "'BaseResponse'", ":", "{", "'Ret'", ":", "-", "1006", ",", "'ErrMsg'", ":", "'%s can not send message directly'", "%", "self", ".", "__class__", ...
https://github.com/littlecodersh/ItChat/blob/d5ce5db32ca15cef8eefa548a438a9fcc4502a6d/itchat/storage/templates.py#L272-L276
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/rpc/ndr.py
python
NdrShort.pack
(cls, data)
return struct.pack("<H", data)
[]
def pack(cls, data): return struct.pack("<H", data)
[ "def", "pack", "(", "cls", ",", "data", ")", ":", "return", "struct", ".", "pack", "(", "\"<H\"", ",", "data", ")" ]
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/rpc/ndr.py#L236-L237
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
Draw_Protein_Dimensions.py
python
matriz_inercia
(selection)
return ord_autoval
DESCRIPTION The method calculates the mass center, the inertia tensor and the eigenvalues and eigenvectors for a given selection. Mostly taken from inertia_tensor.py
DESCRIPTION
[ "DESCRIPTION" ]
def matriz_inercia(selection): ''' DESCRIPTION The method calculates the mass center, the inertia tensor and the eigenvalues and eigenvectors for a given selection. Mostly taken from inertia_tensor.py ''' model = cmd.get_model(selection) totmass = 0.0 x,y,z = 0,0,0 for a in model.atom: m = a.get_mass() x...
[ "def", "matriz_inercia", "(", "selection", ")", ":", "model", "=", "cmd", ".", "get_model", "(", "selection", ")", "totmass", "=", "0.0", "x", ",", "y", ",", "z", "=", "0", ",", "0", ",", "0", "for", "a", "in", "model", ".", "atom", ":", "m", "...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/Draw_Protein_Dimensions.py#L66-L117
datacenter/acitoolkit
629b84887dd0f0183b81efc8adb16817f985541a
applications/search/aciSearchDb.py
python
SearchIndexLookup.add_atk_objects
(self, root)
Will add all the objects recursively from the root down into the index :param root:
Will add all the objects recursively from the root down into the index :param root:
[ "Will", "add", "all", "the", "objects", "recursively", "from", "the", "root", "down", "into", "the", "index", ":", "param", "root", ":" ]
def add_atk_objects(self, root): """ Will add all the objects recursively from the root down into the index :param root: """ searchables = root.get_searchable() self._index_searchables(searchables) pass
[ "def", "add_atk_objects", "(", "self", ",", "root", ")", ":", "searchables", "=", "root", ".", "get_searchable", "(", ")", "self", ".", "_index_searchables", "(", "searchables", ")", "pass" ]
https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/applications/search/aciSearchDb.py#L434-L441
ets-labs/python-dependency-injector
541131e33858ee1b8b5a7590d2bb9f929740ea1e
src/dependency_injector/ext/flask.py
python
ClassBasedView.as_view
(self, name)
return as_view(self, name)
Return Flask view function.
Return Flask view function.
[ "Return", "Flask", "view", "function", "." ]
def as_view(self, name): """Return Flask view function.""" return as_view(self, name)
[ "def", "as_view", "(", "self", ",", "name", ")", ":", "return", "as_view", "(", "self", ",", "name", ")" ]
https://github.com/ets-labs/python-dependency-injector/blob/541131e33858ee1b8b5a7590d2bb9f929740ea1e/src/dependency_injector/ext/flask.py#L40-L42
googlefonts/gftools
8ad55dd4d7e38729524329c79f236476f1576e67
Lib/gftools/fix.py
python
inherit_vertical_metrics
(ttFonts, family_name=None)
Inherit the vertical metrics from the same family which is hosted on Google Fonts. Args: ttFonts: a list of TTFont instances which belong to a family family_name: Optional string which allows users to specify a different family to inherit from e.g "Maven Pro".
Inherit the vertical metrics from the same family which is hosted on Google Fonts.
[ "Inherit", "the", "vertical", "metrics", "from", "the", "same", "family", "which", "is", "hosted", "on", "Google", "Fonts", "." ]
def inherit_vertical_metrics(ttFonts, family_name=None): """Inherit the vertical metrics from the same family which is hosted on Google Fonts. Args: ttFonts: a list of TTFont instances which belong to a family family_name: Optional string which allows users to specify a differen...
[ "def", "inherit_vertical_metrics", "(", "ttFonts", ",", "family_name", "=", "None", ")", ":", "family_name", "=", "font_familyname", "(", "ttFonts", "[", "0", "]", ")", "if", "not", "family_name", "else", "family_name", "gf_fonts", "=", "list", "(", "map", "...
https://github.com/googlefonts/gftools/blob/8ad55dd4d7e38729524329c79f236476f1576e67/Lib/gftools/fix.py#L483-L509
keras-team/keras-contrib
3fc5ef709e061416f4bc8a92ca3750c824b5d2b0
keras_contrib/activations/squash.py
python
squash
(x, axis=-1)
return scale * x
Squash activation function (generally used in Capsule layers).
Squash activation function (generally used in Capsule layers).
[ "Squash", "activation", "function", "(", "generally", "used", "in", "Capsule", "layers", ")", "." ]
def squash(x, axis=-1): """ Squash activation function (generally used in Capsule layers). """ s_squared_norm = K.sum(K.square(x), axis, keepdims=True) + K.epsilon() scale = K.sqrt(s_squared_norm) / (0.5 + s_squared_norm) return scale * x
[ "def", "squash", "(", "x", ",", "axis", "=", "-", "1", ")", ":", "s_squared_norm", "=", "K", ".", "sum", "(", "K", ".", "square", "(", "x", ")", ",", "axis", ",", "keepdims", "=", "True", ")", "+", "K", ".", "epsilon", "(", ")", "scale", "=",...
https://github.com/keras-team/keras-contrib/blob/3fc5ef709e061416f4bc8a92ca3750c824b5d2b0/keras_contrib/activations/squash.py#L4-L10
d2l-ai/d2l-zh
1c2e25a557db446b5691c18e595e5664cc254730
d2l/tensorflow.py
python
Animator.__init__
(self, xlabel=None, ylabel=None, legend=None, xlim=None, ylim=None, xscale='linear', yscale='linear', fmts=('-', 'm--', 'g-.', 'r:'), nrows=1, ncols=1, figsize=(3.5, 2.5))
Defined in :numref:`sec_softmax_scratch`
Defined in :numref:`sec_softmax_scratch`
[ "Defined", "in", ":", "numref", ":", "sec_softmax_scratch" ]
def __init__(self, xlabel=None, ylabel=None, legend=None, xlim=None, ylim=None, xscale='linear', yscale='linear', fmts=('-', 'm--', 'g-.', 'r:'), nrows=1, ncols=1, figsize=(3.5, 2.5)): """Defined in :numref:`sec_softmax_scratch`""" # 增量地绘制多条线 if...
[ "def", "__init__", "(", "self", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "legend", "=", "None", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "xscale", "=", "'linear'", ",", "yscale", "=", "'linear'", ",", "fmts", "="...
https://github.com/d2l-ai/d2l-zh/blob/1c2e25a557db446b5691c18e595e5664cc254730/d2l/tensorflow.py#L260-L275
lazybird/django-carton
eff1bd577913f08d9c8246f69afdef70b85dc649
carton/cart.py
python
Cart.unique_count
(self)
return len(self._items_dict)
The number of unique items in cart, regardless of the quantity.
The number of unique items in cart, regardless of the quantity.
[ "The", "number", "of", "unique", "items", "in", "cart", "regardless", "of", "the", "quantity", "." ]
def unique_count(self): """ The number of unique items in cart, regardless of the quantity. """ return len(self._items_dict)
[ "def", "unique_count", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_items_dict", ")" ]
https://github.com/lazybird/django-carton/blob/eff1bd577913f08d9c8246f69afdef70b85dc649/carton/cart.py#L185-L189
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/dataset_helper.py
python
download_dataset
( storage_client, image_batches, target_dir, local_dataset_copy=None )
Downloads dataset, organize it by batches and rename images. Args: storage_client: instance of the CompetitionStorageClient image_batches: subclass of ImageBatchesBase with data about images target_dir: target directory, should exist and be empty local_dataset_copy: directory with local dat...
Downloads dataset, organize it by batches and rename images.
[ "Downloads", "dataset", "organize", "it", "by", "batches", "and", "rename", "images", "." ]
def download_dataset( storage_client, image_batches, target_dir, local_dataset_copy=None ): """Downloads dataset, organize it by batches and rename images. Args: storage_client: instance of the CompetitionStorageClient image_batches: subclass of ImageBatchesBase with data about images tar...
[ "def", "download_dataset", "(", "storage_client", ",", "image_batches", ",", "target_dir", ",", "local_dataset_copy", "=", "None", ")", ":", "for", "batch_id", ",", "batch_value", "in", "iteritems", "(", "image_batches", ".", "data", ")", ":", "batch_dir", "=", ...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/dataset_helper.py#L123-L158
Urinx/WeixinBot
d9edcd2c9203fe7dd203b22b71bbc48a31e9492b
wxbot_demo_py3/weixin.py
python
WebWeixin.login
(self)
return True
[]
def login(self): data = self._get(self.redirect_uri) if data == '': return False doc = xml.dom.minidom.parseString(data) root = doc.documentElement for node in root.childNodes: if node.nodeName == 'skey': self.skey = node.childNodes[0].dat...
[ "def", "login", "(", "self", ")", ":", "data", "=", "self", ".", "_get", "(", "self", ".", "redirect_uri", ")", "if", "data", "==", "''", ":", "return", "False", "doc", "=", "xml", ".", "dom", ".", "minidom", ".", "parseString", "(", "data", ")", ...
https://github.com/Urinx/WeixinBot/blob/d9edcd2c9203fe7dd203b22b71bbc48a31e9492b/wxbot_demo_py3/weixin.py#L241-L267
hottbox/hottbox
26580018ec6d38a1b08266c04ce4408c9e276130
hottbox/pdtools/utils.py
python
pd_to_tensor
(df, keep_index=True)
return tensor
Represent multi-index pandas dataframe as a tensor Parameters ---------- df : pd.DataFrame Multi-index dataframe with only one column of data keep_index : bool Keep level values of dataframe multi-index Returns ------- tensor : Tensor Examples -------- >>> impo...
Represent multi-index pandas dataframe as a tensor
[ "Represent", "multi", "-", "index", "pandas", "dataframe", "as", "a", "tensor" ]
def pd_to_tensor(df, keep_index=True): """ Represent multi-index pandas dataframe as a tensor Parameters ---------- df : pd.DataFrame Multi-index dataframe with only one column of data keep_index : bool Keep level values of dataframe multi-index Returns ------- tensor :...
[ "def", "pd_to_tensor", "(", "df", ",", "keep_index", "=", "True", ")", ":", "# TODO: need to think what should we do when multi-index dataframe is composed of several columns", "# Reshape values into multi-dimensional array", "dims", "=", "tuple", "(", "[", "len", "(", "level",...
https://github.com/hottbox/hottbox/blob/26580018ec6d38a1b08266c04ce4408c9e276130/hottbox/pdtools/utils.py#L7-L85
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py
python
SessionTransaction._prepare_impl
(self)
[]
def _prepare_impl(self): self._assert_active() if self._parent is None or self.nested: self.session.dispatch.before_commit(self.session) stx = self.session.transaction if stx is not self: for subtransaction in stx._iterate_self_and_parents(upto=self): ...
[ "def", "_prepare_impl", "(", "self", ")", ":", "self", ".", "_assert_active", "(", ")", "if", "self", ".", "_parent", "is", "None", "or", "self", ".", "nested", ":", "self", ".", "session", ".", "dispatch", ".", "before_commit", "(", "self", ".", "sess...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py#L433-L462
usb-tools/Facedancer
e688fe61dc34087db333432394e1f90e52ac3794
facedancer/filters/logging.py
python
USBProxyPrettyPrintFilter.filter_in
(self, ep_num, data)
return ep_num, data
Log IN transfers without modification.
Log IN transfers without modification.
[ "Log", "IN", "transfers", "without", "modification", "." ]
def filter_in(self, ep_num, data): """ Log IN transfers without modification. """ if self.verbose > 4 and data: self._pretty_print_data(data, '<', self.decoration, ep_marker=ep_num) return ep_num, data
[ "def", "filter_in", "(", "self", ",", "ep_num", ",", "data", ")", ":", "if", "self", ".", "verbose", ">", "4", "and", "data", ":", "self", ".", "_pretty_print_data", "(", "data", ",", "'<'", ",", "self", ".", "decoration", ",", "ep_marker", "=", "ep_...
https://github.com/usb-tools/Facedancer/blob/e688fe61dc34087db333432394e1f90e52ac3794/facedancer/filters/logging.py#L77-L85
freelawproject/courtlistener
ab3ae7bb6e5e836b286749113e7dbb403d470912
cl/recap/tasks.py
python
create_or_merge_from_idb_chunk
(idb_chunk)
Take a chunk of IDB rows and either merge them into the Docket table or create new items for them in the docket table. :param idb_chunk: A list of FjcIntegratedDatabase PKs :type idb_chunk: list :return: None :rtype: None
Take a chunk of IDB rows and either merge them into the Docket table or create new items for them in the docket table.
[ "Take", "a", "chunk", "of", "IDB", "rows", "and", "either", "merge", "them", "into", "the", "Docket", "table", "or", "create", "new", "items", "for", "them", "in", "the", "docket", "table", "." ]
def create_or_merge_from_idb_chunk(idb_chunk): """Take a chunk of IDB rows and either merge them into the Docket table or create new items for them in the docket table. :param idb_chunk: A list of FjcIntegratedDatabase PKs :type idb_chunk: list :return: None :rtype: None """ for idb_pk ...
[ "def", "create_or_merge_from_idb_chunk", "(", "idb_chunk", ")", ":", "for", "idb_pk", "in", "idb_chunk", ":", "idb_row", "=", "FjcIntegratedDatabase", ".", "objects", ".", "get", "(", "pk", "=", "idb_pk", ")", "ds", "=", "(", "Docket", ".", "objects", ".", ...
https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/recap/tasks.py#L1016-L1057
tpeng/weibosearch
75997f2d8f7b833dd01128e034e50c30dd41a2c6
weibosearch/timerange/__init__.py
python
temporalrange.delta
(self)
return self.to - self.frm
Fetch the datetime.timedelta between self.frm and self.to
Fetch the datetime.timedelta between self.frm and self.to
[ "Fetch", "the", "datetime", ".", "timedelta", "between", "self", ".", "frm", "and", "self", ".", "to" ]
def delta(self): """Fetch the datetime.timedelta between self.frm and self.to""" return self.to - self.frm
[ "def", "delta", "(", "self", ")", ":", "return", "self", ".", "to", "-", "self", ".", "frm" ]
https://github.com/tpeng/weibosearch/blob/75997f2d8f7b833dd01128e034e50c30dd41a2c6/weibosearch/timerange/__init__.py#L37-L39
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/venv/lib/python2.7/site-packages/pip/index.py
python
PackageFinder._get_index_urls_locations
(self, project_name)
return []
Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations
Returns the locations found via self.index_urls
[ "Returns", "the", "locations", "found", "via", "self", ".", "index_urls" ]
def _get_index_urls_locations(self, project_name): """Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations """ def mkurl_pypi_url(url): loc = posixpath.join(url, proj...
[ "def", "_get_index_urls_locations", "(", "self", ",", "project_name", ")", ":", "def", "mkurl_pypi_url", "(", "url", ")", ":", "loc", "=", "posixpath", ".", "join", "(", "url", ",", "project_url_name", ")", "# For maximum compatibility with easy_install, ensure the pa...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/index.py#L349-L394
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/formdetails/readable.py
python
_html_interpolate_output_refs
(itext_value, context)
[]
def _html_interpolate_output_refs(itext_value, context): if hasattr(itext_value, 'with_refs'): underline_template = '<u>&nbsp;&nbsp;%s&nbsp;&nbsp;</u>' return mark_safe( # nosec: output is escaped itext_value.with_refs( context, processor=lambda x: underl...
[ "def", "_html_interpolate_output_refs", "(", "itext_value", ",", "context", ")", ":", "if", "hasattr", "(", "itext_value", ",", "'with_refs'", ")", ":", "underline_template", "=", "'<u>&nbsp;&nbsp;%s&nbsp;&nbsp;</u>'", "return", "mark_safe", "(", "# nosec: output is escap...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/formdetails/readable.py#L161-L176
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized/cards/aero/aero_cards.py
python
AERO.raw_fields
(self)
return list_fields
Gets the fields in their unmodified form Returns ------- fields : List[int/float/str] the fields that define the card
Gets the fields in their unmodified form
[ "Gets", "the", "fields", "in", "their", "unmodified", "form" ]
def raw_fields(self): """ Gets the fields in their unmodified form Returns ------- fields : List[int/float/str] the fields that define the card """ list_fields = ['AERO', self.acsid, self.velocity, self.cref, self.rho_ref, self.s...
[ "def", "raw_fields", "(", "self", ")", ":", "list_fields", "=", "[", "'AERO'", ",", "self", ".", "acsid", ",", "self", ".", "velocity", ",", "self", ".", "cref", ",", "self", ".", "rho_ref", ",", "self", ".", "sym_xz", ",", "self", ".", "sym_xy", "...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/cards/aero/aero_cards.py#L1124-L1135
thenetcircle/dino
1047c3458e91a1b4189e9f48f1393b3a68a935b3
dino/cache/__init__.py
python
ICache.set_users_in_room
(self, room_id: str, users: dict, is_super_user: bool)
short-lived cache of users in a room, depending on if super super or not (non-super users can't see invisible users), in this format: {user_id: user_name} :param room_id: the uuid of the room :param is_super_user: boolean; if either a super user or global moderator then True, other...
short-lived cache of users in a room, depending on if super super or not (non-super users can't see invisible users), in this format:
[ "short", "-", "lived", "cache", "of", "users", "in", "a", "room", "depending", "on", "if", "super", "super", "or", "not", "(", "non", "-", "super", "users", "can", "t", "see", "invisible", "users", ")", "in", "this", "format", ":" ]
def set_users_in_room(self, room_id: str, users: dict, is_super_user: bool) -> None: """ short-lived cache of users in a room, depending on if super super or not (non-super users can't see invisible users), in this format: {user_id: user_name} :param room_id: the uuid of th...
[ "def", "set_users_in_room", "(", "self", ",", "room_id", ":", "str", ",", "users", ":", "dict", ",", "is_super_user", ":", "bool", ")", "->", "None", ":" ]
https://github.com/thenetcircle/dino/blob/1047c3458e91a1b4189e9f48f1393b3a68a935b3/dino/cache/__init__.py#L577-L587
rlgraph/rlgraph
428fc136a9a075f29a397495b4226a491a287be2
rlgraph/execution/ray/ray_executor.py
python
RayExecutor.execute_workload
(self, workload)
return dict( runtime=total_time, timesteps_executed=timesteps_executed, ops_per_second=(timesteps_executed / total_time), # Multiply sample throughput by these env_frames = samples * env_internal * worker_frame_skip: env_internal_frame_skip=self.env_internal_f...
Executes a workload on Ray and measures worker statistics. Workload semantics are decided via the private implementer, _execute_step(). Args: workload (dict): Workload parameters, primarily 'num_timesteps' and 'report_interval' to indicate how many steps to execute and how o...
Executes a workload on Ray and measures worker statistics. Workload semantics are decided via the private implementer, _execute_step().
[ "Executes", "a", "workload", "on", "Ray", "and", "measures", "worker", "statistics", ".", "Workload", "semantics", "are", "decided", "via", "the", "private", "implementer", "_execute_step", "()", "." ]
def execute_workload(self, workload): """ Executes a workload on Ray and measures worker statistics. Workload semantics are decided via the private implementer, _execute_step(). Args: workload (dict): Workload parameters, primarily 'num_timesteps' and 'report_interval' ...
[ "def", "execute_workload", "(", "self", ",", "workload", ")", ":", "self", ".", "sample_iteration_throughputs", "=", "[", "]", "self", ".", "update_iteration_throughputs", "=", "[", "]", "self", ".", "iteration_times", "=", "[", "]", "# Assume time step based init...
https://github.com/rlgraph/rlgraph/blob/428fc136a9a075f29a397495b4226a491a287be2/rlgraph/execution/ray/ray_executor.py#L143-L246
arq5x/gemini
d393bf3d76a6ff91f711525cb00b6954d2193651
gemini/database.py
python
insert_vcf_header
(session, metadata, vcf_header)
Populate a table storing the original VCF header.
Populate a table storing the original VCF header.
[ "Populate", "a", "table", "storing", "the", "original", "VCF", "header", "." ]
def insert_vcf_header(session, metadata, vcf_header): """Populate a table storing the original VCF header. """ t = metadata.tables['vcf_header'] session.execute(t.insert(), dict(vcf_header=vcf_header.rstrip("\r\n"))) session.commit()
[ "def", "insert_vcf_header", "(", "session", ",", "metadata", ",", "vcf_header", ")", ":", "t", "=", "metadata", ".", "tables", "[", "'vcf_header'", "]", "session", ".", "execute", "(", "t", ".", "insert", "(", ")", ",", "dict", "(", "vcf_header", "=", ...
https://github.com/arq5x/gemini/blob/d393bf3d76a6ff91f711525cb00b6954d2193651/gemini/database.py#L530-L535
fake-name/ChromeController
6c70d855e33e06463516b263bf9e6f34c48e29e8
ChromeController/Generator/Generated.py
python
ChromeRemoteDebugInterface.Runtime_compileScript
(self, expression, sourceURL, persistScript, **kwargs )
return subdom_funcs
Function path: Runtime.compileScript Domain: Runtime Method name: compileScript Parameters: Required arguments: 'expression' (type: string) -> Expression to compile. 'sourceURL' (type: string) -> Source url to be set for the script. 'persistScript' (type: boolean) -> Specifies whether the...
Function path: Runtime.compileScript Domain: Runtime Method name: compileScript Parameters: Required arguments: 'expression' (type: string) -> Expression to compile. 'sourceURL' (type: string) -> Source url to be set for the script. 'persistScript' (type: boolean) -> Specifies whether the...
[ "Function", "path", ":", "Runtime", ".", "compileScript", "Domain", ":", "Runtime", "Method", "name", ":", "compileScript", "Parameters", ":", "Required", "arguments", ":", "expression", "(", "type", ":", "string", ")", "-", ">", "Expression", "to", "compile",...
def Runtime_compileScript(self, expression, sourceURL, persistScript, **kwargs ): """ Function path: Runtime.compileScript Domain: Runtime Method name: compileScript Parameters: Required arguments: 'expression' (type: string) -> Expression to compile. 'sourceURL' (type: string) -> Sou...
[ "def", "Runtime_compileScript", "(", "self", ",", "expression", ",", "sourceURL", ",", "persistScript", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "expression", ",", "(", "str", ",", ")", ")", ",", "\"Argument 'expression' must be of type '[...
https://github.com/fake-name/ChromeController/blob/6c70d855e33e06463516b263bf9e6f34c48e29e8/ChromeController/Generator/Generated.py#L11674-L11711
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/jinja2/filters.py
python
do_reverse
(value: t.Union[str, t.Iterable[V]])
Reverse the object or return an iterator that iterates over it the other way round.
Reverse the object or return an iterator that iterates over it the other way round.
[ "Reverse", "the", "object", "or", "return", "an", "iterator", "that", "iterates", "over", "it", "the", "other", "way", "round", "." ]
def do_reverse(value: t.Union[str, t.Iterable[V]]) -> t.Union[str, t.Iterable[V]]: """Reverse the object or return an iterator that iterates over it the other way round. """ if isinstance(value, str): return value[::-1] try: return reversed(value) # type: ignore except TypeErro...
[ "def", "do_reverse", "(", "value", ":", "t", ".", "Union", "[", "str", ",", "t", ".", "Iterable", "[", "V", "]", "]", ")", "->", "t", ".", "Union", "[", "str", ",", "t", ".", "Iterable", "[", "V", "]", "]", ":", "if", "isinstance", "(", "valu...
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/jinja2/filters.py#L1339-L1354
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/smtpd.py
python
usage
(code, msg='')
[]
def usage(code, msg=''): print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg sys.exit(code)
[ "def", "usage", "(", "code", ",", "msg", "=", "''", ")", ":", "print", ">>", "sys", ".", "stderr", ",", "__doc__", "%", "globals", "(", ")", "if", "msg", ":", "print", ">>", "sys", ".", "stderr", ",", "msg", "sys", ".", "exit", "(", "code", ")"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/smtpd.py#L98-L102
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cdb/v20170320/cdb_client.py
python
CdbClient.DescribeInstanceParamRecords
(self, request)
该接口(DescribeInstanceParamRecords)用于查询实例参数修改历史。 :param request: Request instance for DescribeInstanceParamRecords. :type request: :class:`tencentcloud.cdb.v20170320.models.DescribeInstanceParamRecordsRequest` :rtype: :class:`tencentcloud.cdb.v20170320.models.DescribeInstanceParamRecordsResponse`
该接口(DescribeInstanceParamRecords)用于查询实例参数修改历史。
[ "该接口(DescribeInstanceParamRecords)用于查询实例参数修改历史。" ]
def DescribeInstanceParamRecords(self, request): """该接口(DescribeInstanceParamRecords)用于查询实例参数修改历史。 :param request: Request instance for DescribeInstanceParamRecords. :type request: :class:`tencentcloud.cdb.v20170320.models.DescribeInstanceParamRecordsRequest` :rtype: :class:`tencentclou...
[ "def", "DescribeInstanceParamRecords", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeInstanceParamRecords\"", ",", "params", ")", "response", "=", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cdb/v20170320/cdb_client.py#L1679-L1704
softlayer/softlayer-python
cdef7d63c66413197a9a97b0414de9f95887a82a
SoftLayer/CLI/hardware/update_firmware.py
python
cli
(env, identifier)
Update server firmware.
Update server firmware.
[ "Update", "server", "firmware", "." ]
def cli(env, identifier): """Update server firmware.""" mgr = SoftLayer.HardwareManager(env.client) hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') if not (env.skip_confirmations or formatting.confirm('This will power off the server with id %s and ' ...
[ "def", "cli", "(", "env", ",", "identifier", ")", ":", "mgr", "=", "SoftLayer", ".", "HardwareManager", "(", "env", ".", "client", ")", "hw_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resolve_ids", ",", "identifier", ",", "'hardware'", ")",...
https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/CLI/hardware/update_firmware.py#L16-L26
Kozea/WeasyPrint
6cce2978165134e37683cb5b3d156cac6a11a7f9
weasyprint/css/validation/properties.py
python
marks
(tokens)
``marks`` property validation.
``marks`` property validation.
[ "marks", "property", "validation", "." ]
def marks(tokens): """``marks`` property validation.""" if len(tokens) == 2: keywords = tuple(get_keyword(token) for token in tokens) if 'crop' in keywords and 'cross' in keywords: return keywords elif len(tokens) == 1: keyword = get_keyword(tokens[0]) if keyword ...
[ "def", "marks", "(", "tokens", ")", ":", "if", "len", "(", "tokens", ")", "==", "2", ":", "keywords", "=", "tuple", "(", "get_keyword", "(", "token", ")", "for", "token", "in", "tokens", ")", "if", "'crop'", "in", "keywords", "and", "'cross'", "in", ...
https://github.com/Kozea/WeasyPrint/blob/6cce2978165134e37683cb5b3d156cac6a11a7f9/weasyprint/css/validation/properties.py#L389-L400
palewire/django-bakery
2c9c495e4e8faca7b81fa57635d1631933f14171
bakery/management/commands/build.py
python
Command.build_media
(self)
Build the media files.
Build the media files.
[ "Build", "the", "media", "files", "." ]
def build_media(self): """ Build the media files. """ logger.debug("Building media directory") if self.verbosity > 1: self.stdout.write("Building media directory") if os.path.exists(self.media_root) and settings.MEDIA_URL: target_dir = path.join(se...
[ "def", "build_media", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Building media directory\"", ")", "if", "self", ".", "verbosity", ">", "1", ":", "self", ".", "stdout", ".", "write", "(", "\"Building media directory\"", ")", "if", "os", ".", "p...
https://github.com/palewire/django-bakery/blob/2c9c495e4e8faca7b81fa57635d1631933f14171/bakery/management/commands/build.py#L213-L223
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/generic/scheme.py
python
Scheme.union
(self, X)
Return the disjoint union of the schemes ``self`` and ``X``. EXAMPLES:: sage: S = Spec(QQ) sage: X = AffineSpace(1, QQ) sage: S.union(X) Traceback (most recent call last): ... NotImplementedError
Return the disjoint union of the schemes ``self`` and ``X``.
[ "Return", "the", "disjoint", "union", "of", "the", "schemes", "self", "and", "X", "." ]
def union(self, X): """ Return the disjoint union of the schemes ``self`` and ``X``. EXAMPLES:: sage: S = Spec(QQ) sage: X = AffineSpace(1, QQ) sage: S.union(X) Traceback (most recent call last): ... NotImplementedError ...
[ "def", "union", "(", "self", ",", "X", ")", ":", "raise", "NotImplementedError" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/generic/scheme.py#L133-L146
dpkp/kafka-python
f0a57a6a20a3049dc43fbf7ad9eab9635bd2c0b0
kafka/coordinator/base.py
python
BaseCoordinator._send_heartbeat_request
(self)
return future
Send a heartbeat request
Send a heartbeat request
[ "Send", "a", "heartbeat", "request" ]
def _send_heartbeat_request(self): """Send a heartbeat request""" if self.coordinator_unknown(): e = Errors.GroupCoordinatorNotAvailableError(self.coordinator_id) return Future().failure(e) elif not self._client.ready(self.coordinator_id, metadata_priority=False): ...
[ "def", "_send_heartbeat_request", "(", "self", ")", ":", "if", "self", ".", "coordinator_unknown", "(", ")", ":", "e", "=", "Errors", ".", "GroupCoordinatorNotAvailableError", "(", "self", ".", "coordinator_id", ")", "return", "Future", "(", ")", ".", "failure...
https://github.com/dpkp/kafka-python/blob/f0a57a6a20a3049dc43fbf7ad9eab9635bd2c0b0/kafka/coordinator/base.py#L792-L812
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/sequence.py
python
Sequence.create_rendered_transition_clip
(self, path, rendered_type)
return clip
[]
def create_rendered_transition_clip(self, path, rendered_type): clip = self.create_file_producer_clip(path) # this can't have ttl so we can use simpler constructor clip.rendered_type = rendered_type return clip
[ "def", "create_rendered_transition_clip", "(", "self", ",", "path", ",", "rendered_type", ")", ":", "clip", "=", "self", ".", "create_file_producer_clip", "(", "path", ")", "# this can't have ttl so we can use simpler constructor", "clip", ".", "rendered_type", "=", "re...
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/sequence.py#L475-L478
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py
python
RequestsCookieJar.update
(self, other)
Updates this jar with cookies from another CookieJar or dict-like
Updates this jar with cookies from another CookieJar or dict-like
[ "Updates", "this", "jar", "with", "cookies", "from", "another", "CookieJar", "or", "dict", "-", "like" ]
def update(self, other): """Updates this jar with cookies from another CookieJar or dict-like""" if isinstance(other, cookielib.CookieJar): for cookie in other: self.set_cookie(cookie) else: super(RequestsCookieJar, self).update(other)
[ "def", "update", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "cookielib", ".", "CookieJar", ")", ":", "for", "cookie", "in", "other", ":", "self", ".", "set_cookie", "(", "cookie", ")", "else", ":", "super", "(", "Requ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py#L294-L300
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/avro-1.8.2/src/avro/io.py
python
BinaryEncoder.write_long
(self, datum)
int and long values are written using variable-length, zig-zag coding.
int and long values are written using variable-length, zig-zag coding.
[ "int", "and", "long", "values", "are", "written", "using", "variable", "-", "length", "zig", "-", "zag", "coding", "." ]
def write_long(self, datum): """ int and long values are written using variable-length, zig-zag coding. """ datum = (datum << 1) ^ (datum >> 63) while (datum & ~0x7F) != 0: self.write(chr((datum & 0x7f) | 0x80)) datum >>= 7 self.write(chr(datum))
[ "def", "write_long", "(", "self", ",", "datum", ")", ":", "datum", "=", "(", "datum", "<<", "1", ")", "^", "(", "datum", ">>", "63", ")", "while", "(", "datum", "&", "~", "0x7F", ")", "!=", "0", ":", "self", ".", "write", "(", "chr", "(", "("...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/avro-1.8.2/src/avro/io.py#L306-L314
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pyzmq-14.7.0-py3.3-win-amd64.egg/zmq/eventloop/minitornado/util.py
python
import_object
(name)
Imports an object by name. import_object('x') is equivalent to 'import x'. import_object('x.y.z') is equivalent to 'from x.y import z'. >>> import tornado.escape >>> import_object('tornado.escape') is tornado.escape True >>> import_object('tornado.escape.utf8') is tornado.escape.utf8 True ...
Imports an object by name.
[ "Imports", "an", "object", "by", "name", "." ]
def import_object(name): """Imports an object by name. import_object('x') is equivalent to 'import x'. import_object('x.y.z') is equivalent to 'from x.y import z'. >>> import tornado.escape >>> import_object('tornado.escape') is tornado.escape True >>> import_object('tornado.escape.utf8') ...
[ "def", "import_object", "(", "name", ")", ":", "if", "name", ".", "count", "(", "'.'", ")", "==", "0", ":", "return", "__import__", "(", "name", ",", "None", ",", "None", ")", "parts", "=", "name", ".", "split", "(", "'.'", ")", "obj", "=", "__im...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pyzmq-14.7.0-py3.3-win-amd64.egg/zmq/eventloop/minitornado/util.py#L18-L44
xiaomi-sa/smartdns
d31893894994490e8e933d4dd621ccea458b50c5
script/dns_in_twisted.py
python
DNSDatagramProtocol.startProtocol
(self)
Upon start, reset internal state.
Upon start, reset internal state.
[ "Upon", "start", "reset", "internal", "state", "." ]
def startProtocol(self): """ Upon start, reset internal state. """ self.liveMessages = {} self.resends = {}
[ "def", "startProtocol", "(", "self", ")", ":", "self", ".", "liveMessages", "=", "{", "}", "self", ".", "resends", "=", "{", "}" ]
https://github.com/xiaomi-sa/smartdns/blob/d31893894994490e8e933d4dd621ccea458b50c5/script/dns_in_twisted.py#L1844-L1849
kakaobrain/word2word
7aa48095d719cf48cb09202e9de5a1fcb62c8dd7
word2word/methods.py
python
get_trans_co
(x2ys, n_trans)
return x2ys_co
Use co-occurrences to compute scores.
Use co-occurrences to compute scores.
[ "Use", "co", "-", "occurrences", "to", "compute", "scores", "." ]
def get_trans_co(x2ys, n_trans): """Use co-occurrences to compute scores.""" x2ys_co = dict() for x, ys in x2ys.items(): ys = [y for y, cnt in sorted(ys.items(), key=operator.itemgetter(1), reverse=True)[:n_trans]] x2ys_co[x] = ys return x2ys_co
[ "def", "get_trans_co", "(", "x2ys", ",", "n_trans", ")", ":", "x2ys_co", "=", "dict", "(", ")", "for", "x", ",", "ys", "in", "x2ys", ".", "items", "(", ")", ":", "ys", "=", "[", "y", "for", "y", ",", "cnt", "in", "sorted", "(", "ys", ".", "it...
https://github.com/kakaobrain/word2word/blob/7aa48095d719cf48cb09202e9de5a1fcb62c8dd7/word2word/methods.py#L89-L95
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py2.7/multiprocess/__init__.py
python
Queue
(maxsize=0)
return Queue(maxsize)
Returns a queue object
Returns a queue object
[ "Returns", "a", "queue", "object" ]
def Queue(maxsize=0): ''' Returns a queue object ''' from multiprocess.queues import Queue return Queue(maxsize)
[ "def", "Queue", "(", "maxsize", "=", "0", ")", ":", "from", "multiprocess", ".", "queues", "import", "Queue", "return", "Queue", "(", "maxsize", ")" ]
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py2.7/multiprocess/__init__.py#L216-L221
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/sphinx/sphinx/writers/xml.py
python
PseudoXMLWriter.supports
(self, format)
return True
This writer supports all format-specific elements.
This writer supports all format-specific elements.
[ "This", "writer", "supports", "all", "format", "-", "specific", "elements", "." ]
def supports(self, format): """This writer supports all format-specific elements.""" return True
[ "def", "supports", "(", "self", ",", "format", ")", ":", "return", "True" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/sphinx/sphinx/writers/xml.py#L49-L51
01ly/FooProxy
d4ef256f81d414b974a36c657ea7701d267ef712
tools/util.py
python
time_to_date
(timestamp)
return otherStyleTime
时间戳转换为日期 :param timestamp : 时间戳,int类型,如:1537535021 :return:转换结果日期,格式: 年-月-日 时:分:秒
时间戳转换为日期 :param timestamp : 时间戳,int类型,如:1537535021 :return:转换结果日期,格式: 年-月-日 时:分:秒
[ "时间戳转换为日期", ":", "param", "timestamp", ":", "时间戳,int类型,如:1537535021", ":", "return", ":", "转换结果日期,格式:", "年", "-", "月", "-", "日", "时", ":", "分", ":", "秒" ]
def time_to_date(timestamp): """ 时间戳转换为日期 :param timestamp : 时间戳,int类型,如:1537535021 :return:转换结果日期,格式: 年-月-日 时:分:秒 """ timearr = time.localtime(timestamp) otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timearr) return otherStyleTime
[ "def", "time_to_date", "(", "timestamp", ")", ":", "timearr", "=", "time", ".", "localtime", "(", "timestamp", ")", "otherStyleTime", "=", "time", ".", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ",", "timearr", ")", "return", "otherStyleTime" ]
https://github.com/01ly/FooProxy/blob/d4ef256f81d414b974a36c657ea7701d267ef712/tools/util.py#L26-L34
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_volume.py
python
V1Volume.rbd
(self)
return self._rbd
Gets the rbd of this V1Volume. # noqa: E501 :return: The rbd of this V1Volume. # noqa: E501 :rtype: V1RBDVolumeSource
Gets the rbd of this V1Volume. # noqa: E501
[ "Gets", "the", "rbd", "of", "this", "V1Volume", ".", "#", "noqa", ":", "E501" ]
def rbd(self): """Gets the rbd of this V1Volume. # noqa: E501 :return: The rbd of this V1Volume. # noqa: E501 :rtype: V1RBDVolumeSource """ return self._rbd
[ "def", "rbd", "(", "self", ")", ":", "return", "self", ".", "_rbd" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_volume.py#L729-L736
catalyst-team/catalyst
678dc06eda1848242df010b7f34adb572def2598
catalyst/metrics/functional/_classification.py
python
precision
(tp: int, fp: int, zero_division: int = 0)
return 1 - fp / (tp + fp)
Calculates precision (a.k.a. positive predictive value) for binary classification and segmentation. Args: tp: number of true positives fp: number of false positives zero_division: int value, should be one of 0 or 1; if both tp==0 and fp==0 return this value as s result ...
Calculates precision (a.k.a. positive predictive value) for binary classification and segmentation.
[ "Calculates", "precision", "(", "a", ".", "k", ".", "a", ".", "positive", "predictive", "value", ")", "for", "binary", "classification", "and", "segmentation", "." ]
def precision(tp: int, fp: int, zero_division: int = 0) -> float: """Calculates precision (a.k.a. positive predictive value) for binary classification and segmentation. Args: tp: number of true positives fp: number of false positives zero_division: int value, should be one of 0 or 1...
[ "def", "precision", "(", "tp", ":", "int", ",", "fp", ":", "int", ",", "zero_division", ":", "int", "=", "0", ")", "->", "float", ":", "# originally precision is: ppv = tp / (tp + fp + eps)", "# but when both masks are empty this gives: tp=0 and fp=0 => ppv=0", "# so here...
https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/metrics/functional/_classification.py#L10-L28
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/db/api.py
python
floating_ip_allocate_address
(context, project_id, pool)
return IMPL.floating_ip_allocate_address(context, project_id, pool)
Allocate free floating ip from specified pool and return the address. Raises if one is not available.
Allocate free floating ip from specified pool and return the address.
[ "Allocate", "free", "floating", "ip", "from", "specified", "pool", "and", "return", "the", "address", "." ]
def floating_ip_allocate_address(context, project_id, pool): """Allocate free floating ip from specified pool and return the address. Raises if one is not available. """ return IMPL.floating_ip_allocate_address(context, project_id, pool)
[ "def", "floating_ip_allocate_address", "(", "context", ",", "project_id", ",", "pool", ")", ":", "return", "IMPL", ".", "floating_ip_allocate_address", "(", "context", ",", "project_id", ",", "pool", ")" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/db/api.py#L251-L257
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/graphicsview/diagramscene/diagramscene.py
python
MainWindow.createActions
(self)
[]
def createActions(self): self.toFrontAction = QAction( QIcon(':/images/bringtofront.png'), "Bring to &Front", self, shortcut="Ctrl+F", statusTip="Bring item to front", triggered=self.bringToFront) self.sendBackAction = QAction( QIcon(':/im...
[ "def", "createActions", "(", "self", ")", ":", "self", ".", "toFrontAction", "=", "QAction", "(", "QIcon", "(", "':/images/bringtofront.png'", ")", ",", "\"Bring to &Front\"", ",", "self", ",", "shortcut", "=", "\"Ctrl+F\"", ",", "statusTip", "=", "\"Bring item ...
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/graphicsview/diagramscene/diagramscene.py#L617-L650
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/stem/snowball.py
python
RussianStemmer.__roman_to_cyrillic
(self, word)
return word
Transliterate a Russian word back into the Cyrillic alphabet. A Russian word formerly transliterated into the Roman alphabet in order to ease the stemming process, is transliterated back into the Cyrillic alphabet, its original form. :param word: The word that is transliterated. ...
Transliterate a Russian word back into the Cyrillic alphabet.
[ "Transliterate", "a", "Russian", "word", "back", "into", "the", "Cyrillic", "alphabet", "." ]
def __roman_to_cyrillic(self, word): """ Transliterate a Russian word back into the Cyrillic alphabet. A Russian word formerly transliterated into the Roman alphabet in order to ease the stemming process, is transliterated back into the Cyrillic alphabet, its original form. ...
[ "def", "__roman_to_cyrillic", "(", "self", ",", "word", ")", ":", "word", "=", "(", "word", ".", "replace", "(", "\"i^u\"", ",", "\"\\u044E\"", ")", ".", "replace", "(", "\"i^a\"", ",", "\"\\u044F\"", ")", ".", "replace", "(", "\"shch\"", ",", "\"\\u0449...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/stem/snowball.py#L5306-L5358
SBCV/Blender-Addon-Photogrammetry-Importer
d964ef04cefde73320749cc346113e16be5bd73b
photogrammetry_importer/file_handlers/meshroom_file_handler.py
python
MeshroomFileHandler.parse_meshrom_mg_file
( cls, mg_fp, sfm_node_type, sfm_node_number, mesh_node_type, mesh_node_number, prepare_node_number, op=None, )
return sfm_fp, mesh_fp, image_dp
Parse a :code:`Meshroom` project file (:code:`.mg`).
Parse a :code:`Meshroom` project file (:code:`.mg`).
[ "Parse", "a", ":", "code", ":", "Meshroom", "project", "file", "(", ":", "code", ":", ".", "mg", ")", "." ]
def parse_meshrom_mg_file( cls, mg_fp, sfm_node_type, sfm_node_number, mesh_node_type, mesh_node_number, prepare_node_number, op=None, ): """Parse a :code:`Meshroom` project file (:code:`.mg`).""" cache_dp = os.path.join(os.path.dirnam...
[ "def", "parse_meshrom_mg_file", "(", "cls", ",", "mg_fp", ",", "sfm_node_type", ",", "sfm_node_number", ",", "mesh_node_type", ",", "mesh_node_number", ",", "prepare_node_number", ",", "op", "=", "None", ",", ")", ":", "cache_dp", "=", "os", ".", "path", ".", ...
https://github.com/SBCV/Blender-Addon-Photogrammetry-Importer/blob/d964ef04cefde73320749cc346113e16be5bd73b/photogrammetry_importer/file_handlers/meshroom_file_handler.py#L396-L443
0vercl0k/stuffz
2ff82f4739d7e215c6140d4987efa8310db39d55
transmissionrpc.py
python
get_arguments
(method, rpc_version)
return accessible
Get arguments for method in specified Transmission RPC version.
Get arguments for method in specified Transmission RPC version.
[ "Get", "arguments", "for", "method", "in", "specified", "Transmission", "RPC", "version", "." ]
def get_arguments(method, rpc_version): """ Get arguments for method in specified Transmission RPC version. """ if method in ('torrent-add', 'torrent-get', 'torrent-set'): args = TORRENT_ARGS[method[-3:]] elif method in ('session-get', 'session-set'): args = SESSION_ARGS[method[-3:]]...
[ "def", "get_arguments", "(", "method", ",", "rpc_version", ")", ":", "if", "method", "in", "(", "'torrent-add'", ",", "'torrent-get'", ",", "'torrent-set'", ")", ":", "args", "=", "TORRENT_ARGS", "[", "method", "[", "-", "3", ":", "]", "]", "elif", "meth...
https://github.com/0vercl0k/stuffz/blob/2ff82f4739d7e215c6140d4987efa8310db39d55/transmissionrpc.py#L523-L542
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/ipaddress.py
python
_IPAddressBase.reverse_pointer
(self)
return self._reverse_pointer()
The name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
The name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
[ "The", "name", "of", "the", "reverse", "DNS", "pointer", "for", "the", "IP", "address", "e", ".", "g", ".", ":", ">>>", "ipaddress", ".", "ip_address", "(", "127", ".", "0", ".", "0", ".", "1", ")", ".", "reverse_pointer", "1", ".", "0", ".", "0"...
def reverse_pointer(self): """The name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0....
[ "def", "reverse_pointer", "(", "self", ")", ":", "return", "self", ".", "_reverse_pointer", "(", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/ipaddress.py#L520-L528
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
example/ctp/futures/ApiStruct.py
python
QryTradingCode.__init__
(self, BrokerID='', InvestorID='', ExchangeID='', ClientID='', ClientIDType=CIDT_Speculation)
[]
def __init__(self, BrokerID='', InvestorID='', ExchangeID='', ClientID='', ClientIDType=CIDT_Speculation): self.BrokerID = '' #经纪公司代码, char[11] self.InvestorID = '' #投资者代码, char[13] self.ExchangeID = '' #交易所代码, char[9] self.ClientID = '' #客户代码, char[11] self.ClientIDType = ''
[ "def", "__init__", "(", "self", ",", "BrokerID", "=", "''", ",", "InvestorID", "=", "''", ",", "ExchangeID", "=", "''", ",", "ClientID", "=", "''", ",", "ClientIDType", "=", "CIDT_Speculation", ")", ":", "self", ".", "BrokerID", "=", "''", "#经纪公司代码, char...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/ApiStruct.py#L3049-L3054
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/controllers/wizard/question.py
python
question.set_question_title
(self, s)
[]
def set_question_title(self, s): self._question_title = s
[ "def", "set_question_title", "(", "self", ",", "s", ")", ":", "self", ".", "_question_title", "=", "s" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/wizard/question.py#L41-L42
facebookresearch/ParlAI
e4d59c30eef44f1f67105961b82a83fd28d7d78b
projects/personality_captions/transresnet/transresnet.py
python
TransresnetAgent._setup_dict
(self)
Set up the dictionary. The pretrained model used a separate dictionary from the standard ParlAI one.
Set up the dictionary.
[ "Set", "up", "the", "dictionary", "." ]
def _setup_dict(self): """ Set up the dictionary. The pretrained model used a separate dictionary from the standard ParlAI one. """ self.dict = DictionaryAgent(self.opt) if self.opt.get('pretrained', False): new_tok2ind = {} new_ind2tok = {} ...
[ "def", "_setup_dict", "(", "self", ")", ":", "self", ".", "dict", "=", "DictionaryAgent", "(", "self", ".", "opt", ")", "if", "self", ".", "opt", ".", "get", "(", "'pretrained'", ",", "False", ")", ":", "new_tok2ind", "=", "{", "}", "new_ind2tok", "=...
https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/projects/personality_captions/transresnet/transresnet.py#L403-L421
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/webpage/webpage/libs/soupsieve/css_types.py
python
Immutable.__ne__
(self, other)
return ( not isinstance(other, self.__base__()) or any([getattr(other, key) != getattr(self, key) for key in self.__slots__ if key != '_hash']) )
Equal.
Equal.
[ "Equal", "." ]
def __ne__(self, other): """Equal.""" return ( not isinstance(other, self.__base__()) or any([getattr(other, key) != getattr(self, key) for key in self.__slots__ if key != '_hash']) )
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "(", "not", "isinstance", "(", "other", ",", "self", ".", "__base__", "(", ")", ")", "or", "any", "(", "[", "getattr", "(", "other", ",", "key", ")", "!=", "getattr", "(", "self", ",...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/soupsieve/css_types.py#L61-L67
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
clearml/automation/controller.py
python
PipelineController._monitor_node
(self, node)
If Node is running, put the metrics from the node on the pipeline itself. :param node: Node to test
If Node is running, put the metrics from the node on the pipeline itself. :param node: Node to test
[ "If", "Node", "is", "running", "put", "the", "metrics", "from", "the", "node", "on", "the", "pipeline", "itself", ".", ":", "param", "node", ":", "Node", "to", "test" ]
def _monitor_node(self, node): # type: (PipelineController.Node) -> None """ If Node is running, put the metrics from the node on the pipeline itself. :param node: Node to test """ if not node: return # verify we have the node if node.name not...
[ "def", "_monitor_node", "(", "self", ",", "node", ")", ":", "# type: (PipelineController.Node) -> None", "if", "not", "node", ":", "return", "# verify we have the node", "if", "node", ".", "name", "not", "in", "self", ".", "_monitored_nodes", ":", "self", ".", "...
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/clearml/automation/controller.py#L1886-L1978
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/models/atcomm.py
python
ATCommandResponse.command
(self)
return self.__at_cmd
Returns the AT command. Returns: :class:`.ATCommand`: the AT command.
Returns the AT command.
[ "Returns", "the", "AT", "command", "." ]
def command(self): """ Returns the AT command. Returns: :class:`.ATCommand`: the AT command. """ return self.__at_cmd
[ "def", "command", "(", "self", ")", ":", "return", "self", ".", "__at_cmd" ]
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/models/atcomm.py#L377-L384
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/topology/simplicial_set.py
python
SimplicialSet_arbitrary.join
(self, *others)
The join of this simplicial set with ``others``. Not implemented. See https://ncatlab.org/nlab/show/join+of+simplicial+sets for a few descriptions, for anyone interested in implementing this. See also P. J. Ehlers and Tim Porter, Joins for (Augmented) Simplicial Sets, Jour. Pure...
The join of this simplicial set with ``others``.
[ "The", "join", "of", "this", "simplicial", "set", "with", "others", "." ]
def join(self, *others): """ The join of this simplicial set with ``others``. Not implemented. See https://ncatlab.org/nlab/show/join+of+simplicial+sets for a few descriptions, for anyone interested in implementing this. See also P. J. Ehlers and Tim Porter, Joins for ...
[ "def", "join", "(", "self", ",", "*", "others", ")", ":", "raise", "NotImplementedError", "(", "'joins are not implemented for simplicial sets'", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/topology/simplicial_set.py#L2924-L2945
RiotGames/cloud-inquisitor
29a26c705381fdba3538b4efedb25b9e09b387ed
backend/cloud_inquisitor/plugins/types/issues.py
python
EBSVolumeAuditIssue.state
(self)
return self.get_property('state').value
Current state of the issue Returns: `str`
Current state of the issue
[ "Current", "state", "of", "the", "issue" ]
def state(self): """Current state of the issue Returns: `str` """ return self.get_property('state').value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "get_property", "(", "'state'", ")", ".", "value" ]
https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/backend/cloud_inquisitor/plugins/types/issues.py#L525-L531
pytroll/satpy
09e51f932048f98cce7919a4ff8bd2ec01e1ae98
satpy/dataset/dataid.py
python
DataID.__deepcopy__
(self, memo=None)
return self
Copy this object. Returns self as it's immutable.
Copy this object.
[ "Copy", "this", "object", "." ]
def __deepcopy__(self, memo=None): """Copy this object. Returns self as it's immutable. """ return self
[ "def", "__deepcopy__", "(", "self", ",", "memo", "=", "None", ")", ":", "return", "self" ]
https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/dataset/dataid.py#L390-L395
pubs/pubs
59be47ca9107364db452f8138206ab9895438e33
pubs/filebroker.py
python
FileBroker.push_bibfile
(self, citekey, bibdata)
Put content to disk. Will gladly override anything standing in its way.
Put content to disk. Will gladly override anything standing in its way.
[ "Put", "content", "to", "disk", ".", "Will", "gladly", "override", "anything", "standing", "in", "its", "way", "." ]
def push_bibfile(self, citekey, bibdata): """Put content to disk. Will gladly override anything standing in its way.""" write_file(self.bib_path(citekey), bibdata)
[ "def", "push_bibfile", "(", "self", ",", "citekey", ",", "bibdata", ")", ":", "write_file", "(", "self", ".", "bib_path", "(", "citekey", ")", ",", "bibdata", ")" ]
https://github.com/pubs/pubs/blob/59be47ca9107364db452f8138206ab9895438e33/pubs/filebroker.py#L92-L94
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tvdbapiv2/models/filter_keys.py
python
FilterKeys.to_str
(self)
return pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tvdbapiv2/models/filter_keys.py#L94-L98
pik-copan/pyunicorn
b18316fc08ef34b434a1a4d69dfe3e57e24435ee
pyunicorn/funcnet/coupling_analysis.py
python
CouplingAnalysis.__init__
(self, data, silence_level=0)
Initialize an instance of CouplingAnalysis from data array. :type data: multidimensional numpy array :arg data: The time series array with time in first dimension. :type silence_level: int >= 0 :arg silence_level: The higher, the less progress info is output.
Initialize an instance of CouplingAnalysis from data array.
[ "Initialize", "an", "instance", "of", "CouplingAnalysis", "from", "data", "array", "." ]
def __init__(self, data, silence_level=0): """ Initialize an instance of CouplingAnalysis from data array. :type data: multidimensional numpy array :arg data: The time series array with time in first dimension. :type silence_level: int >= 0 :arg silence_level: The highe...
[ "def", "__init__", "(", "self", ",", "data", ",", "silence_level", "=", "0", ")", ":", "self", ".", "silence_level", "=", "silence_level", "\"\"\"(int>=0) higher -> less progress info\"\"\"", "# Flatten array along spatial dimensions to allow", "# for more convinient indexing...
https://github.com/pik-copan/pyunicorn/blob/b18316fc08ef34b434a1a4d69dfe3e57e24435ee/pyunicorn/funcnet/coupling_analysis.py#L50-L70
hacs/integration
8ad321da6de4bf5ffa06bdaff1802e25edae5705
custom_components/hacs/repositories/integration.py
python
HacsIntegrationRepository.__init__
(self, hacs: HacsBase, full_name: str)
Initialize.
Initialize.
[ "Initialize", "." ]
def __init__(self, hacs: HacsBase, full_name: str): """Initialize.""" super().__init__(hacs=hacs) self.data.full_name = full_name self.data.full_name_lower = full_name.lower() self.data.category = HacsCategory.INTEGRATION self.content.path.remote = "custom_components" ...
[ "def", "__init__", "(", "self", ",", "hacs", ":", "HacsBase", ",", "full_name", ":", "str", ")", ":", "super", "(", ")", ".", "__init__", "(", "hacs", "=", "hacs", ")", "self", ".", "data", ".", "full_name", "=", "full_name", "self", ".", "data", "...
https://github.com/hacs/integration/blob/8ad321da6de4bf5ffa06bdaff1802e25edae5705/custom_components/hacs/repositories/integration.py#L24-L31
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /scripts/Hash_ID.py
python
sha1strtolowerusernamepass
()
[]
def sha1strtolowerusernamepass(): hs='79f575543061e158c2da3799f999eb7c95261f07' if len(hash)==len(hs) and hash.isdigit()==False and hash.isalpha()==False and hash.isalnum()==True: jerar.append("109580")
[ "def", "sha1strtolowerusernamepass", "(", ")", ":", "hs", "=", "'79f575543061e158c2da3799f999eb7c95261f07'", "if", "len", "(", "hash", ")", "==", "len", "(", "hs", ")", "and", "hash", ".", "isdigit", "(", ")", "==", "False", "and", "hash", ".", "isalpha", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/Hash_ID.py#L384-L387
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/pyparsing/core.py
python
ParserElement.inlineLiteralsUsing
(cls)
Set class to be used for inclusion of string literals into a parser. Example:: # default literal class used is Literal integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") date_str.parseString("1999/12/31") # -> ['199...
Set class to be used for inclusion of string literals into a parser.
[ "Set", "class", "to", "be", "used", "for", "inclusion", "of", "string", "literals", "into", "a", "parser", "." ]
def inlineLiteralsUsing(cls): """ Set class to be used for inclusion of string literals into a parser. Example:: # default literal class used is Literal integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") ...
[ "def", "inlineLiteralsUsing", "(", "cls", ")", ":", "ParserElement", ".", "_literalStringClass", "=", "cls" ]
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/pyparsing/core.py#L321-L340
IFGHou/wapiti
91242a8ad293a8ee54ab6e62732ff4b9d770772c
wapitiCore/attack/mod_permanentxss.py
python
mod_permanentxss.attack
(self, get_resources, forms)
This method searches XSS which could be permanently stored in the web application
This method searches XSS which could be permanently stored in the web application
[ "This", "method", "searches", "XSS", "which", "could", "be", "permanently", "stored", "in", "the", "web", "application" ]
def attack(self, get_resources, forms): """This method searches XSS which could be permanently stored in the web application""" for http_resource in get_resources: if http_resource.method != "GET": continue url = http_resource.url target_req = HTTP.HTT...
[ "def", "attack", "(", "self", ",", "get_resources", ",", "forms", ")", ":", "for", "http_resource", "in", "get_resources", ":", "if", "http_resource", ".", "method", "!=", "\"GET\"", ":", "continue", "url", "=", "http_resource", ".", "url", "target_req", "="...
https://github.com/IFGHou/wapiti/blob/91242a8ad293a8ee54ab6e62732ff4b9d770772c/wapitiCore/attack/mod_permanentxss.py#L63-L298