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
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
op_t_get_specflag4
(*args)
return _idaapi.op_t_get_specflag4(*args)
op_t_get_specflag4(self) -> PyObject *
op_t_get_specflag4(self) -> PyObject *
[ "op_t_get_specflag4", "(", "self", ")", "-", ">", "PyObject", "*" ]
def op_t_get_specflag4(*args): """ op_t_get_specflag4(self) -> PyObject * """ return _idaapi.op_t_get_specflag4(*args)
[ "def", "op_t_get_specflag4", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "op_t_get_specflag4", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L49856-L49860
Xavier-Lam/wechat-django
258e193e9ec9558709e889fd105c9bf474b013e6
wechat_django/oauth/request.py
python
WeChatOAuthInfo.__str__
(self)
return "WeChatOuathInfo: " + "\t".join( "{k}: {v}".format(k=attr, v=getattr(self, attr, None)) for attr in ("app", "user", "redirect", "oauth_uri", "state", "scope") )
[]
def __str__(self): return "WeChatOuathInfo: " + "\t".join( "{k}: {v}".format(k=attr, v=getattr(self, attr, None)) for attr in ("app", "user", "redirect", "oauth_uri", "state", "scope") )
[ "def", "__str__", "(", "self", ")", ":", "return", "\"WeChatOuathInfo: \"", "+", "\"\\t\"", ".", "join", "(", "\"{k}: {v}\"", ".", "format", "(", "k", "=", "attr", ",", "v", "=", "getattr", "(", "self", ",", "attr", ",", "None", ")", ")", "for", "att...
https://github.com/Xavier-Lam/wechat-django/blob/258e193e9ec9558709e889fd105c9bf474b013e6/wechat_django/oauth/request.py#L71-L76
Gallopsled/pwntools
1573957cc8b1957399b7cc9bfae0c6f80630d5d4
pwnlib/adb/adb.py
python
install
(apk, *arguments)
Install an APK onto the device. This is a wrapper around 'pm install', which backs 'adb install'. Arguments: apk(str): Path to the APK to intall (e.g. ``'foo.apk'``) arguments: Supplementary arguments to 'pm install', e.g. ``'-l', '-g'``.
Install an APK onto the device.
[ "Install", "an", "APK", "onto", "the", "device", "." ]
def install(apk, *arguments): """Install an APK onto the device. This is a wrapper around 'pm install', which backs 'adb install'. Arguments: apk(str): Path to the APK to intall (e.g. ``'foo.apk'``) arguments: Supplementary arguments to 'pm install', e.g. ``'-l', '-g'``. ""...
[ "def", "install", "(", "apk", ",", "*", "arguments", ")", ":", "if", "not", "apk", ".", "endswith", "(", "'.apk'", ")", ":", "log", ".", "error", "(", "\"APK must have .apk extension\"", ")", "basename", "=", "os", ".", "path", ".", "basename", "(", "a...
https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/adb/adb.py#L1543-L1569
praw-dev/praw
d1280b132f509ad115f3941fb55f13f979068377
praw/models/reddit/subreddit.py
python
ModeratorRelationship.invited
( self, redditor: Optional[Union[str, "praw.models.Redditor"]] = None, **generator_kwargs: Any, )
return ListingGenerator(self.subreddit._reddit, url, **generator_kwargs)
r"""Return a :class:`.ListingGenerator` for :class:`.Redditor`\ s invited to be moderators. :param redditor: When provided, return a list containing at most one :class:`.Redditor` instance. This is useful to confirm if a relationship exists, or to fetch the metadata associated with a pa...
r"""Return a :class:`.ListingGenerator` for :class:`.Redditor`\ s invited to be moderators.
[ "r", "Return", "a", ":", "class", ":", ".", "ListingGenerator", "for", ":", "class", ":", ".", "Redditor", "\\", "s", "invited", "to", "be", "moderators", "." ]
def invited( self, redditor: Optional[Union[str, "praw.models.Redditor"]] = None, **generator_kwargs: Any, ) -> Iterator["praw.models.Redditor"]: r"""Return a :class:`.ListingGenerator` for :class:`.Redditor`\ s invited to be moderators. :param redditor: When provided, retur...
[ "def", "invited", "(", "self", ",", "redditor", ":", "Optional", "[", "Union", "[", "str", ",", "\"praw.models.Redditor\"", "]", "]", "=", "None", ",", "*", "*", "generator_kwargs", ":", "Any", ",", ")", "->", "Iterator", "[", "\"praw.models.Redditor\"", "...
https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/reddit/subreddit.py#L3023-L3054
sefibk/KernelGAN
7218a37f0933519513aac97f40b8a72d3676eec9
util.py
python
create_probability_map
(loss_map, crop)
return prob_vec
Create a vector of probabilities corresponding to the loss map
Create a vector of probabilities corresponding to the loss map
[ "Create", "a", "vector", "of", "probabilities", "corresponding", "to", "the", "loss", "map" ]
def create_probability_map(loss_map, crop): """Create a vector of probabilities corresponding to the loss map""" # Blur the gradients to get the sum of gradients in the crop blurred = convolve2d(loss_map, np.ones([crop // 2, crop // 2]), 'same') / ((crop // 2) ** 2) # Zero pad s.t. probabilities are NNZ...
[ "def", "create_probability_map", "(", "loss_map", ",", "crop", ")", ":", "# Blur the gradients to get the sum of gradients in the crop", "blurred", "=", "convolve2d", "(", "loss_map", ",", "np", ".", "ones", "(", "[", "crop", "//", "2", ",", "crop", "//", "2", "...
https://github.com/sefibk/KernelGAN/blob/7218a37f0933519513aac97f40b8a72d3676eec9/util.py#L92-L100
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/serene/wiki_index.py
python
Index._load_fever_embeddings
(self)
Load fever claim embeddings and ids.
Load fever claim embeddings and ids.
[ "Load", "fever", "claim", "embeddings", "and", "ids", "." ]
def _load_fever_embeddings(self): """Load fever claim embeddings and ids.""" with util.safe_open(self._claim_embedding_path, 'rb') as f: claim_embeddings = np.load(f) with util.safe_open(self._claim_id_path, 'rb') as f: claim_ids = np.load(f) self._claim_embeddings = tf.convert_to_tensor(cla...
[ "def", "_load_fever_embeddings", "(", "self", ")", ":", "with", "util", ".", "safe_open", "(", "self", ".", "_claim_embedding_path", ",", "'rb'", ")", "as", "f", ":", "claim_embeddings", "=", "np", ".", "load", "(", "f", ")", "with", "util", ".", "safe_o...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/serene/wiki_index.py#L275-L288
noxrepo/pox
5f82461e01f8822bd7336603b361bff4ffbd2380
pox/proto/arp_helper.py
python
launch
(no_flow=False, eat_packets=True, use_port_mac=False, reply_from_dst=False)
Start an ARP helper If use_port_mac, use the specific port's MAC instead of the "DPID MAC". If reply_from_dst, then replies will appear to come from the MAC address that is used in the reply (otherwise, it comes from the same place as requests).
Start an ARP helper
[ "Start", "an", "ARP", "helper" ]
def launch (no_flow=False, eat_packets=True, use_port_mac=False, reply_from_dst=False): """ Start an ARP helper If use_port_mac, use the specific port's MAC instead of the "DPID MAC". If reply_from_dst, then replies will appear to come from the MAC address that is used in the reply (otherwise, it...
[ "def", "launch", "(", "no_flow", "=", "False", ",", "eat_packets", "=", "True", ",", "use_port_mac", "=", "False", ",", "reply_from_dst", "=", "False", ")", ":", "use_port_mac", "=", "str_to_bool", "(", "use_port_mac", ")", "reply_from_dst", "=", "str_to_bool"...
https://github.com/noxrepo/pox/blob/5f82461e01f8822bd7336603b361bff4ffbd2380/pox/proto/arp_helper.py#L258-L275
pyparsing/pyparsing
1ccf846394a055924b810faaf9628dac53633848
pyparsing/results.py
python
ParseResults.extend
(self, itemseq)
Add sequence of elements to end of ``ParseResults`` list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-...
Add sequence of elements to end of ``ParseResults`` list of elements.
[ "Add", "sequence", "of", "elements", "to", "end", "of", "ParseResults", "list", "of", "elements", "." ]
def extend(self, itemseq): """ Add sequence of elements to end of ``ParseResults`` list of elements. Example:: patt = OneOrMore(Word(alphas)) # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens)...
[ "def", "extend", "(", "self", ",", "itemseq", ")", ":", "if", "isinstance", "(", "itemseq", ",", "ParseResults", ")", ":", "self", ".", "__iadd__", "(", "itemseq", ")", "else", ":", "self", ".", "_toklist", ".", "extend", "(", "itemseq", ")" ]
https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/pyparsing/results.py#L391-L409
garydoranjr/misvm
b2118fe04d98c00436bdf8a0e4bbfb6082c5751c
misvm/misssvm.py
python
_grad_softmin
(x, alpha=1e4)
return grad
Computes the gradient of min function, taken from gradient of softmin as alpha goes to infinity. It is: 0 if x_i != min(x), or 1/n if x_i is one of the n elements equal to min(x)
Computes the gradient of min function, taken from gradient of softmin as alpha goes to infinity. It is: 0 if x_i != min(x), or 1/n if x_i is one of the n elements equal to min(x)
[ "Computes", "the", "gradient", "of", "min", "function", "taken", "from", "gradient", "of", "softmin", "as", "alpha", "goes", "to", "infinity", ".", "It", "is", ":", "0", "if", "x_i", "!", "=", "min", "(", "x", ")", "or", "1", "/", "n", "if", "x_i",...
def _grad_softmin(x, alpha=1e4): """ Computes the gradient of min function, taken from gradient of softmin as alpha goes to infinity. It is: 0 if x_i != min(x), or 1/n if x_i is one of the n elements equal to min(x) """ grad = np.matrix(np.zeros(x.shape)) minimizers = (x ==...
[ "def", "_grad_softmin", "(", "x", ",", "alpha", "=", "1e4", ")", ":", "grad", "=", "np", ".", "matrix", "(", "np", ".", "zeros", "(", "x", ".", "shape", ")", ")", "minimizers", "=", "(", "x", "==", "min", "(", "x", ".", "flat", ")", ")", "n",...
https://github.com/garydoranjr/misvm/blob/b2118fe04d98c00436bdf8a0e4bbfb6082c5751c/misvm/misssvm.py#L183-L196
aseveryn/deep-qa
249a1ec14ef980a5630b1a2dccf5f587245e16e1
utils.py
python
load_bin_vec
(fname, words)
Loads 300x1 word vecs from Google (Mikolov) word2vec
Loads 300x1 word vecs from Google (Mikolov) word2vec
[ "Loads", "300x1", "word", "vecs", "from", "Google", "(", "Mikolov", ")", "word2vec" ]
def load_bin_vec(fname, words): """ Loads 300x1 word vecs from Google (Mikolov) word2vec """ print fname vocab = set(words) word_vecs = {} with open(fname, "rb") as f: header = f.readline() vocab_size, layer1_size = map(int, header.split()) binary_len = numpy.dtype('float32').itemsize * layer1...
[ "def", "load_bin_vec", "(", "fname", ",", "words", ")", ":", "print", "fname", "vocab", "=", "set", "(", "words", ")", "word_vecs", "=", "{", "}", "with", "open", "(", "fname", ",", "\"rb\"", ")", "as", "f", ":", "header", "=", "f", ".", "readline"...
https://github.com/aseveryn/deep-qa/blob/249a1ec14ef980a5630b1a2dccf5f587245e16e1/utils.py#L143-L174
volatilityfoundation/volatility3
168b0d0b053ab97a7cb096ef2048795cc54d885f
volatility3/framework/renderers/__init__.py
python
ColumnSortKey.__init__
(self, treegrid: TreeGrid, column_name: str, ascending: bool = True)
[]
def __init__(self, treegrid: TreeGrid, column_name: str, ascending: bool = True) -> None: _index = None self._type = None self.ascending = ascending for i in range(len(treegrid.columns)): column = treegrid.columns[i] if column.name.lower() == column_name.lower(): ...
[ "def", "__init__", "(", "self", ",", "treegrid", ":", "TreeGrid", ",", "column_name", ":", "str", ",", "ascending", ":", "bool", "=", "True", ")", "->", "None", ":", "_index", "=", "None", "self", ".", "_type", "=", "None", "self", ".", "ascending", ...
https://github.com/volatilityfoundation/volatility3/blob/168b0d0b053ab97a7cb096ef2048795cc54d885f/volatility3/framework/renderers/__init__.py#L363-L374
bentoml/BentoML
af9c68ea2a0c3acdb3deab529b36575533225b5d
bentoml/service/__init__.py
python
validate_version_str
(version_str)
Validate that version str format is either a simple version string that: * Consist of only ALPHA / DIGIT / "-" / "." / "_" * Length between 1-128 Or a valid semantic version https://github.com/semver/semver/blob/master/semver.md
Validate that version str format is either a simple version string that: * Consist of only ALPHA / DIGIT / "-" / "." / "_" * Length between 1-128 Or a valid semantic version https://github.com/semver/semver/blob/master/semver.md
[ "Validate", "that", "version", "str", "format", "is", "either", "a", "simple", "version", "string", "that", ":", "*", "Consist", "of", "only", "ALPHA", "/", "DIGIT", "/", "-", "/", ".", "/", "_", "*", "Length", "between", "1", "-", "128", "Or", "a", ...
def validate_version_str(version_str): """ Validate that version str format is either a simple version string that: * Consist of only ALPHA / DIGIT / "-" / "." / "_" * Length between 1-128 Or a valid semantic version https://github.com/semver/semver/blob/master/semver.md """ regex = ...
[ "def", "validate_version_str", "(", "version_str", ")", ":", "regex", "=", "r\"[A-Za-z0-9_.-]{1,128}\\Z\"", "semver_regex", "=", "r\"^(?P<major>0|[1-9]\\d*)\\.(?P<minor>0|[1-9]\\d*)\\.(?P<patch>0|[1-9]\\d*)(?:-(?P<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a...
https://github.com/bentoml/BentoML/blob/af9c68ea2a0c3acdb3deab529b36575533225b5d/bentoml/service/__init__.py#L363-L383
hasgeek/hasjob
38098e8034ee749704dea65394b366e8adc5c71f
hasjob/models/flags.py
python
_user_flags
(self)
return flags
[]
def _user_flags(self): cache_key = 'user/flags/' + str(self.id) flags = cache.get(cache_key) if not flags: flags = {} for key, func in UserFlags.__dict__.items(): if isinstance(func, UserFlag): flags[key] = func.for_user(self) cache.set(cache_key, flags, t...
[ "def", "_user_flags", "(", "self", ")", ":", "cache_key", "=", "'user/flags/'", "+", "str", "(", "self", ".", "id", ")", "flags", "=", "cache", ".", "get", "(", "cache_key", ")", "if", "not", "flags", ":", "flags", "=", "{", "}", "for", "key", ",",...
https://github.com/hasgeek/hasjob/blob/38098e8034ee749704dea65394b366e8adc5c71f/hasjob/models/flags.py#L515-L524
SecurityInnovation/PGPy
955d1669472b7b182571f686ee312435f93033e4
pgpy/pgp.py
python
PGPKey.is_public
(self)
return isinstance(self._key, Public) and not isinstance(self._key, Private)
``True`` if this is a public key, otherwise ``False``
``True`` if this is a public key, otherwise ``False``
[ "True", "if", "this", "is", "a", "public", "key", "otherwise", "False" ]
def is_public(self): """``True`` if this is a public key, otherwise ``False``""" return isinstance(self._key, Public) and not isinstance(self._key, Private)
[ "def", "is_public", "(", "self", ")", ":", "return", "isinstance", "(", "self", ".", "_key", ",", "Public", ")", "and", "not", "isinstance", "(", "self", ".", "_key", ",", "Private", ")" ]
https://github.com/SecurityInnovation/PGPy/blob/955d1669472b7b182571f686ee312435f93033e4/pgpy/pgp.py#L1430-L1432
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
sphinxtools/utilities.py
python
pickleItem
(description, current_module, name, kind)
This function pickles/unpickles a dictionary containing class names as keys and class brief description (chopped docstrings) as values to build the main class index for Sphinx **or** the Phoenix standalone function names as keys and their full description as values to build the function page. This step...
This function pickles/unpickles a dictionary containing class names as keys and class brief description (chopped docstrings) as values to build the main class index for Sphinx **or** the Phoenix standalone function names as keys and their full description as values to build the function page.
[ "This", "function", "pickles", "/", "unpickles", "a", "dictionary", "containing", "class", "names", "as", "keys", "and", "class", "brief", "description", "(", "chopped", "docstrings", ")", "as", "values", "to", "build", "the", "main", "class", "index", "for", ...
def pickleItem(description, current_module, name, kind): """ This function pickles/unpickles a dictionary containing class names as keys and class brief description (chopped docstrings) as values to build the main class index for Sphinx **or** the Phoenix standalone function names as keys and their ...
[ "def", "pickleItem", "(", "description", ",", "current_module", ",", "name", ",", "kind", ")", ":", "if", "kind", "==", "'function'", ":", "pickle_file", "=", "os", ".", "path", ".", "join", "(", "SPHINXROOT", ",", "current_module", "+", "'functions.pkl'", ...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/sphinxtools/utilities.py#L647-L670
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_6.4/pyasn1/type/constraint.py
python
AbstractConstraintSet.__len__
(self)
return len(self._values)
[]
def __len__(self): return len(self._values)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_values", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/pyasn1/type/constraint.py#L169-L169
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/asset_service/transports/grpc.py
python
AssetServiceGrpcTransport.create_channel
( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, )
return grpc_helpers.create_channel( host, credentials=credentials, scopes=scopes or cls.AUTH_SCOPES, **kwargs, )
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
[ "Create", "and", "return", "a", "gRPC", "channel", "object", ".", "Args", ":", "address", "(", "Optionsl", "[", "str", "]", ")", ":", "The", "host", "for", "the", "channel", "to", "use", ".", "credentials", "(", "Optional", "[", "~", ".", "Credentials"...
def create_channel( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: address (Options...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"googleads.googleapis.com\"", ",", "credentials", ":", "ga_credentials", ".", "Credentials", "=", "None", ",", "scopes", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None",...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/asset_service/transports/grpc.py#L178-L206
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Tools/scripts/analyze_dxp.py
python
render_common_pairs
(profile=None)
return ''.join(seq())
Renders the most common opcode pairs to a string in order of descending frequency. The result is a series of lines of the form: # of occurrences: ('1st opname', '2nd opname')
Renders the most common opcode pairs to a string in order of descending frequency.
[ "Renders", "the", "most", "common", "opcode", "pairs", "to", "a", "string", "in", "order", "of", "descending", "frequency", "." ]
def render_common_pairs(profile=None): """Renders the most common opcode pairs to a string in order of descending frequency. The result is a series of lines of the form: # of occurrences: ('1st opname', '2nd opname') """ if profile is None: profile = snapshot_profile() def seq():...
[ "def", "render_common_pairs", "(", "profile", "=", "None", ")", ":", "if", "profile", "is", "None", ":", "profile", "=", "snapshot_profile", "(", ")", "def", "seq", "(", ")", ":", "for", "_", ",", "ops", ",", "count", "in", "common_pairs", "(", "profil...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Tools/scripts/analyze_dxp.py#L117-L130
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/importlib/_bootstrap_external.py
python
_NamespaceLoader.create_module
(self, spec)
Use default semantics for module creation.
Use default semantics for module creation.
[ "Use", "default", "semantics", "for", "module", "creation", "." ]
def create_module(self, spec): """Use default semantics for module creation."""
[ "def", "create_module", "(", "self", ",", "spec", ")", ":" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/importlib/_bootstrap_external.py#L1017-L1018
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/ecdsa/util.py
python
randrange
(order, entropy=None)
Return a random integer k such that 1 <= k < order, uniformly distributed across that range. For simplicity, this only behaves well if 'order' is fairly close (but below) a power of 256. The try-try-again algorithm we use takes longer and longer time (on average) to complete as 'order' falls, rising to ...
Return a random integer k such that 1 <= k < order, uniformly distributed across that range. For simplicity, this only behaves well if 'order' is fairly close (but below) a power of 256. The try-try-again algorithm we use takes longer and longer time (on average) to complete as 'order' falls, rising to ...
[ "Return", "a", "random", "integer", "k", "such", "that", "1", "<", "=", "k", "<", "order", "uniformly", "distributed", "across", "that", "range", ".", "For", "simplicity", "this", "only", "behaves", "well", "if", "order", "is", "fairly", "close", "(", "b...
def randrange(order, entropy=None): """Return a random integer k such that 1 <= k < order, uniformly distributed across that range. For simplicity, this only behaves well if 'order' is fairly close (but below) a power of 256. The try-try-again algorithm we use takes longer and longer time (on average) t...
[ "def", "randrange", "(", "order", ",", "entropy", "=", "None", ")", ":", "# we could handle arbitrary orders (even 256**k+1) better if we created", "# candidates bit-wise instead of byte-wise, which would reduce the", "# worst-case behavior to avg=2 loops, but that would be more complex. The...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/ecdsa/util.py#L19-L57
raffaele-forte/climber
5530a780446e35b1ce977bae140557050fe0b47c
Exscript/protocols/Protocol.py
python
Protocol.app_authenticate
(self, account = None, flush = True, bailout = False)
Attempt to perform application-level authentication. Application level authentication is needed on devices where the username and password are requested from the user after the connection was already accepted by the remote device. The difference between app-level authentication and prot...
Attempt to perform application-level authentication. Application level authentication is needed on devices where the username and password are requested from the user after the connection was already accepted by the remote device.
[ "Attempt", "to", "perform", "application", "-", "level", "authentication", ".", "Application", "level", "authentication", "is", "needed", "on", "devices", "where", "the", "username", "and", "password", "are", "requested", "from", "the", "user", "after", "the", "...
def app_authenticate(self, account = None, flush = True, bailout = False): """ Attempt to perform application-level authentication. Application level authentication is needed on devices where the username and password are requested from the user after the connection was already a...
[ "def", "app_authenticate", "(", "self", ",", "account", "=", "None", ",", "flush", "=", "True", ",", "bailout", "=", "False", ")", ":", "with", "self", ".", "_get_account", "(", "account", ")", "as", "account", ":", "user", "=", "account", ".", "get_na...
https://github.com/raffaele-forte/climber/blob/5530a780446e35b1ce977bae140557050fe0b47c/Exscript/protocols/Protocol.py#L784-L820
XanaduAI/strawberryfields
298601e409528f22c6717c2d816ab68ae8bda1fa
strawberryfields/backends/tfbackend/backend.py
python
TFBackend.begin_circuit
(self, num_subsystems, **kwargs)
r"""Instantiate a quantum circuit. Instantiates a representation of a quantum optical state with ``num_subsystems`` modes. The state is initialized to vacuum. The modes in the circuit are indexed sequentially using integers, starting from zero. Once an index is assigned to a mode, it c...
r"""Instantiate a quantum circuit.
[ "r", "Instantiate", "a", "quantum", "circuit", "." ]
def begin_circuit(self, num_subsystems, **kwargs): r"""Instantiate a quantum circuit. Instantiates a representation of a quantum optical state with ``num_subsystems`` modes. The state is initialized to vacuum. The modes in the circuit are indexed sequentially using integers, starting f...
[ "def", "begin_circuit", "(", "self", ",", "num_subsystems", ",", "*", "*", "kwargs", ")", ":", "cutoff_dim", "=", "kwargs", ".", "get", "(", "\"cutoff_dim\"", ",", "None", ")", "pure", "=", "kwargs", ".", "get", "(", "\"pure\"", ",", "True", ")", "batc...
https://github.com/XanaduAI/strawberryfields/blob/298601e409528f22c6717c2d816ab68ae8bda1fa/strawberryfields/backends/tfbackend/backend.py#L66-L114
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/fate_arch/common/conf_utils.py
python
update_config
(key, value, conf_name=SERVICE_CONF)
[]
def update_config(key, value, conf_name=SERVICE_CONF): conf_path = conf_realpath(conf_name=conf_name) if not os.path.isabs(conf_path): conf_path = os.path.join(file_utils.get_project_base_directory(), conf_path) with filelock.FileLock(os.path.join(os.path.dirname(conf_path), ".lock")): confi...
[ "def", "update_config", "(", "key", ",", "value", ",", "conf_name", "=", "SERVICE_CONF", ")", ":", "conf_path", "=", "conf_realpath", "(", "conf_name", "=", "conf_name", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "conf_path", ")", ":", "conf...
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/common/conf_utils.py#L41-L48
alexandreblin/python-can-monitor
71f5fa081ec4ee334298144d6b211db697c1ff8e
canmonitor/source_handler.py
python
CandumpHandler._parse_from_candump
(self, line)
return can_id, can_data
[]
def _parse_from_candump(self, line): line = line.strip('\n') msg_match = self.MSG_RGX.match(line) if msg_match is None: raise InvalidFrame("Wrong format: '{}'".format(line)) abstime, hex_can_id, hex_can_data = msg_match.group(1, 2, 3) abstime = float(abstime) ...
[ "def", "_parse_from_candump", "(", "self", ",", "line", ")", ":", "line", "=", "line", ".", "strip", "(", "'\\n'", ")", "msg_match", "=", "self", ".", "MSG_RGX", ".", "match", "(", "line", ")", "if", "msg_match", "is", "None", ":", "raise", "InvalidFra...
https://github.com/alexandreblin/python-can-monitor/blob/71f5fa081ec4ee334298144d6b211db697c1ff8e/canmonitor/source_handler.py#L117-L136
magenta/magenta
be6558f1a06984faff6d6949234f5fe9ad0ffdb5
magenta/models/latent_transfer/common.py
python
get_index_grouped_by_label
(labels)
return index_grouped_by_label
Get (an array of) index grouped by label. This array is used for label-level sampling. It aims at MNIST and CelebA (in Jesse et al. 2018) with 10 labels. Args: labels: a list of labels in integer. Returns: A (# label - sized) list of lists contatining indices of that label.
Get (an array of) index grouped by label.
[ "Get", "(", "an", "array", "of", ")", "index", "grouped", "by", "label", "." ]
def get_index_grouped_by_label(labels): """Get (an array of) index grouped by label. This array is used for label-level sampling. It aims at MNIST and CelebA (in Jesse et al. 2018) with 10 labels. Args: labels: a list of labels in integer. Returns: A (# label - sized) list of lists contatining indi...
[ "def", "get_index_grouped_by_label", "(", "labels", ")", ":", "index_grouped_by_label", "=", "[", "[", "]", "for", "_", "in", "range", "(", "10", ")", "]", "for", "i", ",", "label", "in", "enumerate", "(", "labels", ")", ":", "index_grouped_by_label", "[",...
https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/latent_transfer/common.py#L171-L186
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/utils/sqlautocomplete/sqlcompletion.py
python
suggest_type
(full_text, text_before_cursor)
return suggest_based_on_last_token(stmt.last_token, stmt)
Takes the full_text that is typed so far and also the text before the cursor to suggest completion type and scope. Returns a tuple with a type of entity ('table', 'column' etc) and a scope. A scope for a column category will be a list of tables.
Takes the full_text that is typed so far and also the text before the cursor to suggest completion type and scope.
[ "Takes", "the", "full_text", "that", "is", "typed", "so", "far", "and", "also", "the", "text", "before", "the", "cursor", "to", "suggest", "completion", "type", "and", "scope", "." ]
def suggest_type(full_text, text_before_cursor): """Takes the full_text that is typed so far and also the text before the cursor to suggest completion type and scope. Returns a tuple with a type of entity ('table', 'column' etc) and a scope. A scope for a column category will be a list of tables. "...
[ "def", "suggest_type", "(", "full_text", ",", "text_before_cursor", ")", ":", "if", "full_text", ".", "startswith", "(", "\"\\\\i \"", ")", ":", "return", "(", "Path", "(", ")", ",", ")", "# This is a temporary hack; the exception handling", "# here should be removed ...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/utils/sqlautocomplete/sqlcompletion.py#L132-L150
adulau/Forban
4b06c8a2e2f18ff872ca20a534587a5f15a692fa
lib/ext/cherrypy/lib/auth.py
python
basic_auth
(realm, users, encrypt=None, debug=False)
If auth fails, raise 401 with a basic authentication header. realm A string containing the authentication realm. users A dict of the form: {username: password} or a callable returning a dict. encrypt callable used to encrypt the password returned from the user-...
If auth fails, raise 401 with a basic authentication header. realm A string containing the authentication realm. users A dict of the form: {username: password} or a callable returning a dict. encrypt callable used to encrypt the password returned from the user-...
[ "If", "auth", "fails", "raise", "401", "with", "a", "basic", "authentication", "header", ".", "realm", "A", "string", "containing", "the", "authentication", "realm", ".", "users", "A", "dict", "of", "the", "form", ":", "{", "username", ":", "password", "}"...
def basic_auth(realm, users, encrypt=None, debug=False): """If auth fails, raise 401 with a basic authentication header. realm A string containing the authentication realm. users A dict of the form: {username: password} or a callable returning a dict. encrypt ...
[ "def", "basic_auth", "(", "realm", ",", "users", ",", "encrypt", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "check_auth", "(", "users", ",", "encrypt", ")", ":", "if", "debug", ":", "cherrypy", ".", "log", "(", "'Auth successful'", ",", ...
https://github.com/adulau/Forban/blob/4b06c8a2e2f18ff872ca20a534587a5f15a692fa/lib/ext/cherrypy/lib/auth.py#L47-L69
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pymongo/bulk.py
python
_Bulk.execute
(self, write_concern, session)
Execute operations.
Execute operations.
[ "Execute", "operations", "." ]
def execute(self, write_concern, session): """Execute operations. """ if not self.ops: raise InvalidOperation('No operations to execute') if self.executed: raise InvalidOperation('Bulk operations can ' 'only be executed once.') ...
[ "def", "execute", "(", "self", ",", "write_concern", ",", "session", ")", ":", "if", "not", "self", ".", "ops", ":", "raise", "InvalidOperation", "(", "'No operations to execute'", ")", "if", "self", ".", "executed", ":", "raise", "InvalidOperation", "(", "'...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pymongo/bulk.py#L489-L511
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
src/zvt/recorders/eastmoney/finance/base_china_stock_finance_recorder.py
python
BaseChinaStockFinanceRecorder.record
(self, entity, start, end, size, timestamps)
return self.api_wrapper.request( url=self.url, param=param, method=self.request_method, path_fields=self.generate_path_fields(entity) )
[]
def record(self, entity, start, end, size, timestamps): # different with the default timestamps handling param = self.generate_request_param(entity, start, end, size, timestamps) self.logger.info("request param:{}".format(param)) return self.api_wrapper.request( url=self.url...
[ "def", "record", "(", "self", ",", "entity", ",", "start", ",", "end", ",", "size", ",", "timestamps", ")", ":", "# different with the default timestamps handling", "param", "=", "self", ".", "generate_request_param", "(", "entity", ",", "start", ",", "end", "...
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/recorders/eastmoney/finance/base_china_stock_finance_recorder.py#L134-L141
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/physics/units/dimensions.py
python
DimensionSystem.dim
(self)
return len(self.base_dims)
Useless method, kept for compatibility with previous versions. DO NOT USE. Give the dimension of the system. That is return the number of dimensions forming the basis.
Useless method, kept for compatibility with previous versions.
[ "Useless", "method", "kept", "for", "compatibility", "with", "previous", "versions", "." ]
def dim(self): """ Useless method, kept for compatibility with previous versions. DO NOT USE. Give the dimension of the system. That is return the number of dimensions forming the basis. """ return len(self.base_dims)
[ "def", "dim", "(", "self", ")", ":", "return", "len", "(", "self", ".", "base_dims", ")" ]
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/physics/units/dimensions.py#L665-L675
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/flask/app.py
python
Flask.test_cli_runner
(self, **kwargs)
return cls(self, **kwargs)
Create a CLI runner for testing CLI commands. See :ref:`testing-cli`. Returns an instance of :attr:`test_cli_runner_class`, by default :class:`~flask.testing.FlaskCliRunner`. The Flask app object is passed as the first argument. .. versionadded:: 1.0
Create a CLI runner for testing CLI commands. See :ref:`testing-cli`.
[ "Create", "a", "CLI", "runner", "for", "testing", "CLI", "commands", ".", "See", ":", "ref", ":", "testing", "-", "cli", "." ]
def test_cli_runner(self, **kwargs): """Create a CLI runner for testing CLI commands. See :ref:`testing-cli`. Returns an instance of :attr:`test_cli_runner_class`, by default :class:`~flask.testing.FlaskCliRunner`. The Flask app object is passed as the first argument. ....
[ "def", "test_cli_runner", "(", "self", ",", "*", "*", "kwargs", ")", ":", "cls", "=", "self", ".", "test_cli_runner_class", "if", "cls", "is", "None", ":", "from", ".", "testing", "import", "FlaskCliRunner", "as", "cls", "return", "cls", "(", "self", ","...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/flask/app.py#L1053-L1068
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/lib2to3/btm_utils.py
python
MinNode.get_linear_subpattern
(self)
Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton...
Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton...
[ "Drives", "the", "leaf_to_root", "method", ".", "The", "reason", "that", "leaf_to_root", "must", "be", "run", "multiple", "times", "is", "because", "we", "need", "to", "reject", "group", "matches", ";", "for", "example", "the", "alternative", "form", "(", "a...
def get_linear_subpattern(self): """Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching mult...
[ "def", "get_linear_subpattern", "(", "self", ")", ":", "for", "l", "in", "self", ".", "leaves", "(", ")", ":", "subp", "=", "l", ".", "leaf_to_root", "(", ")", "if", "subp", ":", "return", "subp" ]
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/lib2to3/btm_utils.py#L75-L94
PythonCharmers/python-future
80523f383fbba1c6de0551e19d0277e73e69573c
src/future/backports/email/generator.py
python
Generator.clone
(self, fp)
return self.__class__(fp, self._mangle_from_, None, # Use policy setting, which we've adjusted policy=self.policy)
Clone this generator with the exact same options.
Clone this generator with the exact same options.
[ "Clone", "this", "generator", "with", "the", "exact", "same", "options", "." ]
def clone(self, fp): """Clone this generator with the exact same options.""" return self.__class__(fp, self._mangle_from_, None, # Use policy setting, which we've adjusted policy=self.policy)
[ "def", "clone", "(", "self", ",", "fp", ")", ":", "return", "self", ".", "__class__", "(", "fp", ",", "self", ".", "_mangle_from_", ",", "None", ",", "# Use policy setting, which we've adjusted", "policy", "=", "self", ".", "policy", ")" ]
https://github.com/PythonCharmers/python-future/blob/80523f383fbba1c6de0551e19d0277e73e69573c/src/future/backports/email/generator.py#L123-L128
pychess/pychess
e3f9b12947e429993edcc2b9288f79bc181e6500
lib/pychess/widgets/SpotGraph.py
python
SpotGraph.getNearestFreeNeighbourArchi
(self, xorg, yorg)
This method performs an archimedes-spircal search for an empty place to put a new dot. http://en.wikipedia.org/wiki/Archimedean_spiral
This method performs an archimedes-spircal search for an empty place to put a new dot. http://en.wikipedia.org/wiki/Archimedean_spiral
[ "This", "method", "performs", "an", "archimedes", "-", "spircal", "search", "for", "an", "empty", "place", "to", "put", "a", "new", "dot", ".", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Archimedean_spiral" ]
def getNearestFreeNeighbourArchi(self, xorg, yorg): """ This method performs an archimedes-spircal search for an empty place to put a new dot. http://en.wikipedia.org/wiki/Archimedean_spiral """ xorg, yorg = self.prcToPix(xorg, yorg) # Start by testing current spot ...
[ "def", "getNearestFreeNeighbourArchi", "(", "self", ",", "xorg", ",", "yorg", ")", ":", "xorg", ",", "yorg", "=", "self", ".", "prcToPix", "(", "xorg", ",", "yorg", ")", "# Start by testing current spot", "if", "self", ".", "isEmpty", "(", "xorg", ",", "yo...
https://github.com/pychess/pychess/blob/e3f9b12947e429993edcc2b9288f79bc181e6500/lib/pychess/widgets/SpotGraph.py#L349-L371
Rapptz/RoboDanny
1fb95d76d1b7685e2e2ff950e11cddfc96efbfec
cogs/stars.py
python
Stars.star
(self, ctx, message: MessageID)
Stars a message via message ID. To star a message you should right click on the on a message and then click "Copy ID". You must have Developer Mode enabled to get that functionality. It is recommended that you react to a message with \N{WHITE MEDIUM STAR} instead. You can only...
Stars a message via message ID.
[ "Stars", "a", "message", "via", "message", "ID", "." ]
async def star(self, ctx, message: MessageID): """Stars a message via message ID. To star a message you should right click on the on a message and then click "Copy ID". You must have Developer Mode enabled to get that functionality. It is recommended that you react to a message...
[ "async", "def", "star", "(", "self", ",", "ctx", ",", "message", ":", "MessageID", ")", ":", "try", ":", "await", "self", ".", "star_message", "(", "ctx", ".", "channel", ",", "message", ",", "ctx", ".", "author", ".", "id", ")", "except", "StarError...
https://github.com/Rapptz/RoboDanny/blob/1fb95d76d1b7685e2e2ff950e11cddfc96efbfec/cogs/stars.py#L662-L679
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
get_build_platform
()
return plat
Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X.
Return this platform's string for platform-specific distributions
[ "Return", "this", "platform", "s", "string", "for", "platform", "-", "specific", "distributions" ]
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
[ "def", "get_build_platform", "(", ")", ":", "from", "sysconfig", "import", "get_platform", "plat", "=", "get_platform", "(", ")", "if", "sys", ".", "platform", "==", "\"darwin\"", "and", "not", "plat", ".", "startswith", "(", "'macosx-'", ")", ":", "try", ...
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L385-L406
learningequality/kolibri
d056dbc477aaf651ab843caa141a6a1e0a491046
kolibri/core/discovery/utils/network/broadcast.py
python
KolibriInstanceListener.partial_subscribe
(self, events)
See similarity to SimplePlugin.subscribe() :param events: A list of string event names, matching methods on this class
See similarity to SimplePlugin.subscribe() :param events: A list of string event names, matching methods on this class
[ "See", "similarity", "to", "SimplePlugin", ".", "subscribe", "()", ":", "param", "events", ":", "A", "list", "of", "string", "event", "names", "matching", "methods", "on", "this", "class" ]
def partial_subscribe(self, events): """ See similarity to SimplePlugin.subscribe() :param events: A list of string event names, matching methods on this class """ for event in events: method = getattr(self, event, None) listeners = self.bus.listeners.get(...
[ "def", "partial_subscribe", "(", "self", ",", "events", ")", ":", "for", "event", "in", "events", ":", "method", "=", "getattr", "(", "self", ",", "event", ",", "None", ")", "listeners", "=", "self", ".", "bus", ".", "listeners", ".", "get", "(", "ev...
https://github.com/learningequality/kolibri/blob/d056dbc477aaf651ab843caa141a6a1e0a491046/kolibri/core/discovery/utils/network/broadcast.py#L262-L271
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
option/ctp/ApiStruct.py
python
FensUserInfo.__init__
(self, BrokerID='', UserID='', LoginMode=LM_Trade)
[]
def __init__(self, BrokerID='', UserID='', LoginMode=LM_Trade): self.BrokerID = '' #经纪公司代码, char[11] self.UserID = '' #用户代码, char[16] self.LoginMode = ''
[ "def", "__init__", "(", "self", ",", "BrokerID", "=", "''", ",", "UserID", "=", "''", ",", "LoginMode", "=", "LM_Trade", ")", ":", "self", ".", "BrokerID", "=", "''", "#经纪公司代码, char[11]", "self", ".", "UserID", "=", "''", "#用户代码, char[16]", "self", ".", ...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/option/ctp/ApiStruct.py#L6458-L6461
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/mailbox.py
python
mbox._generate_toc
(self)
Generate key-to-(start, stop) table of contents.
Generate key-to-(start, stop) table of contents.
[ "Generate", "key", "-", "to", "-", "(", "start", "stop", ")", "table", "of", "contents", "." ]
def _generate_toc(self): """Generate key-to-(start, stop) table of contents.""" starts, stops = [], [] last_was_empty = False self._file.seek(0) while True: line_pos = self._file.tell() line = self._file.readline() if line.startswith('From '): ...
[ "def", "_generate_toc", "(", "self", ")", ":", "starts", ",", "stops", "=", "[", "]", ",", "[", "]", "last_was_empty", "=", "False", "self", ".", "_file", ".", "seek", "(", "0", ")", "while", "True", ":", "line_pos", "=", "self", ".", "_file", ".",...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/mailbox.py#L838-L869
joosthoeks/jhTAlib
4931a34829d966ccc973fb29d767a359d6e94b44
jhtalib/behavioral_techniques/behavioral_techniques.py
python
URANUSC
(df)
Uranus Cycle
Uranus Cycle
[ "Uranus", "Cycle" ]
def URANUSC(df): """ Uranus Cycle """
[ "def", "URANUSC", "(", "df", ")", ":" ]
https://github.com/joosthoeks/jhTAlib/blob/4931a34829d966ccc973fb29d767a359d6e94b44/jhtalib/behavioral_techniques/behavioral_techniques.py#L223-L226
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_label_selector_requirement.py
python
V1LabelSelectorRequirement.__eq__
(self, other)
return self.to_dict() == other.to_dict()
Returns true if both objects are equal
Returns true if both objects are equal
[ "Returns", "true", "if", "both", "objects", "are", "equal" ]
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V1LabelSelectorRequirement): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1LabelSelectorRequirement", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_label_selector_requirement.py#L168-L173
angr/cle
7dea3e72a06c7596b9ef7b884c42cb19bca7620a
cle/backends/__init__.py
python
Backend.initial_register_values
(self)
return self.thread_registers().items()
Deprecated
Deprecated
[ "Deprecated" ]
def initial_register_values(self): """ Deprecated """ l.critical("Deprecation warning: initial_register_values is deprecated - " "use backend.thread_registers() instead") return self.thread_registers().items()
[ "def", "initial_register_values", "(", "self", ")", ":", "l", ".", "critical", "(", "\"Deprecation warning: initial_register_values is deprecated - \"", "\"use backend.thread_registers() instead\"", ")", "return", "self", ".", "thread_registers", "(", ")", ".", "items", "("...
https://github.com/angr/cle/blob/7dea3e72a06c7596b9ef7b884c42cb19bca7620a/cle/backends/__init__.py#L445-L451
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/nlp/data/information_retrieval/information_retrieval_dataset.py
python
BaseInformationRetrievalDataset.construct_input
(self, token_ids1, max_seq_length, token_ids2=None)
return input_ids, input_mask, input_type_ids
Function which constructs a valid input to BERT from tokens. If only one list of tokens (token_ids1) is passed, the input will be [CLS] token_ids1 [SEP] if two lists of tokens are passed, the input will be [CLS] token_ids1 [SEP] token_ids2 [SEP]
Function which constructs a valid input to BERT from tokens.
[ "Function", "which", "constructs", "a", "valid", "input", "to", "BERT", "from", "tokens", "." ]
def construct_input(self, token_ids1, max_seq_length, token_ids2=None): """ Function which constructs a valid input to BERT from tokens. If only one list of tokens (token_ids1) is passed, the input will be [CLS] token_ids1 [SEP] if two lists of tokens are passed, the input will...
[ "def", "construct_input", "(", "self", ",", "token_ids1", ",", "max_seq_length", ",", "token_ids2", "=", "None", ")", ":", "input_ids", "=", "[", "self", ".", "tokenizer", ".", "pad_id", "]", "*", "max_seq_length", "bert_input", "=", "[", "self", ".", "tok...
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/nlp/data/information_retrieval/information_retrieval_dataset.py#L112-L139
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim.py
python
return_or_print
(result, as_str, file)
[]
def return_or_print(result, as_str, file): result = "\n".join(result) if as_str: return result else: if file is None: print(result) else: print(result, file=file)
[ "def", "return_or_print", "(", "result", ",", "as_str", ",", "file", ")", ":", "result", "=", "\"\\n\"", ".", "join", "(", "result", ")", "if", "as_str", ":", "return", "result", "else", ":", "if", "file", "is", "None", ":", "print", "(", "result", "...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim.py#L18551-L18559
kirthevasank/nasbot
3c745dc986be30e3721087c8fa768099032a0802
utils/ancillary_utils.py
python
is_nondecreasing
(arr)
return all([x <= y for x, y in zip(arr, arr[1:])])
Returns true if the sequence is non-decreasing.
Returns true if the sequence is non-decreasing.
[ "Returns", "true", "if", "the", "sequence", "is", "non", "-", "decreasing", "." ]
def is_nondecreasing(arr): """ Returns true if the sequence is non-decreasing. """ return all([x <= y for x, y in zip(arr, arr[1:])])
[ "def", "is_nondecreasing", "(", "arr", ")", ":", "return", "all", "(", "[", "x", "<=", "y", "for", "x", ",", "y", "in", "zip", "(", "arr", ",", "arr", "[", "1", ":", "]", ")", "]", ")" ]
https://github.com/kirthevasank/nasbot/blob/3c745dc986be30e3721087c8fa768099032a0802/utils/ancillary_utils.py#L29-L31
oddt/oddt
8cf555820d97a692ade81c101ebe10e28bcb3722
oddt/docking/AutodockVina.py
python
autodock_vina.predict_ligand
(self, ligand)
return self.score([ligand])[0]
Local method to score one ligand and update it's scores. Parameters ---------- ligand: oddt.toolkit.Molecule object Ligand to be scored Returns ------- ligand: oddt.toolkit.Molecule object Scored ligand with updated scores
Local method to score one ligand and update it's scores.
[ "Local", "method", "to", "score", "one", "ligand", "and", "update", "it", "s", "scores", "." ]
def predict_ligand(self, ligand): """Local method to score one ligand and update it's scores. Parameters ---------- ligand: oddt.toolkit.Molecule object Ligand to be scored Returns ------- ligand: oddt.toolkit.Molecule object Scored ligan...
[ "def", "predict_ligand", "(", "self", ",", "ligand", ")", ":", "return", "self", ".", "score", "(", "[", "ligand", "]", ")", "[", "0", "]" ]
https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/docking/AutodockVina.py#L307-L320
ryanlayer/samplot
34a3f37eb7042b30e074df4fb3937708b1164460
samplot/samplot.py
python
plot
(parser, options, extra_args=None)
To support translocations, the SVs are specified as an array of genome_interval. For now we let that array be size 1 or 2.
To support translocations, the SVs are specified as an array of genome_interval. For now we let that array be size 1 or 2.
[ "To", "support", "translocations", "the", "SVs", "are", "specified", "as", "an", "array", "of", "genome_interval", ".", "For", "now", "we", "let", "that", "array", "be", "size", "1", "or", "2", "." ]
def plot(parser, options, extra_args=None): """ To support translocations, the SVs are specified as an array of genome_interval. For now we let that array be size 1 or 2. """ if options.print_args or options.json_only: print_arguments(options) if options.json_only: sys....
[ "def", "plot", "(", "parser", ",", "options", ",", "extra_args", "=", "None", ")", ":", "if", "options", ".", "print_args", "or", "options", ".", "json_only", ":", "print_arguments", "(", "options", ")", "if", "options", ".", "json_only", ":", "sys", "."...
https://github.com/ryanlayer/samplot/blob/34a3f37eb7042b30e074df4fb3937708b1164460/samplot/samplot.py#L3509-L3674
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_process.py
python
Yedit.separator
(self)
return self._separator
getter method for separator
getter method for separator
[ "getter", "method", "for", "separator" ]
def separator(self): ''' getter method for separator ''' return self._separator
[ "def", "separator", "(", "self", ")", ":", "return", "self", ".", "_separator" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_process.py#L174-L176
nicolas-chaulet/torch-points3d
8e4c19ecb81926626231bf185e9eca77d92a0606
torch_points3d/models/base_architectures/backbone.py
python
BackboneBasedModel.__init__
(self, opt, model_type, dataset: BaseDataset, modules_lib)
Construct a backbone generator (It is a simple down module) Parameters: opt - options for the network generation model_type - type of the model to be generated modules_lib - all modules that can be used in the backbone opt is expected to contains the following keys:...
Construct a backbone generator (It is a simple down module) Parameters: opt - options for the network generation model_type - type of the model to be generated modules_lib - all modules that can be used in the backbone
[ "Construct", "a", "backbone", "generator", "(", "It", "is", "a", "simple", "down", "module", ")", "Parameters", ":", "opt", "-", "options", "for", "the", "network", "generation", "model_type", "-", "type", "of", "the", "model", "to", "be", "generated", "mo...
def __init__(self, opt, model_type, dataset: BaseDataset, modules_lib): """Construct a backbone generator (It is a simple down module) Parameters: opt - options for the network generation model_type - type of the model to be generated modules_lib - all modules that c...
[ "def", "__init__", "(", "self", ",", "opt", ",", "model_type", ",", "dataset", ":", "BaseDataset", ",", "modules_lib", ")", ":", "super", "(", "BackboneBasedModel", ",", "self", ")", ".", "__init__", "(", "opt", ")", "self", ".", "_spatial_ops_dict", "=", ...
https://github.com/nicolas-chaulet/torch-points3d/blob/8e4c19ecb81926626231bf185e9eca77d92a0606/torch_points3d/models/base_architectures/backbone.py#L55-L75
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/codegen/compatibility.py
python
build_deprecated_datatypes_py
()
return buffer.getvalue()
Build datatype (graph_objs) class source code string for deprecated datatypes Returns ------- str
Build datatype (graph_objs) class source code string for deprecated datatypes
[ "Build", "datatype", "(", "graph_objs", ")", "class", "source", "code", "string", "for", "deprecated", "datatypes" ]
def build_deprecated_datatypes_py(): """ Build datatype (graph_objs) class source code string for deprecated datatypes Returns ------- str """ # Initialize source code buffer # ----------------------------- buffer = StringIO() # Write warnings import # ----------------...
[ "def", "build_deprecated_datatypes_py", "(", ")", ":", "# Initialize source code buffer", "# -----------------------------", "buffer", "=", "StringIO", "(", ")", "# Write warnings import", "# ---------------------", "buffer", ".", "write", "(", "\"import warnings\\n\"", ")", ...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/codegen/compatibility.py#L44-L97
NVlabs/neuralrgbd
c8071a0bcbd4c4e7ef95c44e7de9c51353ab9764
code/warping/homography.py
python
resample_vol_cuda
(src_vol, rel_extM, cam_intrinsic = None, d_candi = None, d_candi_new = None, padding_value = 0., output_tensor = False, is_debug = False, PointsDs_ref_cam_coord_in = None)
r''' if d_candi_new is not None: d_candi : candidate depth values for the src view; d_candi_new : candidate depth values for the ref view. Usually d_candi_new is different from d_candi
r'''
[ "r" ]
def resample_vol_cuda(src_vol, rel_extM, cam_intrinsic = None, d_candi = None, d_candi_new = None, padding_value = 0., output_tensor = False, is_debug = False, PointsDs_ref_cam_coord_in = None): r''' if d_candi_new is not None: d_candi : ...
[ "def", "resample_vol_cuda", "(", "src_vol", ",", "rel_extM", ",", "cam_intrinsic", "=", "None", ",", "d_candi", "=", "None", ",", "d_candi_new", "=", "None", ",", "padding_value", "=", "0.", ",", "output_tensor", "=", "False", ",", "is_debug", "=", "False", ...
https://github.com/NVlabs/neuralrgbd/blob/c8071a0bcbd4c4e7ef95c44e7de9c51353ab9764/code/warping/homography.py#L654-L723
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/quotient_ring_element.py
python
QuotientRingElement.__invert__
(self)
return self.__class__(self.parent(), inv)
EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring.QuotientRing_generic_with_category.element_class'> sage: ~S(2/3) 3/2 TESTS:: sage: S(2/3).__invert__() 3/2 Note that a is not ...
EXAMPLES::
[ "EXAMPLES", "::" ]
def __invert__(self): """ EXAMPLES:: sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); type(a) <class 'sage.rings.quotient_ring.QuotientRing_generic_with_category.element_class'> sage: ~S(2/3) 3/2 TESTS:: sage: S(2/3).__invert__() ...
[ "def", "__invert__", "(", "self", ")", ":", "try", ":", "inv", "=", "self", ".", "__rep", ".", "inverse_mod", "(", "self", ".", "parent", "(", ")", ".", "defining_ideal", "(", ")", ")", "except", "NotImplementedError", ":", "return", "self", ".", "pare...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/quotient_ring_element.py#L545-L570
wikimedia/pywikibot
81a01ffaec7271bf5b4b170f85a80388420a4e78
pywikibot/page/__init__.py
python
BasePage.is_categorypage
(self)
return self.namespace() == 14
Return True if the page is a Category, False otherwise.
Return True if the page is a Category, False otherwise.
[ "Return", "True", "if", "the", "page", "is", "a", "Category", "False", "otherwise", "." ]
def is_categorypage(self): """Return True if the page is a Category, False otherwise.""" return self.namespace() == 14
[ "def", "is_categorypage", "(", "self", ")", ":", "return", "self", ".", "namespace", "(", ")", "==", "14" ]
https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/page/__init__.py#L812-L814
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_persistent_volume_spec.py
python
V1PersistentVolumeSpec.cephfs
(self, cephfs)
Sets the cephfs of this V1PersistentVolumeSpec. CephFS represents a Ceph FS mount on the host that shares a pod's lifetime :param cephfs: The cephfs of this V1PersistentVolumeSpec. :type: V1CephFSVolumeSource
Sets the cephfs of this V1PersistentVolumeSpec. CephFS represents a Ceph FS mount on the host that shares a pod's lifetime
[ "Sets", "the", "cephfs", "of", "this", "V1PersistentVolumeSpec", ".", "CephFS", "represents", "a", "Ceph", "FS", "mount", "on", "the", "host", "that", "shares", "a", "pod", "s", "lifetime" ]
def cephfs(self, cephfs): """ Sets the cephfs of this V1PersistentVolumeSpec. CephFS represents a Ceph FS mount on the host that shares a pod's lifetime :param cephfs: The cephfs of this V1PersistentVolumeSpec. :type: V1CephFSVolumeSource """ self._cephfs = ceph...
[ "def", "cephfs", "(", "self", ",", "cephfs", ")", ":", "self", ".", "_cephfs", "=", "cephfs" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_persistent_volume_spec.py#L245-L254
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/caldav/datastore/scheduling/icaldiff.py
python
iCalDiff._organizerMerge
(self)
Merge changes to ATTENDEE properties in oldcalendar into newcalendar.
Merge changes to ATTENDEE properties in oldcalendar into newcalendar.
[ "Merge", "changes", "to", "ATTENDEE", "properties", "in", "oldcalendar", "into", "newcalendar", "." ]
def _organizerMerge(self): """ Merge changes to ATTENDEE properties in oldcalendar into newcalendar. """ organizer = normalizeCUAddr(self.newcalendar.masterComponent().propertyValue("ORGANIZER")) self._doSmartMerge(organizer, True)
[ "def", "_organizerMerge", "(", "self", ")", ":", "organizer", "=", "normalizeCUAddr", "(", "self", ".", "newcalendar", ".", "masterComponent", "(", ")", ".", "propertyValue", "(", "\"ORGANIZER\"", ")", ")", "self", ".", "_doSmartMerge", "(", "organizer", ",", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/scheduling/icaldiff.py#L100-L105
pradyun/Py2C
b5c9fd238db589f6d7709482901e33ffebb764eb
py2c/tree/__init__.py
python
Node.check_modifiers
(self)
Check the modifiers of the Node's fields
Check the modifiers of the Node's fields
[ "Check", "the", "modifiers", "of", "the", "Node", "s", "fields" ]
def check_modifiers(self): """Check the modifiers of the Node's fields """ invalid_modifiers = [] for name, type_, modifier in self._fields: if modifier not in ['NEEDED', 'OPTIONAL', 'ZERO_OR_MORE', 'ONE_OR_MORE']: invalid_modifiers.append((name, modifier)) ...
[ "def", "check_modifiers", "(", "self", ")", ":", "invalid_modifiers", "=", "[", "]", "for", "name", ",", "type_", ",", "modifier", "in", "self", ".", "_fields", ":", "if", "modifier", "not", "in", "[", "'NEEDED'", ",", "'OPTIONAL'", ",", "'ZERO_OR_MORE'", ...
https://github.com/pradyun/Py2C/blob/b5c9fd238db589f6d7709482901e33ffebb764eb/py2c/tree/__init__.py#L226-L236
PacktPublishing/Mastering-Natural-Language-Processing-with-Python
1dd1091e691d8d7febd930b1f4c51519dce2e96e
__pycache__/replacers.py
python
RepeatReplacer.replace
(self, word)
[]
def replace(self, word): if wordnet.synsets(word): return word repl_word = self.repeat_regexp.sub(self.repl, word) if repl_word != word: return self.replace(repl_word) else: return repl_word
[ "def", "replace", "(", "self", ",", "word", ")", ":", "if", "wordnet", ".", "synsets", "(", "word", ")", ":", "return", "word", "repl_word", "=", "self", ".", "repeat_regexp", ".", "sub", "(", "self", ".", "repl", ",", "word", ")", "if", "repl_word",...
https://github.com/PacktPublishing/Mastering-Natural-Language-Processing-with-Python/blob/1dd1091e691d8d7febd930b1f4c51519dce2e96e/__pycache__/replacers.py#L31-L38
Sceptre/sceptre
b44797ae712e1e57c2421f2d93c35a4e8104c5ee
sceptre/cli/launch.py
python
launch_command
(ctx, path, yes)
Launch a Stack or StackGroup for a given config PATH. \f :param path: The path to launch. Can be a Stack or StackGroup. :type path: str :param yes: A flag to answer 'yes' to all CLI questions. :type yes: bool
Launch a Stack or StackGroup for a given config PATH. \f
[ "Launch", "a", "Stack", "or", "StackGroup", "for", "a", "given", "config", "PATH", ".", "\\", "f" ]
def launch_command(ctx, path, yes): """ Launch a Stack or StackGroup for a given config PATH. \f :param path: The path to launch. Can be a Stack or StackGroup. :type path: str :param yes: A flag to answer 'yes' to all CLI questions. :type yes: bool """ context = SceptreContext( ...
[ "def", "launch_command", "(", "ctx", ",", "path", ",", "yes", ")", ":", "context", "=", "SceptreContext", "(", "command_path", "=", "path", ",", "project_path", "=", "ctx", ".", "obj", ".", "get", "(", "\"project_path\"", ")", ",", "user_variables", "=", ...
https://github.com/Sceptre/sceptre/blob/b44797ae712e1e57c2421f2d93c35a4e8104c5ee/sceptre/cli/launch.py#L17-L39
sethmlarson/virtualbox-python
984a6e2cb0e8996f4df40f4444c1528849f1c70d
virtualbox/library.py
python
ISystemProperties.max_guest_ram
(self)
return ret
Get int value for 'maxGuestRAM' Maximum guest system memory in Megabytes.
Get int value for 'maxGuestRAM' Maximum guest system memory in Megabytes.
[ "Get", "int", "value", "for", "maxGuestRAM", "Maximum", "guest", "system", "memory", "in", "Megabytes", "." ]
def max_guest_ram(self): """Get int value for 'maxGuestRAM' Maximum guest system memory in Megabytes. """ ret = self._get_attr("maxGuestRAM") return ret
[ "def", "max_guest_ram", "(", "self", ")", ":", "ret", "=", "self", ".", "_get_attr", "(", "\"maxGuestRAM\"", ")", "return", "ret" ]
https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L20121-L20126
google/brain-tokyo-workshop
faf12f6bbae773fbe535c7a6cf357dc662c6c1d8
WANNRelease/prettyNEAT/neat_src/neat.py
python
Neat.initPop
(self)
Initialize population with a list of random individuals
Initialize population with a list of random individuals
[ "Initialize", "population", "with", "a", "list", "of", "random", "individuals" ]
def initPop(self): """Initialize population with a list of random individuals """ ## Create base individual p = self.p # readability # - Create Nodes - nodeId = np.arange(0,p['ann_nInput']+ p['ann_nOutput']+1,1) node = np.empty((3,len(nodeId))) node[0,:] = nodeId # Node ty...
[ "def", "initPop", "(", "self", ")", ":", "## Create base individual", "p", "=", "self", ".", "p", "# readability", "# - Create Nodes -", "nodeId", "=", "np", ".", "arange", "(", "0", ",", "p", "[", "'ann_nInput'", "]", "+", "p", "[", "'ann_nOutput'", "]",...
https://github.com/google/brain-tokyo-workshop/blob/faf12f6bbae773fbe535c7a6cf357dc662c6c1d8/WANNRelease/prettyNEAT/neat_src/neat.py#L67-L113
hendrycks/robustness
305054464935cdf4c5f182f1387a1cc506854d49
old/Icons-50/models/msdnet.py
python
Transition.forward
(self, x)
return output
Propegate output through different scales. :param x: input to the transition layer :return: list of scales' outputs
Propegate output through different scales.
[ "Propegate", "output", "through", "different", "scales", "." ]
def forward(self, x): """ Propegate output through different scales. :param x: input to the transition layer :return: list of scales' outputs """ if self.args.debug: print ("In transition forward!") output = [] for scale, scale_net in enumera...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "if", "self", ".", "args", ".", "debug", ":", "print", "(", "\"In transition forward!\"", ")", "output", "=", "[", "]", "for", "scale", ",", "scale_net", "in", "enumerate", "(", "self", ".", "scales", ...
https://github.com/hendrycks/robustness/blob/305054464935cdf4c5f182f1387a1cc506854d49/old/Icons-50/models/msdnet.py#L381-L398
googleanalytics/google-analytics-super-proxy
f5bad82eb1375d222638423e6ae302173a9a7948
src/libs/csv_writer/csv_writer.py
python
ExportPrinter.OutputProfileName
(self, results)
Outputs the profile name along with the qurey.
Outputs the profile name along with the qurey.
[ "Outputs", "the", "profile", "name", "along", "with", "the", "qurey", "." ]
def OutputProfileName(self, results): """Outputs the profile name along with the qurey.""" profile_name = '' info = results.get('profileInfo') if info: profile_name = info.get('profileName') self.writer.WriteRow(['Report For Profile: ', profile_name])
[ "def", "OutputProfileName", "(", "self", ",", "results", ")", ":", "profile_name", "=", "''", "info", "=", "results", ".", "get", "(", "'profileInfo'", ")", "if", "info", ":", "profile_name", "=", "info", ".", "get", "(", "'profileName'", ")", "self", "....
https://github.com/googleanalytics/google-analytics-super-proxy/blob/f5bad82eb1375d222638423e6ae302173a9a7948/src/libs/csv_writer/csv_writer.py#L151-L158
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_gcloud/build/src/gcloud_dm_resource_builder.py
python
GcloudResourceBuilder.build_storage_buckets
(self, bucket_names)
return results
create the resource for storage buckets
create the resource for storage buckets
[ "create", "the", "resource", "for", "storage", "buckets" ]
def build_storage_buckets(self, bucket_names): ''' create the resource for storage buckets''' results = [] for b_name in bucket_names: results.append(Bucket(b_name, self.project, self.zone)) return results
[ "def", "build_storage_buckets", "(", "self", ",", "bucket_names", ")", ":", "results", "=", "[", "]", "for", "b_name", "in", "bucket_names", ":", "results", ".", "append", "(", "Bucket", "(", "b_name", ",", "self", ".", "project", ",", "self", ".", "zone...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/build/src/gcloud_dm_resource_builder.py#L177-L183
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-build/python-libs/xmpppy/xmpp/protocol.py
python
DataField.setDesc
(self,desc)
Set the description of this field.
Set the description of this field.
[ "Set", "the", "description", "of", "this", "field", "." ]
def setDesc(self,desc): """ Set the description of this field. """ self.setTagData('desc',desc)
[ "def", "setDesc", "(", "self", ",", "desc", ")", ":", "self", ".", "setTagData", "(", "'desc'", ",", "desc", ")" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/xmpppy/xmpp/protocol.py#L621-L623
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/parental_status_view_service/client.py
python
ParentalStatusViewServiceClient.parse_common_project_path
(path: str)
return m.groupdict() if m else {}
Parse a project path into its component segments.
Parse a project path into its component segments.
[ "Parse", "a", "project", "path", "into", "its", "component", "segments", "." ]
def parse_common_project_path(path: str) -> Dict[str, str]: """Parse a project path into its component segments.""" m = re.match(r"^projects/(?P<project>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_project_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^projects/(?P<project>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(", ")", "if", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/parental_status_view_service/client.py#L224-L227
networkx/networkx
1620568e36702b1cfeaf1c0277b167b6cb93e48d
networkx/algorithms/core.py
python
k_crust
(G, k=None, core_number=None)
return G.subgraph(nodes).copy()
Returns the k-crust of G. The k-crust is the graph G with the edges of the k-core removed and isolated nodes found after the removal of edges are also removed. Parameters ---------- G : NetworkX graph A graph or directed graph. k : int, optional The order of the shell. If not spe...
Returns the k-crust of G.
[ "Returns", "the", "k", "-", "crust", "of", "G", "." ]
def k_crust(G, k=None, core_number=None): """Returns the k-crust of G. The k-crust is the graph G with the edges of the k-core removed and isolated nodes found after the removal of edges are also removed. Parameters ---------- G : NetworkX graph A graph or directed graph. k : int, o...
[ "def", "k_crust", "(", "G", ",", "k", "=", "None", ",", "core_number", "=", "None", ")", ":", "# Default for k is one less than in _core_subgraph, so just inline.", "# Filter is c[v] <= k", "if", "core_number", "is", "None", ":", "core_number", "=", "find_cores", "...
https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/algorithms/core.py#L259-L315
timonwong/SublimeAStyleFormatter
0ac8284db12911cabf7ab5004ba3eb99b96ed1c9
AStyleFormatterLib/diff_match_patch/python2/diff_match_patch.py
python
diff_match_patch.diff_levenshtein
(self, diffs)
return levenshtein
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. Args: diffs: Array of diff tuples. Returns: Number of changes.
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters.
[ "Compute", "the", "Levenshtein", "distance", ";", "the", "number", "of", "inserted", "deleted", "or", "substituted", "characters", "." ]
def diff_levenshtein(self, diffs): """Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. Args: diffs: Array of diff tuples. Returns: Number of changes. """ levenshtein = 0 insertions = 0 deletions = 0 for (op, data) in diffs: ...
[ "def", "diff_levenshtein", "(", "self", ",", "diffs", ")", ":", "levenshtein", "=", "0", "insertions", "=", "0", "deletions", "=", "0", "for", "(", "op", ",", "data", ")", "in", "diffs", ":", "if", "op", "==", "self", ".", "DIFF_INSERT", ":", "insert...
https://github.com/timonwong/SublimeAStyleFormatter/blob/0ac8284db12911cabf7ab5004ba3eb99b96ed1c9/AStyleFormatterLib/diff_match_patch/python2/diff_match_patch.py#L1112-L1136
NeuralEnsemble/python-neo
34d4db8fb0dc950dbbc6defd7fb75e99ea877286
neo/io/brainwaresrcio.py
python
BrainwareSrcIO.__init__
(self, filename=None)
Arguments: filename: the filename
Arguments: filename: the filename
[ "Arguments", ":", "filename", ":", "the", "filename" ]
def __init__(self, filename=None): """ Arguments: filename: the filename """ BaseIO.__init__(self) # log the __init__ self.logger.info('__init__') # this stores the filename of the current object, exactly as it is # provided when the instance...
[ "def", "__init__", "(", "self", ",", "filename", "=", "None", ")", ":", "BaseIO", ".", "__init__", "(", "self", ")", "# log the __init__", "self", ".", "logger", ".", "info", "(", "'__init__'", ")", "# this stores the filename of the current object, exactly as it is...
https://github.com/NeuralEnsemble/python-neo/blob/34d4db8fb0dc950dbbc6defd7fb75e99ea877286/neo/io/brainwaresrcio.py#L140-L181
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
numpy/core/__init__.py
python
ushort.__ge__
(self, *args, **kwargs)
Return self>=value.
Return self>=value.
[ "Return", "self", ">", "=", "value", "." ]
def __ge__(self, *args, **kwargs): # real signature unknown """ Return self>=value. """ pass
[ "def", "__ge__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# real signature unknown", "pass" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L4465-L4467
bbfamily/abu
2de85ae57923a720dac99a545b4f856f6b87304b
abupy/WidgetBu/ABuWGBuyFactor.py
python
BuyDUWidget._init_widget
(self)
构建AbuDownUpTrend策略参数界面
构建AbuDownUpTrend策略参数界面
[ "构建AbuDownUpTrend策略参数界面" ]
def _init_widget(self): """构建AbuDownUpTrend策略参数界面""" self.description = widgets.Textarea( value=u'整个择时周期分成两部分,长的为长线择时,短的为短线择时:\n' u'1. 寻找长线下跌的股票,比如一个季度(4个月)整体趋势为下跌趋势\n' u'2. 短线走势上涨的股票,比如一个月整体趋势为上涨趋势\n,' u'3. 最后使用海龟突破的N日突破策略作为策略最终买入信号', ...
[ "def", "_init_widget", "(", "self", ")", ":", "self", ".", "description", "=", "widgets", ".", "Textarea", "(", "value", "=", "u'整个择时周期分成两部分,长的为长线择时,短的为短线择时:\\n'", "u'1. 寻找长线下跌的股票,比如一个季度(4个月)整体趋势为下跌趋势\\n'", "u'2. 短线走势上涨的股票,比如一个月整体趋势为上涨趋势\\n,'", "u'3. 最后使用海龟突破的N日突破策略作为策略最终买入信号',...
https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/WidgetBu/ABuWGBuyFactor.py#L322-L381
dask/dask
c2b962fec1ba45440fe928869dc64cfe9cc36506
dask/array/core.py
python
keyname
(name, i, okey)
return (name, i) + tuple(k for k in okey if k is not None)
>>> keyname('x', 3, [None, None, 0, 2]) ('x', 3, 0, 2)
[]
def keyname(name, i, okey): """ >>> keyname('x', 3, [None, None, 0, 2]) ('x', 3, 0, 2) """ return (name, i) + tuple(k for k in okey if k is not None)
[ "def", "keyname", "(", "name", ",", "i", ",", "okey", ")", ":", "return", "(", "name", ",", "i", ")", "+", "tuple", "(", "k", "for", "k", "in", "okey", "if", "k", "is", "not", "None", ")" ]
https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/array/core.py#L5105-L5111
ScottfreeLLC/AlphaPy
e6419cc811c2a3abc1ad522a85a888c8ef386056
alphapy/transforms.py
python
extract_date
(f, c)
return date_features
r"""Extract date into its components: year, month, day, dayofweek. Parameters ---------- f : pandas.DataFrame Dataframe containing the date column ``c``. c : str Name of the date column in the dataframe ``f``. Returns ------- date_features : pandas.DataFrame The dat...
r"""Extract date into its components: year, month, day, dayofweek.
[ "r", "Extract", "date", "into", "its", "components", ":", "year", "month", "day", "dayofweek", "." ]
def extract_date(f, c): r"""Extract date into its components: year, month, day, dayofweek. Parameters ---------- f : pandas.DataFrame Dataframe containing the date column ``c``. c : str Name of the date column in the dataframe ``f``. Returns ------- date_features : pand...
[ "def", "extract_date", "(", "f", ",", "c", ")", ":", "fc", "=", "pd", ".", "to_datetime", "(", "f", "[", "c", "]", ")", "date_features", "=", "pd", ".", "DataFrame", "(", ")", "try", ":", "fyear", "=", "pd", ".", "Series", "(", "fc", ".", "dt",...
https://github.com/ScottfreeLLC/AlphaPy/blob/e6419cc811c2a3abc1ad522a85a888c8ef386056/alphapy/transforms.py#L489-L516
pytorch/botorch
f85fb8ff36d21e21bdb881d107982fb6d5d78704
botorch/models/transforms/input.py
python
AppendFeatures.__init__
( self, feature_set: Tensor, transform_on_train: bool = False, transform_on_eval: bool = True, transform_on_fantasize: bool = False, )
r"""Append `feature_set` to each input. Args: feature_set: An `n_f x d_f`-dim tensor denoting the features to be appended to the inputs. transform_on_train: A boolean indicating whether to apply the transforms in train() mode. Default: False. ...
r"""Append `feature_set` to each input.
[ "r", "Append", "feature_set", "to", "each", "input", "." ]
def __init__( self, feature_set: Tensor, transform_on_train: bool = False, transform_on_eval: bool = True, transform_on_fantasize: bool = False, ) -> None: r"""Append `feature_set` to each input. Args: feature_set: An `n_f x d_f`-dim tensor denoti...
[ "def", "__init__", "(", "self", ",", "feature_set", ":", "Tensor", ",", "transform_on_train", ":", "bool", "=", "False", ",", "transform_on_eval", ":", "bool", "=", "True", ",", "transform_on_fantasize", ":", "bool", "=", "False", ",", ")", "->", "None", "...
https://github.com/pytorch/botorch/blob/f85fb8ff36d21e21bdb881d107982fb6d5d78704/botorch/models/transforms/input.py#L951-L976
user-cont/conu
0d8962560f6f7f17fe1be0d434a4809e2a0ea51d
conu/backend/buildah/container.py
python
BuildahContainer.wait
(self, timeout=None)
return run_cmd(cmdline, return_output=True)
Block until the container stops, then return its exit code. Similar to the ``podman wait`` command. :param timeout: int, microseconds to wait before polling for completion :return: int, exit code
Block until the container stops, then return its exit code. Similar to the ``podman wait`` command.
[ "Block", "until", "the", "container", "stops", "then", "return", "its", "exit", "code", ".", "Similar", "to", "the", "podman", "wait", "command", "." ]
def wait(self, timeout=None): """ Block until the container stops, then return its exit code. Similar to the ``podman wait`` command. :param timeout: int, microseconds to wait before polling for completion :return: int, exit code """ timeout = ["--interval=%s" % ...
[ "def", "wait", "(", "self", ",", "timeout", "=", "None", ")", ":", "timeout", "=", "[", "\"--interval=%s\"", "%", "timeout", "]", "if", "timeout", "else", "[", "]", "cmdline", "=", "[", "\"podman\"", ",", "\"wait\"", "]", "+", "timeout", "+", "[", "s...
https://github.com/user-cont/conu/blob/0d8962560f6f7f17fe1be0d434a4809e2a0ea51d/conu/backend/buildah/container.py#L245-L255
pyg-team/pytorch_geometric
b920e9a3a64e22c8356be55301c88444ff051cae
examples/hetero/hetero_conv_dblp.py
python
train
()
return float(loss)
[]
def train(): model.train() optimizer.zero_grad() out = model(data.x_dict, data.edge_index_dict) mask = data['author'].train_mask loss = F.cross_entropy(out[mask], data['author'].y[mask]) loss.backward() optimizer.step() return float(loss)
[ "def", "train", "(", ")", ":", "model", ".", "train", "(", ")", "optimizer", ".", "zero_grad", "(", ")", "out", "=", "model", "(", "data", ".", "x_dict", ",", "data", ".", "edge_index_dict", ")", "mask", "=", "data", "[", "'author'", "]", ".", "tra...
https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/examples/hetero/hetero_conv_dblp.py#L49-L57
volatilityfoundation/community
d9fc0727266ec552bb6412142f3f31440c601664
ZeusScan/zeusscan.py
python
ZeusScan1._zeus_filter
(self, vad)
return (vad.u.VadFlags.PrivateMemory == 0 and prot == "PAGE_NO_ACCESS" and vad.Tag == "VadS")
This is a callback that's executed by get_vads() when searching for zeus injections. @param vad: an MMVAD object. @returns: True if the MMVAD looks like it might contain a zeus image. We want the memory to be executable, but right now we can only get the original p...
This is a callback that's executed by get_vads() when searching for zeus injections.
[ "This", "is", "a", "callback", "that", "s", "executed", "by", "get_vads", "()", "when", "searching", "for", "zeus", "injections", "." ]
def _zeus_filter(self, vad): """ This is a callback that's executed by get_vads() when searching for zeus injections. @param vad: an MMVAD object. @returns: True if the MMVAD looks like it might contain a zeus image. We want the memory to be executable, but ...
[ "def", "_zeus_filter", "(", "self", ",", "vad", ")", ":", "prot", "=", "vad", ".", "u", ".", "VadFlags", ".", "Protection", ".", "v", "(", ")", "prot", "=", "vadinfo", ".", "PROTECT_FLAGS", ".", "get", "(", "prot", ",", "\"\"", ")", "return", "(", ...
https://github.com/volatilityfoundation/community/blob/d9fc0727266ec552bb6412142f3f31440c601664/ZeusScan/zeusscan.py#L98-L120
intel/CeTune
fdc523971dc6d52cbbefb24ff9504fdc934b31ca
conf/common.py
python
check_ceph_running
(user, node)
return True
[]
def check_ceph_running(user, node): stdout, stderr = pdsh(user, [node], "timeout 3 ceph -s 2>/dev/null 1>/dev/null; echo $?", option = "check_return") res = format_pdsh_return(stdout) ceph_is_up = False if node in res: if int(res[node]) == 0: ceph_is_up = True if not ceph_is_up: ...
[ "def", "check_ceph_running", "(", "user", ",", "node", ")", ":", "stdout", ",", "stderr", "=", "pdsh", "(", "user", ",", "[", "node", "]", ",", "\"timeout 3 ceph -s 2>/dev/null 1>/dev/null; echo $?\"", ",", "option", "=", "\"check_return\"", ")", "res", "=", "...
https://github.com/intel/CeTune/blob/fdc523971dc6d52cbbefb24ff9504fdc934b31ca/conf/common.py#L590-L599
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility-2.3/volatility/plugins/malware/psxview.py
python
PsXview.check_pslist
(self, all_tasks)
return dict((p.obj_vm.vtop(p.obj_offset), p) for p in all_tasks)
Enumerate processes from PsActiveProcessHead
Enumerate processes from PsActiveProcessHead
[ "Enumerate", "processes", "from", "PsActiveProcessHead" ]
def check_pslist(self, all_tasks): """Enumerate processes from PsActiveProcessHead""" return dict((p.obj_vm.vtop(p.obj_offset), p) for p in all_tasks)
[ "def", "check_pslist", "(", "self", ",", "all_tasks", ")", ":", "return", "dict", "(", "(", "p", ".", "obj_vm", ".", "vtop", "(", "p", ".", "obj_offset", ")", ",", "p", ")", "for", "p", "in", "all_tasks", ")" ]
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility-2.3/volatility/plugins/malware/psxview.py#L80-L82
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/plugins/dbms/postgresql/takeover.py
python
Takeover.udfSetLocalPaths
(self)
[]
def udfSetLocalPaths(self): self.udfLocalFile = paths.SQLMAP_UDF_PATH self.udfSharedLibName = "libs%s" % randomStr(lowercase=True) self.getVersionFromBanner() banVer = kb.bannerFp["dbmsVersion"] if banVer >= "9.4": majorVer = "9.4" elif banVer >= "9.3": ...
[ "def", "udfSetLocalPaths", "(", "self", ")", ":", "self", ".", "udfLocalFile", "=", "paths", ".", "SQLMAP_UDF_PATH", "self", ".", "udfSharedLibName", "=", "\"libs%s\"", "%", "randomStr", "(", "lowercase", "=", "True", ")", "self", ".", "getVersionFromBanner", ...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/plugins/dbms/postgresql/takeover.py#L43-L84
spotify/luigi
c3b66f4a5fa7eaa52f9a72eb6704b1049035c789
luigi/parameter.py
python
OptionalChoiceParameter.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.expected_type = self._var_type
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "expected_type", "=", "self", ".", "_var_type" ]
https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/parameter.py#L1359-L1361
dpguthrie/yahooquery
a30cc310bf5eb4b5ce5eadeafe51d589995ea9fd
yahooquery/ticker.py
python
Ticker.institution_ownership
(self)
return self._quote_summary_dataframe("institutionOwnership")
Institution Ownership Top 10 owners of a given symbol(s) Returns ------- pandas.DataFrame institutionOwnership module data
Institution Ownership
[ "Institution", "Ownership" ]
def institution_ownership(self): """Institution Ownership Top 10 owners of a given symbol(s) Returns ------- pandas.DataFrame institutionOwnership module data """ return self._quote_summary_dataframe("institutionOwnership")
[ "def", "institution_ownership", "(", "self", ")", ":", "return", "self", ".", "_quote_summary_dataframe", "(", "\"institutionOwnership\"", ")" ]
https://github.com/dpguthrie/yahooquery/blob/a30cc310bf5eb4b5ce5eadeafe51d589995ea9fd/yahooquery/ticker.py#L789-L799
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py
python
CacheControlAdapter.build_response
(self, request, response, from_cache=False)
return resp
Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response
Build a response by making a request or using the cache.
[ "Build", "a", "response", "by", "making", "a", "request", "or", "using", "the", "cache", "." ]
def build_response(self, request, response, from_cache=False): """ Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response """ if not from_cache and request.method == 'GET': # Check fo...
[ "def", "build_response", "(", "self", ",", "request", ",", "response", ",", "from_cache", "=", "False", ")", ":", "if", "not", "from_cache", "and", "request", ".", "method", "==", "'GET'", ":", "# Check for any heuristics that might update headers", "# before trying...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py#L51-L121
jyapayne/Web2Executable
027b01914e4faecfa038169d477851de0cbd9b96
command_line.py
python
setup_directories
(args, command_base)
Setup the project and output directories from args
Setup the project and output directories from args
[ "Setup", "the", "project", "and", "output", "directories", "from", "args" ]
def setup_directories(args, command_base): """Setup the project and output directories from args""" command_base._project_dir = args.project_dir command_base._output_dir = (args.output_dir or utils.path_join(command_base._project_dir, ...
[ "def", "setup_directories", "(", "args", ",", "command_base", ")", ":", "command_base", ".", "_project_dir", "=", "args", ".", "project_dir", "command_base", ".", "_output_dir", "=", "(", "args", ".", "output_dir", "or", "utils", ".", "path_join", "(", "comman...
https://github.com/jyapayne/Web2Executable/blob/027b01914e4faecfa038169d477851de0cbd9b96/command_line.py#L1648-L1654
sokolovstas/SublimeWebInspector
e808d12956f115ea2b37bdf46fbfdb20b4e5ec13
views.py
python
wrap_view
(v)
return None
Convert a Sublime View into an SWIDebugView
Convert a Sublime View into an SWIDebugView
[ "Convert", "a", "Sublime", "View", "into", "an", "SWIDebugView" ]
def wrap_view(v): """ Convert a Sublime View into an SWIDebugView """ if isinstance(v, SwiDebugView): return v if isinstance(v, sublime.View): id = v.buffer_id() # Take this opportunity to replace the wrapped view, # if it's against the same buffer as the previously ...
[ "def", "wrap_view", "(", "v", ")", ":", "if", "isinstance", "(", "v", ",", "SwiDebugView", ")", ":", "return", "v", "if", "isinstance", "(", "v", ",", "sublime", ".", "View", ")", ":", "id", "=", "v", ".", "buffer_id", "(", ")", "# Take this opportun...
https://github.com/sokolovstas/SublimeWebInspector/blob/e808d12956f115ea2b37bdf46fbfdb20b4e5ec13/views.py#L215-L230
cylc/cylc-flow
5ec221143476c7c616c156b74158edfbcd83794a
cylc/flow/terminal.py
python
print_contents
(contents, padding=5, char='.', indent=0)
[]
def print_contents(contents, padding=5, char='.', indent=0): title_width = max( len(title) for title, _ in contents ) width = get_width(default=0) if width < title_width + 20 - indent - padding: width = title_width + 20 - indent - padding desc_width = width - title_width - pa...
[ "def", "print_contents", "(", "contents", ",", "padding", "=", "5", ",", "char", "=", "'.'", ",", "indent", "=", "0", ")", ":", "title_width", "=", "max", "(", "len", "(", "title", ")", "for", "title", ",", "_", "in", "contents", ")", "width", "=",...
https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/terminal.py#L68-L86
mila-iqia/myia
56774a39579b4ec4123f44843ad4ca688acc859b
myia/compile/backends/python/python.py
python
python_universe_getitem
(c, universe, handle)
return f"{universe}.get({handle})"
Implement `universe_getitem`.
Implement `universe_getitem`.
[ "Implement", "universe_getitem", "." ]
def python_universe_getitem(c, universe, handle): """Implement `universe_getitem`.""" universe = c.ref(universe) handle = c.ref(handle) return f"{universe}.get({handle})"
[ "def", "python_universe_getitem", "(", "c", ",", "universe", ",", "handle", ")", ":", "universe", "=", "c", ".", "ref", "(", "universe", ")", "handle", "=", "c", ".", "ref", "(", "handle", ")", "return", "f\"{universe}.get({handle})\"" ]
https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/myia/compile/backends/python/python.py#L209-L213
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/investments_holdings_get_response.py
python
InvestmentsHoldingsGetResponse.additional_properties_type
()
return (bool, date, datetime, dict, float, int, list, str, none_type,)
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
[ "This", "must", "be", "a", "method", "because", "a", "model", "may", "have", "properties", "that", "are", "of", "type", "self", "this", "must", "run", "after", "the", "class", "is", "loaded" ]
def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,)
[ "def", "additional_properties_type", "(", ")", ":", "lazy_import", "(", ")", "return", "(", "bool", ",", "date", ",", "datetime", ",", "dict", ",", "float", ",", "int", ",", "list", ",", "str", ",", "none_type", ",", ")" ]
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/investments_holdings_get_response.py#L69-L75
scikit-learn/scikit-learn
1d1aadd0711b87d2a11c80aad15df6f8cf156712
sklearn/tree/_export.py
python
_color_brew
(n)
return color_list
Generate n colors with equally spaced hues. Parameters ---------- n : int The number of colors required. Returns ------- color_list : list, length n List of n tuples of form (R, G, B) being the components of each color.
Generate n colors with equally spaced hues.
[ "Generate", "n", "colors", "with", "equally", "spaced", "hues", "." ]
def _color_brew(n): """Generate n colors with equally spaced hues. Parameters ---------- n : int The number of colors required. Returns ------- color_list : list, length n List of n tuples of form (R, G, B) being the components of each color. """ color_list = [] ...
[ "def", "_color_brew", "(", "n", ")", ":", "color_list", "=", "[", "]", "# Initialize saturation & value; calculate chroma & value shift", "s", ",", "v", "=", "0.75", ",", "0.9", "c", "=", "s", "*", "v", "m", "=", "v", "-", "c", "for", "h", "in", "np", ...
https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/tree/_export.py#L28-L67
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/wsgiref/handlers.py
python
BaseHandler.client_is_modern
(self)
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
True if client can accept status and headers
True if client can accept status and headers
[ "True", "if", "client", "can", "accept", "status", "and", "headers" ]
def client_is_modern(self): """True if client can accept status and headers""" return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
[ "def", "client_is_modern", "(", "self", ")", ":", "return", "self", ".", "environ", "[", "'SERVER_PROTOCOL'", "]", ".", "upper", "(", ")", "!=", "'HTTP/0.9'" ]
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/wsgiref/handlers.py#L280-L282
rushter/MLAlgorithms
3c8e16b8de3baf131395ae57edd479e59566a7c6
mla/neuralnet/initializations.py
python
uniform
(shape, scale=0.5)
return np.random.uniform(size=shape, low=-scale, high=scale)
[]
def uniform(shape, scale=0.5): return np.random.uniform(size=shape, low=-scale, high=scale)
[ "def", "uniform", "(", "shape", ",", "scale", "=", "0.5", ")", ":", "return", "np", ".", "random", ".", "uniform", "(", "size", "=", "shape", ",", "low", "=", "-", "scale", ",", "high", "=", "scale", ")" ]
https://github.com/rushter/MLAlgorithms/blob/3c8e16b8de3baf131395ae57edd479e59566a7c6/mla/neuralnet/initializations.py#L14-L15
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/caldav/datastore/query/filter.py
python
ComponentFilter._match
(self, component, access)
return self.defined
[]
def _match(self, component, access): # At least one subcomponent must match (or is-not-defined is set) for subcomponent in component.subcomponents(): # If access restrictions are in force, restrict matching to specific components only. # In particular do not match VALARM. ...
[ "def", "_match", "(", "self", ",", "component", ",", "access", ")", ":", "# At least one subcomponent must match (or is-not-defined is set)", "for", "subcomponent", "in", "component", ".", "subcomponents", "(", ")", ":", "# If access restrictions are in force, restrict matchi...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/query/filter.py#L332-L351
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/relay/op/strategy/hls.py
python
bitserial_conv2d_strategy_hls
(attrs, inputs, out_type, target)
return strategy
bitserial_conv2d hls strategy
bitserial_conv2d hls strategy
[ "bitserial_conv2d", "hls", "strategy" ]
def bitserial_conv2d_strategy_hls(attrs, inputs, out_type, target): """bitserial_conv2d hls strategy""" strategy = _op.OpStrategy() layout = attrs.data_layout if layout == "NCHW": strategy.add_implementation( wrap_compute_bitserial_conv2d(topi.nn.bitserial_conv2d_nchw), w...
[ "def", "bitserial_conv2d_strategy_hls", "(", "attrs", ",", "inputs", ",", "out_type", ",", "target", ")", ":", "strategy", "=", "_op", ".", "OpStrategy", "(", ")", "layout", "=", "attrs", ".", "data_layout", "if", "layout", "==", "\"NCHW\"", ":", "strategy",...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/op/strategy/hls.py#L178-L196
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/bessel.py
python
struveh
(ctx,n,z, **kwargs)
return ctx.hypercomb(h, [n], **kwargs)
[]
def struveh(ctx,n,z, **kwargs): n = ctx.convert(n) z = ctx.convert(z) # http://functions.wolfram.com/Bessel-TypeFunctions/StruveH/26/01/02/ def h(n): return [([z/2, 0.5*ctx.sqrt(ctx.pi)], [n+1, -1], [], [n+1.5], [1], [1.5, n+1.5], -(z/2)**2)] return ctx.hypercomb(h, [n], **kwargs)
[ "def", "struveh", "(", "ctx", ",", "n", ",", "z", ",", "*", "*", "kwargs", ")", ":", "n", "=", "ctx", ".", "convert", "(", "n", ")", "z", "=", "ctx", ".", "convert", "(", "z", ")", "# http://functions.wolfram.com/Bessel-TypeFunctions/StruveH/26/01/02/", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/bessel.py#L241-L247
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/graphlib.py
python
_NodeInfo.__init__
(self, node)
[]
def __init__(self, node): # The node this class is augmenting. self.node = node # Number of predecessors, generally >= 0. When this value falls to 0, # and is returned by get_ready(), this is set to _NODE_OUT and when the # node is marked done by a call to done(), set to _NODE_D...
[ "def", "__init__", "(", "self", ",", "node", ")", ":", "# The node this class is augmenting.", "self", ".", "node", "=", "node", "# Number of predecessors, generally >= 0. When this value falls to 0,", "# and is returned by get_ready(), this is set to _NODE_OUT and when the", "# node...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/graphlib.py#L10-L21
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/markdown/preprocessors.py
python
HtmlStash.store
(self, html, safe=False)
return placeholder
Saves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document. Keyword arguments: * html: an html segment * safe: label an html segment as safe for safemode Returns : a placeholder string
Saves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document.
[ "Saves", "an", "HTML", "segment", "for", "later", "reinsertion", ".", "Returns", "a", "placeholder", "string", "that", "needs", "to", "be", "inserted", "into", "the", "document", "." ]
def store(self, html, safe=False): """ Saves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document. Keyword arguments: * html: an html segment * safe: label an html segment as safe for safemode ...
[ "def", "store", "(", "self", ",", "html", ",", "safe", "=", "False", ")", ":", "self", ".", "rawHtmlBlocks", ".", "append", "(", "(", "html", ",", "safe", ")", ")", "placeholder", "=", "HTML_PLACEHOLDER", "%", "self", ".", "html_counter", "self", ".", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/markdown/preprocessors.py#L52-L69
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/physics/quantum/qexpr.py
python
__qsympify_sequence_helper
(seq)
return Tuple(*result)
Helper function for _qsympify_sequence This function does the actual work.
Helper function for _qsympify_sequence This function does the actual work.
[ "Helper", "function", "for", "_qsympify_sequence", "This", "function", "does", "the", "actual", "work", "." ]
def __qsympify_sequence_helper(seq): """ Helper function for _qsympify_sequence This function does the actual work. """ #base case. If not a list, do Sympification if not is_sequence(seq): if isinstance(seq, Matrix): return seq elif isinstance(seq, string_types)...
[ "def", "__qsympify_sequence_helper", "(", "seq", ")", ":", "#base case. If not a list, do Sympification", "if", "not", "is_sequence", "(", "seq", ")", ":", "if", "isinstance", "(", "seq", ",", "Matrix", ")", ":", "return", "seq", "elif", "isinstance", "(", "seq"...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/physics/quantum/qexpr.py#L55-L77
Netflix/brutal
13052ddbaf873acd9c9dac54b19a42ab7b70f7a9
brutal/protocols/irc.py
python
IrcBotClient.__init__
(self, channels, nickname, backend=None)
[]
def __init__(self, channels, nickname, backend=None): self.channels = channels self.nickname = nickname self.backend = backend # this might be bad? self.current_conn = None
[ "def", "__init__", "(", "self", ",", "channels", ",", "nickname", ",", "backend", "=", "None", ")", ":", "self", ".", "channels", "=", "channels", "self", ".", "nickname", "=", "nickname", "self", ".", "backend", "=", "backend", "# this might be bad?", "se...
https://github.com/Netflix/brutal/blob/13052ddbaf873acd9c9dac54b19a42ab7b70f7a9/brutal/protocols/irc.py#L416-L422
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/psutil/__init__.py
python
Process.cwd
(self)
return self._proc.cwd()
Process current working directory as an absolute path.
Process current working directory as an absolute path.
[ "Process", "current", "working", "directory", "as", "an", "absolute", "path", "." ]
def cwd(self): """Process current working directory as an absolute path.""" return self._proc.cwd()
[ "def", "cwd", "(", "self", ")", ":", "return", "self", ".", "_proc", ".", "cwd", "(", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/psutil/__init__.py#L726-L728
ganeti/ganeti
d340a9ddd12f501bef57da421b5f9b969a4ba905
lib/ovf.py
python
OVFWriter.SaveDisksData
(self, disks)
Convert disk information to certain OVF sections. @type disks: list @param disks: list of dictionaries of disk options from config.ini
Convert disk information to certain OVF sections.
[ "Convert", "disk", "information", "to", "certain", "OVF", "sections", "." ]
def SaveDisksData(self, disks): """Convert disk information to certain OVF sections. @type disks: list @param disks: list of dictionaries of disk options from config.ini """ references = ET.SubElement(self.tree, "References") disk_section = ET.SubElement(self.tree, "DiskSection") SubElemen...
[ "def", "SaveDisksData", "(", "self", ",", "disks", ")", ":", "references", "=", "ET", ".", "SubElement", "(", "self", ".", "tree", ",", "\"References\"", ")", "disk_section", "=", "ET", ".", "SubElement", "(", "self", ".", "tree", ",", "\"DiskSection\"", ...
https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/ovf.py#L659-L696
sammchardy/python-binance
217f1e2205877f80dbaba6ee92354ce4aca74232
binance/client.py
python
Client.futures_coin_liquidation_orders
(self, **params)
return self._request_futures_coin_api("get", "forceOrders", signed=True, data=params)
Get all liquidation orders https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data
Get all liquidation orders
[ "Get", "all", "liquidation", "orders" ]
def futures_coin_liquidation_orders(self, **params): """Get all liquidation orders https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data """ return self._request_futures_coin_api("get", "forceOrders", signed=True, data=params)
[ "def", "futures_coin_liquidation_orders", "(", "self", ",", "*", "*", "params", ")", ":", "return", "self", ".", "_request_futures_coin_api", "(", "\"get\"", ",", "\"forceOrders\"", ",", "signed", "=", "True", ",", "data", "=", "params", ")" ]
https://github.com/sammchardy/python-binance/blob/217f1e2205877f80dbaba6ee92354ce4aca74232/binance/client.py#L6171-L6177