partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Client.cookies
Returns a list of all cookies in cookie string format.
webkit_server.py
def cookies(self): """ Returns a list of all cookies in cookie string format. """ return [line.strip() for line in self.conn.issue_command("GetCookies").split("\n") if line.strip()]
def cookies(self): """ Returns a list of all cookies in cookie string format. """ return [line.strip() for line in self.conn.issue_command("GetCookies").split("\n") if line.strip()]
[ "Returns", "a", "list", "of", "all", "cookies", "in", "cookie", "string", "format", "." ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L301-L305
[ "def", "cookies", "(", "self", ")", ":", "return", "[", "line", ".", "strip", "(", ")", "for", "line", "in", "self", ".", "conn", ".", "issue_command", "(", "\"GetCookies\"", ")", ".", "split", "(", "\"\\n\"", ")", "if", "line", ".", "strip", "(", ...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
Client.set_attribute
Sets a custom attribute for our Webkit instance. Possible attributes are: * ``auto_load_images`` * ``dns_prefetch_enabled`` * ``plugins_enabled`` * ``private_browsing_enabled`` * ``javascript_can_open_windows`` * ``javascript_can_access_clipboard`` * ``offline_storage_database...
webkit_server.py
def set_attribute(self, attr, value = True): """ Sets a custom attribute for our Webkit instance. Possible attributes are: * ``auto_load_images`` * ``dns_prefetch_enabled`` * ``plugins_enabled`` * ``private_browsing_enabled`` * ``javascript_can_open_windows`` * ``javascript_can_...
def set_attribute(self, attr, value = True): """ Sets a custom attribute for our Webkit instance. Possible attributes are: * ``auto_load_images`` * ``dns_prefetch_enabled`` * ``plugins_enabled`` * ``private_browsing_enabled`` * ``javascript_can_open_windows`` * ``javascript_can_...
[ "Sets", "a", "custom", "attribute", "for", "our", "Webkit", "instance", ".", "Possible", "attributes", "are", ":" ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L314-L339
[ "def", "set_attribute", "(", "self", ",", "attr", ",", "value", "=", "True", ")", ":", "value", "=", "\"true\"", "if", "value", "else", "\"false\"", "self", ".", "conn", ".", "issue_command", "(", "\"SetAttribute\"", ",", "self", ".", "_normalize_attr", "(...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
Client.set_html
Sets custom HTML in our Webkit session and allows to specify a fake URL. Scripts and CSS is dynamically fetched as if the HTML had been loaded from the given URL.
webkit_server.py
def set_html(self, html, url = None): """ Sets custom HTML in our Webkit session and allows to specify a fake URL. Scripts and CSS is dynamically fetched as if the HTML had been loaded from the given URL. """ if url: self.conn.issue_command('SetHtml', html, url) else: self.conn.issue_com...
def set_html(self, html, url = None): """ Sets custom HTML in our Webkit session and allows to specify a fake URL. Scripts and CSS is dynamically fetched as if the HTML had been loaded from the given URL. """ if url: self.conn.issue_command('SetHtml', html, url) else: self.conn.issue_com...
[ "Sets", "custom", "HTML", "in", "our", "Webkit", "session", "and", "allows", "to", "specify", "a", "fake", "URL", ".", "Scripts", "and", "CSS", "is", "dynamically", "fetched", "as", "if", "the", "HTML", "had", "been", "loaded", "from", "the", "given", "U...
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L347-L354
[ "def", "set_html", "(", "self", ",", "html", ",", "url", "=", "None", ")", ":", "if", "url", ":", "self", ".", "conn", ".", "issue_command", "(", "'SetHtml'", ",", "html", ",", "url", ")", "else", ":", "self", ".", "conn", ".", "issue_command", "("...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
Client.set_proxy
Sets a custom HTTP proxy to use for future requests.
webkit_server.py
def set_proxy(self, host = "localhost", port = 0, user = "", password = ""): """ Sets a custom HTTP proxy to use for future requests. """ self.conn.issue_command("SetProxy", host, port, user, password)
def set_proxy(self, host = "localhost", port = 0, user = "", password = ""): """ Sets a custom HTTP proxy to use for future requests. """ self.conn.issue_command("SetProxy", host, port, user, password)
[ "Sets", "a", "custom", "HTTP", "proxy", "to", "use", "for", "future", "requests", "." ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L356-L361
[ "def", "set_proxy", "(", "self", ",", "host", "=", "\"localhost\"", ",", "port", "=", "0", ",", "user", "=", "\"\"", ",", "password", "=", "\"\"", ")", ":", "self", ".", "conn", ".", "issue_command", "(", "\"SetProxy\"", ",", "host", ",", "port", ","...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
Server.connect
Returns a new socket connection to this server.
webkit_server.py
def connect(self): """ Returns a new socket connection to this server. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(("127.0.0.1", self._port)) return sock
def connect(self): """ Returns a new socket connection to this server. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(("127.0.0.1", self._port)) return sock
[ "Returns", "a", "new", "socket", "connection", "to", "this", "server", "." ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L437-L441
[ "def", "connect", "(", "self", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "connect", "(", "(", "\"127.0.0.1\"", ",", "self", ".", "_port", ")", ")", "return", "s...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
SocketBuffer.read_line
Consume one line from the stream.
webkit_server.py
def read_line(self): """ Consume one line from the stream. """ while True: newline_idx = self.buf.find(b"\n") if newline_idx >= 0: res = self.buf[:newline_idx] self.buf = self.buf[newline_idx + 1:] return res chunk = self.f.recv(4096) if not chunk: raise E...
def read_line(self): """ Consume one line from the stream. """ while True: newline_idx = self.buf.find(b"\n") if newline_idx >= 0: res = self.buf[:newline_idx] self.buf = self.buf[newline_idx + 1:] return res chunk = self.f.recv(4096) if not chunk: raise E...
[ "Consume", "one", "line", "from", "the", "stream", "." ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L475-L486
[ "def", "read_line", "(", "self", ")", ":", "while", "True", ":", "newline_idx", "=", "self", ".", "buf", ".", "find", "(", "b\"\\n\"", ")", "if", "newline_idx", ">=", "0", ":", "res", "=", "self", ".", "buf", "[", ":", "newline_idx", "]", "self", "...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
SocketBuffer.read
Consume `n` characters from the stream.
webkit_server.py
def read(self, n): """ Consume `n` characters from the stream. """ while len(self.buf) < n: chunk = self.f.recv(4096) if not chunk: raise EndOfStreamError() self.buf += chunk res, self.buf = self.buf[:n], self.buf[n:] return res
def read(self, n): """ Consume `n` characters from the stream. """ while len(self.buf) < n: chunk = self.f.recv(4096) if not chunk: raise EndOfStreamError() self.buf += chunk res, self.buf = self.buf[:n], self.buf[n:] return res
[ "Consume", "n", "characters", "from", "the", "stream", "." ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L488-L496
[ "def", "read", "(", "self", ",", "n", ")", ":", "while", "len", "(", "self", ".", "buf", ")", "<", "n", ":", "chunk", "=", "self", ".", "f", ".", "recv", "(", "4096", ")", "if", "not", "chunk", ":", "raise", "EndOfStreamError", "(", ")", "self"...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
ServerConnection.issue_command
Sends and receives a message to/from the server
webkit_server.py
def issue_command(self, cmd, *args): """ Sends and receives a message to/from the server """ self._writeline(cmd) self._writeline(str(len(args))) for arg in args: arg = str(arg) self._writeline(str(len(arg))) self._sock.sendall(arg.encode("utf-8")) return self._read_response()
def issue_command(self, cmd, *args): """ Sends and receives a message to/from the server """ self._writeline(cmd) self._writeline(str(len(args))) for arg in args: arg = str(arg) self._writeline(str(len(arg))) self._sock.sendall(arg.encode("utf-8")) return self._read_response()
[ "Sends", "and", "receives", "a", "message", "to", "/", "from", "the", "server" ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L511-L520
[ "def", "issue_command", "(", "self", ",", "cmd", ",", "*", "args", ")", ":", "self", ".", "_writeline", "(", "cmd", ")", "self", ".", "_writeline", "(", "str", "(", "len", "(", "args", ")", ")", ")", "for", "arg", "in", "args", ":", "arg", "=", ...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
ServerConnection._read_response
Reads a complete response packet from the server
webkit_server.py
def _read_response(self): """ Reads a complete response packet from the server """ result = self.buf.read_line().decode("utf-8") if not result: raise NoResponseError("No response received from server.") msg = self._read_message() if result != "ok": raise InvalidResponseError(msg) r...
def _read_response(self): """ Reads a complete response packet from the server """ result = self.buf.read_line().decode("utf-8") if not result: raise NoResponseError("No response received from server.") msg = self._read_message() if result != "ok": raise InvalidResponseError(msg) r...
[ "Reads", "a", "complete", "response", "packet", "from", "the", "server" ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L522-L532
[ "def", "_read_response", "(", "self", ")", ":", "result", "=", "self", ".", "buf", ".", "read_line", "(", ")", ".", "decode", "(", "\"utf-8\"", ")", "if", "not", "result", ":", "raise", "NoResponseError", "(", "\"No response received from server.\"", ")", "m...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
ServerConnection._read_message
Reads a single size-annotated message from the server
webkit_server.py
def _read_message(self): """ Reads a single size-annotated message from the server """ size = int(self.buf.read_line().decode("utf-8")) return self.buf.read(size).decode("utf-8")
def _read_message(self): """ Reads a single size-annotated message from the server """ size = int(self.buf.read_line().decode("utf-8")) return self.buf.read(size).decode("utf-8")
[ "Reads", "a", "single", "size", "-", "annotated", "message", "from", "the", "server" ]
niklasb/webkit-server
python
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L534-L537
[ "def", "_read_message", "(", "self", ")", ":", "size", "=", "int", "(", "self", ".", "buf", ".", "read_line", "(", ")", ".", "decode", "(", "\"utf-8\"", ")", ")", "return", "self", ".", "buf", ".", "read", "(", "size", ")", ".", "decode", "(", "\...
c9e3a8394b8c51000c35f8a56fb770580562b544
train
ZillowWrapper.get_deep_search_results
GetDeepSearchResults API
pyzillow/pyzillow.py
def get_deep_search_results(self, address, zipcode): """ GetDeepSearchResults API """ url = 'http://www.zillow.com/webservice/GetDeepSearchResults.htm' params = { 'address': address, 'citystatezip': zipcode, 'zws-id': self.api_key } ...
def get_deep_search_results(self, address, zipcode): """ GetDeepSearchResults API """ url = 'http://www.zillow.com/webservice/GetDeepSearchResults.htm' params = { 'address': address, 'citystatezip': zipcode, 'zws-id': self.api_key } ...
[ "GetDeepSearchResults", "API" ]
hanneshapke/pyzillow
python
https://github.com/hanneshapke/pyzillow/blob/1de937669da4ec1eb779b4615f903d3e5bd0eca6/pyzillow/pyzillow.py#L20-L31
[ "def", "get_deep_search_results", "(", "self", ",", "address", ",", "zipcode", ")", ":", "url", "=", "'http://www.zillow.com/webservice/GetDeepSearchResults.htm'", "params", "=", "{", "'address'", ":", "address", ",", "'citystatezip'", ":", "zipcode", ",", "'zws-id'",...
1de937669da4ec1eb779b4615f903d3e5bd0eca6
train
ZillowWrapper.get_updated_property_details
GetUpdatedPropertyDetails API
pyzillow/pyzillow.py
def get_updated_property_details(self, zpid): """ GetUpdatedPropertyDetails API """ url = 'http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm' params = { 'zpid': zpid, 'zws-id': self.api_key } return self.get_data(url, params)
def get_updated_property_details(self, zpid): """ GetUpdatedPropertyDetails API """ url = 'http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm' params = { 'zpid': zpid, 'zws-id': self.api_key } return self.get_data(url, params)
[ "GetUpdatedPropertyDetails", "API" ]
hanneshapke/pyzillow
python
https://github.com/hanneshapke/pyzillow/blob/1de937669da4ec1eb779b4615f903d3e5bd0eca6/pyzillow/pyzillow.py#L33-L43
[ "def", "get_updated_property_details", "(", "self", ",", "zpid", ")", ":", "url", "=", "'http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm'", "params", "=", "{", "'zpid'", ":", "zpid", ",", "'zws-id'", ":", "self", ".", "api_key", "}", "return", "self",...
1de937669da4ec1eb779b4615f903d3e5bd0eca6
train
fix_orientation
`img` can be an Image instance or a path to an image file. `save_over` indicates if the original image file should be replaced by the new image. * Note: `save_over` is only valid if `img` is a file path.
img_rotate/__init__.py
def fix_orientation(img, save_over=False): """ `img` can be an Image instance or a path to an image file. `save_over` indicates if the original image file should be replaced by the new image. * Note: `save_over` is only valid if `img` is a file path. """ path = None if not isinstance(img, Im...
def fix_orientation(img, save_over=False): """ `img` can be an Image instance or a path to an image file. `save_over` indicates if the original image file should be replaced by the new image. * Note: `save_over` is only valid if `img` is a file path. """ path = None if not isinstance(img, Im...
[ "img", "can", "be", "an", "Image", "instance", "or", "a", "path", "to", "an", "image", "file", ".", "save_over", "indicates", "if", "the", "original", "image", "file", "should", "be", "replaced", "by", "the", "new", "image", ".", "*", "Note", ":", "sav...
kylefox/python-image-orientation-patch
python
https://github.com/kylefox/python-image-orientation-patch/blob/7941763d732a3bec0497991479be3c57aedd3415/img_rotate/__init__.py#L25-L54
[ "def", "fix_orientation", "(", "img", ",", "save_over", "=", "False", ")", ":", "path", "=", "None", "if", "not", "isinstance", "(", "img", ",", "Image", ".", "Image", ")", ":", "path", "=", "img", "img", "=", "Image", ".", "open", "(", "path", ")"...
7941763d732a3bec0497991479be3c57aedd3415
train
Check.log_error
Add an error message and optional user message to the error list
integrate/check.py
def log_error(self, error, message, detail=None, strip=4): "Add an error message and optional user message to the error list" if message: msg = message + ": " + error else: msg = error tb = traceback.format_stack() if sys.version_info >= (3, 0): ...
def log_error(self, error, message, detail=None, strip=4): "Add an error message and optional user message to the error list" if message: msg = message + ": " + error else: msg = error tb = traceback.format_stack() if sys.version_info >= (3, 0): ...
[ "Add", "an", "error", "message", "and", "optional", "user", "message", "to", "the", "error", "list" ]
anfema/integrate
python
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L12-L29
[ "def", "log_error", "(", "self", ",", "error", ",", "message", ",", "detail", "=", "None", ",", "strip", "=", "4", ")", ":", "if", "message", ":", "msg", "=", "message", "+", "\": \"", "+", "error", "else", ":", "msg", "=", "error", "tb", "=", "t...
e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7
train
Check.equal
Check if two values are equal
integrate/check.py
def equal(self, a, b, message=None): "Check if two values are equal" if a != b: self.log_error("{} != {}".format(str(a), str(b)), message) return False return True
def equal(self, a, b, message=None): "Check if two values are equal" if a != b: self.log_error("{} != {}".format(str(a), str(b)), message) return False return True
[ "Check", "if", "two", "values", "are", "equal" ]
anfema/integrate
python
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L35-L40
[ "def", "equal", "(", "self", ",", "a", ",", "b", ",", "message", "=", "None", ")", ":", "if", "a", "!=", "b", ":", "self", ".", "log_error", "(", "\"{} != {}\"", ".", "format", "(", "str", "(", "a", ")", ",", "str", "(", "b", ")", ")", ",", ...
e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7
train
Check.is_not_none
Check if a value is not None
integrate/check.py
def is_not_none(self, a, message=None): "Check if a value is not None" if a is None: self.log_error("{} is None".format(str(a)), message) return False return True
def is_not_none(self, a, message=None): "Check if a value is not None" if a is None: self.log_error("{} is None".format(str(a)), message) return False return True
[ "Check", "if", "a", "value", "is", "not", "None" ]
anfema/integrate
python
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L56-L61
[ "def", "is_not_none", "(", "self", ",", "a", ",", "message", "=", "None", ")", ":", "if", "a", "is", "None", ":", "self", ".", "log_error", "(", "\"{} is None\"", ".", "format", "(", "str", "(", "a", ")", ")", ",", "message", ")", "return", "False"...
e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7
train
Check.raises
Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function
integrate/check.py
def raises(self, exception_type, function, *args, **kwargs): """ Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function """ try: result = function(*args, **kwargs) self.log_error("{} did not throw ex...
def raises(self, exception_type, function, *args, **kwargs): """ Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function """ try: result = function(*args, **kwargs) self.log_error("{} did not throw ex...
[ "Check", "if", "a", "function", "raises", "a", "specified", "exception", "type", "*", "args", "and", "**", "kwargs", "are", "forwarded", "to", "the", "function" ]
anfema/integrate
python
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L82-L99
[ "def", "raises", "(", "self", ",", "exception_type", ",", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "result", "=", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "log_error", "(", "\"{} d...
e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7
train
Check.does_not_raise
Check if a function does not raise an exception, *args and **kwargs are forwarded to the function
integrate/check.py
def does_not_raise(self, function, *args, **kwargs): """ Check if a function does not raise an exception, *args and **kwargs are forwarded to the function """ try: return function(*args, **kwargs) except Exception as e: self.log_error("{} d...
def does_not_raise(self, function, *args, **kwargs): """ Check if a function does not raise an exception, *args and **kwargs are forwarded to the function """ try: return function(*args, **kwargs) except Exception as e: self.log_error("{} d...
[ "Check", "if", "a", "function", "does", "not", "raise", "an", "exception", "*", "args", "and", "**", "kwargs", "are", "forwarded", "to", "the", "function" ]
anfema/integrate
python
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L101-L112
[ "def", "does_not_raise", "(", "self", ",", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Exception", "as", "e", ":", "self", ".", "log_e...
e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7
train
calculate_color_temperature
Converts the raw R/G/B values to color temperature in degrees Kelvin.
Adafruit_TCS34725/TCS34725.py
def calculate_color_temperature(r, g, b): """Converts the raw R/G/B values to color temperature in degrees Kelvin.""" # 1. Map RGB values to their XYZ counterparts. # Based on 6500K fluorescent, 3000K fluorescent # and 60W incandescent values for a wide range. # Note: Y = Illuminance or lux X = ...
def calculate_color_temperature(r, g, b): """Converts the raw R/G/B values to color temperature in degrees Kelvin.""" # 1. Map RGB values to their XYZ counterparts. # Based on 6500K fluorescent, 3000K fluorescent # and 60W incandescent values for a wide range. # Note: Y = Illuminance or lux X = ...
[ "Converts", "the", "raw", "R", "/", "G", "/", "B", "values", "to", "color", "temperature", "in", "degrees", "Kelvin", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L102-L124
[ "def", "calculate_color_temperature", "(", "r", ",", "g", ",", "b", ")", ":", "# 1. Map RGB values to their XYZ counterparts.", "# Based on 6500K fluorescent, 3000K fluorescent", "# and 60W incandescent values for a wide range.", "# Note: Y = Illuminance or lux", "X", "=", "(", "-"...
996396cd095522d788b7b15d20fd44e566c8464e
train
calculate_lux
Converts the raw R/G/B values to luminosity in lux.
Adafruit_TCS34725/TCS34725.py
def calculate_lux(r, g, b): """Converts the raw R/G/B values to luminosity in lux.""" illuminance = (-0.32466 * r) + (1.57837 * g) + (-0.73191 * b) return int(illuminance)
def calculate_lux(r, g, b): """Converts the raw R/G/B values to luminosity in lux.""" illuminance = (-0.32466 * r) + (1.57837 * g) + (-0.73191 * b) return int(illuminance)
[ "Converts", "the", "raw", "R", "/", "G", "/", "B", "values", "to", "luminosity", "in", "lux", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L126-L129
[ "def", "calculate_lux", "(", "r", ",", "g", ",", "b", ")", ":", "illuminance", "=", "(", "-", "0.32466", "*", "r", ")", "+", "(", "1.57837", "*", "g", ")", "+", "(", "-", "0.73191", "*", "b", ")", "return", "int", "(", "illuminance", ")" ]
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725._write8
Write a 8-bit value to a register.
Adafruit_TCS34725/TCS34725.py
def _write8(self, reg, value): """Write a 8-bit value to a register.""" self._device.write8(TCS34725_COMMAND_BIT | reg, value)
def _write8(self, reg, value): """Write a 8-bit value to a register.""" self._device.write8(TCS34725_COMMAND_BIT | reg, value)
[ "Write", "a", "8", "-", "bit", "value", "to", "a", "register", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L161-L163
[ "def", "_write8", "(", "self", ",", "reg", ",", "value", ")", ":", "self", ".", "_device", ".", "write8", "(", "TCS34725_COMMAND_BIT", "|", "reg", ",", "value", ")" ]
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.enable
Enable the chip.
Adafruit_TCS34725/TCS34725.py
def enable(self): """Enable the chip.""" # Flip on the power and enable bits. self._write8(TCS34725_ENABLE, TCS34725_ENABLE_PON) time.sleep(0.01) self._write8(TCS34725_ENABLE, (TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN))
def enable(self): """Enable the chip.""" # Flip on the power and enable bits. self._write8(TCS34725_ENABLE, TCS34725_ENABLE_PON) time.sleep(0.01) self._write8(TCS34725_ENABLE, (TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN))
[ "Enable", "the", "chip", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L165-L170
[ "def", "enable", "(", "self", ")", ":", "# Flip on the power and enable bits.", "self", ".", "_write8", "(", "TCS34725_ENABLE", ",", "TCS34725_ENABLE_PON", ")", "time", ".", "sleep", "(", "0.01", ")", "self", ".", "_write8", "(", "TCS34725_ENABLE", ",", "(", "...
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.disable
Disable the chip (power down).
Adafruit_TCS34725/TCS34725.py
def disable(self): """Disable the chip (power down).""" # Flip off the power on and enable bits. reg = self._readU8(TCS34725_ENABLE) reg &= ~(TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN) self._write8(TCS34725_ENABLE, reg)
def disable(self): """Disable the chip (power down).""" # Flip off the power on and enable bits. reg = self._readU8(TCS34725_ENABLE) reg &= ~(TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN) self._write8(TCS34725_ENABLE, reg)
[ "Disable", "the", "chip", "(", "power", "down", ")", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L172-L177
[ "def", "disable", "(", "self", ")", ":", "# Flip off the power on and enable bits.", "reg", "=", "self", ".", "_readU8", "(", "TCS34725_ENABLE", ")", "reg", "&=", "~", "(", "TCS34725_ENABLE_PON", "|", "TCS34725_ENABLE_AEN", ")", "self", ".", "_write8", "(", "TCS...
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.set_integration_time
Sets the integration time for the TC34725. Provide one of these constants: - TCS34725_INTEGRATIONTIME_2_4MS = 2.4ms - 1 cycle - Max Count: 1024 - TCS34725_INTEGRATIONTIME_24MS = 24ms - 10 cycles - Max Count: 10240 - TCS34725_INTEGRATIONTIME_50MS = 50ms - 20 cycles - Max C...
Adafruit_TCS34725/TCS34725.py
def set_integration_time(self, integration_time): """Sets the integration time for the TC34725. Provide one of these constants: - TCS34725_INTEGRATIONTIME_2_4MS = 2.4ms - 1 cycle - Max Count: 1024 - TCS34725_INTEGRATIONTIME_24MS = 24ms - 10 cycles - Max Count: 10240 -...
def set_integration_time(self, integration_time): """Sets the integration time for the TC34725. Provide one of these constants: - TCS34725_INTEGRATIONTIME_2_4MS = 2.4ms - 1 cycle - Max Count: 1024 - TCS34725_INTEGRATIONTIME_24MS = 24ms - 10 cycles - Max Count: 10240 -...
[ "Sets", "the", "integration", "time", "for", "the", "TC34725", ".", "Provide", "one", "of", "these", "constants", ":", "-", "TCS34725_INTEGRATIONTIME_2_4MS", "=", "2", ".", "4ms", "-", "1", "cycle", "-", "Max", "Count", ":", "1024", "-", "TCS34725_INTEGRATIO...
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L179-L190
[ "def", "set_integration_time", "(", "self", ",", "integration_time", ")", ":", "self", ".", "_integration_time", "=", "integration_time", "self", ".", "_write8", "(", "TCS34725_ATIME", ",", "integration_time", ")" ]
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.get_raw_data
Reads the raw red, green, blue and clear channel values. Will return a 4-tuple with the red, green, blue, clear color values (unsigned 16-bit numbers).
Adafruit_TCS34725/TCS34725.py
def get_raw_data(self): """Reads the raw red, green, blue and clear channel values. Will return a 4-tuple with the red, green, blue, clear color values (unsigned 16-bit numbers). """ # Read each color register. r = self._readU16LE(TCS34725_RDATAL) g = self._readU1...
def get_raw_data(self): """Reads the raw red, green, blue and clear channel values. Will return a 4-tuple with the red, green, blue, clear color values (unsigned 16-bit numbers). """ # Read each color register. r = self._readU16LE(TCS34725_RDATAL) g = self._readU1...
[ "Reads", "the", "raw", "red", "green", "blue", "and", "clear", "channel", "values", ".", "Will", "return", "a", "4", "-", "tuple", "with", "the", "red", "green", "blue", "clear", "color", "values", "(", "unsigned", "16", "-", "bit", "numbers", ")", "."...
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L214-L226
[ "def", "get_raw_data", "(", "self", ")", ":", "# Read each color register.", "r", "=", "self", ".", "_readU16LE", "(", "TCS34725_RDATAL", ")", "g", "=", "self", ".", "_readU16LE", "(", "TCS34725_GDATAL", ")", "b", "=", "self", ".", "_readU16LE", "(", "TCS347...
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.set_interrupt
Enable or disable interrupts by setting enabled to True or False.
Adafruit_TCS34725/TCS34725.py
def set_interrupt(self, enabled): """Enable or disable interrupts by setting enabled to True or False.""" enable_reg = self._readU8(TCS34725_ENABLE) if enabled: enable_reg |= TCS34725_ENABLE_AIEN else: enable_reg &= ~TCS34725_ENABLE_AIEN self._write8(TCS34...
def set_interrupt(self, enabled): """Enable or disable interrupts by setting enabled to True or False.""" enable_reg = self._readU8(TCS34725_ENABLE) if enabled: enable_reg |= TCS34725_ENABLE_AIEN else: enable_reg &= ~TCS34725_ENABLE_AIEN self._write8(TCS34...
[ "Enable", "or", "disable", "interrupts", "by", "setting", "enabled", "to", "True", "or", "False", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L228-L236
[ "def", "set_interrupt", "(", "self", ",", "enabled", ")", ":", "enable_reg", "=", "self", ".", "_readU8", "(", "TCS34725_ENABLE", ")", "if", "enabled", ":", "enable_reg", "|=", "TCS34725_ENABLE_AIEN", "else", ":", "enable_reg", "&=", "~", "TCS34725_ENABLE_AIEN",...
996396cd095522d788b7b15d20fd44e566c8464e
train
TCS34725.set_interrupt_limits
Set the interrupt limits to provied unsigned 16-bit threshold values.
Adafruit_TCS34725/TCS34725.py
def set_interrupt_limits(self, low, high): """Set the interrupt limits to provied unsigned 16-bit threshold values. """ self._device.write8(0x04, low & 0xFF) self._device.write8(0x05, low >> 8) self._device.write8(0x06, high & 0xFF) self._device.write8(0x07, high >> 8)
def set_interrupt_limits(self, low, high): """Set the interrupt limits to provied unsigned 16-bit threshold values. """ self._device.write8(0x04, low & 0xFF) self._device.write8(0x05, low >> 8) self._device.write8(0x06, high & 0xFF) self._device.write8(0x07, high >> 8)
[ "Set", "the", "interrupt", "limits", "to", "provied", "unsigned", "16", "-", "bit", "threshold", "values", "." ]
adafruit/Adafruit_Python_TCS34725
python
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L242-L248
[ "def", "set_interrupt_limits", "(", "self", ",", "low", ",", "high", ")", ":", "self", ".", "_device", ".", "write8", "(", "0x04", ",", "low", "&", "0xFF", ")", "self", ".", "_device", ".", "write8", "(", "0x05", ",", "low", ">>", "8", ")", "self",...
996396cd095522d788b7b15d20fd44e566c8464e
train
convert
Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. build_direction : {"TOP_TO_BOTTOM", "LEFT_TO_RIGHT"} String denoting the build direction of the table. If ``"TOP_TO_BOTTOM"`` child objects will be appended below parent...
json2table/json2table.py
def convert(json_input, build_direction="LEFT_TO_RIGHT", table_attributes=None): """ Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. build_direction : {"TOP_TO_BOTTOM", "LEFT_TO_RIGHT"} String denoting the build direc...
def convert(json_input, build_direction="LEFT_TO_RIGHT", table_attributes=None): """ Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. build_direction : {"TOP_TO_BOTTOM", "LEFT_TO_RIGHT"} String denoting the build direc...
[ "Converts", "JSON", "to", "HTML", "Table", "format", "." ]
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L12-L48
[ "def", "convert", "(", "json_input", ",", "build_direction", "=", "\"LEFT_TO_RIGHT\"", ",", "table_attributes", "=", "None", ")", ":", "json_converter", "=", "JsonConverter", "(", "build_direction", "=", "build_direction", ",", "table_attributes", "=", "table_attribut...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
JsonConverter.convert
Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. Returns ------- str String of converted HTML.
json2table/json2table.py
def convert(self, json_input): """ Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. Returns ------- str String of converted HTML. """ html_output = self....
def convert(self, json_input): """ Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. Returns ------- str String of converted HTML. """ html_output = self....
[ "Converts", "JSON", "to", "HTML", "Table", "format", "." ]
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L73-L109
[ "def", "convert", "(", "self", ",", "json_input", ")", ":", "html_output", "=", "self", ".", "_table_opening_tag", "if", "self", ".", "_build_top_to_bottom", ":", "html_output", "+=", "self", ".", "_markup_header_row", "(", "json_input", ".", "keys", "(", ")",...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
JsonConverter._dict_to_html_attributes
Converts a dictionary to a string of ``key=\"value\"`` pairs. If ``None`` is provided as the dictionary an empty string is returned, i.e. no html attributes are generated. Parameters ---------- d : dict Dictionary to convert to html attributes. Returns ...
json2table/json2table.py
def _dict_to_html_attributes(d): """ Converts a dictionary to a string of ``key=\"value\"`` pairs. If ``None`` is provided as the dictionary an empty string is returned, i.e. no html attributes are generated. Parameters ---------- d : dict Dictionary ...
def _dict_to_html_attributes(d): """ Converts a dictionary to a string of ``key=\"value\"`` pairs. If ``None`` is provided as the dictionary an empty string is returned, i.e. no html attributes are generated. Parameters ---------- d : dict Dictionary ...
[ "Converts", "a", "dictionary", "to", "a", "string", "of", "key", "=", "\\", "value", "\\", "pairs", ".", "If", "None", "is", "provided", "as", "the", "dictionary", "an", "empty", "string", "is", "returned", "i", ".", "e", ".", "no", "html", "attributes...
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L144-L164
[ "def", "_dict_to_html_attributes", "(", "d", ")", ":", "if", "d", "is", "None", ":", "return", "\"\"", "return", "\"\"", ".", "join", "(", "\" {}=\\\"{}\\\"\"", ".", "format", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "iter", "("...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
JsonConverter._list_of_dicts_to_column_headers
Detects if all entries in an list of ``dict``'s have identical keys. Returns the keys if all keys are the same and ``None`` otherwise. Parameters ---------- list_of_dicts : list List of dictionaries to test for identical keys. Returns ------- list or...
json2table/json2table.py
def _list_of_dicts_to_column_headers(list_of_dicts): """ Detects if all entries in an list of ``dict``'s have identical keys. Returns the keys if all keys are the same and ``None`` otherwise. Parameters ---------- list_of_dicts : list List of dictionaries to ...
def _list_of_dicts_to_column_headers(list_of_dicts): """ Detects if all entries in an list of ``dict``'s have identical keys. Returns the keys if all keys are the same and ``None`` otherwise. Parameters ---------- list_of_dicts : list List of dictionaries to ...
[ "Detects", "if", "all", "entries", "in", "an", "list", "of", "dict", "s", "have", "identical", "keys", ".", "Returns", "the", "keys", "if", "all", "keys", "are", "the", "same", "and", "None", "otherwise", "." ]
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L167-L190
[ "def", "_list_of_dicts_to_column_headers", "(", "list_of_dicts", ")", ":", "if", "len", "(", "list_of_dicts", ")", "<", "2", "or", "not", "all", "(", "isinstance", "(", "item", ",", "dict", ")", "for", "item", "in", "list_of_dicts", ")", ":", "return", "No...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
JsonConverter._markup
Recursively generates HTML for the current entry. Parameters ---------- entry : object Object to convert to HTML. Maybe be a single entity or contain multiple and/or nested objects. Returns ------- str String of HTML formatted json.
json2table/json2table.py
def _markup(self, entry): """ Recursively generates HTML for the current entry. Parameters ---------- entry : object Object to convert to HTML. Maybe be a single entity or contain multiple and/or nested objects. Returns ------- str ...
def _markup(self, entry): """ Recursively generates HTML for the current entry. Parameters ---------- entry : object Object to convert to HTML. Maybe be a single entity or contain multiple and/or nested objects. Returns ------- str ...
[ "Recursively", "generates", "HTML", "for", "the", "current", "entry", "." ]
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L192-L218
[ "def", "_markup", "(", "self", ",", "entry", ")", ":", "if", "entry", "is", "None", ":", "return", "\"\"", "if", "isinstance", "(", "entry", ",", "list", ")", ":", "list_markup", "=", "\"<ul>\"", "for", "item", "in", "entry", ":", "list_markup", "+=", ...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
JsonConverter._maybe_club
If all keys in a list of dicts are identical, values from each ``dict`` are clubbed, i.e. inserted under a common column heading. If the keys are not identical ``None`` is returned, and the list should be converted to HTML per the normal ``convert`` function. Parameters -------...
json2table/json2table.py
def _maybe_club(self, list_of_dicts): """ If all keys in a list of dicts are identical, values from each ``dict`` are clubbed, i.e. inserted under a common column heading. If the keys are not identical ``None`` is returned, and the list should be converted to HTML per the normal...
def _maybe_club(self, list_of_dicts): """ If all keys in a list of dicts are identical, values from each ``dict`` are clubbed, i.e. inserted under a common column heading. If the keys are not identical ``None`` is returned, and the list should be converted to HTML per the normal...
[ "If", "all", "keys", "in", "a", "list", "of", "dicts", "are", "identical", "values", "from", "each", "dict", "are", "clubbed", "i", ".", "e", ".", "inserted", "under", "a", "common", "column", "heading", ".", "If", "the", "keys", "are", "not", "identic...
latture/json2table
python
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L220-L272
[ "def", "_maybe_club", "(", "self", ",", "list_of_dicts", ")", ":", "column_headers", "=", "JsonConverter", ".", "_list_of_dicts_to_column_headers", "(", "list_of_dicts", ")", "if", "column_headers", "is", "None", ":", "# common headers not found, return normal markup", "h...
8bd1363f54ee4fd608ffb7677761526184a9da83
train
TplApi.update_voice_notify
修改语音通知模版 注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错! 参数: 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 tpl_id Long 是 模板id,64位长整形。指定id时返回id对应的模板。未指定时返回所有模板 9527 tpl_content String 是 模板i...
yunpian_python_sdk/api/tpl.py
def update_voice_notify(self, param, must=[APIKEY, TPL_ID, TPL_CONTENT]): '''修改语音通知模版 注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错! 参数: 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 tpl_id Long 是 模板...
def update_voice_notify(self, param, must=[APIKEY, TPL_ID, TPL_CONTENT]): '''修改语音通知模版 注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错! 参数: 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 tpl_id Long 是 模板...
[ "修改语音通知模版", "注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错!", "参数:", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "tpl_id", "Long", "是", "模板id,64位长整形。指定id时返回id对应的模板。未指定时返回所有模板", "9527", "tpl_content", "String", "是"...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/tpl.py#L144-L163
[ "def", "update_voice_notify", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "TPL_ID", ",", "TPL_CONTENT", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
Result.code
Args: code: (Optional) set code ret_r: (Optional) force to return Result. Default value is False returns: response code(0-success, others-failure) or self
yunpian_python_sdk/model/result.py
def code(self, code=None, ret_r=False): ''' Args: code: (Optional) set code ret_r: (Optional) force to return Result. Default value is False returns: response code(0-success, others-failure) or self ''' if code or ret_r: self._code ...
def code(self, code=None, ret_r=False): ''' Args: code: (Optional) set code ret_r: (Optional) force to return Result. Default value is False returns: response code(0-success, others-failure) or self ''' if code or ret_r: self._code ...
[ "Args", ":", "code", ":", "(", "Optional", ")", "set", "code", "ret_r", ":", "(", "Optional", ")", "force", "to", "return", "Result", ".", "Default", "value", "is", "False", "returns", ":", "response", "code", "(", "0", "-", "success", "others", "-", ...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L33-L44
[ "def", "code", "(", "self", ",", "code", "=", "None", ",", "ret_r", "=", "False", ")", ":", "if", "code", "or", "ret_r", ":", "self", ".", "_code", "=", "code", "return", "self", "return", "self", ".", "_code" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
Result.msg
code's message
yunpian_python_sdk/model/result.py
def msg(self, msg=None, ret_r=False): '''code's message''' if msg or ret_r: self._msg = msg return self return self._msg
def msg(self, msg=None, ret_r=False): '''code's message''' if msg or ret_r: self._msg = msg return self return self._msg
[ "code", "s", "message" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L46-L51
[ "def", "msg", "(", "self", ",", "msg", "=", "None", ",", "ret_r", "=", "False", ")", ":", "if", "msg", "or", "ret_r", ":", "self", ".", "_msg", "=", "msg", "return", "self", "return", "self", ".", "_msg" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
Result.detail
code's detail
yunpian_python_sdk/model/result.py
def detail(self, detail=None, ret_r=False): '''code's detail''' if detail or ret_r: self._detail = detail return self return self._detail
def detail(self, detail=None, ret_r=False): '''code's detail''' if detail or ret_r: self._detail = detail return self return self._detail
[ "code", "s", "detail" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L53-L58
[ "def", "detail", "(", "self", ",", "detail", "=", "None", ",", "ret_r", "=", "False", ")", ":", "if", "detail", "or", "ret_r", ":", "self", ".", "_detail", "=", "detail", "return", "self", "return", "self", ".", "_detail" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
Result.data
response data
yunpian_python_sdk/model/result.py
def data(self, data=None, ret_r=False): '''response data''' if data or ret_r: self._data = data return self return self._data
def data(self, data=None, ret_r=False): '''response data''' if data or ret_r: self._data = data return self return self._data
[ "response", "data" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L60-L65
[ "def", "data", "(", "self", ",", "data", "=", "None", ",", "ret_r", "=", "False", ")", ":", "if", "data", "or", "ret_r", ":", "self", ".", "_data", "=", "data", "return", "self", "return", "self", ".", "_data" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
UserApi.get
查账户信息 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 Args: param: (Optional) Results: Result
yunpian_python_sdk/api/user.py
def get(self, param=None, must=[APIKEY]): '''查账户信息 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 Args: param: (Optional) Results: Result ''' param = {} if param is None else param r = s...
def get(self, param=None, must=[APIKEY]): '''查账户信息 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 Args: param: (Optional) Results: Result ''' param = {} if param is None else param r = s...
[ "查账户信息", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "Args", ":", "param", ":", "(", "Optional", ")", "Results", ":", "Result" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/user.py#L19-L35
[ "def", "get", "(", "self", ",", "param", "=", "None", ",", "must", "=", "[", "APIKEY", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianApi._init
initialize api by YunpianClient
yunpian_python_sdk/api/ypapi.py
def _init(self, clnt): '''initialize api by YunpianClient''' assert clnt, "clnt is None" self._clnt = clnt self._apikey = clnt.apikey() self._version = clnt.conf(YP_VERSION, defval=VERSION_V2) self._charset = clnt.conf(HTTP_CHARSET, defval=CHARSET_UTF8) self._name...
def _init(self, clnt): '''initialize api by YunpianClient''' assert clnt, "clnt is None" self._clnt = clnt self._apikey = clnt.apikey() self._version = clnt.conf(YP_VERSION, defval=VERSION_V2) self._charset = clnt.conf(HTTP_CHARSET, defval=CHARSET_UTF8) self._name...
[ "initialize", "api", "by", "YunpianClient" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L94-L101
[ "def", "_init", "(", "self", ",", "clnt", ")", ":", "assert", "clnt", ",", "\"clnt is None\"", "self", ".", "_clnt", "=", "clnt", "self", ".", "_apikey", "=", "clnt", ".", "apikey", "(", ")", "self", ".", "_version", "=", "clnt", ".", "conf", "(", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianApi.name
api name, default is module.__name__
yunpian_python_sdk/api/ypapi.py
def name(self, name=None): '''api name, default is module.__name__''' if name: self._name = name return self return self._name
def name(self, name=None): '''api name, default is module.__name__''' if name: self._name = name return self return self._name
[ "api", "name", "default", "is", "module", ".", "__name__" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L139-L144
[ "def", "name", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", ":", "self", ".", "_name", "=", "name", "return", "self", "return", "self", ".", "_name" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianApi.post
Args: param: request parameters h: ResultHandler r: YunpianApiResult
yunpian_python_sdk/api/ypapi.py
def post(self, param, h, r): ''' Args: param: request parameters h: ResultHandler r: YunpianApiResult ''' try: rsp = self.client().post(self.uri(), param) # print(rsp) return self.result(rsp, h, r) except Val...
def post(self, param, h, r): ''' Args: param: request parameters h: ResultHandler r: YunpianApiResult ''' try: rsp = self.client().post(self.uri(), param) # print(rsp) return self.result(rsp, h, r) except Val...
[ "Args", ":", "param", ":", "request", "parameters", "h", ":", "ResultHandler", "r", ":", "YunpianApiResult" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L150-L162
[ "def", "post", "(", "self", ",", "param", ",", "h", ",", "r", ")", ":", "try", ":", "rsp", "=", "self", ".", "client", "(", ")", ".", "post", "(", "self", ".", "uri", "(", ")", ",", "param", ")", "# print(rsp)", "return", "self", ".", "result",...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianApi.verify_param
return Code.ARGUMENT_MISSING if every key in must not found in param
yunpian_python_sdk/api/ypapi.py
def verify_param(self, param, must=[], r=None): '''return Code.ARGUMENT_MISSING if every key in must not found in param''' if APIKEY not in param: param[APIKEY] = self.apikey() r = Result() if r is None else r for p in must: if p not in param: r.c...
def verify_param(self, param, must=[], r=None): '''return Code.ARGUMENT_MISSING if every key in must not found in param''' if APIKEY not in param: param[APIKEY] = self.apikey() r = Result() if r is None else r for p in must: if p not in param: r.c...
[ "return", "Code", ".", "ARGUMENT_MISSING", "if", "every", "key", "in", "must", "not", "found", "in", "param" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L180-L191
[ "def", "verify_param", "(", "self", ",", "param", ",", "must", "=", "[", "]", ",", "r", "=", "None", ")", ":", "if", "APIKEY", "not", "in", "param", ":", "param", "[", "APIKEY", "]", "=", "self", ".", "apikey", "(", ")", "r", "=", "Result", "("...
405a1196ec83fdf29ff454f74ef036974be11970
train
_YunpianConf.custom_conf
custom apikey and http parameters
yunpian_python_sdk/ypclient.py
def custom_conf(self, conf): '''custom apikey and http parameters''' if conf: for (key, val) in conf.items(): self.__conf[key] = val return self
def custom_conf(self, conf): '''custom apikey and http parameters''' if conf: for (key, val) in conf.items(): self.__conf[key] = val return self
[ "custom", "apikey", "and", "http", "parameters" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L59-L64
[ "def", "custom_conf", "(", "self", ",", "conf", ")", ":", "if", "conf", ":", "for", "(", "key", ",", "val", ")", "in", "conf", ".", "items", "(", ")", ":", "self", ".", "__conf", "[", "key", "]", "=", "val", "return", "self" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
_YunpianConf.conf
get config
yunpian_python_sdk/ypclient.py
def conf(self, key): '''get config''' return self.__conf[key] if key in self.__conf else _YunpianConf.YP_CONF.get(key)
def conf(self, key): '''get config''' return self.__conf[key] if key in self.__conf else _YunpianConf.YP_CONF.get(key)
[ "get", "config" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L73-L75
[ "def", "conf", "(", "self", ",", "key", ")", ":", "return", "self", ".", "__conf", "[", "key", "]", "if", "key", "in", "self", ".", "__conf", "else", "_YunpianConf", ".", "YP_CONF", ".", "get", "(", "key", ")" ]
405a1196ec83fdf29ff454f74ef036974be11970
train
_ApiFactory.api
return special API by package's name
yunpian_python_sdk/ypclient.py
def api(self, name): '''return special API by package's name''' assert name, 'name is none' if flow.__name__ == name: api = flow.FlowApi() elif sign.__name__ == name: api = sign.SignApi() elif sms.__name__ == name: api = sms.SmsApi() e...
def api(self, name): '''return special API by package's name''' assert name, 'name is none' if flow.__name__ == name: api = flow.FlowApi() elif sign.__name__ == name: api = sign.SignApi() elif sms.__name__ == name: api = sms.SmsApi() e...
[ "return", "special", "API", "by", "package", "s", "name" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L85-L105
[ "def", "api", "(", "self", ",", "name", ")", ":", "assert", "name", ",", "'name is none'", "if", "flow", ".", "__name__", "==", "name", ":", "api", "=", "flow", ".", "FlowApi", "(", ")", "elif", "sign", ".", "__name__", "==", "name", ":", "api", "=...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianClient.conf
return YunpianConf if key=None, else return value in YunpianConf
yunpian_python_sdk/ypclient.py
def conf(self, key=None, defval=None): '''return YunpianConf if key=None, else return value in YunpianConf''' if key is None: return self._ypconf val = self._ypconf.conf(key) return defval if val is None else val
def conf(self, key=None, defval=None): '''return YunpianConf if key=None, else return value in YunpianConf''' if key is None: return self._ypconf val = self._ypconf.conf(key) return defval if val is None else val
[ "return", "YunpianConf", "if", "key", "=", "None", "else", "return", "value", "in", "YunpianConf" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L175-L180
[ "def", "conf", "(", "self", ",", "key", "=", "None", ",", "defval", "=", "None", ")", ":", "if", "key", "is", "None", ":", "return", "self", ".", "_ypconf", "val", "=", "self", ".", "_ypconf", ".", "conf", "(", "key", ")", "return", "defval", "if...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianClient.post
response json text
yunpian_python_sdk/ypclient.py
def post(self, url, data, charset=CHARSET_UTF8, headers={}): '''response json text''' if 'Api-Lang' not in headers: headers['Api-Lang'] = 'python' if 'Content-Type' not in headers: headers['Content-Type'] = "application/x-www-form-urlencoded;charset=" + charset rs...
def post(self, url, data, charset=CHARSET_UTF8, headers={}): '''response json text''' if 'Api-Lang' not in headers: headers['Api-Lang'] = 'python' if 'Content-Type' not in headers: headers['Content-Type'] = "application/x-www-form-urlencoded;charset=" + charset rs...
[ "response", "json", "text" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L185-L193
[ "def", "post", "(", "self", ",", "url", ",", "data", ",", "charset", "=", "CHARSET_UTF8", ",", "headers", "=", "{", "}", ")", ":", "if", "'Api-Lang'", "not", "in", "headers", ":", "headers", "[", "'Api-Lang'", "]", "=", "'python'", "if", "'Content-Type...
405a1196ec83fdf29ff454f74ef036974be11970
train
YunpianClient.urlEncodeAndJoin
sepr.join(urlencode(seq)) Args: seq: string list to be urlencoded sepr: join seq with sepr Returns: str
yunpian_python_sdk/ypclient.py
def urlEncodeAndJoin(self, seq, sepr=','): '''sepr.join(urlencode(seq)) Args: seq: string list to be urlencoded sepr: join seq with sepr Returns: str ''' try: from urllib.parse import quote_plus as encode return sepr.joi...
def urlEncodeAndJoin(self, seq, sepr=','): '''sepr.join(urlencode(seq)) Args: seq: string list to be urlencoded sepr: join seq with sepr Returns: str ''' try: from urllib.parse import quote_plus as encode return sepr.joi...
[ "sepr", ".", "join", "(", "urlencode", "(", "seq", "))", "Args", ":", "seq", ":", "string", "list", "to", "be", "urlencoded", "sepr", ":", "join", "seq", "with", "sepr", "Returns", ":", "str" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L195-L208
[ "def", "urlEncodeAndJoin", "(", "self", ",", "seq", ",", "sepr", "=", "','", ")", ":", "try", ":", "from", "urllib", ".", "parse", "import", "quote_plus", "as", "encode", "return", "sepr", ".", "join", "(", "[", "encode", "(", "x", ",", "encoding", "...
405a1196ec83fdf29ff454f74ef036974be11970
train
VoiceApi.send
发语音验证码 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000 code String 是 验证码,支持4~6位阿拉伯数字 1234 encrypt String 否 加密方式 使用加密 tea (不再使用) _sign String 否 签名字段 参考使用加密 393d079e0a00912335adfe46f4a2e10f (...
yunpian_python_sdk/api/voice.py
def send(self, param, must=[APIKEY, MOBILE, CODE]): '''发语音验证码 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000 code String 是 验证码,支持4~6位阿拉伯数字 1234 encrypt String 否 加密方式 使用加密 tea (不再使用) ...
def send(self, param, must=[APIKEY, MOBILE, CODE]): '''发语音验证码 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000 code String 是 验证码,支持4~6位阿拉伯数字 1234 encrypt String 否 加密方式 使用加密 tea (不再使用) ...
[ "发语音验证码" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/voice.py#L20-L42
[ "def", "send", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "MOBILE", ",", "CODE", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":", "retur...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.single_send
单条发送 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码 (针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见: ...
yunpian_python_sdk/api/sms.py
def single_send(self, param, must=[APIKEY, MOBILE, TEXT]): '''单条发送 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码 (针对国际短信,m...
def single_send(self, param, must=[APIKEY, MOBILE, TEXT]): '''单条发送 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码 (针对国际短信,m...
[ "单条发送", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "是", "接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是", "+", "号开头", "(", "+", "号需要urlencode处理,否则会出现格式错误", ")", ",国际号码不以", "+", "开头将被认为是中国地区的号码", "...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L50-L77
[ "def", "single_send", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "MOBILE", ",", "TEXT", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.pull_reply
获取回复短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size Integer 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result
yunpian_python_sdk/api/sms.py
def pull_reply(self, param=None, must=[APIKEY]): '''获取回复短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size Integer 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result ''' param =...
def pull_reply(self, param=None, must=[APIKEY]): '''获取回复短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size Integer 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result ''' param =...
[ "获取回复短信", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "page_size", "Integer", "否", "每页个数,最大100个,默认20个", "20", "Args", ":", "param", ":", "Results", ":", "Result" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L157-L174
[ "def", "pull_reply", "(", "self", ",", "param", "=", "None", ",", "must", "=", "[", "APIKEY", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", "...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.get_reply
查回复的短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信回复开始时间 2013-08-11 00:00:00 end_time String 是 短信回复结束时间 2013-08-12 00:00:00 page_num Integer 是 页码,默认值为1 1 page_size Integer 是 每页个数,最大100个 20 mobile String...
yunpian_python_sdk/api/sms.py
def get_reply(self, param, must=[APIKEY, START_TIME, END_TIME, PAGE_NUM, PAGE_SIZE]): '''查回复的短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信回复开始时间 2013-08-11 00:00:00 end_time String 是 短信回复结束时间 2013-08-12 00:00:00 ...
def get_reply(self, param, must=[APIKEY, START_TIME, END_TIME, PAGE_NUM, PAGE_SIZE]): '''查回复的短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信回复开始时间 2013-08-11 00:00:00 end_time String 是 短信回复结束时间 2013-08-12 00:00:00 ...
[ "查回复的短信", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "start_time", "String", "是", "短信回复开始时间", "2013", "-", "08", "-", "11", "00", ":", "00", ":", "00", "end_time", "String", "是", "短信回复结束时间", "2013"...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L177-L199
[ "def", "get_reply", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "START_TIME", ",", "END_TIME", ",", "PAGE_NUM", ",", "PAGE_SIZE", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.get_record
查短信发送记录 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 否 需要查询的手机号 15205201314 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间 2013-08-12 00:00:00 page_num Integer 否 页码,默认值为1 1 page_size ...
yunpian_python_sdk/api/sms.py
def get_record(self, param, must=[APIKEY, START_TIME, END_TIME]): '''查短信发送记录 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 否 需要查询的手机号 15205201314 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间...
def get_record(self, param, must=[APIKEY, START_TIME, END_TIME]): '''查短信发送记录 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 否 需要查询的手机号 15205201314 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间...
[ "查短信发送记录", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "否", "需要查询的手机号", "15205201314", "start_time", "String", "是", "短信发送开始时间", "2013", "-", "08", "-", "11", "00", ":", "00", ":", ...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L220-L240
[ "def", "get_record", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "START_TIME", ",", "END_TIME", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.count
统计短信条数 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间 2013-08-12 00:00:00 mobile String 否 需要查询的手机号 15205201314 page_num Integer 否 页码,默认值为1 1 page_size I...
yunpian_python_sdk/api/sms.py
def count(self, param, must=[APIKEY, START_TIME, END_TIME]): '''统计短信条数 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间 2013-08-12 00:00:00 mobile String 否 需要查询的手...
def count(self, param, must=[APIKEY, START_TIME, END_TIME]): '''统计短信条数 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 start_time String 是 短信发送开始时间 2013-08-11 00:00:00 end_time String 是 短信发送结束时间 2013-08-12 00:00:00 mobile String 否 需要查询的手...
[ "统计短信条数", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "start_time", "String", "是", "短信发送开始时间", "2013", "-", "08", "-", "11", "00", ":", "00", ":", "00", "end_time", "String", "是", "短信发送结束时间", "2013"...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L242-L262
[ "def", "count", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "START_TIME", ",", "END_TIME", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":",...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.tpl_send
指定模板发送 only v1 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号 15205201314 tpl_id Long 是 模板id 1 tpl_value String 是 变量名和变量值对。请先对您的变量名和变量值分别进行urlencode再传递。使用参考:代码示例。 注:变量名和变量值都不能为空 模板: 【#company#】您的验证码是#co...
yunpian_python_sdk/api/sms.py
def tpl_send(self, param, must=[APIKEY, MOBILE, TPL_ID, TPL_VALUE]): '''指定模板发送 only v1 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号 15205201314 tpl_id Long 是 模板id 1 tpl_value String 是 变量名和变量值对。请先对您的变量...
def tpl_send(self, param, must=[APIKEY, MOBILE, TPL_ID, TPL_VALUE]): '''指定模板发送 only v1 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号 15205201314 tpl_id Long 是 模板id 1 tpl_value String 是 变量名和变量值对。请先对您的变量...
[ "指定模板发送", "only", "v1", "deprecated", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "是", "接收的手机号", "15205201314", "tpl_id", "Long", "是", "模板id", "1", "tpl_value", "String", "是", "变量名和变...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L264-L289
[ "def", "tpl_send", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "MOBILE", ",", "TPL_ID", ",", "TPL_VALUE", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
SmsApi.tpl_single_send
指定模板单发 only v2 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见: https://en.wikipedia.org/wiki/E.164) 15205201314 tpl_id Long 是 模板id 1 ...
yunpian_python_sdk/api/sms.py
def tpl_single_send(self, param, must=[APIKEY, MOBILE, TPL_ID, TPL_VALUE]): '''指定模板单发 only v2 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见: ...
def tpl_single_send(self, param, must=[APIKEY, MOBILE, TPL_ID, TPL_VALUE]): '''指定模板单发 only v2 deprecated 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见: ...
[ "指定模板单发", "only", "v2", "deprecated" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L291-L318
[ "def", "tpl_single_send", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "MOBILE", ",", "TPL_ID", ",", "TPL_VALUE", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_s...
405a1196ec83fdf29ff454f74ef036974be11970
train
FlowApi.get_package
查询流量包 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 carrier String 否 运营商ID 传入该参数则获取指定运营商的流量包, 否则获取所有运营商的流量包 移动:10086 联通:10010 电信:10000 Args: param: Results: Result
yunpian_python_sdk/api/flow.py
def get_package(self, param=None, must=[APIKEY]): '''查询流量包 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 carrier String 否 运营商ID 传入该参数则获取指定运营商的流量包, 否则获取所有运营商的流量包 移动:10086 联通:10010 电信:10000 Args: param: Results: ...
def get_package(self, param=None, must=[APIKEY]): '''查询流量包 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 carrier String 否 运营商ID 传入该参数则获取指定运营商的流量包, 否则获取所有运营商的流量包 移动:10086 联通:10010 电信:10000 Args: param: Results: ...
[ "查询流量包", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "carrier", "String", "否", "运营商ID", "传入该参数则获取指定运营商的流量包,", "否则获取所有运营商的流量包", "移动:10086", "联通:10010", "电信:10000", "Args", ":", "param", ":", "Results", ":", ...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/flow.py#L19-L36
[ "def", "get_package", "(", "self", ",", "param", "=", "None", ",", "must", "=", "[", "APIKEY", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
FlowApi.recharge
充值流量 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(仅支持大陆号码) 15205201314 sn String 是 流量包的唯一ID 点击查看 1008601 callback_url String 否 本条流量充值的状态报告推送地址 http://your_receive_url_address encrypt String 否 加密方式 使用加密 tea (不再使用...
yunpian_python_sdk/api/flow.py
def recharge(self, param, must=[APIKEY, MOBILE, SN]): '''充值流量 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(仅支持大陆号码) 15205201314 sn String 是 流量包的唯一ID 点击查看 1008601 callback_url String 否 本条流量充值的状态报告推送地址 http://your...
def recharge(self, param, must=[APIKEY, MOBILE, SN]): '''充值流量 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号(仅支持大陆号码) 15205201314 sn String 是 流量包的唯一ID 点击查看 1008601 callback_url String 否 本条流量充值的状态报告推送地址 http://your...
[ "充值流量", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "是", "接收的手机号(仅支持大陆号码)", "15205201314", "sn", "String", "是", "流量包的唯一ID", "点击查看", "1008601", "callback_url", "String", "否", "本条流量充值的状态报告...
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/flow.py#L38-L58
[ "def", "recharge", "(", "self", ",", "param", ",", "must", "=", "[", "APIKEY", ",", "MOBILE", ",", "SN", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":", "ret...
405a1196ec83fdf29ff454f74ef036974be11970
train
FlowApi.pull_status
获取状态报告 参数名 是否必须 描述 示例 apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result
yunpian_python_sdk/api/flow.py
def pull_status(self, param=None, must=[APIKEY]): '''获取状态报告 参数名 是否必须 描述 示例 apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result ''' param = {} if param is N...
def pull_status(self, param=None, must=[APIKEY]): '''获取状态报告 参数名 是否必须 描述 示例 apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result ''' param = {} if param is N...
[ "获取状态报告", "参数名", "是否必须", "描述", "示例", "apikey", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "page_size", "否", "每页个数,最大100个,默认20个", "20", "Args", ":", "param", ":", "Results", ":", "Result" ]
yunpian/yunpian-python-sdk
python
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/flow.py#L60-L77
[ "def", "pull_status", "(", "self", ",", "param", "=", "None", ",", "must", "=", "[", "APIKEY", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ...
405a1196ec83fdf29ff454f74ef036974be11970
train
run_command
Runs a command, piping all output to the DMP log. The args should be separate arguments so paths and subcommands can have spaces in them: ret = run_command('ls', '-l', '/Users/me/My Documents') print(ret.code) print(ret.stdout) print(ret.stderr) On Windows, the PATH is not foll...
django_mako_plus/command.py
def run_command(*args, raise_exception=True, cwd=None): ''' Runs a command, piping all output to the DMP log. The args should be separate arguments so paths and subcommands can have spaces in them: ret = run_command('ls', '-l', '/Users/me/My Documents') print(ret.code) print(ret.std...
def run_command(*args, raise_exception=True, cwd=None): ''' Runs a command, piping all output to the DMP log. The args should be separate arguments so paths and subcommands can have spaces in them: ret = run_command('ls', '-l', '/Users/me/My Documents') print(ret.code) print(ret.std...
[ "Runs", "a", "command", "piping", "all", "output", "to", "the", "DMP", "log", ".", "The", "args", "should", "be", "separate", "arguments", "so", "paths", "and", "subcommands", "can", "have", "spaces", "in", "them", ":" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/command.py#L13-L37
[ "def", "run_command", "(", "*", "args", ",", "raise_exception", "=", "True", ",", "cwd", "=", "None", ")", ":", "args", "=", "[", "str", "(", "a", ")", "for", "a", "in", "args", "]", "log", ".", "info", "(", "'running %s'", ",", "' '", ".", "join...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplateLoader.get_template
Retrieve a *Django* API template object for the given template name, using the app_path and template_subdir settings in this object. This method still uses the corresponding Mako template and engine, but it gives a Django API wrapper around it so you can use it the same as any Django template. ...
django_mako_plus/template/loader.py
def get_template(self, template, def_name=None): '''Retrieve a *Django* API template object for the given template name, using the app_path and template_subdir settings in this object. This method still uses the corresponding Mako template and engine, but it gives a Django API wrapper aro...
def get_template(self, template, def_name=None): '''Retrieve a *Django* API template object for the given template name, using the app_path and template_subdir settings in this object. This method still uses the corresponding Mako template and engine, but it gives a Django API wrapper aro...
[ "Retrieve", "a", "*", "Django", "*", "API", "template", "object", "for", "the", "given", "template", "name", "using", "the", "app_path", "and", "template_subdir", "settings", "in", "this", "object", ".", "This", "method", "still", "uses", "the", "corresponding...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/template/loader.py#L71-L95
[ "def", "get_template", "(", "self", ",", "template", ",", "def_name", "=", "None", ")", ":", "try", ":", "# wrap the mako template in an adapter that gives the Django template API", "return", "MakoTemplateAdapter", "(", "self", ".", "get_mako_template", "(", "template", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplateLoader.get_mako_template
Retrieve the real *Mako* template object for the given template name without any wrapper, using the app_path and template_subdir settings in this object. This method is an alternative to get_template(). Use it when you need the actual Mako template object. This method raises a Mako ex...
django_mako_plus/template/loader.py
def get_mako_template(self, template, force=False): '''Retrieve the real *Mako* template object for the given template name without any wrapper, using the app_path and template_subdir settings in this object. This method is an alternative to get_template(). Use it when you need the actua...
def get_mako_template(self, template, force=False): '''Retrieve the real *Mako* template object for the given template name without any wrapper, using the app_path and template_subdir settings in this object. This method is an alternative to get_template(). Use it when you need the actua...
[ "Retrieve", "the", "real", "*", "Mako", "*", "template", "object", "for", "the", "given", "template", "name", "without", "any", "wrapper", "using", "the", "app_path", "and", "template_subdir", "settings", "in", "this", "object", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/template/loader.py#L98-L119
[ "def", "get_mako_template", "(", "self", ",", "template", ",", "force", "=", "False", ")", ":", "if", "template", "is", "None", ":", "raise", "TemplateLookupException", "(", "'Template \"%s\" not found in search path: %s.'", "%", "(", "template", ",", "self", ".",...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
app_resolver
Registers the given app_name with DMP and adds convention-based url patterns for it. This function is meant to be called in a project's urls.py.
django_mako_plus/router/resolver.py
def app_resolver(app_name=None, pattern_kwargs=None, name=None): ''' Registers the given app_name with DMP and adds convention-based url patterns for it. This function is meant to be called in a project's urls.py. ''' urlconf = URLConf(app_name, pattern_kwargs) resolver = re_path( '...
def app_resolver(app_name=None, pattern_kwargs=None, name=None): ''' Registers the given app_name with DMP and adds convention-based url patterns for it. This function is meant to be called in a project's urls.py. ''' urlconf = URLConf(app_name, pattern_kwargs) resolver = re_path( '...
[ "Registers", "the", "given", "app_name", "with", "DMP", "and", "adds", "convention", "-", "based", "url", "patterns", "for", "it", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/resolver.py#L30-L46
[ "def", "app_resolver", "(", "app_name", "=", "None", ",", "pattern_kwargs", "=", "None", ",", "name", "=", "None", ")", ":", "urlconf", "=", "URLConf", "(", "app_name", ",", "pattern_kwargs", ")", "resolver", "=", "re_path", "(", "'^{}/?'", ".", "format", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
dmp_paths_for_app
Utility function that creates the default patterns for an app
django_mako_plus/router/resolver.py
def dmp_paths_for_app(app_name, pattern_kwargs=None, pretty_app_name=None): '''Utility function that creates the default patterns for an app''' dmp = apps.get_app_config('django_mako_plus') # Because these patterns are subpatterns within the app's resolver, # we don't include the /app/ in the pattern --...
def dmp_paths_for_app(app_name, pattern_kwargs=None, pretty_app_name=None): '''Utility function that creates the default patterns for an app''' dmp = apps.get_app_config('django_mako_plus') # Because these patterns are subpatterns within the app's resolver, # we don't include the /app/ in the pattern --...
[ "Utility", "function", "that", "creates", "the", "default", "patterns", "for", "an", "app" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/resolver.py#L65-L131
[ "def", "dmp_paths_for_app", "(", "app_name", ",", "pattern_kwargs", "=", "None", ",", "pretty_app_name", "=", "None", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "# Because these patterns are subpatterns within the app's resolver,"...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
dmp_path
Creates a DMP-style, convention-based pattern that resolves to various view functions based on the 'dmp_page' value. The following should exist as 1) regex named groups or 2) items in the kwargs dict: dmp_app Should resolve to a name in INSTALLED_APPS. If missing, de...
django_mako_plus/router/resolver.py
def dmp_path(regex, kwargs=None, name=None, app_name=None): ''' Creates a DMP-style, convention-based pattern that resolves to various view functions based on the 'dmp_page' value. The following should exist as 1) regex named groups or 2) items in the kwargs dict: dmp_app Should res...
def dmp_path(regex, kwargs=None, name=None, app_name=None): ''' Creates a DMP-style, convention-based pattern that resolves to various view functions based on the 'dmp_page' value. The following should exist as 1) regex named groups or 2) items in the kwargs dict: dmp_app Should res...
[ "Creates", "a", "DMP", "-", "style", "convention", "-", "based", "pattern", "that", "resolves", "to", "various", "view", "functions", "based", "on", "the", "dmp_page", "value", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/resolver.py#L140-L160
[ "def", "dmp_path", "(", "regex", ",", "kwargs", "=", "None", ",", "name", "=", "None", ",", "app_name", "=", "None", ")", ":", "return", "PagePattern", "(", "regex", ",", "kwargs", ",", "name", ",", "app_name", ")" ]
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
PagePattern.resolve
Different from Django, this method matches by /app/page/ convention using its pattern. The pattern should create keyword arguments for dmp_app, dmp_page.
django_mako_plus/router/resolver.py
def resolve(self, path): ''' Different from Django, this method matches by /app/page/ convention using its pattern. The pattern should create keyword arguments for dmp_app, dmp_page. ''' match = super().resolve(path) if match: try: rou...
def resolve(self, path): ''' Different from Django, this method matches by /app/page/ convention using its pattern. The pattern should create keyword arguments for dmp_app, dmp_page. ''' match = super().resolve(path) if match: try: rou...
[ "Different", "from", "Django", "this", "method", "matches", "by", "/", "app", "/", "page", "/", "convention", "using", "its", "pattern", ".", "The", "pattern", "should", "create", "keyword", "arguments", "for", "dmp_app", "dmp_page", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/resolver.py#L183-L227
[ "def", "resolve", "(", "self", ",", "path", ")", ":", "match", "=", "super", "(", ")", ".", "resolve", "(", "path", ")", "if", "match", ":", "try", ":", "routing_data", "=", "RoutingData", "(", "match", ".", "kwargs", ".", "pop", "(", "'dmp_app'", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
alternate_syntax
A Mako filter that renders a block of text using a different template engine than Mako. The named template engine must be listed in settings.TEMPLATES. The template context variables are available in the embedded template. Specify kwargs to add additional variables created within the template. This i...
django_mako_plus/filters.py
def alternate_syntax(local, using, **kwargs): ''' A Mako filter that renders a block of text using a different template engine than Mako. The named template engine must be listed in settings.TEMPLATES. The template context variables are available in the embedded template. Specify kwargs to add add...
def alternate_syntax(local, using, **kwargs): ''' A Mako filter that renders a block of text using a different template engine than Mako. The named template engine must be listed in settings.TEMPLATES. The template context variables are available in the embedded template. Specify kwargs to add add...
[ "A", "Mako", "filter", "that", "renders", "a", "block", "of", "text", "using", "a", "different", "template", "engine", "than", "Mako", ".", "The", "named", "template", "engine", "must", "be", "listed", "in", "settings", ".", "TEMPLATES", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/filters.py#L64-L124
[ "def", "alternate_syntax", "(", "local", ",", "using", ",", "*", "*", "kwargs", ")", ":", "# get the request (the MakoTemplateAdapter above places this in the context)", "request", "=", "local", ".", "context", "[", "'request'", "]", "if", "isinstance", "(", "local", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
get_view_function
Retrieves a view function from the cache, finding it if the first time. Raises ViewDoesNotExist if not found. This is called by resolver.py.
django_mako_plus/router/discover.py
def get_view_function(module_name, function_name, fallback_app=None, fallback_template=None, verify_decorator=True): ''' Retrieves a view function from the cache, finding it if the first time. Raises ViewDoesNotExist if not found. This is called by resolver.py. ''' # first check the cache (without ...
def get_view_function(module_name, function_name, fallback_app=None, fallback_template=None, verify_decorator=True): ''' Retrieves a view function from the cache, finding it if the first time. Raises ViewDoesNotExist if not found. This is called by resolver.py. ''' # first check the cache (without ...
[ "Retrieves", "a", "view", "function", "from", "the", "cache", "finding", "it", "if", "the", "first", "time", ".", "Raises", "ViewDoesNotExist", "if", "not", "found", ".", "This", "is", "called", "by", "resolver", ".", "py", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/discover.py#L24-L47
[ "def", "get_view_function", "(", "module_name", ",", "function_name", ",", "fallback_app", "=", "None", ",", "fallback_template", "=", "None", ",", "verify_decorator", "=", "True", ")", ":", "# first check the cache (without doing locks)", "key", "=", "(", "module_nam...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
find_view_function
Finds a view function, class-based view, or template view. Raises ViewDoesNotExist if not found.
django_mako_plus/router/discover.py
def find_view_function(module_name, function_name, fallback_app=None, fallback_template=None, verify_decorator=True): ''' Finds a view function, class-based view, or template view. Raises ViewDoesNotExist if not found. ''' dmp = apps.get_app_config('django_mako_plus') # I'm first calling find_s...
def find_view_function(module_name, function_name, fallback_app=None, fallback_template=None, verify_decorator=True): ''' Finds a view function, class-based view, or template view. Raises ViewDoesNotExist if not found. ''' dmp = apps.get_app_config('django_mako_plus') # I'm first calling find_s...
[ "Finds", "a", "view", "function", "class", "-", "based", "view", "or", "template", "view", ".", "Raises", "ViewDoesNotExist", "if", "not", "found", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/discover.py#L50-L99
[ "def", "find_view_function", "(", "module_name", ",", "function_name", ",", "fallback_app", "=", "None", ",", "fallback_template", "=", "None", ",", "verify_decorator", "=", "True", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
create_view_for_template
Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist.
django_mako_plus/router/discover.py
def create_view_for_template(app_name, template_name): ''' Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist. ''' # ensure the template exists apps.get_app_config('django_mako_plus').engine.g...
def create_view_for_template(app_name, template_name): ''' Creates a view function for templates (used whe a view.py file doesn't exist but the .html does) Raises TemplateDoesNotExist if the template doesn't exist. ''' # ensure the template exists apps.get_app_config('django_mako_plus').engine.g...
[ "Creates", "a", "view", "function", "for", "templates", "(", "used", "whe", "a", "view", ".", "py", "file", "doesn", "t", "exist", "but", "the", ".", "html", "does", ")", "Raises", "TemplateDoesNotExist", "if", "the", "template", "doesn", "t", "exist", "...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/router/discover.py#L102-L116
[ "def", "create_view_for_template", "(", "app_name", ",", "template_name", ")", ":", "# ensure the template exists", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", ".", "engine", ".", "get_template_loader", "(", "app_name", ")", ".", "get_template", "("...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
BaseProvider.iter_related
Generator function that iterates this object's related providers, which includes this provider.
django_mako_plus/provider/base.py
def iter_related(self): ''' Generator function that iterates this object's related providers, which includes this provider. ''' for tpl in self.provider_run.templates: yield tpl.providers[self.index]
def iter_related(self): ''' Generator function that iterates this object's related providers, which includes this provider. ''' for tpl in self.provider_run.templates: yield tpl.providers[self.index]
[ "Generator", "function", "that", "iterates", "this", "object", "s", "related", "providers", "which", "includes", "this", "provider", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/base.py#L94-L100
[ "def", "iter_related", "(", "self", ")", ":", "for", "tpl", "in", "self", ".", "provider_run", ".", "templates", ":", "yield", "tpl", ".", "providers", "[", "self", ".", "index", "]" ]
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
BaseProvider.get_cache_item
Gets the cached item. Raises AttributeError if it hasn't been set.
django_mako_plus/provider/base.py
def get_cache_item(self): '''Gets the cached item. Raises AttributeError if it hasn't been set.''' if settings.DEBUG: raise AttributeError('Caching disabled in DEBUG mode') return getattr(self.template, self.options['template_cache_key'])
def get_cache_item(self): '''Gets the cached item. Raises AttributeError if it hasn't been set.''' if settings.DEBUG: raise AttributeError('Caching disabled in DEBUG mode') return getattr(self.template, self.options['template_cache_key'])
[ "Gets", "the", "cached", "item", ".", "Raises", "AttributeError", "if", "it", "hasn", "t", "been", "set", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/base.py#L149-L153
[ "def", "get_cache_item", "(", "self", ")", ":", "if", "settings", ".", "DEBUG", ":", "raise", "AttributeError", "(", "'Caching disabled in DEBUG mode'", ")", "return", "getattr", "(", "self", ".", "template", ",", "self", ".", "options", "[", "'template_cache_ke...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
flatten
Generator that recursively flattens embedded lists, tuples, etc.
django_mako_plus/util/datastruct.py
def flatten(*args): '''Generator that recursively flattens embedded lists, tuples, etc.''' for arg in args: if isinstance(arg, collections.Iterable) and not isinstance(arg, (str, bytes)): yield from flatten(*arg) else: yield arg
def flatten(*args): '''Generator that recursively flattens embedded lists, tuples, etc.''' for arg in args: if isinstance(arg, collections.Iterable) and not isinstance(arg, (str, bytes)): yield from flatten(*arg) else: yield arg
[ "Generator", "that", "recursively", "flattens", "embedded", "lists", "tuples", "etc", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/util/datastruct.py#L18-L24
[ "def", "flatten", "(", "*", "args", ")", ":", "for", "arg", "in", "args", ":", "if", "isinstance", "(", "arg", ",", "collections", ".", "Iterable", ")", "and", "not", "isinstance", "(", "arg", ",", "(", "str", ",", "bytes", ")", ")", ":", "yield", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
crc32
Calculates the CRC checksum for a file. Using CRC32 because security isn't the issue and don't need perfect noncollisions. We just need to know if a file has changed. On my machine, crc32 was 20 times faster than any hashlib algorithm, including blake and md5 algorithms.
django_mako_plus/util/datastruct.py
def crc32(filename): ''' Calculates the CRC checksum for a file. Using CRC32 because security isn't the issue and don't need perfect noncollisions. We just need to know if a file has changed. On my machine, crc32 was 20 times faster than any hashlib algorithm, including blake and md5 algorithms...
def crc32(filename): ''' Calculates the CRC checksum for a file. Using CRC32 because security isn't the issue and don't need perfect noncollisions. We just need to know if a file has changed. On my machine, crc32 was 20 times faster than any hashlib algorithm, including blake and md5 algorithms...
[ "Calculates", "the", "CRC", "checksum", "for", "a", "file", ".", "Using", "CRC32", "because", "security", "isn", "t", "the", "issue", "and", "don", "t", "need", "perfect", "noncollisions", ".", "We", "just", "need", "to", "know", "if", "a", "file", "has"...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/util/datastruct.py#L28-L44
[ "def", "crc32", "(", "filename", ")", ":", "result", "=", "0", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fin", ":", "while", "True", ":", "chunk", "=", "fin", ".", "read", "(", "48", ")", "if", "len", "(", "chunk", ")", "==", "0...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
Command.compile_mako_files
Compiles the Mako templates within the apps of this system
django_mako_plus/management/commands/dmp_makemessages.py
def compile_mako_files(self, app_config): '''Compiles the Mako templates within the apps of this system''' # go through the files in the templates, scripts, and styles directories for subdir_name in self.SEARCH_DIRS: subdir = subdir_name.format( app_path=app_config.pa...
def compile_mako_files(self, app_config): '''Compiles the Mako templates within the apps of this system''' # go through the files in the templates, scripts, and styles directories for subdir_name in self.SEARCH_DIRS: subdir = subdir_name.format( app_path=app_config.pa...
[ "Compiles", "the", "Mako", "templates", "within", "the", "apps", "of", "this", "system" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/management/commands/dmp_makemessages.py#L70-L100
[ "def", "compile_mako_files", "(", "self", ",", "app_config", ")", ":", "# go through the files in the templates, scripts, and styles directories", "for", "subdir_name", "in", "self", ".", "SEARCH_DIRS", ":", "subdir", "=", "subdir_name", ".", "format", "(", "app_path", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplates.from_string
Compiles a template from the given string. This is one of the required methods of Django template engines.
django_mako_plus/engine.py
def from_string(self, template_code): ''' Compiles a template from the given string. This is one of the required methods of Django template engines. ''' dmp = apps.get_app_config('django_mako_plus') mako_template = Template(template_code, imports=dmp.template_imports, inp...
def from_string(self, template_code): ''' Compiles a template from the given string. This is one of the required methods of Django template engines. ''' dmp = apps.get_app_config('django_mako_plus') mako_template = Template(template_code, imports=dmp.template_imports, inp...
[ "Compiles", "a", "template", "from", "the", "given", "string", ".", "This", "is", "one", "of", "the", "required", "methods", "of", "Django", "template", "engines", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/engine.py#L58-L65
[ "def", "from_string", "(", "self", ",", "template_code", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "mako_template", "=", "Template", "(", "template_code", ",", "imports", "=", "dmp", ".", "template_imports", ",", "inp...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplates.get_template
Retrieves a template object from the pattern "app_name/template.html". This is one of the required methods of Django template engines. Because DMP templates are always app-specific (Django only searches a global set of directories), the template_name MUST be in the format: "app_name/tem...
django_mako_plus/engine.py
def get_template(self, template_name): ''' Retrieves a template object from the pattern "app_name/template.html". This is one of the required methods of Django template engines. Because DMP templates are always app-specific (Django only searches a global set of directories), the...
def get_template(self, template_name): ''' Retrieves a template object from the pattern "app_name/template.html". This is one of the required methods of Django template engines. Because DMP templates are always app-specific (Django only searches a global set of directories), the...
[ "Retrieves", "a", "template", "object", "from", "the", "pattern", "app_name", "/", "template", ".", "html", ".", "This", "is", "one", "of", "the", "required", "methods", "of", "Django", "template", "engines", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/engine.py#L68-L87
[ "def", "get_template", "(", "self", ",", "template_name", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "match", "=", "RE_TEMPLATE_NAME", ".", "match", "(", "template_name", ")", "if", "match", "is", "None", "or", "matc...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplates.get_template_loader
Returns a template loader object for the given app name in the given subdir. For example, get_template_loader('homepage', 'styles') will return a loader for the styles/ directory in the homepage app. The app parameter can be either an app name or an AppConfig instance. The subdir parame...
django_mako_plus/engine.py
def get_template_loader(self, app, subdir='templates', create=False): ''' Returns a template loader object for the given app name in the given subdir. For example, get_template_loader('homepage', 'styles') will return a loader for the styles/ directory in the homepage app. The a...
def get_template_loader(self, app, subdir='templates', create=False): ''' Returns a template loader object for the given app name in the given subdir. For example, get_template_loader('homepage', 'styles') will return a loader for the styles/ directory in the homepage app. The a...
[ "Returns", "a", "template", "loader", "object", "for", "the", "given", "app", "name", "in", "the", "given", "subdir", ".", "For", "example", "get_template_loader", "(", "homepage", "styles", ")", "will", "return", "a", "loader", "for", "the", "styles", "/", ...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/engine.py#L90-L129
[ "def", "get_template_loader", "(", "self", ",", "app", ",", "subdir", "=", "'templates'", ",", "create", "=", "False", ")", ":", "# ensure we have an AppConfig", "if", "app", "is", "None", ":", "raise", "TemplateDoesNotExist", "(", "\"Cannot locate loader when app i...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
MakoTemplates.get_template_loader_for_path
Returns a template loader object for the given directory path. For example, get_template_loader('/var/mytemplates/') will return a loader for that specific directory. Normally, you should not have to call this method. Django automatically adds request.dmp.render() and request.dmp.rende...
django_mako_plus/engine.py
def get_template_loader_for_path(self, path, use_cache=True): ''' Returns a template loader object for the given directory path. For example, get_template_loader('/var/mytemplates/') will return a loader for that specific directory. Normally, you should not have to call this met...
def get_template_loader_for_path(self, path, use_cache=True): ''' Returns a template loader object for the given directory path. For example, get_template_loader('/var/mytemplates/') will return a loader for that specific directory. Normally, you should not have to call this met...
[ "Returns", "a", "template", "loader", "object", "for", "the", "given", "directory", "path", ".", "For", "example", "get_template_loader", "(", "/", "var", "/", "mytemplates", "/", ")", "will", "return", "a", "loader", "for", "that", "specific", "directory", ...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/engine.py#L132-L165
[ "def", "get_template_loader_for_path", "(", "self", ",", "path", ",", "use_cache", "=", "True", ")", ":", "# get from the cache if we are able", "if", "use_cache", ":", "try", ":", "return", "self", ".", "template_loaders", "[", "path", "]", "except", "KeyError", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
ParameterConverter._register_converter
Triggered by the @converter_function decorator
django_mako_plus/converter/base.py
def _register_converter(cls, conv_func, conv_type): '''Triggered by the @converter_function decorator''' cls.converters.append(ConverterFunctionInfo(conv_func, conv_type, len(cls.converters))) cls._sort_converters()
def _register_converter(cls, conv_func, conv_type): '''Triggered by the @converter_function decorator''' cls.converters.append(ConverterFunctionInfo(conv_func, conv_type, len(cls.converters))) cls._sort_converters()
[ "Triggered", "by", "the" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/converter/base.py#L83-L86
[ "def", "_register_converter", "(", "cls", ",", "conv_func", ",", "conv_type", ")", ":", "cls", ".", "converters", ".", "append", "(", "ConverterFunctionInfo", "(", "conv_func", ",", "conv_type", ",", "len", "(", "cls", ".", "converters", ")", ")", ")", "cl...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
ParameterConverter._sort_converters
Sorts the converter functions
django_mako_plus/converter/base.py
def _sort_converters(cls, app_ready=False): '''Sorts the converter functions''' # app_ready is True when called from DMP's AppConfig.ready() # we can't sort before then because models aren't ready cls._sorting_enabled = cls._sorting_enabled or app_ready if cls._sorting_enabled: ...
def _sort_converters(cls, app_ready=False): '''Sorts the converter functions''' # app_ready is True when called from DMP's AppConfig.ready() # we can't sort before then because models aren't ready cls._sorting_enabled = cls._sorting_enabled or app_ready if cls._sorting_enabled: ...
[ "Sorts", "the", "converter", "functions" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/converter/base.py#L90-L98
[ "def", "_sort_converters", "(", "cls", ",", "app_ready", "=", "False", ")", ":", "# app_ready is True when called from DMP's AppConfig.ready()", "# we can't sort before then because models aren't ready", "cls", ".", "_sorting_enabled", "=", "cls", ".", "_sorting_enabled", "or",...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
ParameterConverter.convert_parameters
Iterates the urlparams and converts them according to the type hints in the current view function. This is the primary function of the class.
django_mako_plus/converter/base.py
def convert_parameters(self, request, *args, **kwargs): ''' Iterates the urlparams and converts them according to the type hints in the current view function. This is the primary function of the class. ''' args = list(args) urlparam_i = 0 parameters = se...
def convert_parameters(self, request, *args, **kwargs): ''' Iterates the urlparams and converts them according to the type hints in the current view function. This is the primary function of the class. ''' args = list(args) urlparam_i = 0 parameters = se...
[ "Iterates", "the", "urlparams", "and", "converts", "them", "according", "to", "the", "type", "hints", "in", "the", "current", "view", "function", ".", "This", "is", "the", "primary", "function", "of", "the", "class", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/converter/base.py#L101-L134
[ "def", "convert_parameters", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "=", "list", "(", "args", ")", "urlparam_i", "=", "0", "parameters", "=", "self", ".", "view_parameters", ".", "get", "(", "request",...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
ParameterConverter.convert_value
Converts a parameter value in the view function call. value: value from request.dmp.urlparams to convert The value will always be a string, even if empty '' (never None). parameter: an instance of django_mako_plus.ViewParameter that holds this parameter's ...
django_mako_plus/converter/base.py
def convert_value(self, value, parameter, request): ''' Converts a parameter value in the view function call. value: value from request.dmp.urlparams to convert The value will always be a string, even if empty '' (never None). parameter: an instanc...
def convert_value(self, value, parameter, request): ''' Converts a parameter value in the view function call. value: value from request.dmp.urlparams to convert The value will always be a string, even if empty '' (never None). parameter: an instanc...
[ "Converts", "a", "parameter", "value", "in", "the", "view", "function", "call", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/converter/base.py#L137-L195
[ "def", "convert_value", "(", "self", ",", "value", ",", "parameter", ",", "request", ")", ":", "try", ":", "# we don't convert anything without type hints", "if", "parameter", ".", "type", "is", "inspect", ".", "Parameter", ".", "empty", ":", "if", "log", ".",...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
Command.create_entry_file
Creates an entry file for the given script map
django_mako_plus/management/commands/dmp_webpack.py
def create_entry_file(self, filename, script_map, enapps): '''Creates an entry file for the given script map''' if len(script_map) == 0: return # create the entry file template = MakoTemplate(''' <%! import os %> // dynamic imports are within functions so they don't happen u...
def create_entry_file(self, filename, script_map, enapps): '''Creates an entry file for the given script map''' if len(script_map) == 0: return # create the entry file template = MakoTemplate(''' <%! import os %> // dynamic imports are within functions so they don't happen u...
[ "Creates", "an", "entry", "file", "for", "the", "given", "script", "map" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/management/commands/dmp_webpack.py#L89-L136
[ "def", "create_entry_file", "(", "self", ",", "filename", ",", "script_map", ",", "enapps", ")", ":", "if", "len", "(", "script_map", ")", "==", "0", ":", "return", "# create the entry file", "template", "=", "MakoTemplate", "(", "'''\n<%! import os %>\n// dynamic...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
Command.generate_script_map
Maps templates in this app to their scripts. This function deep searches app/templates/* for the templates of this app. Returns the following dictionary with absolute paths: { ( 'appname', 'template1' ): [ '/abs/path/to/scripts/template1.js', '/abs/path/to/scripts/supertemplate1.j...
django_mako_plus/management/commands/dmp_webpack.py
def generate_script_map(self, config): ''' Maps templates in this app to their scripts. This function deep searches app/templates/* for the templates of this app. Returns the following dictionary with absolute paths: { ( 'appname', 'template1' ): [ '/abs/path/to/sc...
def generate_script_map(self, config): ''' Maps templates in this app to their scripts. This function deep searches app/templates/* for the templates of this app. Returns the following dictionary with absolute paths: { ( 'appname', 'template1' ): [ '/abs/path/to/sc...
[ "Maps", "templates", "in", "this", "app", "to", "their", "scripts", ".", "This", "function", "deep", "searches", "app", "/", "templates", "/", "*", "for", "the", "templates", "of", "this", "app", ".", "Returns", "the", "following", "dictionary", "with", "a...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/management/commands/dmp_webpack.py#L138-L175
[ "def", "generate_script_map", "(", "self", ",", "config", ")", ":", "script_map", "=", "OrderedDict", "(", ")", "template_root", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "relpath", "(", "config", ".", "path", ",", "settings", "...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
Command.template_scripts
Returns a list of scripts used by the given template object AND its ancestors. This runs a ProviderRun on the given template (as if it were being displayed). This allows the WEBPACK_PROVIDERS to provide the JS files to us.
django_mako_plus/management/commands/dmp_webpack.py
def template_scripts(self, config, template_name): ''' Returns a list of scripts used by the given template object AND its ancestors. This runs a ProviderRun on the given template (as if it were being displayed). This allows the WEBPACK_PROVIDERS to provide the JS files to us. '...
def template_scripts(self, config, template_name): ''' Returns a list of scripts used by the given template object AND its ancestors. This runs a ProviderRun on the given template (as if it were being displayed). This allows the WEBPACK_PROVIDERS to provide the JS files to us. '...
[ "Returns", "a", "list", "of", "scripts", "used", "by", "the", "given", "template", "object", "AND", "its", "ancestors", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/management/commands/dmp_webpack.py#L178-L195
[ "def", "template_scripts", "(", "self", ",", "config", ",", "template_name", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "template_obj", "=", "dmp", ".", "engine", ".", "get_template_loader", "(", "config", ",", "create...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
RedirectException.get_response
Returns the redirect response for this exception.
django_mako_plus/exceptions.py
def get_response(self, request, *args, **kwargs): '''Returns the redirect response for this exception.''' # normal process response = HttpResponseRedirect(self.redirect_to) response[REDIRECT_HEADER_KEY] = self.redirect_to return response
def get_response(self, request, *args, **kwargs): '''Returns the redirect response for this exception.''' # normal process response = HttpResponseRedirect(self.redirect_to) response[REDIRECT_HEADER_KEY] = self.redirect_to return response
[ "Returns", "the", "redirect", "response", "for", "this", "exception", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/exceptions.py#L54-L59
[ "def", "get_response", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# normal process", "response", "=", "HttpResponseRedirect", "(", "self", ".", "redirect_to", ")", "response", "[", "REDIRECT_HEADER_KEY", "]", "=", "sel...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
JavascriptRedirectException.get_response
Returns the redirect response for this exception.
django_mako_plus/exceptions.py
def get_response(self, request): '''Returns the redirect response for this exception.''' # the redirect key is already placed in the response by HttpResponseJavascriptRedirect return HttpResponseJavascriptRedirect(self.redirect_to, *self.args, **self.kwargs)
def get_response(self, request): '''Returns the redirect response for this exception.''' # the redirect key is already placed in the response by HttpResponseJavascriptRedirect return HttpResponseJavascriptRedirect(self.redirect_to, *self.args, **self.kwargs)
[ "Returns", "the", "redirect", "response", "for", "this", "exception", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/exceptions.py#L114-L117
[ "def", "get_response", "(", "self", ",", "request", ")", ":", "# the redirect key is already placed in the response by HttpResponseJavascriptRedirect", "return", "HttpResponseJavascriptRedirect", "(", "self", ".", "redirect_to", ",", "*", "self", ".", "args", ",", "*", "*...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
get_template_loader
Convenience method that calls get_template_loader() on the DMP template engine instance.
django_mako_plus/convenience.py
def get_template_loader(app, subdir='templates'): ''' Convenience method that calls get_template_loader() on the DMP template engine instance. ''' dmp = apps.get_app_config('django_mako_plus') return dmp.engine.get_template_loader(app, subdir, create=True)
def get_template_loader(app, subdir='templates'): ''' Convenience method that calls get_template_loader() on the DMP template engine instance. ''' dmp = apps.get_app_config('django_mako_plus') return dmp.engine.get_template_loader(app, subdir, create=True)
[ "Convenience", "method", "that", "calls", "get_template_loader", "()", "on", "the", "DMP", "template", "engine", "instance", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/convenience.py#L9-L15
[ "def", "get_template_loader", "(", "app", ",", "subdir", "=", "'templates'", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "return", "dmp", ".", "engine", ".", "get_template_loader", "(", "app", ",", "subdir", ",", "cre...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
render_template
Convenience method that directly renders a template, given the app and template names.
django_mako_plus/convenience.py
def render_template(request, app, template_name, context=None, subdir="templates", def_name=None): ''' Convenience method that directly renders a template, given the app and template names. ''' return get_template(app, template_name, subdir).render(context, request, def_name)
def render_template(request, app, template_name, context=None, subdir="templates", def_name=None): ''' Convenience method that directly renders a template, given the app and template names. ''' return get_template(app, template_name, subdir).render(context, request, def_name)
[ "Convenience", "method", "that", "directly", "renders", "a", "template", "given", "the", "app", "and", "template", "names", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/convenience.py#L27-L31
[ "def", "render_template", "(", "request", ",", "app", ",", "template_name", ",", "context", "=", "None", ",", "subdir", "=", "\"templates\"", ",", "def_name", "=", "None", ")", ":", "return", "get_template", "(", "app", ",", "template_name", ",", "subdir", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
get_template_loader_for_path
Convenience method that calls get_template_loader_for_path() on the DMP template engine instance.
django_mako_plus/convenience.py
def get_template_loader_for_path(path, use_cache=True): ''' Convenience method that calls get_template_loader_for_path() on the DMP template engine instance. ''' dmp = apps.get_app_config('django_mako_plus') return dmp.engine.get_template_loader_for_path(path, use_cache)
def get_template_loader_for_path(path, use_cache=True): ''' Convenience method that calls get_template_loader_for_path() on the DMP template engine instance. ''' dmp = apps.get_app_config('django_mako_plus') return dmp.engine.get_template_loader_for_path(path, use_cache)
[ "Convenience", "method", "that", "calls", "get_template_loader_for_path", "()", "on", "the", "DMP", "template", "engine", "instance", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/convenience.py#L34-L40
[ "def", "get_template_loader_for_path", "(", "path", ",", "use_cache", "=", "True", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "return", "dmp", ".", "engine", ".", "get_template_loader_for_path", "(", "path", ",", "use_ca...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
get_template_for_path
Convenience method that retrieves a template given a direct path to it.
django_mako_plus/convenience.py
def get_template_for_path(path, use_cache=True): ''' Convenience method that retrieves a template given a direct path to it. ''' dmp = apps.get_app_config('django_mako_plus') app_path, template_name = os.path.split(path) return dmp.engine.get_template_loader_for_path(app_path, use_cache=use_cach...
def get_template_for_path(path, use_cache=True): ''' Convenience method that retrieves a template given a direct path to it. ''' dmp = apps.get_app_config('django_mako_plus') app_path, template_name = os.path.split(path) return dmp.engine.get_template_loader_for_path(app_path, use_cache=use_cach...
[ "Convenience", "method", "that", "retrieves", "a", "template", "given", "a", "direct", "path", "to", "it", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/convenience.py#L43-L49
[ "def", "get_template_for_path", "(", "path", ",", "use_cache", "=", "True", ")", ":", "dmp", "=", "apps", ".", "get_app_config", "(", "'django_mako_plus'", ")", "app_path", ",", "template_name", "=", "os", ".", "path", ".", "split", "(", "path", ")", "retu...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
render_template_for_path
Convenience method that directly renders a template, given a direct path to it.
django_mako_plus/convenience.py
def render_template_for_path(request, path, context=None, use_cache=True, def_name=None): ''' Convenience method that directly renders a template, given a direct path to it. ''' return get_template_for_path(path, use_cache).render(context, request, def_name)
def render_template_for_path(request, path, context=None, use_cache=True, def_name=None): ''' Convenience method that directly renders a template, given a direct path to it. ''' return get_template_for_path(path, use_cache).render(context, request, def_name)
[ "Convenience", "method", "that", "directly", "renders", "a", "template", "given", "a", "direct", "path", "to", "it", "." ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/convenience.py#L52-L56
[ "def", "render_template_for_path", "(", "request", ",", "path", ",", "context", "=", "None", ",", "use_cache", "=", "True", ",", "def_name", "=", "None", ")", ":", "return", "get_template_for_path", "(", "path", ",", "use_cache", ")", ".", "render", "(", "...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
qualified_name
Returns the fully-qualified name of the given object
django_mako_plus/util/reflect.py
def qualified_name(obj): '''Returns the fully-qualified name of the given object''' if not hasattr(obj, '__module__'): obj = obj.__class__ module = obj.__module__ if module is None or module == str.__class__.__module__: return obj.__qualname__ return '{}.{}'.format(module, obj.__qual...
def qualified_name(obj): '''Returns the fully-qualified name of the given object''' if not hasattr(obj, '__module__'): obj = obj.__class__ module = obj.__module__ if module is None or module == str.__class__.__module__: return obj.__qualname__ return '{}.{}'.format(module, obj.__qual...
[ "Returns", "the", "fully", "-", "qualified", "name", "of", "the", "given", "object" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/util/reflect.py#L4-L11
[ "def", "qualified_name", "(", "obj", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'__module__'", ")", ":", "obj", "=", "obj", ".", "__class__", "module", "=", "obj", ".", "__module__", "if", "module", "is", "None", "or", "module", "==", "str", ...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
import_qualified
Imports a fully-qualified name from a module: cls = import_qualified('homepage.views.index.MyForm') Raises an ImportError if it can't be ipmorted.
django_mako_plus/util/reflect.py
def import_qualified(name): ''' Imports a fully-qualified name from a module: cls = import_qualified('homepage.views.index.MyForm') Raises an ImportError if it can't be ipmorted. ''' parts = name.rsplit('.', 1) if len(parts) != 2: raise ImportError('Invalid fully-qualified name...
def import_qualified(name): ''' Imports a fully-qualified name from a module: cls = import_qualified('homepage.views.index.MyForm') Raises an ImportError if it can't be ipmorted. ''' parts = name.rsplit('.', 1) if len(parts) != 2: raise ImportError('Invalid fully-qualified name...
[ "Imports", "a", "fully", "-", "qualified", "name", "from", "a", "module", ":" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/util/reflect.py#L14-L28
[ "def", "import_qualified", "(", "name", ")", ":", "parts", "=", "name", ".", "rsplit", "(", "'.'", ",", "1", ")", "if", "len", "(", "parts", ")", "!=", "2", ":", "raise", "ImportError", "(", "'Invalid fully-qualified name: {}'", ".", "format", "(", "name...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
links
Returns the HTML for the given provider group (or all groups if None)
django_mako_plus/provider/__init__.py
def links(tself, group=None): '''Returns the HTML for the given provider group (or all groups if None)''' pr = ProviderRun(tself, group) pr.run() return mark_safe(pr.getvalue())
def links(tself, group=None): '''Returns the HTML for the given provider group (or all groups if None)''' pr = ProviderRun(tself, group) pr.run() return mark_safe(pr.getvalue())
[ "Returns", "the", "HTML", "for", "the", "given", "provider", "group", "(", "or", "all", "groups", "if", "None", ")" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/__init__.py#L12-L16
[ "def", "links", "(", "tself", ",", "group", "=", "None", ")", ":", "pr", "=", "ProviderRun", "(", "tself", ",", "group", ")", "pr", ".", "run", "(", ")", "return", "mark_safe", "(", "pr", ".", "getvalue", "(", ")", ")" ]
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
template_links
Returns the HTML for the given provider group, using an app and template name. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular python code instead of from within a rendering template environment.
django_mako_plus/provider/__init__.py
def template_links(request, app, template_name, context=None, group=None, force=True): ''' Returns the HTML for the given provider group, using an app and template name. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular...
def template_links(request, app, template_name, context=None, group=None, force=True): ''' Returns the HTML for the given provider group, using an app and template name. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular...
[ "Returns", "the", "HTML", "for", "the", "given", "provider", "group", "using", "an", "app", "and", "template", "name", ".", "This", "method", "should", "not", "normally", "be", "used", "(", "use", "links", "()", "instead", ")", ".", "The", "use", "of", ...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/__init__.py#L19-L32
[ "def", "template_links", "(", "request", ",", "app", ",", "template_name", ",", "context", "=", "None", ",", "group", "=", "None", ",", "force", "=", "True", ")", ":", "if", "isinstance", "(", "app", ",", "str", ")", ":", "app", "=", "apps", ".", "...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
template_obj_links
Returns the HTML for the given provider group, using a template object. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular python code instead of from within a rendering template environment.
django_mako_plus/provider/__init__.py
def template_obj_links(request, template_obj, context=None, group=None): ''' Returns the HTML for the given provider group, using a template object. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular python code instead ...
def template_obj_links(request, template_obj, context=None, group=None): ''' Returns the HTML for the given provider group, using a template object. This method should not normally be used (use links() instead). The use of this method is when provider need to be called from regular python code instead ...
[ "Returns", "the", "HTML", "for", "the", "given", "provider", "group", "using", "a", "template", "object", ".", "This", "method", "should", "not", "normally", "be", "used", "(", "use", "links", "()", "instead", ")", ".", "The", "use", "of", "this", "metho...
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/__init__.py#L35-L55
[ "def", "template_obj_links", "(", "request", ",", "template_obj", ",", "context", "=", "None", ",", "group", "=", "None", ")", ":", "# the template_obj can be a MakoTemplateAdapter or a Mako Template", "# if our DMP-defined MakoTemplateAdapter, switch to the embedded Mako Template"...
a90f9b4af19e5fa9f83452989cdcaed21569a181
train
CssLinkProvider.build_default_link
Called when 'link' is not defined in the settings
django_mako_plus/provider/link.py
def build_default_link(self): '''Called when 'link' is not defined in the settings''' attrs = {} attrs["rel"] = "stylesheet" attrs["href"] ="{}?{:x}".format( os.path.join(settings.STATIC_URL, self.filepath).replace(os.path.sep, '/'), self.version_id, ) ...
def build_default_link(self): '''Called when 'link' is not defined in the settings''' attrs = {} attrs["rel"] = "stylesheet" attrs["href"] ="{}?{:x}".format( os.path.join(settings.STATIC_URL, self.filepath).replace(os.path.sep, '/'), self.version_id, ) ...
[ "Called", "when", "link", "is", "not", "defined", "in", "the", "settings" ]
doconix/django-mako-plus
python
https://github.com/doconix/django-mako-plus/blob/a90f9b4af19e5fa9f83452989cdcaed21569a181/django_mako_plus/provider/link.py#L155-L165
[ "def", "build_default_link", "(", "self", ")", ":", "attrs", "=", "{", "}", "attrs", "[", "\"rel\"", "]", "=", "\"stylesheet\"", "attrs", "[", "\"href\"", "]", "=", "\"{}?{:x}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "settings", "."...
a90f9b4af19e5fa9f83452989cdcaed21569a181