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,600
open-homeautomation/pknx
knxip/ip.py
CEMIMessage.to_body
def to_body(self): """Convert the CEMI frame object to its byte representation.""" body = [self.code, 0x00, self.ctl1, self.ctl2, (self.src_addr >> 8) & 0xff, (self.src_addr >> 0) & 0xff, (self.dst_addr >> 8) & 0xff, (self.dst_addr >> 0) & 0xff] if self.dptsize ==...
python
def to_body(self): """Convert the CEMI frame object to its byte representation.""" body = [self.code, 0x00, self.ctl1, self.ctl2, (self.src_addr >> 8) & 0xff, (self.src_addr >> 0) & 0xff, (self.dst_addr >> 8) & 0xff, (self.dst_addr >> 0) & 0xff] if self.dptsize ==...
[ "def", "to_body", "(", "self", ")", ":", "body", "=", "[", "self", ".", "code", ",", "0x00", ",", "self", ".", "ctl1", ",", "self", ".", "ctl2", ",", "(", "self", ".", "src_addr", ">>", "8", ")", "&", "0xff", ",", "(", "self", ".", "src_addr", ...
Convert the CEMI frame object to its byte representation.
[ "Convert", "the", "CEMI", "frame", "object", "to", "its", "byte", "representation", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L201-L215
48,601
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.disconnect
def disconnect(self): """Disconnect an open tunnel connection""" if self.connected and self.channel: logging.debug("Disconnecting KNX/IP tunnel...") frame = KNXIPFrame(KNXIPFrame.DISCONNECT_REQUEST) frame.body = self.hpai_body() # TODO: Glaube Sequence e...
python
def disconnect(self): """Disconnect an open tunnel connection""" if self.connected and self.channel: logging.debug("Disconnecting KNX/IP tunnel...") frame = KNXIPFrame(KNXIPFrame.DISCONNECT_REQUEST) frame.body = self.hpai_body() # TODO: Glaube Sequence e...
[ "def", "disconnect", "(", "self", ")", ":", "if", "self", ".", "connected", "and", "self", ".", "channel", ":", "logging", ".", "debug", "(", "\"Disconnecting KNX/IP tunnel...\"", ")", "frame", "=", "KNXIPFrame", "(", "KNXIPFrame", ".", "DISCONNECT_REQUEST", "...
Disconnect an open tunnel connection
[ "Disconnect", "an", "open", "tunnel", "connection" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L385-L409
48,602
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.check_connection_state
def check_connection_state(self): """Check the state of the connection using connection state request. This sends a CONNECTION_STATE_REQUEST. This method will only return True, if the connection is established and no error code is returned from the KNX/IP gateway """ if ...
python
def check_connection_state(self): """Check the state of the connection using connection state request. This sends a CONNECTION_STATE_REQUEST. This method will only return True, if the connection is established and no error code is returned from the KNX/IP gateway """ if ...
[ "def", "check_connection_state", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "self", ".", "connection_state", "=", "-", "1", "return", "False", "frame", "=", "KNXIPFrame", "(", "KNXIPFrame", ".", "CONNECTIONSTATE_REQUEST", ")", "frame", ...
Check the state of the connection using connection state request. This sends a CONNECTION_STATE_REQUEST. This method will only return True, if the connection is established and no error code is returned from the KNX/IP gateway
[ "Check", "the", "state", "of", "the", "connection", "using", "connection", "state", "request", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L411-L487
48,603
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.hpai_body
def hpai_body(self): """ Create a body with HPAI information. This is used for disconnect and connection state requests. """ body = [] # ============ IP Body ========== body.extend([self.channel]) # Communication Channel Id body.extend([0x00]) # Reserverd ...
python
def hpai_body(self): """ Create a body with HPAI information. This is used for disconnect and connection state requests. """ body = [] # ============ IP Body ========== body.extend([self.channel]) # Communication Channel Id body.extend([0x00]) # Reserverd ...
[ "def", "hpai_body", "(", "self", ")", ":", "body", "=", "[", "]", "# ============ IP Body ==========", "body", ".", "extend", "(", "[", "self", ".", "channel", "]", ")", "# Communication Channel Id", "body", ".", "extend", "(", "[", "0x00", "]", ")", "# Re...
Create a body with HPAI information. This is used for disconnect and connection state requests.
[ "Create", "a", "body", "with", "HPAI", "information", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L489-L506
48,604
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.send_tunnelling_request
def send_tunnelling_request(self, cemi, auto_connect=True): """Sends a tunneling request based on the given CEMI data. This method does not wait for an acknowledge or result frame. """ if not self.connected: if auto_connect: if not self.connect(): ...
python
def send_tunnelling_request(self, cemi, auto_connect=True): """Sends a tunneling request based on the given CEMI data. This method does not wait for an acknowledge or result frame. """ if not self.connected: if auto_connect: if not self.connect(): ...
[ "def", "send_tunnelling_request", "(", "self", ",", "cemi", ",", "auto_connect", "=", "True", ")", ":", "if", "not", "self", ".", "connected", ":", "if", "auto_connect", ":", "if", "not", "self", ".", "connect", "(", ")", ":", "raise", "KNXException", "(...
Sends a tunneling request based on the given CEMI data. This method does not wait for an acknowledge or result frame.
[ "Sends", "a", "tunneling", "request", "based", "on", "the", "given", "CEMI", "data", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L508-L548
48,605
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.group_read
def group_read(self, addr, use_cache=True, timeout=1): """Send a group read to the KNX bus and return the result.""" if use_cache: res = self.value_cache.get(addr) if res: logging.debug( "Got value of group address %s from cache: %s", addr, res...
python
def group_read(self, addr, use_cache=True, timeout=1): """Send a group read to the KNX bus and return the result.""" if use_cache: res = self.value_cache.get(addr) if res: logging.debug( "Got value of group address %s from cache: %s", addr, res...
[ "def", "group_read", "(", "self", ",", "addr", ",", "use_cache", "=", "True", ",", "timeout", "=", "1", ")", ":", "if", "use_cache", ":", "res", "=", "self", ".", "value_cache", ".", "get", "(", "addr", ")", "if", "res", ":", "logging", ".", "debug...
Send a group read to the KNX bus and return the result.
[ "Send", "a", "group", "read", "to", "the", "KNX", "bus", "and", "return", "the", "result", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L550-L573
48,606
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.group_write
def group_write(self, addr, data, dptsize=0): """Send a group write to the given address. The method does not check if the address exists and the write request is valid. """ cemi = CEMIMessage() cemi.init_group_write(addr, data, dptsize) with self._lock: ...
python
def group_write(self, addr, data, dptsize=0): """Send a group write to the given address. The method does not check if the address exists and the write request is valid. """ cemi = CEMIMessage() cemi.init_group_write(addr, data, dptsize) with self._lock: ...
[ "def", "group_write", "(", "self", ",", "addr", ",", "data", ",", "dptsize", "=", "0", ")", ":", "cemi", "=", "CEMIMessage", "(", ")", "cemi", ".", "init_group_write", "(", "addr", ",", "data", ",", "dptsize", ")", "with", "self", ".", "_lock", ":", ...
Send a group write to the given address. The method does not check if the address exists and the write request is valid.
[ "Send", "a", "group", "write", "to", "the", "given", "address", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L575-L588
48,607
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.group_toggle
def group_toggle(self, addr, use_cache=True): """Toggle the value of an 1-bit group address. If the object has a value != 0, it will be set to 0, otherwise to 1 """ data = self.group_read(addr, use_cache) if len(data) != 1: problem = "Can't toggle a {}-octet group ad...
python
def group_toggle(self, addr, use_cache=True): """Toggle the value of an 1-bit group address. If the object has a value != 0, it will be set to 0, otherwise to 1 """ data = self.group_read(addr, use_cache) if len(data) != 1: problem = "Can't toggle a {}-octet group ad...
[ "def", "group_toggle", "(", "self", ",", "addr", ",", "use_cache", "=", "True", ")", ":", "data", "=", "self", ".", "group_read", "(", "addr", ",", "use_cache", ")", "if", "len", "(", "data", ")", "!=", "1", ":", "problem", "=", "\"Can't toggle a {}-oc...
Toggle the value of an 1-bit group address. If the object has a value != 0, it will be set to 0, otherwise to 1
[ "Toggle", "the", "value", "of", "an", "1", "-", "bit", "group", "address", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L590-L610
48,608
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.register_listener
def register_listener(self, address, func): """Adds a listener to messages received on a specific address If some KNX messages will be received from the KNX bus, this listener will be called func(address, data). There can be multiple listeners for a given address """ try...
python
def register_listener(self, address, func): """Adds a listener to messages received on a specific address If some KNX messages will be received from the KNX bus, this listener will be called func(address, data). There can be multiple listeners for a given address """ try...
[ "def", "register_listener", "(", "self", ",", "address", ",", "func", ")", ":", "try", ":", "listeners", "=", "self", ".", "address_listeners", "[", "address", "]", "except", "KeyError", ":", "listeners", "=", "[", "]", "self", ".", "address_listeners", "[...
Adds a listener to messages received on a specific address If some KNX messages will be received from the KNX bus, this listener will be called func(address, data). There can be multiple listeners for a given address
[ "Adds", "a", "listener", "to", "messages", "received", "on", "a", "specific", "address" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L612-L628
48,609
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.unregister_listener
def unregister_listener(self, address, func): """Removes a listener function for a given address Remove the listener for the given address. Returns true if the listener was found and removed, false otherwise """ listeners = self.address_listeners[address] if listeners is...
python
def unregister_listener(self, address, func): """Removes a listener function for a given address Remove the listener for the given address. Returns true if the listener was found and removed, false otherwise """ listeners = self.address_listeners[address] if listeners is...
[ "def", "unregister_listener", "(", "self", ",", "address", ",", "func", ")", ":", "listeners", "=", "self", ".", "address_listeners", "[", "address", "]", "if", "listeners", "is", "None", ":", "return", "False", "if", "func", "in", "listeners", ":", "liste...
Removes a listener function for a given address Remove the listener for the given address. Returns true if the listener was found and removed, false otherwise
[ "Removes", "a", "listener", "function", "for", "a", "given", "address" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L630-L644
48,610
open-homeautomation/pknx
knxip/ip.py
KNXIPTunnel.received_message
def received_message(self, address, data): """Process a message received from the KNX bus.""" self.value_cache.set(address, data) if self.notify: self.notify(address, data) try: listeners = self.address_listeners[address] except KeyError: list...
python
def received_message(self, address, data): """Process a message received from the KNX bus.""" self.value_cache.set(address, data) if self.notify: self.notify(address, data) try: listeners = self.address_listeners[address] except KeyError: list...
[ "def", "received_message", "(", "self", ",", "address", ",", "data", ")", ":", "self", ".", "value_cache", ".", "set", "(", "address", ",", "data", ")", "if", "self", ".", "notify", ":", "self", ".", "notify", "(", "address", ",", "data", ")", "try",...
Process a message received from the KNX bus.
[ "Process", "a", "message", "received", "from", "the", "KNX", "bus", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L646-L658
48,611
open-homeautomation/pknx
knxip/ip.py
DataRequestHandler.handle
def handle(self): """Process an incoming package.""" data = self.request[0] sock = self.request[1] frame = KNXIPFrame.from_frame(data) if frame.service_type_id == KNXIPFrame.TUNNELING_REQUEST: req = KNXTunnelingRequest.from_body(frame.body) msg = CEMIMes...
python
def handle(self): """Process an incoming package.""" data = self.request[0] sock = self.request[1] frame = KNXIPFrame.from_frame(data) if frame.service_type_id == KNXIPFrame.TUNNELING_REQUEST: req = KNXTunnelingRequest.from_body(frame.body) msg = CEMIMes...
[ "def", "handle", "(", "self", ")", ":", "data", "=", "self", ".", "request", "[", "0", "]", "sock", "=", "self", ".", "request", "[", "1", "]", "frame", "=", "KNXIPFrame", ".", "from_frame", "(", "data", ")", "if", "frame", ".", "service_type_id", ...
Process an incoming package.
[ "Process", "an", "incoming", "package", "." ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/ip.py#L664-L719
48,612
open-homeautomation/pknx
knxip/conversion.py
float_to_knx2
def float_to_knx2(floatval): """Convert a float to a 2 byte KNX float value""" if floatval < -671088.64 or floatval > 670760.96: raise KNXException("float {} out of valid range".format(floatval)) floatval = floatval * 100 i = 0 for i in range(0, 15): exp = pow(2, i) if ((f...
python
def float_to_knx2(floatval): """Convert a float to a 2 byte KNX float value""" if floatval < -671088.64 or floatval > 670760.96: raise KNXException("float {} out of valid range".format(floatval)) floatval = floatval * 100 i = 0 for i in range(0, 15): exp = pow(2, i) if ((f...
[ "def", "float_to_knx2", "(", "floatval", ")", ":", "if", "floatval", "<", "-", "671088.64", "or", "floatval", ">", "670760.96", ":", "raise", "KNXException", "(", "\"float {} out of valid range\"", ".", "format", "(", "floatval", ")", ")", "floatval", "=", "fl...
Convert a float to a 2 byte KNX float value
[ "Convert", "a", "float", "to", "a", "2", "byte", "KNX", "float", "value" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L7-L29
48,613
open-homeautomation/pknx
knxip/conversion.py
knx2_to_float
def knx2_to_float(knxdata): """Convert a KNX 2 byte float object to a float""" if len(knxdata) != 2: raise KNXException("Can only convert a 2 Byte object to float") data = knxdata[0] * 256 + knxdata[1] sign = data >> 15 exponent = (data >> 11) & 0x0f mantisse = float(data & 0x7ff) i...
python
def knx2_to_float(knxdata): """Convert a KNX 2 byte float object to a float""" if len(knxdata) != 2: raise KNXException("Can only convert a 2 Byte object to float") data = knxdata[0] * 256 + knxdata[1] sign = data >> 15 exponent = (data >> 11) & 0x0f mantisse = float(data & 0x7ff) i...
[ "def", "knx2_to_float", "(", "knxdata", ")", ":", "if", "len", "(", "knxdata", ")", "!=", "2", ":", "raise", "KNXException", "(", "\"Can only convert a 2 Byte object to float\"", ")", "data", "=", "knxdata", "[", "0", "]", "*", "256", "+", "knxdata", "[", ...
Convert a KNX 2 byte float object to a float
[ "Convert", "a", "KNX", "2", "byte", "float", "object", "to", "a", "float" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L32-L44
48,614
open-homeautomation/pknx
knxip/conversion.py
time_to_knx
def time_to_knx(timeval, dow=0): """Converts a time and day-of-week to a KNX time object""" knxdata = [0, 0, 0] knxdata[0] = ((dow & 0x07) << 5) + timeval.hour knxdata[1] = timeval.minute knxdata[2] = timeval.second return knxdata
python
def time_to_knx(timeval, dow=0): """Converts a time and day-of-week to a KNX time object""" knxdata = [0, 0, 0] knxdata[0] = ((dow & 0x07) << 5) + timeval.hour knxdata[1] = timeval.minute knxdata[2] = timeval.second return knxdata
[ "def", "time_to_knx", "(", "timeval", ",", "dow", "=", "0", ")", ":", "knxdata", "=", "[", "0", ",", "0", ",", "0", "]", "knxdata", "[", "0", "]", "=", "(", "(", "dow", "&", "0x07", ")", "<<", "5", ")", "+", "timeval", ".", "hour", "knxdata",...
Converts a time and day-of-week to a KNX time object
[ "Converts", "a", "time", "and", "day", "-", "of", "-", "week", "to", "a", "KNX", "time", "object" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L47-L54
48,615
open-homeautomation/pknx
knxip/conversion.py
knx_to_time
def knx_to_time(knxdata): """Converts a KNX time to a tuple of a time object and the day of week""" if len(knxdata) != 3: raise KNXException("Can only convert a 3 Byte object to time") dow = knxdata[0] >> 5 res = time(knxdata[0] & 0x1f, knxdata[1], knxdata[2]) return [res, dow]
python
def knx_to_time(knxdata): """Converts a KNX time to a tuple of a time object and the day of week""" if len(knxdata) != 3: raise KNXException("Can only convert a 3 Byte object to time") dow = knxdata[0] >> 5 res = time(knxdata[0] & 0x1f, knxdata[1], knxdata[2]) return [res, dow]
[ "def", "knx_to_time", "(", "knxdata", ")", ":", "if", "len", "(", "knxdata", ")", "!=", "3", ":", "raise", "KNXException", "(", "\"Can only convert a 3 Byte object to time\"", ")", "dow", "=", "knxdata", "[", "0", "]", ">>", "5", "res", "=", "time", "(", ...
Converts a KNX time to a tuple of a time object and the day of week
[ "Converts", "a", "KNX", "time", "to", "a", "tuple", "of", "a", "time", "object", "and", "the", "day", "of", "week" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L57-L66
48,616
open-homeautomation/pknx
knxip/conversion.py
date_to_knx
def date_to_knx(dateval): """Convert a date to a 3 byte KNX data array""" if (dateval.year < 1990) or (dateval.year > 2089): raise KNXException("Year has to be between 1990 and 2089") if dateval.year < 2000: year = dateval.year - 1900 else: year = dateval.year - 2000 retur...
python
def date_to_knx(dateval): """Convert a date to a 3 byte KNX data array""" if (dateval.year < 1990) or (dateval.year > 2089): raise KNXException("Year has to be between 1990 and 2089") if dateval.year < 2000: year = dateval.year - 1900 else: year = dateval.year - 2000 retur...
[ "def", "date_to_knx", "(", "dateval", ")", ":", "if", "(", "dateval", ".", "year", "<", "1990", ")", "or", "(", "dateval", ".", "year", ">", "2089", ")", ":", "raise", "KNXException", "(", "\"Year has to be between 1990 and 2089\"", ")", "if", "dateval", "...
Convert a date to a 3 byte KNX data array
[ "Convert", "a", "date", "to", "a", "3", "byte", "KNX", "data", "array" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L69-L80
48,617
open-homeautomation/pknx
knxip/conversion.py
knx_to_date
def knx_to_date(knxdata): """Convert a 3 byte KNX data object to a date""" if len(knxdata) != 3: raise KNXException("Can only convert a 3 Byte object to date") year = knxdata[2] if year >= 90: year += 1900 else: year += 2000 return date(year, knxdata[1], knxdata[0])
python
def knx_to_date(knxdata): """Convert a 3 byte KNX data object to a date""" if len(knxdata) != 3: raise KNXException("Can only convert a 3 Byte object to date") year = knxdata[2] if year >= 90: year += 1900 else: year += 2000 return date(year, knxdata[1], knxdata[0])
[ "def", "knx_to_date", "(", "knxdata", ")", ":", "if", "len", "(", "knxdata", ")", "!=", "3", ":", "raise", "KNXException", "(", "\"Can only convert a 3 Byte object to date\"", ")", "year", "=", "knxdata", "[", "2", "]", "if", "year", ">=", "90", ":", "year...
Convert a 3 byte KNX data object to a date
[ "Convert", "a", "3", "byte", "KNX", "data", "object", "to", "a", "date" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L83-L95
48,618
open-homeautomation/pknx
knxip/conversion.py
datetime_to_knx
def datetime_to_knx(datetimeval, clock_synced_external=1): """Convert a Python timestamp to an 8 byte KNX time and date object""" res = [0, 0, 0, 0, 0, 0, 0, 0] year = datetimeval.year if (year < 1900) or (year > 2155): raise KNXException("Only years between 1900 and 2155 supported") res[0]...
python
def datetime_to_knx(datetimeval, clock_synced_external=1): """Convert a Python timestamp to an 8 byte KNX time and date object""" res = [0, 0, 0, 0, 0, 0, 0, 0] year = datetimeval.year if (year < 1900) or (year > 2155): raise KNXException("Only years between 1900 and 2155 supported") res[0]...
[ "def", "datetime_to_knx", "(", "datetimeval", ",", "clock_synced_external", "=", "1", ")", ":", "res", "=", "[", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", "]", "year", "=", "datetimeval", ".", "year", "if", "(", ...
Convert a Python timestamp to an 8 byte KNX time and date object
[ "Convert", "a", "Python", "timestamp", "to", "an", "8", "byte", "KNX", "time", "and", "date", "object" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L98-L133
48,619
open-homeautomation/pknx
knxip/conversion.py
knx_to_datetime
def knx_to_datetime(knxdata): """Convert a an 8 byte KNX time and date object to its components""" if len(knxdata) != 8: raise KNXException("Can only convert an 8 Byte object to datetime") year = knxdata[0] + 1900 month = knxdata[1] day = knxdata[2] hour = knxdata[3] & 0x1f minute ...
python
def knx_to_datetime(knxdata): """Convert a an 8 byte KNX time and date object to its components""" if len(knxdata) != 8: raise KNXException("Can only convert an 8 Byte object to datetime") year = knxdata[0] + 1900 month = knxdata[1] day = knxdata[2] hour = knxdata[3] & 0x1f minute ...
[ "def", "knx_to_datetime", "(", "knxdata", ")", ":", "if", "len", "(", "knxdata", ")", "!=", "8", ":", "raise", "KNXException", "(", "\"Can only convert an 8 Byte object to datetime\"", ")", "year", "=", "knxdata", "[", "0", "]", "+", "1900", "month", "=", "k...
Convert a an 8 byte KNX time and date object to its components
[ "Convert", "a", "an", "8", "byte", "KNX", "time", "and", "date", "object", "to", "its", "components" ]
a8aed8271563923c447aa330ba7c1c2927286f7a
https://github.com/open-homeautomation/pknx/blob/a8aed8271563923c447aa330ba7c1c2927286f7a/knxip/conversion.py#L136-L149
48,620
happyleavesaoc/python-limitlessled
limitlessled/group/rgbww.py
RgbwwGroup.saturation
def saturation(self, saturation): """ Set the group saturation. :param saturation: Saturation in decimal percent (0.0-1.0). """ if saturation < 0 or saturation > 1: raise ValueError("Saturation must be a percentage " "represented as decimal 0-1.0...
python
def saturation(self, saturation): """ Set the group saturation. :param saturation: Saturation in decimal percent (0.0-1.0). """ if saturation < 0 or saturation > 1: raise ValueError("Saturation must be a percentage " "represented as decimal 0-1.0...
[ "def", "saturation", "(", "self", ",", "saturation", ")", ":", "if", "saturation", "<", "0", "or", "saturation", ">", "1", ":", "raise", "ValueError", "(", "\"Saturation must be a percentage \"", "\"represented as decimal 0-1.0\"", ")", "self", ".", "_saturation", ...
Set the group saturation. :param saturation: Saturation in decimal percent (0.0-1.0).
[ "Set", "the", "group", "saturation", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/group/rgbww.py#L115-L129
48,621
golemhq/webdriver-manager
webdriver_manager/helpers.py
download_file_with_progress_bar
def download_file_with_progress_bar(url): """Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ request = requests.get(url, stream=True) if request.status_code == 404: msg = ('there was a 404 error trying to reach {} \nThis probably ' ...
python
def download_file_with_progress_bar(url): """Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ request = requests.get(url, stream=True) if request.status_code == 404: msg = ('there was a 404 error trying to reach {} \nThis probably ' ...
[ "def", "download_file_with_progress_bar", "(", "url", ")", ":", "request", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "if", "request", ".", "status_code", "==", "404", ":", "msg", "=", "(", "'there was a 404 error trying to reach...
Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object
[ "Downloads", "a", "file", "from", "the", "given", "url", "displays", "a", "progress", "bar", ".", "Returns", "a", "io", ".", "BytesIO", "object" ]
5c923deec5cb14f503ba7c20b67bc296e411de19
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/helpers.py#L106-L125
48,622
golemhq/webdriver-manager
webdriver_manager/helpers.py
extract_file_from_zip
def extract_file_from_zip(bytes_io, expected_file): """Extracts a file from a bytes_io zip. Returns bytes""" zipf = zipfile.ZipFile(bytes_io) return zipf.read(expected_file)
python
def extract_file_from_zip(bytes_io, expected_file): """Extracts a file from a bytes_io zip. Returns bytes""" zipf = zipfile.ZipFile(bytes_io) return zipf.read(expected_file)
[ "def", "extract_file_from_zip", "(", "bytes_io", ",", "expected_file", ")", ":", "zipf", "=", "zipfile", ".", "ZipFile", "(", "bytes_io", ")", "return", "zipf", ".", "read", "(", "expected_file", ")" ]
Extracts a file from a bytes_io zip. Returns bytes
[ "Extracts", "a", "file", "from", "a", "bytes_io", "zip", ".", "Returns", "bytes" ]
5c923deec5cb14f503ba7c20b67bc296e411de19
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/helpers.py#L139-L142
48,623
golemhq/webdriver-manager
webdriver_manager/helpers.py
extract_file_from_tar
def extract_file_from_tar(bytes_io, expected_file): """extract a file from a bytes_io tar. Returns bytes""" with open('temp', 'wb+') as f: bytes_io.seek(0) shutil.copyfileobj(bytes_io, f, length=131072) tar = tarfile.open('temp', mode='r:gz') os.remove('temp') return tar.extractfile(...
python
def extract_file_from_tar(bytes_io, expected_file): """extract a file from a bytes_io tar. Returns bytes""" with open('temp', 'wb+') as f: bytes_io.seek(0) shutil.copyfileobj(bytes_io, f, length=131072) tar = tarfile.open('temp', mode='r:gz') os.remove('temp') return tar.extractfile(...
[ "def", "extract_file_from_tar", "(", "bytes_io", ",", "expected_file", ")", ":", "with", "open", "(", "'temp'", ",", "'wb+'", ")", "as", "f", ":", "bytes_io", ".", "seek", "(", "0", ")", "shutil", ".", "copyfileobj", "(", "bytes_io", ",", "f", ",", "le...
extract a file from a bytes_io tar. Returns bytes
[ "extract", "a", "file", "from", "a", "bytes_io", "tar", ".", "Returns", "bytes" ]
5c923deec5cb14f503ba7c20b67bc296e411de19
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/helpers.py#L145-L152
48,624
golemhq/webdriver-manager
webdriver_manager/commands.py
clean
def clean(outputdir, drivers=None): """Remove driver executables from the specified outputdir. drivers can be a list of drivers to filter which executables to remove. Specify a version using an equal sign i.e.: 'chrome=2.2' """ if drivers: # Generate a list of tuples: [(driver_name, request...
python
def clean(outputdir, drivers=None): """Remove driver executables from the specified outputdir. drivers can be a list of drivers to filter which executables to remove. Specify a version using an equal sign i.e.: 'chrome=2.2' """ if drivers: # Generate a list of tuples: [(driver_name, request...
[ "def", "clean", "(", "outputdir", ",", "drivers", "=", "None", ")", ":", "if", "drivers", ":", "# Generate a list of tuples: [(driver_name, requested_version)]", "# If driver string does not contain a version, the second element", "# of the tuple is None.", "# Example:", "# [('driv...
Remove driver executables from the specified outputdir. drivers can be a list of drivers to filter which executables to remove. Specify a version using an equal sign i.e.: 'chrome=2.2'
[ "Remove", "driver", "executables", "from", "the", "specified", "outputdir", "." ]
5c923deec5cb14f503ba7c20b67bc296e411de19
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/commands.py#L27-L67
48,625
juicer/juicer
juicer/juicer/Juicer.py
Juicer.push
def push(self, cart, env=None, callback=None): """ `cart` - Release cart to push items from `callback` - Optional callback to call if juicer.utils.upload_rpm succeeds Pushes the items in a release cart to the pre-release environment. """ juicer.utils.Log.log_debug("Initi...
python
def push(self, cart, env=None, callback=None): """ `cart` - Release cart to push items from `callback` - Optional callback to call if juicer.utils.upload_rpm succeeds Pushes the items in a release cart to the pre-release environment. """ juicer.utils.Log.log_debug("Initi...
[ "def", "push", "(", "self", ",", "cart", ",", "env", "=", "None", ",", "callback", "=", "None", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Initializing push of cart '%s'\"", "%", "cart", ".", "cart_name", ")", "if", "not", ...
`cart` - Release cart to push items from `callback` - Optional callback to call if juicer.utils.upload_rpm succeeds Pushes the items in a release cart to the pre-release environment.
[ "cart", "-", "Release", "cart", "to", "push", "items", "from", "callback", "-", "Optional", "callback", "to", "call", "if", "juicer", ".", "utils", ".", "upload_rpm", "succeeds" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L130-L145
48,626
juicer/juicer
juicer/juicer/Juicer.py
Juicer.publish
def publish(self, cart, env=None): """ `cart` - Release cart to publish in json format Publish a release cart in JSON format to the pre-release environment. """ juicer.utils.Log.log_debug("Initializing publish of cart '%s'" % cart.cart_name) if not env: env ...
python
def publish(self, cart, env=None): """ `cart` - Release cart to publish in json format Publish a release cart in JSON format to the pre-release environment. """ juicer.utils.Log.log_debug("Initializing publish of cart '%s'" % cart.cart_name) if not env: env ...
[ "def", "publish", "(", "self", ",", "cart", ",", "env", "=", "None", ")", ":", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Initializing publish of cart '%s'\"", "%", "cart", ".", "cart_name", ")", "if", "not", "env", ":", "env", "=", ...
`cart` - Release cart to publish in json format Publish a release cart in JSON format to the pre-release environment.
[ "cart", "-", "Release", "cart", "to", "publish", "in", "json", "format" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L147-L161
48,627
juicer/juicer
juicer/juicer/Juicer.py
Juicer.create_manifest
def create_manifest(self, cart_name, manifests): """ `cart_name` - Name of this release cart `manifests` - a list of manifest files """ cart = juicer.common.Cart.Cart(cart_name) for manifest in manifests: cart.add_from_manifest(manifest, self.connectors) ...
python
def create_manifest(self, cart_name, manifests): """ `cart_name` - Name of this release cart `manifests` - a list of manifest files """ cart = juicer.common.Cart.Cart(cart_name) for manifest in manifests: cart.add_from_manifest(manifest, self.connectors) ...
[ "def", "create_manifest", "(", "self", ",", "cart_name", ",", "manifests", ")", ":", "cart", "=", "juicer", ".", "common", ".", "Cart", ".", "Cart", "(", "cart_name", ")", "for", "manifest", "in", "manifests", ":", "cart", ".", "add_from_manifest", "(", ...
`cart_name` - Name of this release cart `manifests` - a list of manifest files
[ "cart_name", "-", "Name", "of", "this", "release", "cart", "manifests", "-", "a", "list", "of", "manifest", "files" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L213-L224
48,628
juicer/juicer
juicer/juicer/Juicer.py
Juicer.list
def list(self, cart_glob=['*.json']): """ List all carts """ carts = [] for glob in cart_glob: # Translate cart names into cart file names if not glob.endswith('.json'): search_glob = glob + ".json" else: search_...
python
def list(self, cart_glob=['*.json']): """ List all carts """ carts = [] for glob in cart_glob: # Translate cart names into cart file names if not glob.endswith('.json'): search_glob = glob + ".json" else: search_...
[ "def", "list", "(", "self", ",", "cart_glob", "=", "[", "'*.json'", "]", ")", ":", "carts", "=", "[", "]", "for", "glob", "in", "cart_glob", ":", "# Translate cart names into cart file names", "if", "not", "glob", ".", "endswith", "(", "'.json'", ")", ":",...
List all carts
[ "List", "all", "carts" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L258-L274
48,629
juicer/juicer
juicer/juicer/Juicer.py
Juicer.search
def search(self, pkg_name=None, search_carts=False, query='/content/units/rpm/search/'): """ search for a package stored in a pulp repo `pkg_name` - substring in the name of the package `search_carts` - whether or not to return carts that include the listed package "...
python
def search(self, pkg_name=None, search_carts=False, query='/content/units/rpm/search/'): """ search for a package stored in a pulp repo `pkg_name` - substring in the name of the package `search_carts` - whether or not to return carts that include the listed package "...
[ "def", "search", "(", "self", ",", "pkg_name", "=", "None", ",", "search_carts", "=", "False", ",", "query", "=", "'/content/units/rpm/search/'", ")", ":", "# this data block is... yeah. searching in pulp v2 is painful", "#", "# https://pulp-dev-guide.readthedocs.org/en/lates...
search for a package stored in a pulp repo `pkg_name` - substring in the name of the package `search_carts` - whether or not to return carts that include the listed package
[ "search", "for", "a", "package", "stored", "in", "a", "pulp", "repo" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L276-L340
48,630
juicer/juicer
juicer/juicer/Juicer.py
Juicer.merge
def merge(self, carts=None, new_cart_name=None): """ `carts` - A list of cart names `new_cart_name` - Resultant cart name Merge the contents of N carts into a new cart TODO: Sanity check that each cart in `carts` exists. Try 'juicer pull'ing carts that can't be located ...
python
def merge(self, carts=None, new_cart_name=None): """ `carts` - A list of cart names `new_cart_name` - Resultant cart name Merge the contents of N carts into a new cart TODO: Sanity check that each cart in `carts` exists. Try 'juicer pull'ing carts that can't be located ...
[ "def", "merge", "(", "self", ",", "carts", "=", "None", ",", "new_cart_name", "=", "None", ")", ":", "if", "new_cart_name", "is", "not", "None", ":", "cart_name", "=", "new_cart_name", "else", ":", "cart_name", "=", "carts", "[", "0", "]", "result_cart",...
`carts` - A list of cart names `new_cart_name` - Resultant cart name Merge the contents of N carts into a new cart TODO: Sanity check that each cart in `carts` exists. Try 'juicer pull'ing carts that can't be located locally. Then cry like a baby and error out.
[ "carts", "-", "A", "list", "of", "cart", "names", "new_cart_name", "-", "Resultant", "cart", "name" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L369-L402
48,631
juicer/juicer
juicer/juicer/Juicer.py
Juicer.pull
def pull(self, cartname=None, env=None): """ `cartname` - Name of cart Pull remote cart from the pre release (base) environment """ if not env: env = self._defaults['start_in'] juicer.utils.Log.log_debug("Initializing pulling cart: %s ...", cartname) ...
python
def pull(self, cartname=None, env=None): """ `cartname` - Name of cart Pull remote cart from the pre release (base) environment """ if not env: env = self._defaults['start_in'] juicer.utils.Log.log_debug("Initializing pulling cart: %s ...", cartname) ...
[ "def", "pull", "(", "self", ",", "cartname", "=", "None", ",", "env", "=", "None", ")", ":", "if", "not", "env", ":", "env", "=", "self", ".", "_defaults", "[", "'start_in'", "]", "juicer", ".", "utils", ".", "Log", ".", "log_debug", "(", "\"Initia...
`cartname` - Name of cart Pull remote cart from the pre release (base) environment
[ "cartname", "-", "Name", "of", "cart" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L404-L423
48,632
juicer/juicer
juicer/juicer/Juicer.py
Juicer.promote
def promote(self, cart_name): """ `name` - name of cart Promote a cart from its current environment to the next in the chain. """ cart = juicer.common.Cart.Cart(cart_name=cart_name, autoload=True, autosync=True) old_env = cart.current_env cart.current_env = juice...
python
def promote(self, cart_name): """ `name` - name of cart Promote a cart from its current environment to the next in the chain. """ cart = juicer.common.Cart.Cart(cart_name=cart_name, autoload=True, autosync=True) old_env = cart.current_env cart.current_env = juice...
[ "def", "promote", "(", "self", ",", "cart_name", ")", ":", "cart", "=", "juicer", ".", "common", ".", "Cart", ".", "Cart", "(", "cart_name", "=", "cart_name", ",", "autoload", "=", "True", ",", "autosync", "=", "True", ")", "old_env", "=", "cart", "....
`name` - name of cart Promote a cart from its current environment to the next in the chain.
[ "name", "-", "name", "of", "cart" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L425-L486
48,633
juicer/juicer
juicer/juicer/Juicer.py
Juicer.sign_cart_for_env_maybe
def sign_cart_for_env_maybe(self, cart, env=None): """ Sign the items to upload, if the env requires a signature. `cart` - Cart to sign `envs` - The cart is signed if env has the property: requires_signature = True Will attempt to load the rpm_sign_plugin defined in ...
python
def sign_cart_for_env_maybe(self, cart, env=None): """ Sign the items to upload, if the env requires a signature. `cart` - Cart to sign `envs` - The cart is signed if env has the property: requires_signature = True Will attempt to load the rpm_sign_plugin defined in ...
[ "def", "sign_cart_for_env_maybe", "(", "self", ",", "cart", ",", "env", "=", "None", ")", ":", "if", "self", ".", "connectors", "[", "env", "]", ".", "requires_signature", ":", "cart", ".", "sync_remotes", "(", "force", "=", "True", ")", "juicer", ".", ...
Sign the items to upload, if the env requires a signature. `cart` - Cart to sign `envs` - The cart is signed if env has the property: requires_signature = True Will attempt to load the rpm_sign_plugin defined in ~/.config/juicer/config, which must be a plugin inheriting from ...
[ "Sign", "the", "items", "to", "upload", "if", "the", "env", "requires", "a", "signature", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L525-L569
48,634
juicer/juicer
juicer/juicer/Juicer.py
Juicer.publish_repo
def publish_repo(self, repo, env): """ `repo` - Repo name. `env` - Environment. Publish a repository. This action regenerates metadata. """ _r = self.connectors[env].post('/repositories/%s-%s/actions/publish/' % (repo, env), {'id': 'yum_distributor'}) if _r.statu...
python
def publish_repo(self, repo, env): """ `repo` - Repo name. `env` - Environment. Publish a repository. This action regenerates metadata. """ _r = self.connectors[env].post('/repositories/%s-%s/actions/publish/' % (repo, env), {'id': 'yum_distributor'}) if _r.statu...
[ "def", "publish_repo", "(", "self", ",", "repo", ",", "env", ")", ":", "_r", "=", "self", ".", "connectors", "[", "env", "]", ".", "post", "(", "'/repositories/%s-%s/actions/publish/'", "%", "(", "repo", ",", "env", ")", ",", "{", "'id'", ":", "'yum_di...
`repo` - Repo name. `env` - Environment. Publish a repository. This action regenerates metadata.
[ "repo", "-", "Repo", "name", ".", "env", "-", "Environment", "." ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L571-L582
48,635
juicer/juicer
juicer/juicer/Juicer.py
Juicer.prune_repo
def prune_repo(self, repo_name=None, daycount=None, envs=[], query='/repositories/'): """ `repo_name` - name of the repository to prune """ orphan_query = '/content/orphans/rpm/' t = datetime.datetime.now() - datetime.timedelta(days = daycount) juicer.utils.Log.log_debug(...
python
def prune_repo(self, repo_name=None, daycount=None, envs=[], query='/repositories/'): """ `repo_name` - name of the repository to prune """ orphan_query = '/content/orphans/rpm/' t = datetime.datetime.now() - datetime.timedelta(days = daycount) juicer.utils.Log.log_debug(...
[ "def", "prune_repo", "(", "self", ",", "repo_name", "=", "None", ",", "daycount", "=", "None", ",", "envs", "=", "[", "]", ",", "query", "=", "'/repositories/'", ")", ":", "orphan_query", "=", "'/content/orphans/rpm/'", "t", "=", "datetime", ".", "datetime...
`repo_name` - name of the repository to prune
[ "repo_name", "-", "name", "of", "the", "repository", "to", "prune" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L584-L626
48,636
juicer/juicer
juicer/juicer/Juicer.py
Juicer.delete
def delete(self, cartname): """ `cartname` - name of the cart to delete Delete a cart both from your local filesystem and the mongo database """ cart = juicer.common.Cart.Cart(cart_name=cartname) cart.implode(self._defaults['start_in'])
python
def delete(self, cartname): """ `cartname` - name of the cart to delete Delete a cart both from your local filesystem and the mongo database """ cart = juicer.common.Cart.Cart(cart_name=cartname) cart.implode(self._defaults['start_in'])
[ "def", "delete", "(", "self", ",", "cartname", ")", ":", "cart", "=", "juicer", ".", "common", ".", "Cart", ".", "Cart", "(", "cart_name", "=", "cartname", ")", "cart", ".", "implode", "(", "self", ".", "_defaults", "[", "'start_in'", "]", ")" ]
`cartname` - name of the cart to delete Delete a cart both from your local filesystem and the mongo database
[ "cartname", "-", "name", "of", "the", "cart", "to", "delete", "Delete", "a", "cart", "both", "from", "your", "local", "filesystem", "and", "the", "mongo", "database" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/juicer/Juicer.py#L628-L634
48,637
juicer/juicer
juicer/utils/texttable.py
Texttable.reset
def reset(self): """Reset the instance - reset rows and header """ self._hline_string = None self._row_size = None self._header = [] self._rows = []
python
def reset(self): """Reset the instance - reset rows and header """ self._hline_string = None self._row_size = None self._header = [] self._rows = []
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_hline_string", "=", "None", "self", ".", "_row_size", "=", "None", "self", ".", "_header", "=", "[", "]", "self", ".", "_rows", "=", "[", "]" ]
Reset the instance - reset rows and header
[ "Reset", "the", "instance" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/texttable.py#L130-L139
48,638
juicer/juicer
juicer/utils/texttable.py
Texttable.set_cols_width
def set_cols_width(self, array): """Set the desired columns width - the elements of the array should be integers, specifying the width of each column. For example: [10, 20, 5] """ self._check_row_size(array) try: array = map(int, array) ...
python
def set_cols_width(self, array): """Set the desired columns width - the elements of the array should be integers, specifying the width of each column. For example: [10, 20, 5] """ self._check_row_size(array) try: array = map(int, array) ...
[ "def", "set_cols_width", "(", "self", ",", "array", ")", ":", "self", ".", "_check_row_size", "(", "array", ")", "try", ":", "array", "=", "map", "(", "int", ",", "array", ")", "if", "reduce", "(", "min", ",", "array", ")", "<=", "0", ":", "raise",...
Set the desired columns width - the elements of the array should be integers, specifying the width of each column. For example: [10, 20, 5]
[ "Set", "the", "desired", "columns", "width" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/texttable.py#L240-L257
48,639
juicer/juicer
juicer/utils/texttable.py
Texttable._check_row_size
def _check_row_size(self, array): """Check that the specified array fits the previous rows size """ if not self._row_size: self._row_size = len(array) elif self._row_size != len(array): raise ArraySizeError, "array should contain %d elements" \ % ...
python
def _check_row_size(self, array): """Check that the specified array fits the previous rows size """ if not self._row_size: self._row_size = len(array) elif self._row_size != len(array): raise ArraySizeError, "array should contain %d elements" \ % ...
[ "def", "_check_row_size", "(", "self", ",", "array", ")", ":", "if", "not", "self", ".", "_row_size", ":", "self", ".", "_row_size", "=", "len", "(", "array", ")", "elif", "self", ".", "_row_size", "!=", "len", "(", "array", ")", ":", "raise", "Array...
Check that the specified array fits the previous rows size
[ "Check", "that", "the", "specified", "array", "fits", "the", "previous", "rows", "size" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/texttable.py#L286-L294
48,640
juicer/juicer
juicer/utils/texttable.py
Texttable._check_align
def _check_align(self): """Check if alignment has been specified, set default one if not """ if not hasattr(self, "_align"): self._align = ["l"]*self._row_size if not hasattr(self, "_valign"): self._valign = ["t"]*self._row_size
python
def _check_align(self): """Check if alignment has been specified, set default one if not """ if not hasattr(self, "_align"): self._align = ["l"]*self._row_size if not hasattr(self, "_valign"): self._valign = ["t"]*self._row_size
[ "def", "_check_align", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_align\"", ")", ":", "self", ".", "_align", "=", "[", "\"l\"", "]", "*", "self", ".", "_row_size", "if", "not", "hasattr", "(", "self", ",", "\"_valign\"", ")"...
Check if alignment has been specified, set default one if not
[ "Check", "if", "alignment", "has", "been", "specified", "set", "default", "one", "if", "not" ]
0c9f0fd59e293d45df6b46e81f675d33221c600d
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/texttable.py#L399-L406
48,641
happyleavesaoc/python-limitlessled
limitlessled/util.py
transition
def transition(value, maximum, start, end): """ Transition between two values. :param value: Current iteration. :param maximum: Maximum number of iterations. :param start: Start value. :param end: End value. :returns: Transitional value. """ return round(start + (end - start) * value / ...
python
def transition(value, maximum, start, end): """ Transition between two values. :param value: Current iteration. :param maximum: Maximum number of iterations. :param start: Start value. :param end: End value. :returns: Transitional value. """ return round(start + (end - start) * value / ...
[ "def", "transition", "(", "value", ",", "maximum", ",", "start", ",", "end", ")", ":", "return", "round", "(", "start", "+", "(", "end", "-", "start", ")", "*", "value", "/", "maximum", ",", "2", ")" ]
Transition between two values. :param value: Current iteration. :param maximum: Maximum number of iterations. :param start: Start value. :param end: End value. :returns: Transitional value.
[ "Transition", "between", "two", "values", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/util.py#L36-L45
48,642
happyleavesaoc/python-limitlessled
limitlessled/util.py
steps
def steps(current, target, max_steps): """ Steps between two values. :param current: Current value (0.0-1.0). :param target: Target value (0.0-1.0). :param max_steps: Maximum number of steps. """ if current < 0 or current > 1.0: raise ValueError("current value %s is out of bounds (0.0-1...
python
def steps(current, target, max_steps): """ Steps between two values. :param current: Current value (0.0-1.0). :param target: Target value (0.0-1.0). :param max_steps: Maximum number of steps. """ if current < 0 or current > 1.0: raise ValueError("current value %s is out of bounds (0.0-1...
[ "def", "steps", "(", "current", ",", "target", ",", "max_steps", ")", ":", "if", "current", "<", "0", "or", "current", ">", "1.0", ":", "raise", "ValueError", "(", "\"current value %s is out of bounds (0.0-1.0)\"", ",", "current", ")", "if", "target", "<", "...
Steps between two values. :param current: Current value (0.0-1.0). :param target: Target value (0.0-1.0). :param max_steps: Maximum number of steps.
[ "Steps", "between", "two", "values", "." ]
70307c2bf8c91430a99579d2ad18b228ec7a8488
https://github.com/happyleavesaoc/python-limitlessled/blob/70307c2bf8c91430a99579d2ad18b228ec7a8488/limitlessled/util.py#L48-L59
48,643
stormpath/stormpath-django
django_stormpath/forms.py
StormpathUserCreationForm.clean_email
def clean_email(self): """Check if email exists on Stormpath. The email address is unique across all Stormpath applications. The username is only unique within a Stormpath application. """ try: accounts = APPLICATION.accounts.search({'email': self.cleaned_data['email...
python
def clean_email(self): """Check if email exists on Stormpath. The email address is unique across all Stormpath applications. The username is only unique within a Stormpath application. """ try: accounts = APPLICATION.accounts.search({'email': self.cleaned_data['email...
[ "def", "clean_email", "(", "self", ")", ":", "try", ":", "accounts", "=", "APPLICATION", ".", "accounts", ".", "search", "(", "{", "'email'", ":", "self", ".", "cleaned_data", "[", "'email'", "]", "}", ")", "if", "len", "(", "accounts", ")", ":", "ms...
Check if email exists on Stormpath. The email address is unique across all Stormpath applications. The username is only unique within a Stormpath application.
[ "Check", "if", "email", "exists", "on", "Stormpath", "." ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/forms.py#L60-L74
48,644
stormpath/stormpath-django
django_stormpath/forms.py
PasswordResetForm.clean_new_password2
def clean_new_password2(self): """Check if passwords match and are valid.""" password1 = self.cleaned_data.get('new_password1') password2 = self.cleaned_data.get('new_password2') try: directory = APPLICATION.default_account_store_mapping.account_store directory.p...
python
def clean_new_password2(self): """Check if passwords match and are valid.""" password1 = self.cleaned_data.get('new_password1') password2 = self.cleaned_data.get('new_password2') try: directory = APPLICATION.default_account_store_mapping.account_store directory.p...
[ "def", "clean_new_password2", "(", "self", ")", ":", "password1", "=", "self", ".", "cleaned_data", ".", "get", "(", "'new_password1'", ")", "password2", "=", "self", ".", "cleaned_data", ".", "get", "(", "'new_password2'", ")", "try", ":", "directory", "=",...
Check if passwords match and are valid.
[ "Check", "if", "passwords", "match", "and", "are", "valid", "." ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/forms.py#L118-L133
48,645
stormpath/stormpath-django
django_stormpath/social.py
create_provider_directory
def create_provider_directory(provider, redirect_uri): """Helper function for creating a provider directory""" dir = CLIENT.directories.create({ 'name': APPLICATION.name + '-' + provider, 'provider': { 'client_id': settings.STORMPATH_SOCIAL[provider.upper()]['client_id'], ...
python
def create_provider_directory(provider, redirect_uri): """Helper function for creating a provider directory""" dir = CLIENT.directories.create({ 'name': APPLICATION.name + '-' + provider, 'provider': { 'client_id': settings.STORMPATH_SOCIAL[provider.upper()]['client_id'], ...
[ "def", "create_provider_directory", "(", "provider", ",", "redirect_uri", ")", ":", "dir", "=", "CLIENT", ".", "directories", ".", "create", "(", "{", "'name'", ":", "APPLICATION", ".", "name", "+", "'-'", "+", "provider", ",", "'provider'", ":", "{", "'cl...
Helper function for creating a provider directory
[ "Helper", "function", "for", "creating", "a", "provider", "directory" ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/social.py#L126-L144
48,646
mwolff44/django-simple-invoice
invoice/pdf_example.py
draw_header
def draw_header(canvas): """ Draws the invoice header """ canvas.setStrokeColorRGB(0.9, 0.5, 0.2) canvas.setFillColorRGB(0.2, 0.2, 0.2) canvas.setFont('Helvetica', 16) canvas.drawString(18 * cm, -1 * cm, 'Invoice') canvas.drawInlineImage(settings.INV_LOGO, 1 * cm, -1 * cm, 250, 16) canvas.se...
python
def draw_header(canvas): """ Draws the invoice header """ canvas.setStrokeColorRGB(0.9, 0.5, 0.2) canvas.setFillColorRGB(0.2, 0.2, 0.2) canvas.setFont('Helvetica', 16) canvas.drawString(18 * cm, -1 * cm, 'Invoice') canvas.drawInlineImage(settings.INV_LOGO, 1 * cm, -1 * cm, 250, 16) canvas.se...
[ "def", "draw_header", "(", "canvas", ")", ":", "canvas", ".", "setStrokeColorRGB", "(", "0.9", ",", "0.5", ",", "0.2", ")", "canvas", ".", "setFillColorRGB", "(", "0.2", ",", "0.2", ",", "0.2", ")", "canvas", ".", "setFont", "(", "'Helvetica'", ",", "1...
Draws the invoice header
[ "Draws", "the", "invoice", "header" ]
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/pdf_example.py#L16-L24
48,647
mwolff44/django-simple-invoice
invoice/pdf_example.py
draw_address
def draw_address(canvas): """ Draws the business address """ business_details = ( u'COMPANY NAME LTD', u'STREET', u'TOWN', U'COUNTY', U'POSTCODE', U'COUNTRY', u'', u'', u'Phone: +00 (0) 000 000 000', u'Email: example@example.com', ...
python
def draw_address(canvas): """ Draws the business address """ business_details = ( u'COMPANY NAME LTD', u'STREET', u'TOWN', U'COUNTY', U'POSTCODE', U'COUNTRY', u'', u'', u'Phone: +00 (0) 000 000 000', u'Email: example@example.com', ...
[ "def", "draw_address", "(", "canvas", ")", ":", "business_details", "=", "(", "u'COMPANY NAME LTD'", ",", "u'STREET'", ",", "u'TOWN'", ",", "U'COUNTY'", ",", "U'POSTCODE'", ",", "U'COUNTRY'", ",", "u''", ",", "u''", ",", "u'Phone: +00 (0) 000 000 000'", ",", "u'...
Draws the business address
[ "Draws", "the", "business", "address" ]
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/pdf_example.py#L27-L47
48,648
mwolff44/django-simple-invoice
invoice/pdf_example.py
draw_footer
def draw_footer(canvas): """ Draws the invoice footer """ note = ( u'Bank Details: Street address, Town, County, POSTCODE', u'Sort Code: 00-00-00 Account No: 00000000 (Quote invoice number).', u'Please pay via bank transfer or cheque. All payments should be made in CURRENCY.', u'...
python
def draw_footer(canvas): """ Draws the invoice footer """ note = ( u'Bank Details: Street address, Town, County, POSTCODE', u'Sort Code: 00-00-00 Account No: 00000000 (Quote invoice number).', u'Please pay via bank transfer or cheque. All payments should be made in CURRENCY.', u'...
[ "def", "draw_footer", "(", "canvas", ")", ":", "note", "=", "(", "u'Bank Details: Street address, Town, County, POSTCODE'", ",", "u'Sort Code: 00-00-00 Account No: 00000000 (Quote invoice number).'", ",", "u'Please pay via bank transfer or cheque. All payments should be made in CURRENCY.'"...
Draws the invoice footer
[ "Draws", "the", "invoice", "footer" ]
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/pdf_example.py#L50-L61
48,649
trentm/cmdln
bin/mkmanpage.py
mkmanpage
def mkmanpage(name): """Return man page content for the given `cmdln.Cmdln` subclass name.""" mod_name, class_name = name.rsplit('.', 1) mod = __import__(mod_name) inst = getattr(mod, class_name)() sections = cmdln.man_sections_from_cmdln(inst) sys.stdout.write(''.join(sections))
python
def mkmanpage(name): """Return man page content for the given `cmdln.Cmdln` subclass name.""" mod_name, class_name = name.rsplit('.', 1) mod = __import__(mod_name) inst = getattr(mod, class_name)() sections = cmdln.man_sections_from_cmdln(inst) sys.stdout.write(''.join(sections))
[ "def", "mkmanpage", "(", "name", ")", ":", "mod_name", ",", "class_name", "=", "name", ".", "rsplit", "(", "'.'", ",", "1", ")", "mod", "=", "__import__", "(", "mod_name", ")", "inst", "=", "getattr", "(", "mod", ",", "class_name", ")", "(", ")", "...
Return man page content for the given `cmdln.Cmdln` subclass name.
[ "Return", "man", "page", "content", "for", "the", "given", "cmdln", ".", "Cmdln", "subclass", "name", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/bin/mkmanpage.py#L18-L24
48,650
trentm/cmdln
examples/svn.py
MySVN.do_add
def do_add(self, subcmd, opts, *args): """Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit. usage: add PATH... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, ...
python
def do_add(self, subcmd, opts, *args): """Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit. usage: add PATH... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, ...
[ "def", "do_add", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit. usage: add PATH... ${cmd_option_list}
[ "Put", "files", "and", "directories", "under", "version", "control", "scheduling", "them", "for", "addition", "to", "repository", ".", "They", "will", "be", "added", "in", "next", "commit", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L46-L56
48,651
trentm/cmdln
examples/svn.py
MySVN.do_blame
def do_blame(self, subcmd, opts, *args): """Output the content of specified files or URLs with revision and author information in-line. usage: blame TARGET... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %s' a...
python
def do_blame(self, subcmd, opts, *args): """Output the content of specified files or URLs with revision and author information in-line. usage: blame TARGET... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %s' a...
[ "def", "do_blame", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Output the content of specified files or URLs with revision and author information in-line. usage: blame TARGET... ${cmd_option_list}
[ "Output", "the", "content", "of", "specified", "files", "or", "URLs", "with", "revision", "and", "author", "information", "in", "-", "line", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L73-L83
48,652
trentm/cmdln
examples/svn.py
MySVN.do_cat
def do_cat(self, subcmd, opts, *args): """Output the content of specified files or URLs. usage: cat TARGET... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %s' args: %s" % (subcmd, args)
python
def do_cat(self, subcmd, opts, *args): """Output the content of specified files or URLs. usage: cat TARGET... ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %s' args: %s" % (subcmd, args)
[ "def", "do_cat", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Output the content of specified files or URLs. usage: cat TARGET... ${cmd_option_list}
[ "Output", "the", "content", "of", "specified", "files", "or", "URLs", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L97-L106
48,653
trentm/cmdln
examples/svn.py
MySVN.do_checkout
def do_checkout(self, subcmd, opts, *args): """Check out a working copy from a repository. usage: checkout URL... [PATH] Note: If PATH is omitted, the basename of the URL will be used as the destination. If multiple URLs are given each will be checked out in...
python
def do_checkout(self, subcmd, opts, *args): """Check out a working copy from a repository. usage: checkout URL... [PATH] Note: If PATH is omitted, the basename of the URL will be used as the destination. If multiple URLs are given each will be checked out in...
[ "def", "do_checkout", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Check out a working copy from a repository. usage: checkout URL... [PATH] Note: If PATH is omitted, the basename of the URL will be used as the destination. If multiple URLs are given each will be checked out into a sub-directory of PATH, with the name of the sub-di...
[ "Check", "out", "a", "working", "copy", "from", "a", "repository", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L125-L139
48,654
trentm/cmdln
examples/svn.py
MySVN.do_cleanup
def do_cleanup(self, subcmd, opts, *args): """Recursively clean up the working copy, removing locks, resuming unfinished operations, etc. usage: cleanup [PATH...] ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %...
python
def do_cleanup(self, subcmd, opts, *args): """Recursively clean up the working copy, removing locks, resuming unfinished operations, etc. usage: cleanup [PATH...] ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %...
[ "def", "do_cleanup", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Recursively clean up the working copy, removing locks, resuming unfinished operations, etc. usage: cleanup [PATH...] ${cmd_option_list}
[ "Recursively", "clean", "up", "the", "working", "copy", "removing", "locks", "resuming", "unfinished", "operations", "etc", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L145-L155
48,655
trentm/cmdln
examples/svn.py
MySVN.do_commit
def do_commit(self, subcmd, opts, *args): """Send changes from your working copy to the repository. usage: commit [PATH...] A log message must be provided, but it can be empty. If it is not given by a --message or --file option, an editor will be started. ...
python
def do_commit(self, subcmd, opts, *args): """Send changes from your working copy to the repository. usage: commit [PATH...] A log message must be provided, but it can be empty. If it is not given by a --message or --file option, an editor will be started. ...
[ "def", "do_commit", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Send changes from your working copy to the repository. usage: commit [PATH...] A log message must be provided, but it can be empty. If it is not given by a --message or --file option, an editor will be started. ${cmd_option_list}
[ "Send", "changes", "from", "your", "working", "copy", "to", "the", "repository", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L184-L196
48,656
trentm/cmdln
examples/svn.py
MySVN.do_copy
def do_copy(self, subcmd, opts, *args): """Duplicate something in working copy or repository, remembering history. usage: copy SRC DST SRC and DST can each be either a working copy (WC) path or URL: WC -> WC: copy and schedule for addition (with history) ...
python
def do_copy(self, subcmd, opts, *args): """Duplicate something in working copy or repository, remembering history. usage: copy SRC DST SRC and DST can each be either a working copy (WC) path or URL: WC -> WC: copy and schedule for addition (with history) ...
[ "def", "do_copy", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Duplicate something in working copy or repository, remembering history. usage: copy SRC DST SRC and DST can each be either a working copy (WC) path or URL: WC -> WC: copy and schedule for addition (with history) WC -> URL: immediately commit a copy of WC to...
[ "Duplicate", "something", "in", "working", "copy", "or", "repository", "remembering", "history", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L223-L238
48,657
trentm/cmdln
examples/svn.py
MySVN.do_delete
def do_delete(self, subcmd, opts, *args): """Remove files and directories from version control. usage: 1. delete PATH... 2. delete URL... 1. Each item specified by a PATH is scheduled for deletion upon the next commit. Files, and directories that have...
python
def do_delete(self, subcmd, opts, *args): """Remove files and directories from version control. usage: 1. delete PATH... 2. delete URL... 1. Each item specified by a PATH is scheduled for deletion upon the next commit. Files, and directories that have...
[ "def", "do_delete", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Remove files and directories from version control. usage: 1. delete PATH... 2. delete URL... 1. Each item specified by a PATH is scheduled for deletion upon the next commit. Files, and directories that have not been committed, are immediately remove...
[ "Remove", "files", "and", "directories", "from", "version", "control", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L267-L286
48,658
trentm/cmdln
examples/svn.py
MySVN.do_diff
def do_diff(self, subcmd, opts, *args): """Display the differences between two paths. usage: 1. diff [-r N[:M]] [TARGET[@REV]...] 2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \ [PATH...] 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWR...
python
def do_diff(self, subcmd, opts, *args): """Display the differences between two paths. usage: 1. diff [-r N[:M]] [TARGET[@REV]...] 2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \ [PATH...] 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWR...
[ "def", "do_diff", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Display the differences between two paths. usage: 1. diff [-r N[:M]] [TARGET[@REV]...] 2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \ [PATH...] 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV] 1. Display the changes made to...
[ "Display", "the", "differences", "between", "two", "paths", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L315-L345
48,659
trentm/cmdln
examples/svn.py
MySVN.do_import
def do_import(self, subcmd, opts, *args): """Commit an unversioned file or tree into the repository. usage: import [PATH] URL Recursively commit a copy of PATH to URL. If PATH is omitted '.' is assumed. Parent directories are created as necessary in the rep...
python
def do_import(self, subcmd, opts, *args): """Commit an unversioned file or tree into the repository. usage: import [PATH] URL Recursively commit a copy of PATH to URL. If PATH is omitted '.' is assumed. Parent directories are created as necessary in the rep...
[ "def", "do_import", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Commit an unversioned file or tree into the repository. usage: import [PATH] URL Recursively commit a copy of PATH to URL. If PATH is omitted '.' is assumed. Parent directories are created as necessary in the repository. ${cmd_option_list}
[ "Commit", "an", "unversioned", "file", "or", "tree", "into", "the", "repository", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L418-L431
48,660
trentm/cmdln
examples/svn.py
MySVN.do_info
def do_info(self, subcmd, opts, *args): """Display information about a file or directory. usage: info [PATH...] Print information about each PATH (default: '.'). ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %...
python
def do_info(self, subcmd, opts, *args): """Display information about a file or directory. usage: info [PATH...] Print information about each PATH (default: '.'). ${cmd_option_list} """ print "'svn %s' opts: %s" % (subcmd, opts) print "'svn %...
[ "def", "do_info", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Display information about a file or directory. usage: info [PATH...] Print information about each PATH (default: '.'). ${cmd_option_list}
[ "Display", "information", "about", "a", "file", "or", "directory", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L439-L450
48,661
trentm/cmdln
examples/svn.py
MySVN.do_list
def do_list(self, subcmd, opts, *args): """List directory entries in the repository. usage: list [TARGET...] List each TARGET file and the contents of each TARGET directory as they exist in the repository. If TARGET is a working copy path, the corresponding...
python
def do_list(self, subcmd, opts, *args): """List directory entries in the repository. usage: list [TARGET...] List each TARGET file and the contents of each TARGET directory as they exist in the repository. If TARGET is a working copy path, the corresponding...
[ "def", "do_list", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
List directory entries in the repository. usage: list [TARGET...] List each TARGET file and the contents of each TARGET directory as they exist in the repository. If TARGET is a working copy path, the corresponding repository URL will be used. The ...
[ "List", "directory", "entries", "in", "the", "repository", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L469-L492
48,662
trentm/cmdln
examples/svn.py
MySVN.do_merge
def do_merge(self, subcmd, opts, *args): """Apply the differences between two sources to a working copy path. usage: 1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH] 2. merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH] 3. merge -r N:M SOURCE[@REV] [WCPATH] ...
python
def do_merge(self, subcmd, opts, *args): """Apply the differences between two sources to a working copy path. usage: 1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH] 2. merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH] 3. merge -r N:M SOURCE[@REV] [WCPATH] ...
[ "def", "do_merge", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Apply the differences between two sources to a working copy path. usage: 1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH] 2. merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH] 3. merge -r N:M SOURCE[@REV] [WCPATH] 1. In the first form, the source URLs are specifi...
[ "Apply", "the", "differences", "between", "two", "sources", "to", "a", "working", "copy", "path", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L575-L604
48,663
trentm/cmdln
examples/svn.py
MySVN.do_mkdir
def do_mkdir(self, subcmd, opts, *args): """Create a new directory under version control. usage: 1. mkdir PATH... 2. mkdir URL... Create version controlled directories. 1. Each directory specified by a working copy PATH is created locally ...
python
def do_mkdir(self, subcmd, opts, *args): """Create a new directory under version control. usage: 1. mkdir PATH... 2. mkdir URL... Create version controlled directories. 1. Each directory specified by a working copy PATH is created locally ...
[ "def", "do_mkdir", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Create a new directory under version control. usage: 1. mkdir PATH... 2. mkdir URL... Create version controlled directories. 1. Each directory specified by a working copy PATH is created locally and scheduled for addition upon the next commit....
[ "Create", "a", "new", "directory", "under", "version", "control", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L628-L648
48,664
trentm/cmdln
examples/svn.py
MySVN.do_propdel
def do_propdel(self, subcmd, opts, *args): """Remove PROPNAME from files, dirs, or revisions. usage: 1. propdel PROPNAME [PATH...] 2. propdel PROPNAME --revprop -r REV [URL] 1. Removes versioned props in working copy. 2. Removes unversioned remote prop o...
python
def do_propdel(self, subcmd, opts, *args): """Remove PROPNAME from files, dirs, or revisions. usage: 1. propdel PROPNAME [PATH...] 2. propdel PROPNAME --revprop -r REV [URL] 1. Removes versioned props in working copy. 2. Removes unversioned remote prop o...
[ "def", "do_propdel", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Remove PROPNAME from files, dirs, or revisions. usage: 1. propdel PROPNAME [PATH...] 2. propdel PROPNAME --revprop -r REV [URL] 1. Removes versioned props in working copy. 2. Removes unversioned remote prop on repos revision. ${cmd_option_list}
[ "Remove", "PROPNAME", "from", "files", "dirs", "or", "revisions", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L713-L726
48,665
trentm/cmdln
examples/svn.py
MySVN.do_propedit
def do_propedit(self, subcmd, opts, *args): """Edit property PROPNAME with an external editor on targets. usage: 1. propedit PROPNAME PATH... 2. propedit PROPNAME --revprop -r REV [URL] 1. Edits versioned props in working copy. 2. Edits unversioned remot...
python
def do_propedit(self, subcmd, opts, *args): """Edit property PROPNAME with an external editor on targets. usage: 1. propedit PROPNAME PATH... 2. propedit PROPNAME --revprop -r REV [URL] 1. Edits versioned props in working copy. 2. Edits unversioned remot...
[ "def", "do_propedit", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Edit property PROPNAME with an external editor on targets. usage: 1. propedit PROPNAME PATH... 2. propedit PROPNAME --revprop -r REV [URL] 1. Edits versioned props in working copy. 2. Edits unversioned remote prop on repos revision. ${cmd_option_list}
[ "Edit", "property", "PROPNAME", "with", "an", "external", "editor", "on", "targets", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L749-L762
48,666
trentm/cmdln
examples/svn.py
MySVN.do_propget
def do_propget(self, subcmd, opts, *args): """Print value of PROPNAME on files, dirs, or revisions. usage: 1. propget PROPNAME [PATH...] 2. propget PROPNAME --revprop -r REV [URL] 1. Prints versioned prop in working copy. 2. Prints unversioned remote pro...
python
def do_propget(self, subcmd, opts, *args): """Print value of PROPNAME on files, dirs, or revisions. usage: 1. propget PROPNAME [PATH...] 2. propget PROPNAME --revprop -r REV [URL] 1. Prints versioned prop in working copy. 2. Prints unversioned remote pro...
[ "def", "do_propget", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Print value of PROPNAME on files, dirs, or revisions. usage: 1. propget PROPNAME [PATH...] 2. propget PROPNAME --revprop -r REV [URL] 1. Prints versioned prop in working copy. 2. Prints unversioned remote prop on repos revision. By default, this...
[ "Print", "value", "of", "PROPNAME", "on", "files", "dirs", "or", "revisions", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L783-L803
48,667
trentm/cmdln
examples/svn.py
MySVN.do_proplist
def do_proplist(self, subcmd, opts, *args): """List all properties on files, dirs, or revisions. usage: 1. proplist [PATH...] 2. proplist --revprop -r REV [URL] 1. Lists versioned props in working copy. 2. Lists unversioned remote props on repos revision...
python
def do_proplist(self, subcmd, opts, *args): """List all properties on files, dirs, or revisions. usage: 1. proplist [PATH...] 2. proplist --revprop -r REV [URL] 1. Lists versioned props in working copy. 2. Lists unversioned remote props on repos revision...
[ "def", "do_proplist", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
List all properties on files, dirs, or revisions. usage: 1. proplist [PATH...] 2. proplist --revprop -r REV [URL] 1. Lists versioned props in working copy. 2. Lists unversioned remote props on repos revision. ${cmd_option_list}
[ "List", "all", "properties", "on", "files", "dirs", "or", "revisions", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L826-L839
48,668
trentm/cmdln
examples/svn.py
MySVN.do_propset
def do_propset(self, subcmd, opts, *args): """Set PROPNAME to PROPVAL on files, dirs, or revisions. usage: 1. propset PROPNAME [PROPVAL | -F VALFILE] PATH... 2. propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [URL] 1. Creates a versioned, local propchan...
python
def do_propset(self, subcmd, opts, *args): """Set PROPNAME to PROPVAL on files, dirs, or revisions. usage: 1. propset PROPNAME [PROPVAL | -F VALFILE] PATH... 2. propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [URL] 1. Creates a versioned, local propchan...
[ "def", "do_propset", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Set PROPNAME to PROPVAL on files, dirs, or revisions. usage: 1. propset PROPNAME [PROPVAL | -F VALFILE] PATH... 2. propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [URL] 1. Creates a versioned, local propchange in working copy. 2. Creates an unversioned,...
[ "Set", "PROPNAME", "to", "PROPVAL", "on", "files", "dirs", "or", "revisions", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L868-L907
48,669
trentm/cmdln
examples/svn.py
MySVN.do_resolved
def do_resolved(self, subcmd, opts, *args): """Remove 'conflicted' state on working copy files or directories. usage: resolved PATH... Note: this subcommand does not semantically resolve conflicts or remove conflict markers; it merely removes the conflict-related ...
python
def do_resolved(self, subcmd, opts, *args): """Remove 'conflicted' state on working copy files or directories. usage: resolved PATH... Note: this subcommand does not semantically resolve conflicts or remove conflict markers; it merely removes the conflict-related ...
[ "def", "do_resolved", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Remove 'conflicted' state on working copy files or directories. usage: resolved PATH... Note: this subcommand does not semantically resolve conflicts or remove conflict markers; it merely removes the conflict-related artifact files and allows PATH to be committed a...
[ "Remove", "conflicted", "state", "on", "working", "copy", "files", "or", "directories", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L917-L930
48,670
trentm/cmdln
examples/svn.py
MySVN.do_status
def do_status(self, subcmd, opts, *args): """Print the status of working copy files and directories. usage: status [PATH...] With no args, print only locally modified items (no network access). With -u, add working revision and server out-of-date information. ...
python
def do_status(self, subcmd, opts, *args): """Print the status of working copy files and directories. usage: status [PATH...] With no args, print only locally modified items (no network access). With -u, add working revision and server out-of-date information. ...
[ "def", "do_status", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Print the status of working copy files and directories. usage: status [PATH...] With no args, print only locally modified items (no network access). With -u, add working revision and server out-of-date information. With -v, print full revision information on every i...
[ "Print", "the", "status", "of", "working", "copy", "files", "and", "directories", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L975-L1044
48,671
trentm/cmdln
examples/svn.py
MySVN.do_switch
def do_switch(self, subcmd, opts, *args): """Update the working copy to a different URL. usage: 1. switch URL [PATH] 2. switch --relocate FROM TO [PATH...] 1. Update the working copy to mirror a new URL within the repository. This behaviour is similar...
python
def do_switch(self, subcmd, opts, *args): """Update the working copy to a different URL. usage: 1. switch URL [PATH] 2. switch --relocate FROM TO [PATH...] 1. Update the working copy to mirror a new URL within the repository. This behaviour is similar...
[ "def", "do_switch", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Update the working copy to a different URL. usage: 1. switch URL [PATH] 2. switch --relocate FROM TO [PATH...] 1. Update the working copy to mirror a new URL within the repository. This behaviour is similar to 'svn update', and is the way to move a...
[ "Update", "the", "working", "copy", "to", "a", "different", "URL", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L1067-L1086
48,672
trentm/cmdln
examples/svn.py
MySVN.do_update
def do_update(self, subcmd, opts, *args): """Bring changes from the repository into the working copy. usage: update [PATH...] If no revision given, bring working copy up-to-date with HEAD rev. Else synchronize working copy to revision given by -r. F...
python
def do_update(self, subcmd, opts, *args): """Bring changes from the repository into the working copy. usage: update [PATH...] If no revision given, bring working copy up-to-date with HEAD rev. Else synchronize working copy to revision given by -r. F...
[ "def", "do_update", "(", "self", ",", "subcmd", ",", "opts", ",", "*", "args", ")", ":", "print", "\"'svn %s' opts: %s\"", "%", "(", "subcmd", ",", "opts", ")", "print", "\"'svn %s' args: %s\"", "%", "(", "subcmd", ",", "args", ")" ]
Bring changes from the repository into the working copy. usage: update [PATH...] If no revision given, bring working copy up-to-date with HEAD rev. Else synchronize working copy to revision given by -r. For each updated item a line will start with a charact...
[ "Bring", "changes", "from", "the", "repository", "into", "the", "working", "copy", "." ]
55e980cf52c9b03e62d2349a7e62c9101d08ae10
https://github.com/trentm/cmdln/blob/55e980cf52c9b03e62d2349a7e62c9101d08ae10/examples/svn.py#L1107-L1131
48,673
stefanfoulis/django-class-based-auth-views
class_based_auth_views/utils.py
default_redirect
def default_redirect(request, fallback_url, **kwargs): """ Evaluates a redirect url by consulting GET, POST and the session. """ redirect_field_name = kwargs.get("redirect_field_name", "next") next = request.POST.get(redirect_field_name, request.GET.get(redirect_field_nam...
python
def default_redirect(request, fallback_url, **kwargs): """ Evaluates a redirect url by consulting GET, POST and the session. """ redirect_field_name = kwargs.get("redirect_field_name", "next") next = request.POST.get(redirect_field_name, request.GET.get(redirect_field_nam...
[ "def", "default_redirect", "(", "request", ",", "fallback_url", ",", "*", "*", "kwargs", ")", ":", "redirect_field_name", "=", "kwargs", ".", "get", "(", "\"redirect_field_name\"", ",", "\"next\"", ")", "next", "=", "request", ".", "POST", ".", "get", "(", ...
Evaluates a redirect url by consulting GET, POST and the session.
[ "Evaluates", "a", "redirect", "url", "by", "consulting", "GET", "POST", "and", "the", "session", "." ]
9998e2b8c1e5714c33a774a23c1a07d7a5928597
https://github.com/stefanfoulis/django-class-based-auth-views/blob/9998e2b8c1e5714c33a774a23c1a07d7a5928597/class_based_auth_views/utils.py#L10-L32
48,674
maximkulkin/lollipop
lollipop/errors.py
ValidationErrorBuilder.add_error
def add_error(self, path, error): """Add error message for given field path. Example: :: builder = ValidationErrorBuilder() builder.add_error('foo.bar.baz', 'Some error') print builder.errors # => {'foo': {'bar': {'baz': 'Some error'}}} :param s...
python
def add_error(self, path, error): """Add error message for given field path. Example: :: builder = ValidationErrorBuilder() builder.add_error('foo.bar.baz', 'Some error') print builder.errors # => {'foo': {'bar': {'baz': 'Some error'}}} :param s...
[ "def", "add_error", "(", "self", ",", "path", ",", "error", ")", ":", "self", ".", "errors", "=", "merge_errors", "(", "self", ".", "errors", ",", "self", ".", "_make_error", "(", "path", ",", "error", ")", ")" ]
Add error message for given field path. Example: :: builder = ValidationErrorBuilder() builder.add_error('foo.bar.baz', 'Some error') print builder.errors # => {'foo': {'bar': {'baz': 'Some error'}}} :param str path: '.'-separated list of field names ...
[ "Add", "error", "message", "for", "given", "field", "path", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/errors.py#L147-L160
48,675
mwolff44/django-simple-invoice
invoice/utils/friendly_id.py
find_suitable_period
def find_suitable_period(): """ Automatically find a suitable period to use. Factors are best, because they will have 1 left over when dividing SIZE+1. This only needs to be run once, on import. """ # The highest acceptable factor will be the square root of the size. highest_acce...
python
def find_suitable_period(): """ Automatically find a suitable period to use. Factors are best, because they will have 1 left over when dividing SIZE+1. This only needs to be run once, on import. """ # The highest acceptable factor will be the square root of the size. highest_acce...
[ "def", "find_suitable_period", "(", ")", ":", "# The highest acceptable factor will be the square root of the size.", "highest_acceptable_factor", "=", "int", "(", "math", ".", "sqrt", "(", "SIZE", ")", ")", "# Too high a factor (eg SIZE/2) and the interval is too small, too", "#...
Automatically find a suitable period to use. Factors are best, because they will have 1 left over when dividing SIZE+1. This only needs to be run once, on import.
[ "Automatically", "find", "a", "suitable", "period", "to", "use", ".", "Factors", "are", "best", "because", "they", "will", "have", "1", "left", "over", "when", "dividing", "SIZE", "+", "1", ".", "This", "only", "needs", "to", "be", "run", "once", "on", ...
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/utils/friendly_id.py#L55-L75
48,676
mwolff44/django-simple-invoice
invoice/utils/friendly_id.py
friendly_number
def friendly_number(num): """ Convert a base 10 number to a base X string. Charcters from VALID_CHARS are chosen, to convert the number to eg base 24, if there are 24 characters to choose from. Use valid chars to choose characters that are friendly, avoiding ones that could be confus...
python
def friendly_number(num): """ Convert a base 10 number to a base X string. Charcters from VALID_CHARS are chosen, to convert the number to eg base 24, if there are 24 characters to choose from. Use valid chars to choose characters that are friendly, avoiding ones that could be confus...
[ "def", "friendly_number", "(", "num", ")", ":", "# Convert to a (shorter) string for human consumption", "string", "=", "\"\"", "# The length of the string can be determined by STRING_LENGTH or by how many", "# characters are necessary to present a base 30 representation of SIZE.", "while", ...
Convert a base 10 number to a base X string. Charcters from VALID_CHARS are chosen, to convert the number to eg base 24, if there are 24 characters to choose from. Use valid chars to choose characters that are friendly, avoiding ones that could be confused in print or over the phone.
[ "Convert", "a", "base", "10", "number", "to", "a", "base", "X", "string", ".", "Charcters", "from", "VALID_CHARS", "are", "chosen", "to", "convert", "the", "number", "to", "eg", "base", "24", "if", "there", "are", "24", "characters", "to", "choose", "fro...
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/utils/friendly_id.py#L89-L105
48,677
happyleavesaoc/python-fedexdeliverymanager
fedexdeliverymanager/__init__.py
_login
def _login(session): """Login to Fedex Delivery Manager.""" session.get(LOGIN_REFERER) resp = session.post(LOGIN_URL, { 'user': session.auth.username, 'pwd': session.auth.password }, headers={ 'Referer': LOGIN_REFERER, 'X-Requested-With': 'XMLHttpRequest' }) if re...
python
def _login(session): """Login to Fedex Delivery Manager.""" session.get(LOGIN_REFERER) resp = session.post(LOGIN_URL, { 'user': session.auth.username, 'pwd': session.auth.password }, headers={ 'Referer': LOGIN_REFERER, 'X-Requested-With': 'XMLHttpRequest' }) if re...
[ "def", "_login", "(", "session", ")", ":", "session", ".", "get", "(", "LOGIN_REFERER", ")", "resp", "=", "session", ".", "post", "(", "LOGIN_URL", ",", "{", "'user'", ":", "session", ".", "auth", ".", "username", ",", "'pwd'", ":", "session", ".", "...
Login to Fedex Delivery Manager.
[ "Login", "to", "Fedex", "Delivery", "Manager", "." ]
cff2f1104a86573569500d41e69be54b90b596c6
https://github.com/happyleavesaoc/python-fedexdeliverymanager/blob/cff2f1104a86573569500d41e69be54b90b596c6/fedexdeliverymanager/__init__.py#L71-L86
48,678
happyleavesaoc/python-fedexdeliverymanager
fedexdeliverymanager/__init__.py
get_packages
def get_packages(session): """Get packages.""" resp = session.post(TRACKING_URL, { 'data': json.dumps(SHIPMENT_LIST_REQUEST), 'action': SHIPMENT_LIST_ACTION, 'format': SHIPMENT_LIST_FORMAT, 'locale': session.auth.locale, 'version': 1 }) data = resp.json().get('Shi...
python
def get_packages(session): """Get packages.""" resp = session.post(TRACKING_URL, { 'data': json.dumps(SHIPMENT_LIST_REQUEST), 'action': SHIPMENT_LIST_ACTION, 'format': SHIPMENT_LIST_FORMAT, 'locale': session.auth.locale, 'version': 1 }) data = resp.json().get('Shi...
[ "def", "get_packages", "(", "session", ")", ":", "resp", "=", "session", ".", "post", "(", "TRACKING_URL", ",", "{", "'data'", ":", "json", ".", "dumps", "(", "SHIPMENT_LIST_REQUEST", ")", ",", "'action'", ":", "SHIPMENT_LIST_ACTION", ",", "'format'", ":", ...
Get packages.
[ "Get", "packages", "." ]
cff2f1104a86573569500d41e69be54b90b596c6
https://github.com/happyleavesaoc/python-fedexdeliverymanager/blob/cff2f1104a86573569500d41e69be54b90b596c6/fedexdeliverymanager/__init__.py#L90-L123
48,679
maximkulkin/lollipop
lollipop/types.py
dict_value_hint
def dict_value_hint(key, mapper=None): """Returns a function that takes a dictionary and returns value of particular key. The returned value can be optionally processed by `mapper` function. To be used as a type hint in :class:`OneOf`. """ if mapper is None: mapper = identity def h...
python
def dict_value_hint(key, mapper=None): """Returns a function that takes a dictionary and returns value of particular key. The returned value can be optionally processed by `mapper` function. To be used as a type hint in :class:`OneOf`. """ if mapper is None: mapper = identity def h...
[ "def", "dict_value_hint", "(", "key", ",", "mapper", "=", "None", ")", ":", "if", "mapper", "is", "None", ":", "mapper", "=", "identity", "def", "hinter", "(", "data", ")", ":", "return", "mapper", "(", "data", ".", "get", "(", "key", ")", ")", "re...
Returns a function that takes a dictionary and returns value of particular key. The returned value can be optionally processed by `mapper` function. To be used as a type hint in :class:`OneOf`.
[ "Returns", "a", "function", "that", "takes", "a", "dictionary", "and", "returns", "value", "of", "particular", "key", ".", "The", "returned", "value", "can", "be", "optionally", "processed", "by", "mapper", "function", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/types.py#L603-L616
48,680
maximkulkin/lollipop
lollipop/types.py
validated_type
def validated_type(base_type, name=None, validate=None): """Convenient way to create a new type by adding validation to existing type. Example: :: Ipv4Address = validated_type( String, 'Ipv4Address', # regexp simplified for demo purposes Regexp('^\d+\.\d+\.\d+\.\d+$...
python
def validated_type(base_type, name=None, validate=None): """Convenient way to create a new type by adding validation to existing type. Example: :: Ipv4Address = validated_type( String, 'Ipv4Address', # regexp simplified for demo purposes Regexp('^\d+\.\d+\.\d+\.\d+$...
[ "def", "validated_type", "(", "base_type", ",", "name", "=", "None", ",", "validate", "=", "None", ")", ":", "if", "validate", "is", "None", ":", "validate", "=", "[", "]", "if", "not", "is_sequence", "(", "validate", ")", ":", "validate", "=", "[", ...
Convenient way to create a new type by adding validation to existing type. Example: :: Ipv4Address = validated_type( String, 'Ipv4Address', # regexp simplified for demo purposes Regexp('^\d+\.\d+\.\d+\.\d+$', error='Invalid IP address') ) Percentage = v...
[ "Convenient", "way", "to", "create", "a", "new", "type", "by", "adding", "validation", "to", "existing", "type", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/types.py#L1767-L1812
48,681
maximkulkin/lollipop
lollipop/types.py
Type.validate
def validate(self, data, context=None): """Takes serialized data and returns validation errors or None. :param data: Data to validate. :param context: Context data. :returns: validation errors or None """ try: self.load(data, context) return None ...
python
def validate(self, data, context=None): """Takes serialized data and returns validation errors or None. :param data: Data to validate. :param context: Context data. :returns: validation errors or None """ try: self.load(data, context) return None ...
[ "def", "validate", "(", "self", ",", "data", ",", "context", "=", "None", ")", ":", "try", ":", "self", ".", "load", "(", "data", ",", "context", ")", "return", "None", "except", "ValidationError", "as", "ve", ":", "return", "ve", ".", "messages" ]
Takes serialized data and returns validation errors or None. :param data: Data to validate. :param context: Context data. :returns: validation errors or None
[ "Takes", "serialized", "data", "and", "returns", "validation", "errors", "or", "None", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/types.py#L114-L125
48,682
maximkulkin/lollipop
lollipop/types.py
Object.load_into
def load_into(self, obj, data, inplace=True, *args, **kwargs): """Load data and update existing object. :param obj: Object to update with deserialized data. :param data: Raw data to get value to deserialize from. :param bool inplace: If True update data inplace; otherwise - ...
python
def load_into(self, obj, data, inplace=True, *args, **kwargs): """Load data and update existing object. :param obj: Object to update with deserialized data. :param data: Raw data to get value to deserialize from. :param bool inplace: If True update data inplace; otherwise - ...
[ "def", "load_into", "(", "self", ",", "obj", ",", "data", ",", "inplace", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "obj", "is", "None", ":", "raise", "ValueError", "(", "'Load target should not be None'", ")", "if", "data...
Load data and update existing object. :param obj: Object to update with deserialized data. :param data: Raw data to get value to deserialize from. :param bool inplace: If True update data inplace; otherwise - create new data. :param kwargs: Same keyword arguments as for :met...
[ "Load", "data", "and", "update", "existing", "object", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/types.py#L1450-L1532
48,683
maximkulkin/lollipop
lollipop/types.py
Object.validate_for
def validate_for(self, obj, data, *args, **kwargs): """Takes target object and serialized data, tries to update that object with data and validate result. Returns validation errors or None. Object is not updated. :param obj: Object to check data validity against. In case the data is ...
python
def validate_for(self, obj, data, *args, **kwargs): """Takes target object and serialized data, tries to update that object with data and validate result. Returns validation errors or None. Object is not updated. :param obj: Object to check data validity against. In case the data is ...
[ "def", "validate_for", "(", "self", ",", "obj", ",", "data", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "load_into", "(", "obj", ",", "data", ",", "inplace", "=", "False", ",", "*", "args", ",", "*", "*", "kwa...
Takes target object and serialized data, tries to update that object with data and validate result. Returns validation errors or None. Object is not updated. :param obj: Object to check data validity against. In case the data is partial object is used to get the rest of data from. ...
[ "Takes", "target", "object", "and", "serialized", "data", "tries", "to", "update", "that", "object", "with", "data", "and", "validate", "result", ".", "Returns", "validation", "errors", "or", "None", ".", "Object", "is", "not", "updated", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/types.py#L1534-L1550
48,684
miguelcb84/coc-client
coc/utils.py
filter_country_locations
def filter_country_locations(api_response, is_country=True): """ Filter the response to only include the elements that are countries. This uses the 'api_response' object as input. Plain `list`s are also valid, but they must contain the location elements, not the `items` wrapper. """ ret...
python
def filter_country_locations(api_response, is_country=True): """ Filter the response to only include the elements that are countries. This uses the 'api_response' object as input. Plain `list`s are also valid, but they must contain the location elements, not the `items` wrapper. """ ret...
[ "def", "filter_country_locations", "(", "api_response", ",", "is_country", "=", "True", ")", ":", "return", "[", "item", "for", "item", "in", "api_response", "if", "item", "[", "ISCOUNTRY", "]", "==", "is_country", "]" ]
Filter the response to only include the elements that are countries. This uses the 'api_response' object as input. Plain `list`s are also valid, but they must contain the location elements, not the `items` wrapper.
[ "Filter", "the", "response", "to", "only", "include", "the", "elements", "that", "are", "countries", ".", "This", "uses", "the", "api_response", "object", "as", "input", ".", "Plain", "list", "s", "are", "also", "valid", "but", "they", "must", "contain", "...
7d249211a850538cfc1b5b286dff1d83df443db7
https://github.com/miguelcb84/coc-client/blob/7d249211a850538cfc1b5b286dff1d83df443db7/coc/utils.py#L3-L10
48,685
mwolff44/django-simple-invoice
invoice/models.py
Invoice._get_next_number
def _get_next_number(self): """ Returnes next invoice number - reset yearly. .. warning:: This is only used to prepopulate ``number`` field on saving new invoice. To get invoice number always use ``number`` field. .. note:: To get invoice full numb...
python
def _get_next_number(self): """ Returnes next invoice number - reset yearly. .. warning:: This is only used to prepopulate ``number`` field on saving new invoice. To get invoice number always use ``number`` field. .. note:: To get invoice full numb...
[ "def", "_get_next_number", "(", "self", ")", ":", "# Recupere les facture de l annee", "relative_invoices", "=", "Invoice", ".", "objects", ".", "filter", "(", "invoice_date__year", "=", "self", ".", "invoice_date", ".", "year", ")", "# on prend le numero le plus eleve ...
Returnes next invoice number - reset yearly. .. warning:: This is only used to prepopulate ``number`` field on saving new invoice. To get invoice number always use ``number`` field. .. note:: To get invoice full number use ``invoice_id`` field. :return: s...
[ "Returnes", "next", "invoice", "number", "-", "reset", "yearly", "." ]
ab14d905a69f37cd27e137c039750e6630bce4ef
https://github.com/mwolff44/django-simple-invoice/blob/ab14d905a69f37cd27e137c039750e6630bce4ef/invoice/models.py#L155-L176
48,686
maximkulkin/lollipop
lollipop/utils.py
make_context_aware
def make_context_aware(func, numargs): """ Check if given function has no more arguments than given. If so, wrap it into another function that takes extra argument and drops it. Used to support user providing callback functions that are not context aware. """ try: if inspect.ismethod(fun...
python
def make_context_aware(func, numargs): """ Check if given function has no more arguments than given. If so, wrap it into another function that takes extra argument and drops it. Used to support user providing callback functions that are not context aware. """ try: if inspect.ismethod(fun...
[ "def", "make_context_aware", "(", "func", ",", "numargs", ")", ":", "try", ":", "if", "inspect", ".", "ismethod", "(", "func", ")", ":", "arg_count", "=", "len", "(", "inspect", ".", "getargspec", "(", "func", ")", ".", "args", ")", "-", "1", "elif",...
Check if given function has no more arguments than given. If so, wrap it into another function that takes extra argument and drops it. Used to support user providing callback functions that are not context aware.
[ "Check", "if", "given", "function", "has", "no", "more", "arguments", "than", "given", ".", "If", "so", "wrap", "it", "into", "another", "function", "that", "takes", "extra", "argument", "and", "drops", "it", ".", "Used", "to", "support", "user", "providin...
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/utils.py#L32-L56
48,687
maximkulkin/lollipop
lollipop/utils.py
call_with_context
def call_with_context(func, context, *args): """ Check if given function has more arguments than given. Call it with context as last argument or without it. """ return make_context_aware(func, len(args))(*args + (context,))
python
def call_with_context(func, context, *args): """ Check if given function has more arguments than given. Call it with context as last argument or without it. """ return make_context_aware(func, len(args))(*args + (context,))
[ "def", "call_with_context", "(", "func", ",", "context", ",", "*", "args", ")", ":", "return", "make_context_aware", "(", "func", ",", "len", "(", "args", ")", ")", "(", "*", "args", "+", "(", "context", ",", ")", ")" ]
Check if given function has more arguments than given. Call it with context as last argument or without it.
[ "Check", "if", "given", "function", "has", "more", "arguments", "than", "given", ".", "Call", "it", "with", "context", "as", "last", "argument", "or", "without", "it", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/utils.py#L59-L64
48,688
maximkulkin/lollipop
lollipop/utils.py
to_snake_case
def to_snake_case(s): """Converts camel-case identifiers to snake-case.""" return re.sub('([^_A-Z])([A-Z])', lambda m: m.group(1) + '_' + m.group(2).lower(), s)
python
def to_snake_case(s): """Converts camel-case identifiers to snake-case.""" return re.sub('([^_A-Z])([A-Z])', lambda m: m.group(1) + '_' + m.group(2).lower(), s)
[ "def", "to_snake_case", "(", "s", ")", ":", "return", "re", ".", "sub", "(", "'([^_A-Z])([A-Z])'", ",", "lambda", "m", ":", "m", ".", "group", "(", "1", ")", "+", "'_'", "+", "m", ".", "group", "(", "2", ")", ".", "lower", "(", ")", ",", "s", ...
Converts camel-case identifiers to snake-case.
[ "Converts", "camel", "-", "case", "identifiers", "to", "snake", "-", "case", "." ]
042e8a24508cc3b28630863253c38ffbfc52c882
https://github.com/maximkulkin/lollipop/blob/042e8a24508cc3b28630863253c38ffbfc52c882/lollipop/utils.py#L67-L69
48,689
stormpath/stormpath-django
django_stormpath/helpers.py
validate_settings
def validate_settings(settings): """Ensure all user-supplied settings exist, or throw a useful error message. :param obj settings: The Django settings object. """ if not (settings.STORMPATH_ID and settings.STORMPATH_SECRET): raise ImproperlyConfigured('Both STORMPATH_ID and STORMPATH_SECRET mus...
python
def validate_settings(settings): """Ensure all user-supplied settings exist, or throw a useful error message. :param obj settings: The Django settings object. """ if not (settings.STORMPATH_ID and settings.STORMPATH_SECRET): raise ImproperlyConfigured('Both STORMPATH_ID and STORMPATH_SECRET mus...
[ "def", "validate_settings", "(", "settings", ")", ":", "if", "not", "(", "settings", ".", "STORMPATH_ID", "and", "settings", ".", "STORMPATH_SECRET", ")", ":", "raise", "ImproperlyConfigured", "(", "'Both STORMPATH_ID and STORMPATH_SECRET must be specified in settings.py.'"...
Ensure all user-supplied settings exist, or throw a useful error message. :param obj settings: The Django settings object.
[ "Ensure", "all", "user", "-", "supplied", "settings", "exist", "or", "throw", "a", "useful", "error", "message", "." ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/helpers.py#L7-L16
48,690
stormpath/stormpath-django
django_stormpath/models.py
get_default_is_active
def get_default_is_active(): """ Stormpath user is active by default if e-mail verification is disabled. """ directory = APPLICATION.default_account_store_mapping.account_store verif_email = directory.account_creation_policy.verification_email_status return verif_email == AccountCreationPoli...
python
def get_default_is_active(): """ Stormpath user is active by default if e-mail verification is disabled. """ directory = APPLICATION.default_account_store_mapping.account_store verif_email = directory.account_creation_policy.verification_email_status return verif_email == AccountCreationPoli...
[ "def", "get_default_is_active", "(", ")", ":", "directory", "=", "APPLICATION", ".", "default_account_store_mapping", ".", "account_store", "verif_email", "=", "directory", ".", "account_creation_policy", ".", "verification_email_status", "return", "verif_email", "==", "A...
Stormpath user is active by default if e-mail verification is disabled.
[ "Stormpath", "user", "is", "active", "by", "default", "if", "e", "-", "mail", "verification", "is", "disabled", "." ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/models.py#L48-L55
48,691
stormpath/stormpath-django
django_stormpath/backends.py
StormpathBackend._stormpath_authenticate
def _stormpath_authenticate(self, username, password): """Check if Stormpath authentication works :param username: Can be actual username or email :param password: Account password Returns an account object if successful or None otherwise. """ APPLICATION = get_applicat...
python
def _stormpath_authenticate(self, username, password): """Check if Stormpath authentication works :param username: Can be actual username or email :param password: Account password Returns an account object if successful or None otherwise. """ APPLICATION = get_applicat...
[ "def", "_stormpath_authenticate", "(", "self", ",", "username", ",", "password", ")", ":", "APPLICATION", "=", "get_application", "(", ")", "try", ":", "result", "=", "APPLICATION", ".", "authenticate_account", "(", "username", ",", "password", ")", "return", ...
Check if Stormpath authentication works :param username: Can be actual username or email :param password: Account password Returns an account object if successful or None otherwise.
[ "Check", "if", "Stormpath", "authentication", "works" ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/backends.py#L22-L36
48,692
stormpath/stormpath-django
django_stormpath/backends.py
StormpathBackend._get_group_difference
def _get_group_difference(self, sp_groups): """Helper method for gettings the groups that are present in the local db but not on stormpath and the other way around.""" db_groups = set(Group.objects.all().values_list('name', flat=True)) missing_from_db = set(sp_groups).difference(...
python
def _get_group_difference(self, sp_groups): """Helper method for gettings the groups that are present in the local db but not on stormpath and the other way around.""" db_groups = set(Group.objects.all().values_list('name', flat=True)) missing_from_db = set(sp_groups).difference(...
[ "def", "_get_group_difference", "(", "self", ",", "sp_groups", ")", ":", "db_groups", "=", "set", "(", "Group", ".", "objects", ".", "all", "(", ")", ".", "values_list", "(", "'name'", ",", "flat", "=", "True", ")", ")", "missing_from_db", "=", "set", ...
Helper method for gettings the groups that are present in the local db but not on stormpath and the other way around.
[ "Helper", "method", "for", "gettings", "the", "groups", "that", "are", "present", "in", "the", "local", "db", "but", "not", "on", "stormpath", "and", "the", "other", "way", "around", "." ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/backends.py#L38-L46
48,693
stormpath/stormpath-django
django_stormpath/backends.py
StormpathBackend._mirror_groups_from_stormpath
def _mirror_groups_from_stormpath(self): """Helper method for saving to the local db groups that are missing but are on Stormpath""" APPLICATION = get_application() sp_groups = [g.name for g in APPLICATION.groups] missing_from_db, missing_from_sp = self._get_group_difference(sp_g...
python
def _mirror_groups_from_stormpath(self): """Helper method for saving to the local db groups that are missing but are on Stormpath""" APPLICATION = get_application() sp_groups = [g.name for g in APPLICATION.groups] missing_from_db, missing_from_sp = self._get_group_difference(sp_g...
[ "def", "_mirror_groups_from_stormpath", "(", "self", ")", ":", "APPLICATION", "=", "get_application", "(", ")", "sp_groups", "=", "[", "g", ".", "name", "for", "g", "in", "APPLICATION", ".", "groups", "]", "missing_from_db", ",", "missing_from_sp", "=", "self"...
Helper method for saving to the local db groups that are missing but are on Stormpath
[ "Helper", "method", "for", "saving", "to", "the", "local", "db", "groups", "that", "are", "missing", "but", "are", "on", "Stormpath" ]
af60eb5da2115d94ac313613c5d4e6b9f3d16157
https://github.com/stormpath/stormpath-django/blob/af60eb5da2115d94ac313613c5d4e6b9f3d16157/django_stormpath/backends.py#L48-L61
48,694
edibledinos/pwnypack
pwnypack/fmtstring.py
fmtstring
def fmtstring(offset, writes, written=0, max_width=2, target=None): """ Build a format string that writes given data to given locations. Can be used easily create format strings to exploit format string bugs. `writes` is a list of 2- or 3-item tuples. Each tuple represents a memory write starting w...
python
def fmtstring(offset, writes, written=0, max_width=2, target=None): """ Build a format string that writes given data to given locations. Can be used easily create format strings to exploit format string bugs. `writes` is a list of 2- or 3-item tuples. Each tuple represents a memory write starting w...
[ "def", "fmtstring", "(", "offset", ",", "writes", ",", "written", "=", "0", ",", "max_width", "=", "2", ",", "target", "=", "None", ")", ":", "if", "max_width", "not", "in", "(", "1", ",", "2", ",", "4", ")", ":", "raise", "ValueError", "(", "'ma...
Build a format string that writes given data to given locations. Can be used easily create format strings to exploit format string bugs. `writes` is a list of 2- or 3-item tuples. Each tuple represents a memory write starting with an absolute address, then the data to write as an integer and finally th...
[ "Build", "a", "format", "string", "that", "writes", "given", "data", "to", "given", "locations", ".", "Can", "be", "used", "easily", "create", "format", "strings", "to", "exploit", "format", "string", "bugs", "." ]
e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/fmtstring.py#L21-L99
48,695
RacingTadpole/django-private-media
private_media/views.py
get_class
def get_class(import_path=None): """ Largely based on django.core.files.storage's get_storage_class """ from django.core.exceptions import ImproperlyConfigured if import_path is None: raise ImproperlyConfigured('No class path specified.') try: dot = import_path.rindex('.') ex...
python
def get_class(import_path=None): """ Largely based on django.core.files.storage's get_storage_class """ from django.core.exceptions import ImproperlyConfigured if import_path is None: raise ImproperlyConfigured('No class path specified.') try: dot = import_path.rindex('.') ex...
[ "def", "get_class", "(", "import_path", "=", "None", ")", ":", "from", "django", ".", "core", ".", "exceptions", "import", "ImproperlyConfigured", "if", "import_path", "is", "None", ":", "raise", "ImproperlyConfigured", "(", "'No class path specified.'", ")", "try...
Largely based on django.core.files.storage's get_storage_class
[ "Largely", "based", "on", "django", ".", "core", ".", "files", ".", "storage", "s", "get_storage_class" ]
7510f2f63ddf0653679b4134a0542cd78317a5c8
https://github.com/RacingTadpole/django-private-media/blob/7510f2f63ddf0653679b4134a0542cd78317a5c8/private_media/views.py#L14-L33
48,696
RacingTadpole/django-private-media
private_media/views.py
serve_private_file
def serve_private_file(request, path): """ Serve private files to users with read permission. """ logger.debug('Serving {0} to {1}'.format(path, request.user)) if not permissions.has_read_permission(request, path): if settings.DEBUG: raise PermissionDenied else: ...
python
def serve_private_file(request, path): """ Serve private files to users with read permission. """ logger.debug('Serving {0} to {1}'.format(path, request.user)) if not permissions.has_read_permission(request, path): if settings.DEBUG: raise PermissionDenied else: ...
[ "def", "serve_private_file", "(", "request", ",", "path", ")", ":", "logger", ".", "debug", "(", "'Serving {0} to {1}'", ".", "format", "(", "path", ",", "request", ".", "user", ")", ")", "if", "not", "permissions", ".", "has_read_permission", "(", "request"...
Serve private files to users with read permission.
[ "Serve", "private", "files", "to", "users", "with", "read", "permission", "." ]
7510f2f63ddf0653679b4134a0542cd78317a5c8
https://github.com/RacingTadpole/django-private-media/blob/7510f2f63ddf0653679b4134a0542cd78317a5c8/private_media/views.py#L44-L54
48,697
edibledinos/pwnypack
pwnypack/elf.py
symbols_app
def symbols_app(parser, _, args): # pragma: no cover """ List ELF symbol table. """ parser.add_argument('file', help='ELF file to list the symbols of') parser.add_argument('symbol', nargs='?', help='show only this symbol') parser.add_argument('--exact', '-e', action='store_const', const=True, ...
python
def symbols_app(parser, _, args): # pragma: no cover """ List ELF symbol table. """ parser.add_argument('file', help='ELF file to list the symbols of') parser.add_argument('symbol', nargs='?', help='show only this symbol') parser.add_argument('--exact', '-e', action='store_const', const=True, ...
[ "def", "symbols_app", "(", "parser", ",", "_", ",", "args", ")", ":", "# pragma: no cover", "parser", ".", "add_argument", "(", "'file'", ",", "help", "=", "'ELF file to list the symbols of'", ")", "parser", ".", "add_argument", "(", "'symbol'", ",", "nargs", ...
List ELF symbol table.
[ "List", "ELF", "symbol", "table", "." ]
e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/elf.py#L976-L1023
48,698
edibledinos/pwnypack
pwnypack/elf.py
extract_symbol_app
def extract_symbol_app(parser, _, args): # pragma: no cover """ Extract a symbol from an ELF file. """ parser.add_argument('file', help='ELF file to extract a symbol from') parser.add_argument('symbol', help='the symbol to extract') args = parser.parse_args(args) return ELF(args.file).get_...
python
def extract_symbol_app(parser, _, args): # pragma: no cover """ Extract a symbol from an ELF file. """ parser.add_argument('file', help='ELF file to extract a symbol from') parser.add_argument('symbol', help='the symbol to extract') args = parser.parse_args(args) return ELF(args.file).get_...
[ "def", "extract_symbol_app", "(", "parser", ",", "_", ",", "args", ")", ":", "# pragma: no cover", "parser", ".", "add_argument", "(", "'file'", ",", "help", "=", "'ELF file to extract a symbol from'", ")", "parser", ".", "add_argument", "(", "'symbol'", ",", "h...
Extract a symbol from an ELF file.
[ "Extract", "a", "symbol", "from", "an", "ELF", "file", "." ]
e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/elf.py#L1027-L1035
48,699
edibledinos/pwnypack
pwnypack/elf.py
ELF._parse_header
def _parse_header(self, data): """ Parse the ELF header in ``data`` and populate the properties. Args: data(bytes): The ELF header. """ (magic, word_size, byte_order, version, osabi, abi_version, _), data = \ unpack('4sBBBBB7s', data[:16]), data[16:] ...
python
def _parse_header(self, data): """ Parse the ELF header in ``data`` and populate the properties. Args: data(bytes): The ELF header. """ (magic, word_size, byte_order, version, osabi, abi_version, _), data = \ unpack('4sBBBBB7s', data[:16]), data[16:] ...
[ "def", "_parse_header", "(", "self", ",", "data", ")", ":", "(", "magic", ",", "word_size", ",", "byte_order", ",", "version", ",", "osabi", ",", "abi_version", ",", "_", ")", ",", "data", "=", "unpack", "(", "'4sBBBBB7s'", ",", "data", "[", ":", "16...
Parse the ELF header in ``data`` and populate the properties. Args: data(bytes): The ELF header.
[ "Parse", "the", "ELF", "header", "in", "data", "and", "populate", "the", "properties", "." ]
e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/elf.py#L690-L754