partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
scramble_native_password
Scramble used for mysql_native_password
pymysql/_auth.py
def scramble_native_password(password, message): """Scramble used for mysql_native_password""" if not password: return b'' stage1 = sha1_new(password).digest() stage2 = sha1_new(stage1).digest() s = sha1_new() s.update(message[:SCRAMBLE_LENGTH]) s.update(stage2) result = s.diges...
def scramble_native_password(password, message): """Scramble used for mysql_native_password""" if not password: return b'' stage1 = sha1_new(password).digest() stage2 = sha1_new(stage1).digest() s = sha1_new() s.update(message[:SCRAMBLE_LENGTH]) s.update(stage2) result = s.diges...
[ "Scramble", "used", "for", "mysql_native_password" ]
PyMySQL/PyMySQL
python
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L34-L45
[ "def", "scramble_native_password", "(", "password", ",", "message", ")", ":", "if", "not", "password", ":", "return", "b''", "stage1", "=", "sha1_new", "(", "password", ")", ".", "digest", "(", ")", "stage2", "=", "sha1_new", "(", "stage1", ")", ".", "di...
3674bc6fd064bf88524e839c07690e8c35223709
train
sha2_rsa_encrypt
Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password.
pymysql/_auth.py
def sha2_rsa_encrypt(password, salt, public_key): """Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password. """ if not _have_cryptography: raise RuntimeError("'cryptography' package is required for sha256_password or caching_sha2_password auth methods") ...
def sha2_rsa_encrypt(password, salt, public_key): """Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password. """ if not _have_cryptography: raise RuntimeError("'cryptography' package is required for sha256_password or caching_sha2_password auth methods") ...
[ "Encrypt", "password", "with", "salt", "and", "public_key", "." ]
PyMySQL/PyMySQL
python
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L136-L152
[ "def", "sha2_rsa_encrypt", "(", "password", ",", "salt", ",", "public_key", ")", ":", "if", "not", "_have_cryptography", ":", "raise", "RuntimeError", "(", "\"'cryptography' package is required for sha256_password or caching_sha2_password auth methods\"", ")", "message", "=",...
3674bc6fd064bf88524e839c07690e8c35223709
train
scramble_caching_sha2
Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce))
pymysql/_auth.py
def scramble_caching_sha2(password, nonce): # (bytes, bytes) -> bytes """Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce)) """ if not password: return b'' p1 = hashlib.sha256(password).digest() p2 = hashlib.sha...
def scramble_caching_sha2(password, nonce): # (bytes, bytes) -> bytes """Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce)) """ if not password: return b'' p1 = hashlib.sha256(password).digest() p2 = hashlib.sha...
[ "Scramble", "algorithm", "used", "in", "cached_sha2_password", "fast", "path", "." ]
PyMySQL/PyMySQL
python
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L186-L205
[ "def", "scramble_caching_sha2", "(", "password", ",", "nonce", ")", ":", "# (bytes, bytes) -> bytes", "if", "not", "password", ":", "return", "b''", "p1", "=", "hashlib", ".", "sha256", "(", "password", ")", ".", "digest", "(", ")", "p2", "=", "hashlib", "...
3674bc6fd064bf88524e839c07690e8c35223709
train
ClosureTable
Model factory for the transitive closure extension.
playhouse/sqlite_ext.py
def ClosureTable(model_class, foreign_key=None, referencing_class=None, referencing_key=None): """Model factory for the transitive closure extension.""" if referencing_class is None: referencing_class = model_class if foreign_key is None: for field_obj in model_class._meta....
def ClosureTable(model_class, foreign_key=None, referencing_class=None, referencing_key=None): """Model factory for the transitive closure extension.""" if referencing_class is None: referencing_class = model_class if foreign_key is None: for field_obj in model_class._meta....
[ "Model", "factory", "for", "the", "transitive", "closure", "extension", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L719-L807
[ "def", "ClosureTable", "(", "model_class", ",", "foreign_key", "=", "None", ",", "referencing_class", "=", "None", ",", "referencing_key", "=", "None", ")", ":", "if", "referencing_class", "is", "None", ":", "referencing_class", "=", "model_class", "if", "foreig...
ea9403b01acb039adb3a2472186d795c796b77a0
train
bm25
Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank
playhouse/sqlite_ext.py
def bm25(raw_match_info, *args): """ Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank """ match_info = _parse_match_info(raw_match_info) ...
def bm25(raw_match_info, *args): """ Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank """ match_info = _parse_match_info(raw_match_info) ...
[ "Usage", ":" ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L1172-L1223
[ "def", "bm25", "(", "raw_match_info", ",", "*", "args", ")", ":", "match_info", "=", "_parse_match_info", "(", "raw_match_info", ")", "K", "=", "1.2", "B", "=", "0.75", "score", "=", "0.0", "P_O", ",", "C_O", ",", "N_O", ",", "A_O", "=", "range", "("...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTSModel.search
Full-text search using selected `term`.
playhouse/sqlite_ext.py
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls._search( term, weights, with_score, score_alias, cls.rank, ...
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls._search( term, weights, with_score, score_alias, cls.rank, ...
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L391-L400
[ "def", "search", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weights", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTSModel.search_bm25
Full-text search for selected `term` using BM25 algorithm.
playhouse/sqlite_ext.py
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L403-L412
[ "def", "search_bm25", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weights...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTSModel.search_bm25f
Full-text search for selected `term` using BM25 algorithm.
playhouse/sqlite_ext.py
def search_bm25f(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
def search_bm25f(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L415-L424
[ "def", "search_bm25f", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weight...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTSModel.search_lucene
Full-text search for selected `term` using BM25 algorithm.
playhouse/sqlite_ext.py
def search_lucene(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
def search_lucene(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L427-L436
[ "def", "search_lucene", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weigh...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTS5Model.validate_query
Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries.
playhouse/sqlite_ext.py
def validate_query(query): """ Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries. """ tokens = _quote_re.findall(query) for ...
def validate_query(query): """ Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries. """ tokens = _quote_re.findall(query) for ...
[ "Simple", "helper", "function", "to", "indicate", "whether", "a", "search", "query", "is", "a", "valid", "FTS5", "query", ".", "Note", ":", "this", "simply", "looks", "at", "the", "characters", "being", "used", "and", "is", "not", "guaranteed", "to", "catc...
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L550-L562
[ "def", "validate_query", "(", "query", ")", ":", "tokens", "=", "_quote_re", ".", "findall", "(", "query", ")", "for", "token", "in", "tokens", ":", "if", "token", ".", "startswith", "(", "'\"'", ")", "and", "token", ".", "endswith", "(", "'\"'", ")", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTS5Model.clean_query
Clean a query of invalid tokens.
playhouse/sqlite_ext.py
def clean_query(query, replace=chr(26)): """ Clean a query of invalid tokens. """ accum = [] any_invalid = False tokens = _quote_re.findall(query) for token in tokens: if token.startswith('"') and token.endswith('"'): accum.append(token...
def clean_query(query, replace=chr(26)): """ Clean a query of invalid tokens. """ accum = [] any_invalid = False tokens = _quote_re.findall(query) for token in tokens: if token.startswith('"') and token.endswith('"'): accum.append(token...
[ "Clean", "a", "query", "of", "invalid", "tokens", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L565-L586
[ "def", "clean_query", "(", "query", ",", "replace", "=", "chr", "(", "26", ")", ")", ":", "accum", "=", "[", "]", "any_invalid", "=", "False", "tokens", "=", "_quote_re", ".", "findall", "(", "query", ")", "for", "token", "in", "tokens", ":", "if", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTS5Model.search
Full-text search using selected `term`.
playhouse/sqlite_ext.py
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls.search_bm25( FTS5Model.clean_query(term), weights, with_score, score_alias, ...
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls.search_bm25( FTS5Model.clean_query(term), weights, with_score, score_alias, ...
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L604-L612
[ "def", "search", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "search_bm25", "(", "FTS5Model", ".", "cle...
ea9403b01acb039adb3a2472186d795c796b77a0
train
FTS5Model.search_bm25
Full-text search using selected `term`.
playhouse/sqlite_ext.py
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" if not weights: rank = SQL('rank') elif isinstance(weights, dict): weight_args = [] for ...
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" if not weights: rank = SQL('rank') elif isinstance(weights, dict): weight_args = [] for ...
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L615-L640
[ "def", "search_bm25", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "if", "not", "weights", ":", "rank", "=", "SQL", "(", "'r...
ea9403b01acb039adb3a2472186d795c796b77a0
train
PooledDatabase.manual_close
Close the underlying connection without returning it to the pool.
playhouse/pool.py
def manual_close(self): """ Close the underlying connection without returning it to the pool. """ if self.is_closed(): return False # Obtain reference to the connection in-use by the calling thread. conn = self.connection() # A connection will only b...
def manual_close(self): """ Close the underlying connection without returning it to the pool. """ if self.is_closed(): return False # Obtain reference to the connection in-use by the calling thread. conn = self.connection() # A connection will only b...
[ "Close", "the", "underlying", "connection", "without", "returning", "it", "to", "the", "pool", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/pool.py#L190-L206
[ "def", "manual_close", "(", "self", ")", ":", "if", "self", ".", "is_closed", "(", ")", ":", "return", "False", "# Obtain reference to the connection in-use by the calling thread.", "conn", "=", "self", ".", "connection", "(", ")", "# A connection will only be re-added ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.top_pages_by_time_period
Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9
examples/analytics/reports.py
def top_pages_by_time_period(self, interval='day'): """ Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9 """ date_trunc = fn.date_trunc(interval, PageView.timesta...
def top_pages_by_time_period(self, interval='day'): """ Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9 """ date_trunc = fn.date_trunc(interval, PageView.timesta...
[ "Get", "a", "breakdown", "of", "top", "pages", "per", "interval", "i", ".", "e", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L19-L38
[ "def", "top_pages_by_time_period", "(", "self", ",", "interval", "=", "'day'", ")", ":", "date_trunc", "=", "fn", ".", "date_trunc", "(", "interval", ",", "PageView", ".", "timestamp", ")", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.cookies
Retrieve the cookies header from all the users who visited.
examples/analytics/reports.py
def cookies(self): """ Retrieve the cookies header from all the users who visited. """ return (self.get_query() .select(PageView.ip, PageView.headers['Cookie']) .where(PageView.headers['Cookie'].is_null(False)) .tuples())
def cookies(self): """ Retrieve the cookies header from all the users who visited. """ return (self.get_query() .select(PageView.ip, PageView.headers['Cookie']) .where(PageView.headers['Cookie'].is_null(False)) .tuples())
[ "Retrieve", "the", "cookies", "header", "from", "all", "the", "users", "who", "visited", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L40-L47
[ "def", "cookies", "(", "self", ")", ":", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "ip", ",", "PageView", ".", "headers", "[", "'Cookie'", "]", ")", ".", "where", "(", "PageView", ".", "headers", "[", "...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.user_agents
Retrieve user-agents, sorted by most common to least common.
examples/analytics/reports.py
def user_agents(self): """ Retrieve user-agents, sorted by most common to least common. """ return (self.get_query() .select( PageView.headers['User-Agent'], fn.Count(PageView.id)) .group_by(PageView.headers['User-Ag...
def user_agents(self): """ Retrieve user-agents, sorted by most common to least common. """ return (self.get_query() .select( PageView.headers['User-Agent'], fn.Count(PageView.id)) .group_by(PageView.headers['User-Ag...
[ "Retrieve", "user", "-", "agents", "sorted", "by", "most", "common", "to", "least", "common", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L49-L59
[ "def", "user_agents", "(", "self", ")", ":", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "headers", "[", "'User-Agent'", "]", ",", "fn", ".", "Count", "(", "PageView", ".", "id", ")", ")", ".", "group_by", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.languages
Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon.
examples/analytics/reports.py
def languages(self): """ Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon. """ language = PageView.headers['Accept-Language'...
def languages(self): """ Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon. """ language = PageView.headers['Accept-Language'...
[ "Retrieve", "languages", "sorted", "by", "most", "common", "to", "least", "common", ".", "The", "Accept", "-", "Languages", "header", "sometimes", "looks", "weird", "i", ".", "e", ".", "en", "-", "US", "en", ";", "q", "=", "0", ".", "8", "is", ";", ...
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L61-L77
[ "def", "languages", "(", "self", ")", ":", "language", "=", "PageView", ".", "headers", "[", "'Accept-Language'", "]", "first_language", "=", "fn", ".", "SubStr", "(", "language", ",", "# String to slice.", "1", ",", "# Left index.", "fn", ".", "StrPos", "("...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.trail
Get all visitors by IP and then list the pages they visited in order.
examples/analytics/reports.py
def trail(self): """ Get all visitors by IP and then list the pages they visited in order. """ inner = (self.get_query() .select(PageView.ip, PageView.url) .order_by(PageView.timestamp)) return (PageView .select( ...
def trail(self): """ Get all visitors by IP and then list the pages they visited in order. """ inner = (self.get_query() .select(PageView.ip, PageView.url) .order_by(PageView.timestamp)) return (PageView .select( ...
[ "Get", "all", "visitors", "by", "IP", "and", "then", "list", "the", "pages", "they", "visited", "in", "order", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L79-L91
[ "def", "trail", "(", "self", ")", ":", "inner", "=", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "ip", ",", "PageView", ".", "url", ")", ".", "order_by", "(", "PageView", ".", "timestamp", ")", ")", "return", "(", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Report.top_referrers
What domains send us the most traffic?
examples/analytics/reports.py
def top_referrers(self, domain_only=True): """ What domains send us the most traffic? """ referrer = self._referrer_clause(domain_only) return (self.get_query() .select(referrer, fn.Count(PageView.id)) .group_by(referrer) .order_by(...
def top_referrers(self, domain_only=True): """ What domains send us the most traffic? """ referrer = self._referrer_clause(domain_only) return (self.get_query() .select(referrer, fn.Count(PageView.id)) .group_by(referrer) .order_by(...
[ "What", "domains", "send", "us", "the", "most", "traffic?" ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L99-L108
[ "def", "top_referrers", "(", "self", ",", "domain_only", "=", "True", ")", ":", "referrer", "=", "self", ".", "_referrer_clause", "(", "domain_only", ")", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "referrer", ",", "fn", ".", ...
ea9403b01acb039adb3a2472186d795c796b77a0
train
add_entry
Add entry
examples/diary.py
def add_entry(): """Add entry""" print('Enter your entry. Press ctrl+d when finished.') data = sys.stdin.read().strip() if data and raw_input('Save entry? [Yn] ') != 'n': Entry.create(content=data) print('Saved successfully.')
def add_entry(): """Add entry""" print('Enter your entry. Press ctrl+d when finished.') data = sys.stdin.read().strip() if data and raw_input('Save entry? [Yn] ') != 'n': Entry.create(content=data) print('Saved successfully.')
[ "Add", "entry" ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/diary.py#L35-L41
[ "def", "add_entry", "(", ")", ":", "print", "(", "'Enter your entry. Press ctrl+d when finished.'", ")", "data", "=", "sys", ".", "stdin", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "data", "and", "raw_input", "(", "'Save entry? [Yn] '", ")", "!=",...
ea9403b01acb039adb3a2472186d795c796b77a0
train
view_entries
View previous entries
examples/diary.py
def view_entries(search_query=None): """View previous entries""" query = Entry.select().order_by(Entry.timestamp.desc()) if search_query: query = query.where(Entry.content.contains(search_query)) for entry in query: timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p') pr...
def view_entries(search_query=None): """View previous entries""" query = Entry.select().order_by(Entry.timestamp.desc()) if search_query: query = query.where(Entry.content.contains(search_query)) for entry in query: timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p') pr...
[ "View", "previous", "entries" ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/diary.py#L43-L62
[ "def", "view_entries", "(", "search_query", "=", "None", ")", ":", "query", "=", "Entry", ".", "select", "(", ")", ".", "order_by", "(", "Entry", ".", "timestamp", ".", "desc", "(", ")", ")", "if", "search_query", ":", "query", "=", "query", ".", "wh...
ea9403b01acb039adb3a2472186d795c796b77a0
train
Entry.html_content
Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images.
examples/blog/app.py
def html_content(self): """ Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images. """ hilite = CodeHiliteExtension(linenums=False, css_class='highlight') extras =...
def html_content(self): """ Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images. """ hilite = CodeHiliteExtension(linenums=False, css_class='highlight') extras =...
[ "Generate", "HTML", "representation", "of", "the", "markdown", "-", "formatted", "blog", "entry", "and", "also", "convert", "any", "media", "URLs", "into", "rich", "media", "objects", "such", "as", "video", "players", "or", "images", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/blog/app.py#L66-L80
[ "def", "html_content", "(", "self", ")", ":", "hilite", "=", "CodeHiliteExtension", "(", "linenums", "=", "False", ",", "css_class", "=", "'highlight'", ")", "extras", "=", "ExtraExtension", "(", ")", "markdown_content", "=", "markdown", "(", "self", ".", "c...
ea9403b01acb039adb3a2472186d795c796b77a0
train
model_to_dict
Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether foreign-keys should be recursed. :param bool backrefs: Whether lists of related objects should be recursed. :param only: A list (or set) of field instances indicating which fields should be included. ...
playhouse/shortcuts.py
def model_to_dict(model, recurse=True, backrefs=False, only=None, exclude=None, seen=None, extra_attrs=None, fields_from_query=None, max_depth=None, manytomany=False): """ Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether fo...
def model_to_dict(model, recurse=True, backrefs=False, only=None, exclude=None, seen=None, extra_attrs=None, fields_from_query=None, max_depth=None, manytomany=False): """ Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether fo...
[ "Convert", "a", "model", "instance", "(", "and", "any", "related", "objects", ")", "to", "a", "dictionary", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/shortcuts.py#L10-L124
[ "def", "model_to_dict", "(", "model", ",", "recurse", "=", "True", ",", "backrefs", "=", "False", ",", "only", "=", "None", ",", "exclude", "=", "None", ",", "seen", "=", "None", ",", "extra_attrs", "=", "None", ",", "fields_from_query", "=", "None", "...
ea9403b01acb039adb3a2472186d795c796b77a0
train
ColumnBase._e
Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`.
peewee.py
def _e(op, inv=False): """ Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`. """ def inner(self, rhs): if inv: return Expression(rhs, op, self) return Expre...
def _e(op, inv=False): """ Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`. """ def inner(self, rhs): if inv: return Expression(rhs, op, self) return Expre...
[ "Lightweight", "factory", "which", "returns", "a", "method", "that", "builds", "an", "Expression", "consisting", "of", "the", "left", "-", "hand", "and", "right", "-", "hand", "operands", "using", "op", "." ]
coleifer/peewee
python
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/peewee.py#L1091-L1100
[ "def", "_e", "(", "op", ",", "inv", "=", "False", ")", ":", "def", "inner", "(", "self", ",", "rhs", ")", ":", "if", "inv", ":", "return", "Expression", "(", "rhs", ",", "op", ",", "self", ")", "return", "Expression", "(", "self", ",", "op", ",...
ea9403b01acb039adb3a2472186d795c796b77a0
train
ForeignExchange.get_currency_exchange_intraday
Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would like to get the exchange rate for. For example: from_currency=EUR or from_currency=USD. ...
alpha_vantage/foreignexchange.py
def get_currency_exchange_intraday(self, from_symbol, to_symbol, interval='15min', outputsize='compact'): """ Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would lik...
def get_currency_exchange_intraday(self, from_symbol, to_symbol, interval='15min', outputsize='compact'): """ Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would lik...
[ "Returns", "the", "intraday", "exchange", "rate", "for", "any", "pair", "of", "physical", "currency", "(", "e", ".", "g", ".", "EUR", ")", "or", "physical", "currency", "(", "e", ".", "g", ".", "USD", ")", "." ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/foreignexchange.py#L37-L56
[ "def", "get_currency_exchange_intraday", "(", "self", ",", "from_symbol", ",", "to_symbol", ",", "interval", "=", "'15min'", ",", "outputsize", "=", "'compact'", ")", ":", "_FUNCTION_KEY", "=", "'FX_INTRADAY'", "return", "_FUNCTION_KEY", ",", "\"Time Series FX ({})\""...
4e0b5057e520e3e3de69cf947301765817290121
train
AlphaVantage._call_api_on_func
Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated
alpha_vantage/alphavantage.py
def _call_api_on_func(cls, func): """ Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated """ ...
def _call_api_on_func(cls, func): """ Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated """ ...
[ "Decorator", "for", "forming", "the", "api", "call", "with", "the", "arguments", "of", "the", "function", "it", "works", "by", "taking", "the", "arguments", "given", "to", "the", "function", "and", "building", "the", "url", "to", "call", "the", "api", "on"...
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L65-L147
[ "def", "_call_api_on_func", "(", "cls", ",", "func", ")", ":", "# Argument Handling", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "# Deprecated since version 3.0", "argspec", "=", "inspect", ".", "getargspec", "(", "func", ")", "else", ":...
4e0b5057e520e3e3de69cf947301765817290121
train
AlphaVantage._output_format
Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None
alpha_vantage/alphavantage.py
def _output_format(cls, func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None """ ...
def _output_format(cls, func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None """ ...
[ "Decorator", "in", "charge", "of", "giving", "the", "output", "its", "right", "format", "either", "json", "or", "pandas" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L150-L203
[ "def", "_output_format", "(", "cls", ",", "func", ",", "override", "=", "None", ")", ":", "@", "wraps", "(", "func", ")", "def", "_format_wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "call_response", ",", "data_key", ",...
4e0b5057e520e3e3de69cf947301765817290121
train
AlphaVantage.map_to_matype
Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: matype: The math type of the alpha vantage a...
alpha_vantage/alphavantage.py
def map_to_matype(self, matype): """ Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: ...
def map_to_matype(self, matype): """ Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: ...
[ "Convert", "to", "the", "alpha", "vantage", "math", "type", "integer", ".", "It", "returns", "an", "integer", "correspondent", "to", "the", "type", "of", "math", "to", "apply", "to", "a", "function", ".", "It", "raises", "ValueError", "if", "an", "integer"...
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L214-L241
[ "def", "map_to_matype", "(", "self", ",", "matype", ")", ":", "# Check if it is an integer or a string", "try", ":", "value", "=", "int", "(", "matype", ")", "if", "abs", "(", "value", ")", ">", "len", "(", "AlphaVantage", ".", "_ALPHA_VANTAGE_MATH_MAP", ")", ...
4e0b5057e520e3e3de69cf947301765817290121
train
AlphaVantage._handle_api_call
Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object meta_data_key: The key for getting the meta da...
alpha_vantage/alphavantage.py
def _handle_api_call(self, url): """ Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object me...
def _handle_api_call(self, url): """ Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object me...
[ "Handle", "the", "return", "call", "from", "the", "api", "and", "return", "a", "data", "and", "meta_data", "object", ".", "It", "raises", "a", "ValueError", "on", "problems" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L243-L269
[ "def", "_handle_api_call", "(", "self", ",", "url", ")", ":", "response", "=", "requests", ".", "get", "(", "url", ",", "proxies", "=", "self", ".", "proxy", ")", "if", "'json'", "in", "self", ".", "output_format", ".", "lower", "(", ")", "or", "'pan...
4e0b5057e520e3e3de69cf947301765817290121
train
SectorPerformances._output_format_sector
Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None Returns: A...
alpha_vantage/sectorperformance.py
def _output_format_sector(func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal for...
def _output_format_sector(func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal for...
[ "Decorator", "in", "charge", "of", "giving", "the", "output", "its", "right", "format", "either", "json", "or", "pandas", "(", "replacing", "the", "%", "for", "usable", "floats", "range", "0", "-", "1", ".", "0", ")" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/sectorperformance.py#L33-L74
[ "def", "_output_format_sector", "(", "func", ",", "override", "=", "None", ")", ":", "@", "wraps", "(", "func", ")", "def", "_format_wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "json_response", ",", "data_key", ",", "met...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_macd
Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive ...
alpha_vantage/techindicators.py
def get_macd(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None): """ Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise K...
def get_macd(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None): """ Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise K...
[ "Return", "the", "moving", "average", "convergence", "/", "divergence", "time", "series", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L186-L204
[ "def", "get_macd", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "series_type", "=", "'close'", ",", "fastperiod", "=", "None", ",", "slowperiod", "=", "None", ",", "signalperiod", "=", "None", ")", ":", "_FUNCTION_KEY", "=", "\"MACD\""...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_macdext
Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive ...
alpha_vantage/techindicators.py
def get_macdext(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None, fastmatype=None, slowmatype=None, signalmatype=None): """ Return the moving average convergence/divergence time series in two json objects as ...
def get_macdext(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None, fastmatype=None, slowmatype=None, signalmatype=None): """ Return the moving average convergence/divergence time series in two json objects as ...
[ "Return", "the", "moving", "average", "convergence", "/", "divergence", "time", "series", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L208-L249
[ "def", "get_macdext", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "series_type", "=", "'close'", ",", "fastperiod", "=", "None", ",", "slowperiod", "=", "None", ",", "signalperiod", "=", "None", ",", "fastmatype", "=", "None", ",", ...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_stoch
Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive values, ...
alpha_vantage/techindicators.py
def get_stoch(self, symbol, interval='daily', fastkperiod=None, slowkperiod=None, slowdperiod=None, slowkmatype=None, slowdmatype=None): """ Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keywo...
def get_stoch(self, symbol, interval='daily', fastkperiod=None, slowkperiod=None, slowdperiod=None, slowkmatype=None, slowdmatype=None): """ Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keywo...
[ "Return", "the", "stochatic", "oscillator", "values", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L253-L290
[ "def", "get_stoch", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "fastkperiod", "=", "None", ",", "slowkperiod", "=", "None", ",", "slowdperiod", "=", "None", ",", "slowkmatype", "=", "None", ",", "slowdmatype", "=", "None", ")", ":"...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_stochrsi
Return the stochatic relative strength index in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive values, ...
alpha_vantage/techindicators.py
def get_stochrsi(self, symbol, interval='daily', time_period=20, series_type='close', fastkperiod=None, fastdperiod=None, fastdmatype=None): """ Return the stochatic relative strength index in two json objects as data and meta_data. It raises ValueError when problems arise ...
def get_stochrsi(self, symbol, interval='daily', time_period=20, series_type='close', fastkperiod=None, fastdperiod=None, fastdmatype=None): """ Return the stochatic relative strength index in two json objects as data and meta_data. It raises ValueError when problems arise ...
[ "Return", "the", "stochatic", "relative", "strength", "index", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L347-L381
[ "def", "get_stochrsi", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "time_period", "=", "20", ",", "series_type", "=", "'close'", ",", "fastkperiod", "=", "None", ",", "fastdperiod", "=", "None", ",", "fastdmatype", "=", "None", ")", ...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_apo
Return the absolute price oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive values, ...
alpha_vantage/techindicators.py
def get_apo(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, matype=None): """ Return the absolute price oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: ...
def get_apo(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, matype=None): """ Return the absolute price oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: ...
[ "Return", "the", "absolute", "price", "oscillator", "values", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L433-L463
[ "def", "get_apo", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "series_type", "=", "'close'", ",", "fastperiod", "=", "None", ",", "slowperiod", "=", "None", ",", "matype", "=", "None", ")", ":", "_FUNCTION_KEY", "=", "\"APO\"", "ret...
4e0b5057e520e3e3de69cf947301765817290121
train
TechIndicators.get_bbands
Return the bollinger bands values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive values, sup...
alpha_vantage/techindicators.py
def get_bbands(self, symbol, interval='daily', time_period=20, series_type='close', nbdevup=None, nbdevdn=None, matype=None): """ Return the bollinger bands values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: ...
def get_bbands(self, symbol, interval='daily', time_period=20, series_type='close', nbdevup=None, nbdevdn=None, matype=None): """ Return the bollinger bands values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: ...
[ "Return", "the", "bollinger", "bands", "values", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
RomelTorres/alpha_vantage
python
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L780-L812
[ "def", "get_bbands", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "time_period", "=", "20", ",", "series_type", "=", "'close'", ",", "nbdevup", "=", "None", ",", "nbdevdn", "=", "None", ",", "matype", "=", "None", ")", ":", "_FUNCT...
4e0b5057e520e3e3de69cf947301765817290121
train
unpack
Return a three tuple of data, code, and headers
flask_restful/utils/__init__.py
def unpack(value): """Return a three tuple of data, code, and headers""" if not isinstance(value, tuple): return value, 200, {} try: data, code, headers = value return data, code, headers except ValueError: pass try: data, code = value return data, c...
def unpack(value): """Return a three tuple of data, code, and headers""" if not isinstance(value, tuple): return value, 200, {} try: data, code, headers = value return data, code, headers except ValueError: pass try: data, code = value return data, c...
[ "Return", "a", "three", "tuple", "of", "data", "code", "and", "headers" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/utils/__init__.py#L18-L35
[ "def", "unpack", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "tuple", ")", ":", "return", "value", ",", "200", ",", "{", "}", "try", ":", "data", ",", "code", ",", "headers", "=", "value", "return", "data", ",", "code", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
output_xml
Makes a Flask response with a XML encoded body
examples/xml_representation.py
def output_xml(data, code, headers=None): """Makes a Flask response with a XML encoded body""" resp = make_response(dumps({'response' :data}), code) resp.headers.extend(headers or {}) return resp
def output_xml(data, code, headers=None): """Makes a Flask response with a XML encoded body""" resp = make_response(dumps({'response' :data}), code) resp.headers.extend(headers or {}) return resp
[ "Makes", "a", "Flask", "response", "with", "a", "XML", "encoded", "body" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/examples/xml_representation.py#L6-L10
[ "def", "output_xml", "(", "data", ",", "code", ",", "headers", "=", "None", ")", ":", "resp", "=", "make_response", "(", "dumps", "(", "{", "'response'", ":", "data", "}", ")", ",", "code", ")", "resp", ".", "headers", ".", "extend", "(", "headers", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
output_json
Makes a Flask response with a JSON encoded body
flask_restful/representations/json.py
def output_json(data, code, headers=None): """Makes a Flask response with a JSON encoded body""" settings = current_app.config.get('RESTFUL_JSON', {}) # If we're in debug mode, and the indent is not set, we set it to a # reasonable value here. Note that this won't override any existing value # th...
def output_json(data, code, headers=None): """Makes a Flask response with a JSON encoded body""" settings = current_app.config.get('RESTFUL_JSON', {}) # If we're in debug mode, and the indent is not set, we set it to a # reasonable value here. Note that this won't override any existing value # th...
[ "Makes", "a", "Flask", "response", "with", "a", "JSON", "encoded", "body" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/representations/json.py#L7-L25
[ "def", "output_json", "(", "data", ",", "code", ",", "headers", "=", "None", ")", ":", "settings", "=", "current_app", ".", "config", ".", "get", "(", "'RESTFUL_JSON'", ",", "{", "}", ")", "# If we're in debug mode, and the indent is not set, we set it to a", "# r...
25544d697c1f82bafbd1320960df459f58a58e03
train
abort
Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing.
flask_restful/__init__.py
def abort(http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. """ #noinspection PyUnresolvedReferences try: original_flask_abort(http_status_code) except HTTPException as e: if l...
def abort(http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. """ #noinspection PyUnresolvedReferences try: original_flask_abort(http_status_code) except HTTPException as e: if l...
[ "Raise", "a", "HTTPException", "for", "the", "given", "http_status_code", ".", "Attach", "any", "keyword", "arguments", "to", "the", "exception", "for", "later", "processing", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L23-L33
[ "def", "abort", "(", "http_status_code", ",", "*", "*", "kwargs", ")", ":", "#noinspection PyUnresolvedReferences", "try", ":", "original_flask_abort", "(", "http_status_code", ")", "except", "HTTPException", "as", "e", ":", "if", "len", "(", "kwargs", ")", ":",...
25544d697c1f82bafbd1320960df459f58a58e03
train
marshal
Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose keys will make up the final serialized response output ...
flask_restful/__init__.py
def marshal(data, fields, envelope=None): """Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose keys will make up the final ...
def marshal(data, fields, envelope=None): """Takes raw data (in the form of a dict, list, object) and a dict of fields to output and filters the data based on those fields. :param data: the actual object(s) from which the fields are taken from :param fields: a dict of whose keys will make up the final ...
[ "Takes", "raw", "data", "(", "in", "the", "form", "of", "a", "dict", "list", "object", ")", "and", "a", "dict", "of", "fields", "to", "output", "and", "filters", "the", "data", "based", "on", "those", "fields", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L591-L626
[ "def", "marshal", "(", "data", ",", "fields", ",", "envelope", "=", "None", ")", ":", "def", "make", "(", "cls", ")", ":", "if", "isinstance", "(", "cls", ",", "type", ")", ":", "return", "cls", "(", ")", "return", "cls", "if", "isinstance", "(", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.init_app
Initialize this class with the given :class:`flask.Flask` application or :class:`flask.Blueprint` object. :param app: the Flask application or blueprint object :type app: flask.Flask :type app: flask.Blueprint Examples:: api = Api() api.add_resource(......
flask_restful/__init__.py
def init_app(self, app): """Initialize this class with the given :class:`flask.Flask` application or :class:`flask.Blueprint` object. :param app: the Flask application or blueprint object :type app: flask.Flask :type app: flask.Blueprint Examples:: api = Ap...
def init_app(self, app): """Initialize this class with the given :class:`flask.Flask` application or :class:`flask.Blueprint` object. :param app: the Flask application or blueprint object :type app: flask.Flask :type app: flask.Blueprint Examples:: api = Ap...
[ "Initialize", "this", "class", "with", "the", "given", ":", "class", ":", "flask", ".", "Flask", "application", "or", ":", "class", ":", "flask", ".", "Blueprint", "object", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L96-L118
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "# If app is a blueprint, defer the initialization", "try", ":", "app", ".", "record", "(", "self", ".", "_deferred_blueprint_init", ")", "# Flask.Blueprint has a 'record' attribute, Flask.Api does not", "except", "Attri...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api._complete_url
This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is registered with :param registration_prefix: The part of the url contributed by the blueprint. Generally speaking...
flask_restful/__init__.py
def _complete_url(self, url_part, registration_prefix): """This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is registered with :param registration_prefix: The part of th...
def _complete_url(self, url_part, registration_prefix): """This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is registered with :param registration_prefix: The part of th...
[ "This", "method", "is", "used", "to", "defer", "the", "construction", "of", "the", "final", "url", "in", "the", "case", "that", "the", "Api", "is", "created", "with", "a", "Blueprint", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L120-L133
[ "def", "_complete_url", "(", "self", ",", "url_part", ",", "registration_prefix", ")", ":", "parts", "=", "{", "'b'", ":", "registration_prefix", ",", "'a'", ":", "self", ".", "prefix", ",", "'e'", ":", "url_part", "}", "return", "''", ".", "join", "(", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api._init_app
Perform initialization actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: flask.Flask
flask_restful/__init__.py
def _init_app(self, app): """Perform initialization actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: flask.Flask """ app.handle_exception = partial(self.error_router, app.handle_exception) app.handle_user_exc...
def _init_app(self, app): """Perform initialization actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: flask.Flask """ app.handle_exception = partial(self.error_router, app.handle_exception) app.handle_user_exc...
[ "Perform", "initialization", "actions", "with", "the", "given", ":", "class", ":", "flask", ".", "Flask", "object", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L186-L198
[ "def", "_init_app", "(", "self", ",", "app", ")", ":", "app", ".", "handle_exception", "=", "partial", "(", "self", ".", "error_router", ",", "app", ".", "handle_exception", ")", "app", ".", "handle_user_exception", "=", "partial", "(", "self", ".", "error...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.owns_endpoint
Tests if an endpoint name (not path) belongs to this Api. Takes in to account the Blueprint name part of the endpoint name. :param endpoint: The name of the endpoint being checked :return: bool
flask_restful/__init__.py
def owns_endpoint(self, endpoint): """Tests if an endpoint name (not path) belongs to this Api. Takes in to account the Blueprint name part of the endpoint name. :param endpoint: The name of the endpoint being checked :return: bool """ if self.blueprint: if...
def owns_endpoint(self, endpoint): """Tests if an endpoint name (not path) belongs to this Api. Takes in to account the Blueprint name part of the endpoint name. :param endpoint: The name of the endpoint being checked :return: bool """ if self.blueprint: if...
[ "Tests", "if", "an", "endpoint", "name", "(", "not", "path", ")", "belongs", "to", "this", "Api", ".", "Takes", "in", "to", "account", "the", "Blueprint", "name", "part", "of", "the", "endpoint", "name", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L200-L213
[ "def", "owns_endpoint", "(", "self", ",", "endpoint", ")", ":", "if", "self", ".", "blueprint", ":", "if", "endpoint", ".", "startswith", "(", "self", ".", "blueprint", ".", "name", ")", ":", "endpoint", "=", "endpoint", ".", "split", "(", "self", ".",...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api._should_use_fr_error_handler
Determine if error should be handled with FR or default Flask The goal is to return Flask error handlers for non-FR-related routes, and FR errors (with the correct media type) for FR endpoints. This method currently handles 404 and 405 errors. :return: bool
flask_restful/__init__.py
def _should_use_fr_error_handler(self): """ Determine if error should be handled with FR or default Flask The goal is to return Flask error handlers for non-FR-related routes, and FR errors (with the correct media type) for FR endpoints. This method currently handles 404 and 405 errors....
def _should_use_fr_error_handler(self): """ Determine if error should be handled with FR or default Flask The goal is to return Flask error handlers for non-FR-related routes, and FR errors (with the correct media type) for FR endpoints. This method currently handles 404 and 405 errors....
[ "Determine", "if", "error", "should", "be", "handled", "with", "FR", "or", "default", "Flask" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L215-L237
[ "def", "_should_use_fr_error_handler", "(", "self", ")", ":", "adapter", "=", "current_app", ".", "create_url_adapter", "(", "request", ")", "try", ":", "adapter", ".", "match", "(", ")", "except", "MethodNotAllowed", "as", "e", ":", "# Check if the other HTTP met...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api._has_fr_route
Encapsulating the rules for whether the request was to a Flask endpoint
flask_restful/__init__.py
def _has_fr_route(self): """Encapsulating the rules for whether the request was to a Flask endpoint""" # 404's, 405's, which might not have a url_rule if self._should_use_fr_error_handler(): return True # for all other errors, just check if FR dispatched the route if ...
def _has_fr_route(self): """Encapsulating the rules for whether the request was to a Flask endpoint""" # 404's, 405's, which might not have a url_rule if self._should_use_fr_error_handler(): return True # for all other errors, just check if FR dispatched the route if ...
[ "Encapsulating", "the", "rules", "for", "whether", "the", "request", "was", "to", "a", "Flask", "endpoint" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L239-L247
[ "def", "_has_fr_route", "(", "self", ")", ":", "# 404's, 405's, which might not have a url_rule", "if", "self", ".", "_should_use_fr_error_handler", "(", ")", ":", "return", "True", "# for all other errors, just check if FR dispatched the route", "if", "not", "request", ".", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.error_router
This function decides whether the error occured in a flask-restful endpoint or not. If it happened in a flask-restful endpoint, our handler will be dispatched. If it happened in an unrelated view, the app's original error handler will be dispatched. In the event that the error occurred i...
flask_restful/__init__.py
def error_router(self, original_handler, e): """This function decides whether the error occured in a flask-restful endpoint or not. If it happened in a flask-restful endpoint, our handler will be dispatched. If it happened in an unrelated view, the app's original error handler will be di...
def error_router(self, original_handler, e): """This function decides whether the error occured in a flask-restful endpoint or not. If it happened in a flask-restful endpoint, our handler will be dispatched. If it happened in an unrelated view, the app's original error handler will be di...
[ "This", "function", "decides", "whether", "the", "error", "occured", "in", "a", "flask", "-", "restful", "endpoint", "or", "not", ".", "If", "it", "happened", "in", "a", "flask", "-", "restful", "endpoint", "our", "handler", "will", "be", "dispatched", "."...
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L249-L269
[ "def", "error_router", "(", "self", ",", "original_handler", ",", "e", ")", ":", "if", "self", ".", "_has_fr_route", "(", ")", ":", "try", ":", "return", "self", ".", "handle_error", "(", "e", ")", "except", "Exception", ":", "pass", "# Fall through to ori...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.handle_error
Error handler for the API transforms a raised exception into a Flask response, with the appropriate HTTP status code and body. :param e: the raised Exception object :type e: Exception
flask_restful/__init__.py
def handle_error(self, e): """Error handler for the API transforms a raised exception into a Flask response, with the appropriate HTTP status code and body. :param e: the raised Exception object :type e: Exception """ got_request_exception.send(current_app._get_current_...
def handle_error(self, e): """Error handler for the API transforms a raised exception into a Flask response, with the appropriate HTTP status code and body. :param e: the raised Exception object :type e: Exception """ got_request_exception.send(current_app._get_current_...
[ "Error", "handler", "for", "the", "API", "transforms", "a", "raised", "exception", "into", "a", "Flask", "response", "with", "the", "appropriate", "HTTP", "status", "code", "and", "body", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L271-L341
[ "def", "handle_error", "(", "self", ",", "e", ")", ":", "got_request_exception", ".", "send", "(", "current_app", ".", "_get_current_object", "(", ")", ",", "exception", "=", "e", ")", "if", "not", "isinstance", "(", "e", ",", "HTTPException", ")", "and", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.add_resource
Adds a resource to the api. :param resource: the class name of your resource :type resource: :class:`Type[Resource]` :param urls: one or more url routes to match for the resource, standard flask routing rules apply. Any url variables will be passed to...
flask_restful/__init__.py
def add_resource(self, resource, *urls, **kwargs): """Adds a resource to the api. :param resource: the class name of your resource :type resource: :class:`Type[Resource]` :param urls: one or more url routes to match for the resource, standard flask routing rules ap...
def add_resource(self, resource, *urls, **kwargs): """Adds a resource to the api. :param resource: the class name of your resource :type resource: :class:`Type[Resource]` :param urls: one or more url routes to match for the resource, standard flask routing rules ap...
[ "Adds", "a", "resource", "to", "the", "api", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L348-L384
[ "def", "add_resource", "(", "self", ",", "resource", ",", "*", "urls", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "app", "is", "not", "None", ":", "self", ".", "_register_view", "(", "self", ".", "app", ",", "resource", ",", "*", "urls",...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.resource
Wraps a :class:`~flask_restful.Resource` class, adding it to the api. Parameters are the same as :meth:`~flask_restful.Api.add_resource`. Example:: app = Flask(__name__) api = restful.Api(app) @api.resource('/foo') class Foo(Resource): d...
flask_restful/__init__.py
def resource(self, *urls, **kwargs): """Wraps a :class:`~flask_restful.Resource` class, adding it to the api. Parameters are the same as :meth:`~flask_restful.Api.add_resource`. Example:: app = Flask(__name__) api = restful.Api(app) @api.resource('/foo') ...
def resource(self, *urls, **kwargs): """Wraps a :class:`~flask_restful.Resource` class, adding it to the api. Parameters are the same as :meth:`~flask_restful.Api.add_resource`. Example:: app = Flask(__name__) api = restful.Api(app) @api.resource('/foo') ...
[ "Wraps", "a", ":", "class", ":", "~flask_restful", ".", "Resource", "class", "adding", "it", "to", "the", "api", ".", "Parameters", "are", "the", "same", "as", ":", "meth", ":", "~flask_restful", ".", "Api", ".", "add_resource", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L386-L404
[ "def", "resource", "(", "self", ",", "*", "urls", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "cls", ")", ":", "self", ".", "add_resource", "(", "cls", ",", "*", "urls", ",", "*", "*", "kwargs", ")", "return", "cls", "return", "de...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.output
Wraps a resource (as a flask view function), for cases where the resource does not directly return a response object :param resource: The resource as a flask view function
flask_restful/__init__.py
def output(self, resource): """Wraps a resource (as a flask view function), for cases where the resource does not directly return a response object :param resource: The resource as a flask view function """ @wraps(resource) def wrapper(*args, **kwargs): resp ...
def output(self, resource): """Wraps a resource (as a flask view function), for cases where the resource does not directly return a response object :param resource: The resource as a flask view function """ @wraps(resource) def wrapper(*args, **kwargs): resp ...
[ "Wraps", "a", "resource", "(", "as", "a", "flask", "view", "function", ")", "for", "cases", "where", "the", "resource", "does", "not", "directly", "return", "a", "response", "object" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L450-L463
[ "def", "output", "(", "self", ",", "resource", ")", ":", "@", "wraps", "(", "resource", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "resp", "=", "resource", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.url_for
Generates a URL to the given resource. Works like :func:`flask.url_for`.
flask_restful/__init__.py
def url_for(self, resource, **values): """Generates a URL to the given resource. Works like :func:`flask.url_for`.""" endpoint = resource.endpoint if self.blueprint: endpoint = '{0}.{1}'.format(self.blueprint.name, endpoint) return url_for(endpoint, **values)
def url_for(self, resource, **values): """Generates a URL to the given resource. Works like :func:`flask.url_for`.""" endpoint = resource.endpoint if self.blueprint: endpoint = '{0}.{1}'.format(self.blueprint.name, endpoint) return url_for(endpoint, **values)
[ "Generates", "a", "URL", "to", "the", "given", "resource", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L465-L472
[ "def", "url_for", "(", "self", ",", "resource", ",", "*", "*", "values", ")", ":", "endpoint", "=", "resource", ".", "endpoint", "if", "self", ".", "blueprint", ":", "endpoint", "=", "'{0}.{1}'", ".", "format", "(", "self", ".", "blueprint", ".", "name...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.make_response
Looks up the representation transformer for the requested media type, invoking the transformer to create a response object. This defaults to default_mediatype if no transformer is found for the requested mediatype. If default_mediatype is None, a 406 Not Acceptable response will be sent ...
flask_restful/__init__.py
def make_response(self, data, *args, **kwargs): """Looks up the representation transformer for the requested media type, invoking the transformer to create a response object. This defaults to default_mediatype if no transformer is found for the requested mediatype. If default_mediatype i...
def make_response(self, data, *args, **kwargs): """Looks up the representation transformer for the requested media type, invoking the transformer to create a response object. This defaults to default_mediatype if no transformer is found for the requested mediatype. If default_mediatype i...
[ "Looks", "up", "the", "representation", "transformer", "for", "the", "requested", "media", "type", "invoking", "the", "transformer", "to", "create", "a", "response", "object", ".", "This", "defaults", "to", "default_mediatype", "if", "no", "transformer", "is", "...
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L474-L499
[ "def", "make_response", "(", "self", ",", "data", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "default_mediatype", "=", "kwargs", ".", "pop", "(", "'fallback_mediatype'", ",", "None", ")", "or", "self", ".", "default_mediatype", "mediatype", "=", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.mediatypes
Returns a list of requested mediatypes sent in the Accept header
flask_restful/__init__.py
def mediatypes(self): """Returns a list of requested mediatypes sent in the Accept header""" return [h for h, q in sorted(request.accept_mimetypes, key=operator.itemgetter(1), reverse=True)]
def mediatypes(self): """Returns a list of requested mediatypes sent in the Accept header""" return [h for h, q in sorted(request.accept_mimetypes, key=operator.itemgetter(1), reverse=True)]
[ "Returns", "a", "list", "of", "requested", "mediatypes", "sent", "in", "the", "Accept", "header" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L501-L504
[ "def", "mediatypes", "(", "self", ")", ":", "return", "[", "h", "for", "h", ",", "q", "in", "sorted", "(", "request", ".", "accept_mimetypes", ",", "key", "=", "operator", ".", "itemgetter", "(", "1", ")", ",", "reverse", "=", "True", ")", "]" ]
25544d697c1f82bafbd1320960df459f58a58e03
train
Api.representation
Allows additional representation transformers to be declared for the api. Transformers are functions that must be decorated with this method, passing the mediatype the transformer represents. Three arguments are passed to the transformer: * The data to be represented in the response bod...
flask_restful/__init__.py
def representation(self, mediatype): """Allows additional representation transformers to be declared for the api. Transformers are functions that must be decorated with this method, passing the mediatype the transformer represents. Three arguments are passed to the transformer: ...
def representation(self, mediatype): """Allows additional representation transformers to be declared for the api. Transformers are functions that must be decorated with this method, passing the mediatype the transformer represents. Three arguments are passed to the transformer: ...
[ "Allows", "additional", "representation", "transformers", "to", "be", "declared", "for", "the", "api", ".", "Transformers", "are", "functions", "that", "must", "be", "decorated", "with", "this", "method", "passing", "the", "mediatype", "the", "transformer", "repre...
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/__init__.py#L506-L530
[ "def", "representation", "(", "self", ",", "mediatype", ")", ":", "def", "wrapper", "(", "func", ")", ":", "self", ".", "representations", "[", "mediatype", "]", "=", "func", "return", "func", "return", "wrapper" ]
25544d697c1f82bafbd1320960df459f58a58e03
train
Argument.source
Pulls values off the request in the provided location :param request: The flask request object to parse arguments from
flask_restful/reqparse.py
def source(self, request): """Pulls values off the request in the provided location :param request: The flask request object to parse arguments from """ if isinstance(self.location, six.string_types): value = getattr(request, self.location, MultiDict()) if callabl...
def source(self, request): """Pulls values off the request in the provided location :param request: The flask request object to parse arguments from """ if isinstance(self.location, six.string_types): value = getattr(request, self.location, MultiDict()) if callabl...
[ "Pulls", "values", "off", "the", "request", "in", "the", "provided", "location", ":", "param", "request", ":", "The", "flask", "request", "object", "to", "parse", "arguments", "from" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L109-L129
[ "def", "source", "(", "self", ",", "request", ")", ":", "if", "isinstance", "(", "self", ".", "location", ",", "six", ".", "string_types", ")", ":", "value", "=", "getattr", "(", "request", ",", "self", ".", "location", ",", "MultiDict", "(", ")", ")...
25544d697c1f82bafbd1320960df459f58a58e03
train
Argument.handle_validation_error
Called when an error is raised while parsing. Aborts the request with a 400 status and an error message :param error: the error that was raised :param bundle_errors: do not abort when first error occurs, return a dict with the name of the argument and the error message to be ...
flask_restful/reqparse.py
def handle_validation_error(self, error, bundle_errors): """Called when an error is raised while parsing. Aborts the request with a 400 status and an error message :param error: the error that was raised :param bundle_errors: do not abort when first error occurs, return a di...
def handle_validation_error(self, error, bundle_errors): """Called when an error is raised while parsing. Aborts the request with a 400 status and an error message :param error: the error that was raised :param bundle_errors: do not abort when first error occurs, return a di...
[ "Called", "when", "an", "error", "is", "raised", "while", "parsing", ".", "Aborts", "the", "request", "with", "a", "400", "status", "and", "an", "error", "message" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L155-L170
[ "def", "handle_validation_error", "(", "self", ",", "error", ",", "bundle_errors", ")", ":", "error_str", "=", "six", ".", "text_type", "(", "error", ")", "error_msg", "=", "self", ".", "help", ".", "format", "(", "error_msg", "=", "error_str", ")", "if", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Argument.parse
Parses argument value(s) from the request, converting according to the argument's type. :param request: The flask request object to parse arguments from :param bundle_errors: Do not abort when first error occurs, return a dict with the name of the argument and the error message to b...
flask_restful/reqparse.py
def parse(self, request, bundle_errors=False): """Parses argument value(s) from the request, converting according to the argument's type. :param request: The flask request object to parse arguments from :param bundle_errors: Do not abort when first error occurs, return a dic...
def parse(self, request, bundle_errors=False): """Parses argument value(s) from the request, converting according to the argument's type. :param request: The flask request object to parse arguments from :param bundle_errors: Do not abort when first error occurs, return a dic...
[ "Parses", "argument", "value", "(", "s", ")", "from", "the", "request", "converting", "according", "to", "the", "argument", "s", "type", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L172-L256
[ "def", "parse", "(", "self", ",", "request", ",", "bundle_errors", "=", "False", ")", ":", "source", "=", "self", ".", "source", "(", "request", ")", "results", "=", "[", "]", "# Sentinels", "_not_found", "=", "False", "_found", "=", "True", "for", "op...
25544d697c1f82bafbd1320960df459f58a58e03
train
RequestParser.add_argument
Adds an argument to be parsed. Accepts either a single instance of Argument or arguments to be passed into :class:`Argument`'s constructor. See :class:`Argument`'s constructor for documentation on the available options.
flask_restful/reqparse.py
def add_argument(self, *args, **kwargs): """Adds an argument to be parsed. Accepts either a single instance of Argument or arguments to be passed into :class:`Argument`'s constructor. See :class:`Argument`'s constructor for documentation on the available options. """ ...
def add_argument(self, *args, **kwargs): """Adds an argument to be parsed. Accepts either a single instance of Argument or arguments to be passed into :class:`Argument`'s constructor. See :class:`Argument`'s constructor for documentation on the available options. """ ...
[ "Adds", "an", "argument", "to", "be", "parsed", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L285-L305
[ "def", "add_argument", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", "and", "isinstance", "(", "args", "[", "0", "]", ",", "self", ".", "argument_class", ")", ":", "self", ".", "args",...
25544d697c1f82bafbd1320960df459f58a58e03
train
RequestParser.parse_args
Parse all arguments from the provided request and return the results as a Namespace :param req: Can be used to overwrite request from Flask :param strict: if req includes args not in parser, throw 400 BadRequest exception :param http_error_code: use custom error code for `flask_restful....
flask_restful/reqparse.py
def parse_args(self, req=None, strict=False, http_error_code=400): """Parse all arguments from the provided request and return the results as a Namespace :param req: Can be used to overwrite request from Flask :param strict: if req includes args not in parser, throw 400 BadRequest excep...
def parse_args(self, req=None, strict=False, http_error_code=400): """Parse all arguments from the provided request and return the results as a Namespace :param req: Can be used to overwrite request from Flask :param strict: if req includes args not in parser, throw 400 BadRequest excep...
[ "Parse", "all", "arguments", "from", "the", "provided", "request", "and", "return", "the", "results", "as", "a", "Namespace" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L307-L338
[ "def", "parse_args", "(", "self", ",", "req", "=", "None", ",", "strict", "=", "False", ",", "http_error_code", "=", "400", ")", ":", "if", "req", "is", "None", ":", "req", "=", "request", "namespace", "=", "self", ".", "namespace_class", "(", ")", "...
25544d697c1f82bafbd1320960df459f58a58e03
train
RequestParser.copy
Creates a copy of this RequestParser with the same set of arguments
flask_restful/reqparse.py
def copy(self): """ Creates a copy of this RequestParser with the same set of arguments """ parser_copy = self.__class__(self.argument_class, self.namespace_class) parser_copy.args = deepcopy(self.args) parser_copy.trim = self.trim parser_copy.bundle_errors = self.bundle_errors ...
def copy(self): """ Creates a copy of this RequestParser with the same set of arguments """ parser_copy = self.__class__(self.argument_class, self.namespace_class) parser_copy.args = deepcopy(self.args) parser_copy.trim = self.trim parser_copy.bundle_errors = self.bundle_errors ...
[ "Creates", "a", "copy", "of", "this", "RequestParser", "with", "the", "same", "set", "of", "arguments" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L340-L346
[ "def", "copy", "(", "self", ")", ":", "parser_copy", "=", "self", ".", "__class__", "(", "self", ".", "argument_class", ",", "self", ".", "namespace_class", ")", "parser_copy", ".", "args", "=", "deepcopy", "(", "self", ".", "args", ")", "parser_copy", "...
25544d697c1f82bafbd1320960df459f58a58e03
train
RequestParser.replace_argument
Replace the argument matching the given name with a new version.
flask_restful/reqparse.py
def replace_argument(self, name, *args, **kwargs): """ Replace the argument matching the given name with a new version. """ new_arg = self.argument_class(name, *args, **kwargs) for index, arg in enumerate(self.args[:]): if new_arg.name == arg.name: del self.args[index...
def replace_argument(self, name, *args, **kwargs): """ Replace the argument matching the given name with a new version. """ new_arg = self.argument_class(name, *args, **kwargs) for index, arg in enumerate(self.args[:]): if new_arg.name == arg.name: del self.args[index...
[ "Replace", "the", "argument", "matching", "the", "given", "name", "with", "a", "new", "version", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L348-L356
[ "def", "replace_argument", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "new_arg", "=", "self", ".", "argument_class", "(", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", "for", "index", ",", "arg", "in", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
RequestParser.remove_argument
Remove the argument matching the given name.
flask_restful/reqparse.py
def remove_argument(self, name): """ Remove the argument matching the given name. """ for index, arg in enumerate(self.args[:]): if name == arg.name: del self.args[index] break return self
def remove_argument(self, name): """ Remove the argument matching the given name. """ for index, arg in enumerate(self.args[:]): if name == arg.name: del self.args[index] break return self
[ "Remove", "the", "argument", "matching", "the", "given", "name", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/reqparse.py#L358-L364
[ "def", "remove_argument", "(", "self", ",", "name", ")", ":", "for", "index", ",", "arg", "in", "enumerate", "(", "self", ".", "args", "[", ":", "]", ")", ":", "if", "name", "==", "arg", ".", "name", ":", "del", "self", ".", "args", "[", "index",...
25544d697c1f82bafbd1320960df459f58a58e03
train
to_marshallable_type
Helper for converting an object to a dictionary only if it is not dictionary already or an indexable object nor a simple type
flask_restful/fields.py
def to_marshallable_type(obj): """Helper for converting an object to a dictionary only if it is not dictionary already or an indexable object nor a simple type""" if obj is None: return None # make it idempotent for None if hasattr(obj, '__marshallable__'): return obj.__marshallable__(...
def to_marshallable_type(obj): """Helper for converting an object to a dictionary only if it is not dictionary already or an indexable object nor a simple type""" if obj is None: return None # make it idempotent for None if hasattr(obj, '__marshallable__'): return obj.__marshallable__(...
[ "Helper", "for", "converting", "an", "object", "to", "a", "dictionary", "only", "if", "it", "is", "not", "dictionary", "already", "or", "an", "indexable", "object", "nor", "a", "simple", "type" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/fields.py#L63-L75
[ "def", "to_marshallable_type", "(", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "None", "# make it idempotent for None", "if", "hasattr", "(", "obj", ",", "'__marshallable__'", ")", ":", "return", "obj", ".", "__marshallable__", "(", ")", "if", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
Raw.output
Pulls the value for the given key from the object, applies the field's formatting and returns the result. If the key is not found in the object, returns the default value. Field classes that create values which do not require the existence of the key in the object should override this an...
flask_restful/fields.py
def output(self, key, obj): """Pulls the value for the given key from the object, applies the field's formatting and returns the result. If the key is not found in the object, returns the default value. Field classes that create values which do not require the existence of the key in the...
def output(self, key, obj): """Pulls the value for the given key from the object, applies the field's formatting and returns the result. If the key is not found in the object, returns the default value. Field classes that create values which do not require the existence of the key in the...
[ "Pulls", "the", "value", "for", "the", "given", "key", "from", "the", "object", "applies", "the", "field", "s", "formatting", "and", "returns", "the", "result", ".", "If", "the", "key", "is", "not", "found", "in", "the", "object", "returns", "the", "defa...
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/fields.py#L111-L126
[ "def", "output", "(", "self", ",", "key", ",", "obj", ")", ":", "value", "=", "get_value", "(", "key", "if", "self", ".", "attribute", "is", "None", "else", "self", ".", "attribute", ",", "obj", ")", "if", "value", "is", "None", ":", "return", "sel...
25544d697c1f82bafbd1320960df459f58a58e03
train
url
Validate a URL. :param string value: The URL to validate :returns: The URL if valid. :raises: ValueError
flask_restful/inputs.py
def url(value): """Validate a URL. :param string value: The URL to validate :returns: The URL if valid. :raises: ValueError """ if not url_regex.search(value): message = u"{0} is not a valid URL".format(value) if url_regex.search('http://' + value): message += u". Di...
def url(value): """Validate a URL. :param string value: The URL to validate :returns: The URL if valid. :raises: ValueError """ if not url_regex.search(value): message = u"{0} is not a valid URL".format(value) if url_regex.search('http://' + value): message += u". Di...
[ "Validate", "a", "URL", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L28-L40
[ "def", "url", "(", "value", ")", ":", "if", "not", "url_regex", ".", "search", "(", "value", ")", ":", "message", "=", "u\"{0} is not a valid URL\"", ".", "format", "(", "value", ")", "if", "url_regex", ".", "search", "(", "'http://'", "+", "value", ")",...
25544d697c1f82bafbd1320960df459f58a58e03
train
_normalize_interval
Normalize datetime intervals. Given a pair of datetime.date or datetime.datetime objects, returns a 2-tuple of tz-aware UTC datetimes spanning the same interval. For datetime.date objects, the returned interval starts at 00:00:00.0 on the first date and ends at 00:00:00.0 on the second. Naive dat...
flask_restful/inputs.py
def _normalize_interval(start, end, value): """Normalize datetime intervals. Given a pair of datetime.date or datetime.datetime objects, returns a 2-tuple of tz-aware UTC datetimes spanning the same interval. For datetime.date objects, the returned interval starts at 00:00:00.0 on the first date a...
def _normalize_interval(start, end, value): """Normalize datetime intervals. Given a pair of datetime.date or datetime.datetime objects, returns a 2-tuple of tz-aware UTC datetimes spanning the same interval. For datetime.date objects, the returned interval starts at 00:00:00.0 on the first date a...
[ "Normalize", "datetime", "intervals", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L74-L102
[ "def", "_normalize_interval", "(", "start", ",", "end", ",", "value", ")", ":", "if", "not", "isinstance", "(", "start", ",", "datetime", ")", ":", "start", "=", "datetime", ".", "combine", "(", "start", ",", "START_OF_DAY", ")", "end", "=", "datetime", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
_parse_interval
Do some nasty try/except voodoo to get some sort of datetime object(s) out of the string.
flask_restful/inputs.py
def _parse_interval(value): """Do some nasty try/except voodoo to get some sort of datetime object(s) out of the string. """ try: return sorted(aniso8601.parse_interval(value)) except ValueError: try: return aniso8601.parse_datetime(value), None except ValueError:...
def _parse_interval(value): """Do some nasty try/except voodoo to get some sort of datetime object(s) out of the string. """ try: return sorted(aniso8601.parse_interval(value)) except ValueError: try: return aniso8601.parse_datetime(value), None except ValueError:...
[ "Do", "some", "nasty", "try", "/", "except", "voodoo", "to", "get", "some", "sort", "of", "datetime", "object", "(", "s", ")", "out", "of", "the", "string", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L129-L139
[ "def", "_parse_interval", "(", "value", ")", ":", "try", ":", "return", "sorted", "(", "aniso8601", ".", "parse_interval", "(", "value", ")", ")", "except", "ValueError", ":", "try", ":", "return", "aniso8601", ".", "parse_datetime", "(", "value", ")", ","...
25544d697c1f82bafbd1320960df459f58a58e03
train
iso8601interval
Parses ISO 8601-formatted datetime intervals into tuples of datetimes. Accepts both a single date(time) or a full interval using either start/end or start/duration notation, with the following behavior: - Intervals are defined as inclusive start, exclusive end - Single datetimes are translated into th...
flask_restful/inputs.py
def iso8601interval(value, argument='argument'): """Parses ISO 8601-formatted datetime intervals into tuples of datetimes. Accepts both a single date(time) or a full interval using either start/end or start/duration notation, with the following behavior: - Intervals are defined as inclusive start, exc...
def iso8601interval(value, argument='argument'): """Parses ISO 8601-formatted datetime intervals into tuples of datetimes. Accepts both a single date(time) or a full interval using either start/end or start/duration notation, with the following behavior: - Intervals are defined as inclusive start, exc...
[ "Parses", "ISO", "8601", "-", "formatted", "datetime", "intervals", "into", "tuples", "of", "datetimes", "." ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L142-L184
[ "def", "iso8601interval", "(", "value", ",", "argument", "=", "'argument'", ")", ":", "try", ":", "start", ",", "end", "=", "_parse_interval", "(", "value", ")", "if", "end", "is", "None", ":", "end", "=", "_expand_datetime", "(", "start", ",", "value", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
natural
Restrict input type to the natural numbers (0, 1, 2, 3...)
flask_restful/inputs.py
def natural(value, argument='argument'): """ Restrict input type to the natural numbers (0, 1, 2, 3...) """ value = _get_integer(value) if value < 0: error = ('Invalid {arg}: {value}. {arg} must be a non-negative ' 'integer'.format(arg=argument, value=value)) raise ValueErro...
def natural(value, argument='argument'): """ Restrict input type to the natural numbers (0, 1, 2, 3...) """ value = _get_integer(value) if value < 0: error = ('Invalid {arg}: {value}. {arg} must be a non-negative ' 'integer'.format(arg=argument, value=value)) raise ValueErro...
[ "Restrict", "input", "type", "to", "the", "natural", "numbers", "(", "0", "1", "2", "3", "...", ")" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L200-L207
[ "def", "natural", "(", "value", ",", "argument", "=", "'argument'", ")", ":", "value", "=", "_get_integer", "(", "value", ")", "if", "value", "<", "0", ":", "error", "=", "(", "'Invalid {arg}: {value}. {arg} must be a non-negative '", "'integer'", ".", "format",...
25544d697c1f82bafbd1320960df459f58a58e03
train
positive
Restrict input type to the positive integers (1, 2, 3...)
flask_restful/inputs.py
def positive(value, argument='argument'): """ Restrict input type to the positive integers (1, 2, 3...) """ value = _get_integer(value) if value < 1: error = ('Invalid {arg}: {value}. {arg} must be a positive ' 'integer'.format(arg=argument, value=value)) raise ValueError(er...
def positive(value, argument='argument'): """ Restrict input type to the positive integers (1, 2, 3...) """ value = _get_integer(value) if value < 1: error = ('Invalid {arg}: {value}. {arg} must be a positive ' 'integer'.format(arg=argument, value=value)) raise ValueError(er...
[ "Restrict", "input", "type", "to", "the", "positive", "integers", "(", "1", "2", "3", "...", ")" ]
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L210-L217
[ "def", "positive", "(", "value", ",", "argument", "=", "'argument'", ")", ":", "value", "=", "_get_integer", "(", "value", ")", "if", "value", "<", "1", ":", "error", "=", "(", "'Invalid {arg}: {value}. {arg} must be a positive '", "'integer'", ".", "format", ...
25544d697c1f82bafbd1320960df459f58a58e03
train
boolean
Parse the string ``"true"`` or ``"false"`` as a boolean (case insensitive). Also accepts ``"1"`` and ``"0"`` as ``True``/``False`` (respectively). If the input is from the request JSON body, the type is already a native python boolean, and will be passed through without further parsing.
flask_restful/inputs.py
def boolean(value): """Parse the string ``"true"`` or ``"false"`` as a boolean (case insensitive). Also accepts ``"1"`` and ``"0"`` as ``True``/``False`` (respectively). If the input is from the request JSON body, the type is already a native python boolean, and will be passed through without furthe...
def boolean(value): """Parse the string ``"true"`` or ``"false"`` as a boolean (case insensitive). Also accepts ``"1"`` and ``"0"`` as ``True``/``False`` (respectively). If the input is from the request JSON body, the type is already a native python boolean, and will be passed through without furthe...
[ "Parse", "the", "string", "true", "or", "false", "as", "a", "boolean", "(", "case", "insensitive", ")", ".", "Also", "accepts", "1", "and", "0", "as", "True", "/", "False", "(", "respectively", ")", ".", "If", "the", "input", "is", "from", "the", "re...
flask-restful/flask-restful
python
https://github.com/flask-restful/flask-restful/blob/25544d697c1f82bafbd1320960df459f58a58e03/flask_restful/inputs.py#L237-L254
[ "def", "boolean", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "value", "if", "not", "value", ":", "raise", "ValueError", "(", "\"boolean type must be non-null\"", ")", "value", "=", "value", ".", "lower", "(",...
25544d697c1f82bafbd1320960df459f58a58e03
train
_specialKeyEvent
Helper method for special keys. Source: http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac
pyautogui/_pyautogui_osx.py
def _specialKeyEvent(key, upDown): """ Helper method for special keys. Source: http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac """ assert upDown in ('up', 'down'), "upDown argument must be 'up' or 'down'" key_code = special_key_translate_table[key] ev = AppKit.NSEve...
def _specialKeyEvent(key, upDown): """ Helper method for special keys. Source: http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac """ assert upDown in ('up', 'down'), "upDown argument must be 'up' or 'down'" key_code = special_key_translate_table[key] ev = AppKit.NSEve...
[ "Helper", "method", "for", "special", "keys", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_osx.py#L264-L285
[ "def", "_specialKeyEvent", "(", "key", ",", "upDown", ")", ":", "assert", "upDown", "in", "(", "'up'", ",", "'down'", ")", ",", "\"upDown argument must be 'up' or 'down'\"", "key_code", "=", "special_key_translate_table", "[", "key", "]", "ev", "=", "AppKit", "....
77524bd47334a89024013fd48e05151c3ac9289a
train
_keyDown
Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down. The valid names are liste...
pyautogui/_pyautogui_x11.py
def _keyDown(key): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down....
def _keyDown(key): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down....
[ "Performs", "a", "keyboard", "key", "press", "without", "the", "release", ".", "This", "will", "put", "that", "key", "in", "a", "held", "down", "state", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_x11.py#L99-L129
[ "def", "_keyDown", "(", "key", ")", ":", "if", "key", "not", "in", "keyboardMapping", "or", "keyboardMapping", "[", "key", "]", "is", "None", ":", "return", "if", "type", "(", "key", ")", "==", "int", ":", "fake_input", "(", "_display", ",", "X", "."...
77524bd47334a89024013fd48e05151c3ac9289a
train
_keyUp
Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None
pyautogui/_pyautogui_x11.py
def _keyUp(key): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None """ """ Release a given character key. Also works with character keycodes as ...
def _keyUp(key): """Performs a keyboard key release (without the press down beforehand). Args: key (str): The key to be released up. The valid names are listed in pyautogui.KEY_NAMES. Returns: None """ """ Release a given character key. Also works with character keycodes as ...
[ "Performs", "a", "keyboard", "key", "release", "(", "without", "the", "press", "down", "beforehand", ")", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_x11.py#L132-L156
[ "def", "_keyUp", "(", "key", ")", ":", "\"\"\"\n Release a given character key. Also works with character keycodes as\n integers, but not keysyms.\n \"\"\"", "if", "key", "not", "in", "keyboardMapping", "or", "keyboardMapping", "[", "key", "]", "is", "None", ":", "re...
77524bd47334a89024013fd48e05151c3ac9289a
train
getWindows
Return dict: {'window title' : window handle} for all visible windows
pyautogui/_window_win.py
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ """Return dict: {'window title' : window handle} for all visible windows""" titles = {} def foreach_window(hwnd, lparam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd)...
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ """Return dict: {'window title' : window handle} for all visible windows""" titles = {} def foreach_window(hwnd, lparam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd)...
[ "Return", "dict", ":", "{", "window", "title", ":", "window", "handle", "}", "for", "all", "visible", "windows" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L84-L97
[ "def", "getWindows", "(", ")", ":", "#https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/", "titles", "=", "{", "}", "def", "foreach_window", "(", "hwnd", ",", "lparam", ")", ":", "if", "IsWindowVisible", "(", "hwnd", ")", ":", "length",...
77524bd47334a89024013fd48e05151c3ac9289a
train
getWindow
Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match
pyautogui/_window_win.py
def getWindow(title, exact=False): """Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match """ titles = getWindows() hwnd = titles....
def getWindow(title, exact=False): """Return Window object if 'title' or its part found in visible windows titles, else return None Return only 1 window found first Args: title: unicode string exact (bool): True if search only exact match """ titles = getWindows() hwnd = titles....
[ "Return", "Window", "object", "if", "title", "or", "its", "part", "found", "in", "visible", "windows", "titles", "else", "return", "None" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L99-L117
[ "def", "getWindow", "(", "title", ",", "exact", "=", "False", ")", ":", "titles", "=", "getWindows", "(", ")", "hwnd", "=", "titles", ".", "get", "(", "title", ",", "None", ")", "if", "not", "hwnd", "and", "not", "exact", ":", "for", "k", ",", "v...
77524bd47334a89024013fd48e05151c3ac9289a
train
Window.set_position
Set window top-left corner position and size
pyautogui/_window_win.py
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
[ "Set", "window", "top", "-", "left", "corner", "position", "and", "size" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L44-L46
[ "def", "set_position", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "x", ",", "y", ",", "width", ",", "height", ",", "ctypes", ".", "c_uint", "(", "0", ")", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
Window.move
Move window top-left corner to position
pyautogui/_window_win.py
def move(self, x, y): """Move window top-left corner to position""" SetWindowPos(self._hwnd, None, x, y, 0, 0, SWP_NOSIZE)
def move(self, x, y): """Move window top-left corner to position""" SetWindowPos(self._hwnd, None, x, y, 0, 0, SWP_NOSIZE)
[ "Move", "window", "top", "-", "left", "corner", "to", "position" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L48-L50
[ "def", "move", "(", "self", ",", "x", ",", "y", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "x", ",", "y", ",", "0", ",", "0", ",", "SWP_NOSIZE", ")" ]
77524bd47334a89024013fd48e05151c3ac9289a
train
Window.resize
Change window size
pyautogui/_window_win.py
def resize(self, width, height): """Change window size""" SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE)
def resize(self, width, height): """Change window size""" SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE)
[ "Change", "window", "size" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L52-L54
[ "def", "resize", "(", "self", ",", "width", ",", "height", ")", ":", "SetWindowPos", "(", "self", ".", "_hwnd", ",", "None", ",", "0", ",", "0", ",", "width", ",", "height", ",", "SWP_NOMOVE", ")" ]
77524bd47334a89024013fd48e05151c3ac9289a
train
Window.get_position
Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners
pyautogui/_window_win.py
def get_position(self): """Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners""" rect = _Rect() GetWindowRect(self._hwnd, ctypes.pointer(rect)) return rect.left, rect.top, rect.right, rect.bottom
def get_position(self): """Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners""" rect = _Rect() GetWindowRect(self._hwnd, ctypes.pointer(rect)) return rect.left, rect.top, rect.right, rect.bottom
[ "Returns", "tuple", "of", "4", "numbers", ":", "(", "x", "y", ")", "s", "of", "top", "-", "left", "and", "bottom", "-", "right", "corners" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L71-L75
[ "def", "get_position", "(", "self", ")", ":", "rect", "=", "_Rect", "(", ")", "GetWindowRect", "(", "self", ".", "_hwnd", ",", "ctypes", ".", "pointer", "(", "rect", ")", ")", "return", "rect", ".", "left", ",", "rect", ".", "top", ",", "rect", "."...
77524bd47334a89024013fd48e05151c3ac9289a
train
getPointOnLine
Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module.
pyautogui/__init__.py
def getPointOnLine(x1, y1, x2, y2, n): """Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module. """ x = ((x2 - x1) * n) + x1 y = ((y2 - y1) * n) + y1 return (x, y)
def getPointOnLine(x1, y1, x2, y2, n): """Returns the (x, y) tuple of the point that has progressed a proportion n along the line defined by the two x, y coordinates. Copied from pytweening module. """ x = ((x2 - x1) * n) + x1 y = ((y2 - y1) * n) + y1 return (x, y)
[ "Returns", "the", "(", "x", "y", ")", "tuple", "of", "the", "point", "that", "has", "progressed", "a", "proportion", "n", "along", "the", "line", "defined", "by", "the", "two", "x", "y", "coordinates", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L179-L187
[ "def", "getPointOnLine", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "n", ")", ":", "x", "=", "(", "(", "x2", "-", "x1", ")", "*", "n", ")", "+", "x1", "y", "=", "(", "(", "y2", "-", "y1", ")", "*", "n", ")", "+", "y1", "return", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
_unpackXY
If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence.
pyautogui/__init__.py
def _unpackXY(x, y): """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence. """ if isinstance(x, str): # x parameter is the string of an ...
def _unpackXY(x, y): """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y. On functions that receive a pair of x,y coordinates, they can be passed as separate arguments, or as a single two-element sequence. """ if isinstance(x, str): # x parameter is the string of an ...
[ "If", "x", "is", "a", "sequence", "and", "y", "is", "None", "returns", "x", "[", "0", "]", "y", "[", "0", "]", ".", "Else", "returns", "x", "y", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L210-L231
[ "def", "_unpackXY", "(", "x", ",", "y", ")", ":", "if", "isinstance", "(", "x", ",", "str", ")", ":", "# x parameter is the string of an image filename to find and click on:", "x", ",", "y", "=", "center", "(", "locateOnScreen", "(", "x", ")", ")", "elif", "...
77524bd47334a89024013fd48e05151c3ac9289a
train
position
Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in the return value. Returns: ...
pyautogui/__init__.py
def position(x=None, y=None): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in ...
def position(x=None, y=None): """Returns the current xy coordinates of the mouse cursor as a two-integer tuple. Args: x (int, None, optional) - If not None, this argument overrides the x in the return value. y (int, None, optional) - If not None, this argument overrides the y in ...
[ "Returns", "the", "current", "xy", "coordinates", "of", "the", "mouse", "cursor", "as", "a", "two", "-", "integer", "tuple", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L234-L254
[ "def", "position", "(", "x", "=", "None", ",", "y", "=", "None", ")", ":", "posx", ",", "posy", "=", "platformModule", ".", "_position", "(", ")", "posx", "=", "int", "(", "posx", ")", "posy", "=", "int", "(", "posy", ")", "if", "x", "is", "not...
77524bd47334a89024013fd48e05151c3ac9289a
train
onScreen
Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: onScreen(x, y) or onScreen([x, y...
pyautogui/__init__.py
def onScreen(x, y=None): """Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: ...
def onScreen(x, y=None): """Returns whether the given xy coordinates are on the screen or not. Args: Either the arguments are two separate values, first arg for x and second for y, or there is a single argument of a sequence with two values, the first x and the second y. Example: ...
[ "Returns", "whether", "the", "given", "xy", "coordinates", "are", "on", "the", "screen", "or", "not", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L266-L284
[ "def", "onScreen", "(", "x", ",", "y", "=", "None", ")", ":", "x", ",", "y", "=", "_unpackXY", "(", "x", ",", "y", ")", "x", "=", "int", "(", "x", ")", "y", "=", "int", "(", "y", ")", "width", ",", "height", "=", "platformModule", ".", "_si...
77524bd47334a89024013fd48e05151c3ac9289a
train
mouseUp
Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. Args: ...
pyautogui/__init__.py
def mouseUp(x=None, y=None, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down....
def mouseUp(x=None, y=None, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs releasing a mouse button up (but not down beforehand). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down....
[ "Performs", "releasing", "a", "mouse", "button", "up", "(", "but", "not", "down", "beforehand", ")", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L334-L375
[ "def", "mouseUp", "(", "x", "=", "None", ",", "y", "=", "None", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "button", "not", "in", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
click
Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. ...
pyautogui/__init__.py
def click(x=None, y=None, clicks=1, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a f...
def click(x=None, y=None, clicks=1, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs pressing a mouse button down and then immediately releasing it. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a f...
[ "Performs", "pressing", "a", "mouse", "button", "down", "and", "then", "immediately", "releasing", "it", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L377-L430
[ "def", "click", "(", "x", "=", "None", ",", "y", "=", "None", ",", "clicks", "=", "1", ",", "interval", "=", "0.0", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
rightClick
Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge o...
pyautogui/__init__.py
def rightClick(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, ...
def rightClick(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Performs a right mouse button click. This is a wrapper function for click('right', x, y). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, ...
[ "Performs", "a", "right", "mouse", "button", "click", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L432-L457
[ "def", "rightClick", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "click", "(", "x", ",", "y",...
77524bd47334a89024013fd48e05151c3ac9289a
train
doubleClick
Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge o...
pyautogui/__init__.py
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
[ "Performs", "a", "double", "click", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L488-L530
[ "def", "doubleClick", "(", "x", "=", "None", ",", "y", "=", "None", ",", "interval", "=", "0.0", ",", "button", "=", "'left'", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", "...
77524bd47334a89024013fd48e05151c3ac9289a
train
scroll
Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the bo...
pyautogui/__init__.py
def scroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position ...
def scroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs a scroll of the mouse scroll wheel. Whether this is a vertical or horizontal scroll depends on the underlying operating system. The x and y parameters detail where the mouse event happens. If None, the current mouse position ...
[ "Performs", "a", "scroll", "of", "the", "mouse", "scroll", "wheel", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L577-L605
[ "def", "scroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
hscroll
Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the bounda...
pyautogui/__init__.py
def hscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is ...
def hscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly horizontal scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is ...
[ "Performs", "an", "explicitly", "horizontal", "scroll", "of", "the", "mouse", "scroll", "wheel", "if", "this", "is", "supported", "by", "the", "operating", "system", ".", "(", "Currently", "just", "Linux", ".", ")" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L608-L634
[ "def", "hscroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
vscroll
Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundari...
pyautogui/__init__.py
def vscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is us...
def vscroll(clicks, x=None, y=None, pause=None, _pause=True): """Performs an explicitly vertical scroll of the mouse scroll wheel, if this is supported by the operating system. (Currently just Linux.) The x and y parameters detail where the mouse event happens. If None, the current mouse position is us...
[ "Performs", "an", "explicitly", "vertical", "scroll", "of", "the", "mouse", "scroll", "wheel", "if", "this", "is", "supported", "by", "the", "operating", "system", ".", "(", "Currently", "just", "Linux", ".", ")" ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L637-L662
[ "def", "vscroll", "(", "clicks", ",", "x", "=", "None", ",", "y", "=", "None", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "if", "type", "(", "x", ")", "in", "(", "tuple", ",", "list", ")", ":", ...
77524bd47334a89024013fd48e05151c3ac9289a
train
moveTo
Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the screen. Args: x (int, flo...
pyautogui/__init__.py
def moveTo(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries ...
def moveTo(x=None, y=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries ...
[ "Moves", "the", "mouse", "cursor", "to", "a", "point", "on", "the", "screen", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L665-L695
[ "def", "moveTo", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "x", ",", "y", "=", "_unpackXY",...
77524bd47334a89024013fd48e05151c3ac9289a
train
moveRel
Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge of the ...
pyautogui/__init__.py
def moveRel(xOffset=None, yOffset=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value,...
def moveRel(xOffset=None, yOffset=None, duration=0.0, tween=linear, pause=None, _pause=True): """Moves the mouse cursor to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value,...
[ "Moves", "the", "mouse", "cursor", "to", "a", "point", "on", "the", "screen", "relative", "to", "its", "current", "position", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L698-L729
[ "def", "moveRel", "(", "xOffset", "=", "None", ",", "yOffset", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "_failSafeCheck", "(", ")", "xOffset", ",", "yOffse...
77524bd47334a89024013fd48e05151c3ac9289a
train
dragTo
Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the screen, the event happens at edge...
pyautogui/__init__.py
def dragTo(x=None, y=None, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse posit...
def dragTo(x=None, y=None, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen. The x and y parameters detail where the mouse event happens. If None, the current mouse posit...
[ "Performs", "a", "mouse", "drag", "(", "mouse", "movement", "while", "a", "button", "is", "held", "down", ")", "to", "a", "point", "on", "the", "screen", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L735-L775
[ "def", "dragTo", "(", "x", "=", "None", ",", "y", "=", "None", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "button", "=", "'left'", ",", "pause", "=", "None", ",", "_pause", "=", "True", ",", "mouseDownUp", "=", "True", ")", ":...
77524bd47334a89024013fd48e05151c3ac9289a
train
dragRel
Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happens. If None, the current mouse position is used. If a float value, it is rounded down. If outside the boundaries of the...
pyautogui/__init__.py
def dragRel(xOffset=0, yOffset=0, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happ...
def dragRel(xOffset=0, yOffset=0, duration=0.0, tween=linear, button='left', pause=None, _pause=True, mouseDownUp=True): """Performs a mouse drag (mouse movement while a button is held down) to a point on the screen, relative to its current position. The x and y parameters detail where the mouse event happ...
[ "Performs", "a", "mouse", "drag", "(", "mouse", "movement", "while", "a", "button", "is", "held", "down", ")", "to", "a", "point", "on", "the", "screen", "relative", "to", "its", "current", "position", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L778-L827
[ "def", "dragRel", "(", "xOffset", "=", "0", ",", "yOffset", "=", "0", ",", "duration", "=", "0.0", ",", "tween", "=", "linear", ",", "button", "=", "'left'", ",", "pause", "=", "None", ",", "_pause", "=", "True", ",", "mouseDownUp", "=", "True", ")...
77524bd47334a89024013fd48e05151c3ac9289a
train
_mouseMoveDrag
Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" event must be used instead. The code for moving and dragging the mouse is similar, so this functi...
pyautogui/__init__.py
def _mouseMoveDrag(moveOrDrag, x, y, xOffset, yOffset, duration, tween=linear, button=None): """Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" ev...
def _mouseMoveDrag(moveOrDrag, x, y, xOffset, yOffset, duration, tween=linear, button=None): """Handles the actual move or drag event, since different platforms implement them differently. On Windows & Linux, a drag is a normal mouse move while a mouse button is held down. On OS X, a distinct "drag" ev...
[ "Handles", "the", "actual", "move", "or", "drag", "event", "since", "different", "platforms", "implement", "them", "differently", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L833-L929
[ "def", "_mouseMoveDrag", "(", "moveOrDrag", ",", "x", ",", "y", ",", "xOffset", ",", "yOffset", ",", "duration", ",", "tween", "=", "linear", ",", "button", "=", "None", ")", ":", "# The move and drag code is similar, but OS X requires a special drag event instead of ...
77524bd47334a89024013fd48e05151c3ac9289a
train
keyDown
Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The key to be pressed down. The valid names are liste...
pyautogui/__init__.py
def keyDown(key, pause=None, _pause=True): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The...
def keyDown(key, pause=None, _pause=True): """Performs a keyboard key press without the release. This will put that key in a held down state. NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field. Args: key (str): The...
[ "Performs", "a", "keyboard", "key", "press", "without", "the", "release", ".", "This", "will", "put", "that", "key", "in", "a", "held", "down", "state", "." ]
asweigart/pyautogui
python
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/__init__.py#L955-L975
[ "def", "keyDown", "(", "key", ",", "pause", "=", "None", ",", "_pause", "=", "True", ")", ":", "if", "len", "(", "key", ")", ">", "1", ":", "key", "=", "key", ".", "lower", "(", ")", "_failSafeCheck", "(", ")", "platformModule", ".", "_keyDown", ...
77524bd47334a89024013fd48e05151c3ac9289a