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
56,100
BlendedSiteGenerator/Blended
blended/functions.py
getunzipped
def getunzipped(username, repo, thedir): """Downloads and unzips a zip file""" theurl = "https://github.com/" + username + "/" + repo + "/archive/master.zip" name = os.path.join(thedir, 'temp.zip') try: name = urllib.urlretrieve(theurl, name) name = os.path.join(thedir, 'temp.zip') e...
python
def getunzipped(username, repo, thedir): """Downloads and unzips a zip file""" theurl = "https://github.com/" + username + "/" + repo + "/archive/master.zip" name = os.path.join(thedir, 'temp.zip') try: name = urllib.urlretrieve(theurl, name) name = os.path.join(thedir, 'temp.zip') e...
[ "def", "getunzipped", "(", "username", ",", "repo", ",", "thedir", ")", ":", "theurl", "=", "\"https://github.com/\"", "+", "username", "+", "\"/\"", "+", "repo", "+", "\"/archive/master.zip\"", "name", "=", "os", ".", "path", ".", "join", "(", "thedir", "...
Downloads and unzips a zip file
[ "Downloads", "and", "unzips", "a", "zip", "file" ]
e5865a8633e461a22c86ef6ee98cdd7051c412ac
https://github.com/BlendedSiteGenerator/Blended/blob/e5865a8633e461a22c86ef6ee98cdd7051c412ac/blended/functions.py#L72-L92
56,101
BlendedSiteGenerator/Blended
blended/functions.py
checkConfig
def checkConfig(): """If the config.py file exists, back it up""" config_file_dir = os.path.join(cwd, "config.py") if os.path.exists(config_file_dir): print("Making a backup of your config file!") config_file_dir2 = os.path.join(cwd, "config.py.oldbak") copyfile(config_file_dir, conf...
python
def checkConfig(): """If the config.py file exists, back it up""" config_file_dir = os.path.join(cwd, "config.py") if os.path.exists(config_file_dir): print("Making a backup of your config file!") config_file_dir2 = os.path.join(cwd, "config.py.oldbak") copyfile(config_file_dir, conf...
[ "def", "checkConfig", "(", ")", ":", "config_file_dir", "=", "os", ".", "path", ".", "join", "(", "cwd", ",", "\"config.py\"", ")", "if", "os", ".", "path", ".", "exists", "(", "config_file_dir", ")", ":", "print", "(", "\"Making a backup of your config file...
If the config.py file exists, back it up
[ "If", "the", "config", ".", "py", "file", "exists", "back", "it", "up" ]
e5865a8633e461a22c86ef6ee98cdd7051c412ac
https://github.com/BlendedSiteGenerator/Blended/blob/e5865a8633e461a22c86ef6ee98cdd7051c412ac/blended/functions.py#L95-L101
56,102
BlendedSiteGenerator/Blended
blended/functions.py
createConfig
def createConfig(app_version=5.0, wname="", wdesc="", wdescl="", wlic="", wlan="", wurl="", aname="", abio=""): """Generates a config file from the information""" config_file_dir = os.path.join(cwd, "config.py") config_file = open(config_file_dir, "w") config_file.write('blended_version = ' + app_versi...
python
def createConfig(app_version=5.0, wname="", wdesc="", wdescl="", wlic="", wlan="", wurl="", aname="", abio=""): """Generates a config file from the information""" config_file_dir = os.path.join(cwd, "config.py") config_file = open(config_file_dir, "w") config_file.write('blended_version = ' + app_versi...
[ "def", "createConfig", "(", "app_version", "=", "5.0", ",", "wname", "=", "\"\"", ",", "wdesc", "=", "\"\"", ",", "wdescl", "=", "\"\"", ",", "wlic", "=", "\"\"", ",", "wlan", "=", "\"\"", ",", "wurl", "=", "\"\"", ",", "aname", "=", "\"\"", ",", ...
Generates a config file from the information
[ "Generates", "a", "config", "file", "from", "the", "information" ]
e5865a8633e461a22c86ef6ee98cdd7051c412ac
https://github.com/BlendedSiteGenerator/Blended/blob/e5865a8633e461a22c86ef6ee98cdd7051c412ac/blended/functions.py#L104-L141
56,103
BlendedSiteGenerator/Blended
blended/functions.py
createBlendedFolders
def createBlendedFolders(): """Creates the standard folders for a Blended website""" # Create the templates folder create_folder(os.path.join(cwd, "templates")) # Create the templates/assets folder create_folder(os.path.join(cwd, "templates", "assets")) # Create the templates/assets/css folder...
python
def createBlendedFolders(): """Creates the standard folders for a Blended website""" # Create the templates folder create_folder(os.path.join(cwd, "templates")) # Create the templates/assets folder create_folder(os.path.join(cwd, "templates", "assets")) # Create the templates/assets/css folder...
[ "def", "createBlendedFolders", "(", ")", ":", "# Create the templates folder", "create_folder", "(", "os", ".", "path", ".", "join", "(", "cwd", ",", "\"templates\"", ")", ")", "# Create the templates/assets folder", "create_folder", "(", "os", ".", "path", ".", "...
Creates the standard folders for a Blended website
[ "Creates", "the", "standard", "folders", "for", "a", "Blended", "website" ]
e5865a8633e461a22c86ef6ee98cdd7051c412ac
https://github.com/BlendedSiteGenerator/Blended/blob/e5865a8633e461a22c86ef6ee98cdd7051c412ac/blended/functions.py#L144-L162
56,104
tkf/rash
rash/record.py
record_run
def record_run(record_type, print_session_id, **kwds): """ Record shell history. """ if print_session_id and record_type != 'init': raise RuntimeError( '--print-session-id should be used with --record-type=init') cfstore = ConfigStore() # SOMEDAY: Pass a list of environment ...
python
def record_run(record_type, print_session_id, **kwds): """ Record shell history. """ if print_session_id and record_type != 'init': raise RuntimeError( '--print-session-id should be used with --record-type=init') cfstore = ConfigStore() # SOMEDAY: Pass a list of environment ...
[ "def", "record_run", "(", "record_type", ",", "print_session_id", ",", "*", "*", "kwds", ")", ":", "if", "print_session_id", "and", "record_type", "!=", "'init'", ":", "raise", "RuntimeError", "(", "'--print-session-id should be used with --record-type=init'", ")", "c...
Record shell history.
[ "Record", "shell", "history", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/record.py#L102-L139
56,105
staticdev/django-sorting-bootstrap
sorting_bootstrap/compat.py
format_html
def format_html(format_string, *args, **kwargs): """ Similar to str.format, but passes all arguments through conditional_escape, and calls 'mark_safe' on the result. This function should be used instead of str.format or % interpolation to build up small HTML fragments. """ args_safe = map(condit...
python
def format_html(format_string, *args, **kwargs): """ Similar to str.format, but passes all arguments through conditional_escape, and calls 'mark_safe' on the result. This function should be used instead of str.format or % interpolation to build up small HTML fragments. """ args_safe = map(condit...
[ "def", "format_html", "(", "format_string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args_safe", "=", "map", "(", "conditional_escape", ",", "args", ")", "kwargs_safe", "=", "dict", "(", "[", "(", "k", ",", "conditional_escape", "(", "v", ...
Similar to str.format, but passes all arguments through conditional_escape, and calls 'mark_safe' on the result. This function should be used instead of str.format or % interpolation to build up small HTML fragments.
[ "Similar", "to", "str", ".", "format", "but", "passes", "all", "arguments", "through", "conditional_escape", "and", "calls", "mark_safe", "on", "the", "result", ".", "This", "function", "should", "be", "used", "instead", "of", "str", ".", "format", "or", "%"...
cfdc6e671b1b57aad04e44b041b9df10ee8288d3
https://github.com/staticdev/django-sorting-bootstrap/blob/cfdc6e671b1b57aad04e44b041b9df10ee8288d3/sorting_bootstrap/compat.py#L15-L24
56,106
tkf/rash
rash/database.py
sql_program_name_func
def sql_program_name_func(command): """ Extract program name from `command`. >>> sql_program_name_func('ls') 'ls' >>> sql_program_name_func('git status') 'git' >>> sql_program_name_func('EMACS=emacs make') 'make' :type command: str """ args = command.split(' ') for pro...
python
def sql_program_name_func(command): """ Extract program name from `command`. >>> sql_program_name_func('ls') 'ls' >>> sql_program_name_func('git status') 'git' >>> sql_program_name_func('EMACS=emacs make') 'make' :type command: str """ args = command.split(' ') for pro...
[ "def", "sql_program_name_func", "(", "command", ")", ":", "args", "=", "command", ".", "split", "(", "' '", ")", "for", "prog", "in", "args", ":", "if", "'='", "not", "in", "prog", ":", "return", "prog", "return", "args", "[", "0", "]" ]
Extract program name from `command`. >>> sql_program_name_func('ls') 'ls' >>> sql_program_name_func('git status') 'git' >>> sql_program_name_func('EMACS=emacs make') 'make' :type command: str
[ "Extract", "program", "name", "from", "command", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L68-L86
56,107
tkf/rash
rash/database.py
sql_pathdist_func
def sql_pathdist_func(path1, path2, sep=os.path.sep): """ Return a distance between `path1` and `path2`. >>> sql_pathdist_func('a/b/', 'a/b/', sep='/') 0 >>> sql_pathdist_func('a/', 'a/b/', sep='/') 1 >>> sql_pathdist_func('a', 'a/', sep='/') 0 """ seq1 = path1.rstrip(sep).spli...
python
def sql_pathdist_func(path1, path2, sep=os.path.sep): """ Return a distance between `path1` and `path2`. >>> sql_pathdist_func('a/b/', 'a/b/', sep='/') 0 >>> sql_pathdist_func('a/', 'a/b/', sep='/') 1 >>> sql_pathdist_func('a', 'a/', sep='/') 0 """ seq1 = path1.rstrip(sep).spli...
[ "def", "sql_pathdist_func", "(", "path1", ",", "path2", ",", "sep", "=", "os", ".", "path", ".", "sep", ")", ":", "seq1", "=", "path1", ".", "rstrip", "(", "sep", ")", ".", "split", "(", "sep", ")", "seq2", "=", "path2", ".", "rstrip", "(", "sep"...
Return a distance between `path1` and `path2`. >>> sql_pathdist_func('a/b/', 'a/b/', sep='/') 0 >>> sql_pathdist_func('a/', 'a/b/', sep='/') 1 >>> sql_pathdist_func('a', 'a/', sep='/') 0
[ "Return", "a", "distance", "between", "path1", "and", "path2", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L89-L103
56,108
tkf/rash
rash/database.py
DataBase.connection
def connection(self, commit=False): """ Context manager to keep around DB connection. :rtype: sqlite3.Connection SOMEDAY: Get rid of this function. Keeping connection around as an argument to the method using this context manager is probably better as it is more explic...
python
def connection(self, commit=False): """ Context manager to keep around DB connection. :rtype: sqlite3.Connection SOMEDAY: Get rid of this function. Keeping connection around as an argument to the method using this context manager is probably better as it is more explic...
[ "def", "connection", "(", "self", ",", "commit", "=", "False", ")", ":", "if", "commit", ":", "self", ".", "_need_commit", "=", "True", "if", "self", ".", "_db", ":", "yield", "self", ".", "_db", "else", ":", "try", ":", "with", "self", ".", "_get_...
Context manager to keep around DB connection. :rtype: sqlite3.Connection SOMEDAY: Get rid of this function. Keeping connection around as an argument to the method using this context manager is probably better as it is more explicit. Also, holding "global state" as instance att...
[ "Context", "manager", "to", "keep", "around", "DB", "connection", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L129-L160
56,109
tkf/rash
rash/database.py
DataBase.update_version_records
def update_version_records(self): """ Update rash_info table if necessary. """ from .__init__ import __version__ as version with self.connection(commit=True) as connection: for vrec in self.get_version_records(): if (vrec.rash_version == version and ...
python
def update_version_records(self): """ Update rash_info table if necessary. """ from .__init__ import __version__ as version with self.connection(commit=True) as connection: for vrec in self.get_version_records(): if (vrec.rash_version == version and ...
[ "def", "update_version_records", "(", "self", ")", ":", "from", ".", "__init__", "import", "__version__", "as", "version", "with", "self", ".", "connection", "(", "commit", "=", "True", ")", "as", "connection", ":", "for", "vrec", "in", "self", ".", "get_v...
Update rash_info table if necessary.
[ "Update", "rash_info", "table", "if", "necessary", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L219-L232
56,110
tkf/rash
rash/database.py
DataBase.select_by_command_record
def select_by_command_record(self, crec): """ Yield records that matches to `crec`. All attributes of `crec` except for `environ` are concerned. """ keys = ['command_history_id', 'command', 'session_history_id', 'cwd', 'terminal', 'start', 'stop'...
python
def select_by_command_record(self, crec): """ Yield records that matches to `crec`. All attributes of `crec` except for `environ` are concerned. """ keys = ['command_history_id', 'command', 'session_history_id', 'cwd', 'terminal', 'start', 'stop'...
[ "def", "select_by_command_record", "(", "self", ",", "crec", ")", ":", "keys", "=", "[", "'command_history_id'", ",", "'command'", ",", "'session_history_id'", ",", "'cwd'", ",", "'terminal'", ",", "'start'", ",", "'stop'", ",", "'exit_code'", "]", "sql", "=",...
Yield records that matches to `crec`. All attributes of `crec` except for `environ` are concerned.
[ "Yield", "records", "that", "matches", "to", "crec", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/database.py#L346-L377
56,111
mathiasertl/xmpp-backends
xmpp_backends/dummy.py
DummyBackend.start_user_session
def start_user_session(self, username, domain, resource, **kwargs): """Method to add a user session for debugging. Accepted parameters are the same as to the constructor of :py:class:`~xmpp_backends.base.UserSession`. """ kwargs.setdefault('uptime', pytz.utc.localize(datetime.utcnow())...
python
def start_user_session(self, username, domain, resource, **kwargs): """Method to add a user session for debugging. Accepted parameters are the same as to the constructor of :py:class:`~xmpp_backends.base.UserSession`. """ kwargs.setdefault('uptime', pytz.utc.localize(datetime.utcnow())...
[ "def", "start_user_session", "(", "self", ",", "username", ",", "domain", ",", "resource", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'uptime'", ",", "pytz", ".", "utc", ".", "localize", "(", "datetime", ".", "utcnow", "(", "...
Method to add a user session for debugging. Accepted parameters are the same as to the constructor of :py:class:`~xmpp_backends.base.UserSession`.
[ "Method", "to", "add", "a", "user", "session", "for", "debugging", "." ]
214ef0664dbf90fa300c2483b9b3416559e5d171
https://github.com/mathiasertl/xmpp-backends/blob/214ef0664dbf90fa300c2483b9b3416559e5d171/xmpp_backends/dummy.py#L66-L103
56,112
staticdev/django-sorting-bootstrap
sorting_bootstrap/util.py
label_for_field
def label_for_field(name, model, return_attr=False): """ Returns a sensible label for a field name. The name can be a callable, property (but not created with @property decorator) or the name of an object's attribute, as well as a genuine fields. If return_attr is True, the resolved attribute (which...
python
def label_for_field(name, model, return_attr=False): """ Returns a sensible label for a field name. The name can be a callable, property (but not created with @property decorator) or the name of an object's attribute, as well as a genuine fields. If return_attr is True, the resolved attribute (which...
[ "def", "label_for_field", "(", "name", ",", "model", ",", "return_attr", "=", "False", ")", ":", "attr", "=", "None", "try", ":", "field", "=", "model", ".", "_meta", ".", "get_field_by_name", "(", "name", ")", "[", "0", "]", "if", "isinstance", "(", ...
Returns a sensible label for a field name. The name can be a callable, property (but not created with @property decorator) or the name of an object's attribute, as well as a genuine fields. If return_attr is True, the resolved attribute (which could be a callable) is also returned. This will be None if ...
[ "Returns", "a", "sensible", "label", "for", "a", "field", "name", ".", "The", "name", "can", "be", "a", "callable", "property", "(", "but", "not", "created", "with" ]
cfdc6e671b1b57aad04e44b041b9df10ee8288d3
https://github.com/staticdev/django-sorting-bootstrap/blob/cfdc6e671b1b57aad04e44b041b9df10ee8288d3/sorting_bootstrap/util.py#L17-L64
56,113
avalente/appmetrics
appmetrics/meter.py
EWMA.update
def update(self, value): """ Update the current rate with the given value. The value must be an integer. """ value = int(value) with self.lock: self.value += value
python
def update(self, value): """ Update the current rate with the given value. The value must be an integer. """ value = int(value) with self.lock: self.value += value
[ "def", "update", "(", "self", ",", "value", ")", ":", "value", "=", "int", "(", "value", ")", "with", "self", ".", "lock", ":", "self", ".", "value", "+=", "value" ]
Update the current rate with the given value. The value must be an integer.
[ "Update", "the", "current", "rate", "with", "the", "given", "value", ".", "The", "value", "must", "be", "an", "integer", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/meter.py#L60-L69
56,114
avalente/appmetrics
appmetrics/meter.py
EWMA.tick
def tick(self): """Decay the current rate according to the elapsed time""" instant_rate = float(self.value) / float(self.tick_interval) with self.lock: if self.initialized: self.rate += (self.alpha * (instant_rate - self.rate)) else: self...
python
def tick(self): """Decay the current rate according to the elapsed time""" instant_rate = float(self.value) / float(self.tick_interval) with self.lock: if self.initialized: self.rate += (self.alpha * (instant_rate - self.rate)) else: self...
[ "def", "tick", "(", "self", ")", ":", "instant_rate", "=", "float", "(", "self", ".", "value", ")", "/", "float", "(", "self", ".", "tick_interval", ")", "with", "self", ".", "lock", ":", "if", "self", ".", "initialized", ":", "self", ".", "rate", ...
Decay the current rate according to the elapsed time
[ "Decay", "the", "current", "rate", "according", "to", "the", "elapsed", "time" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/meter.py#L71-L83
56,115
avalente/appmetrics
appmetrics/meter.py
Meter.notify
def notify(self, value): """Add a new observation to the metric""" with self.lock: #TODO: this could slow down slow-rate incoming updates # since the number of ticks depends on the actual time # passed since the latest notification. Consider using # a rea...
python
def notify(self, value): """Add a new observation to the metric""" with self.lock: #TODO: this could slow down slow-rate incoming updates # since the number of ticks depends on the actual time # passed since the latest notification. Consider using # a rea...
[ "def", "notify", "(", "self", ",", "value", ")", ":", "with", "self", ".", "lock", ":", "#TODO: this could slow down slow-rate incoming updates", "# since the number of ticks depends on the actual time", "# passed since the latest notification. Consider using", "# a real timer to tic...
Add a new observation to the metric
[ "Add", "a", "new", "observation", "to", "the", "metric" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/meter.py#L112-L125
56,116
avalente/appmetrics
appmetrics/meter.py
Meter.tick_all
def tick_all(self, times): """ Tick all the EWMAs for the given number of times """ for i in range(times): for avg in (self.m1, self.m5, self.m15, self.day): avg.tick()
python
def tick_all(self, times): """ Tick all the EWMAs for the given number of times """ for i in range(times): for avg in (self.m1, self.m5, self.m15, self.day): avg.tick()
[ "def", "tick_all", "(", "self", ",", "times", ")", ":", "for", "i", "in", "range", "(", "times", ")", ":", "for", "avg", "in", "(", "self", ".", "m1", ",", "self", ".", "m5", ",", "self", ".", "m15", ",", "self", ".", "day", ")", ":", "avg", ...
Tick all the EWMAs for the given number of times
[ "Tick", "all", "the", "EWMAs", "for", "the", "given", "number", "of", "times" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/meter.py#L127-L134
56,117
intiocean/pyinter
pyinter/interval.py
open
def open(lower_value, upper_value): """Helper function to construct an interval object with open lower and upper. For example: >>> open(100.2, 800.9) (100.2, 800.9) """ return Interval(Interval.OPEN, lower_value, upper_value, Interval.OPEN)
python
def open(lower_value, upper_value): """Helper function to construct an interval object with open lower and upper. For example: >>> open(100.2, 800.9) (100.2, 800.9) """ return Interval(Interval.OPEN, lower_value, upper_value, Interval.OPEN)
[ "def", "open", "(", "lower_value", ",", "upper_value", ")", ":", "return", "Interval", "(", "Interval", ".", "OPEN", ",", "lower_value", ",", "upper_value", ",", "Interval", ".", "OPEN", ")" ]
Helper function to construct an interval object with open lower and upper. For example: >>> open(100.2, 800.9) (100.2, 800.9)
[ "Helper", "function", "to", "construct", "an", "interval", "object", "with", "open", "lower", "and", "upper", "." ]
fb6e904307477fa43123cc9ab326680aa1a8cd62
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L6-L14
56,118
intiocean/pyinter
pyinter/interval.py
closed
def closed(lower_value, upper_value): """Helper function to construct an interval object with closed lower and upper. For example: >>> closed(100.2, 800.9) [100.2, 800.9] """ return Interval(Interval.CLOSED, lower_value, upper_value, Interval.CLOSED)
python
def closed(lower_value, upper_value): """Helper function to construct an interval object with closed lower and upper. For example: >>> closed(100.2, 800.9) [100.2, 800.9] """ return Interval(Interval.CLOSED, lower_value, upper_value, Interval.CLOSED)
[ "def", "closed", "(", "lower_value", ",", "upper_value", ")", ":", "return", "Interval", "(", "Interval", ".", "CLOSED", ",", "lower_value", ",", "upper_value", ",", "Interval", ".", "CLOSED", ")" ]
Helper function to construct an interval object with closed lower and upper. For example: >>> closed(100.2, 800.9) [100.2, 800.9]
[ "Helper", "function", "to", "construct", "an", "interval", "object", "with", "closed", "lower", "and", "upper", "." ]
fb6e904307477fa43123cc9ab326680aa1a8cd62
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L17-L25
56,119
intiocean/pyinter
pyinter/interval.py
openclosed
def openclosed(lower_value, upper_value): """Helper function to construct an interval object with a open lower and closed upper. For example: >>> openclosed(100.2, 800.9) (100.2, 800.9] """ return Interval(Interval.OPEN, lower_value, upper_value, Interval.CLOSED)
python
def openclosed(lower_value, upper_value): """Helper function to construct an interval object with a open lower and closed upper. For example: >>> openclosed(100.2, 800.9) (100.2, 800.9] """ return Interval(Interval.OPEN, lower_value, upper_value, Interval.CLOSED)
[ "def", "openclosed", "(", "lower_value", ",", "upper_value", ")", ":", "return", "Interval", "(", "Interval", ".", "OPEN", ",", "lower_value", ",", "upper_value", ",", "Interval", ".", "CLOSED", ")" ]
Helper function to construct an interval object with a open lower and closed upper. For example: >>> openclosed(100.2, 800.9) (100.2, 800.9]
[ "Helper", "function", "to", "construct", "an", "interval", "object", "with", "a", "open", "lower", "and", "closed", "upper", "." ]
fb6e904307477fa43123cc9ab326680aa1a8cd62
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L28-L36
56,120
intiocean/pyinter
pyinter/interval.py
closedopen
def closedopen(lower_value, upper_value): """Helper function to construct an interval object with a closed lower and open upper. For example: >>> closedopen(100.2, 800.9) [100.2, 800.9) """ return Interval(Interval.CLOSED, lower_value, upper_value, Interval.OPEN)
python
def closedopen(lower_value, upper_value): """Helper function to construct an interval object with a closed lower and open upper. For example: >>> closedopen(100.2, 800.9) [100.2, 800.9) """ return Interval(Interval.CLOSED, lower_value, upper_value, Interval.OPEN)
[ "def", "closedopen", "(", "lower_value", ",", "upper_value", ")", ":", "return", "Interval", "(", "Interval", ".", "CLOSED", ",", "lower_value", ",", "upper_value", ",", "Interval", ".", "OPEN", ")" ]
Helper function to construct an interval object with a closed lower and open upper. For example: >>> closedopen(100.2, 800.9) [100.2, 800.9)
[ "Helper", "function", "to", "construct", "an", "interval", "object", "with", "a", "closed", "lower", "and", "open", "upper", "." ]
fb6e904307477fa43123cc9ab326680aa1a8cd62
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L39-L47
56,121
intiocean/pyinter
pyinter/interval.py
Interval.overlaps
def overlaps(self, other): """If self and other have any overlapping values returns True, otherwise returns False""" if self > other: smaller, larger = other, self else: smaller, larger = self, other if larger.empty(): return False if smaller._...
python
def overlaps(self, other): """If self and other have any overlapping values returns True, otherwise returns False""" if self > other: smaller, larger = other, self else: smaller, larger = self, other if larger.empty(): return False if smaller._...
[ "def", "overlaps", "(", "self", ",", "other", ")", ":", "if", "self", ">", "other", ":", "smaller", ",", "larger", "=", "other", ",", "self", "else", ":", "smaller", ",", "larger", "=", "self", ",", "other", "if", "larger", ".", "empty", "(", ")", ...
If self and other have any overlapping values returns True, otherwise returns False
[ "If", "self", "and", "other", "have", "any", "overlapping", "values", "returns", "True", "otherwise", "returns", "False" ]
fb6e904307477fa43123cc9ab326680aa1a8cd62
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L223-L233
56,122
avalente/appmetrics
appmetrics/reporter.py
remove
def remove(id_): """ Remove the callback and its schedule """ with LOCK: thread = REGISTRY.pop(id_, None) if thread is not None: thread.cancel() return thread
python
def remove(id_): """ Remove the callback and its schedule """ with LOCK: thread = REGISTRY.pop(id_, None) if thread is not None: thread.cancel() return thread
[ "def", "remove", "(", "id_", ")", ":", "with", "LOCK", ":", "thread", "=", "REGISTRY", ".", "pop", "(", "id_", ",", "None", ")", "if", "thread", "is", "not", "None", ":", "thread", ".", "cancel", "(", ")", "return", "thread" ]
Remove the callback and its schedule
[ "Remove", "the", "callback", "and", "its", "schedule" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/reporter.py#L73-L82
56,123
avalente/appmetrics
appmetrics/reporter.py
get_metrics
def get_metrics(tag): """ Return the values for the metrics with the given tag or all the available metrics if None """ if tag is None: return metrics.metrics_by_name_list(metrics.metrics()) else: return metrics.metrics_by_tag(tag)
python
def get_metrics(tag): """ Return the values for the metrics with the given tag or all the available metrics if None """ if tag is None: return metrics.metrics_by_name_list(metrics.metrics()) else: return metrics.metrics_by_tag(tag)
[ "def", "get_metrics", "(", "tag", ")", ":", "if", "tag", "is", "None", ":", "return", "metrics", ".", "metrics_by_name_list", "(", "metrics", ".", "metrics", "(", ")", ")", "else", ":", "return", "metrics", ".", "metrics_by_tag", "(", "tag", ")" ]
Return the values for the metrics with the given tag or all the available metrics if None
[ "Return", "the", "values", "for", "the", "metrics", "with", "the", "given", "tag", "or", "all", "the", "available", "metrics", "if", "None" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/reporter.py#L140-L147
56,124
avalente/appmetrics
appmetrics/reporter.py
fixed_interval_scheduler
def fixed_interval_scheduler(interval): """ A scheduler that ticks at fixed intervals of "interval" seconds """ start = time.time() next_tick = start while True: next_tick += interval yield next_tick
python
def fixed_interval_scheduler(interval): """ A scheduler that ticks at fixed intervals of "interval" seconds """ start = time.time() next_tick = start while True: next_tick += interval yield next_tick
[ "def", "fixed_interval_scheduler", "(", "interval", ")", ":", "start", "=", "time", ".", "time", "(", ")", "next_tick", "=", "start", "while", "True", ":", "next_tick", "+=", "interval", "yield", "next_tick" ]
A scheduler that ticks at fixed intervals of "interval" seconds
[ "A", "scheduler", "that", "ticks", "at", "fixed", "intervals", "of", "interval", "seconds" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/reporter.py#L150-L159
56,125
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Game.wrap_search
def wrap_search(cls, response): """Wrap the response from a game search into instances and return them :param response: The response from searching a game :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :class:`Game` ...
python
def wrap_search(cls, response): """Wrap the response from a game search into instances and return them :param response: The response from searching a game :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :class:`Game` ...
[ "def", "wrap_search", "(", "cls", ",", "response", ")", ":", "games", "=", "[", "]", "json", "=", "response", ".", "json", "(", ")", "gamejsons", "=", "json", "[", "'games'", "]", "for", "j", "in", "gamejsons", ":", "g", "=", "cls", ".", "wrap_json...
Wrap the response from a game search into instances and return them :param response: The response from searching a game :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :class:`Game` :raises: None
[ "Wrap", "the", "response", "from", "a", "game", "search", "into", "instances", "and", "return", "them" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L11-L27
56,126
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Game.wrap_topgames
def wrap_topgames(cls, response): """Wrap the response from quering the top games into instances and return them :param response: The response for quering the top games :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :...
python
def wrap_topgames(cls, response): """Wrap the response from quering the top games into instances and return them :param response: The response for quering the top games :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :...
[ "def", "wrap_topgames", "(", "cls", ",", "response", ")", ":", "games", "=", "[", "]", "json", "=", "response", ".", "json", "(", ")", "topjsons", "=", "json", "[", "'top'", "]", "for", "t", "in", "topjsons", ":", "g", "=", "cls", ".", "wrap_json",...
Wrap the response from quering the top games into instances and return them :param response: The response for quering the top games :type response: :class:`requests.Response` :returns: the new game instances :rtype: :class:`list` of :class:`Game` :raises: None
[ "Wrap", "the", "response", "from", "quering", "the", "top", "games", "into", "instances", "and", "return", "them" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L30-L48
56,127
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Game.wrap_json
def wrap_json(cls, json, viewers=None, channels=None): """Create a Game instance for the given json :param json: the dict with the information of the game :type json: :class:`dict` :param viewers: The viewer count :type viewers: :class:`int` :param channels: The viewer c...
python
def wrap_json(cls, json, viewers=None, channels=None): """Create a Game instance for the given json :param json: the dict with the information of the game :type json: :class:`dict` :param viewers: The viewer count :type viewers: :class:`int` :param channels: The viewer c...
[ "def", "wrap_json", "(", "cls", ",", "json", ",", "viewers", "=", "None", ",", "channels", "=", "None", ")", ":", "g", "=", "Game", "(", "name", "=", "json", ".", "get", "(", "'name'", ")", ",", "box", "=", "json", ".", "get", "(", "'box'", ")"...
Create a Game instance for the given json :param json: the dict with the information of the game :type json: :class:`dict` :param viewers: The viewer count :type viewers: :class:`int` :param channels: The viewer count :type channels: :class:`int` :returns: the ne...
[ "Create", "a", "Game", "instance", "for", "the", "given", "json" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L51-L70
56,128
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Channel.wrap_search
def wrap_search(cls, response): """Wrap the response from a channel search into instances and return them :param response: The response from searching a channel :type response: :class:`requests.Response` :returns: the new channel instances :rtype: :class:`list` of :class...
python
def wrap_search(cls, response): """Wrap the response from a channel search into instances and return them :param response: The response from searching a channel :type response: :class:`requests.Response` :returns: the new channel instances :rtype: :class:`list` of :class...
[ "def", "wrap_search", "(", "cls", ",", "response", ")", ":", "channels", "=", "[", "]", "json", "=", "response", ".", "json", "(", ")", "channeljsons", "=", "json", "[", "'channels'", "]", "for", "j", "in", "channeljsons", ":", "c", "=", "cls", ".", ...
Wrap the response from a channel search into instances and return them :param response: The response from searching a channel :type response: :class:`requests.Response` :returns: the new channel instances :rtype: :class:`list` of :class:`channel` :raises: None
[ "Wrap", "the", "response", "from", "a", "channel", "search", "into", "instances", "and", "return", "them" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L119-L135
56,129
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Channel.wrap_get_channel
def wrap_get_channel(cls, response): """Wrap the response from getting a channel into an instance and return it :param response: The response from getting a channel :type response: :class:`requests.Response` :returns: the new channel instance :rtype: :class:`list` of :cl...
python
def wrap_get_channel(cls, response): """Wrap the response from getting a channel into an instance and return it :param response: The response from getting a channel :type response: :class:`requests.Response` :returns: the new channel instance :rtype: :class:`list` of :cl...
[ "def", "wrap_get_channel", "(", "cls", ",", "response", ")", ":", "json", "=", "response", ".", "json", "(", ")", "c", "=", "cls", ".", "wrap_json", "(", "json", ")", "return", "c" ]
Wrap the response from getting a channel into an instance and return it :param response: The response from getting a channel :type response: :class:`requests.Response` :returns: the new channel instance :rtype: :class:`list` of :class:`channel` :raises: None
[ "Wrap", "the", "response", "from", "getting", "a", "channel", "into", "an", "instance", "and", "return", "it" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L138-L150
56,130
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Channel.wrap_json
def wrap_json(cls, json): """Create a Channel instance for the given json :param json: the dict with the information of the channel :type json: :class:`dict` :returns: the new channel instance :rtype: :class:`Channel` :raises: None """ c = Channel(name=js...
python
def wrap_json(cls, json): """Create a Channel instance for the given json :param json: the dict with the information of the channel :type json: :class:`dict` :returns: the new channel instance :rtype: :class:`Channel` :raises: None """ c = Channel(name=js...
[ "def", "wrap_json", "(", "cls", ",", "json", ")", ":", "c", "=", "Channel", "(", "name", "=", "json", ".", "get", "(", "'name'", ")", ",", "status", "=", "json", ".", "get", "(", "'status'", ")", ",", "displayname", "=", "json", ".", "get", "(", ...
Create a Channel instance for the given json :param json: the dict with the information of the channel :type json: :class:`dict` :returns: the new channel instance :rtype: :class:`Channel` :raises: None
[ "Create", "a", "Channel", "instance", "for", "the", "given", "json" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L153-L177
56,131
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Stream.wrap_search
def wrap_search(cls, response): """Wrap the response from a stream search into instances and return them :param response: The response from searching a stream :type response: :class:`requests.Response` :returns: the new stream instances :rtype: :class:`list` of :class:`s...
python
def wrap_search(cls, response): """Wrap the response from a stream search into instances and return them :param response: The response from searching a stream :type response: :class:`requests.Response` :returns: the new stream instances :rtype: :class:`list` of :class:`s...
[ "def", "wrap_search", "(", "cls", ",", "response", ")", ":", "streams", "=", "[", "]", "json", "=", "response", ".", "json", "(", ")", "streamjsons", "=", "json", "[", "'streams'", "]", "for", "j", "in", "streamjsons", ":", "s", "=", "cls", ".", "w...
Wrap the response from a stream search into instances and return them :param response: The response from searching a stream :type response: :class:`requests.Response` :returns: the new stream instances :rtype: :class:`list` of :class:`stream` :raises: None
[ "Wrap", "the", "response", "from", "a", "stream", "search", "into", "instances", "and", "return", "them" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L264-L280
56,132
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Stream.wrap_get_stream
def wrap_get_stream(cls, response): """Wrap the response from getting a stream into an instance and return it :param response: The response from getting a stream :type response: :class:`requests.Response` :returns: the new stream instance :rtype: :class:`list` of :class:...
python
def wrap_get_stream(cls, response): """Wrap the response from getting a stream into an instance and return it :param response: The response from getting a stream :type response: :class:`requests.Response` :returns: the new stream instance :rtype: :class:`list` of :class:...
[ "def", "wrap_get_stream", "(", "cls", ",", "response", ")", ":", "json", "=", "response", ".", "json", "(", ")", "s", "=", "cls", ".", "wrap_json", "(", "json", "[", "'stream'", "]", ")", "return", "s" ]
Wrap the response from getting a stream into an instance and return it :param response: The response from getting a stream :type response: :class:`requests.Response` :returns: the new stream instance :rtype: :class:`list` of :class:`stream` :raises: None
[ "Wrap", "the", "response", "from", "getting", "a", "stream", "into", "an", "instance", "and", "return", "it" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L283-L295
56,133
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
Stream.wrap_json
def wrap_json(cls, json): """Create a Stream instance for the given json :param json: the dict with the information of the stream :type json: :class:`dict` | None :returns: the new stream instance :rtype: :class:`Stream` | None :raises: None """ if json i...
python
def wrap_json(cls, json): """Create a Stream instance for the given json :param json: the dict with the information of the stream :type json: :class:`dict` | None :returns: the new stream instance :rtype: :class:`Stream` | None :raises: None """ if json i...
[ "def", "wrap_json", "(", "cls", ",", "json", ")", ":", "if", "json", "is", "None", ":", "return", "None", "channel", "=", "Channel", ".", "wrap_json", "(", "json", ".", "get", "(", "'channel'", ")", ")", "s", "=", "Stream", "(", "game", "=", "json"...
Create a Stream instance for the given json :param json: the dict with the information of the stream :type json: :class:`dict` | None :returns: the new stream instance :rtype: :class:`Stream` | None :raises: None
[ "Create", "a", "Stream", "instance", "for", "the", "given", "json" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L298-L315
56,134
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
User.wrap_get_user
def wrap_get_user(cls, response): """Wrap the response from getting a user into an instance and return it :param response: The response from getting a user :type response: :class:`requests.Response` :returns: the new user instance :rtype: :class:`list` of :class:`User` ...
python
def wrap_get_user(cls, response): """Wrap the response from getting a user into an instance and return it :param response: The response from getting a user :type response: :class:`requests.Response` :returns: the new user instance :rtype: :class:`list` of :class:`User` ...
[ "def", "wrap_get_user", "(", "cls", ",", "response", ")", ":", "json", "=", "response", ".", "json", "(", ")", "u", "=", "cls", ".", "wrap_json", "(", "json", ")", "return", "u" ]
Wrap the response from getting a user into an instance and return it :param response: The response from getting a user :type response: :class:`requests.Response` :returns: the new user instance :rtype: :class:`list` of :class:`User` :raises: None
[ "Wrap", "the", "response", "from", "getting", "a", "user", "into", "an", "instance", "and", "return", "it" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L360-L372
56,135
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
User.wrap_json
def wrap_json(cls, json): """Create a User instance for the given json :param json: the dict with the information of the user :type json: :class:`dict` | None :returns: the new user instance :rtype: :class:`User` :raises: None """ u = User(usertype=json['...
python
def wrap_json(cls, json): """Create a User instance for the given json :param json: the dict with the information of the user :type json: :class:`dict` | None :returns: the new user instance :rtype: :class:`User` :raises: None """ u = User(usertype=json['...
[ "def", "wrap_json", "(", "cls", ",", "json", ")", ":", "u", "=", "User", "(", "usertype", "=", "json", "[", "'type'", "]", ",", "name", "=", "json", "[", "'name'", "]", ",", "logo", "=", "json", "[", "'logo'", "]", ",", "twitchid", "=", "json", ...
Create a User instance for the given json :param json: the dict with the information of the user :type json: :class:`dict` | None :returns: the new user instance :rtype: :class:`User` :raises: None
[ "Create", "a", "User", "instance", "for", "the", "given", "json" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L375-L390
56,136
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/client.py
_wrap_execute_after
def _wrap_execute_after(funcname): """Warp the given method, so it gets executed by the reactor Wrap a method of :data:`IRCCLient.out_connection`. The returned function should be assigned to a :class:`irc.client.SimpleIRCClient` class. :param funcname: the name of a :class:`irc.client.ServerConnectio...
python
def _wrap_execute_after(funcname): """Warp the given method, so it gets executed by the reactor Wrap a method of :data:`IRCCLient.out_connection`. The returned function should be assigned to a :class:`irc.client.SimpleIRCClient` class. :param funcname: the name of a :class:`irc.client.ServerConnectio...
[ "def", "_wrap_execute_after", "(", "funcname", ")", ":", "def", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "f", "=", "getattr", "(", "self", ".", "out_connection", ",", "funcname", ")", "p", "=", "functools", ".", "pa...
Warp the given method, so it gets executed by the reactor Wrap a method of :data:`IRCCLient.out_connection`. The returned function should be assigned to a :class:`irc.client.SimpleIRCClient` class. :param funcname: the name of a :class:`irc.client.ServerConnection` method :type funcname: :class:`str`...
[ "Warp", "the", "given", "method", "so", "it", "gets", "executed", "by", "the", "reactor" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/client.py#L100-L117
56,137
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/client.py
Reactor.shutdown
def shutdown(self): """Disconnect all connections and end the loop :returns: None :rtype: None :raises: None """ log.debug('Shutting down %s' % self) self.disconnect_all() self._looping.clear()
python
def shutdown(self): """Disconnect all connections and end the loop :returns: None :rtype: None :raises: None """ log.debug('Shutting down %s' % self) self.disconnect_all() self._looping.clear()
[ "def", "shutdown", "(", "self", ")", ":", "log", ".", "debug", "(", "'Shutting down %s'", "%", "self", ")", "self", ".", "disconnect_all", "(", ")", "self", ".", "_looping", ".", "clear", "(", ")" ]
Disconnect all connections and end the loop :returns: None :rtype: None :raises: None
[ "Disconnect", "all", "connections", "and", "end", "the", "loop" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/client.py#L68-L77
56,138
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/client.py
Reactor3.server
def server(self, ): """Creates and returns a ServerConnection :returns: a server connection :rtype: :class:`connection.ServerConnection3` :raises: None """ c = connection.ServerConnection3(self) with self.mutex: self.connections.append(c) retu...
python
def server(self, ): """Creates and returns a ServerConnection :returns: a server connection :rtype: :class:`connection.ServerConnection3` :raises: None """ c = connection.ServerConnection3(self) with self.mutex: self.connections.append(c) retu...
[ "def", "server", "(", "self", ",", ")", ":", "c", "=", "connection", ".", "ServerConnection3", "(", "self", ")", "with", "self", ".", "mutex", ":", "self", ".", "connections", ".", "append", "(", "c", ")", "return", "c" ]
Creates and returns a ServerConnection :returns: a server connection :rtype: :class:`connection.ServerConnection3` :raises: None
[ "Creates", "and", "returns", "a", "ServerConnection" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/client.py#L87-L97
56,139
tkf/rash
rash/init.py
init_run
def init_run(shell, no_daemon, daemon_options, daemon_outfile): """ Configure your shell. Add the following line in your shell RC file and then you are ready to go:: eval $(%(prog)s) To check if your shell is supported, simply run:: %(prog)s --no-daemon If you want to specify sh...
python
def init_run(shell, no_daemon, daemon_options, daemon_outfile): """ Configure your shell. Add the following line in your shell RC file and then you are ready to go:: eval $(%(prog)s) To check if your shell is supported, simply run:: %(prog)s --no-daemon If you want to specify sh...
[ "def", "init_run", "(", "shell", ",", "no_daemon", ",", "daemon_options", ",", "daemon_outfile", ")", ":", "import", "sys", "from", ".", "__init__", "import", "__version__", "init_file", "=", "find_init", "(", "shell", ")", "if", "os", ".", "path", ".", "e...
Configure your shell. Add the following line in your shell RC file and then you are ready to go:: eval $(%(prog)s) To check if your shell is supported, simply run:: %(prog)s --no-daemon If you want to specify shell other than $SHELL, you can give --shell option:: eval $(%(pro...
[ "Configure", "your", "shell", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/init.py#L37-L77
56,140
alpha-xone/xone
xone/cache.py
update_data
def update_data(func): """ Decorator to save data more easily. Use parquet as data format Args: func: function to load data from data source Returns: wrapped function """ default = dict([ (param.name, param.default) for param in inspect.signature(func).parameter...
python
def update_data(func): """ Decorator to save data more easily. Use parquet as data format Args: func: function to load data from data source Returns: wrapped function """ default = dict([ (param.name, param.default) for param in inspect.signature(func).parameter...
[ "def", "update_data", "(", "func", ")", ":", "default", "=", "dict", "(", "[", "(", "param", ".", "name", ",", "param", ".", "default", ")", "for", "param", "in", "inspect", ".", "signature", "(", "func", ")", ".", "parameters", ".", "values", "(", ...
Decorator to save data more easily. Use parquet as data format Args: func: function to load data from data source Returns: wrapped function
[ "Decorator", "to", "save", "data", "more", "easily", ".", "Use", "parquet", "as", "data", "format" ]
68534a30f7f1760b220ba58040be3927f7dfbcf4
https://github.com/alpha-xone/xone/blob/68534a30f7f1760b220ba58040be3927f7dfbcf4/xone/cache.py#L46-L99
56,141
alpha-xone/xone
xone/cache.py
save_data
def save_data(data, file_fmt, append=False, drop_dups=None, info=None, **kwargs): """ Save data to file Args: data: pd.DataFrame file_fmt: data file format in terms of f-strings append: if append data to existing data drop_dups: list, drop duplicates in columns info:...
python
def save_data(data, file_fmt, append=False, drop_dups=None, info=None, **kwargs): """ Save data to file Args: data: pd.DataFrame file_fmt: data file format in terms of f-strings append: if append data to existing data drop_dups: list, drop duplicates in columns info:...
[ "def", "save_data", "(", "data", ",", "file_fmt", ",", "append", "=", "False", ",", "drop_dups", "=", "None", ",", "info", "=", "None", ",", "*", "*", "kwargs", ")", ":", "d_file", "=", "data_file", "(", "file_fmt", "=", "file_fmt", ",", "info", "=",...
Save data to file Args: data: pd.DataFrame file_fmt: data file format in terms of f-strings append: if append data to existing data drop_dups: list, drop duplicates in columns info: dict, infomation to be hashed and passed to f-strings **kwargs: additional parameters...
[ "Save", "data", "to", "file" ]
68534a30f7f1760b220ba58040be3927f7dfbcf4
https://github.com/alpha-xone/xone/blob/68534a30f7f1760b220ba58040be3927f7dfbcf4/xone/cache.py#L102-L128
56,142
alpha-xone/xone
xone/cache.py
data_file
def data_file(file_fmt, info=None, **kwargs): """ Data file name for given infomation Args: file_fmt: file format in terms of f-strings info: dict, to be hashed and then pass to f-string using 'hash_key' these info will also be passed to f-strings **kwargs: arguments f...
python
def data_file(file_fmt, info=None, **kwargs): """ Data file name for given infomation Args: file_fmt: file format in terms of f-strings info: dict, to be hashed and then pass to f-string using 'hash_key' these info will also be passed to f-strings **kwargs: arguments f...
[ "def", "data_file", "(", "file_fmt", ",", "info", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "info", ",", "dict", ")", ":", "kwargs", "[", "'hash_key'", "]", "=", "hashlib", ".", "sha256", "(", "json", ".", "dumps", "(...
Data file name for given infomation Args: file_fmt: file format in terms of f-strings info: dict, to be hashed and then pass to f-string using 'hash_key' these info will also be passed to f-strings **kwargs: arguments for f-strings Returns: str: data file name
[ "Data", "file", "name", "for", "given", "infomation" ]
68534a30f7f1760b220ba58040be3927f7dfbcf4
https://github.com/alpha-xone/xone/blob/68534a30f7f1760b220ba58040be3927f7dfbcf4/xone/cache.py#L131-L148
56,143
tkf/rash
rash/index.py
index_run
def index_run(record_path, keep_json, check_duplicate): """ Convert raw JSON records into sqlite3 DB. Normally RASH launches a daemon that takes care of indexing. See ``rash daemon --help``. """ from .config import ConfigStore from .indexer import Indexer cfstore = ConfigStore() in...
python
def index_run(record_path, keep_json, check_duplicate): """ Convert raw JSON records into sqlite3 DB. Normally RASH launches a daemon that takes care of indexing. See ``rash daemon --help``. """ from .config import ConfigStore from .indexer import Indexer cfstore = ConfigStore() in...
[ "def", "index_run", "(", "record_path", ",", "keep_json", ",", "check_duplicate", ")", ":", "from", ".", "config", "import", "ConfigStore", "from", ".", "indexer", "import", "Indexer", "cfstore", "=", "ConfigStore", "(", ")", "indexer", "=", "Indexer", "(", ...
Convert raw JSON records into sqlite3 DB. Normally RASH launches a daemon that takes care of indexing. See ``rash daemon --help``.
[ "Convert", "raw", "JSON", "records", "into", "sqlite3", "DB", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/index.py#L17-L29
56,144
pebble/libpebble2
libpebble2/services/data_logging.py
DataLoggingService.list
def list(self): """ List all available data logging sessions """ # We have to open this queue before we make the request, to ensure we don't miss the response. queue = self._pebble.get_endpoint_queue(DataLogging) self._pebble.send_packet(DataLogging(data=DataLoggingRepo...
python
def list(self): """ List all available data logging sessions """ # We have to open this queue before we make the request, to ensure we don't miss the response. queue = self._pebble.get_endpoint_queue(DataLogging) self._pebble.send_packet(DataLogging(data=DataLoggingRepo...
[ "def", "list", "(", "self", ")", ":", "# We have to open this queue before we make the request, to ensure we don't miss the response.", "queue", "=", "self", ".", "_pebble", ".", "get_endpoint_queue", "(", "DataLogging", ")", "self", ".", "_pebble", ".", "send_packet", "(...
List all available data logging sessions
[ "List", "all", "available", "data", "logging", "sessions" ]
23e2eb92cfc084e6f9e8c718711ac994ef606d18
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/services/data_logging.py#L23-L45
56,145
pebble/libpebble2
libpebble2/services/data_logging.py
DataLoggingService.get_send_enable
def get_send_enable(self): """ Return true if sending of sessions is enabled on the watch """ # We have to open this queue before we make the request, to ensure we don't miss the response. queue = self._pebble.get_endpoint_queue(DataLogging) self._pebble.send_packet(Dat...
python
def get_send_enable(self): """ Return true if sending of sessions is enabled on the watch """ # We have to open this queue before we make the request, to ensure we don't miss the response. queue = self._pebble.get_endpoint_queue(DataLogging) self._pebble.send_packet(Dat...
[ "def", "get_send_enable", "(", "self", ")", ":", "# We have to open this queue before we make the request, to ensure we don't miss the response.", "queue", "=", "self", ".", "_pebble", ".", "get_endpoint_queue", "(", "DataLogging", ")", "self", ".", "_pebble", ".", "send_pa...
Return true if sending of sessions is enabled on the watch
[ "Return", "true", "if", "sending", "of", "sessions", "is", "enabled", "on", "the", "watch" ]
23e2eb92cfc084e6f9e8c718711ac994ef606d18
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/services/data_logging.py#L116-L133
56,146
pebble/libpebble2
libpebble2/services/data_logging.py
DataLoggingService.set_send_enable
def set_send_enable(self, setting): """ Set the send enable setting on the watch """ self._pebble.send_packet(DataLogging(data=DataLoggingSetSendEnable(enabled=setting)))
python
def set_send_enable(self, setting): """ Set the send enable setting on the watch """ self._pebble.send_packet(DataLogging(data=DataLoggingSetSendEnable(enabled=setting)))
[ "def", "set_send_enable", "(", "self", ",", "setting", ")", ":", "self", ".", "_pebble", ".", "send_packet", "(", "DataLogging", "(", "data", "=", "DataLoggingSetSendEnable", "(", "enabled", "=", "setting", ")", ")", ")" ]
Set the send enable setting on the watch
[ "Set", "the", "send", "enable", "setting", "on", "the", "watch" ]
23e2eb92cfc084e6f9e8c718711ac994ef606d18
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/services/data_logging.py#L136-L140
56,147
tkf/rash
rash/log.py
loglevel
def loglevel(level): """ Convert any representation of `level` to an int appropriately. :type level: int or str :rtype: int >>> loglevel('DEBUG') == logging.DEBUG True >>> loglevel(10) 10 >>> loglevel(None) Traceback (most recent call last): ... ValueError: None is no...
python
def loglevel(level): """ Convert any representation of `level` to an int appropriately. :type level: int or str :rtype: int >>> loglevel('DEBUG') == logging.DEBUG True >>> loglevel(10) 10 >>> loglevel(None) Traceback (most recent call last): ... ValueError: None is no...
[ "def", "loglevel", "(", "level", ")", ":", "if", "isinstance", "(", "level", ",", "str", ")", ":", "level", "=", "getattr", "(", "logging", ",", "level", ".", "upper", "(", ")", ")", "elif", "isinstance", "(", "level", ",", "int", ")", ":", "pass",...
Convert any representation of `level` to an int appropriately. :type level: int or str :rtype: int >>> loglevel('DEBUG') == logging.DEBUG True >>> loglevel(10) 10 >>> loglevel(None) Traceback (most recent call last): ... ValueError: None is not a proper log level.
[ "Convert", "any", "representation", "of", "level", "to", "an", "int", "appropriately", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/log.py#L20-L43
56,148
tkf/rash
rash/log.py
setup_daemon_log_file
def setup_daemon_log_file(cfstore): """ Attach file handler to RASH logger. :type cfstore: rash.config.ConfigStore """ level = loglevel(cfstore.daemon_log_level) handler = logging.FileHandler(filename=cfstore.daemon_log_path) handler.setLevel(level) logger.setLevel(level) logger.ad...
python
def setup_daemon_log_file(cfstore): """ Attach file handler to RASH logger. :type cfstore: rash.config.ConfigStore """ level = loglevel(cfstore.daemon_log_level) handler = logging.FileHandler(filename=cfstore.daemon_log_path) handler.setLevel(level) logger.setLevel(level) logger.ad...
[ "def", "setup_daemon_log_file", "(", "cfstore", ")", ":", "level", "=", "loglevel", "(", "cfstore", ".", "daemon_log_level", ")", "handler", "=", "logging", ".", "FileHandler", "(", "filename", "=", "cfstore", ".", "daemon_log_path", ")", "handler", ".", "setL...
Attach file handler to RASH logger. :type cfstore: rash.config.ConfigStore
[ "Attach", "file", "handler", "to", "RASH", "logger", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/log.py#L49-L60
56,149
mathiasertl/xmpp-backends
xmpp_backends/xmlrpclib.py
gzip_encode
def gzip_encode(data): """data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO() gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) gzf.write(data) gzf.close() ...
python
def gzip_encode(data): """data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO() gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) gzf.write(data) gzf.close() ...
[ "def", "gzip_encode", "(", "data", ")", ":", "if", "not", "gzip", ":", "raise", "NotImplementedError", "f", "=", "StringIO", ".", "StringIO", "(", ")", "gzf", "=", "gzip", ".", "GzipFile", "(", "mode", "=", "\"wb\"", ",", "fileobj", "=", "f", ",", "c...
data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952
[ "data", "-", ">", "gzip", "encoded", "data" ]
214ef0664dbf90fa300c2483b9b3416559e5d171
https://github.com/mathiasertl/xmpp-backends/blob/214ef0664dbf90fa300c2483b9b3416559e5d171/xmpp_backends/xmlrpclib.py#L1240-L1253
56,150
mathiasertl/xmpp-backends
xmpp_backends/xmlrpclib.py
gzip_decode
def gzip_decode(data, max_decode=20971520): """gzip encoded data -> unencoded data Decode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO(data) gzf = gzip.GzipFile(mode="rb", fileobj=f) try: if ma...
python
def gzip_decode(data, max_decode=20971520): """gzip encoded data -> unencoded data Decode data using the gzip content encoding as described in RFC 1952 """ if not gzip: raise NotImplementedError f = StringIO.StringIO(data) gzf = gzip.GzipFile(mode="rb", fileobj=f) try: if ma...
[ "def", "gzip_decode", "(", "data", ",", "max_decode", "=", "20971520", ")", ":", "if", "not", "gzip", ":", "raise", "NotImplementedError", "f", "=", "StringIO", ".", "StringIO", "(", "data", ")", "gzf", "=", "gzip", ".", "GzipFile", "(", "mode", "=", "...
gzip encoded data -> unencoded data Decode data using the gzip content encoding as described in RFC 1952
[ "gzip", "encoded", "data", "-", ">", "unencoded", "data" ]
214ef0664dbf90fa300c2483b9b3416559e5d171
https://github.com/mathiasertl/xmpp-backends/blob/214ef0664dbf90fa300c2483b9b3416559e5d171/xmpp_backends/xmlrpclib.py#L1267-L1287
56,151
staticdev/django-sorting-bootstrap
sorting_bootstrap/templatetags/sorting_tags.py
result_headers
def result_headers(context, cl): """ Generates the list column headers. """ for i, field_name in enumerate(cl.list_display): text, attr = label_for_field(field_name, cl.model, return_attr=True) if attr: # Potentially not sortable # if the field is the action che...
python
def result_headers(context, cl): """ Generates the list column headers. """ for i, field_name in enumerate(cl.list_display): text, attr = label_for_field(field_name, cl.model, return_attr=True) if attr: # Potentially not sortable # if the field is the action che...
[ "def", "result_headers", "(", "context", ",", "cl", ")", ":", "for", "i", ",", "field_name", "in", "enumerate", "(", "cl", ".", "list_display", ")", ":", "text", ",", "attr", "=", "label_for_field", "(", "field_name", ",", "cl", ".", "model", ",", "ret...
Generates the list column headers.
[ "Generates", "the", "list", "column", "headers", "." ]
cfdc6e671b1b57aad04e44b041b9df10ee8288d3
https://github.com/staticdev/django-sorting-bootstrap/blob/cfdc6e671b1b57aad04e44b041b9df10ee8288d3/sorting_bootstrap/templatetags/sorting_tags.py#L16-L94
56,152
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/message.py
Tag.from_str
def from_str(cls, tagstring): """Create a tag by parsing the tag of a message :param tagstring: A tag string described in the irc protocol :type tagstring: :class:`str` :returns: A tag :rtype: :class:`Tag` :raises: None """ m = cls._parse_regexp.match(tag...
python
def from_str(cls, tagstring): """Create a tag by parsing the tag of a message :param tagstring: A tag string described in the irc protocol :type tagstring: :class:`str` :returns: A tag :rtype: :class:`Tag` :raises: None """ m = cls._parse_regexp.match(tag...
[ "def", "from_str", "(", "cls", ",", "tagstring", ")", ":", "m", "=", "cls", ".", "_parse_regexp", ".", "match", "(", "tagstring", ")", "return", "cls", "(", "name", "=", "m", ".", "group", "(", "'name'", ")", ",", "value", "=", "m", ".", "group", ...
Create a tag by parsing the tag of a message :param tagstring: A tag string described in the irc protocol :type tagstring: :class:`str` :returns: A tag :rtype: :class:`Tag` :raises: None
[ "Create", "a", "tag", "by", "parsing", "the", "tag", "of", "a", "message" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/message.py#L61-L71
56,153
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/message.py
Emote.from_str
def from_str(cls, emotestr): """Create an emote from the emote tag key :param emotestr: the tag key, e.g. ``'123:0-4'`` :type emotestr: :class:`str` :returns: an emote :rtype: :class:`Emote` :raises: None """ emoteid, occstr = emotestr.split(':') ...
python
def from_str(cls, emotestr): """Create an emote from the emote tag key :param emotestr: the tag key, e.g. ``'123:0-4'`` :type emotestr: :class:`str` :returns: an emote :rtype: :class:`Emote` :raises: None """ emoteid, occstr = emotestr.split(':') ...
[ "def", "from_str", "(", "cls", ",", "emotestr", ")", ":", "emoteid", ",", "occstr", "=", "emotestr", ".", "split", "(", "':'", ")", "occurences", "=", "[", "]", "for", "occ", "in", "occstr", ".", "split", "(", "','", ")", ":", "start", ",", "end", ...
Create an emote from the emote tag key :param emotestr: the tag key, e.g. ``'123:0-4'`` :type emotestr: :class:`str` :returns: an emote :rtype: :class:`Emote` :raises: None
[ "Create", "an", "emote", "from", "the", "emote", "tag", "key" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/message.py#L113-L127
56,154
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/message.py
Message3.from_event
def from_event(cls, event): """Create a message from an event :param event: the event that was received of type ``pubmsg`` or ``privmsg`` :type event: :class:`Event3` :returns: a message that resembles the event :rtype: :class:`Message3` :raises: None """ ...
python
def from_event(cls, event): """Create a message from an event :param event: the event that was received of type ``pubmsg`` or ``privmsg`` :type event: :class:`Event3` :returns: a message that resembles the event :rtype: :class:`Message3` :raises: None """ ...
[ "def", "from_event", "(", "cls", ",", "event", ")", ":", "source", "=", "Chatter", "(", "event", ".", "source", ")", "return", "cls", "(", "source", ",", "event", ".", "target", ",", "event", ".", "arguments", "[", "0", "]", ",", "event", ".", "tag...
Create a message from an event :param event: the event that was received of type ``pubmsg`` or ``privmsg`` :type event: :class:`Event3` :returns: a message that resembles the event :rtype: :class:`Message3` :raises: None
[ "Create", "a", "message", "from", "an", "event" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/message.py#L265-L275
56,155
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/message.py
Message3.set_tags
def set_tags(self, tags): """For every known tag, set the appropriate attribute. Known tags are: :color: The user color :emotes: A list of emotes :subscriber: True, if subscriber :turbo: True, if turbo user :user_type: None, mod, staff, globa...
python
def set_tags(self, tags): """For every known tag, set the appropriate attribute. Known tags are: :color: The user color :emotes: A list of emotes :subscriber: True, if subscriber :turbo: True, if turbo user :user_type: None, mod, staff, globa...
[ "def", "set_tags", "(", "self", ",", "tags", ")", ":", "if", "tags", "is", "None", ":", "return", "attrmap", "=", "{", "'color'", ":", "'color'", ",", "'emotes'", ":", "'emotes'", ",", "'subscriber'", ":", "'subscriber'", ",", "'turbo'", ":", "'turbo'", ...
For every known tag, set the appropriate attribute. Known tags are: :color: The user color :emotes: A list of emotes :subscriber: True, if subscriber :turbo: True, if turbo user :user_type: None, mod, staff, global_mod, admin :param tags: a ...
[ "For", "every", "known", "tag", "set", "the", "appropriate", "attribute", "." ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/message.py#L292-L319
56,156
Pytwitcher/pytwitcherapi
src/pytwitcherapi/chat/message.py
Message3.emotes
def emotes(self, emotes): """Set the emotes :param emotes: the key of the emotes tag :type emotes: :class:`str` :returns: None :rtype: None :raises: None """ if emotes is None: self._emotes = [] return es = [] for e...
python
def emotes(self, emotes): """Set the emotes :param emotes: the key of the emotes tag :type emotes: :class:`str` :returns: None :rtype: None :raises: None """ if emotes is None: self._emotes = [] return es = [] for e...
[ "def", "emotes", "(", "self", ",", "emotes", ")", ":", "if", "emotes", "is", "None", ":", "self", ".", "_emotes", "=", "[", "]", "return", "es", "=", "[", "]", "for", "estr", "in", "emotes", ".", "split", "(", "'/'", ")", ":", "es", ".", "appen...
Set the emotes :param emotes: the key of the emotes tag :type emotes: :class:`str` :returns: None :rtype: None :raises: None
[ "Set", "the", "emotes" ]
d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/chat/message.py#L332-L347
56,157
avalente/appmetrics
appmetrics/statistics.py
coerce_types
def coerce_types(T1, T2): """Coerce types T1 and T2 to a common type. Coercion is performed according to this table, where "N/A" means that a TypeError exception is raised. +----------+-----------+-----------+-----------+----------+ | | int | Fraction | Decimal | float | +...
python
def coerce_types(T1, T2): """Coerce types T1 and T2 to a common type. Coercion is performed according to this table, where "N/A" means that a TypeError exception is raised. +----------+-----------+-----------+-----------+----------+ | | int | Fraction | Decimal | float | +...
[ "def", "coerce_types", "(", "T1", ",", "T2", ")", ":", "# Get the common/fast cases out of the way first.", "if", "T1", "is", "T2", ":", "return", "T1", "if", "T1", "is", "int", ":", "return", "T2", "if", "T2", "is", "int", ":", "return", "T1", "# Subclass...
Coerce types T1 and T2 to a common type. Coercion is performed according to this table, where "N/A" means that a TypeError exception is raised. +----------+-----------+-----------+-----------+----------+ | | int | Fraction | Decimal | float | +----------+-----------+----------...
[ "Coerce", "types", "T1", "and", "T2", "to", "a", "common", "type", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L125-L157
56,158
avalente/appmetrics
appmetrics/statistics.py
median_low
def median_low(data): """Return the low median of numeric data. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned. """ data = sorted(data) n = len(data) if n == 0: raise StatisticsError("no median f...
python
def median_low(data): """Return the low median of numeric data. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned. """ data = sorted(data) n = len(data) if n == 0: raise StatisticsError("no median f...
[ "def", "median_low", "(", "data", ")", ":", "data", "=", "sorted", "(", "data", ")", "n", "=", "len", "(", "data", ")", "if", "n", "==", "0", ":", "raise", "StatisticsError", "(", "\"no median for empty data\"", ")", "if", "n", "%", "2", "==", "1", ...
Return the low median of numeric data. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned.
[ "Return", "the", "low", "median", "of", "numeric", "data", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L213-L226
56,159
avalente/appmetrics
appmetrics/statistics.py
median_high
def median_high(data): """Return the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned. """ data = sorted(data) n = len(data) if n == 0: raise StatisticsError("no median for emp...
python
def median_high(data): """Return the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned. """ data = sorted(data) n = len(data) if n == 0: raise StatisticsError("no median for emp...
[ "def", "median_high", "(", "data", ")", ":", "data", "=", "sorted", "(", "data", ")", "n", "=", "len", "(", "data", ")", "if", "n", "==", "0", ":", "raise", "StatisticsError", "(", "\"no median for empty data\"", ")", "return", "data", "[", "n", "//", ...
Return the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned.
[ "Return", "the", "high", "median", "of", "data", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L229-L240
56,160
avalente/appmetrics
appmetrics/statistics.py
variance
def variance(data, xbar=None): """Return the sample variance of data. data should be an iterable of Real-valued numbers, with at least two values. The optional argument xbar, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function...
python
def variance(data, xbar=None): """Return the sample variance of data. data should be an iterable of Real-valued numbers, with at least two values. The optional argument xbar, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function...
[ "def", "variance", "(", "data", ",", "xbar", "=", "None", ")", ":", "if", "iter", "(", "data", ")", "is", "data", ":", "data", "=", "list", "(", "data", ")", "n", "=", "len", "(", "data", ")", "if", "n", "<", "2", ":", "raise", "StatisticsError...
Return the sample variance of data. data should be an iterable of Real-valued numbers, with at least two values. The optional argument xbar, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function when your data is a sample from a pop...
[ "Return", "the", "sample", "variance", "of", "data", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L295-L321
56,161
avalente/appmetrics
appmetrics/statistics.py
pvariance
def pvariance(data, mu=None): """Return the population variance of ``data``. data should be an iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this func...
python
def pvariance(data, mu=None): """Return the population variance of ``data``. data should be an iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this func...
[ "def", "pvariance", "(", "data", ",", "mu", "=", "None", ")", ":", "if", "iter", "(", "data", ")", "is", "data", ":", "data", "=", "list", "(", "data", ")", "n", "=", "len", "(", "data", ")", "if", "n", "<", "1", ":", "raise", "StatisticsError"...
Return the population variance of ``data``. data should be an iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function to calculate the variance from t...
[ "Return", "the", "population", "variance", "of", "data", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L324-L353
56,162
avalente/appmetrics
appmetrics/statistics.py
stdev
def stdev(data, xbar=None): """Return the square root of the sample variance. See ``variance`` for arguments and other details. """ var = variance(data, xbar) try: return var.sqrt() except AttributeError: return math.sqrt(var)
python
def stdev(data, xbar=None): """Return the square root of the sample variance. See ``variance`` for arguments and other details. """ var = variance(data, xbar) try: return var.sqrt() except AttributeError: return math.sqrt(var)
[ "def", "stdev", "(", "data", ",", "xbar", "=", "None", ")", ":", "var", "=", "variance", "(", "data", ",", "xbar", ")", "try", ":", "return", "var", ".", "sqrt", "(", ")", "except", "AttributeError", ":", "return", "math", ".", "sqrt", "(", "var", ...
Return the square root of the sample variance. See ``variance`` for arguments and other details.
[ "Return", "the", "square", "root", "of", "the", "sample", "variance", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L356-L366
56,163
avalente/appmetrics
appmetrics/statistics.py
pstdev
def pstdev(data, mu=None): """Return the square root of the population variance. See ``pvariance`` for arguments and other details. """ var = pvariance(data, mu) try: return var.sqrt() except AttributeError: return math.sqrt(var)
python
def pstdev(data, mu=None): """Return the square root of the population variance. See ``pvariance`` for arguments and other details. """ var = pvariance(data, mu) try: return var.sqrt() except AttributeError: return math.sqrt(var)
[ "def", "pstdev", "(", "data", ",", "mu", "=", "None", ")", ":", "var", "=", "pvariance", "(", "data", ",", "mu", ")", "try", ":", "return", "var", ".", "sqrt", "(", ")", "except", "AttributeError", ":", "return", "math", ".", "sqrt", "(", "var", ...
Return the square root of the population variance. See ``pvariance`` for arguments and other details.
[ "Return", "the", "square", "root", "of", "the", "population", "variance", "." ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L369-L379
56,164
avalente/appmetrics
appmetrics/statistics.py
geometric_mean
def geometric_mean(data): """Return the geometric mean of data """ if not data: raise StatisticsError('geometric_mean requires at least one data point') # in order to support negative or null values data = [x if x > 0 else math.e if x == 0 else 1.0 for x in data] return math.pow(math....
python
def geometric_mean(data): """Return the geometric mean of data """ if not data: raise StatisticsError('geometric_mean requires at least one data point') # in order to support negative or null values data = [x if x > 0 else math.e if x == 0 else 1.0 for x in data] return math.pow(math....
[ "def", "geometric_mean", "(", "data", ")", ":", "if", "not", "data", ":", "raise", "StatisticsError", "(", "'geometric_mean requires at least one data point'", ")", "# in order to support negative or null values", "data", "=", "[", "x", "if", "x", ">", "0", "else", ...
Return the geometric mean of data
[ "Return", "the", "geometric", "mean", "of", "data" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L382-L392
56,165
avalente/appmetrics
appmetrics/statistics.py
harmonic_mean
def harmonic_mean(data): """Return the harmonic mean of data """ if not data: raise StatisticsError('harmonic_mean requires at least one data point') divisor = sum(map(lambda x: 1.0 / x if x else 0.0, data)) return len(data) / divisor if divisor else 0.0
python
def harmonic_mean(data): """Return the harmonic mean of data """ if not data: raise StatisticsError('harmonic_mean requires at least one data point') divisor = sum(map(lambda x: 1.0 / x if x else 0.0, data)) return len(data) / divisor if divisor else 0.0
[ "def", "harmonic_mean", "(", "data", ")", ":", "if", "not", "data", ":", "raise", "StatisticsError", "(", "'harmonic_mean requires at least one data point'", ")", "divisor", "=", "sum", "(", "map", "(", "lambda", "x", ":", "1.0", "/", "x", "if", "x", "else",...
Return the harmonic mean of data
[ "Return", "the", "harmonic", "mean", "of", "data" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L395-L403
56,166
avalente/appmetrics
appmetrics/statistics.py
kurtosis
def kurtosis(data): """Return the kurtosis of the data's distribution """ if not data: raise StatisticsError('kurtosis requires at least one data point') size = len(data) sd = stdev(data) ** 4 if not sd: return 0.0 mn = mean(data) return sum(map(lambda x: ((x - mn) *...
python
def kurtosis(data): """Return the kurtosis of the data's distribution """ if not data: raise StatisticsError('kurtosis requires at least one data point') size = len(data) sd = stdev(data) ** 4 if not sd: return 0.0 mn = mean(data) return sum(map(lambda x: ((x - mn) *...
[ "def", "kurtosis", "(", "data", ")", ":", "if", "not", "data", ":", "raise", "StatisticsError", "(", "'kurtosis requires at least one data point'", ")", "size", "=", "len", "(", "data", ")", "sd", "=", "stdev", "(", "data", ")", "**", "4", "if", "not", "...
Return the kurtosis of the data's distribution
[ "Return", "the", "kurtosis", "of", "the", "data", "s", "distribution" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L424-L439
56,167
avalente/appmetrics
appmetrics/statistics.py
percentile
def percentile(data, n): """Return the n-th percentile of the given data Assume that the data are already sorted """ size = len(data) idx = (n / 100.0) * size - 0.5 if idx < 0 or idx > size: raise StatisticsError("Too few data points ({}) for {}th percentile".format(size, n)) re...
python
def percentile(data, n): """Return the n-th percentile of the given data Assume that the data are already sorted """ size = len(data) idx = (n / 100.0) * size - 0.5 if idx < 0 or idx > size: raise StatisticsError("Too few data points ({}) for {}th percentile".format(size, n)) re...
[ "def", "percentile", "(", "data", ",", "n", ")", ":", "size", "=", "len", "(", "data", ")", "idx", "=", "(", "n", "/", "100.0", ")", "*", "size", "-", "0.5", "if", "idx", "<", "0", "or", "idx", ">", "size", ":", "raise", "StatisticsError", "(",...
Return the n-th percentile of the given data Assume that the data are already sorted
[ "Return", "the", "n", "-", "th", "percentile", "of", "the", "given", "data" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L442-L455
56,168
avalente/appmetrics
appmetrics/statistics.py
get_histogram
def get_histogram(data): """Return the histogram relative to the given data Assume that the data are already sorted """ count = len(data) if count < 2: raise StatisticsError('Too few data points ({}) for get_histogram'.format(count)) min_ = data[0] max_ = data[-1] std = stde...
python
def get_histogram(data): """Return the histogram relative to the given data Assume that the data are already sorted """ count = len(data) if count < 2: raise StatisticsError('Too few data points ({}) for get_histogram'.format(count)) min_ = data[0] max_ = data[-1] std = stde...
[ "def", "get_histogram", "(", "data", ")", ":", "count", "=", "len", "(", "data", ")", "if", "count", "<", "2", ":", "raise", "StatisticsError", "(", "'Too few data points ({}) for get_histogram'", ".", "format", "(", "count", ")", ")", "min_", "=", "data", ...
Return the histogram relative to the given data Assume that the data are already sorted
[ "Return", "the", "histogram", "relative", "to", "the", "given", "data" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L458-L484
56,169
avalente/appmetrics
appmetrics/statistics.py
get_histogram_bins
def get_histogram_bins(min_, max_, std, count): """ Return optimal bins given the input parameters """ width = _get_bin_width(std, count) count = int(round((max_ - min_) / width) + 1) if count: bins = [i * width + min_ for i in xrange(1, count + 1)] else: bins = [min_] ...
python
def get_histogram_bins(min_, max_, std, count): """ Return optimal bins given the input parameters """ width = _get_bin_width(std, count) count = int(round((max_ - min_) / width) + 1) if count: bins = [i * width + min_ for i in xrange(1, count + 1)] else: bins = [min_] ...
[ "def", "get_histogram_bins", "(", "min_", ",", "max_", ",", "std", ",", "count", ")", ":", "width", "=", "_get_bin_width", "(", "std", ",", "count", ")", "count", "=", "int", "(", "round", "(", "(", "max_", "-", "min_", ")", "/", "width", ")", "+",...
Return optimal bins given the input parameters
[ "Return", "optimal", "bins", "given", "the", "input", "parameters" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L487-L501
56,170
avalente/appmetrics
appmetrics/statistics.py
_get_bin_width
def _get_bin_width(stdev, count): """Return the histogram's optimal bin width based on Sturges http://www.jstor.org/pss/2965501 """ w = int(round((3.5 * stdev) / (count ** (1.0 / 3)))) if w: return w else: return 1
python
def _get_bin_width(stdev, count): """Return the histogram's optimal bin width based on Sturges http://www.jstor.org/pss/2965501 """ w = int(round((3.5 * stdev) / (count ** (1.0 / 3)))) if w: return w else: return 1
[ "def", "_get_bin_width", "(", "stdev", ",", "count", ")", ":", "w", "=", "int", "(", "round", "(", "(", "3.5", "*", "stdev", ")", "/", "(", "count", "**", "(", "1.0", "/", "3", ")", ")", ")", ")", "if", "w", ":", "return", "w", "else", ":", ...
Return the histogram's optimal bin width based on Sturges http://www.jstor.org/pss/2965501
[ "Return", "the", "histogram", "s", "optimal", "bin", "width", "based", "on", "Sturges" ]
366fc7e1ca897e49a2227cbfa43bfa02a47f1acc
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/statistics.py#L504-L514
56,171
schneiderfelipe/pyrrole
pyrrole/drawing.py
_longest_common_subsequence
def _longest_common_subsequence(x, y): """ Return the longest common subsequence between two sequences. Parameters ---------- x, y : sequence Returns ------- sequence Longest common subsequence of x and y. Examples -------- >>> _longest_common_subsequence("AGGTAB",...
python
def _longest_common_subsequence(x, y): """ Return the longest common subsequence between two sequences. Parameters ---------- x, y : sequence Returns ------- sequence Longest common subsequence of x and y. Examples -------- >>> _longest_common_subsequence("AGGTAB",...
[ "def", "_longest_common_subsequence", "(", "x", ",", "y", ")", ":", "m", "=", "len", "(", "x", ")", "n", "=", "len", "(", "y", ")", "# L[i, j] will contain the length of the longest common subsequence of", "# x[0..i - 1] and y[0..j - 1].", "L", "=", "_np", ".", "z...
Return the longest common subsequence between two sequences. Parameters ---------- x, y : sequence Returns ------- sequence Longest common subsequence of x and y. Examples -------- >>> _longest_common_subsequence("AGGTAB", "GXTXAYB") ['G', 'T', 'A', 'B'] >>> _longe...
[ "Return", "the", "longest", "common", "subsequence", "between", "two", "sequences", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L24-L78
56,172
schneiderfelipe/pyrrole
pyrrole/drawing.py
tower_layout
def tower_layout(graph, height='freeenergy', scale=None, center=None, dim=2): """ Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, opt...
python
def tower_layout(graph, height='freeenergy', scale=None, center=None, dim=2): """ Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, opt...
[ "def", "tower_layout", "(", "graph", ",", "height", "=", "'freeenergy'", ",", "scale", "=", "None", ",", "center", "=", "None", ",", "dim", "=", "2", ")", ":", "# TODO: private function of packages should not be used.", "graph", ",", "center", "=", "_nx", ".",...
Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, optional The node attribute that holds the numerical value used for the node ...
[ "Position", "all", "nodes", "of", "graph", "stacked", "on", "top", "of", "each", "other", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L81-L152
56,173
schneiderfelipe/pyrrole
pyrrole/drawing.py
diagram_layout
def diagram_layout(graph, height='freeenergy', sources=None, targets=None, pos=None, scale=None, center=None, dim=2): """ Position nodes such that paths are highlighted, from left to right. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will ...
python
def diagram_layout(graph, height='freeenergy', sources=None, targets=None, pos=None, scale=None, center=None, dim=2): """ Position nodes such that paths are highlighted, from left to right. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will ...
[ "def", "diagram_layout", "(", "graph", ",", "height", "=", "'freeenergy'", ",", "sources", "=", "None", ",", "targets", "=", "None", ",", "pos", "=", "None", ",", "scale", "=", "None", ",", "center", "=", "None", ",", "dim", "=", "2", ")", ":", "# ...
Position nodes such that paths are highlighted, from left to right. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, optional The node attribute that holds the numerical value used for the nod...
[ "Position", "nodes", "such", "that", "paths", "are", "highlighted", "from", "left", "to", "right", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L155-L254
56,174
schneiderfelipe/pyrrole
pyrrole/drawing.py
draw_diagram_nodes
def draw_diagram_nodes(graph, pos=None, nodelist=None, node_size=.7, node_color='k', style='solid', alpha=1.0, cmap=None, vmin=None, vmax=None, ax=None, label=None): """ Draw nodes of graph. This draws only the nodes of graph as horizontal lines at each ``y...
python
def draw_diagram_nodes(graph, pos=None, nodelist=None, node_size=.7, node_color='k', style='solid', alpha=1.0, cmap=None, vmin=None, vmax=None, ax=None, label=None): """ Draw nodes of graph. This draws only the nodes of graph as horizontal lines at each ``y...
[ "def", "draw_diagram_nodes", "(", "graph", ",", "pos", "=", "None", ",", "nodelist", "=", "None", ",", "node_size", "=", ".7", ",", "node_color", "=", "'k'", ",", "style", "=", "'solid'", ",", "alpha", "=", "1.0", ",", "cmap", "=", "None", ",", "vmin...
Draw nodes of graph. This draws only the nodes of graph as horizontal lines at each ``y = pos[1]`` from ``x - node_size/2`` to ``x + node_size/2``, where ``x = pos[0]``. Parameters ---------- graph : `networkx.Graph` A NetworkX graph. pos : mapping, optional A mapping with ...
[ "Draw", "nodes", "of", "graph", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L257-L371
56,175
schneiderfelipe/pyrrole
pyrrole/drawing.py
draw_diagram_labels
def draw_diagram_labels(graph, pos=None, labels=None, font_size=12, font_color='k', font_family='sans-serif', font_weight='normal', alpha=1.0, bbox=None, ax=None, offset=None, **kwds): """ Draw node labels of graph. This draws only the...
python
def draw_diagram_labels(graph, pos=None, labels=None, font_size=12, font_color='k', font_family='sans-serif', font_weight='normal', alpha=1.0, bbox=None, ax=None, offset=None, **kwds): """ Draw node labels of graph. This draws only the...
[ "def", "draw_diagram_labels", "(", "graph", ",", "pos", "=", "None", ",", "labels", "=", "None", ",", "font_size", "=", "12", ",", "font_color", "=", "'k'", ",", "font_family", "=", "'sans-serif'", ",", "font_weight", "=", "'normal'", ",", "alpha", "=", ...
Draw node labels of graph. This draws only the node labels of a graph. Parameters ---------- graph : `networkx.Graph` A NetworkX graph. pos : mapping, optional A mapping with nodes as keys and positions as values. Positions should be sequences of length 2. If not specified ...
[ "Draw", "node", "labels", "of", "graph", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L539-L646
56,176
schneiderfelipe/pyrrole
pyrrole/drawing.py
draw_diagram
def draw_diagram(graph, pos=None, with_labels=True, offset=None, **kwds): """ Draw a diagram for graph using Matplotlib. Draw graph as a simple energy diagram with Matplotlib with options for node positions, labeling, titles, and many other drawing features. See examples below. Parameters ...
python
def draw_diagram(graph, pos=None, with_labels=True, offset=None, **kwds): """ Draw a diagram for graph using Matplotlib. Draw graph as a simple energy diagram with Matplotlib with options for node positions, labeling, titles, and many other drawing features. See examples below. Parameters ...
[ "def", "draw_diagram", "(", "graph", ",", "pos", "=", "None", ",", "with_labels", "=", "True", ",", "offset", "=", "None", ",", "*", "*", "kwds", ")", ":", "if", "pos", "is", "None", ":", "pos", "=", "diagram_layout", "(", "graph", ",", "*", "*", ...
Draw a diagram for graph using Matplotlib. Draw graph as a simple energy diagram with Matplotlib with options for node positions, labeling, titles, and many other drawing features. See examples below. Parameters ---------- graph : `networkx.Graph` A NetworkX graph. pos : mapping, o...
[ "Draw", "a", "diagram", "for", "graph", "using", "Matplotlib", "." ]
13e26accc9a059f0ab69773648b24292fe1fbfd6
https://github.com/schneiderfelipe/pyrrole/blob/13e26accc9a059f0ab69773648b24292fe1fbfd6/pyrrole/drawing.py#L649-L715
56,177
pebble/libpebble2
libpebble2/protocol/base/__init__.py
PebblePacket.serialise
def serialise(self, default_endianness=None): """ Serialise a message, without including any framing. :param default_endianness: The default endianness, unless overridden by the fields or class metadata. Should usually be left at ``None``. Otherwise, use ``'<'...
python
def serialise(self, default_endianness=None): """ Serialise a message, without including any framing. :param default_endianness: The default endianness, unless overridden by the fields or class metadata. Should usually be left at ``None``. Otherwise, use ``'<'...
[ "def", "serialise", "(", "self", ",", "default_endianness", "=", "None", ")", ":", "# Figure out an endianness.", "endianness", "=", "(", "default_endianness", "or", "DEFAULT_ENDIANNESS", ")", "if", "hasattr", "(", "self", ",", "'_Meta'", ")", ":", "endianness", ...
Serialise a message, without including any framing. :param default_endianness: The default endianness, unless overridden by the fields or class metadata. Should usually be left at ``None``. Otherwise, use ``'<'`` for little endian and ``'>'`...
[ "Serialise", "a", "message", "without", "including", "any", "framing", "." ]
23e2eb92cfc084e6f9e8c718711ac994ef606d18
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/protocol/base/__init__.py#L112-L141
56,178
pebble/libpebble2
libpebble2/protocol/base/__init__.py
PebblePacket.serialise_packet
def serialise_packet(self): """ Serialise a message, including framing information inferred from the ``Meta`` inner class of the packet. ``self.Meta.endpoint`` must be defined to call this method. :return: A serialised message, ready to be sent to the Pebble. """ if not ...
python
def serialise_packet(self): """ Serialise a message, including framing information inferred from the ``Meta`` inner class of the packet. ``self.Meta.endpoint`` must be defined to call this method. :return: A serialised message, ready to be sent to the Pebble. """ if not ...
[ "def", "serialise_packet", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_Meta'", ")", ":", "raise", "ReferenceError", "(", "\"Can't serialise a packet that doesn't have an endpoint ID.\"", ")", "serialised", "=", "self", ".", "serialise", "(", ...
Serialise a message, including framing information inferred from the ``Meta`` inner class of the packet. ``self.Meta.endpoint`` must be defined to call this method. :return: A serialised message, ready to be sent to the Pebble.
[ "Serialise", "a", "message", "including", "framing", "information", "inferred", "from", "the", "Meta", "inner", "class", "of", "the", "packet", ".", "self", ".", "Meta", ".", "endpoint", "must", "be", "defined", "to", "call", "this", "method", "." ]
23e2eb92cfc084e6f9e8c718711ac994ef606d18
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/protocol/base/__init__.py#L143-L153
56,179
tkf/rash
rash/query.py
expand_query
def expand_query(config, kwds): """ Expand `kwds` based on `config.search.query_expander`. :type config: .config.Configuration :type kwds: dict :rtype: dict :return: Return `kwds`, modified in place. """ pattern = [] for query in kwds.pop('pattern', []): expansion = config....
python
def expand_query(config, kwds): """ Expand `kwds` based on `config.search.query_expander`. :type config: .config.Configuration :type kwds: dict :rtype: dict :return: Return `kwds`, modified in place. """ pattern = [] for query in kwds.pop('pattern', []): expansion = config....
[ "def", "expand_query", "(", "config", ",", "kwds", ")", ":", "pattern", "=", "[", "]", "for", "query", "in", "kwds", ".", "pop", "(", "'pattern'", ",", "[", "]", ")", ":", "expansion", "=", "config", ".", "search", ".", "alias", ".", "get", "(", ...
Expand `kwds` based on `config.search.query_expander`. :type config: .config.Configuration :type kwds: dict :rtype: dict :return: Return `kwds`, modified in place.
[ "Expand", "kwds", "based", "on", "config", ".", "search", ".", "query_expander", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/query.py#L32-L60
56,180
tkf/rash
rash/query.py
preprocess_kwds
def preprocess_kwds(kwds): """ Preprocess keyword arguments for `DataBase.search_command_record`. """ from .utils.timeutils import parse_datetime, parse_duration for key in ['output', 'format', 'format_level', 'with_command_id', 'with_session_id']: kwds.pop(key, None) f...
python
def preprocess_kwds(kwds): """ Preprocess keyword arguments for `DataBase.search_command_record`. """ from .utils.timeutils import parse_datetime, parse_duration for key in ['output', 'format', 'format_level', 'with_command_id', 'with_session_id']: kwds.pop(key, None) f...
[ "def", "preprocess_kwds", "(", "kwds", ")", ":", "from", ".", "utils", ".", "timeutils", "import", "parse_datetime", ",", "parse_duration", "for", "key", "in", "[", "'output'", ",", "'format'", ",", "'format_level'", ",", "'with_command_id'", ",", "'with_session...
Preprocess keyword arguments for `DataBase.search_command_record`.
[ "Preprocess", "keyword", "arguments", "for", "DataBase", ".", "search_command_record", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/query.py#L63-L94
56,181
RonenNess/grepfunc
grepfunc/grepfunc.py
__fix_args
def __fix_args(kwargs): """ Set all named arguments shortcuts and flags. """ kwargs.setdefault('fixed_strings', kwargs.get('F')) kwargs.setdefault('basic_regexp', kwargs.get('G')) kwargs.setdefault('extended_regexp', kwargs.get('E')) kwargs.setdefault('ignore_case', kwargs.get('i')) kwar...
python
def __fix_args(kwargs): """ Set all named arguments shortcuts and flags. """ kwargs.setdefault('fixed_strings', kwargs.get('F')) kwargs.setdefault('basic_regexp', kwargs.get('G')) kwargs.setdefault('extended_regexp', kwargs.get('E')) kwargs.setdefault('ignore_case', kwargs.get('i')) kwar...
[ "def", "__fix_args", "(", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'fixed_strings'", ",", "kwargs", ".", "get", "(", "'F'", ")", ")", "kwargs", ".", "setdefault", "(", "'basic_regexp'", ",", "kwargs", ".", "get", "(", "'G'", ")", ")", "kw...
Set all named arguments shortcuts and flags.
[ "Set", "all", "named", "arguments", "shortcuts", "and", "flags", "." ]
a5323d082c0a581e4b053ef85838c9a0101b43ff
https://github.com/RonenNess/grepfunc/blob/a5323d082c0a581e4b053ef85838c9a0101b43ff/grepfunc/grepfunc.py#L18-L39
56,182
RonenNess/grepfunc
grepfunc/grepfunc.py
__process_line
def __process_line(line, strip_eol, strip): """ process a single line value. """ if strip: line = line.strip() elif strip_eol and line.endswith('\n'): line = line[:-1] return line
python
def __process_line(line, strip_eol, strip): """ process a single line value. """ if strip: line = line.strip() elif strip_eol and line.endswith('\n'): line = line[:-1] return line
[ "def", "__process_line", "(", "line", ",", "strip_eol", ",", "strip", ")", ":", "if", "strip", ":", "line", "=", "line", ".", "strip", "(", ")", "elif", "strip_eol", "and", "line", ".", "endswith", "(", "'\\n'", ")", ":", "line", "=", "line", "[", ...
process a single line value.
[ "process", "a", "single", "line", "value", "." ]
a5323d082c0a581e4b053ef85838c9a0101b43ff
https://github.com/RonenNess/grepfunc/blob/a5323d082c0a581e4b053ef85838c9a0101b43ff/grepfunc/grepfunc.py#L238-L246
56,183
tkf/rash
rash/cli.py
get_parser
def get_parser(commands): """ Generate argument parser given a list of subcommand specifications. :type commands: list of (str, function, function) :arg commands: Each element must be a tuple ``(name, adder, runner)``. :param name: subcommand :param adder: a function takes ...
python
def get_parser(commands): """ Generate argument parser given a list of subcommand specifications. :type commands: list of (str, function, function) :arg commands: Each element must be a tuple ``(name, adder, runner)``. :param name: subcommand :param adder: a function takes ...
[ "def", "get_parser", "(", "commands", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "Formatter", ",", "description", "=", "__doc__", ",", "epilog", "=", "EPILOG", ",", ")", "subparsers", "=", "parser", ".", "add_sub...
Generate argument parser given a list of subcommand specifications. :type commands: list of (str, function, function) :arg commands: Each element must be a tuple ``(name, adder, runner)``. :param name: subcommand :param adder: a function takes one object which is an instance ...
[ "Generate", "argument", "parser", "given", "a", "list", "of", "subcommand", "specifications", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/cli.py#L31-L64
56,184
tkf/rash
rash/cli.py
locate_run
def locate_run(output, target, no_newline): """ Print location of RASH related file. """ from .config import ConfigStore cfstore = ConfigStore() path = getattr(cfstore, "{0}_path".format(target)) output.write(path) if not no_newline: output.write("\n")
python
def locate_run(output, target, no_newline): """ Print location of RASH related file. """ from .config import ConfigStore cfstore = ConfigStore() path = getattr(cfstore, "{0}_path".format(target)) output.write(path) if not no_newline: output.write("\n")
[ "def", "locate_run", "(", "output", ",", "target", ",", "no_newline", ")", ":", "from", ".", "config", "import", "ConfigStore", "cfstore", "=", "ConfigStore", "(", ")", "path", "=", "getattr", "(", "cfstore", ",", "\"{0}_path\"", ".", "format", "(", "targe...
Print location of RASH related file.
[ "Print", "location", "of", "RASH", "related", "file", "." ]
585da418ec37dd138f1a4277718b6f507e9536a2
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/cli.py#L102-L111
56,185
twisted/mantissa
xmantissa/webadmin.py
UserInteractionFragment.userBrowser
def userBrowser(self, request, tag): """ Render a TDB of local users. """ f = LocalUserBrowserFragment(self.browser) f.docFactory = webtheme.getLoader(f.fragmentName) f.setFragmentParent(self) return f
python
def userBrowser(self, request, tag): """ Render a TDB of local users. """ f = LocalUserBrowserFragment(self.browser) f.docFactory = webtheme.getLoader(f.fragmentName) f.setFragmentParent(self) return f
[ "def", "userBrowser", "(", "self", ",", "request", ",", "tag", ")", ":", "f", "=", "LocalUserBrowserFragment", "(", "self", ".", "browser", ")", "f", ".", "docFactory", "=", "webtheme", ".", "getLoader", "(", "f", ".", "fragmentName", ")", "f", ".", "s...
Render a TDB of local users.
[ "Render", "a", "TDB", "of", "local", "users", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L140-L147
56,186
twisted/mantissa
xmantissa/webadmin.py
UserInteractionFragment.userCreate
def userCreate(self, request, tag): """ Render a form for creating new users. """ userCreator = liveform.LiveForm( self.createUser, [liveform.Parameter( "localpart", liveform.TEXT_INPUT, unicode, ...
python
def userCreate(self, request, tag): """ Render a form for creating new users. """ userCreator = liveform.LiveForm( self.createUser, [liveform.Parameter( "localpart", liveform.TEXT_INPUT, unicode, ...
[ "def", "userCreate", "(", "self", ",", "request", ",", "tag", ")", ":", "userCreator", "=", "liveform", ".", "LiveForm", "(", "self", ".", "createUser", ",", "[", "liveform", ".", "Parameter", "(", "\"localpart\"", ",", "liveform", ".", "TEXT_INPUT", ",", ...
Render a form for creating new users.
[ "Render", "a", "form", "for", "creating", "new", "users", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L151-L173
56,187
twisted/mantissa
xmantissa/webadmin.py
UserInteractionFragment.createUser
def createUser(self, localpart, domain, password=None): """ Create a new, blank user account with the given name and domain and, if specified, with the given password. @type localpart: C{unicode} @param localpart: The local portion of the username. ie, the C{'alice'} in...
python
def createUser(self, localpart, domain, password=None): """ Create a new, blank user account with the given name and domain and, if specified, with the given password. @type localpart: C{unicode} @param localpart: The local portion of the username. ie, the C{'alice'} in...
[ "def", "createUser", "(", "self", ",", "localpart", ",", "domain", ",", "password", "=", "None", ")", ":", "loginSystem", "=", "self", ".", "browser", ".", "store", ".", "parent", ".", "findUnique", "(", "userbase", ".", "LoginSystem", ")", "if", "passwo...
Create a new, blank user account with the given name and domain and, if specified, with the given password. @type localpart: C{unicode} @param localpart: The local portion of the username. ie, the C{'alice'} in C{'alice@example.com'}. @type domain: C{unicode} @param do...
[ "Create", "a", "new", "blank", "user", "account", "with", "the", "given", "name", "and", "domain", "and", "if", "specified", "with", "the", "given", "password", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L177-L197
56,188
twisted/mantissa
xmantissa/webadmin.py
LocalUserBrowserFragment.doAction
def doAction(self, loginMethod, actionClass): """ Show the form for the requested action. """ loginAccount = loginMethod.account return actionClass( self, loginMethod.localpart + u'@' + loginMethod.domain, loginAccount)
python
def doAction(self, loginMethod, actionClass): """ Show the form for the requested action. """ loginAccount = loginMethod.account return actionClass( self, loginMethod.localpart + u'@' + loginMethod.domain, loginAccount)
[ "def", "doAction", "(", "self", ",", "loginMethod", ",", "actionClass", ")", ":", "loginAccount", "=", "loginMethod", ".", "account", "return", "actionClass", "(", "self", ",", "loginMethod", ".", "localpart", "+", "u'@'", "+", "loginMethod", ".", "domain", ...
Show the form for the requested action.
[ "Show", "the", "form", "for", "the", "requested", "action", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L224-L232
56,189
twisted/mantissa
xmantissa/webadmin.py
REPL.getStore
def getStore(self, name, domain): """Convenience method for the REPL. I got tired of typing this string every time I logged in.""" return IRealm(self.original.store.parent).accountByAddress(name, domain).avatars.open()
python
def getStore(self, name, domain): """Convenience method for the REPL. I got tired of typing this string every time I logged in.""" return IRealm(self.original.store.parent).accountByAddress(name, domain).avatars.open()
[ "def", "getStore", "(", "self", ",", "name", ",", "domain", ")", ":", "return", "IRealm", "(", "self", ".", "original", ".", "store", ".", "parent", ")", ".", "accountByAddress", "(", "name", ",", "domain", ")", ".", "avatars", ".", "open", "(", ")" ...
Convenience method for the REPL. I got tired of typing this string every time I logged in.
[ "Convenience", "method", "for", "the", "REPL", ".", "I", "got", "tired", "of", "typing", "this", "string", "every", "time", "I", "logged", "in", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L415-L417
56,190
twisted/mantissa
xmantissa/webadmin.py
PortConfiguration.createPort
def createPort(self, portNumber, ssl, certPath, factory, interface=u''): """ Create a new listening port. @type portNumber: C{int} @param portNumber: Port number on which to listen. @type ssl: C{bool} @param ssl: Indicates whether this should be an SSL port or not. ...
python
def createPort(self, portNumber, ssl, certPath, factory, interface=u''): """ Create a new listening port. @type portNumber: C{int} @param portNumber: Port number on which to listen. @type ssl: C{bool} @param ssl: Indicates whether this should be an SSL port or not. ...
[ "def", "createPort", "(", "self", ",", "portNumber", ",", "ssl", ",", "certPath", ",", "factory", ",", "interface", "=", "u''", ")", ":", "store", "=", "self", ".", "store", ".", "parent", "if", "ssl", ":", "port", "=", "SSLPort", "(", "store", "=", ...
Create a new listening port. @type portNumber: C{int} @param portNumber: Port number on which to listen. @type ssl: C{bool} @param ssl: Indicates whether this should be an SSL port or not. @type certPath: C{str} @param ssl: If C{ssl} is true, a path to a certificate fi...
[ "Create", "a", "new", "listening", "port", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L565-L592
56,191
twisted/mantissa
xmantissa/webadmin.py
FactoryColumn.extractValue
def extractValue(self, model, item): """ Get the class name of the factory referenced by a port. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). ...
python
def extractValue(self, model, item): """ Get the class name of the factory referenced by a port. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). ...
[ "def", "extractValue", "(", "self", ",", "model", ",", "item", ")", ":", "factory", "=", "super", "(", "FactoryColumn", ",", "self", ")", ".", "extractValue", "(", "model", ",", "item", ")", "return", "factory", ".", "__class__", ".", "__name__", ".", ...
Get the class name of the factory referenced by a port. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). @rtype: C{unicode} @return: The name of the class...
[ "Get", "the", "class", "name", "of", "the", "factory", "referenced", "by", "a", "port", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L601-L615
56,192
twisted/mantissa
xmantissa/webadmin.py
CertificateColumn.extractValue
def extractValue(self, model, item): """ Get the path referenced by this column's attribute. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). @rty...
python
def extractValue(self, model, item): """ Get the path referenced by this column's attribute. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). @rty...
[ "def", "extractValue", "(", "self", ",", "model", ",", "item", ")", ":", "certPath", "=", "super", "(", "CertificateColumn", ",", "self", ")", ".", "extractValue", "(", "model", ",", "item", ")", "return", "certPath", ".", "path", ".", "decode", "(", "...
Get the path referenced by this column's attribute. @param model: Either a TabularDataModel or a ScrollableView, depending on what this column is part of. @param item: A port item instance (as defined by L{xmantissa.port}). @rtype: C{unicode}
[ "Get", "the", "path", "referenced", "by", "this", "column", "s", "attribute", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/webadmin.py#L623-L635
56,193
twisted/mantissa
xmantissa/ampserver.py
connectRoute
def connectRoute(amp, router, receiver, protocol): """ Connect the given receiver to a new box receiver for the given protocol. After connecting this router to an AMP server, use this method similarly to how you would use C{reactor.connectTCP} to establish a new connection to an HTTP, SMTP, or ...
python
def connectRoute(amp, router, receiver, protocol): """ Connect the given receiver to a new box receiver for the given protocol. After connecting this router to an AMP server, use this method similarly to how you would use C{reactor.connectTCP} to establish a new connection to an HTTP, SMTP, or ...
[ "def", "connectRoute", "(", "amp", ",", "router", ",", "receiver", ",", "protocol", ")", ":", "route", "=", "router", ".", "bindRoute", "(", "receiver", ")", "d", "=", "amp", ".", "callRemote", "(", "Connect", ",", "origin", "=", "route", ".", "localRo...
Connect the given receiver to a new box receiver for the given protocol. After connecting this router to an AMP server, use this method similarly to how you would use C{reactor.connectTCP} to establish a new connection to an HTTP, SMTP, or IRC server. @param receiver: An L{IBoxReceiver} which will...
[ "Connect", "the", "given", "receiver", "to", "a", "new", "box", "receiver", "for", "the", "given", "protocol", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/ampserver.py#L220-L247
56,194
twisted/mantissa
xmantissa/ampserver.py
AMPConfiguration.getFactory
def getFactory(self): """ Return a server factory which creates AMP protocol instances. """ factory = ServerFactory() def protocol(): proto = CredReceiver() proto.portal = Portal( self.loginSystem, [self.loginSystem, ...
python
def getFactory(self): """ Return a server factory which creates AMP protocol instances. """ factory = ServerFactory() def protocol(): proto = CredReceiver() proto.portal = Portal( self.loginSystem, [self.loginSystem, ...
[ "def", "getFactory", "(", "self", ")", ":", "factory", "=", "ServerFactory", "(", ")", "def", "protocol", "(", ")", ":", "proto", "=", "CredReceiver", "(", ")", "proto", ".", "portal", "=", "Portal", "(", "self", ".", "loginSystem", ",", "[", "self", ...
Return a server factory which creates AMP protocol instances.
[ "Return", "a", "server", "factory", "which", "creates", "AMP", "protocol", "instances", "." ]
53e5502aba23ce99be78b27f923a276593033fe8
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/ampserver.py#L78-L91
56,195
miku/gluish
gluish/common.py
getfirstline
def getfirstline(file, default): """ Returns the first line of a file. """ with open(file, 'rb') as fh: content = fh.readlines() if len(content) == 1: return content[0].decode('utf-8').strip('\n') return default
python
def getfirstline(file, default): """ Returns the first line of a file. """ with open(file, 'rb') as fh: content = fh.readlines() if len(content) == 1: return content[0].decode('utf-8').strip('\n') return default
[ "def", "getfirstline", "(", "file", ",", "default", ")", ":", "with", "open", "(", "file", ",", "'rb'", ")", "as", "fh", ":", "content", "=", "fh", ".", "readlines", "(", ")", "if", "len", "(", "content", ")", "==", "1", ":", "return", "content", ...
Returns the first line of a file.
[ "Returns", "the", "first", "line", "of", "a", "file", "." ]
56d3ac4f41a944e31ecac0aa3b6d1dc2ce705e29
https://github.com/miku/gluish/blob/56d3ac4f41a944e31ecac0aa3b6d1dc2ce705e29/gluish/common.py#L51-L60
56,196
vladcalin/gemstone
gemstone/core/structs.py
JsonRpcResponseBatch.add_item
def add_item(self, item): """Adds an item to the batch.""" if not isinstance(item, JsonRpcResponse): raise TypeError( "Expected JsonRpcResponse but got {} instead".format(type(item).__name__)) self.items.append(item)
python
def add_item(self, item): """Adds an item to the batch.""" if not isinstance(item, JsonRpcResponse): raise TypeError( "Expected JsonRpcResponse but got {} instead".format(type(item).__name__)) self.items.append(item)
[ "def", "add_item", "(", "self", ",", "item", ")", ":", "if", "not", "isinstance", "(", "item", ",", "JsonRpcResponse", ")", ":", "raise", "TypeError", "(", "\"Expected JsonRpcResponse but got {} instead\"", ".", "format", "(", "type", "(", "item", ")", ".", ...
Adds an item to the batch.
[ "Adds", "an", "item", "to", "the", "batch", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/structs.py#L165-L172
56,197
laurivosandi/butterknife
host/butterknife/pool.py
LocalPool.manifest
def manifest(self, subvol): """ Generator for manifest, yields 7-tuples """ subvol_path = os.path.join(self.path, str(subvol)) builtin_path = os.path.join(subvol_path, MANIFEST_DIR[1:], str(subvol)) manifest_path = os.path.join(MANIFEST_DIR, str(subvol)) if os.pa...
python
def manifest(self, subvol): """ Generator for manifest, yields 7-tuples """ subvol_path = os.path.join(self.path, str(subvol)) builtin_path = os.path.join(subvol_path, MANIFEST_DIR[1:], str(subvol)) manifest_path = os.path.join(MANIFEST_DIR, str(subvol)) if os.pa...
[ "def", "manifest", "(", "self", ",", "subvol", ")", ":", "subvol_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "str", "(", "subvol", ")", ")", "builtin_path", "=", "os", ".", "path", ".", "join", "(", "subvol_path", ","...
Generator for manifest, yields 7-tuples
[ "Generator", "for", "manifest", "yields", "7", "-", "tuples" ]
076ddabd66dcc1cedda7eba27ddca2a9ebed309e
https://github.com/laurivosandi/butterknife/blob/076ddabd66dcc1cedda7eba27ddca2a9ebed309e/host/butterknife/pool.py#L70-L96
56,198
vladcalin/gemstone
gemstone/core/decorators.py
event_handler
def event_handler(event_name): """ Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a J...
python
def event_handler(event_name): """ Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a J...
[ "def", "event_handler", "(", "event_name", ")", ":", "def", "wrapper", "(", "func", ")", ":", "func", ".", "_event_handler", "=", "True", "func", ".", "_handled_event", "=", "event_name", "return", "func", "return", "wrapper" ]
Decorator for designating a handler for an event type. ``event_name`` must be a string representing the name of the event type. The decorated function must accept a parameter: the body of the received event, which will be a Python object that can be encoded as a JSON (dict, list, str, int, bool, float ...
[ "Decorator", "for", "designating", "a", "handler", "for", "an", "event", "type", ".", "event_name", "must", "be", "a", "string", "representing", "the", "name", "of", "the", "event", "type", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/decorators.py#L14-L32
56,199
vladcalin/gemstone
gemstone/core/decorators.py
exposed_method
def exposed_method(name=None, private=False, is_coroutine=True, requires_handler_reference=False): """ Marks a method as exposed via JSON RPC. :param name: the name of the exposed method. Must contains only letters, digits, dots and underscores. If not present or is set explicitly to ``Non...
python
def exposed_method(name=None, private=False, is_coroutine=True, requires_handler_reference=False): """ Marks a method as exposed via JSON RPC. :param name: the name of the exposed method. Must contains only letters, digits, dots and underscores. If not present or is set explicitly to ``Non...
[ "def", "exposed_method", "(", "name", "=", "None", ",", "private", "=", "False", ",", "is_coroutine", "=", "True", ",", "requires_handler_reference", "=", "False", ")", ":", "def", "wrapper", "(", "func", ")", ":", "# validation", "if", "name", ":", "metho...
Marks a method as exposed via JSON RPC. :param name: the name of the exposed method. Must contains only letters, digits, dots and underscores. If not present or is set explicitly to ``None``, this parameter will default to the name of the exposed method. If two me...
[ "Marks", "a", "method", "as", "exposed", "via", "JSON", "RPC", "." ]
325a49d17621b9d45ffd2b5eca6f0de284de8ba4
https://github.com/vladcalin/gemstone/blob/325a49d17621b9d45ffd2b5eca6f0de284de8ba4/gemstone/core/decorators.py#L35-L94