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
48,500
open-homeautomation/pknx
knxip/helper.py
ip_to_array
def ip_to_array(ipaddress): """Convert a string representing an IPv4 address to 4 bytes.""" res = [] for i in ipaddress.split("."): res.append(int(i)) assert len(res) == 4 return res
python
def ip_to_array(ipaddress): """Convert a string representing an IPv4 address to 4 bytes.""" res = [] for i in ipaddress.split("."): res.append(int(i)) assert len(res) == 4 return res
[ "def", "ip_to_array", "(", "ipaddress", ")", ":", "res", "=", "[", "]", "for", "i", "in", "ipaddress", ".", "split", "(", "\".\"", ")", ":", "res", ".", "append", "(", "int", "(", "i", ")", ")", "assert", "len", "(", "res", ")", "==", "4", "ret...
Convert a string representing an IPv4 address to 4 bytes.
[ "Convert", "a", "string", "representing", "an", "IPv4", "address", "to", "4", "bytes", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/helper.py#L8-L15
48,501
open-homeautomation/pknx
knxip/helper.py
int_to_array
def int_to_array(i, length=2): """Convert an length byte integer to an array of bytes.""" res = [] for dummy in range(0, length): res.append(i & 0xff) i = i >> 8 return reversed(res)
python
def int_to_array(i, length=2): """Convert an length byte integer to an array of bytes.""" res = [] for dummy in range(0, length): res.append(i & 0xff) i = i >> 8 return reversed(res)
[ "def", "int_to_array", "(", "i", ",", "length", "=", "2", ")", ":", "res", "=", "[", "]", "for", "dummy", "in", "range", "(", "0", ",", "length", ")", ":", "res", ".", "append", "(", "i", "&", "0xff", ")", "i", "=", "i", ">>", "8", "return", ...
Convert an length byte integer to an array of bytes.
[ "Convert", "an", "length", "byte", "integer", "to", "an", "array", "of", "bytes", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/helper.py#L18-L24
48,502
todbot/blink1-python
blink1/blink1.py
Blink1.stop
def stop(self): """Stop internal color pattern playing """ if ( self.dev == None ): return '' buf = [REPORT_ID, ord('p'), 0, 0, 0, 0, 0, 0, 0] return self.write(buf);
python
def stop(self): """Stop internal color pattern playing """ if ( self.dev == None ): return '' buf = [REPORT_ID, ord('p'), 0, 0, 0, 0, 0, 0, 0] return self.write(buf);
[ "def", "stop", "(", "self", ")", ":", "if", "(", "self", ".", "dev", "==", "None", ")", ":", "return", "''", "buf", "=", "[", "REPORT_ID", ",", "ord", "(", "'p'", ")", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ...
Stop internal color pattern playing
[ "Stop", "internal", "color", "pattern", "playing" ]
7a5183becd9662f88da3c29afd3447403f4ef82f
https://github.com/todbot/blink1-python/blob/7a5183becd9662f88da3c29afd3447403f4ef82f/blink1/blink1.py#L222-L227
48,503
todbot/blink1-python
blink1/blink1.py
Blink1.savePattern
def savePattern(self): """Save internal RAM pattern to flash """ if ( self.dev == None ): return '' buf = [REPORT_ID, ord('W'), 0xBE, 0xEF, 0xCA, 0xFE, 0, 0, 0] return self.write(buf);
python
def savePattern(self): """Save internal RAM pattern to flash """ if ( self.dev == None ): return '' buf = [REPORT_ID, ord('W'), 0xBE, 0xEF, 0xCA, 0xFE, 0, 0, 0] return self.write(buf);
[ "def", "savePattern", "(", "self", ")", ":", "if", "(", "self", ".", "dev", "==", "None", ")", ":", "return", "''", "buf", "=", "[", "REPORT_ID", ",", "ord", "(", "'W'", ")", ",", "0xBE", ",", "0xEF", ",", "0xCA", ",", "0xFE", ",", "0", ",", ...
Save internal RAM pattern to flash
[ "Save", "internal", "RAM", "pattern", "to", "flash" ]
7a5183becd9662f88da3c29afd3447403f4ef82f
https://github.com/todbot/blink1-python/blob/7a5183becd9662f88da3c29afd3447403f4ef82f/blink1/blink1.py#L229-L234
48,504
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.create_repo
def create_repo(self, repo_name=None, feed=None, envs=[], checksum_type="sha256", query='/repositories/'): """ `repo_name` - Name of repository to create `feed` - Repo URL to feed from `checksum_type` - Used for generating meta-data Create repository in specified environments, a...
python
def create_repo(self, repo_name=None, feed=None, envs=[], checksum_type="sha256", query='/repositories/'): """ `repo_name` - Name of repository to create `feed` - Repo URL to feed from `checksum_type` - Used for generating meta-data Create repository in specified environments, a...
[ "def", "create_repo", "(", "self", ",", "repo_name", "=", "None", ",", "feed", "=", "None", ",", "envs", "=", "[", "]", ",", "checksum_type", "=", "\"sha256\"", ",", "query", "=", "'/repositories/'", ")", ":", "data", "=", "{", "'display_name'", ":", "...
`repo_name` - Name of repository to create `feed` - Repo URL to feed from `checksum_type` - Used for generating meta-data Create repository in specified environments, associate the yum_distributor with it and publish the repo
[ "repo_name", "-", "Name", "of", "repository", "to", "create", "feed", "-", "Repo", "URL", "to", "feed", "from", "checksum_type", "-", "Used", "for", "generating", "meta", "-", "data" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L47-L115
48,505
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.create_user
def create_user(self, login=None, password=None, user_name=None, envs=[], query='/users/'): """ `login` - Login or username for user `password` - Plain text password for user `user_name` - Full name of user Create user in specified environments """ login = login....
python
def create_user(self, login=None, password=None, user_name=None, envs=[], query='/users/'): """ `login` - Login or username for user `password` - Plain text password for user `user_name` - Full name of user Create user in specified environments """ login = login....
[ "def", "create_user", "(", "self", ",", "login", "=", "None", ",", "password", "=", "None", ",", "user_name", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/users/'", ")", ":", "login", "=", "login", ".", "lower", "(", ")", "data", ...
`login` - Login or username for user `password` - Plain text password for user `user_name` - Full name of user Create user in specified environments
[ "login", "-", "Login", "or", "username", "for", "user", "password", "-", "Plain", "text", "password", "for", "user", "user_name", "-", "Full", "name", "of", "user" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L342-L374
48,506
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.delete_repo
def delete_repo(self, repo_name=None, envs=[], query='/repositories/'): """ `repo_name` - Name of repository to delete Delete repo in specified environments """ orphan_query = '/content/orphans/rpm/' juicer.utils.Log.log_debug("Delete Repo: %s", repo_name) for e...
python
def delete_repo(self, repo_name=None, envs=[], query='/repositories/'): """ `repo_name` - Name of repository to delete Delete repo in specified environments """ orphan_query = '/content/orphans/rpm/' juicer.utils.Log.log_debug("Delete Repo: %s", repo_name) for e...
[ "def", "delete_repo", "(", "self", ",", "repo_name", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/repositories/'", ")", ":", "orphan_query", "=", "'/content/orphans/rpm/'", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Del...
`repo_name` - Name of repository to delete Delete repo in specified environments
[ "repo_name", "-", "Name", "of", "repository", "to", "delete" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L376-L410
48,507
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.delete_user
def delete_user(self, login=None, envs=[], query='/users/'): """ `login` - Login or username of user to delete Delete user in specified environments """ juicer.utils.Log.log_debug("Delete User: %s", login) for env in envs: if envs.index(env) != 0 and juicer....
python
def delete_user(self, login=None, envs=[], query='/users/'): """ `login` - Login or username of user to delete Delete user in specified environments """ juicer.utils.Log.log_debug("Delete User: %s", login) for env in envs: if envs.index(env) != 0 and juicer....
[ "def", "delete_user", "(", "self", ",", "login", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/users/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Delete User: %s\"", ",", "login", ")", "for", "env", "in...
`login` - Login or username of user to delete Delete user in specified environments
[ "login", "-", "Login", "or", "username", "of", "user", "to", "delete" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L412-L437
48,508
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.sync_repo
def sync_repo(self, repo_name=None, envs=[], query='/repositories/'): """ Sync repository in specified environments """ juicer.utils.Log.log_debug( "Sync Repo %s In: %s" % (repo_name, ",".join(envs))) data = { 'override_config': { 'verify_...
python
def sync_repo(self, repo_name=None, envs=[], query='/repositories/'): """ Sync repository in specified environments """ juicer.utils.Log.log_debug( "Sync Repo %s In: %s" % (repo_name, ",".join(envs))) data = { 'override_config': { 'verify_...
[ "def", "sync_repo", "(", "self", ",", "repo_name", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/repositories/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Sync Repo %s In: %s\"", "%", "(", "repo_name", ",",...
Sync repository in specified environments
[ "Sync", "repository", "in", "specified", "environments" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L439-L461
48,509
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.list_repos
def list_repos(self, envs=[], query='/repositories/'): """ List repositories in specified environments """ juicer.utils.Log.log_debug( "List Repos In: %s", ", ".join(envs)) repo_lists = {} for env in envs: repo_lists[env] = [] for env...
python
def list_repos(self, envs=[], query='/repositories/'): """ List repositories in specified environments """ juicer.utils.Log.log_debug( "List Repos In: %s", ", ".join(envs)) repo_lists = {} for env in envs: repo_lists[env] = [] for env...
[ "def", "list_repos", "(", "self", ",", "envs", "=", "[", "]", ",", "query", "=", "'/repositories/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"List Repos In: %s\"", ",", "\", \"", ".", "join", "(", "envs", ")", ")", "repo_...
List repositories in specified environments
[ "List", "repositories", "in", "specified", "environments" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L463-L482
48,510
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.list_users
def list_users(self, envs=[], query="/users/"): """ List users in specified environments """ juicer.utils.Log.log_debug( "List Users In: %s", ", ".join(envs)) for env in envs: juicer.utils.Log.log_info("%s:" % (env)) _r = self.connectors[en...
python
def list_users(self, envs=[], query="/users/"): """ List users in specified environments """ juicer.utils.Log.log_debug( "List Users In: %s", ", ".join(envs)) for env in envs: juicer.utils.Log.log_info("%s:" % (env)) _r = self.connectors[en...
[ "def", "list_users", "(", "self", ",", "envs", "=", "[", "]", ",", "query", "=", "\"/users/\"", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"List Users In: %s\"", ",", "\", \"", ".", "join", "(", "envs", ")", ")", "for", "e...
List users in specified environments
[ "List", "users", "in", "specified", "environments" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L484-L503
48,511
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.role_add
def role_add(self, role=None, login=None, envs=[], query='/roles/'): """ `login` - Login or username of user to add to `role` `role` - Role to add user to Add user to role """ data = {'login': self.args.login} juicer.utils.Log.log_debug( "Add Role...
python
def role_add(self, role=None, login=None, envs=[], query='/roles/'): """ `login` - Login or username of user to add to `role` `role` - Role to add user to Add user to role """ data = {'login': self.args.login} juicer.utils.Log.log_debug( "Add Role...
[ "def", "role_add", "(", "self", ",", "role", "=", "None", ",", "login", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/roles/'", ")", ":", "data", "=", "{", "'login'", ":", "self", ".", "args", ".", "login", "}", "juicer", ".", ...
`login` - Login or username of user to add to `role` `role` - Role to add user to Add user to role
[ "login", "-", "Login", "or", "username", "of", "user", "to", "add", "to", "role", "role", "-", "Role", "to", "add", "user", "to" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L505-L532
48,512
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.show_user
def show_user(self, login=None, envs=[], query='/users/'): """ `login` - Login or username of user Show user in specified environments """ juicer.utils.Log.log_debug("Show User: %s", login) # keep track of which iteration of environment we're in count = 0 ...
python
def show_user(self, login=None, envs=[], query='/users/'): """ `login` - Login or username of user Show user in specified environments """ juicer.utils.Log.log_debug("Show User: %s", login) # keep track of which iteration of environment we're in count = 0 ...
[ "def", "show_user", "(", "self", ",", "login", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/users/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Show User: %s\"", ",", "login", ")", "# keep track of which it...
`login` - Login or username of user Show user in specified environments
[ "login", "-", "Login", "or", "username", "of", "user" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L566-L600
48,513
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.list_roles
def list_roles(self, envs=[], query='/roles/'): """ List roles in specified environments """ juicer.utils.Log.log_debug("List Roles %s", ", ".join(envs)) count = 0 for env in envs: count += 1 rcount = 0 juicer.utils.Log.log_info("%s:...
python
def list_roles(self, envs=[], query='/roles/'): """ List roles in specified environments """ juicer.utils.Log.log_debug("List Roles %s", ", ".join(envs)) count = 0 for env in envs: count += 1 rcount = 0 juicer.utils.Log.log_info("%s:...
[ "def", "list_roles", "(", "self", ",", "envs", "=", "[", "]", ",", "query", "=", "'/roles/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"List Roles %s\"", ",", "\", \"", ".", "join", "(", "envs", ")", ")", "count", "=", ...
List roles in specified environments
[ "List", "roles", "in", "specified", "environments" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L602-L636
48,514
juicer/juicer
juicer/admin/JuicerAdmin.py
JuicerAdmin.update_user
def update_user(self, login=None, user_name=None, password=None, envs=[], query='/users/'): """ `login` - Login or username of user to update `user_name` - Updated full name of user `password` - Updated plain text password for user Update user information """ jui...
python
def update_user(self, login=None, user_name=None, password=None, envs=[], query='/users/'): """ `login` - Login or username of user to update `user_name` - Updated full name of user `password` - Updated plain text password for user Update user information """ jui...
[ "def", "update_user", "(", "self", ",", "login", "=", "None", ",", "user_name", "=", "None", ",", "password", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/users/'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "...
`login` - Login or username of user to update `user_name` - Updated full name of user `password` - Updated plain text password for user Update user information
[ "login", "-", "Login", "or", "username", "of", "user", "to", "update", "user_name", "-", "Updated", "full", "name", "of", "user", "password", "-", "Updated", "plain", "text", "password", "for", "user" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/admin/JuicerAdmin.py#L638-L676
48,515
juicer/juicer
juicer/common/Repo.py
RepoDiff._diff
def _diff(self): """Calculates what you need to do to make a pulp repo match a juicer repo def""" j_cs = self.j['checksum_type'] j_feed = self.j['feed'] p_cs = self.p['checksum_type'] p_feed = self.p['feed'] # checksum is a distributor property # Is the pulp che...
python
def _diff(self): """Calculates what you need to do to make a pulp repo match a juicer repo def""" j_cs = self.j['checksum_type'] j_feed = self.j['feed'] p_cs = self.p['checksum_type'] p_feed = self.p['feed'] # checksum is a distributor property # Is the pulp che...
[ "def", "_diff", "(", "self", ")", ":", "j_cs", "=", "self", ".", "j", "[", "'checksum_type'", "]", "j_feed", "=", "self", ".", "j", "[", "'feed'", "]", "p_cs", "=", "self", ".", "p", "[", "'checksum_type'", "]", "p_feed", "=", "self", ".", "p", "...
Calculates what you need to do to make a pulp repo match a juicer repo def
[ "Calculates", "what", "you", "need", "to", "do", "to", "make", "a", "pulp", "repo", "match", "a", "juicer", "repo", "def" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/Repo.py#L156-L175
48,516
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer._set_prefixes
def _set_prefixes(self, conf): """Set the graphite key prefixes :param dict conf: The configuration data """ if conf.get('legacy_namespace', 'y') in self.TRUE_VALUES: self.count_prefix = 'stats_counts' self.count_suffix = '' self.gauge_prefix = 'stat...
python
def _set_prefixes(self, conf): """Set the graphite key prefixes :param dict conf: The configuration data """ if conf.get('legacy_namespace', 'y') in self.TRUE_VALUES: self.count_prefix = 'stats_counts' self.count_suffix = '' self.gauge_prefix = 'stat...
[ "def", "_set_prefixes", "(", "self", ",", "conf", ")", ":", "if", "conf", ".", "get", "(", "'legacy_namespace'", ",", "'y'", ")", "in", "self", ".", "TRUE_VALUES", ":", "self", ".", "count_prefix", "=", "'stats_counts'", "self", ".", "count_suffix", "=", ...
Set the graphite key prefixes :param dict conf: The configuration data
[ "Set", "the", "graphite", "key", "prefixes" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L57-L81
48,517
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer._get_batches
def _get_batches(self, items): """given a list yield list at most self.max_batch_size in size""" for i in xrange(0, len(items), self.max_batch_size): yield items[i:i + self.max_batch_size]
python
def _get_batches(self, items): """given a list yield list at most self.max_batch_size in size""" for i in xrange(0, len(items), self.max_batch_size): yield items[i:i + self.max_batch_size]
[ "def", "_get_batches", "(", "self", ",", "items", ")", ":", "for", "i", "in", "xrange", "(", "0", ",", "len", "(", "items", ")", ",", "self", ".", "max_batch_size", ")", ":", "yield", "items", "[", "i", ":", "i", "+", "self", ".", "max_batch_size",...
given a list yield list at most self.max_batch_size in size
[ "given", "a", "list", "yield", "list", "at", "most", "self", ".", "max_batch_size", "in", "size" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L83-L86
48,518
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.report_stats
def report_stats(self, payload, is_retry=False): """ Send data to graphite host :param payload: Data to send to graphite """ if self.debug: if self.pickle_proto: print "reporting pickled stats" else: print "reporting stats ...
python
def report_stats(self, payload, is_retry=False): """ Send data to graphite host :param payload: Data to send to graphite """ if self.debug: if self.pickle_proto: print "reporting pickled stats" else: print "reporting stats ...
[ "def", "report_stats", "(", "self", ",", "payload", ",", "is_retry", "=", "False", ")", ":", "if", "self", ".", "debug", ":", "if", "self", ".", "pickle_proto", ":", "print", "\"reporting pickled stats\"", "else", ":", "print", "\"reporting stats -> {\\n%s}\"", ...
Send data to graphite host :param payload: Data to send to graphite
[ "Send", "data", "to", "graphite", "host" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L88-L122
48,519
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.stats_flush
def stats_flush(self): """ Periodically flush stats to graphite """ while True: try: eventlet.sleep(self.flush_interval) if self.debug: print "seen %d stats so far." % self.stats_seen print "current count...
python
def stats_flush(self): """ Periodically flush stats to graphite """ while True: try: eventlet.sleep(self.flush_interval) if self.debug: print "seen %d stats so far." % self.stats_seen print "current count...
[ "def", "stats_flush", "(", "self", ")", ":", "while", "True", ":", "try", ":", "eventlet", ".", "sleep", "(", "self", ".", "flush_interval", ")", "if", "self", ".", "debug", ":", "print", "\"seen %d stats so far.\"", "%", "self", ".", "stats_seen", "print"...
Periodically flush stats to graphite
[ "Periodically", "flush", "stats", "to", "graphite" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L124-L144
48,520
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.pickle_payload
def pickle_payload(self): """obtain stats payload in batches of pickle format""" tstamp = int(time.time()) payload = [] for item in self.counters: payload.append(("%s.%s%s" % (self.rate_prefix, item, self.rate_suffix), ...
python
def pickle_payload(self): """obtain stats payload in batches of pickle format""" tstamp = int(time.time()) payload = [] for item in self.counters: payload.append(("%s.%s%s" % (self.rate_prefix, item, self.rate_suffix), ...
[ "def", "pickle_payload", "(", "self", ")", ":", "tstamp", "=", "int", "(", "time", ".", "time", "(", ")", ")", "payload", "=", "[", "]", "for", "item", "in", "self", ".", "counters", ":", "payload", ".", "append", "(", "(", "\"%s.%s%s\"", "%", "(",...
obtain stats payload in batches of pickle format
[ "obtain", "stats", "payload", "in", "batches", "of", "pickle", "format" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L146-L180
48,521
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.plain_payload
def plain_payload(self): """obtain stats payload in plaintext format""" tstamp = int(time.time()) payload = [] for item in self.counters: payload.append('%s.%s%s %s %s\n' % (self.rate_prefix, item, ...
python
def plain_payload(self): """obtain stats payload in plaintext format""" tstamp = int(time.time()) payload = [] for item in self.counters: payload.append('%s.%s%s %s %s\n' % (self.rate_prefix, item, ...
[ "def", "plain_payload", "(", "self", ")", ":", "tstamp", "=", "int", "(", "time", ".", "time", "(", ")", ")", "payload", "=", "[", "]", "for", "item", "in", "self", ".", "counters", ":", "payload", ".", "append", "(", "'%s.%s%s %s %s\\n'", "%", "(", ...
obtain stats payload in plaintext format
[ "obtain", "stats", "payload", "in", "plaintext", "format" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L182-L216
48,522
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.process_gauge
def process_gauge(self, key, fields): """ Process a received gauge event :param key: Key of timer :param fields: Received fields """ try: self.gauges[key] = float(fields[0]) if self.stats_seen >= maxint: self.logger.info("hit maxin...
python
def process_gauge(self, key, fields): """ Process a received gauge event :param key: Key of timer :param fields: Received fields """ try: self.gauges[key] = float(fields[0]) if self.stats_seen >= maxint: self.logger.info("hit maxin...
[ "def", "process_gauge", "(", "self", ",", "key", ",", "fields", ")", ":", "try", ":", "self", ".", "gauges", "[", "key", "]", "=", "float", "(", "fields", "[", "0", "]", ")", "if", "self", ".", "stats_seen", ">=", "maxint", ":", "self", ".", "log...
Process a received gauge event :param key: Key of timer :param fields: Received fields
[ "Process", "a", "received", "gauge", "event" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L218-L234
48,523
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.process_timer
def process_timer(self, key, fields): """ Process a received timer event :param key: Key of timer :param fields: Received fields """ try: if key not in self.timers: self.timers[key] = [] self.timers[key].append(float(fields[0])) ...
python
def process_timer(self, key, fields): """ Process a received timer event :param key: Key of timer :param fields: Received fields """ try: if key not in self.timers: self.timers[key] = [] self.timers[key].append(float(fields[0])) ...
[ "def", "process_timer", "(", "self", ",", "key", ",", "fields", ")", ":", "try", ":", "if", "key", "not", "in", "self", ".", "timers", ":", "self", ".", "timers", "[", "key", "]", "=", "[", "]", "self", ".", "timers", "[", "key", "]", ".", "app...
Process a received timer event :param key: Key of timer :param fields: Received fields
[ "Process", "a", "received", "timer", "event" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L236-L254
48,524
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.process_counter
def process_counter(self, key, fields): """ Process a received counter event :param key: Key of counter :param fields: Received fields """ sample_rate = 1.0 try: if len(fields) is 3: if self.ratecheck.match(fields[2]): ...
python
def process_counter(self, key, fields): """ Process a received counter event :param key: Key of counter :param fields: Received fields """ sample_rate = 1.0 try: if len(fields) is 3: if self.ratecheck.match(fields[2]): ...
[ "def", "process_counter", "(", "self", ",", "key", ",", "fields", ")", ":", "sample_rate", "=", "1.0", "try", ":", "if", "len", "(", "fields", ")", "is", "3", ":", "if", "self", ".", "ratecheck", ".", "match", "(", "fields", "[", "2", "]", ")", "...
Process a received counter event :param key: Key of counter :param fields: Received fields
[ "Process", "a", "received", "counter", "event" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L256-L281
48,525
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.process_timer_key
def process_timer_key(self, key, tstamp, stack, pickled=False): """Append the plain text graphite :param str key: The timer key to process :param int tstamp: The timestamp for the data point :param list stack: The stack of metrics to append the output to """ self.timers...
python
def process_timer_key(self, key, tstamp, stack, pickled=False): """Append the plain text graphite :param str key: The timer key to process :param int tstamp: The timestamp for the data point :param list stack: The stack of metrics to append the output to """ self.timers...
[ "def", "process_timer_key", "(", "self", ",", "key", ",", "tstamp", ",", "stack", ",", "pickled", "=", "False", ")", ":", "self", ".", "timers", "[", "key", "]", ".", "sort", "(", ")", "values", "=", "{", "'count'", ":", "len", "(", "self", ".", ...
Append the plain text graphite :param str key: The timer key to process :param int tstamp: The timestamp for the data point :param list stack: The stack of metrics to append the output to
[ "Append", "the", "plain", "text", "graphite" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L283-L314
48,526
pandemicsyn/statsdpy
statsdpy/statsd.py
StatsdServer.decode_recvd
def decode_recvd(self, data): """ Decode and process the data from a received event. :param data: Data to decode and process. """ bits = data.split(':') if len(bits) == 2: key = self.keycheck.sub('_', bits[0]) fields = bits[1].split("|") ...
python
def decode_recvd(self, data): """ Decode and process the data from a received event. :param data: Data to decode and process. """ bits = data.split(':') if len(bits) == 2: key = self.keycheck.sub('_', bits[0]) fields = bits[1].split("|") ...
[ "def", "decode_recvd", "(", "self", ",", "data", ")", ":", "bits", "=", "data", ".", "split", "(", "':'", ")", "if", "len", "(", "bits", ")", "==", "2", ":", "key", "=", "self", ".", "keycheck", ".", "sub", "(", "'_'", ",", "bits", "[", "0", ...
Decode and process the data from a received event. :param data: Data to decode and process.
[ "Decode", "and", "process", "the", "data", "from", "a", "received", "event", "." ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/statsd.py#L316-L339
48,527
juju-solutions/jujuresources
docs/exts/clidoc.py
CLIDoc._get_usage
def _get_usage(self): """ Build usage string from argparser args. """ parser = argparse.ArgumentParser() parser.prog = 'juju-resources {}'.format(self.object_name) for set_name, set_args in getattr(self.object, '_subcommand_argsets', {}).items(): for ap_args, ...
python
def _get_usage(self): """ Build usage string from argparser args. """ parser = argparse.ArgumentParser() parser.prog = 'juju-resources {}'.format(self.object_name) for set_name, set_args in getattr(self.object, '_subcommand_argsets', {}).items(): for ap_args, ...
[ "def", "_get_usage", "(", "self", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "prog", "=", "'juju-resources {}'", ".", "format", "(", "self", ".", "object_name", ")", "for", "set_name", ",", "set_args", "in", "getat...
Build usage string from argparser args.
[ "Build", "usage", "string", "from", "argparser", "args", "." ]
7d2c5f50981784cc4b5cde216b930f6d59c951a4
https://github.com/juju-solutions/jujuresources/blob/7d2c5f50981784cc4b5cde216b930f6d59c951a4/docs/exts/clidoc.py#L15-L28
48,528
open-homeautomation/pknx
knxip/core.py
parse_group_address
def parse_group_address(addr): """Parse KNX group addresses and return the address as an integer. This allows to convert x/x/x and x/x address syntax to a numeric KNX group address """ if addr is None: raise KNXException("No address given") res = None if re.match('[0-9]+$', addr)...
python
def parse_group_address(addr): """Parse KNX group addresses and return the address as an integer. This allows to convert x/x/x and x/x address syntax to a numeric KNX group address """ if addr is None: raise KNXException("No address given") res = None if re.match('[0-9]+$', addr)...
[ "def", "parse_group_address", "(", "addr", ")", ":", "if", "addr", "is", "None", ":", "raise", "KNXException", "(", "\"No address given\"", ")", "res", "=", "None", "if", "re", ".", "match", "(", "'[0-9]+$'", ",", "addr", ")", ":", "res", "=", "int", "...
Parse KNX group addresses and return the address as an integer. This allows to convert x/x/x and x/x address syntax to a numeric KNX group address
[ "Parse", "KNX", "group", "addresses", "and", "return", "the", "address", "as", "an", "integer", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/core.py#L21-L53
48,529
open-homeautomation/pknx
knxip/core.py
ValueCache.set
def set(self, name, value): """Set the cached value for the given name""" old_val = self.values.get(name) if old_val != value: self.values[name] = value return True else: return False
python
def set(self, name, value): """Set the cached value for the given name""" old_val = self.values.get(name) if old_val != value: self.values[name] = value return True else: return False
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "old_val", "=", "self", ".", "values", ".", "get", "(", "name", ")", "if", "old_val", "!=", "value", ":", "self", ".", "values", "[", "name", "]", "=", "value", "return", "True", "el...
Set the cached value for the given name
[ "Set", "the", "cached", "value", "for", "the", "given", "name" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/core.py#L67-L74
48,530
open-homeautomation/pknx
knxip/core.py
KNXMessage.sanitize
def sanitize(self): """Sanitize all fields of the KNX message.""" self.repeat = self.repeat % 2 self.priority = self.priority % 4 self.src_addr = self.src_addr % 0x10000 self.dst_addr = self.dst_addr % 0x10000 self.multicast = self.multicast % 2 self.routing = sel...
python
def sanitize(self): """Sanitize all fields of the KNX message.""" self.repeat = self.repeat % 2 self.priority = self.priority % 4 self.src_addr = self.src_addr % 0x10000 self.dst_addr = self.dst_addr % 0x10000 self.multicast = self.multicast % 2 self.routing = sel...
[ "def", "sanitize", "(", "self", ")", ":", "self", ".", "repeat", "=", "self", ".", "repeat", "%", "2", "self", ".", "priority", "=", "self", ".", "priority", "%", "4", "self", ".", "src_addr", "=", "self", ".", "src_addr", "%", "0x10000", "self", "...
Sanitize all fields of the KNX message.
[ "Sanitize", "all", "fields", "of", "the", "KNX", "message", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/core.py#L129-L139
48,531
open-homeautomation/pknx
knxip/core.py
KNXMessage.to_frame
def to_frame(self): """Convert the object to its frame format.""" self.sanitize() res = [] res.append((1 << 7) + (1 << 4) + (self.repeat << 5) + (self.priority << 2)) res.append(self.src_addr >> 8) res.append(self.src_addr % 0x100) res.append(se...
python
def to_frame(self): """Convert the object to its frame format.""" self.sanitize() res = [] res.append((1 << 7) + (1 << 4) + (self.repeat << 5) + (self.priority << 2)) res.append(self.src_addr >> 8) res.append(self.src_addr % 0x100) res.append(se...
[ "def", "to_frame", "(", "self", ")", ":", "self", ".", "sanitize", "(", ")", "res", "=", "[", "]", "res", ".", "append", "(", "(", "1", "<<", "7", ")", "+", "(", "1", "<<", "4", ")", "+", "(", "self", ".", "repeat", "<<", "5", ")", "+", "...
Convert the object to its frame format.
[ "Convert", "the", "object", "to", "its", "frame", "format", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/core.py#L141-L162
48,532
open-homeautomation/pknx
knxip/core.py
KNXMessage.from_frame
def from_frame(cls, frame): """Create a KNXMessage object from the frame format.""" message = cls() # Check checksum first checksum = 0 for i in range(0, len(frame) - 1): checksum += frame[i] if (checksum % 0x100) != frame[len(frame) - 1]: raise ...
python
def from_frame(cls, frame): """Create a KNXMessage object from the frame format.""" message = cls() # Check checksum first checksum = 0 for i in range(0, len(frame) - 1): checksum += frame[i] if (checksum % 0x100) != frame[len(frame) - 1]: raise ...
[ "def", "from_frame", "(", "cls", ",", "frame", ")", ":", "message", "=", "cls", "(", ")", "# Check checksum first", "checksum", "=", "0", "for", "i", "in", "range", "(", "0", ",", "len", "(", "frame", ")", "-", "1", ")", ":", "checksum", "+=", "fra...
Create a KNXMessage object from the frame format.
[ "Create", "a", "KNXMessage", "object", "from", "the", "frame", "format", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/core.py#L165-L193
48,533
juicer/juicer
juicer/utils/Remotes.py
assemble_remotes
def assemble_remotes(resource): """ Using the specified input resource, assemble a list of rpm URLS. This function will, when given a remote package url, directory index, or a combination of the two in a local input file, do all the work required to turn that input into a list of only remote pa...
python
def assemble_remotes(resource): """ Using the specified input resource, assemble a list of rpm URLS. This function will, when given a remote package url, directory index, or a combination of the two in a local input file, do all the work required to turn that input into a list of only remote pa...
[ "def", "assemble_remotes", "(", "resource", ")", ":", "resource_type", "=", "classify_resource_type", "(", "resource", ")", "if", "resource_type", "is", "None", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Could not classify or find the input r...
Using the specified input resource, assemble a list of rpm URLS. This function will, when given a remote package url, directory index, or a combination of the two in a local input file, do all the work required to turn that input into a list of only remote package URLs.
[ "Using", "the", "specified", "input", "resource", "assemble", "a", "list", "of", "rpm", "URLS", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L32-L54
48,534
juicer/juicer
juicer/utils/Remotes.py
classify_resource_type
def classify_resource_type(resource): """ Determine if the specified resource is remote or local. We can handle three remote resource types from the command line, remote RPMs, directory indexes, and input files. They're classified by matching the following patterns: - Remote RPMS start with ht...
python
def classify_resource_type(resource): """ Determine if the specified resource is remote or local. We can handle three remote resource types from the command line, remote RPMs, directory indexes, and input files. They're classified by matching the following patterns: - Remote RPMS start with ht...
[ "def", "classify_resource_type", "(", "resource", ")", ":", "if", "is_remote_package", "(", "resource", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Classified %s as a remote package\"", "%", "resource", ")", "return", "REMOTE_PKG_TYPE", ...
Determine if the specified resource is remote or local. We can handle three remote resource types from the command line, remote RPMs, directory indexes, and input files. They're classified by matching the following patterns: - Remote RPMS start with http[s] and end with .RPM - Directory indexes st...
[ "Determine", "if", "the", "specified", "resource", "is", "remote", "or", "local", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L57-L80
48,535
juicer/juicer
juicer/utils/Remotes.py
is_remote_package
def is_remote_package(resource): """ Classify the input resource as a remote RPM or not. """ remote_regexp = re.compile(r"^https?://(.+).rpm$", re.I) result = remote_regexp.match(resource) if result is not None: juicer.utils.Log.log_debug("%s matches remote package regexp" % resource) ...
python
def is_remote_package(resource): """ Classify the input resource as a remote RPM or not. """ remote_regexp = re.compile(r"^https?://(.+).rpm$", re.I) result = remote_regexp.match(resource) if result is not None: juicer.utils.Log.log_debug("%s matches remote package regexp" % resource) ...
[ "def", "is_remote_package", "(", "resource", ")", ":", "remote_regexp", "=", "re", ".", "compile", "(", "r\"^https?://(.+).rpm$\"", ",", "re", ".", "I", ")", "result", "=", "remote_regexp", ".", "match", "(", "resource", ")", "if", "result", "is", "not", "...
Classify the input resource as a remote RPM or not.
[ "Classify", "the", "input", "resource", "as", "a", "remote", "RPM", "or", "not", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L83-L95
48,536
juicer/juicer
juicer/utils/Remotes.py
is_directory_index
def is_directory_index(resource): """ Classify the input resource as a directory index or not. """ remote_regexp = re.compile(r"^https?://(.+)/?$", re.I) result = remote_regexp.match(resource) if result is not None: juicer.utils.Log.log_debug("%s matches directory index regexp" % resour...
python
def is_directory_index(resource): """ Classify the input resource as a directory index or not. """ remote_regexp = re.compile(r"^https?://(.+)/?$", re.I) result = remote_regexp.match(resource) if result is not None: juicer.utils.Log.log_debug("%s matches directory index regexp" % resour...
[ "def", "is_directory_index", "(", "resource", ")", ":", "remote_regexp", "=", "re", ".", "compile", "(", "r\"^https?://(.+)/?$\"", ",", "re", ".", "I", ")", "result", "=", "remote_regexp", ".", "match", "(", "resource", ")", "if", "result", "is", "not", "N...
Classify the input resource as a directory index or not.
[ "Classify", "the", "input", "resource", "as", "a", "directory", "index", "or", "not", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L98-L110
48,537
juicer/juicer
juicer/utils/Remotes.py
parse_input_file
def parse_input_file(resource): """ Parse input file into remote packages and excluded data. In addition to garbage, excluded data includes directory indexes for the time being. This will be revisited after basic functionality has been fully implemented. """ input_resource = open(resource, ...
python
def parse_input_file(resource): """ Parse input file into remote packages and excluded data. In addition to garbage, excluded data includes directory indexes for the time being. This will be revisited after basic functionality has been fully implemented. """ input_resource = open(resource, ...
[ "def", "parse_input_file", "(", "resource", ")", ":", "input_resource", "=", "open", "(", "resource", ",", "'r'", ")", ".", "read", "(", ")", "remotes_list", "=", "[", "url", "for", "url", "in", "input_resource", ".", "split", "(", ")", "]", "juicer", ...
Parse input file into remote packages and excluded data. In addition to garbage, excluded data includes directory indexes for the time being. This will be revisited after basic functionality has been fully implemented.
[ "Parse", "input", "file", "into", "remote", "packages", "and", "excluded", "data", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L113-L135
48,538
juicer/juicer
juicer/utils/Remotes.py
parse_directory_index
def parse_directory_index(directory_index): """ Retrieve a directory index and make a list of the RPMs listed. """ # Normalize our URL style if not directory_index.endswith('/'): directory_index = directory_index + '/' site_index = urllib2.urlopen(directory_index) parsed_site_index ...
python
def parse_directory_index(directory_index): """ Retrieve a directory index and make a list of the RPMs listed. """ # Normalize our URL style if not directory_index.endswith('/'): directory_index = directory_index + '/' site_index = urllib2.urlopen(directory_index) parsed_site_index ...
[ "def", "parse_directory_index", "(", "directory_index", ")", ":", "# Normalize our URL style", "if", "not", "directory_index", ".", "endswith", "(", "'/'", ")", ":", "directory_index", "=", "directory_index", "+", "'/'", "site_index", "=", "urllib2", ".", "urlopen",...
Retrieve a directory index and make a list of the RPMs listed.
[ "Retrieve", "a", "directory", "index", "and", "make", "a", "list", "of", "the", "RPMs", "listed", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Remotes.py#L138-L156
48,539
todbot/blink1-python
blink1/kelvin.py
kelvin_to_rgb
def kelvin_to_rgb(kelvin): """ Convert a color temperature given in kelvin to an approximate RGB value. :param kelvin: Color temp in K :return: Tuple of (r, g, b), equivalent color for the temperature """ temp = kelvin / 100.0 # Calculate Red: if temp <= 66: red = 255 else:...
python
def kelvin_to_rgb(kelvin): """ Convert a color temperature given in kelvin to an approximate RGB value. :param kelvin: Color temp in K :return: Tuple of (r, g, b), equivalent color for the temperature """ temp = kelvin / 100.0 # Calculate Red: if temp <= 66: red = 255 else:...
[ "def", "kelvin_to_rgb", "(", "kelvin", ")", ":", "temp", "=", "kelvin", "/", "100.0", "# Calculate Red:", "if", "temp", "<=", "66", ":", "red", "=", "255", "else", ":", "red", "=", "329.698727446", "*", "(", "(", "temp", "-", "60", ")", "**", "-", ...
Convert a color temperature given in kelvin to an approximate RGB value. :param kelvin: Color temp in K :return: Tuple of (r, g, b), equivalent color for the temperature
[ "Convert", "a", "color", "temperature", "given", "in", "kelvin", "to", "an", "approximate", "RGB", "value", "." ]
7a5183becd9662f88da3c29afd3447403f4ef82f
https://github.com/todbot/blink1-python/blob/7a5183becd9662f88da3c29afd3447403f4ef82f/blink1/kelvin.py#L37-L67
48,540
happyleavesaoc/python-limitlessled
limitlessled/group/rgbw.py
RgbwGroup.white
def white(self): """ Set color to white. """ self._color = RGB_WHITE cmd = self.command_set.white() self.send(cmd)
python
def white(self): """ Set color to white. """ self._color = RGB_WHITE cmd = self.command_set.white() self.send(cmd)
[ "def", "white", "(", "self", ")", ":", "self", ".", "_color", "=", "RGB_WHITE", "cmd", "=", "self", ".", "command_set", ".", "white", "(", ")", "self", ".", "send", "(", "cmd", ")" ]
Set color to white.
[ "Set", "color", "to", "white", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/group/rgbw.py#L53-L57
48,541
happyleavesaoc/python-limitlessled
limitlessled/group/rgbw.py
RgbwGroup.brightness
def brightness(self, brightness): """ Set the group brightness. :param brightness: Brightness in decimal percent (0.0-1.0). """ if brightness < 0 or brightness > 1: raise ValueError("Brightness must be a percentage " "represented as decimal 0-1.0...
python
def brightness(self, brightness): """ Set the group brightness. :param brightness: Brightness in decimal percent (0.0-1.0). """ if brightness < 0 or brightness > 1: raise ValueError("Brightness must be a percentage " "represented as decimal 0-1.0...
[ "def", "brightness", "(", "self", ",", "brightness", ")", ":", "if", "brightness", "<", "0", "or", "brightness", ">", "1", ":", "raise", "ValueError", "(", "\"Brightness must be a percentage \"", "\"represented as decimal 0-1.0\"", ")", "self", ".", "_brightness", ...
Set the group brightness. :param brightness: Brightness in decimal percent (0.0-1.0).
[ "Set", "the", "group", "brightness", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/group/rgbw.py#L73-L83
48,542
happyleavesaoc/python-limitlessled
limitlessled/group/rgbw.py
RgbwGroup.hue
def hue(self, hue): """ Set the group hue. :param hue: Hue in decimal percent (0.0-1.0). """ if hue < 0 or hue > 1: raise ValueError("Hue must be a percentage " "represented as decimal 0-1.0") self._hue = hue cmd = self.command_se...
python
def hue(self, hue): """ Set the group hue. :param hue: Hue in decimal percent (0.0-1.0). """ if hue < 0 or hue > 1: raise ValueError("Hue must be a percentage " "represented as decimal 0-1.0") self._hue = hue cmd = self.command_se...
[ "def", "hue", "(", "self", ",", "hue", ")", ":", "if", "hue", "<", "0", "or", "hue", ">", "1", ":", "raise", "ValueError", "(", "\"Hue must be a percentage \"", "\"represented as decimal 0-1.0\"", ")", "self", ".", "_hue", "=", "hue", "cmd", "=", "self", ...
Set the group hue. :param hue: Hue in decimal percent (0.0-1.0).
[ "Set", "the", "group", "hue", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/group/rgbw.py#L94-L104
48,543
open-homeautomation/pknx
knxip/timeupdater.py
KNXDateTimeUpdater.send_updates
def send_updates(self): """ Send updated to the KNX bus. """ d = datetime.now() if self.timeaddr: self.tunnel.group_write(self.timeaddr, time_to_knx(d)) if self.dateaddr: self.tunnel.group_write(self.dateaddr, ...
python
def send_updates(self): """ Send updated to the KNX bus. """ d = datetime.now() if self.timeaddr: self.tunnel.group_write(self.timeaddr, time_to_knx(d)) if self.dateaddr: self.tunnel.group_write(self.dateaddr, ...
[ "def", "send_updates", "(", "self", ")", ":", "d", "=", "datetime", ".", "now", "(", ")", "if", "self", ".", "timeaddr", ":", "self", ".", "tunnel", ".", "group_write", "(", "self", ".", "timeaddr", ",", "time_to_knx", "(", "d", ")", ")", "if", "se...
Send updated to the KNX bus.
[ "Send", "updated", "to", "the", "KNX", "bus", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/timeupdater.py#L60-L81
48,544
open-homeautomation/pknx
knxip/timeupdater.py
KNXDateTimeUpdater.updater_loop
def updater_loop(self): """ Main loop that should run in the background. """ self.updater_running = True while (self.updater_running): self.send_updates() sleep(self.updateinterval)
python
def updater_loop(self): """ Main loop that should run in the background. """ self.updater_running = True while (self.updater_running): self.send_updates() sleep(self.updateinterval)
[ "def", "updater_loop", "(", "self", ")", ":", "self", ".", "updater_running", "=", "True", "while", "(", "self", ".", "updater_running", ")", ":", "self", ".", "send_updates", "(", ")", "sleep", "(", "self", ".", "updateinterval", ")" ]
Main loop that should run in the background.
[ "Main", "loop", "that", "should", "run", "in", "the", "background", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/timeupdater.py#L83-L88
48,545
open-homeautomation/pknx
knxip/timeupdater.py
KNXDateTimeUpdater.run_updater_in_background
def run_updater_in_background(self): """ Starts a thread that runs the updater in the background. """ thread = threading.Thread(target=self.updater_loop()) thread.daemon = True thread.start()
python
def run_updater_in_background(self): """ Starts a thread that runs the updater in the background. """ thread = threading.Thread(target=self.updater_loop()) thread.daemon = True thread.start()
[ "def", "run_updater_in_background", "(", "self", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "updater_loop", "(", ")", ")", "thread", ".", "daemon", "=", "True", "thread", ".", "start", "(", ")" ]
Starts a thread that runs the updater in the background.
[ "Starts", "a", "thread", "that", "runs", "the", "updater", "in", "the", "background", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/timeupdater.py#L90-L94
48,546
kdheepak/zip
zip/app/settings.py
parent_dir
def parent_dir(path): '''Return the parent of a directory.''' return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
python
def parent_dir(path): '''Return the parent of a directory.''' return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
[ "def", "parent_dir", "(", "path", ")", ":", "return", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "path", ",", "os", ".", "pardir", ",", "os", ".", "pardir", ",", "'_build'", ")", ")" ]
Return the parent of a directory.
[ "Return", "the", "parent", "of", "a", "directory", "." ]
5c7f2400045d6ae2b3b4994577c73209562604a9
https://github.com/kdheepak/zip/blob/5c7f2400045d6ae2b3b4994577c73209562604a9/zip/app/settings.py#L11-L13
48,547
juicer/juicer
juicer/common/CartItem.py
CartItem.update
def update(self, path): """ Update the attributes of this CartItem. """ self._reset() self.path = path self._refresh_synced() if self.is_synced: self._refresh_path() self._refresh_signed() self._refresh_nvr()
python
def update(self, path): """ Update the attributes of this CartItem. """ self._reset() self.path = path self._refresh_synced() if self.is_synced: self._refresh_path() self._refresh_signed() self._refresh_nvr()
[ "def", "update", "(", "self", ",", "path", ")", ":", "self", ".", "_reset", "(", ")", "self", ".", "path", "=", "path", "self", ".", "_refresh_synced", "(", ")", "if", "self", ".", "is_synced", ":", "self", ".", "_refresh_path", "(", ")", "self", "...
Update the attributes of this CartItem.
[ "Update", "the", "attributes", "of", "this", "CartItem", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L44-L54
48,548
juicer/juicer
juicer/common/CartItem.py
CartItem.sync_to
def sync_to(self, destination): """ Sync an RPM from a REMOTE to a LOCAL path. Returns True if the item required a sync, False if it already existed locally. TODO: Remove dupe code in Cart.py:sync_remotes() """ rpm = RPM(self.path) rpm.sync(destination) ...
python
def sync_to(self, destination): """ Sync an RPM from a REMOTE to a LOCAL path. Returns True if the item required a sync, False if it already existed locally. TODO: Remove dupe code in Cart.py:sync_remotes() """ rpm = RPM(self.path) rpm.sync(destination) ...
[ "def", "sync_to", "(", "self", ",", "destination", ")", ":", "rpm", "=", "RPM", "(", "self", ".", "path", ")", "rpm", ".", "sync", "(", "destination", ")", "if", "rpm", ".", "modified", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "("...
Sync an RPM from a REMOTE to a LOCAL path. Returns True if the item required a sync, False if it already existed locally. TODO: Remove dupe code in Cart.py:sync_remotes()
[ "Sync", "an", "RPM", "from", "a", "REMOTE", "to", "a", "LOCAL", "path", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L63-L78
48,549
juicer/juicer
juicer/common/CartItem.py
CartItem._refresh_synced
def _refresh_synced(self): """ Update our is_synced attribute accordingly. """ if self.path.startswith('http'): juicer.utils.Log.log_debug("%s is not synced" % self.path) self.is_synced = False else: juicer.utils.Log.log_debug("%s is synced" % ...
python
def _refresh_synced(self): """ Update our is_synced attribute accordingly. """ if self.path.startswith('http'): juicer.utils.Log.log_debug("%s is not synced" % self.path) self.is_synced = False else: juicer.utils.Log.log_debug("%s is synced" % ...
[ "def", "_refresh_synced", "(", "self", ")", ":", "if", "self", ".", "path", ".", "startswith", "(", "'http'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"%s is not synced\"", "%", "self", ".", "path", ")", "self", ".", "is_s...
Update our is_synced attribute accordingly.
[ "Update", "our", "is_synced", "attribute", "accordingly", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L80-L89
48,550
juicer/juicer
juicer/common/CartItem.py
CartItem._refresh_path
def _refresh_path(self): """ Does it exist? Can we read it? Is it an RPM? """ # Unsynced items are remote so we can't check some of their # properties yet if os.path.exists(self.path): try: i = open(self.path, 'r') i.close() jui...
python
def _refresh_path(self): """ Does it exist? Can we read it? Is it an RPM? """ # Unsynced items are remote so we can't check some of their # properties yet if os.path.exists(self.path): try: i = open(self.path, 'r') i.close() jui...
[ "def", "_refresh_path", "(", "self", ")", ":", "# Unsynced items are remote so we can't check some of their", "# properties yet", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "try", ":", "i", "=", "open", "(", "self", ".", "path"...
Does it exist? Can we read it? Is it an RPM?
[ "Does", "it", "exist?", "Can", "we", "read", "it?", "Is", "it", "an", "RPM?" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L91-L103
48,551
juicer/juicer
juicer/common/CartItem.py
CartItem._refresh_nvr
def _refresh_nvr(self): """ Refresh our name-version-release attributes. """ rpm_info = juicer.utils.rpm_info(self.path) self.name = rpm_info['name'] self.version = rpm_info['version'] self.release = rpm_info['release']
python
def _refresh_nvr(self): """ Refresh our name-version-release attributes. """ rpm_info = juicer.utils.rpm_info(self.path) self.name = rpm_info['name'] self.version = rpm_info['version'] self.release = rpm_info['release']
[ "def", "_refresh_nvr", "(", "self", ")", ":", "rpm_info", "=", "juicer", ".", "utils", ".", "rpm_info", "(", "self", ".", "path", ")", "self", ".", "name", "=", "rpm_info", "[", "'name'", "]", "self", ".", "version", "=", "rpm_info", "[", "'version'", ...
Refresh our name-version-release attributes.
[ "Refresh", "our", "name", "-", "version", "-", "release", "attributes", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L105-L110
48,552
juicer/juicer
juicer/common/CartItem.py
CartItem._reset
def _reset(self): """ Used during update operations and when initialized. """ self.path = '' self.version = '' self.release = '' self.is_signed = False self.is_synced = False self.rpm = False
python
def _reset(self): """ Used during update operations and when initialized. """ self.path = '' self.version = '' self.release = '' self.is_signed = False self.is_synced = False self.rpm = False
[ "def", "_reset", "(", "self", ")", ":", "self", ".", "path", "=", "''", "self", ".", "version", "=", "''", "self", ".", "release", "=", "''", "self", ".", "is_signed", "=", "False", "self", ".", "is_synced", "=", "False", "self", ".", "rpm", "=", ...
Used during update operations and when initialized.
[ "Used", "during", "update", "operations", "and", "when", "initialized", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/common/CartItem.py#L119-L126
48,553
happyleavesaoc/python-limitlessled
limitlessled/__init__.py
LimitlessLED.add_bridge
def add_bridge(self, bridge): """ Add bridge groups. :param bridge: Add groups from this bridge. """ for group in bridge.groups: self._groups[group.name] = group
python
def add_bridge(self, bridge): """ Add bridge groups. :param bridge: Add groups from this bridge. """ for group in bridge.groups: self._groups[group.name] = group
[ "def", "add_bridge", "(", "self", ",", "bridge", ")", ":", "for", "group", "in", "bridge", ".", "groups", ":", "self", ".", "_groups", "[", "group", ".", "name", "]", "=", "group" ]
Add bridge groups. :param bridge: Add groups from this bridge.
[ "Add", "bridge", "groups", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/__init__.py#L36-L42
48,554
JustusW/harparser
harparser.py
HAREncodable.json
def json(self, json_string=None): """ Convenience method allowing easy dumping to and loading from json. """ if json_string is not None: return self.__init__(loads(json_string)) dump = self if isinstance(self, HAR.log): dump = {"log": dump} ...
python
def json(self, json_string=None): """ Convenience method allowing easy dumping to and loading from json. """ if json_string is not None: return self.__init__(loads(json_string)) dump = self if isinstance(self, HAR.log): dump = {"log": dump} ...
[ "def", "json", "(", "self", ",", "json_string", "=", "None", ")", ":", "if", "json_string", "is", "not", "None", ":", "return", "self", ".", "__init__", "(", "loads", "(", "json_string", ")", ")", "dump", "=", "self", "if", "isinstance", "(", "self", ...
Convenience method allowing easy dumping to and loading from json.
[ "Convenience", "method", "allowing", "easy", "dumping", "to", "and", "loading", "from", "json", "." ]
89f06b9e556ecfbab5202551fdcb13f1e1c69cfc
https://github.com/JustusW/harparser/blob/89f06b9e556ecfbab5202551fdcb13f1e1c69cfc/harparser.py#L97-L106
48,555
open-homeautomation/pknx
knxip/gatewayscanner.py
GatewayScanner.start_search
def start_search(self): """ Start the Gateway Search Request and return the address information :rtype: (string,int) :return: a tuple(string(IP),int(Port) when found or None when timeout occurs """ self._asyncio_loop = asyncio.get_event_loop() # Cre...
python
def start_search(self): """ Start the Gateway Search Request and return the address information :rtype: (string,int) :return: a tuple(string(IP),int(Port) when found or None when timeout occurs """ self._asyncio_loop = asyncio.get_event_loop() # Cre...
[ "def", "start_search", "(", "self", ")", ":", "self", ".", "_asyncio_loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "# Creating Broadcast Receiver", "coroutine_listen", "=", "self", ".", "_asyncio_loop", ".", "create_datagram_endpoint", "(", "lambda", ":", ...
Start the Gateway Search Request and return the address information :rtype: (string,int) :return: a tuple(string(IP),int(Port) when found or None when timeout occurs
[ "Start", "the", "Gateway", "Search", "Request", "and", "return", "the", "address", "information" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/gatewayscanner.py#L69-L116
48,556
open-homeautomation/pknx
knxip/gatewayscanner.py
GatewayScanner._process_response
def _process_response(self, received_data): """ Processing the incoming UDP Datagram from the Broadcast Socket :param received_data: UDP Datagram Package to Process :type received_data: Byte """ resp = bytearray(received_data) self._resolved_gateway_ip_address = ...
python
def _process_response(self, received_data): """ Processing the incoming UDP Datagram from the Broadcast Socket :param received_data: UDP Datagram Package to Process :type received_data: Byte """ resp = bytearray(received_data) self._resolved_gateway_ip_address = ...
[ "def", "_process_response", "(", "self", ",", "received_data", ")", ":", "resp", "=", "bytearray", "(", "received_data", ")", "self", ".", "_resolved_gateway_ip_address", "=", "str", ".", "format", "(", "\"{}.{}.{}.{}\"", ",", "resp", "[", "8", "]", ",", "re...
Processing the incoming UDP Datagram from the Broadcast Socket :param received_data: UDP Datagram Package to Process :type received_data: Byte
[ "Processing", "the", "incoming", "UDP", "Datagram", "from", "the", "Broadcast", "Socket" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/gatewayscanner.py#L126-L137
48,557
juicer/juicer
juicer/utils/Upload.py
Upload.append
def append(self, fdata, offset, query='/content/uploads'): """ append binary data to an upload `fdata` - binary data to send to pulp `offset` - the amount of previously-uploaded data """ query = '%s/%s/%s/' % (query, self.uid, offset) _r = self.connector.put(query...
python
def append(self, fdata, offset, query='/content/uploads'): """ append binary data to an upload `fdata` - binary data to send to pulp `offset` - the amount of previously-uploaded data """ query = '%s/%s/%s/' % (query, self.uid, offset) _r = self.connector.put(query...
[ "def", "append", "(", "self", ",", "fdata", ",", "offset", ",", "query", "=", "'/content/uploads'", ")", ":", "query", "=", "'%s/%s/%s/'", "%", "(", "query", ",", "self", ".", "uid", ",", "offset", ")", "_r", "=", "self", ".", "connector", ".", "put"...
append binary data to an upload `fdata` - binary data to send to pulp `offset` - the amount of previously-uploaded data
[ "append", "binary", "data", "to", "an", "upload", "fdata", "-", "binary", "data", "to", "send", "to", "pulp", "offset", "-", "the", "amount", "of", "previously", "-", "uploaded", "data" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Upload.py#L47-L59
48,558
juicer/juicer
juicer/utils/Upload.py
Upload.import_upload
def import_upload(self, nvrea, ftype='rpm', rpm_name='', desc=None, htype='md5', lic=None, group=None, vendor=None, req=None): """ import the completed upload into pulp `ftype` - the type of the upload `rpm_name` - the name of the uploaded rpm `desc` - description of the rpm ...
python
def import_upload(self, nvrea, ftype='rpm', rpm_name='', desc=None, htype='md5', lic=None, group=None, vendor=None, req=None): """ import the completed upload into pulp `ftype` - the type of the upload `rpm_name` - the name of the uploaded rpm `desc` - description of the rpm ...
[ "def", "import_upload", "(", "self", ",", "nvrea", ",", "ftype", "=", "'rpm'", ",", "rpm_name", "=", "''", ",", "desc", "=", "None", ",", "htype", "=", "'md5'", ",", "lic", "=", "None", ",", "group", "=", "None", ",", "vendor", "=", "None", ",", ...
import the completed upload into pulp `ftype` - the type of the upload `rpm_name` - the name of the uploaded rpm `desc` - description of the rpm `htype` - checksum type `lic` - license used in the packaged software `group` - package group `vendor` - software vendo...
[ "import", "the", "completed", "upload", "into", "pulp", "ftype", "-", "the", "type", "of", "the", "upload", "rpm_name", "-", "the", "name", "of", "the", "uploaded", "rpm", "desc", "-", "description", "of", "the", "rpm", "htype", "-", "checksum", "type", ...
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Upload.py#L61-L104
48,559
juicer/juicer
juicer/utils/Upload.py
Upload.clean_upload
def clean_upload(self, query='/content/uploads/'): """ pulp leaves droppings if you don't specifically tell it to clean up after itself. use this to do so. """ query = query + self.uid + '/' _r = self.connector.delete(query) if _r.status_code == Constants.PULP_DE...
python
def clean_upload(self, query='/content/uploads/'): """ pulp leaves droppings if you don't specifically tell it to clean up after itself. use this to do so. """ query = query + self.uid + '/' _r = self.connector.delete(query) if _r.status_code == Constants.PULP_DE...
[ "def", "clean_upload", "(", "self", ",", "query", "=", "'/content/uploads/'", ")", ":", "query", "=", "query", "+", "self", ".", "uid", "+", "'/'", "_r", "=", "self", ".", "connector", ".", "delete", "(", "query", ")", "if", "_r", ".", "status_code", ...
pulp leaves droppings if you don't specifically tell it to clean up after itself. use this to do so.
[ "pulp", "leaves", "droppings", "if", "you", "don", "t", "specifically", "tell", "it", "to", "clean", "up", "after", "itself", ".", "use", "this", "to", "do", "so", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/Upload.py#L106-L117
48,560
juicer/juicer
juicer/utils/__init__.py
_user_config_file
def _user_config_file(): """ Check that the config file is present and readable. If not, copy a template in place. """ config_file = Constants.USER_CONFIG if os.path.exists(config_file) and os.access(config_file, os.R_OK): return config_file elif os.path.exists(config_file) and not o...
python
def _user_config_file(): """ Check that the config file is present and readable. If not, copy a template in place. """ config_file = Constants.USER_CONFIG if os.path.exists(config_file) and os.access(config_file, os.R_OK): return config_file elif os.path.exists(config_file) and not o...
[ "def", "_user_config_file", "(", ")", ":", "config_file", "=", "Constants", ".", "USER_CONFIG", "if", "os", ".", "path", ".", "exists", "(", "config_file", ")", "and", "os", ".", "access", "(", "config_file", ",", "os", ".", "R_OK", ")", ":", "return", ...
Check that the config file is present and readable. If not, copy a template in place.
[ "Check", "that", "the", "config", "file", "is", "present", "and", "readable", ".", "If", "not", "copy", "a", "template", "in", "place", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L70-L83
48,561
juicer/juicer
juicer/utils/__init__.py
cart_db
def cart_db(): """ return a pymongo db connection for interacting with cart objects """ config = _config_file() _config_test(config) juicer.utils.Log.log_debug("Establishing cart connection:") cart_con = MongoClient(dict(config.items(config.sections()[0]))['cart_host']) cart_db = cart_c...
python
def cart_db(): """ return a pymongo db connection for interacting with cart objects """ config = _config_file() _config_test(config) juicer.utils.Log.log_debug("Establishing cart connection:") cart_con = MongoClient(dict(config.items(config.sections()[0]))['cart_host']) cart_db = cart_c...
[ "def", "cart_db", "(", ")", ":", "config", "=", "_config_file", "(", ")", "_config_test", "(", "config", ")", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Establishing cart connection:\"", ")", "cart_con", "=", "MongoClient", "(", "dict", "(...
return a pymongo db connection for interacting with cart objects
[ "return", "a", "pymongo", "db", "connection", "for", "interacting", "with", "cart", "objects" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L123-L134
48,562
juicer/juicer
juicer/utils/__init__.py
upload_cart
def upload_cart(cart, collection): """ Connect to mongo and store your cart in the specified collection. """ cart_cols = cart_db() cart_json = read_json_document(cart.cart_file()) try: cart_id = cart_cols[collection].save(cart_json) except MongoErrors.AutoReconnect: raise Ju...
python
def upload_cart(cart, collection): """ Connect to mongo and store your cart in the specified collection. """ cart_cols = cart_db() cart_json = read_json_document(cart.cart_file()) try: cart_id = cart_cols[collection].save(cart_json) except MongoErrors.AutoReconnect: raise Ju...
[ "def", "upload_cart", "(", "cart", ",", "collection", ")", ":", "cart_cols", "=", "cart_db", "(", ")", "cart_json", "=", "read_json_document", "(", "cart", ".", "cart_file", "(", ")", ")", "try", ":", "cart_id", "=", "cart_cols", "[", "collection", "]", ...
Connect to mongo and store your cart in the specified collection.
[ "Connect", "to", "mongo", "and", "store", "your", "cart", "in", "the", "specified", "collection", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L137-L148
48,563
juicer/juicer
juicer/utils/__init__.py
get_login_info
def get_login_info(): """ Give back an array of dicts with the connection information for all the environments. """ connections = {} _defaults = {} _defaults['start_in'] = '' _defaults['rpm_sign_plugin'] = '' config = _config_file() _config_test(config) juicer.utils.Log.lo...
python
def get_login_info(): """ Give back an array of dicts with the connection information for all the environments. """ connections = {} _defaults = {} _defaults['start_in'] = '' _defaults['rpm_sign_plugin'] = '' config = _config_file() _config_test(config) juicer.utils.Log.lo...
[ "def", "get_login_info", "(", ")", ":", "connections", "=", "{", "}", "_defaults", "=", "{", "}", "_defaults", "[", "'start_in'", "]", "=", "''", "_defaults", "[", "'rpm_sign_plugin'", "]", "=", "''", "config", "=", "_config_file", "(", ")", "_config_test"...
Give back an array of dicts with the connection information for all the environments.
[ "Give", "back", "an", "array", "of", "dicts", "with", "the", "connection", "information", "for", "all", "the", "environments", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L151-L184
48,564
juicer/juicer
juicer/utils/__init__.py
get_environments
def get_environments(): """ Return defined environments from config file for default environment values. """ config = ConfigParser.SafeConfigParser() config = _config_file() juicer.utils.Log.log_debug("Reading environment sections:") environments = config.sections() juicer.utils.L...
python
def get_environments(): """ Return defined environments from config file for default environment values. """ config = ConfigParser.SafeConfigParser() config = _config_file() juicer.utils.Log.log_debug("Reading environment sections:") environments = config.sections() juicer.utils.L...
[ "def", "get_environments", "(", ")", ":", "config", "=", "ConfigParser", ".", "SafeConfigParser", "(", ")", "config", "=", "_config_file", "(", ")", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Reading environment sections:\"", ")", "environment...
Return defined environments from config file for default environment values.
[ "Return", "defined", "environments", "from", "config", "file", "for", "default", "environment", "values", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L187-L200
48,565
juicer/juicer
juicer/utils/__init__.py
env_same_host
def env_same_host(env1, env2): """ determine if two environments are on the same host. returns true or false """ config = _config_file() h1 = dict(config.items(env1))['base_url'] h2 = dict(config.items(env2))['base_url'] return h1 == h2
python
def env_same_host(env1, env2): """ determine if two environments are on the same host. returns true or false """ config = _config_file() h1 = dict(config.items(env1))['base_url'] h2 = dict(config.items(env2))['base_url'] return h1 == h2
[ "def", "env_same_host", "(", "env1", ",", "env2", ")", ":", "config", "=", "_config_file", "(", ")", "h1", "=", "dict", "(", "config", ".", "items", "(", "env1", ")", ")", "[", "'base_url'", "]", "h2", "=", "dict", "(", "config", ".", "items", "(",...
determine if two environments are on the same host. returns true or false
[ "determine", "if", "two", "environments", "are", "on", "the", "same", "host", ".", "returns", "true", "or", "false" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L203-L213
48,566
juicer/juicer
juicer/utils/__init__.py
get_next_environment
def get_next_environment(env): """ Given an environment, return the next environment in the promotion hierarchy """ config = _config_file() juicer.utils.Log.log_debug("Finding next environment...") if env not in config.sections(): raise JuicerConfigError("%s is not a server configu...
python
def get_next_environment(env): """ Given an environment, return the next environment in the promotion hierarchy """ config = _config_file() juicer.utils.Log.log_debug("Finding next environment...") if env not in config.sections(): raise JuicerConfigError("%s is not a server configu...
[ "def", "get_next_environment", "(", "env", ")", ":", "config", "=", "_config_file", "(", ")", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Finding next environment...\"", ")", "if", "env", "not", "in", "config", ".", "sections", "(", ")", ...
Given an environment, return the next environment in the promotion hierarchy
[ "Given", "an", "environment", "return", "the", "next", "environment", "in", "the", "promotion", "hierarchy" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L216-L234
48,567
juicer/juicer
juicer/utils/__init__.py
pulp_repo_path
def pulp_repo_path(connection, repoid): """ Given a connection and a repoid, return the url of the repository """ dl_base = connection.base_url.replace('/pulp/api/v2', '/pulp/repos') _m = re.match('(.*)-(.*)', repoid) repo = _m.group(1) env = _m.group(2) return "%s/%s/%s" % (dl_base, en...
python
def pulp_repo_path(connection, repoid): """ Given a connection and a repoid, return the url of the repository """ dl_base = connection.base_url.replace('/pulp/api/v2', '/pulp/repos') _m = re.match('(.*)-(.*)', repoid) repo = _m.group(1) env = _m.group(2) return "%s/%s/%s" % (dl_base, en...
[ "def", "pulp_repo_path", "(", "connection", ",", "repoid", ")", ":", "dl_base", "=", "connection", ".", "base_url", ".", "replace", "(", "'/pulp/api/v2'", ",", "'/pulp/repos'", ")", "_m", "=", "re", ".", "match", "(", "'(.*)-(.*)'", ",", "repoid", ")", "re...
Given a connection and a repoid, return the url of the repository
[ "Given", "a", "connection", "and", "a", "repoid", "return", "the", "url", "of", "the", "repository" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L237-L246
48,568
juicer/juicer
juicer/utils/__init__.py
user_exists_p
def user_exists_p(login, connector): """ Determine if user exists in specified environment. """ url = '/users/' + login + '/' _r = connector.get(url) return (_r.status_code == Constants.PULP_GET_OK)
python
def user_exists_p(login, connector): """ Determine if user exists in specified environment. """ url = '/users/' + login + '/' _r = connector.get(url) return (_r.status_code == Constants.PULP_GET_OK)
[ "def", "user_exists_p", "(", "login", ",", "connector", ")", ":", "url", "=", "'/users/'", "+", "login", "+", "'/'", "_r", "=", "connector", ".", "get", "(", "url", ")", "return", "(", "_r", ".", "status_code", "==", "Constants", ".", "PULP_GET_OK", ")...
Determine if user exists in specified environment.
[ "Determine", "if", "user", "exists", "in", "specified", "environment", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L249-L255
48,569
juicer/juicer
juicer/utils/__init__.py
flatten
def flatten(x): """ Flatten an arbitrary depth nested list. """ # Lifted from: http://stackoverflow.com/a/406822/263969 result = [] for el in x: if hasattr(el, "__iter__") and not isinstance(el, basestring): result.extend(flatten(el)) else: result.append(e...
python
def flatten(x): """ Flatten an arbitrary depth nested list. """ # Lifted from: http://stackoverflow.com/a/406822/263969 result = [] for el in x: if hasattr(el, "__iter__") and not isinstance(el, basestring): result.extend(flatten(el)) else: result.append(e...
[ "def", "flatten", "(", "x", ")", ":", "# Lifted from: http://stackoverflow.com/a/406822/263969", "result", "=", "[", "]", "for", "el", "in", "x", ":", "if", "hasattr", "(", "el", ",", "\"__iter__\"", ")", "and", "not", "isinstance", "(", "el", ",", "basestri...
Flatten an arbitrary depth nested list.
[ "Flatten", "an", "arbitrary", "depth", "nested", "list", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L270-L281
48,570
juicer/juicer
juicer/utils/__init__.py
write_json_document
def write_json_document(title, body): """ `title` - Name of the file to write. `body` - Python datastructure representing the document. This method handles transforming the body into a proper json string, and then writing the file to disk. """ if not title.endswith('.json'): title +...
python
def write_json_document(title, body): """ `title` - Name of the file to write. `body` - Python datastructure representing the document. This method handles transforming the body into a proper json string, and then writing the file to disk. """ if not title.endswith('.json'): title +...
[ "def", "write_json_document", "(", "title", ",", "body", ")", ":", "if", "not", "title", ".", "endswith", "(", "'.json'", ")", ":", "title", "+=", "'.json'", "json_body", "=", "create_json_str", "(", "body", ")", "if", "os", ".", "path", ".", "exists", ...
`title` - Name of the file to write. `body` - Python datastructure representing the document. This method handles transforming the body into a proper json string, and then writing the file to disk.
[ "title", "-", "Name", "of", "the", "file", "to", "write", ".", "body", "-", "Python", "datastructure", "representing", "the", "document", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L289-L308
48,571
juicer/juicer
juicer/utils/__init__.py
read_json_document
def read_json_document(title): """ Reads in a json document and returns a native python datastructure. """ if not title.endswith('.json'): juicer.utils.Log.log_warn("File name (%s) does not end with '.json', appending it automatically." % title) title += '.json' if not os.path.e...
python
def read_json_document(title): """ Reads in a json document and returns a native python datastructure. """ if not title.endswith('.json'): juicer.utils.Log.log_warn("File name (%s) does not end with '.json', appending it automatically." % title) title += '.json' if not os.path.e...
[ "def", "read_json_document", "(", "title", ")", ":", "if", "not", "title", ".", "endswith", "(", "'.json'", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_warn", "(", "\"File name (%s) does not end with '.json', appending it automatically.\"", "%", "title",...
Reads in a json document and returns a native python datastructure.
[ "Reads", "in", "a", "json", "document", "and", "returns", "a", "native", "python", "datastructure", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L311-L327
48,572
juicer/juicer
juicer/utils/__init__.py
find_pattern
def find_pattern(search_base, pattern='*.rpm'): """ `search_base` - The directory to begin walking down. `pattern` - File pattern to match for. This is a generator which yields the full path to files (one at a time) which match the given glob (`pattern`). """ # Stolen from http://rosettacod...
python
def find_pattern(search_base, pattern='*.rpm'): """ `search_base` - The directory to begin walking down. `pattern` - File pattern to match for. This is a generator which yields the full path to files (one at a time) which match the given glob (`pattern`). """ # Stolen from http://rosettacod...
[ "def", "find_pattern", "(", "search_base", ",", "pattern", "=", "'*.rpm'", ")", ":", "# Stolen from http://rosettacode.org/wiki/Walk_a_directory/Recursively#Python", "if", "(", "not", "os", ".", "path", ".", "isdir", "(", "search_base", ")", ")", "and", "os", ".", ...
`search_base` - The directory to begin walking down. `pattern` - File pattern to match for. This is a generator which yields the full path to files (one at a time) which match the given glob (`pattern`).
[ "search_base", "-", "The", "directory", "to", "begin", "walking", "down", ".", "pattern", "-", "File", "pattern", "to", "match", "for", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L337-L352
48,573
juicer/juicer
juicer/utils/__init__.py
filter_package_list
def filter_package_list(package_list): """ Filter a list of packages into local and remotes. """ remote_pkgs = [] local_pkgs = [] possible_remotes = filter(lambda i: not os.path.exists(i), package_list) juicer.utils.Log.log_debug("Considering %s possible remotes" % len(possible_remotes)) ...
python
def filter_package_list(package_list): """ Filter a list of packages into local and remotes. """ remote_pkgs = [] local_pkgs = [] possible_remotes = filter(lambda i: not os.path.exists(i), package_list) juicer.utils.Log.log_debug("Considering %s possible remotes" % len(possible_remotes)) ...
[ "def", "filter_package_list", "(", "package_list", ")", ":", "remote_pkgs", "=", "[", "]", "local_pkgs", "=", "[", "]", "possible_remotes", "=", "filter", "(", "lambda", "i", ":", "not", "os", ".", "path", ".", "exists", "(", "i", ")", ",", "package_list...
Filter a list of packages into local and remotes.
[ "Filter", "a", "list", "of", "packages", "into", "local", "and", "remotes", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L355-L379
48,574
juicer/juicer
juicer/utils/__init__.py
mute
def mute(returns_output=False): """ `returns_output` - Returns all print output in a list. Capture or ignore all print output generated by a function. Usage: output = mute(returns_output=True)(module.my_func)(args) """ def decorator(func): @wraps(func) def wrapper(*args, ...
python
def mute(returns_output=False): """ `returns_output` - Returns all print output in a list. Capture or ignore all print output generated by a function. Usage: output = mute(returns_output=True)(module.my_func)(args) """ def decorator(func): @wraps(func) def wrapper(*args, ...
[ "def", "mute", "(", "returns_output", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "saved_stdout", "=", "sys", ".", "stdout...
`returns_output` - Returns all print output in a list. Capture or ignore all print output generated by a function. Usage: output = mute(returns_output=True)(module.my_func)(args)
[ "returns_output", "-", "Returns", "all", "print", "output", "in", "a", "list", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L382-L406
48,575
juicer/juicer
juicer/utils/__init__.py
save_url_as
def save_url_as(url, save_as): """ Download the file `url` and save it to the local disk as `save_as`. """ remote = requests.get(url, verify=False) if not remote.status_code == Constants.PULP_GET_OK: raise JuicerPulpError("A %s error occurred trying to get %s" % ...
python
def save_url_as(url, save_as): """ Download the file `url` and save it to the local disk as `save_as`. """ remote = requests.get(url, verify=False) if not remote.status_code == Constants.PULP_GET_OK: raise JuicerPulpError("A %s error occurred trying to get %s" % ...
[ "def", "save_url_as", "(", "url", ",", "save_as", ")", ":", "remote", "=", "requests", ".", "get", "(", "url", ",", "verify", "=", "False", ")", "if", "not", "remote", ".", "status_code", "==", "Constants", ".", "PULP_GET_OK", ":", "raise", "JuicerPulpEr...
Download the file `url` and save it to the local disk as `save_as`.
[ "Download", "the", "file", "url", "and", "save", "it", "to", "the", "local", "disk", "as", "save_as", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L436-L449
48,576
juicer/juicer
juicer/utils/__init__.py
remote_url
def remote_url(connector, env, repo, filename): """ return a str containing a link to the rpm in the pulp repository """ dl_base = connector.base_url.replace('/pulp/api/v2', '/pulp/repos') repoid = '%s-%s' % (repo, env) _r = connector.get('/repositories/%s/' % repoid) if not _r.status_code...
python
def remote_url(connector, env, repo, filename): """ return a str containing a link to the rpm in the pulp repository """ dl_base = connector.base_url.replace('/pulp/api/v2', '/pulp/repos') repoid = '%s-%s' % (repo, env) _r = connector.get('/repositories/%s/' % repoid) if not _r.status_code...
[ "def", "remote_url", "(", "connector", ",", "env", ",", "repo", ",", "filename", ")", ":", "dl_base", "=", "connector", ".", "base_url", ".", "replace", "(", "'/pulp/api/v2'", ",", "'/pulp/repos'", ")", "repoid", "=", "'%s-%s'", "%", "(", "repo", ",", "e...
return a str containing a link to the rpm in the pulp repository
[ "return", "a", "str", "containing", "a", "link", "to", "the", "rpm", "in", "the", "pulp", "repository" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L452-L472
48,577
juicer/juicer
juicer/utils/__init__.py
return_hdr
def return_hdr(ts, package): """ Hand back the hdr - duh - if the pkg is foobar handback None Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ try: fdno = os.open(package, os.O_RDONLY) except OSError: hdr = None return hdr t...
python
def return_hdr(ts, package): """ Hand back the hdr - duh - if the pkg is foobar handback None Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ try: fdno = os.open(package, os.O_RDONLY) except OSError: hdr = None return hdr t...
[ "def", "return_hdr", "(", "ts", ",", "package", ")", ":", "try", ":", "fdno", "=", "os", ".", "open", "(", "package", ",", "os", ".", "O_RDONLY", ")", "except", "OSError", ":", "hdr", "=", "None", "return", "hdr", "ts", ".", "setVSFlags", "(", "~",...
Hand back the hdr - duh - if the pkg is foobar handback None Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py
[ "Hand", "back", "the", "hdr", "-", "duh", "-", "if", "the", "pkg", "is", "foobar", "handback", "None" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L482-L504
48,578
juicer/juicer
juicer/utils/__init__.py
get_sig_info
def get_sig_info(hdr): """ hand back signature information and an error code Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ string = '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pg...
python
def get_sig_info(hdr): """ hand back signature information and an error code Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ string = '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pg...
[ "def", "get_sig_info", "(", "hdr", ")", ":", "string", "=", "'%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|'", "siginfo", "=", "hdr", ".", "sprintf", "(", "string", ")", "if", "siginf...
hand back signature information and an error code Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py
[ "hand", "back", "signature", "information", "and", "an", "error", "code" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L507-L526
48,579
juicer/juicer
juicer/utils/__init__.py
check_sig
def check_sig(package): """ check if rpm has a signature, we don't care if it's valid or not at the moment Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ rpmroot = '/' ts = rpm.TransactionSet(rpmroot) sigerror = 0 ts.setVSFlags(0) h...
python
def check_sig(package): """ check if rpm has a signature, we don't care if it's valid or not at the moment Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py """ rpmroot = '/' ts = rpm.TransactionSet(rpmroot) sigerror = 0 ts.setVSFlags(0) h...
[ "def", "check_sig", "(", "package", ")", ":", "rpmroot", "=", "'/'", "ts", "=", "rpm", ".", "TransactionSet", "(", "rpmroot", ")", "sigerror", "=", "0", "ts", ".", "setVSFlags", "(", "0", ")", "hdr", "=", "return_hdr", "(", "ts", ",", "package", ")",...
check if rpm has a signature, we don't care if it's valid or not at the moment Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py
[ "check", "if", "rpm", "has", "a", "signature", "we", "don", "t", "care", "if", "it", "s", "valid", "or", "not", "at", "the", "moment" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L529-L552
48,580
juicer/juicer
juicer/utils/__init__.py
rpm_info
def rpm_info(rpm_path): """ Query information about the RPM at `rpm_path`. """ ts = rpm.TransactionSet() ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) rpm_info = {} rpm_fd = open(rpm_path, 'rb') pkg = ts.hdrFromFdno(rpm_fd) rpm_info['name'] = pkg['name'] rpm_info['version'] = pkg['ve...
python
def rpm_info(rpm_path): """ Query information about the RPM at `rpm_path`. """ ts = rpm.TransactionSet() ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) rpm_info = {} rpm_fd = open(rpm_path, 'rb') pkg = ts.hdrFromFdno(rpm_fd) rpm_info['name'] = pkg['name'] rpm_info['version'] = pkg['ve...
[ "def", "rpm_info", "(", "rpm_path", ")", ":", "ts", "=", "rpm", ".", "TransactionSet", "(", ")", "ts", ".", "setVSFlags", "(", "rpm", ".", "_RPMVSF_NOSIGNATURES", ")", "rpm_info", "=", "{", "}", "rpm_fd", "=", "open", "(", "rpm_path", ",", "'rb'", ")",...
Query information about the RPM at `rpm_path`.
[ "Query", "information", "about", "the", "RPM", "at", "rpm_path", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L598-L619
48,581
juicer/juicer
juicer/utils/__init__.py
upload_rpm
def upload_rpm(rpm_path, repoid, connector, callback=None): """upload an rpm into pulp rpm_path: path to an rpm connector: the connector to use for interacting with pulp callback: Optional callback to call after an RPM is uploaded. Callback should accept one argument, the name of the RPM which...
python
def upload_rpm(rpm_path, repoid, connector, callback=None): """upload an rpm into pulp rpm_path: path to an rpm connector: the connector to use for interacting with pulp callback: Optional callback to call after an RPM is uploaded. Callback should accept one argument, the name of the RPM which...
[ "def", "upload_rpm", "(", "rpm_path", ",", "repoid", ",", "connector", ",", "callback", "=", "None", ")", ":", "ts", "=", "rpm", ".", "TransactionSet", "(", ")", "ts", ".", "setVSFlags", "(", "rpm", ".", "_RPMVSF_NOSIGNATURES", ")", "info", "=", "rpm_inf...
upload an rpm into pulp rpm_path: path to an rpm connector: the connector to use for interacting with pulp callback: Optional callback to call after an RPM is uploaded. Callback should accept one argument, the name of the RPM which was uploaded
[ "upload", "an", "rpm", "into", "pulp" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L622-L685
48,582
juicer/juicer
juicer/utils/__init__.py
download_cart
def download_cart(cart_name, env): """ accesses mongodb and return a cart spec stored there """ cart_con = cart_db() carts = cart_con[env] return carts.find_one({'_id': cart_name})
python
def download_cart(cart_name, env): """ accesses mongodb and return a cart spec stored there """ cart_con = cart_db() carts = cart_con[env] return carts.find_one({'_id': cart_name})
[ "def", "download_cart", "(", "cart_name", ",", "env", ")", ":", "cart_con", "=", "cart_db", "(", ")", "carts", "=", "cart_con", "[", "env", "]", "return", "carts", ".", "find_one", "(", "{", "'_id'", ":", "cart_name", "}", ")" ]
accesses mongodb and return a cart spec stored there
[ "accesses", "mongodb", "and", "return", "a", "cart", "spec", "stored", "there" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L688-L695
48,583
juicer/juicer
juicer/utils/__init__.py
get_cart
def get_cart(base_url, env, cart_name): """ returns a dict object representing a cart stored in pulp base_url: a str for the base_url (eg: http://sweet.pulp.repo/pulp/api/) env: a str with the the name of the environement (eg: prod) cart_name: a str with the name of the cart to get """ base...
python
def get_cart(base_url, env, cart_name): """ returns a dict object representing a cart stored in pulp base_url: a str for the base_url (eg: http://sweet.pulp.repo/pulp/api/) env: a str with the the name of the environement (eg: prod) cart_name: a str with the name of the cart to get """ base...
[ "def", "get_cart", "(", "base_url", ",", "env", ",", "cart_name", ")", ":", "base_url", "=", "base_url", ".", "replace", "(", "'/pulp/api/'", ",", "'/pulp/repos'", ")", "url", "=", "'%s/%s/carts/%s.json'", "%", "(", "base_url", ",", "env", ",", "cart_name", ...
returns a dict object representing a cart stored in pulp base_url: a str for the base_url (eg: http://sweet.pulp.repo/pulp/api/) env: a str with the the name of the environement (eg: prod) cart_name: a str with the name of the cart to get
[ "returns", "a", "dict", "object", "representing", "a", "cart", "stored", "in", "pulp" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L698-L713
48,584
juicer/juicer
juicer/utils/__init__.py
search_carts
def search_carts(env, pkg_name, repos): """ returns a list of carts containing a package with the specified name env: the name of an environment from the juicer config pkg_name: the name of the package for which to search repos: a list of repos in which to search for the package """ db = ca...
python
def search_carts(env, pkg_name, repos): """ returns a list of carts containing a package with the specified name env: the name of an environment from the juicer config pkg_name: the name of the package for which to search repos: a list of repos in which to search for the package """ db = ca...
[ "def", "search_carts", "(", "env", ",", "pkg_name", ",", "repos", ")", ":", "db", "=", "cart_db", "(", ")", "carts", "=", "db", "[", "env", "]", "for", "repo", "in", "repos", ":", "field", "=", "'repos_items.%s'", "%", "repo", "value", "=", "'.*%s.*'...
returns a list of carts containing a package with the specified name env: the name of an environment from the juicer config pkg_name: the name of the package for which to search repos: a list of repos in which to search for the package
[ "returns", "a", "list", "of", "carts", "containing", "a", "package", "with", "the", "specified", "name" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L716-L735
48,585
juicer/juicer
juicer/utils/__init__.py
header
def header(msg): """ Wrap `msg` in bars to create a header effect """ # Accounting for '| ' and ' |' width = len(msg) + 4 s = [] s.append('-' * width) s.append("| %s |" % msg) s.append('-' * width) return '\n'.join(s)
python
def header(msg): """ Wrap `msg` in bars to create a header effect """ # Accounting for '| ' and ' |' width = len(msg) + 4 s = [] s.append('-' * width) s.append("| %s |" % msg) s.append('-' * width) return '\n'.join(s)
[ "def", "header", "(", "msg", ")", ":", "# Accounting for '| ' and ' |'", "width", "=", "len", "(", "msg", ")", "+", "4", "s", "=", "[", "]", "s", ".", "append", "(", "'-'", "*", "width", ")", "s", ".", "append", "(", "\"| %s |\"", "%", "msg", ")", ...
Wrap `msg` in bars to create a header effect
[ "Wrap", "msg", "in", "bars", "to", "create", "a", "header", "effect" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L787-L797
48,586
juicer/juicer
juicer/utils/__init__.py
repo_in_defined_envs
def repo_in_defined_envs(repo, all_envs): """Raises exception if the repo references undefined environments""" remaining_envs = set(repo['env']) - set(all_envs) if set(repo['env']) - set(all_envs): raise JuicerRepoInUndefinedEnvs("Repo def %s references undefined environments: %s" % ...
python
def repo_in_defined_envs(repo, all_envs): """Raises exception if the repo references undefined environments""" remaining_envs = set(repo['env']) - set(all_envs) if set(repo['env']) - set(all_envs): raise JuicerRepoInUndefinedEnvs("Repo def %s references undefined environments: %s" % ...
[ "def", "repo_in_defined_envs", "(", "repo", ",", "all_envs", ")", ":", "remaining_envs", "=", "set", "(", "repo", "[", "'env'", "]", ")", "-", "set", "(", "all_envs", ")", "if", "set", "(", "repo", "[", "'env'", "]", ")", "-", "set", "(", "all_envs",...
Raises exception if the repo references undefined environments
[ "Raises", "exception", "if", "the", "repo", "references", "undefined", "environments" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L827-L834
48,587
juicer/juicer
juicer/utils/__init__.py
repo_def_matches_reality
def repo_def_matches_reality(juicer_def, pulp_def): """Compare a juicer repo def with a given pulp definition. Compute and return the update necessary to make `pulp_def` match `juicer_def`. `juicer_def` - A JuicerRepo() object representing a juicer repository `pulp_def` - A PulpRepo() object representi...
python
def repo_def_matches_reality(juicer_def, pulp_def): """Compare a juicer repo def with a given pulp definition. Compute and return the update necessary to make `pulp_def` match `juicer_def`. `juicer_def` - A JuicerRepo() object representing a juicer repository `pulp_def` - A PulpRepo() object representi...
[ "def", "repo_def_matches_reality", "(", "juicer_def", ",", "pulp_def", ")", ":", "return", "juicer", ".", "common", ".", "Repo", ".", "RepoDiff", "(", "juicer_repo", "=", "juicer_def", ",", "pulp_repo", "=", "pulp_def", ")" ]
Compare a juicer repo def with a given pulp definition. Compute and return the update necessary to make `pulp_def` match `juicer_def`. `juicer_def` - A JuicerRepo() object representing a juicer repository `pulp_def` - A PulpRepo() object representing a pulp repository
[ "Compare", "a", "juicer", "repo", "def", "with", "a", "given", "pulp", "definition", ".", "Compute", "and", "return", "the", "update", "necessary", "to", "make", "pulp_def", "match", "juicer_def", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L837-L844
48,588
juicer/juicer
juicer/utils/__init__.py
chunk_list
def chunk_list(l, n): """Return `n` size lists from a given list `l`""" return [l[i:i + n] for i in range(0, len(l), n)]
python
def chunk_list(l, n): """Return `n` size lists from a given list `l`""" return [l[i:i + n] for i in range(0, len(l), n)]
[ "def", "chunk_list", "(", "l", ",", "n", ")", ":", "return", "[", "l", "[", "i", ":", "i", "+", "n", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "l", ")", ",", "n", ")", "]" ]
Return `n` size lists from a given list `l`
[ "Return", "n", "size", "lists", "from", "a", "given", "list", "l" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/__init__.py#L856-L858
48,589
pandemicsyn/statsdpy
statsdpy/daemonutils.py
readconf
def readconf(conffile, section_name=None, log_name=None, defaults=None, raw=False): """ Read config file and return config items as a dict :param conffile: path to config file, or a file-like object (hasattr readline) :param section_name: config section to read (will r...
python
def readconf(conffile, section_name=None, log_name=None, defaults=None, raw=False): """ Read config file and return config items as a dict :param conffile: path to config file, or a file-like object (hasattr readline) :param section_name: config section to read (will r...
[ "def", "readconf", "(", "conffile", ",", "section_name", "=", "None", ",", "log_name", "=", "None", ",", "defaults", "=", "None", ",", "raw", "=", "False", ")", ":", "if", "defaults", "is", "None", ":", "defaults", "=", "{", "}", "if", "raw", ":", ...
Read config file and return config items as a dict :param conffile: path to config file, or a file-like object (hasattr readline) :param section_name: config section to read (will return all sections if not defined) :param log_name: name to be used with logging (wi...
[ "Read", "config", "file", "and", "return", "config", "items", "as", "a", "dict" ]
9cfccf89121fd6a12df20f17fa3eb8f618a36455
https://github.com/pandemicsyn/statsdpy/blob/9cfccf89121fd6a12df20f17fa3eb8f618a36455/statsdpy/daemonutils.py#L12-L57
48,590
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
group_factory
def group_factory(bridge, number, name, led_type): """ Make a group. :param bridge: Member of this bridge. :param number: Group number (1-4). :param name: Name of group. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: New group. """ if led_t...
python
def group_factory(bridge, number, name, led_type): """ Make a group. :param bridge: Member of this bridge. :param number: Group number (1-4). :param name: Name of group. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: New group. """ if led_t...
[ "def", "group_factory", "(", "bridge", ",", "number", ",", "name", ",", "led_type", ")", ":", "if", "led_type", "in", "[", "RGBW", ",", "BRIDGE_LED", "]", ":", "return", "RgbwGroup", "(", "bridge", ",", "number", ",", "name", ",", "led_type", ")", "eli...
Make a group. :param bridge: Member of this bridge. :param number: Group number (1-4). :param name: Name of group. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: New group.
[ "Make", "a", "group", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L35-L55
48,591
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
Bridge.add_group
def add_group(self, number, name, led_type): """ Add a group. :param number: Group number (1-4). :param name: Group name. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: Added group. """ group = group_factory(self, nu...
python
def add_group(self, number, name, led_type): """ Add a group. :param number: Group number (1-4). :param name: Group name. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: Added group. """ group = group_factory(self, nu...
[ "def", "add_group", "(", "self", ",", "number", ",", "name", ",", "led_type", ")", ":", "group", "=", "group_factory", "(", "self", ",", "number", ",", "name", ",", "led_type", ")", "self", ".", "groups", ".", "append", "(", "group", ")", "return", "...
Add a group. :param number: Group number (1-4). :param name: Group name. :param led_type: Either `RGBW`, `WRGB`, `RGBWW`, `WHITE`, `DIMMER` or `BRIDGE_LED`. :returns: Added group.
[ "Add", "a", "group", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L147-L157
48,592
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
Bridge.send
def send(self, command, reps=REPS, wait=MIN_WAIT): """ Send a command to the physical bridge. :param command: A Command instance. :param reps: Number of repetitions. :param wait: Wait time in seconds. """ # Enqueue the command. self._command_queue.put((command, r...
python
def send(self, command, reps=REPS, wait=MIN_WAIT): """ Send a command to the physical bridge. :param command: A Command instance. :param reps: Number of repetitions. :param wait: Wait time in seconds. """ # Enqueue the command. self._command_queue.put((command, r...
[ "def", "send", "(", "self", ",", "command", ",", "reps", "=", "REPS", ",", "wait", "=", "MIN_WAIT", ")", ":", "# Enqueue the command.", "self", ".", "_command_queue", ".", "put", "(", "(", "command", ",", "reps", ",", "wait", ")", ")", "# Wait before acc...
Send a command to the physical bridge. :param command: A Command instance. :param reps: Number of repetitions. :param wait: Wait time in seconds.
[ "Send", "a", "command", "to", "the", "physical", "bridge", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L159-L173
48,593
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
Bridge._consume
def _consume(self): """ Consume commands from the queue. The command is repeated according to the configured value. Wait after each command is sent. The bridge socket is a shared resource. It must only be used by one thread at a time. Note that this can and will delay c...
python
def _consume(self): """ Consume commands from the queue. The command is repeated according to the configured value. Wait after each command is sent. The bridge socket is a shared resource. It must only be used by one thread at a time. Note that this can and will delay c...
[ "def", "_consume", "(", "self", ")", ":", "while", "not", "self", ".", "is_closed", ":", "# Get command from queue.", "msg", "=", "self", ".", "_command_queue", ".", "get", "(", ")", "# Closed", "if", "msg", "is", "None", ":", "return", "# Use the lock so we...
Consume commands from the queue. The command is repeated according to the configured value. Wait after each command is sent. The bridge socket is a shared resource. It must only be used by one thread at a time. Note that this can and will delay commands if multiple groups are a...
[ "Consume", "commands", "from", "the", "queue", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L175-L225
48,594
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
Bridge._keep_alive
def _keep_alive(self): """ Send keep alive messages continuously to bridge. """ send_next_keep_alive_at = 0 while not self.is_closed: if not self.is_ready: self._reconnect() continue if time.monotonic() > send_next_keep_ali...
python
def _keep_alive(self): """ Send keep alive messages continuously to bridge. """ send_next_keep_alive_at = 0 while not self.is_closed: if not self.is_ready: self._reconnect() continue if time.monotonic() > send_next_keep_ali...
[ "def", "_keep_alive", "(", "self", ")", ":", "send_next_keep_alive_at", "=", "0", "while", "not", "self", ".", "is_closed", ":", "if", "not", "self", ".", "is_ready", ":", "self", ".", "_reconnect", "(", ")", "continue", "if", "time", ".", "monotonic", "...
Send keep alive messages continuously to bridge.
[ "Send", "keep", "alive", "messages", "continuously", "to", "bridge", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L275-L307
48,595
happyleavesaoc/python-limitlessled
limitlessled/bridge.py
Bridge.close
def close(self): """ Closes the connection to the bridge. """ self.is_closed = True self.is_ready = False self._command_queue.put(None)
python
def close(self): """ Closes the connection to the bridge. """ self.is_closed = True self.is_ready = False self._command_queue.put(None)
[ "def", "close", "(", "self", ")", ":", "self", ".", "is_closed", "=", "True", "self", ".", "is_ready", "=", "False", "self", ".", "_command_queue", ".", "put", "(", "None", ")" ]
Closes the connection to the bridge.
[ "Closes", "the", "connection", "to", "the", "bridge", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/bridge.py#L309-L315
48,596
open-homeautomation/pknx
knxip/ip.py
CEMIMessage.from_body
def from_body(cls, cemi): """Create a new CEMIMessage initialized from the given CEMI data.""" # TODO: check that length matches message = cls() message.code = cemi[0] offset = cemi[1] message.ctl1 = cemi[2 + offset] message.ctl2 = cemi[3 + offset] messa...
python
def from_body(cls, cemi): """Create a new CEMIMessage initialized from the given CEMI data.""" # TODO: check that length matches message = cls() message.code = cemi[0] offset = cemi[1] message.ctl1 = cemi[2 + offset] message.ctl2 = cemi[3 + offset] messa...
[ "def", "from_body", "(", "cls", ",", "cemi", ")", ":", "# TODO: check that length matches", "message", "=", "cls", "(", ")", "message", ".", "code", "=", "cemi", "[", "0", "]", "offset", "=", "cemi", "[", "1", "]", "message", ".", "ctl1", "=", "cemi", ...
Create a new CEMIMessage initialized from the given CEMI data.
[ "Create", "a", "new", "CEMIMessage", "initialized", "from", "the", "given", "CEMI", "data", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L129-L170
48,597
open-homeautomation/pknx
knxip/ip.py
CEMIMessage.init_group
def init_group(self, dst_addr=1): """Initilize the CEMI frame with the given destination address.""" self.code = 0x11 # frametype 1, repeat 1, system broadcast 1, priority 3, ack-req 0, # confirm-flag 0 self.ctl1 = 0xbc self.ctl2 = 0xe0 # dst addr type 1, hop count 6, ex...
python
def init_group(self, dst_addr=1): """Initilize the CEMI frame with the given destination address.""" self.code = 0x11 # frametype 1, repeat 1, system broadcast 1, priority 3, ack-req 0, # confirm-flag 0 self.ctl1 = 0xbc self.ctl2 = 0xe0 # dst addr type 1, hop count 6, ex...
[ "def", "init_group", "(", "self", ",", "dst_addr", "=", "1", ")", ":", "self", ".", "code", "=", "0x11", "# frametype 1, repeat 1, system broadcast 1, priority 3, ack-req 0,", "# confirm-flag 0", "self", ".", "ctl1", "=", "0xbc", "self", ".", "ctl2", "=", "0xe0", ...
Initilize the CEMI frame with the given destination address.
[ "Initilize", "the", "CEMI", "frame", "with", "the", "given", "destination", "address", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L172-L180
48,598
open-homeautomation/pknx
knxip/ip.py
CEMIMessage.init_group_write
def init_group_write(self, dst_addr=1, data=None, dptsize=0): """Initialize the CEMI frame for a group write operation.""" self.init_group(dst_addr) # unnumbered data packet, group write self.tpci_apci = 0x00 * 256 + 0x80 self.dptsize = dptsize if data is None: ...
python
def init_group_write(self, dst_addr=1, data=None, dptsize=0): """Initialize the CEMI frame for a group write operation.""" self.init_group(dst_addr) # unnumbered data packet, group write self.tpci_apci = 0x00 * 256 + 0x80 self.dptsize = dptsize if data is None: ...
[ "def", "init_group_write", "(", "self", ",", "dst_addr", "=", "1", ",", "data", "=", "None", ",", "dptsize", "=", "0", ")", ":", "self", ".", "init_group", "(", "dst_addr", ")", "# unnumbered data packet, group write", "self", ".", "tpci_apci", "=", "0x00", ...
Initialize the CEMI frame for a group write operation.
[ "Initialize", "the", "CEMI", "frame", "for", "a", "group", "write", "operation", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L182-L193
48,599
open-homeautomation/pknx
knxip/ip.py
CEMIMessage.init_group_read
def init_group_read(self, dst_addr=1): """Initialize the CEMI frame for a group read operation.""" self.init_group(dst_addr) self.tpci_apci = 0x00 # unnumbered data packet, group read self.data = [0]
python
def init_group_read(self, dst_addr=1): """Initialize the CEMI frame for a group read operation.""" self.init_group(dst_addr) self.tpci_apci = 0x00 # unnumbered data packet, group read self.data = [0]
[ "def", "init_group_read", "(", "self", ",", "dst_addr", "=", "1", ")", ":", "self", ".", "init_group", "(", "dst_addr", ")", "self", ".", "tpci_apci", "=", "0x00", "# unnumbered data packet, group read", "self", ".", "data", "=", "[", "0", "]" ]
Initialize the CEMI frame for a group read operation.
[ "Initialize", "the", "CEMI", "frame", "for", "a", "group", "read", "operation", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L195-L199