id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
242,500
mgk/thingamon
thingamon/client.py
Client.publish
def publish(self, topic, message): """Publish an MQTT message to a topic.""" self.connect() log.info('publish {}'.format(message)) self.client.publish(topic, message)
python
def publish(self, topic, message): """Publish an MQTT message to a topic.""" self.connect() log.info('publish {}'.format(message)) self.client.publish(topic, message)
[ "def", "publish", "(", "self", ",", "topic", ",", "message", ")", ":", "self", ".", "connect", "(", ")", "log", ".", "info", "(", "'publish {}'", ".", "format", "(", "message", ")", ")", "self", ".", "client", ".", "publish", "(", "topic", ",", "me...
Publish an MQTT message to a topic.
[ "Publish", "an", "MQTT", "message", "to", "a", "topic", "." ]
3f7d68dc2131c347473af15cd5f7d4b669407c6b
https://github.com/mgk/thingamon/blob/3f7d68dc2131c347473af15cd5f7d4b669407c6b/thingamon/client.py#L95-L99
242,501
JonLiuFYI/pkdx
pkdx/pkdx/scrape_abilities.py
get_abilities
def get_abilities(): """Visit Bulbapedia and pull names and descriptions from the table, 'list of Abilities.' Save as JSON.""" page = requests.get('http://bulbapedia.bulbagarden.net/wiki/Ability') soup = bs4.BeautifulSoup(page.text) table = soup.find("table", {"class": "sortable"}) tablerows = [tr f...
python
def get_abilities(): """Visit Bulbapedia and pull names and descriptions from the table, 'list of Abilities.' Save as JSON.""" page = requests.get('http://bulbapedia.bulbagarden.net/wiki/Ability') soup = bs4.BeautifulSoup(page.text) table = soup.find("table", {"class": "sortable"}) tablerows = [tr f...
[ "def", "get_abilities", "(", ")", ":", "page", "=", "requests", ".", "get", "(", "'http://bulbapedia.bulbagarden.net/wiki/Ability'", ")", "soup", "=", "bs4", ".", "BeautifulSoup", "(", "page", ".", "text", ")", "table", "=", "soup", ".", "find", "(", "\"tabl...
Visit Bulbapedia and pull names and descriptions from the table, 'list of Abilities.' Save as JSON.
[ "Visit", "Bulbapedia", "and", "pull", "names", "and", "descriptions", "from", "the", "table", "list", "of", "Abilities", ".", "Save", "as", "JSON", "." ]
269e9814df074e0df25972fad04539a644d73a3c
https://github.com/JonLiuFYI/pkdx/blob/269e9814df074e0df25972fad04539a644d73a3c/pkdx/pkdx/scrape_abilities.py#L12-L28
242,502
openp2pdesign/makerlabs
makerlabs/techshop_ws.py
data_from_techshop_ws
def data_from_techshop_ws(tws_url): """Scrapes data from techshop.ws.""" r = requests.get(tws_url) if r.status_code == 200: data = BeautifulSoup(r.text, "lxml") else: data = "There was an error while accessing data on techshop.ws." return data
python
def data_from_techshop_ws(tws_url): """Scrapes data from techshop.ws.""" r = requests.get(tws_url) if r.status_code == 200: data = BeautifulSoup(r.text, "lxml") else: data = "There was an error while accessing data on techshop.ws." return data
[ "def", "data_from_techshop_ws", "(", "tws_url", ")", ":", "r", "=", "requests", ".", "get", "(", "tws_url", ")", "if", "r", ".", "status_code", "==", "200", ":", "data", "=", "BeautifulSoup", "(", "r", ".", "text", ",", "\"lxml\"", ")", "else", ":", ...
Scrapes data from techshop.ws.
[ "Scrapes", "data", "from", "techshop", ".", "ws", "." ]
b5838440174f10d370abb671358db9a99d7739fd
https://github.com/openp2pdesign/makerlabs/blob/b5838440174f10d370abb671358db9a99d7739fd/makerlabs/techshop_ws.py#L38-L47
242,503
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
Database.has_client_id
def has_client_id(self, id): """Returns True if we have a client with a certain integer identifier""" return self.query(Client).filter(Client.id==id).count() != 0
python
def has_client_id(self, id): """Returns True if we have a client with a certain integer identifier""" return self.query(Client).filter(Client.id==id).count() != 0
[ "def", "has_client_id", "(", "self", ",", "id", ")", ":", "return", "self", ".", "query", "(", "Client", ")", ".", "filter", "(", "Client", ".", "id", "==", "id", ")", ".", "count", "(", ")", "!=", "0" ]
Returns True if we have a client with a certain integer identifier
[ "Returns", "True", "if", "we", "have", "a", "client", "with", "a", "certain", "integer", "identifier" ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L142-L145
242,504
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
Database.client
def client(self, id): """Returns the client object in the database given a certain id. Raises an error if that does not exist.""" return self.query(Client).filter(Client.id==id).one()
python
def client(self, id): """Returns the client object in the database given a certain id. Raises an error if that does not exist.""" return self.query(Client).filter(Client.id==id).one()
[ "def", "client", "(", "self", ",", "id", ")", ":", "return", "self", ".", "query", "(", "Client", ")", ".", "filter", "(", "Client", ".", "id", "==", "id", ")", ".", "one", "(", ")" ]
Returns the client object in the database given a certain id. Raises an error if that does not exist.
[ "Returns", "the", "client", "object", "in", "the", "database", "given", "a", "certain", "id", ".", "Raises", "an", "error", "if", "that", "does", "not", "exist", "." ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L147-L151
242,505
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
Database.protocol_names
def protocol_names(self): """Returns all registered protocol names""" l = self.protocols() retval = [str(k.name) for k in l] return retval
python
def protocol_names(self): """Returns all registered protocol names""" l = self.protocols() retval = [str(k.name) for k in l] return retval
[ "def", "protocol_names", "(", "self", ")", ":", "l", "=", "self", ".", "protocols", "(", ")", "retval", "=", "[", "str", "(", "k", ".", "name", ")", "for", "k", "in", "l", "]", "return", "retval" ]
Returns all registered protocol names
[ "Returns", "all", "registered", "protocol", "names" ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L232-L237
242,506
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
Database.has_protocol
def has_protocol(self, name): """Tells if a certain protocol is available""" return self.query(Protocol).filter(Protocol.name==name).count() != 0
python
def has_protocol(self, name): """Tells if a certain protocol is available""" return self.query(Protocol).filter(Protocol.name==name).count() != 0
[ "def", "has_protocol", "(", "self", ",", "name", ")", ":", "return", "self", ".", "query", "(", "Protocol", ")", ".", "filter", "(", "Protocol", ".", "name", "==", "name", ")", ".", "count", "(", ")", "!=", "0" ]
Tells if a certain protocol is available
[ "Tells", "if", "a", "certain", "protocol", "is", "available" ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L244-L247
242,507
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
Database.protocol
def protocol(self, name): """Returns the protocol object in the database given a certain name. Raises an error if that does not exist.""" return self.query(Protocol).filter(Protocol.name==name).one()
python
def protocol(self, name): """Returns the protocol object in the database given a certain name. Raises an error if that does not exist.""" return self.query(Protocol).filter(Protocol.name==name).one()
[ "def", "protocol", "(", "self", ",", "name", ")", ":", "return", "self", ".", "query", "(", "Protocol", ")", ".", "filter", "(", "Protocol", ".", "name", "==", "name", ")", ".", "one", "(", ")" ]
Returns the protocol object in the database given a certain name. Raises an error if that does not exist.
[ "Returns", "the", "protocol", "object", "in", "the", "database", "given", "a", "certain", "name", ".", "Raises", "an", "error", "if", "that", "does", "not", "exist", "." ]
b7358a73e21757b43334df7c89ba057b377ca704
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L249-L253
242,508
JNRowe/jnrbase
jnrbase/i18n.py
setup
def setup(__pkg: ModuleType) -> Tuple[Callable[[str], str], Callable[[str, str, int], str]]: """Configure ``gettext`` for given package. Args: __pkg: Package to use as location for :program:`gettext` files Returns: :program:`gettext` functions for singu...
python
def setup(__pkg: ModuleType) -> Tuple[Callable[[str], str], Callable[[str, str, int], str]]: """Configure ``gettext`` for given package. Args: __pkg: Package to use as location for :program:`gettext` files Returns: :program:`gettext` functions for singu...
[ "def", "setup", "(", "__pkg", ":", "ModuleType", ")", "->", "Tuple", "[", "Callable", "[", "[", "str", "]", ",", "str", "]", ",", "Callable", "[", "[", "str", ",", "str", ",", "int", "]", ",", "str", "]", "]", ":", "package_locale", "=", "path", ...
Configure ``gettext`` for given package. Args: __pkg: Package to use as location for :program:`gettext` files Returns: :program:`gettext` functions for singular and plural translations
[ "Configure", "gettext", "for", "given", "package", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/i18n.py#L27-L40
242,509
jalanb/pysyte
pysyte/bash/git.py
run
def run(sub_command, quiet=False, no_edit=False, no_verify=False): """Run a git command Prefix that sub_command with "git " then run the command in shell If quiet if True then do not log results If no_edit is True then prefix the git command with "GIT_EDITOR=true" (which does not wait ...
python
def run(sub_command, quiet=False, no_edit=False, no_verify=False): """Run a git command Prefix that sub_command with "git " then run the command in shell If quiet if True then do not log results If no_edit is True then prefix the git command with "GIT_EDITOR=true" (which does not wait ...
[ "def", "run", "(", "sub_command", ",", "quiet", "=", "False", ",", "no_edit", "=", "False", ",", "no_verify", "=", "False", ")", ":", "if", "_working_dirs", "[", "0", "]", "!=", "'.'", ":", "git_command", "=", "'git -C \"%s\"'", "%", "_working_dirs", "["...
Run a git command Prefix that sub_command with "git " then run the command in shell If quiet if True then do not log results If no_edit is True then prefix the git command with "GIT_EDITOR=true" (which does not wait on user's editor) If the command gives a non-zero status, raise a Git...
[ "Run", "a", "git", "command" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L173-L214
242,510
jalanb/pysyte
pysyte/bash/git.py
branches
def branches(remotes=False): """Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch ...
python
def branches(remotes=False): """Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch ...
[ "def", "branches", "(", "remotes", "=", "False", ")", ":", "stdout", "=", "branch", "(", "'--list %s'", "%", "(", "remotes", "and", "'-a'", "or", "''", ")", ",", "quiet", "=", "True", ")", "return", "[", "_", ".", "lstrip", "(", "'*'", ")", ".", ...
Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch
[ "Return", "a", "list", "of", "all", "local", "branches", "in", "the", "repo" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L258-L268
242,511
jalanb/pysyte
pysyte/bash/git.py
branches_containing
def branches_containing(commit): """Return a list of branches conatining that commit""" lines = run('branch --contains %s' % commit).splitlines() return [l.lstrip('* ') for l in lines]
python
def branches_containing(commit): """Return a list of branches conatining that commit""" lines = run('branch --contains %s' % commit).splitlines() return [l.lstrip('* ') for l in lines]
[ "def", "branches_containing", "(", "commit", ")", ":", "lines", "=", "run", "(", "'branch --contains %s'", "%", "commit", ")", ".", "splitlines", "(", ")", "return", "[", "l", ".", "lstrip", "(", "'* '", ")", "for", "l", "in", "lines", "]" ]
Return a list of branches conatining that commit
[ "Return", "a", "list", "of", "branches", "conatining", "that", "commit" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L271-L274
242,512
jalanb/pysyte
pysyte/bash/git.py
conflicted
def conflicted(path_to_file): """Whether there are any conflict markers in that file""" for line in open(path_to_file, 'r'): for marker in '>="<': if line.startswith(marker * 8): return True return False
python
def conflicted(path_to_file): """Whether there are any conflict markers in that file""" for line in open(path_to_file, 'r'): for marker in '>="<': if line.startswith(marker * 8): return True return False
[ "def", "conflicted", "(", "path_to_file", ")", ":", "for", "line", "in", "open", "(", "path_to_file", ",", "'r'", ")", ":", "for", "marker", "in", "'>=\"<'", ":", "if", "line", ".", "startswith", "(", "marker", "*", "8", ")", ":", "return", "True", "...
Whether there are any conflict markers in that file
[ "Whether", "there", "are", "any", "conflict", "markers", "in", "that", "file" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L290-L296
242,513
jalanb/pysyte
pysyte/bash/git.py
config
def config(key, value, local=True): """Set that config key to that value Unless local is set to False: only change local config """ option = local and '--local' or '' run('config %s "%s" "%s"' % (option, key, value))
python
def config(key, value, local=True): """Set that config key to that value Unless local is set to False: only change local config """ option = local and '--local' or '' run('config %s "%s" "%s"' % (option, key, value))
[ "def", "config", "(", "key", ",", "value", ",", "local", "=", "True", ")", ":", "option", "=", "local", "and", "'--local'", "or", "''", "run", "(", "'config %s \"%s\" \"%s\"'", "%", "(", "option", ",", "key", ",", "value", ")", ")" ]
Set that config key to that value Unless local is set to False: only change local config
[ "Set", "that", "config", "key", "to", "that", "value" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L330-L336
242,514
jalanb/pysyte
pysyte/bash/git.py
clone
def clone(url, path=None, remove=True): """Clone a local repo from that URL to that path If path is not given, then use the git default: same as repo name If path is given and remove is True then the path is removed before cloning Because this is run from a script it is assumed that user shoul...
python
def clone(url, path=None, remove=True): """Clone a local repo from that URL to that path If path is not given, then use the git default: same as repo name If path is given and remove is True then the path is removed before cloning Because this is run from a script it is assumed that user shoul...
[ "def", "clone", "(", "url", ",", "path", "=", "None", ",", "remove", "=", "True", ")", ":", "clean", "=", "True", "if", "path", "and", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "if", "not", "remove", ":", "clean", "=", "False", "e...
Clone a local repo from that URL to that path If path is not given, then use the git default: same as repo name If path is given and remove is True then the path is removed before cloning Because this is run from a script it is assumed that user should be Admin so set config user values fo...
[ "Clone", "a", "local", "repo", "from", "that", "URL", "to", "that", "path" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L347-L374
242,515
jalanb/pysyte
pysyte/bash/git.py
needs_abort
def needs_abort(): """A command to abort an operation in progress For example a merge, cherry-pick or rebase If one of these operations has left the repo conflicted then give a command to abandon the operation """ for line in status().splitlines(): if '--abort' in line: ...
python
def needs_abort(): """A command to abort an operation in progress For example a merge, cherry-pick or rebase If one of these operations has left the repo conflicted then give a command to abandon the operation """ for line in status().splitlines(): if '--abort' in line: ...
[ "def", "needs_abort", "(", ")", ":", "for", "line", "in", "status", "(", ")", ".", "splitlines", "(", ")", ":", "if", "'--abort'", "in", "line", ":", "for", "part", "in", "line", ".", "split", "(", "'\"'", ")", ":", "if", "'--abort'", "in", "part",...
A command to abort an operation in progress For example a merge, cherry-pick or rebase If one of these operations has left the repo conflicted then give a command to abandon the operation
[ "A", "command", "to", "abort", "an", "operation", "in", "progress" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L386-L404
242,516
jalanb/pysyte
pysyte/bash/git.py
show_branches
def show_branches(branch1, branch2): """Runs git show-branch between the 2 branches, parse result""" def find_column(string): """Find first non space line in the prefix""" result = 0 for c in string: if c == ' ': result += 1 return result def par...
python
def show_branches(branch1, branch2): """Runs git show-branch between the 2 branches, parse result""" def find_column(string): """Find first non space line in the prefix""" result = 0 for c in string: if c == ' ': result += 1 return result def par...
[ "def", "show_branches", "(", "branch1", ",", "branch2", ")", ":", "def", "find_column", "(", "string", ")", ":", "\"\"\"Find first non space line in the prefix\"\"\"", "result", "=", "0", "for", "c", "in", "string", ":", "if", "c", "==", "' '", ":", "result", ...
Runs git show-branch between the 2 branches, parse result
[ "Runs", "git", "show", "-", "branch", "between", "the", "2", "branches", "parse", "result" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L429-L465
242,517
jalanb/pysyte
pysyte/bash/git.py
checkout
def checkout(branch, quiet=False, as_path=False): """Check out that branch Defaults to a quiet checkout, giving no stdout if stdout it wanted, call with quiet = False Defaults to checking out branches If as_path is true, then treat "branch" like a file, i.e. $ git checkout -- branc...
python
def checkout(branch, quiet=False, as_path=False): """Check out that branch Defaults to a quiet checkout, giving no stdout if stdout it wanted, call with quiet = False Defaults to checking out branches If as_path is true, then treat "branch" like a file, i.e. $ git checkout -- branc...
[ "def", "checkout", "(", "branch", ",", "quiet", "=", "False", ",", "as_path", "=", "False", ")", ":", "try", ":", "if", "as_path", ":", "branch", "=", "'-- %s'", "%", "branch", "run", "(", "'checkout %s %s'", "%", "(", "quiet", "and", "'-q'", "or", "...
Check out that branch Defaults to a quiet checkout, giving no stdout if stdout it wanted, call with quiet = False Defaults to checking out branches If as_path is true, then treat "branch" like a file, i.e. $ git checkout -- branch All errors will pass silently, just returning Fals...
[ "Check", "out", "that", "branch" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L509-L534
242,518
jalanb/pysyte
pysyte/bash/git.py
same_diffs
def same_diffs(commit1, commit2): """Whether those 2 commits have the same change Run "git range-diff" against 2 commit ranges: 1. parent of commit1 to commit1 1. parent of commit2 to commit2 If the two produce the same diff then git will only show header lines Header lines are pre...
python
def same_diffs(commit1, commit2): """Whether those 2 commits have the same change Run "git range-diff" against 2 commit ranges: 1. parent of commit1 to commit1 1. parent of commit2 to commit2 If the two produce the same diff then git will only show header lines Header lines are pre...
[ "def", "same_diffs", "(", "commit1", ",", "commit2", ")", ":", "def", "range_one", "(", "commit", ")", ":", "\"\"\"A git commit \"range\" to include only one commit\"\"\"", "return", "'%s^..%s'", "%", "(", "commit", ",", "commit", ")", "output", "=", "run", "(", ...
Whether those 2 commits have the same change Run "git range-diff" against 2 commit ranges: 1. parent of commit1 to commit1 1. parent of commit2 to commit2 If the two produce the same diff then git will only show header lines Header lines are prefixed like "1: ...." Otherwise there ...
[ "Whether", "those", "2", "commits", "have", "the", "same", "change" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L545-L566
242,519
jalanb/pysyte
pysyte/bash/git.py
renew_local_branch
def renew_local_branch(branch, start_point, remote=False): """Make a new local branch from that start_point start_point is a git "commit-ish", e.g branch, tag, commit If a local branch already exists it is removed If remote is true then push the new branch to origin """ if branch in branches()...
python
def renew_local_branch(branch, start_point, remote=False): """Make a new local branch from that start_point start_point is a git "commit-ish", e.g branch, tag, commit If a local branch already exists it is removed If remote is true then push the new branch to origin """ if branch in branches()...
[ "def", "renew_local_branch", "(", "branch", ",", "start_point", ",", "remote", "=", "False", ")", ":", "if", "branch", "in", "branches", "(", ")", ":", "checkout", "(", "start_point", ")", "delete", "(", "branch", ",", "force", "=", "True", ",", "remote"...
Make a new local branch from that start_point start_point is a git "commit-ish", e.g branch, tag, commit If a local branch already exists it is removed If remote is true then push the new branch to origin
[ "Make", "a", "new", "local", "branch", "from", "that", "start_point" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L582-L596
242,520
jalanb/pysyte
pysyte/bash/git.py
publish
def publish(branch, full_force=False): """Publish that branch, i.e. push it to origin""" checkout(branch) try: push('--force --set-upstream origin', branch) except ExistingReference: if full_force: push('origin --delete', branch) push('--force --set-upstream origi...
python
def publish(branch, full_force=False): """Publish that branch, i.e. push it to origin""" checkout(branch) try: push('--force --set-upstream origin', branch) except ExistingReference: if full_force: push('origin --delete', branch) push('--force --set-upstream origi...
[ "def", "publish", "(", "branch", ",", "full_force", "=", "False", ")", ":", "checkout", "(", "branch", ")", "try", ":", "push", "(", "'--force --set-upstream origin'", ",", "branch", ")", "except", "ExistingReference", ":", "if", "full_force", ":", "push", "...
Publish that branch, i.e. push it to origin
[ "Publish", "that", "branch", "i", ".", "e", ".", "push", "it", "to", "origin" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L615-L623
242,521
jalanb/pysyte
pysyte/bash/git.py
commit
def commit(message, add=False, quiet=False): """Commit with that message and return the SHA1 of the commit If add is truish then "$ git add ." first """ if add: run('add .') try: stdout = run('commit -m %r' % str(message), quiet=quiet) except GitError as e: s = str(e) ...
python
def commit(message, add=False, quiet=False): """Commit with that message and return the SHA1 of the commit If add is truish then "$ git add ." first """ if add: run('add .') try: stdout = run('commit -m %r' % str(message), quiet=quiet) except GitError as e: s = str(e) ...
[ "def", "commit", "(", "message", ",", "add", "=", "False", ",", "quiet", "=", "False", ")", ":", "if", "add", ":", "run", "(", "'add .'", ")", "try", ":", "stdout", "=", "run", "(", "'commit -m %r'", "%", "str", "(", "message", ")", ",", "quiet", ...
Commit with that message and return the SHA1 of the commit If add is truish then "$ git add ." first
[ "Commit", "with", "that", "message", "and", "return", "the", "SHA1", "of", "the", "commit" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L646-L660
242,522
jalanb/pysyte
pysyte/bash/git.py
pull
def pull(rebase=True, refspec=None): """Pull refspec from remote repository to local If refspec is left as None, then pull current branch The '--rebase' option is used unless rebase is set to false """ options = rebase and '--rebase' or '' output = run('pull %s %s' % (options, refspec or '')) ...
python
def pull(rebase=True, refspec=None): """Pull refspec from remote repository to local If refspec is left as None, then pull current branch The '--rebase' option is used unless rebase is set to false """ options = rebase and '--rebase' or '' output = run('pull %s %s' % (options, refspec or '')) ...
[ "def", "pull", "(", "rebase", "=", "True", ",", "refspec", "=", "None", ")", ":", "options", "=", "rebase", "and", "'--rebase'", "or", "''", "output", "=", "run", "(", "'pull %s %s'", "%", "(", "options", ",", "refspec", "or", "''", ")", ")", "return...
Pull refspec from remote repository to local If refspec is left as None, then pull current branch The '--rebase' option is used unless rebase is set to false
[ "Pull", "refspec", "from", "remote", "repository", "to", "local" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L663-L671
242,523
jalanb/pysyte
pysyte/bash/git.py
rebase
def rebase(upstream, branch=None): """Rebase branch onto upstream If branch is empty, use current branch """ rebase_branch = branch and branch or current_branch() with git_continuer(run, 'rebase --continue', no_edit=True): stdout = run('rebase %s %s' % (upstream, rebase_branch)) re...
python
def rebase(upstream, branch=None): """Rebase branch onto upstream If branch is empty, use current branch """ rebase_branch = branch and branch or current_branch() with git_continuer(run, 'rebase --continue', no_edit=True): stdout = run('rebase %s %s' % (upstream, rebase_branch)) re...
[ "def", "rebase", "(", "upstream", ",", "branch", "=", "None", ")", ":", "rebase_branch", "=", "branch", "and", "branch", "or", "current_branch", "(", ")", "with", "git_continuer", "(", "run", ",", "'rebase --continue'", ",", "no_edit", "=", "True", ")", ":...
Rebase branch onto upstream If branch is empty, use current branch
[ "Rebase", "branch", "onto", "upstream" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L762-L771
242,524
larsks/thecache
thecache/cache.py
tempfile_writer
def tempfile_writer(target): '''write cache data to a temporary location. when writing is complete, rename the file to the actual location. delete the temporary file on any error''' tmp = target.parent / ('_%s' % target.name) try: with tmp.open('wb') as fd: yield fd except:...
python
def tempfile_writer(target): '''write cache data to a temporary location. when writing is complete, rename the file to the actual location. delete the temporary file on any error''' tmp = target.parent / ('_%s' % target.name) try: with tmp.open('wb') as fd: yield fd except:...
[ "def", "tempfile_writer", "(", "target", ")", ":", "tmp", "=", "target", ".", "parent", "/", "(", "'_%s'", "%", "target", ".", "name", ")", "try", ":", "with", "tmp", ".", "open", "(", "'wb'", ")", "as", "fd", ":", "yield", "fd", "except", ":", "...
write cache data to a temporary location. when writing is complete, rename the file to the actual location. delete the temporary file on any error
[ "write", "cache", "data", "to", "a", "temporary", "location", ".", "when", "writing", "is", "complete", "rename", "the", "file", "to", "the", "actual", "location", ".", "delete", "the", "temporary", "file", "on", "any", "error" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L46-L58
242,525
larsks/thecache
thecache/cache.py
Cache.xform_key
def xform_key(self, key): '''we transform cache keys by taking their sha1 hash so that we don't need to worry about cache keys containing invalid characters''' newkey = hashlib.sha1(key.encode('utf-8')) return newkey.hexdigest()
python
def xform_key(self, key): '''we transform cache keys by taking their sha1 hash so that we don't need to worry about cache keys containing invalid characters''' newkey = hashlib.sha1(key.encode('utf-8')) return newkey.hexdigest()
[ "def", "xform_key", "(", "self", ",", "key", ")", ":", "newkey", "=", "hashlib", ".", "sha1", "(", "key", ".", "encode", "(", "'utf-8'", ")", ")", "return", "newkey", ".", "hexdigest", "(", ")" ]
we transform cache keys by taking their sha1 hash so that we don't need to worry about cache keys containing invalid characters
[ "we", "transform", "cache", "keys", "by", "taking", "their", "sha1", "hash", "so", "that", "we", "don", "t", "need", "to", "worry", "about", "cache", "keys", "containing", "invalid", "characters" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L104-L110
242,526
larsks/thecache
thecache/cache.py
Cache.invalidate
def invalidate(self, key): '''Clear an item from the cache''' path = self.path(self.xform_key(key)) try: LOG.debug('invalidate %s (%s)', key, path) path.unlink() except OSError: pass
python
def invalidate(self, key): '''Clear an item from the cache''' path = self.path(self.xform_key(key)) try: LOG.debug('invalidate %s (%s)', key, path) path.unlink() except OSError: pass
[ "def", "invalidate", "(", "self", ",", "key", ")", ":", "path", "=", "self", ".", "path", "(", "self", ".", "xform_key", "(", "key", ")", ")", "try", ":", "LOG", ".", "debug", "(", "'invalidate %s (%s)'", ",", "key", ",", "path", ")", "path", ".", ...
Clear an item from the cache
[ "Clear", "an", "item", "from", "the", "cache" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L112-L119
242,527
larsks/thecache
thecache/cache.py
Cache.invalidate_all
def invalidate_all(self): '''Clear all items from the cache''' LOG.debug('clearing cache') appcache = str(self.get_app_cache()) for dirpath, dirnames, filenames in os.walk(appcache): for name in filenames: try: pathlib.Path(dirpath, name)....
python
def invalidate_all(self): '''Clear all items from the cache''' LOG.debug('clearing cache') appcache = str(self.get_app_cache()) for dirpath, dirnames, filenames in os.walk(appcache): for name in filenames: try: pathlib.Path(dirpath, name)....
[ "def", "invalidate_all", "(", "self", ")", ":", "LOG", ".", "debug", "(", "'clearing cache'", ")", "appcache", "=", "str", "(", "self", ".", "get_app_cache", "(", ")", ")", "for", "dirpath", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "...
Clear all items from the cache
[ "Clear", "all", "items", "from", "the", "cache" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L121-L131
242,528
larsks/thecache
thecache/cache.py
Cache.store_iter
def store_iter(self, key, content): '''stores content in the cache by iterating over content''' cachekey = self.xform_key(key) path = self.path(cachekey) with tempfile_writer(path) as fd: for data in content: LOG.debug('writing chunk of %d bytes for %...
python
def store_iter(self, key, content): '''stores content in the cache by iterating over content''' cachekey = self.xform_key(key) path = self.path(cachekey) with tempfile_writer(path) as fd: for data in content: LOG.debug('writing chunk of %d bytes for %...
[ "def", "store_iter", "(", "self", ",", "key", ",", "content", ")", ":", "cachekey", "=", "self", ".", "xform_key", "(", "key", ")", "path", "=", "self", ".", "path", "(", "cachekey", ")", "with", "tempfile_writer", "(", "path", ")", "as", "fd", ":", ...
stores content in the cache by iterating over content
[ "stores", "content", "in", "the", "cache", "by", "iterating", "over", "content" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L133-L144
242,529
larsks/thecache
thecache/cache.py
Cache.store_lines
def store_lines(self, key, content): '''like store_iter, but appends a newline to each chunk of content''' return self.store_iter( key, (data + '\n'.encode('utf-8') for data in content))
python
def store_lines(self, key, content): '''like store_iter, but appends a newline to each chunk of content''' return self.store_iter( key, (data + '\n'.encode('utf-8') for data in content))
[ "def", "store_lines", "(", "self", ",", "key", ",", "content", ")", ":", "return", "self", ".", "store_iter", "(", "key", ",", "(", "data", "+", "'\\n'", ".", "encode", "(", "'utf-8'", ")", "for", "data", "in", "content", ")", ")" ]
like store_iter, but appends a newline to each chunk of content
[ "like", "store_iter", "but", "appends", "a", "newline", "to", "each", "chunk", "of", "content" ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L146-L151
242,530
larsks/thecache
thecache/cache.py
Cache.load_fd
def load_fd(self, key, noexpire=False): '''Look up an item in the cache and return an open file descriptor for the object. It is the caller's responsibility to close the file descriptor.''' cachekey = self.xform_key(key) path = self.path(cachekey) try: stat...
python
def load_fd(self, key, noexpire=False): '''Look up an item in the cache and return an open file descriptor for the object. It is the caller's responsibility to close the file descriptor.''' cachekey = self.xform_key(key) path = self.path(cachekey) try: stat...
[ "def", "load_fd", "(", "self", ",", "key", ",", "noexpire", "=", "False", ")", ":", "cachekey", "=", "self", ".", "xform_key", "(", "key", ")", "path", "=", "self", ".", "path", "(", "cachekey", ")", "try", ":", "stat", "=", "path", ".", "stat", ...
Look up an item in the cache and return an open file descriptor for the object. It is the caller's responsibility to close the file descriptor.
[ "Look", "up", "an", "item", "in", "the", "cache", "and", "return", "an", "open", "file", "descriptor", "for", "the", "object", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "close", "the", "file", "descriptor", "." ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L174-L193
242,531
larsks/thecache
thecache/cache.py
Cache.load_lines
def load_lines(self, key, noexpire=None): '''Look up up an item in the cache and return a line iterator. The underlying file will be closed once all lines have been consumed.''' return line_iterator(self.load_fd(key, noexpire=noexpire))
python
def load_lines(self, key, noexpire=None): '''Look up up an item in the cache and return a line iterator. The underlying file will be closed once all lines have been consumed.''' return line_iterator(self.load_fd(key, noexpire=noexpire))
[ "def", "load_lines", "(", "self", ",", "key", ",", "noexpire", "=", "None", ")", ":", "return", "line_iterator", "(", "self", ".", "load_fd", "(", "key", ",", "noexpire", "=", "noexpire", ")", ")" ]
Look up up an item in the cache and return a line iterator. The underlying file will be closed once all lines have been consumed.
[ "Look", "up", "up", "an", "item", "in", "the", "cache", "and", "return", "a", "line", "iterator", ".", "The", "underlying", "file", "will", "be", "closed", "once", "all", "lines", "have", "been", "consumed", "." ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L195-L199
242,532
larsks/thecache
thecache/cache.py
Cache.load_iter
def load_iter(self, key, chunksize=None, noexpire=None): '''Lookup an item in the cache and return an iterator that reads chunksize bytes of data at a time. The underlying file will be closed when all data has been read''' return chunk_iterator(self.load_fd(key, noexpire=noexpire), ...
python
def load_iter(self, key, chunksize=None, noexpire=None): '''Lookup an item in the cache and return an iterator that reads chunksize bytes of data at a time. The underlying file will be closed when all data has been read''' return chunk_iterator(self.load_fd(key, noexpire=noexpire), ...
[ "def", "load_iter", "(", "self", ",", "key", ",", "chunksize", "=", "None", ",", "noexpire", "=", "None", ")", ":", "return", "chunk_iterator", "(", "self", ".", "load_fd", "(", "key", ",", "noexpire", "=", "noexpire", ")", ",", "chunksize", "=", "chun...
Lookup an item in the cache and return an iterator that reads chunksize bytes of data at a time. The underlying file will be closed when all data has been read
[ "Lookup", "an", "item", "in", "the", "cache", "and", "return", "an", "iterator", "that", "reads", "chunksize", "bytes", "of", "data", "at", "a", "time", ".", "The", "underlying", "file", "will", "be", "closed", "when", "all", "data", "has", "been", "read...
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L201-L206
242,533
larsks/thecache
thecache/cache.py
Cache.load
def load(self, key, noexpire=None): '''Lookup an item in the cache and return the raw content of the file as a string.''' with self.load_fd(key, noexpire=noexpire) as fd: return fd.read()
python
def load(self, key, noexpire=None): '''Lookup an item in the cache and return the raw content of the file as a string.''' with self.load_fd(key, noexpire=noexpire) as fd: return fd.read()
[ "def", "load", "(", "self", ",", "key", ",", "noexpire", "=", "None", ")", ":", "with", "self", ".", "load_fd", "(", "key", ",", "noexpire", "=", "noexpire", ")", "as", "fd", ":", "return", "fd", ".", "read", "(", ")" ]
Lookup an item in the cache and return the raw content of the file as a string.
[ "Lookup", "an", "item", "in", "the", "cache", "and", "return", "the", "raw", "content", "of", "the", "file", "as", "a", "string", "." ]
e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0
https://github.com/larsks/thecache/blob/e535f91031a7f92f19b5ff6fe2a1a03c7680e9e0/thecache/cache.py#L208-L212
242,534
jerith/txTwitter
txtwitter/twitter.py
set_bool_param
def set_bool_param(params, name, value): """ Set a boolean parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param bool value: The value of the parameter. If ``None``, the field will not be set. If ...
python
def set_bool_param(params, name, value): """ Set a boolean parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param bool value: The value of the parameter. If ``None``, the field will not be set. If ...
[ "def", "set_bool_param", "(", "params", ",", "name", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "if", "value", "is", "True", ":", "params", "[", "name", "]", "=", "'true'", "elif", "value", "is", "False", ":", "params", "[", ...
Set a boolean parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param bool value: The value of the parameter. If ``None``, the field will not be set. If ``True`` or ``False``, the relevant field in ``par...
[ "Set", "a", "boolean", "parameter", "if", "applicable", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L34-L58
242,535
jerith/txTwitter
txtwitter/twitter.py
set_str_param
def set_str_param(params, name, value): """ Set a string parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param value: The value of the parameter. If ``None``, the field will not be set. If an i...
python
def set_str_param(params, name, value): """ Set a string parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param value: The value of the parameter. If ``None``, the field will not be set. If an i...
[ "def", "set_str_param", "(", "params", ",", "name", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "if", "isinstance", "(", "value", ",", "str", ")", ":", "params", "[", "name", "]", "=", "value", "elif", "isinstance", "(", "valu...
Set a string parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param value: The value of the parameter. If ``None``, the field will not be set. If an instance of ``str``, the relevant field will be set. ...
[ "Set", "a", "string", "parameter", "if", "applicable", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L61-L86
242,536
jerith/txTwitter
txtwitter/twitter.py
set_float_param
def set_float_param(params, name, value, min=None, max=None): """ Set a float parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param float value: The value of the parameter. If ``None``, the field will ...
python
def set_float_param(params, name, value, min=None, max=None): """ Set a float parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param float value: The value of the parameter. If ``None``, the field will ...
[ "def", "set_float_param", "(", "params", ",", "name", ",", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "try", ":", "value", "=", "float", "(", "str", "(", "value", ")", ")", "ex...
Set a float parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param float value: The value of the parameter. If ``None``, the field will not be set. If an instance of a numeric type or a string that can ...
[ "Set", "a", "float", "parameter", "if", "applicable", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L89-L129
242,537
jerith/txTwitter
txtwitter/twitter.py
set_int_param
def set_int_param(params, name, value, min=None, max=None): """ Set a int parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param int value: The value of the parameter. If ``None``, the field will not be...
python
def set_int_param(params, name, value, min=None, max=None): """ Set a int parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param int value: The value of the parameter. If ``None``, the field will not be...
[ "def", "set_int_param", "(", "params", ",", "name", ",", "value", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "try", ":", "value", "=", "int", "(", "str", "(", "value", ")", ")", "except...
Set a int parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param int value: The value of the parameter. If ``None``, the field will not be set. If an instance of a numeric type or a string that can be t...
[ "Set", "a", "int", "parameter", "if", "applicable", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L132-L172
242,538
jerith/txTwitter
txtwitter/twitter.py
set_list_param
def set_list_param(params, name, value, min_len=None, max_len=None): """ Set a list parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param list value: The value of the parameter. If ``None``, the field ...
python
def set_list_param(params, name, value, min_len=None, max_len=None): """ Set a list parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param list value: The value of the parameter. If ``None``, the field ...
[ "def", "set_list_param", "(", "params", ",", "name", ",", "value", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ")", ":", "if", "value", "is", "None", ":", "return", "if", "type", "(", "value", ")", "is", "dict", ":", "raise", "ValueErro...
Set a list parameter if applicable. :param dict params: A dict containing API call parameters. :param str name: The name of the parameter to set. :param list value: The value of the parameter. If ``None``, the field will not be set. If an instance of ``set``, ``tuple``, or type that can b...
[ "Set", "a", "list", "parameter", "if", "applicable", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L175-L221
242,539
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_user_timeline
def statuses_user_timeline(self, user_id=None, screen_name=None, since_id=None, count=None, max_id=None, trim_user=None, exclude_replies=None, contributor_details=None, include_rts=None): ...
python
def statuses_user_timeline(self, user_id=None, screen_name=None, since_id=None, count=None, max_id=None, trim_user=None, exclude_replies=None, contributor_details=None, include_rts=None): ...
[ "def", "statuses_user_timeline", "(", "self", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ",", "since_id", "=", "None", ",", "count", "=", "None", ",", "max_id", "=", "None", ",", "trim_user", "=", "None", ",", "exclude_replies", "=", "...
Returns a list of the most recent tweets posted by the specified user. https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline Either ``user_id`` or ``screen_name`` must be provided. :param str user_id: The ID of the user to return tweets for. :param str screen_na...
[ "Returns", "a", "list", "of", "the", "most", "recent", "tweets", "posted", "by", "the", "specified", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L393-L451
242,540
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_home_timeline
def statuses_home_timeline(self, count=None, since_id=None, max_id=None, trim_user=None, exclude_replies=None, contributor_details=None, include_entities=None): """ Returns a collection of the most recent Tweets...
python
def statuses_home_timeline(self, count=None, since_id=None, max_id=None, trim_user=None, exclude_replies=None, contributor_details=None, include_entities=None): """ Returns a collection of the most recent Tweets...
[ "def", "statuses_home_timeline", "(", "self", ",", "count", "=", "None", ",", "since_id", "=", "None", ",", "max_id", "=", "None", ",", "trim_user", "=", "None", ",", "exclude_replies", "=", "None", ",", "contributor_details", "=", "None", ",", "include_enti...
Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow. https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline :param int count: Specifies the number of tweets to try and retrieve, up to a maximum ...
[ "Returns", "a", "collection", "of", "the", "most", "recent", "Tweets", "and", "retweets", "posted", "by", "the", "authenticating", "user", "and", "the", "users", "they", "follow", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L453-L501
242,541
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_retweets
def statuses_retweets(self, id, count=None, trim_user=None): """ Returns a list of the most recent retweets of the Tweet specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/%3Aid :param str id: (*required*) The numerical ID of t...
python
def statuses_retweets(self, id, count=None, trim_user=None): """ Returns a list of the most recent retweets of the Tweet specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/%3Aid :param str id: (*required*) The numerical ID of t...
[ "def", "statuses_retweets", "(", "self", ",", "id", ",", "count", "=", "None", ",", "trim_user", "=", "None", ")", ":", "params", "=", "{", "'id'", ":", "id", "}", "set_int_param", "(", "params", ",", "'count'", ",", "count", ")", "set_bool_param", "("...
Returns a list of the most recent retweets of the Tweet specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param int count: The maximum number of re...
[ "Returns", "a", "list", "of", "the", "most", "recent", "retweets", "of", "the", "Tweet", "specified", "by", "the", "id", "parameter", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L507-L529
242,542
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_show
def statuses_show(self, id, trim_user=None, include_my_retweet=None, include_entities=None): """ Returns a single Tweet, specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid :param str id: (*required*) The numeric...
python
def statuses_show(self, id, trim_user=None, include_my_retweet=None, include_entities=None): """ Returns a single Tweet, specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid :param str id: (*required*) The numeric...
[ "def", "statuses_show", "(", "self", ",", "id", ",", "trim_user", "=", "None", ",", "include_my_retweet", "=", "None", ",", "include_entities", "=", "None", ")", ":", "params", "=", "{", "'id'", ":", "id", "}", "set_bool_param", "(", "params", ",", "'tri...
Returns a single Tweet, specified by the id parameter. https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: When set to ``True``, the tweet's user object includes only the...
[ "Returns", "a", "single", "Tweet", "specified", "by", "the", "id", "parameter", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L531-L560
242,543
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_destroy
def statuses_destroy(self, id, trim_user=None): """ Destroys the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: ...
python
def statuses_destroy(self, id, trim_user=None): """ Destroys the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: ...
[ "def", "statuses_destroy", "(", "self", ",", "id", ",", "trim_user", "=", "None", ")", ":", "params", "=", "{", "'id'", ":", "id", "}", "set_bool_param", "(", "params", ",", "'trim_user'", ",", "trim_user", ")", "return", "self", ".", "_post_api", "(", ...
Destroys the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: When set to ``True``, the return value's user object includes o...
[ "Destroys", "the", "status", "specified", "by", "the", "ID", "parameter", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L562-L580
242,544
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_update
def statuses_update(self, status, in_reply_to_status_id=None, lat=None, long=None, place_id=None, display_coordinates=None, trim_user=None, media_ids=None): """ Posts a tweet. https://dev.twitter.com/docs/api/1.1/post/statuses/update :par...
python
def statuses_update(self, status, in_reply_to_status_id=None, lat=None, long=None, place_id=None, display_coordinates=None, trim_user=None, media_ids=None): """ Posts a tweet. https://dev.twitter.com/docs/api/1.1/post/statuses/update :par...
[ "def", "statuses_update", "(", "self", ",", "status", ",", "in_reply_to_status_id", "=", "None", ",", "lat", "=", "None", ",", "long", "=", "None", ",", "place_id", "=", "None", ",", "display_coordinates", "=", "None", ",", "trim_user", "=", "None", ",", ...
Posts a tweet. https://dev.twitter.com/docs/api/1.1/post/statuses/update :param str status: (*required*) The text of your tweet, typically up to 140 characters. URL encode as necessary. t.co link wrapping may affect character counts. There are some spec...
[ "Posts", "a", "tweet", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L582-L650
242,545
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.statuses_retweet
def statuses_retweet(self, id, trim_user=None): """ Retweets the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: ...
python
def statuses_retweet(self, id, trim_user=None): """ Retweets the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: ...
[ "def", "statuses_retweet", "(", "self", ",", "id", ",", "trim_user", "=", "None", ")", ":", "params", "=", "{", "'id'", ":", "id", "}", "set_bool_param", "(", "params", ",", "'trim_user'", ",", "trim_user", ")", "return", "self", ".", "_post_api", "(", ...
Retweets the status specified by the ID parameter. https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/%3Aid :param str id: (*required*) The numerical ID of the desired tweet. :param bool trim_user: When set to ``True``, the return value's user object includes o...
[ "Retweets", "the", "status", "specified", "by", "the", "ID", "parameter", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L652-L671
242,546
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.media_upload
def media_upload(self, media, additional_owners=None): """ Uploads an image to Twitter for later embedding in tweets. https://dev.twitter.com/rest/reference/post/media/upload :param file media: The image file to upload (see the API docs for limitations). :param lis...
python
def media_upload(self, media, additional_owners=None): """ Uploads an image to Twitter for later embedding in tweets. https://dev.twitter.com/rest/reference/post/media/upload :param file media: The image file to upload (see the API docs for limitations). :param lis...
[ "def", "media_upload", "(", "self", ",", "media", ",", "additional_owners", "=", "None", ")", ":", "params", "=", "{", "}", "set_list_param", "(", "params", ",", "'additional_owners'", ",", "additional_owners", ",", "max_len", "=", "100", ")", "return", "sel...
Uploads an image to Twitter for later embedding in tweets. https://dev.twitter.com/rest/reference/post/media/upload :param file media: The image file to upload (see the API docs for limitations). :param list additional_owners: A list of Twitter users that will be able ...
[ "Uploads", "an", "image", "to", "Twitter", "for", "later", "embedding", "in", "tweets", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L673-L693
242,547
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.stream_filter
def stream_filter(self, delegate, follow=None, track=None, locations=None, stall_warnings=None): """ Streams public messages filtered by various parameters. https://dev.twitter.com/docs/api/1.1/post/statuses/filter At least one of ``follow``, ``track``, or ``locat...
python
def stream_filter(self, delegate, follow=None, track=None, locations=None, stall_warnings=None): """ Streams public messages filtered by various parameters. https://dev.twitter.com/docs/api/1.1/post/statuses/filter At least one of ``follow``, ``track``, or ``locat...
[ "def", "stream_filter", "(", "self", ",", "delegate", ",", "follow", "=", "None", ",", "track", "=", "None", ",", "locations", "=", "None", ",", "stall_warnings", "=", "None", ")", ":", "params", "=", "{", "}", "if", "follow", "is", "not", "None", ":...
Streams public messages filtered by various parameters. https://dev.twitter.com/docs/api/1.1/post/statuses/filter At least one of ``follow``, ``track``, or ``locations`` must be provided. See the API documentation linked above for details on these parameters and the various limits on t...
[ "Streams", "public", "messages", "filtered", "by", "various", "parameters", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L705-L752
242,548
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.userstream_user
def userstream_user(self, delegate, stall_warnings=None, with_='followings', replies=None): """ Streams messages for a single user. https://dev.twitter.com/docs/api/1.1/get/user The ``stringify_friend_ids`` parameter is always set to ``'true'`` for consi...
python
def userstream_user(self, delegate, stall_warnings=None, with_='followings', replies=None): """ Streams messages for a single user. https://dev.twitter.com/docs/api/1.1/get/user The ``stringify_friend_ids`` parameter is always set to ``'true'`` for consi...
[ "def", "userstream_user", "(", "self", ",", "delegate", ",", "stall_warnings", "=", "None", ",", "with_", "=", "'followings'", ",", "replies", "=", "None", ")", ":", "params", "=", "{", "'stringify_friend_ids'", ":", "'true'", "}", "set_bool_param", "(", "pa...
Streams messages for a single user. https://dev.twitter.com/docs/api/1.1/get/user The ``stringify_friend_ids`` parameter is always set to ``'true'`` for consistency with the use of string identifiers elsewhere. :param delegate: A delegate function that will be called for e...
[ "Streams", "messages", "for", "a", "single", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L757-L799
242,549
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.direct_messages
def direct_messages(self, since_id=None, max_id=None, count=None, include_entities=None, skip_status=None): """ Gets the 20 most recent direct messages received by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages :param s...
python
def direct_messages(self, since_id=None, max_id=None, count=None, include_entities=None, skip_status=None): """ Gets the 20 most recent direct messages received by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages :param s...
[ "def", "direct_messages", "(", "self", ",", "since_id", "=", "None", ",", "max_id", "=", "None", ",", "count", "=", "None", ",", "include_entities", "=", "None", ",", "skip_status", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", ...
Gets the 20 most recent direct messages received by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages :param str since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the numbe...
[ "Gets", "the", "20", "most", "recent", "direct", "messages", "received", "by", "the", "authenticating", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L803-L844
242,550
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.direct_messages_sent
def direct_messages_sent(self, since_id=None, max_id=None, count=None, include_entities=None, page=None): """ Gets the 20 most recent direct messages sent by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent :par...
python
def direct_messages_sent(self, since_id=None, max_id=None, count=None, include_entities=None, page=None): """ Gets the 20 most recent direct messages sent by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent :par...
[ "def", "direct_messages_sent", "(", "self", ",", "since_id", "=", "None", ",", "max_id", "=", "None", ",", "count", "=", "None", ",", "include_entities", "=", "None", ",", "page", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "p...
Gets the 20 most recent direct messages sent by the authenticating user. https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent :param str since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the numb...
[ "Gets", "the", "20", "most", "recent", "direct", "messages", "sent", "by", "the", "authenticating", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L846-L884
242,551
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.direct_messages_show
def direct_messages_show(self, id): """ Gets the direct message with the given id. https://dev.twitter.com/docs/api/1.1/get/direct_messages/show :param str id: (*required*) The ID of the direct message. :returns: A direct message dict. """ ...
python
def direct_messages_show(self, id): """ Gets the direct message with the given id. https://dev.twitter.com/docs/api/1.1/get/direct_messages/show :param str id: (*required*) The ID of the direct message. :returns: A direct message dict. """ ...
[ "def", "direct_messages_show", "(", "self", ",", "id", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'id'", ",", "id", ")", "d", "=", "self", ".", "_get_api", "(", "'direct_messages/show.json'", ",", "params", ")", "d", ".", ...
Gets the direct message with the given id. https://dev.twitter.com/docs/api/1.1/get/direct_messages/show :param str id: (*required*) The ID of the direct message. :returns: A direct message dict.
[ "Gets", "the", "direct", "message", "with", "the", "given", "id", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L886-L902
242,552
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.direct_messages_destroy
def direct_messages_destroy(self, id, include_entities=None): """ Destroys the direct message with the given id. https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy :param str id: (*required*) The ID of the direct message. :param bool include_entities:...
python
def direct_messages_destroy(self, id, include_entities=None): """ Destroys the direct message with the given id. https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy :param str id: (*required*) The ID of the direct message. :param bool include_entities:...
[ "def", "direct_messages_destroy", "(", "self", ",", "id", ",", "include_entities", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'id'", ",", "id", ")", "set_bool_param", "(", "params", ",", "'include_entities'", ",", ...
Destroys the direct message with the given id. https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy :param str id: (*required*) The ID of the direct message. :param bool include_entities: The entities node will not be included when set to ``False``. ...
[ "Destroys", "the", "direct", "message", "with", "the", "given", "id", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L904-L921
242,553
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.direct_messages_new
def direct_messages_new(self, text, user_id=None, screen_name=None): """ Sends a new direct message to the given user from the authenticating user. https://dev.twitter.com/docs/api/1.1/post/direct_messages/new :param str text: (*required*) The text of your direct me...
python
def direct_messages_new(self, text, user_id=None, screen_name=None): """ Sends a new direct message to the given user from the authenticating user. https://dev.twitter.com/docs/api/1.1/post/direct_messages/new :param str text: (*required*) The text of your direct me...
[ "def", "direct_messages_new", "(", "self", ",", "text", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'text'", ",", "text", ")", "set_str_param", "(", "params", ",",...
Sends a new direct message to the given user from the authenticating user. https://dev.twitter.com/docs/api/1.1/post/direct_messages/new :param str text: (*required*) The text of your direct message. :param str user_id: The ID of the user who should receive the ...
[ "Sends", "a", "new", "direct", "message", "to", "the", "given", "user", "from", "the", "authenticating", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L923-L946
242,554
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.friendships_create
def friendships_create(self, user_id=None, screen_name=None, follow=None): """ Allows the authenticating users to follow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/create :param str user_id: The screen name of the us...
python
def friendships_create(self, user_id=None, screen_name=None, follow=None): """ Allows the authenticating users to follow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/create :param str user_id: The screen name of the us...
[ "def", "friendships_create", "(", "self", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ",", "follow", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'user_id'", ",", "user_id", ")", "set_str_param", ...
Allows the authenticating users to follow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/create :param str user_id: The screen name of the user for whom to befriend. Required if ``screen_name`` isn't given. :param str screen_name: ...
[ "Allows", "the", "authenticating", "users", "to", "follow", "the", "specified", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L961-L984
242,555
jerith/txTwitter
txtwitter/twitter.py
TwitterClient.friendships_destroy
def friendships_destroy(self, user_id=None, screen_name=None): """ Allows the authenticating user to unfollow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/destroy :param str user_id: The screen name of the user for whom to unfollow. Required if ...
python
def friendships_destroy(self, user_id=None, screen_name=None): """ Allows the authenticating user to unfollow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/destroy :param str user_id: The screen name of the user for whom to unfollow. Required if ...
[ "def", "friendships_destroy", "(", "self", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'user_id'", ",", "user_id", ")", "set_str_param", "(", "params", ",", "'screen...
Allows the authenticating user to unfollow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/destroy :param str user_id: The screen name of the user for whom to unfollow. Required if ``screen_name`` isn't given. :param str screen_name: ...
[ "Allows", "the", "authenticating", "user", "to", "unfollow", "the", "specified", "user", "." ]
f07afd21184cd1bee697737bf98fd143378dbdff
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L986-L1005
242,556
pwyliu/clancy
clancy/redoctober.py
api_call
def api_call(endpoint, args, payload): """ Generic function to call the RO API """ headers = {'content-type': 'application/json; ; charset=utf-8'} url = 'https://{}/{}'.format(args['--server'], endpoint) attempt = 0 resp = None while True: try: attempt += 1 ...
python
def api_call(endpoint, args, payload): """ Generic function to call the RO API """ headers = {'content-type': 'application/json; ; charset=utf-8'} url = 'https://{}/{}'.format(args['--server'], endpoint) attempt = 0 resp = None while True: try: attempt += 1 ...
[ "def", "api_call", "(", "endpoint", ",", "args", ",", "payload", ")", ":", "headers", "=", "{", "'content-type'", ":", "'application/json; ; charset=utf-8'", "}", "url", "=", "'https://{}/{}'", ".", "format", "(", "args", "[", "'--server'", "]", ",", "endpoint...
Generic function to call the RO API
[ "Generic", "function", "to", "call", "the", "RO", "API" ]
cb15a5e2bb735ffce7a84b8413b04faa78c5039c
https://github.com/pwyliu/clancy/blob/cb15a5e2bb735ffce7a84b8413b04faa78c5039c/clancy/redoctober.py#L9-L40
242,557
lvh/axiombench
axiombench/update.py
benchmark
def benchmark(store, n=10000): """ Increments an integer count n times. """ x = UpdatableItem(store=store, count=0) for _ in xrange(n): x.count += 1
python
def benchmark(store, n=10000): """ Increments an integer count n times. """ x = UpdatableItem(store=store, count=0) for _ in xrange(n): x.count += 1
[ "def", "benchmark", "(", "store", ",", "n", "=", "10000", ")", ":", "x", "=", "UpdatableItem", "(", "store", "=", "store", ",", "count", "=", "0", ")", "for", "_", "in", "xrange", "(", "n", ")", ":", "x", ".", "count", "+=", "1" ]
Increments an integer count n times.
[ "Increments", "an", "integer", "count", "n", "times", "." ]
dd783abfde23b0c67d7a74152d372c4c51e112aa
https://github.com/lvh/axiombench/blob/dd783abfde23b0c67d7a74152d372c4c51e112aa/axiombench/update.py#L8-L14
242,558
mayfield/shellish
shellish/layout/progress.py
progressbar
def progressbar(stream, prefix='Loading: ', width=0.5, **options): """ Generator filter to print a progress bar. """ size = len(stream) if not size: return stream if 'width' not in options: if width <= 1: width = round(shutil.get_terminal_size()[0] * width) options['w...
python
def progressbar(stream, prefix='Loading: ', width=0.5, **options): """ Generator filter to print a progress bar. """ size = len(stream) if not size: return stream if 'width' not in options: if width <= 1: width = round(shutil.get_terminal_size()[0] * width) options['w...
[ "def", "progressbar", "(", "stream", ",", "prefix", "=", "'Loading: '", ",", "width", "=", "0.5", ",", "*", "*", "options", ")", ":", "size", "=", "len", "(", "stream", ")", "if", "not", "size", ":", "return", "stream", "if", "'width'", "not", "in", ...
Generator filter to print a progress bar.
[ "Generator", "filter", "to", "print", "a", "progress", "bar", "." ]
df0f0e4612d138c34d8cb99b66ab5b8e47f1414a
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/layout/progress.py#L79-L92
242,559
inveniosoftware-contrib/record-recommender
record_recommender/utils.py
get_week_dates
def get_week_dates(year, week, as_timestamp=False): """ Get the dates or timestamp of a week in a year. param year: The year. param week: The week. param as_timestamp: Return values as timestamps. returns: The begin and end of the week as datetime.date or as timestamp. """ year = int(ye...
python
def get_week_dates(year, week, as_timestamp=False): """ Get the dates or timestamp of a week in a year. param year: The year. param week: The week. param as_timestamp: Return values as timestamps. returns: The begin and end of the week as datetime.date or as timestamp. """ year = int(ye...
[ "def", "get_week_dates", "(", "year", ",", "week", ",", "as_timestamp", "=", "False", ")", ":", "year", "=", "int", "(", "year", ")", "week", "=", "int", "(", "week", ")", "start_date", "=", "date", "(", "year", ",", "1", ",", "1", ")", "if", "st...
Get the dates or timestamp of a week in a year. param year: The year. param week: The week. param as_timestamp: Return values as timestamps. returns: The begin and end of the week as datetime.date or as timestamp.
[ "Get", "the", "dates", "or", "timestamp", "of", "a", "week", "in", "a", "year", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/utils.py#L33-L57
242,560
inveniosoftware-contrib/record-recommender
record_recommender/utils.py
get_year_week
def get_year_week(timestamp): """Get the year and week for a given timestamp.""" time_ = datetime.fromtimestamp(timestamp) year = time_.isocalendar()[0] week = time_.isocalendar()[1] return year, week
python
def get_year_week(timestamp): """Get the year and week for a given timestamp.""" time_ = datetime.fromtimestamp(timestamp) year = time_.isocalendar()[0] week = time_.isocalendar()[1] return year, week
[ "def", "get_year_week", "(", "timestamp", ")", ":", "time_", "=", "datetime", ".", "fromtimestamp", "(", "timestamp", ")", "year", "=", "time_", ".", "isocalendar", "(", ")", "[", "0", "]", "week", "=", "time_", ".", "isocalendar", "(", ")", "[", "1", ...
Get the year and week for a given timestamp.
[ "Get", "the", "year", "and", "week", "for", "a", "given", "timestamp", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/utils.py#L60-L65
242,561
inveniosoftware-contrib/record-recommender
record_recommender/utils.py
get_last_weeks
def get_last_weeks(number_of_weeks): """Get the last weeks.""" time_now = datetime.now() year = time_now.isocalendar()[0] week = time_now.isocalendar()[1] weeks = [] for i in range(0, number_of_weeks): start = get_week_dates(year, week - i, as_timestamp=True)[0] n_year, n_week = ...
python
def get_last_weeks(number_of_weeks): """Get the last weeks.""" time_now = datetime.now() year = time_now.isocalendar()[0] week = time_now.isocalendar()[1] weeks = [] for i in range(0, number_of_weeks): start = get_week_dates(year, week - i, as_timestamp=True)[0] n_year, n_week = ...
[ "def", "get_last_weeks", "(", "number_of_weeks", ")", ":", "time_now", "=", "datetime", ".", "now", "(", ")", "year", "=", "time_now", ".", "isocalendar", "(", ")", "[", "0", "]", "week", "=", "time_now", ".", "isocalendar", "(", ")", "[", "1", "]", ...
Get the last weeks.
[ "Get", "the", "last", "weeks", "." ]
07f71e783369e6373218b5e6ba0bf15901e9251a
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/utils.py#L68-L79
242,562
Othernet-Project/squery-pg
squery_pg/pool.py
gevent_wait_callback
def gevent_wait_callback(conn, timeout=None): """A wait callback useful to allow gevent to work with Psycopg.""" while 1: state = conn.poll() if state == extensions.POLL_OK: break elif state == extensions.POLL_READ: wait_read(conn.fileno(), timeout=timeout) ...
python
def gevent_wait_callback(conn, timeout=None): """A wait callback useful to allow gevent to work with Psycopg.""" while 1: state = conn.poll() if state == extensions.POLL_OK: break elif state == extensions.POLL_READ: wait_read(conn.fileno(), timeout=timeout) ...
[ "def", "gevent_wait_callback", "(", "conn", ",", "timeout", "=", "None", ")", ":", "while", "1", ":", "state", "=", "conn", ".", "poll", "(", ")", "if", "state", "==", "extensions", ".", "POLL_OK", ":", "break", "elif", "state", "==", "extensions", "."...
A wait callback useful to allow gevent to work with Psycopg.
[ "A", "wait", "callback", "useful", "to", "allow", "gevent", "to", "work", "with", "Psycopg", "." ]
eaa695c3719e2d2b7e1b049bb58c987c132b6b34
https://github.com/Othernet-Project/squery-pg/blob/eaa695c3719e2d2b7e1b049bb58c987c132b6b34/squery_pg/pool.py#L24-L36
242,563
steenzout/python-sphinx
steenzout/sphinx/__init__.py
ResourceGenerator.conf
def conf(self): """Generate the Sphinx `conf.py` configuration file Returns: (str): the contents of the `conf.py` file. """ return self.env.get_template('conf.py.j2').render( metadata=self.metadata, package=self.package)
python
def conf(self): """Generate the Sphinx `conf.py` configuration file Returns: (str): the contents of the `conf.py` file. """ return self.env.get_template('conf.py.j2').render( metadata=self.metadata, package=self.package)
[ "def", "conf", "(", "self", ")", ":", "return", "self", ".", "env", ".", "get_template", "(", "'conf.py.j2'", ")", ".", "render", "(", "metadata", "=", "self", ".", "metadata", ",", "package", "=", "self", ".", "package", ")" ]
Generate the Sphinx `conf.py` configuration file Returns: (str): the contents of the `conf.py` file.
[ "Generate", "the", "Sphinx", "conf", ".", "py", "configuration", "file" ]
b9767195fba74540c385fdf5f94cc4a24bc5e46d
https://github.com/steenzout/python-sphinx/blob/b9767195fba74540c385fdf5f94cc4a24bc5e46d/steenzout/sphinx/__init__.py#L42-L50
242,564
steenzout/python-sphinx
steenzout/sphinx/__init__.py
ResourceGenerator.makefile
def makefile(self): """Generate the documentation Makefile. Returns: (str): the contents of the `Makefile`. """ return self.env.get_template('Makefile.j2').render( metadata=self.metadata, package=self.package)
python
def makefile(self): """Generate the documentation Makefile. Returns: (str): the contents of the `Makefile`. """ return self.env.get_template('Makefile.j2').render( metadata=self.metadata, package=self.package)
[ "def", "makefile", "(", "self", ")", ":", "return", "self", ".", "env", ".", "get_template", "(", "'Makefile.j2'", ")", ".", "render", "(", "metadata", "=", "self", ".", "metadata", ",", "package", "=", "self", ".", "package", ")" ]
Generate the documentation Makefile. Returns: (str): the contents of the `Makefile`.
[ "Generate", "the", "documentation", "Makefile", "." ]
b9767195fba74540c385fdf5f94cc4a24bc5e46d
https://github.com/steenzout/python-sphinx/blob/b9767195fba74540c385fdf5f94cc4a24bc5e46d/steenzout/sphinx/__init__.py#L52-L60
242,565
mrstephenneal/dirutility
dirutility/compare.py
compare_trees
def compare_trees(dir1, dir2): """Parse two directories and return lists of unique files""" paths1 = DirPaths(dir1).walk() paths2 = DirPaths(dir2).walk() return unique_venn(paths1, paths2)
python
def compare_trees(dir1, dir2): """Parse two directories and return lists of unique files""" paths1 = DirPaths(dir1).walk() paths2 = DirPaths(dir2).walk() return unique_venn(paths1, paths2)
[ "def", "compare_trees", "(", "dir1", ",", "dir2", ")", ":", "paths1", "=", "DirPaths", "(", "dir1", ")", ".", "walk", "(", ")", "paths2", "=", "DirPaths", "(", "dir2", ")", ".", "walk", "(", ")", "return", "unique_venn", "(", "paths1", ",", "paths2",...
Parse two directories and return lists of unique files
[ "Parse", "two", "directories", "and", "return", "lists", "of", "unique", "files" ]
339378659e2d7e09c53acfc51c5df745bb0cd517
https://github.com/mrstephenneal/dirutility/blob/339378659e2d7e09c53acfc51c5df745bb0cd517/dirutility/compare.py#L21-L25
242,566
openknowledge-archive/datapackage-validate-py
datapackage_validate/schema.py
Schema.validate
def validate(self, data): '''Validates a data dict against this schema. Args: data (dict): The data to be validated. Raises: ValidationError: If the data is invalid. ''' try: self._validator.validate(data) except jsonschema.Validation...
python
def validate(self, data): '''Validates a data dict against this schema. Args: data (dict): The data to be validated. Raises: ValidationError: If the data is invalid. ''' try: self._validator.validate(data) except jsonschema.Validation...
[ "def", "validate", "(", "self", ",", "data", ")", ":", "try", ":", "self", ".", "_validator", ".", "validate", "(", "data", ")", "except", "jsonschema", ".", "ValidationError", "as", "e", ":", "six", ".", "raise_from", "(", "ValidationError", ".", "creat...
Validates a data dict against this schema. Args: data (dict): The data to be validated. Raises: ValidationError: If the data is invalid.
[ "Validates", "a", "data", "dict", "against", "this", "schema", "." ]
5f906bd4e0baa78dfd45f48e7fa3c5d649e6846a
https://github.com/openknowledge-archive/datapackage-validate-py/blob/5f906bd4e0baa78dfd45f48e7fa3c5d649e6846a/datapackage_validate/schema.py#L45-L57
242,567
fangpenlin/pyramid-handy
pyramid_handy/tweens/api_headers.py
set_version
def set_version(request, response): """Set version and revision to response """ settings = request.registry.settings resolver = DottedNameResolver() # get version config version_header = settings.get( 'api.version_header', 'X-Version', ) version_header_value = settings....
python
def set_version(request, response): """Set version and revision to response """ settings = request.registry.settings resolver = DottedNameResolver() # get version config version_header = settings.get( 'api.version_header', 'X-Version', ) version_header_value = settings....
[ "def", "set_version", "(", "request", ",", "response", ")", ":", "settings", "=", "request", ".", "registry", ".", "settings", "resolver", "=", "DottedNameResolver", "(", ")", "# get version config", "version_header", "=", "settings", ".", "get", "(", "'api.vers...
Set version and revision to response
[ "Set", "version", "and", "revision", "to", "response" ]
e3cbc19224ab1f0a14aab556990bceabd2d1f658
https://github.com/fangpenlin/pyramid-handy/blob/e3cbc19224ab1f0a14aab556990bceabd2d1f658/pyramid_handy/tweens/api_headers.py#L7-L39
242,568
fangpenlin/pyramid-handy
pyramid_handy/tweens/api_headers.py
api_headers_tween_factory
def api_headers_tween_factory(handler, registry): """This tween provides necessary API headers """ def api_headers_tween(request): response = handler(request) set_version(request, response) set_req_guid(request, response) return response return api_headers_tween
python
def api_headers_tween_factory(handler, registry): """This tween provides necessary API headers """ def api_headers_tween(request): response = handler(request) set_version(request, response) set_req_guid(request, response) return response return api_headers_tween
[ "def", "api_headers_tween_factory", "(", "handler", ",", "registry", ")", ":", "def", "api_headers_tween", "(", "request", ")", ":", "response", "=", "handler", "(", "request", ")", "set_version", "(", "request", ",", "response", ")", "set_req_guid", "(", "req...
This tween provides necessary API headers
[ "This", "tween", "provides", "necessary", "API", "headers" ]
e3cbc19224ab1f0a14aab556990bceabd2d1f658
https://github.com/fangpenlin/pyramid-handy/blob/e3cbc19224ab1f0a14aab556990bceabd2d1f658/pyramid_handy/tweens/api_headers.py#L62-L73
242,569
regardscitoyens/lawfactory_utils
lawfactory_utils/urls.py
clean_url
def clean_url(url): """ Normalize the url and clean it >>> clean_url("http://www.assemblee-nationale.fr/15/dossiers/le_nouveau_dossier.asp#deuxieme_partie") 'http://www.assemblee-nationale.fr/dyn/15/dossiers/deuxieme_partie' >>> clean_url("http://www.conseil-constitutionnel.fr/conseil-constitutionn...
python
def clean_url(url): """ Normalize the url and clean it >>> clean_url("http://www.assemblee-nationale.fr/15/dossiers/le_nouveau_dossier.asp#deuxieme_partie") 'http://www.assemblee-nationale.fr/dyn/15/dossiers/deuxieme_partie' >>> clean_url("http://www.conseil-constitutionnel.fr/conseil-constitutionn...
[ "def", "clean_url", "(", "url", ")", ":", "url", "=", "url", ".", "strip", "(", ")", "# fix urls like 'pjl09-518.htmlhttp://www.assemblee-nationale.fr/13/ta/ta051`8.asp'", "if", "url", ".", "find", "(", "'https://'", ")", ">", "0", ":", "url", "=", "'https://'", ...
Normalize the url and clean it >>> clean_url("http://www.assemblee-nationale.fr/15/dossiers/le_nouveau_dossier.asp#deuxieme_partie") 'http://www.assemblee-nationale.fr/dyn/15/dossiers/deuxieme_partie' >>> clean_url("http://www.conseil-constitutionnel.fr/conseil-constitutionnel/francais/les-decisions/acces-...
[ "Normalize", "the", "url", "and", "clean", "it" ]
d8565c5216f9ef8ce7c91a2409782f2d2636f67e
https://github.com/regardscitoyens/lawfactory_utils/blob/d8565c5216f9ef8ce7c91a2409782f2d2636f67e/lawfactory_utils/urls.py#L141-L227
242,570
regardscitoyens/lawfactory_utils
lawfactory_utils/urls.py
parse_national_assembly_url
def parse_national_assembly_url(url_an): """Returns the slug and the legislature of an AN url >>> # old format >>> parse_national_assembly_url("http://www.assemblee-nationale.fr/14/dossiers/devoir_vigilance_entreprises_donneuses_ordre.asp") (14, 'devoir_vigilance_entreprises_donneuses_ordre') >>> #...
python
def parse_national_assembly_url(url_an): """Returns the slug and the legislature of an AN url >>> # old format >>> parse_national_assembly_url("http://www.assemblee-nationale.fr/14/dossiers/devoir_vigilance_entreprises_donneuses_ordre.asp") (14, 'devoir_vigilance_entreprises_donneuses_ordre') >>> #...
[ "def", "parse_national_assembly_url", "(", "url_an", ")", ":", "legislature_match", "=", "re", ".", "search", "(", "r\"\\.fr/(dyn/)?(\\d+)/\"", ",", "url_an", ")", "if", "legislature_match", ":", "legislature", "=", "int", "(", "legislature_match", ".", "group", "...
Returns the slug and the legislature of an AN url >>> # old format >>> parse_national_assembly_url("http://www.assemblee-nationale.fr/14/dossiers/devoir_vigilance_entreprises_donneuses_ordre.asp") (14, 'devoir_vigilance_entreprises_donneuses_ordre') >>> # new format >>> parse_national_assembly_url(...
[ "Returns", "the", "slug", "and", "the", "legislature", "of", "an", "AN", "url" ]
d8565c5216f9ef8ce7c91a2409782f2d2636f67e
https://github.com/regardscitoyens/lawfactory_utils/blob/d8565c5216f9ef8ce7c91a2409782f2d2636f67e/lawfactory_utils/urls.py#L230-L263
242,571
jhazelwo/python-fileasobj
fileasobj/__init__.py
FileAsObj.read
def read(self, given_file): """ Read given_file to self.contents Will ignoring duplicate lines if self.unique is True Will sort self.contents after reading file if self.sorted is True """ if self.unique is not False and self.unique is not True: raise Attribute...
python
def read(self, given_file): """ Read given_file to self.contents Will ignoring duplicate lines if self.unique is True Will sort self.contents after reading file if self.sorted is True """ if self.unique is not False and self.unique is not True: raise Attribute...
[ "def", "read", "(", "self", ",", "given_file", ")", ":", "if", "self", ".", "unique", "is", "not", "False", "and", "self", ".", "unique", "is", "not", "True", ":", "raise", "AttributeError", "(", "\"Attribute 'unique' is not True or False.\"", ")", "self", "...
Read given_file to self.contents Will ignoring duplicate lines if self.unique is True Will sort self.contents after reading file if self.sorted is True
[ "Read", "given_file", "to", "self", ".", "contents", "Will", "ignoring", "duplicate", "lines", "if", "self", ".", "unique", "is", "True", "Will", "sort", "self", ".", "contents", "after", "reading", "file", "if", "self", ".", "sorted", "is", "True" ]
4bdbb575e75da830b88d10d0c1020d787ceba44d
https://github.com/jhazelwo/python-fileasobj/blob/4bdbb575e75da830b88d10d0c1020d787ceba44d/fileasobj/__init__.py#L89-L109
242,572
jhazelwo/python-fileasobj
fileasobj/__init__.py
FileAsObj.check
def check(self, line): """ Find first occurrence of 'line' in file. This searches each line as a whole, if you want to see if a substring is in a line, use .grep() or .egrep() If found, return the line; this makes it easier to chain methods. :param line: String; whole line to ...
python
def check(self, line): """ Find first occurrence of 'line' in file. This searches each line as a whole, if you want to see if a substring is in a line, use .grep() or .egrep() If found, return the line; this makes it easier to chain methods. :param line: String; whole line to ...
[ "def", "check", "(", "self", ",", "line", ")", ":", "if", "not", "isinstance", "(", "line", ",", "str", ")", ":", "raise", "TypeError", "(", "\"Parameter 'line' not a 'string', is {0}\"", ".", "format", "(", "type", "(", "line", ")", ")", ")", "if", "lin...
Find first occurrence of 'line' in file. This searches each line as a whole, if you want to see if a substring is in a line, use .grep() or .egrep() If found, return the line; this makes it easier to chain methods. :param line: String; whole line to find. :return: String or False.
[ "Find", "first", "occurrence", "of", "line", "in", "file", "." ]
4bdbb575e75da830b88d10d0c1020d787ceba44d
https://github.com/jhazelwo/python-fileasobj/blob/4bdbb575e75da830b88d10d0c1020d787ceba44d/fileasobj/__init__.py#L111-L126
242,573
jhazelwo/python-fileasobj
fileasobj/__init__.py
FileAsObj.add
def add(self, line): """ Append 'line' to contents where 'line' is an entire line or a list of lines. If self.unique is False it will add regardless of contents. Multi-line strings are converted to a list delimited by new lines. :param line: String or List of Strin...
python
def add(self, line): """ Append 'line' to contents where 'line' is an entire line or a list of lines. If self.unique is False it will add regardless of contents. Multi-line strings are converted to a list delimited by new lines. :param line: String or List of Strin...
[ "def", "add", "(", "self", ",", "line", ")", ":", "if", "self", ".", "unique", "is", "not", "False", "and", "self", ".", "unique", "is", "not", "True", ":", "raise", "AttributeError", "(", "\"Attribute 'unique' is not True or False.\"", ")", "self", ".", "...
Append 'line' to contents where 'line' is an entire line or a list of lines. If self.unique is False it will add regardless of contents. Multi-line strings are converted to a list delimited by new lines. :param line: String or List of Strings; arbitrary string(s) to append to file...
[ "Append", "line", "to", "contents", "where", "line", "is", "an", "entire", "line", "or", "a", "list", "of", "lines", "." ]
4bdbb575e75da830b88d10d0c1020d787ceba44d
https://github.com/jhazelwo/python-fileasobj/blob/4bdbb575e75da830b88d10d0c1020d787ceba44d/fileasobj/__init__.py#L128-L156
242,574
jhazelwo/python-fileasobj
fileasobj/__init__.py
FileAsObj.rm
def rm(self, line): """ Remove all occurrences of 'line' from contents where 'line' is an entire line or a list of lines. Return true if the file was changed by rm(), False otherwise. Multi-line strings are converted to a list delimited by new lines. :param line: S...
python
def rm(self, line): """ Remove all occurrences of 'line' from contents where 'line' is an entire line or a list of lines. Return true if the file was changed by rm(), False otherwise. Multi-line strings are converted to a list delimited by new lines. :param line: S...
[ "def", "rm", "(", "self", ",", "line", ")", ":", "self", ".", "log", "(", "'rm({0})'", ".", "format", "(", "line", ")", ")", "if", "line", "is", "False", ":", "return", "False", "if", "isinstance", "(", "line", ",", "str", ")", ":", "line", "=", ...
Remove all occurrences of 'line' from contents where 'line' is an entire line or a list of lines. Return true if the file was changed by rm(), False otherwise. Multi-line strings are converted to a list delimited by new lines. :param line: String, or List of Strings; each string r...
[ "Remove", "all", "occurrences", "of", "line", "from", "contents", "where", "line", "is", "an", "entire", "line", "or", "a", "list", "of", "lines", "." ]
4bdbb575e75da830b88d10d0c1020d787ceba44d
https://github.com/jhazelwo/python-fileasobj/blob/4bdbb575e75da830b88d10d0c1020d787ceba44d/fileasobj/__init__.py#L158-L188
242,575
jhazelwo/python-fileasobj
fileasobj/__init__.py
FileAsObj.replace
def replace(self, old, new): """ Replace all lines of file that match 'old' with 'new' Will replace duplicates if found. :param old: String, List of Strings, a multi-line String, or False; what to replace. :param new: String; what to use as replacement. :return: Boolea...
python
def replace(self, old, new): """ Replace all lines of file that match 'old' with 'new' Will replace duplicates if found. :param old: String, List of Strings, a multi-line String, or False; what to replace. :param new: String; what to use as replacement. :return: Boolea...
[ "def", "replace", "(", "self", ",", "old", ",", "new", ")", ":", "self", ".", "log", "(", "'replace({0}, {1})'", ".", "format", "(", "old", ",", "new", ")", ")", "if", "old", "is", "False", ":", "return", "False", "if", "isinstance", "(", "old", ",...
Replace all lines of file that match 'old' with 'new' Will replace duplicates if found. :param old: String, List of Strings, a multi-line String, or False; what to replace. :param new: String; what to use as replacement. :return: Boolean; whether contents changed during method call.
[ "Replace", "all", "lines", "of", "file", "that", "match", "old", "with", "new" ]
4bdbb575e75da830b88d10d0c1020d787ceba44d
https://github.com/jhazelwo/python-fileasobj/blob/4bdbb575e75da830b88d10d0c1020d787ceba44d/fileasobj/__init__.py#L245-L276
242,576
Archived-Object/ligament
ligament/helpers.py
partition
def partition(pred, iterable): """ split the results of an iterable based on a predicate """ trues = [] falses = [] for item in iterable: if pred(item): trues.append(item) else: falses.append(item) return trues, falses
python
def partition(pred, iterable): """ split the results of an iterable based on a predicate """ trues = [] falses = [] for item in iterable: if pred(item): trues.append(item) else: falses.append(item) return trues, falses
[ "def", "partition", "(", "pred", ",", "iterable", ")", ":", "trues", "=", "[", "]", "falses", "=", "[", "]", "for", "item", "in", "iterable", ":", "if", "pred", "(", "item", ")", ":", "trues", ".", "append", "(", "item", ")", "else", ":", "falses...
split the results of an iterable based on a predicate
[ "split", "the", "results", "of", "an", "iterable", "based", "on", "a", "predicate" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L17-L26
242,577
Archived-Object/ligament
ligament/helpers.py
zip_with_output
def zip_with_output(skip_args=[]): """decorater that zips the input of a function with its output only zips positional arguments. skip_args : list a list of indexes of arguments to exclude from the skip @zip_with_output(skip_args=[0]) def foo(bar, baz): ...
python
def zip_with_output(skip_args=[]): """decorater that zips the input of a function with its output only zips positional arguments. skip_args : list a list of indexes of arguments to exclude from the skip @zip_with_output(skip_args=[0]) def foo(bar, baz): ...
[ "def", "zip_with_output", "(", "skip_args", "=", "[", "]", ")", ":", "def", "decorator", "(", "fn", ")", ":", "def", "wrapped", "(", "*", "args", ",", "*", "*", "vargs", ")", ":", "g", "=", "[", "arg", "for", "i", ",", "arg", "in", "enumerate", ...
decorater that zips the input of a function with its output only zips positional arguments. skip_args : list a list of indexes of arguments to exclude from the skip @zip_with_output(skip_args=[0]) def foo(bar, baz): return baz will decorate...
[ "decorater", "that", "zips", "the", "input", "of", "a", "function", "with", "its", "output", "only", "zips", "positional", "arguments", "." ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L29-L52
242,578
Archived-Object/ligament
ligament/helpers.py
capture_exception
def capture_exception(fn): """decorator that catches and returns an exception from wrapped function""" def wrapped(*args): try: return fn(*args) except Exception as e: return e return wrapped
python
def capture_exception(fn): """decorator that catches and returns an exception from wrapped function""" def wrapped(*args): try: return fn(*args) except Exception as e: return e return wrapped
[ "def", "capture_exception", "(", "fn", ")", ":", "def", "wrapped", "(", "*", "args", ")", ":", "try", ":", "return", "fn", "(", "*", "args", ")", "except", "Exception", "as", "e", ":", "return", "e", "return", "wrapped" ]
decorator that catches and returns an exception from wrapped function
[ "decorator", "that", "catches", "and", "returns", "an", "exception", "from", "wrapped", "function" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L55-L62
242,579
Archived-Object/ligament
ligament/helpers.py
compose
def compose(*funcs): """compose a list of functions""" return lambda x: reduce(lambda v, f: f(v), reversed(funcs), x)
python
def compose(*funcs): """compose a list of functions""" return lambda x: reduce(lambda v, f: f(v), reversed(funcs), x)
[ "def", "compose", "(", "*", "funcs", ")", ":", "return", "lambda", "x", ":", "reduce", "(", "lambda", "v", ",", "f", ":", "f", "(", "v", ")", ",", "reversed", "(", "funcs", ")", ",", "x", ")" ]
compose a list of functions
[ "compose", "a", "list", "of", "functions" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L65-L67
242,580
Archived-Object/ligament
ligament/helpers.py
map_over_glob
def map_over_glob(fn, path, pattern): """map a function over a glob pattern, relative to a directory""" return [fn(x) for x in glob.glob(os.path.join(path, pattern))]
python
def map_over_glob(fn, path, pattern): """map a function over a glob pattern, relative to a directory""" return [fn(x) for x in glob.glob(os.path.join(path, pattern))]
[ "def", "map_over_glob", "(", "fn", ",", "path", ",", "pattern", ")", ":", "return", "[", "fn", "(", "x", ")", "for", "x", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "path", ",", "pattern", ")", ")", "]" ]
map a function over a glob pattern, relative to a directory
[ "map", "a", "function", "over", "a", "glob", "pattern", "relative", "to", "a", "directory" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L100-L102
242,581
Archived-Object/ligament
ligament/helpers.py
mkdir_recursive
def mkdir_recursive(dirname): """makes all the directories along a given path, if they do not exist""" parent = os.path.dirname(dirname) if parent != "": if not os.path.exists(parent): mkdir_recursive(parent) if not os.path.exists(dirname): os.mkdir(dirname) elif ...
python
def mkdir_recursive(dirname): """makes all the directories along a given path, if they do not exist""" parent = os.path.dirname(dirname) if parent != "": if not os.path.exists(parent): mkdir_recursive(parent) if not os.path.exists(dirname): os.mkdir(dirname) elif ...
[ "def", "mkdir_recursive", "(", "dirname", ")", ":", "parent", "=", "os", ".", "path", ".", "dirname", "(", "dirname", ")", "if", "parent", "!=", "\"\"", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "parent", ")", ":", "mkdir_recursive", "...
makes all the directories along a given path, if they do not exist
[ "makes", "all", "the", "directories", "along", "a", "given", "path", "if", "they", "do", "not", "exist" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L105-L114
242,582
Archived-Object/ligament
ligament/helpers.py
indent_text
def indent_text(*strs, **kwargs): """ indents text according to an operater string and a global indentation level. returns a tuple of all passed args, indented according to the operator string indent: [defaults to +0] The operator string, of the form ++n : increment...
python
def indent_text(*strs, **kwargs): """ indents text according to an operater string and a global indentation level. returns a tuple of all passed args, indented according to the operator string indent: [defaults to +0] The operator string, of the form ++n : increment...
[ "def", "indent_text", "(", "*", "strs", ",", "*", "*", "kwargs", ")", ":", "# python 2.7 workaround", "indent", "=", "kwargs", "[", "\"indent\"", "]", "if", "\"indent\"", "in", "kwargs", "else", "\"+0\"", "autobreak", "=", "kwargs", ".", "get", "(", "\"aut...
indents text according to an operater string and a global indentation level. returns a tuple of all passed args, indented according to the operator string indent: [defaults to +0] The operator string, of the form ++n : increments the global indentation level by n and in...
[ "indents", "text", "according", "to", "an", "operater", "string", "and", "a", "global", "indentation", "level", ".", "returns", "a", "tuple", "of", "all", "passed", "args", "indented", "according", "to", "the", "operator", "string" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L142-L203
242,583
Archived-Object/ligament
ligament/helpers.py
pdebug
def pdebug(*args, **kwargs): """print formatted output to stdout with indentation control""" if should_msg(kwargs.get("groups", ["debug"])): # initialize colorama only if uninitialized global colorama_init if not colorama_init: colorama_init = True colorama.init()...
python
def pdebug(*args, **kwargs): """print formatted output to stdout with indentation control""" if should_msg(kwargs.get("groups", ["debug"])): # initialize colorama only if uninitialized global colorama_init if not colorama_init: colorama_init = True colorama.init()...
[ "def", "pdebug", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "should_msg", "(", "kwargs", ".", "get", "(", "\"groups\"", ",", "[", "\"debug\"", "]", ")", ")", ":", "# initialize colorama only if uninitialized", "global", "colorama_init", "if",...
print formatted output to stdout with indentation control
[ "print", "formatted", "output", "to", "stdout", "with", "indentation", "control" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L247-L262
242,584
Archived-Object/ligament
ligament/helpers.py
pout
def pout(*args, **kwargs): """print to stdout, maintaining indent level""" if should_msg(kwargs.get("groups", ["normal"])): args = indent_text(*args, **kwargs) # write to stdout sys.stderr.write("".join(args)) sys.stderr.write("\n")
python
def pout(*args, **kwargs): """print to stdout, maintaining indent level""" if should_msg(kwargs.get("groups", ["normal"])): args = indent_text(*args, **kwargs) # write to stdout sys.stderr.write("".join(args)) sys.stderr.write("\n")
[ "def", "pout", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "should_msg", "(", "kwargs", ".", "get", "(", "\"groups\"", ",", "[", "\"normal\"", "]", ")", ")", ":", "args", "=", "indent_text", "(", "*", "args", ",", "*", "*", "kwargs...
print to stdout, maintaining indent level
[ "print", "to", "stdout", "maintaining", "indent", "level" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L265-L272
242,585
Archived-Object/ligament
ligament/helpers.py
urlretrieve
def urlretrieve(url, dest, write_mode="w"): """save a file to disk from a given url""" response = urllib2.urlopen(url) mkdir_recursive(os.path.dirname(dest)) with open(dest, write_mode) as f: f.write(response.read()) f.close()
python
def urlretrieve(url, dest, write_mode="w"): """save a file to disk from a given url""" response = urllib2.urlopen(url) mkdir_recursive(os.path.dirname(dest)) with open(dest, write_mode) as f: f.write(response.read()) f.close()
[ "def", "urlretrieve", "(", "url", ",", "dest", ",", "write_mode", "=", "\"w\"", ")", ":", "response", "=", "urllib2", ".", "urlopen", "(", "url", ")", "mkdir_recursive", "(", "os", ".", "path", ".", "dirname", "(", "dest", ")", ")", "with", "open", "...
save a file to disk from a given url
[ "save", "a", "file", "to", "disk", "from", "a", "given", "url" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L275-L281
242,586
Archived-Object/ligament
ligament/helpers.py
remove_dups
def remove_dups(seq): """remove duplicates from a sequence, preserving order""" seen = set() seen_add = seen.add return [x for x in seq if not (x in seen or seen_add(x))]
python
def remove_dups(seq): """remove duplicates from a sequence, preserving order""" seen = set() seen_add = seen.add return [x for x in seq if not (x in seen or seen_add(x))]
[ "def", "remove_dups", "(", "seq", ")", ":", "seen", "=", "set", "(", ")", "seen_add", "=", "seen", ".", "add", "return", "[", "x", "for", "x", "in", "seq", "if", "not", "(", "x", "in", "seen", "or", "seen_add", "(", "x", ")", ")", "]" ]
remove duplicates from a sequence, preserving order
[ "remove", "duplicates", "from", "a", "sequence", "preserving", "order" ]
ff3d78130522676a20dc64086dc8a27b197cc20f
https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/helpers.py#L291-L295
242,587
rehandalal/buchner
buchner/helpers.py
json_requested
def json_requested(): """Check if json is the preferred output format for the request.""" best = request.accept_mimetypes.best_match( ['application/json', 'text/html']) return (best == 'application/json' and request.accept_mimetypes[best] > request.accept_mimetypes['text/html...
python
def json_requested(): """Check if json is the preferred output format for the request.""" best = request.accept_mimetypes.best_match( ['application/json', 'text/html']) return (best == 'application/json' and request.accept_mimetypes[best] > request.accept_mimetypes['text/html...
[ "def", "json_requested", "(", ")", ":", "best", "=", "request", ".", "accept_mimetypes", ".", "best_match", "(", "[", "'application/json'", ",", "'text/html'", "]", ")", "return", "(", "best", "==", "'application/json'", "and", "request", ".", "accept_mimetypes"...
Check if json is the preferred output format for the request.
[ "Check", "if", "json", "is", "the", "preferred", "output", "format", "for", "the", "request", "." ]
dc22a61c493b9d4a74d76e8b42a319aa13e385f3
https://github.com/rehandalal/buchner/blob/dc22a61c493b9d4a74d76e8b42a319aa13e385f3/buchner/helpers.py#L13-L19
242,588
emin63/eyap
setup.py
get_readme
def get_readme(): 'Get the long description from the README file' here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as my_fd: result = my_fd.read() return result
python
def get_readme(): 'Get the long description from the README file' here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as my_fd: result = my_fd.read() return result
[ "def", "get_readme", "(", ")", ":", "here", "=", "path", ".", "abspath", "(", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "open", "(", "path", ".", "join", "(", "here", ",", "'README.rst'", ")", ",", "encoding", "=", "'utf-8'", ")", ...
Get the long description from the README file
[ "Get", "the", "long", "description", "from", "the", "README", "file" ]
a610761973b478ca0e864e970be05ce29d5994a5
https://github.com/emin63/eyap/blob/a610761973b478ca0e864e970be05ce29d5994a5/setup.py#L14-L21
242,589
pacificclimate/cfmeta
cfmeta/cmipfile.py
get_nc_attrs
def get_nc_attrs(nc): """Gets netCDF file metadata attributes. Arguments: nc (netCDF4.Dataset): an open NetCDF4 Dataset to pull attributes from. Returns: dict: Metadata as extracted from the netCDF file. """ meta = { 'experiment': nc.experiment_id, 'frequency': nc....
python
def get_nc_attrs(nc): """Gets netCDF file metadata attributes. Arguments: nc (netCDF4.Dataset): an open NetCDF4 Dataset to pull attributes from. Returns: dict: Metadata as extracted from the netCDF file. """ meta = { 'experiment': nc.experiment_id, 'frequency': nc....
[ "def", "get_nc_attrs", "(", "nc", ")", ":", "meta", "=", "{", "'experiment'", ":", "nc", ".", "experiment_id", ",", "'frequency'", ":", "nc", ".", "frequency", ",", "'institute'", ":", "nc", ".", "institute_id", ",", "'model'", ":", "nc", ".", "model_id"...
Gets netCDF file metadata attributes. Arguments: nc (netCDF4.Dataset): an open NetCDF4 Dataset to pull attributes from. Returns: dict: Metadata as extracted from the netCDF file.
[ "Gets", "netCDF", "file", "metadata", "attributes", "." ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmipfile.py#L151-L174
242,590
pacificclimate/cfmeta
cfmeta/cmipfile.py
get_var_name
def get_var_name(nc): """Guesses the variable_name of an open NetCDF file """ non_variable_names = [ 'lat', 'lat_bnds', 'lon', 'lon_bnds', 'time', 'latitude', 'longitude', 'bnds' ] _vars = set(nc.variables.keys()) _vars.difference...
python
def get_var_name(nc): """Guesses the variable_name of an open NetCDF file """ non_variable_names = [ 'lat', 'lat_bnds', 'lon', 'lon_bnds', 'time', 'latitude', 'longitude', 'bnds' ] _vars = set(nc.variables.keys()) _vars.difference...
[ "def", "get_var_name", "(", "nc", ")", ":", "non_variable_names", "=", "[", "'lat'", ",", "'lat_bnds'", ",", "'lon'", ",", "'lon_bnds'", ",", "'time'", ",", "'latitude'", ",", "'longitude'", ",", "'bnds'", "]", "_vars", "=", "set", "(", "nc", ".", "varia...
Guesses the variable_name of an open NetCDF file
[ "Guesses", "the", "variable_name", "of", "an", "open", "NetCDF", "file" ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmipfile.py#L176-L195
242,591
pacificclimate/cfmeta
cfmeta/cmipfile.py
CmipFile._update_known_atts
def _update_known_atts(self, **kwargs): """Updates instance attributes with supplied keyword arguments. """ for k, v in kwargs.items(): if k not in ATTR_KEYS: # Warn if passed in unknown kwargs raise SyntaxWarning('Unknown argument: {}'.format(k)) ...
python
def _update_known_atts(self, **kwargs): """Updates instance attributes with supplied keyword arguments. """ for k, v in kwargs.items(): if k not in ATTR_KEYS: # Warn if passed in unknown kwargs raise SyntaxWarning('Unknown argument: {}'.format(k)) ...
[ "def", "_update_known_atts", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "not", "in", "ATTR_KEYS", ":", "# Warn if passed in unknown kwargs", "raise", "SyntaxWarning", "(", ...
Updates instance attributes with supplied keyword arguments.
[ "Updates", "instance", "attributes", "with", "supplied", "keyword", "arguments", "." ]
a6eef78d0bce523bb44920ba96233f034b60316a
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmipfile.py#L57-L67
242,592
redbridge/molnctrl
molnctrl/cachemaker.py
savecache
def savecache(apicache, json_file): """ Saves apicache dictionary as json_file, returns dictionary as indented str """ if apicache is None or apicache is {}: return "" apicachestr = json.dumps(apicache, indent=2) with open(json_file, 'w') as cache_file: cache_file.write(apicaches...
python
def savecache(apicache, json_file): """ Saves apicache dictionary as json_file, returns dictionary as indented str """ if apicache is None or apicache is {}: return "" apicachestr = json.dumps(apicache, indent=2) with open(json_file, 'w') as cache_file: cache_file.write(apicaches...
[ "def", "savecache", "(", "apicache", ",", "json_file", ")", ":", "if", "apicache", "is", "None", "or", "apicache", "is", "{", "}", ":", "return", "\"\"", "apicachestr", "=", "json", ".", "dumps", "(", "apicache", ",", "indent", "=", "2", ")", "with", ...
Saves apicache dictionary as json_file, returns dictionary as indented str
[ "Saves", "apicache", "dictionary", "as", "json_file", "returns", "dictionary", "as", "indented", "str" ]
9990ae7e522ce364bb61a735f774dc28de5f8e60
https://github.com/redbridge/molnctrl/blob/9990ae7e522ce364bb61a735f774dc28de5f8e60/molnctrl/cachemaker.py#L55-L64
242,593
redbridge/molnctrl
molnctrl/cachemaker.py
loadcache
def loadcache(json_file): """ Loads json file as dictionary, feeds it to monkeycache and spits result """ f = open(json_file, 'r') data = f.read() f.close() try: apicache = json.loads(data) except ValueError as e: print("Error processing json:", json_file, e) retu...
python
def loadcache(json_file): """ Loads json file as dictionary, feeds it to monkeycache and spits result """ f = open(json_file, 'r') data = f.read() f.close() try: apicache = json.loads(data) except ValueError as e: print("Error processing json:", json_file, e) retu...
[ "def", "loadcache", "(", "json_file", ")", ":", "f", "=", "open", "(", "json_file", ",", "'r'", ")", "data", "=", "f", ".", "read", "(", ")", "f", ".", "close", "(", ")", "try", ":", "apicache", "=", "json", ".", "loads", "(", "data", ")", "exc...
Loads json file as dictionary, feeds it to monkeycache and spits result
[ "Loads", "json", "file", "as", "dictionary", "feeds", "it", "to", "monkeycache", "and", "spits", "result" ]
9990ae7e522ce364bb61a735f774dc28de5f8e60
https://github.com/redbridge/molnctrl/blob/9990ae7e522ce364bb61a735f774dc28de5f8e60/molnctrl/cachemaker.py#L67-L79
242,594
redbridge/molnctrl
molnctrl/cachemaker.py
monkeycache
def monkeycache(apis): """ Feed this a dictionary of api bananas, it spits out processed cache """ if isinstance(type(apis), type(None)) or apis is None: return {} verbs = set() cache = {} cache['count'] = apis['count'] cache['asyncapis'] = [] apilist = apis['api'] if a...
python
def monkeycache(apis): """ Feed this a dictionary of api bananas, it spits out processed cache """ if isinstance(type(apis), type(None)) or apis is None: return {} verbs = set() cache = {} cache['count'] = apis['count'] cache['asyncapis'] = [] apilist = apis['api'] if a...
[ "def", "monkeycache", "(", "apis", ")", ":", "if", "isinstance", "(", "type", "(", "apis", ")", ",", "type", "(", "None", ")", ")", "or", "apis", "is", "None", ":", "return", "{", "}", "verbs", "=", "set", "(", ")", "cache", "=", "{", "}", "cac...
Feed this a dictionary of api bananas, it spits out processed cache
[ "Feed", "this", "a", "dictionary", "of", "api", "bananas", "it", "spits", "out", "processed", "cache" ]
9990ae7e522ce364bb61a735f774dc28de5f8e60
https://github.com/redbridge/molnctrl/blob/9990ae7e522ce364bb61a735f774dc28de5f8e60/molnctrl/cachemaker.py#L82-L132
242,595
zagfai/webtul
webtul/db.py
MySQL.execute
def execute(self, sql, param=(), times=1): """This function is the most use one, with the paramter times it will try x times to execute the sql, default is 1. """ self.log and self.log.debug('%s %s' % ('SQL:', sql)) if param is not (): self.log and self.log.debug('%s ...
python
def execute(self, sql, param=(), times=1): """This function is the most use one, with the paramter times it will try x times to execute the sql, default is 1. """ self.log and self.log.debug('%s %s' % ('SQL:', sql)) if param is not (): self.log and self.log.debug('%s ...
[ "def", "execute", "(", "self", ",", "sql", ",", "param", "=", "(", ")", ",", "times", "=", "1", ")", ":", "self", ".", "log", "and", "self", ".", "log", ".", "debug", "(", "'%s %s'", "%", "(", "'SQL:'", ",", "sql", ")", ")", "if", "param", "i...
This function is the most use one, with the paramter times it will try x times to execute the sql, default is 1.
[ "This", "function", "is", "the", "most", "use", "one", "with", "the", "paramter", "times", "it", "will", "try", "x", "times", "to", "execute", "the", "sql", "default", "is", "1", "." ]
58c49928070b56ef54a45b4af20d800b269ad8ce
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/db.py#L50-L66
242,596
boisgera/about
about/__init__.py
get_metadata
def get_metadata(source): """ Extract the metadata from the module or dict argument. It returns a `metadata` dictionary that provides keywords arguments for the setuptools `setup` function. """ if isinstance(source, types.ModuleType): metadata = source.__dict__ else: metadat...
python
def get_metadata(source): """ Extract the metadata from the module or dict argument. It returns a `metadata` dictionary that provides keywords arguments for the setuptools `setup` function. """ if isinstance(source, types.ModuleType): metadata = source.__dict__ else: metadat...
[ "def", "get_metadata", "(", "source", ")", ":", "if", "isinstance", "(", "source", ",", "types", ".", "ModuleType", ")", ":", "metadata", "=", "source", ".", "__dict__", "else", ":", "metadata", "=", "source", "setuptools_kwargs", "=", "{", "}", "for", "...
Extract the metadata from the module or dict argument. It returns a `metadata` dictionary that provides keywords arguments for the setuptools `setup` function.
[ "Extract", "the", "metadata", "from", "the", "module", "or", "dict", "argument", "." ]
ae16b015377250fe9df11848ea11ddaa9df54ffa
https://github.com/boisgera/about/blob/ae16b015377250fe9df11848ea11ddaa9df54ffa/about/__init__.py#L87-L149
242,597
donovan-duplessis/pwnurl
manage.py
profile
def profile(length=25): """ Start the application under the code profiler """ from werkzeug.contrib.profiler import ProfilerMiddleware app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length]) app.run()
python
def profile(length=25): """ Start the application under the code profiler """ from werkzeug.contrib.profiler import ProfilerMiddleware app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length]) app.run()
[ "def", "profile", "(", "length", "=", "25", ")", ":", "from", "werkzeug", ".", "contrib", ".", "profiler", "import", "ProfilerMiddleware", "app", ".", "wsgi_app", "=", "ProfilerMiddleware", "(", "app", ".", "wsgi_app", ",", "restrictions", "=", "[", "length"...
Start the application under the code profiler
[ "Start", "the", "application", "under", "the", "code", "profiler" ]
a13e27694f738228d186ea437b4d15ef5a925a87
https://github.com/donovan-duplessis/pwnurl/blob/a13e27694f738228d186ea437b4d15ef5a925a87/manage.py#L63-L68
242,598
donovan-duplessis/pwnurl
manage.py
_help
def _help(): """ Display both SQLAlchemy and Python help statements """ statement = '%s%s' % (shelp, phelp % ', '.join(cntx_.keys())) print statement.strip()
python
def _help(): """ Display both SQLAlchemy and Python help statements """ statement = '%s%s' % (shelp, phelp % ', '.join(cntx_.keys())) print statement.strip()
[ "def", "_help", "(", ")", ":", "statement", "=", "'%s%s'", "%", "(", "shelp", ",", "phelp", "%", "', '", ".", "join", "(", "cntx_", ".", "keys", "(", ")", ")", ")", "print", "statement", ".", "strip", "(", ")" ]
Display both SQLAlchemy and Python help statements
[ "Display", "both", "SQLAlchemy", "and", "Python", "help", "statements" ]
a13e27694f738228d186ea437b4d15ef5a925a87
https://github.com/donovan-duplessis/pwnurl/blob/a13e27694f738228d186ea437b4d15ef5a925a87/manage.py#L71-L75
242,599
beylsp/unisquid
unisquid/liveserver.py
LiveServerThread.run
def run(self): """ Sets up live server, and then loops over handling http requests. """ try: # Go through the list of possible ports, hoping we can find # one that is free to use for the WSGI server. for index, port in enumerate(self.possible_ports): ...
python
def run(self): """ Sets up live server, and then loops over handling http requests. """ try: # Go through the list of possible ports, hoping we can find # one that is free to use for the WSGI server. for index, port in enumerate(self.possible_ports): ...
[ "def", "run", "(", "self", ")", ":", "try", ":", "# Go through the list of possible ports, hoping we can find", "# one that is free to use for the WSGI server.", "for", "index", ",", "port", "in", "enumerate", "(", "self", ".", "possible_ports", ")", ":", "try", ":", ...
Sets up live server, and then loops over handling http requests.
[ "Sets", "up", "live", "server", "and", "then", "loops", "over", "handling", "http", "requests", "." ]
880787a2b6c9051b7f82a7f721434819984003e2
https://github.com/beylsp/unisquid/blob/880787a2b6c9051b7f82a7f721434819984003e2/unisquid/liveserver.py#L29-L59