repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
napalm-automation/napalm-nxos
napalm_nxos/nxos.py
NXOSDriver._get_diff
def _get_diff(self, cp_file): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() diff_out = self.device.show( 'show diff rollback-patch file {0} file {1}'.format( 'sot_file', self.replace_file.split('/')[-1]), raw_te...
python
def _get_diff(self, cp_file): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() diff_out = self.device.show( 'show diff rollback-patch file {0} file {1}'.format( 'sot_file', self.replace_file.split('/')[-1]), raw_te...
[ "def", "_get_diff", "(", "self", ",", "cp_file", ")", ":", "diff", "=", "[", "]", "self", ".", "_create_sot_file", "(", ")", "diff_out", "=", "self", ".", "device", ".", "show", "(", "'show diff rollback-patch file {0} file {1}'", ".", "format", "(", "'sot_f...
Get a diff between running config and a proposed file.
[ "Get", "a", "diff", "between", "running", "config", "and", "a", "proposed", "file", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos/nxos.py#L252-L270
napalm-automation/napalm-nxos
napalm_nxos/nxos.py
NXOSDriver._save_config
def _save_config(self, filename): """Save the current running config to the given file.""" self.device.show('checkpoint file {}'.format(filename), raw_text=True)
python
def _save_config(self, filename): """Save the current running config to the given file.""" self.device.show('checkpoint file {}'.format(filename), raw_text=True)
[ "def", "_save_config", "(", "self", ",", "filename", ")", ":", "self", ".", "device", ".", "show", "(", "'checkpoint file {}'", ".", "format", "(", "filename", ")", ",", "raw_text", "=", "True", ")" ]
Save the current running config to the given file.
[ "Save", "the", "current", "running", "config", "to", "the", "given", "file", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos/nxos.py#L305-L307
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.open
def open(self): """Open the connection wit the device.""" try: self.device.open() except ConnectTimeoutError as cte: raise ConnectionException(cte.message) self.device.timeout = self.timeout self.device._conn._session.transport.set_keepalive(self.keepalive...
python
def open(self): """Open the connection wit the device.""" try: self.device.open() except ConnectTimeoutError as cte: raise ConnectionException(cte.message) self.device.timeout = self.timeout self.device._conn._session.transport.set_keepalive(self.keepalive...
[ "def", "open", "(", "self", ")", ":", "try", ":", "self", ".", "device", ".", "open", "(", ")", "except", "ConnectTimeoutError", "as", "cte", ":", "raise", "ConnectionException", "(", "cte", ".", "message", ")", "self", ".", "device", ".", "timeout", "...
Open the connection wit the device.
[ "Open", "the", "connection", "wit", "the", "device", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L104-L118
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver._lock
def _lock(self): """Lock the config DB.""" if not self.locked: self.device.cu.lock() self.locked = True
python
def _lock(self): """Lock the config DB.""" if not self.locked: self.device.cu.lock() self.locked = True
[ "def", "_lock", "(", "self", ")", ":", "if", "not", "self", ".", "locked", ":", "self", ".", "device", ".", "cu", ".", "lock", "(", ")", "self", ".", "locked", "=", "True" ]
Lock the config DB.
[ "Lock", "the", "config", "DB", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L126-L130
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver._unlock
def _unlock(self): """Unlock the config DB.""" if self.locked: self.device.cu.unlock() self.locked = False
python
def _unlock(self): """Unlock the config DB.""" if self.locked: self.device.cu.unlock() self.locked = False
[ "def", "_unlock", "(", "self", ")", ":", "if", "self", ".", "locked", ":", "self", ".", "device", ".", "cu", ".", "unlock", "(", ")", "self", ".", "locked", "=", "False" ]
Unlock the config DB.
[ "Unlock", "the", "config", "DB", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L132-L136
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.compare_config
def compare_config(self): """Compare candidate config with running.""" diff = self.device.cu.diff() if diff is None: return '' else: return diff.strip()
python
def compare_config(self): """Compare candidate config with running.""" diff = self.device.cu.diff() if diff is None: return '' else: return diff.strip()
[ "def", "compare_config", "(", "self", ")", ":", "diff", "=", "self", ".", "device", ".", "cu", ".", "diff", "(", ")", "if", "diff", "is", "None", ":", "return", "''", "else", ":", "return", "diff", ".", "strip", "(", ")" ]
Compare candidate config with running.
[ "Compare", "candidate", "config", "with", "running", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L229-L236
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.commit_config
def commit_config(self): """Commit configuration.""" self.device.cu.commit(ignore_warning=self.ignore_warning) if not self.config_lock: self._unlock()
python
def commit_config(self): """Commit configuration.""" self.device.cu.commit(ignore_warning=self.ignore_warning) if not self.config_lock: self._unlock()
[ "def", "commit_config", "(", "self", ")", ":", "self", ".", "device", ".", "cu", ".", "commit", "(", "ignore_warning", "=", "self", ".", "ignore_warning", ")", "if", "not", "self", ".", "config_lock", ":", "self", ".", "_unlock", "(", ")" ]
Commit configuration.
[ "Commit", "configuration", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L238-L242
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.discard_config
def discard_config(self): """Discard changes (rollback 0).""" self.device.cu.rollback(rb_id=0) if not self.config_lock: self._unlock()
python
def discard_config(self): """Discard changes (rollback 0).""" self.device.cu.rollback(rb_id=0) if not self.config_lock: self._unlock()
[ "def", "discard_config", "(", "self", ")", ":", "self", ".", "device", ".", "cu", ".", "rollback", "(", "rb_id", "=", "0", ")", "if", "not", "self", ".", "config_lock", ":", "self", ".", "_unlock", "(", ")" ]
Discard changes (rollback 0).
[ "Discard", "changes", "(", "rollback", "0", ")", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L244-L248
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_facts
def get_facts(self): """Return facts of the device.""" output = self.device.facts uptime = self.device.uptime or -1 interfaces = junos_views.junos_iface_table(self.device) interfaces.get() interface_list = interfaces.keys() return { 'vendor': u'Juni...
python
def get_facts(self): """Return facts of the device.""" output = self.device.facts uptime = self.device.uptime or -1 interfaces = junos_views.junos_iface_table(self.device) interfaces.get() interface_list = interfaces.keys() return { 'vendor': u'Juni...
[ "def", "get_facts", "(", "self", ")", ":", "output", "=", "self", ".", "device", ".", "facts", "uptime", "=", "self", ".", "device", ".", "uptime", "or", "-", "1", "interfaces", "=", "junos_views", ".", "junos_iface_table", "(", "self", ".", "device", ...
Return facts of the device.
[ "Return", "facts", "of", "the", "device", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L255-L274
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_interfaces
def get_interfaces(self): """Return interfaces details.""" result = {} interfaces = junos_views.junos_iface_table(self.device) interfaces.get() # convert all the tuples to our pre-defined dict structure for iface in interfaces.keys(): result[iface] = { ...
python
def get_interfaces(self): """Return interfaces details.""" result = {} interfaces = junos_views.junos_iface_table(self.device) interfaces.get() # convert all the tuples to our pre-defined dict structure for iface in interfaces.keys(): result[iface] = { ...
[ "def", "get_interfaces", "(", "self", ")", ":", "result", "=", "{", "}", "interfaces", "=", "junos_views", ".", "junos_iface_table", "(", "self", ".", "device", ")", "interfaces", ".", "get", "(", ")", "# convert all the tuples to our pre-defined dict structure", ...
Return interfaces details.
[ "Return", "interfaces", "details", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L276-L309
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver._get_address_family
def _get_address_family(table): """ Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family """ address_family_mapping = { 'inet': 'ipv4', 'inet6': 'ipv6', 'inetf...
python
def _get_address_family(table): """ Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family """ address_family_mapping = { 'inet': 'ipv4', 'inet6': 'ipv6', 'inetf...
[ "def", "_get_address_family", "(", "table", ")", ":", "address_family_mapping", "=", "{", "'inet'", ":", "'ipv4'", ",", "'inet6'", ":", "'ipv6'", ",", "'inetflow'", ":", "'flow'", "}", "family", "=", "table", ".", "split", "(", "'.'", ")", "[", "-", "2",...
Function to derive address family from a junos table name. :params table: The name of the routing table :returns: address family
[ "Function", "to", "derive", "address", "family", "from", "a", "junos", "table", "name", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L451-L468
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_bgp_neighbors
def get_bgp_neighbors(self): """Return BGP neighbors details.""" bgp_neighbor_data = {} default_neighbor_details = { 'local_as': 0, 'remote_as': 0, 'remote_id': '', 'is_up': False, 'is_enabled': False, 'description': '', ...
python
def get_bgp_neighbors(self): """Return BGP neighbors details.""" bgp_neighbor_data = {} default_neighbor_details = { 'local_as': 0, 'remote_as': 0, 'remote_id': '', 'is_up': False, 'is_enabled': False, 'description': '', ...
[ "def", "get_bgp_neighbors", "(", "self", ")", ":", "bgp_neighbor_data", "=", "{", "}", "default_neighbor_details", "=", "{", "'local_as'", ":", "0", ",", "'remote_as'", ":", "0", ",", "'remote_id'", ":", "''", ",", "'is_up'", ":", "False", ",", "'is_enabled'...
Return BGP neighbors details.
[ "Return", "BGP", "neighbors", "details", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L516-L628
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_lldp_neighbors
def get_lldp_neighbors(self): """Return LLDP neighbors details.""" lldp = junos_views.junos_lldp_table(self.device) try: lldp.get() except RpcError as rpcerr: # this assumes the library runs in an environment # able to handle logs # otherwi...
python
def get_lldp_neighbors(self): """Return LLDP neighbors details.""" lldp = junos_views.junos_lldp_table(self.device) try: lldp.get() except RpcError as rpcerr: # this assumes the library runs in an environment # able to handle logs # otherwi...
[ "def", "get_lldp_neighbors", "(", "self", ")", ":", "lldp", "=", "junos_views", ".", "junos_lldp_table", "(", "self", ".", "device", ")", "try", ":", "lldp", ".", "get", "(", ")", "except", "RpcError", "as", "rpcerr", ":", "# this assumes the library runs in a...
Return LLDP neighbors details.
[ "Return", "LLDP", "neighbors", "details", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L630-L650
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_lldp_neighbors_detail
def get_lldp_neighbors_detail(self, interface=''): """Detailed view of the LLDP neighbors.""" lldp_neighbors = {} lldp_table = junos_views.junos_lldp_neighbors_detail_table(self.device) try: lldp_table.get() except RpcError as rpcerr: # this assumes the l...
python
def get_lldp_neighbors_detail(self, interface=''): """Detailed view of the LLDP neighbors.""" lldp_neighbors = {} lldp_table = junos_views.junos_lldp_neighbors_detail_table(self.device) try: lldp_table.get() except RpcError as rpcerr: # this assumes the l...
[ "def", "get_lldp_neighbors_detail", "(", "self", ",", "interface", "=", "''", ")", ":", "lldp_neighbors", "=", "{", "}", "lldp_table", "=", "junos_views", ".", "junos_lldp_neighbors_detail_table", "(", "self", ".", "device", ")", "try", ":", "lldp_table", ".", ...
Detailed view of the LLDP neighbors.
[ "Detailed", "view", "of", "the", "LLDP", "neighbors", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L652-L698
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_arp_table
def get_arp_table(self): """Return the ARP table.""" # could use ArpTable # from jnpr.junos.op.phyport import ArpTable # and simply use it # but # we need: # - filters # - group by VLAN ID # - hostname & TTE fields as well arp_table ...
python
def get_arp_table(self): """Return the ARP table.""" # could use ArpTable # from jnpr.junos.op.phyport import ArpTable # and simply use it # but # we need: # - filters # - group by VLAN ID # - hostname & TTE fields as well arp_table ...
[ "def", "get_arp_table", "(", "self", ")", ":", "# could use ArpTable", "# from jnpr.junos.op.phyport import ArpTable", "# and simply use it", "# but", "# we need:", "# - filters", "# - group by VLAN ID", "# - hostname & TTE fields as well", "arp_table", "=", "[", "]", "arp_...
Return the ARP table.
[ "Return", "the", "ARP", "table", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1198-L1223
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_ntp_peers
def get_ntp_peers(self): """Return the NTP peers configured on the device.""" ntp_table = junos_views.junos_ntp_peers_config_table(self.device) ntp_table.get() ntp_peers = ntp_table.items() if not ntp_peers: return {} return {napalm_base.helpers.ip(peer[0])...
python
def get_ntp_peers(self): """Return the NTP peers configured on the device.""" ntp_table = junos_views.junos_ntp_peers_config_table(self.device) ntp_table.get() ntp_peers = ntp_table.items() if not ntp_peers: return {} return {napalm_base.helpers.ip(peer[0])...
[ "def", "get_ntp_peers", "(", "self", ")", ":", "ntp_table", "=", "junos_views", ".", "junos_ntp_peers_config_table", "(", "self", ".", "device", ")", "ntp_table", ".", "get", "(", ")", "ntp_peers", "=", "ntp_table", ".", "items", "(", ")", "if", "not", "nt...
Return the NTP peers configured on the device.
[ "Return", "the", "NTP", "peers", "configured", "on", "the", "device", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1225-L1235
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_ntp_servers
def get_ntp_servers(self): """Return the NTP servers configured on the device.""" ntp_table = junos_views.junos_ntp_servers_config_table(self.device) ntp_table.get() ntp_servers = ntp_table.items() if not ntp_servers: return {} return {napalm_base.helpers.i...
python
def get_ntp_servers(self): """Return the NTP servers configured on the device.""" ntp_table = junos_views.junos_ntp_servers_config_table(self.device) ntp_table.get() ntp_servers = ntp_table.items() if not ntp_servers: return {} return {napalm_base.helpers.i...
[ "def", "get_ntp_servers", "(", "self", ")", ":", "ntp_table", "=", "junos_views", ".", "junos_ntp_servers_config_table", "(", "self", ".", "device", ")", "ntp_table", ".", "get", "(", ")", "ntp_servers", "=", "ntp_table", ".", "items", "(", ")", "if", "not",...
Return the NTP servers configured on the device.
[ "Return", "the", "NTP", "servers", "configured", "on", "the", "device", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1237-L1247
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_ntp_stats
def get_ntp_stats(self): """Return NTP stats (associations).""" # NTP Peers does not have XML RPC defined # thus we need to retrieve raw text and parse... # :( ntp_stats = [] REGEX = ( '^\s?(\+|\*|x|-)?([a-zA-Z0-9\.+-:]+)' '\s+([a-zA-Z0-9\.]+)\s+...
python
def get_ntp_stats(self): """Return NTP stats (associations).""" # NTP Peers does not have XML RPC defined # thus we need to retrieve raw text and parse... # :( ntp_stats = [] REGEX = ( '^\s?(\+|\*|x|-)?([a-zA-Z0-9\.+-:]+)' '\s+([a-zA-Z0-9\.]+)\s+...
[ "def", "get_ntp_stats", "(", "self", ")", ":", "# NTP Peers does not have XML RPC defined", "# thus we need to retrieve raw text and parse...", "# :(", "ntp_stats", "=", "[", "]", "REGEX", "=", "(", "'^\\s?(\\+|\\*|x|-)?([a-zA-Z0-9\\.+-:]+)'", "'\\s+([a-zA-Z0-9\\.]+)\\s+([0-9]{1,2}...
Return NTP stats (associations).
[ "Return", "NTP", "stats", "(", "associations", ")", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1249-L1290
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_mac_address_table
def get_mac_address_table(self): """Return the MAC address table.""" mac_address_table = [] if self.device.facts.get('personality', '') in ['SWITCH']: # for EX & QFX devices if self.device.facts.get('switch_style', '') in ['VLAN_L2NG']: # for L2NG devices mac_table...
python
def get_mac_address_table(self): """Return the MAC address table.""" mac_address_table = [] if self.device.facts.get('personality', '') in ['SWITCH']: # for EX & QFX devices if self.device.facts.get('switch_style', '') in ['VLAN_L2NG']: # for L2NG devices mac_table...
[ "def", "get_mac_address_table", "(", "self", ")", ":", "mac_address_table", "=", "[", "]", "if", "self", ".", "device", ".", "facts", ".", "get", "(", "'personality'", ",", "''", ")", "in", "[", "'SWITCH'", "]", ":", "# for EX & QFX devices", "if", "self",...
Return the MAC address table.
[ "Return", "the", "MAC", "address", "table", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1337-L1376
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_probes_config
def get_probes_config(self): """Return the configuration of the RPM probes.""" probes = {} probes_table = junos_views.junos_rpm_probes_config_table(self.device) probes_table.get() probes_table_items = probes_table.items() for probe_test in probes_table_items: ...
python
def get_probes_config(self): """Return the configuration of the RPM probes.""" probes = {} probes_table = junos_views.junos_rpm_probes_config_table(self.device) probes_table.get() probes_table_items = probes_table.items() for probe_test in probes_table_items: ...
[ "def", "get_probes_config", "(", "self", ")", ":", "probes", "=", "{", "}", "probes_table", "=", "junos_views", ".", "junos_rpm_probes_config_table", "(", "self", ".", "device", ")", "probes_table", ".", "get", "(", ")", "probes_table_items", "=", "probes_table"...
Return the configuration of the RPM probes.
[ "Return", "the", "configuration", "of", "the", "RPM", "probes", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1539-L1572
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.get_probes_results
def get_probes_results(self): """Return the results of the RPM probes.""" probes_results = {} probes_results_table = junos_views.junos_rpm_probes_results_table(self.device) probes_results_table.get() probes_results_items = probes_results_table.items() for probe_result i...
python
def get_probes_results(self): """Return the results of the RPM probes.""" probes_results = {} probes_results_table = junos_views.junos_rpm_probes_results_table(self.device) probes_results_table.get() probes_results_items = probes_results_table.items() for probe_result i...
[ "def", "get_probes_results", "(", "self", ")", ":", "probes_results", "=", "{", "}", "probes_results_table", "=", "junos_views", ".", "junos_rpm_probes_results_table", "(", "self", ".", "device", ")", "probes_results_table", ".", "get", "(", ")", "probes_results_ite...
Return the results of the RPM probes.
[ "Return", "the", "results", "of", "the", "RPM", "probes", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1574-L1601
napalm-automation/napalm-junos
napalm_junos/junos.py
JunOSDriver.traceroute
def traceroute(self, destination, source=C.TRACEROUTE_SOURCE, ttl=C.TRACEROUTE_TTL, timeout=C.TRACEROUTE_TIMEOUT, vrf=C.TRACEROUTE_VRF): """Execute traceroute and return results.""" traceroute_result = {} ...
python
def traceroute(self, destination, source=C.TRACEROUTE_SOURCE, ttl=C.TRACEROUTE_TTL, timeout=C.TRACEROUTE_TIMEOUT, vrf=C.TRACEROUTE_VRF): """Execute traceroute and return results.""" traceroute_result = {} ...
[ "def", "traceroute", "(", "self", ",", "destination", ",", "source", "=", "C", ".", "TRACEROUTE_SOURCE", ",", "ttl", "=", "C", ".", "TRACEROUTE_TTL", ",", "timeout", "=", "C", ".", "TRACEROUTE_TIMEOUT", ",", "vrf", "=", "C", ".", "TRACEROUTE_VRF", ")", "...
Execute traceroute and return results.
[ "Execute", "traceroute", "and", "return", "results", "." ]
train
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L1603-L1671
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
parse_intf_section
def parse_intf_section(interface): """Parse a single entry from show interfaces output. Different cases: mgmt0 is up admin state is up Ethernet2/1 is up admin state is up, Dedicated Interface Vlan1 is down (Administratively down), line protocol is down, autostate enabled Ethernet154/...
python
def parse_intf_section(interface): """Parse a single entry from show interfaces output. Different cases: mgmt0 is up admin state is up Ethernet2/1 is up admin state is up, Dedicated Interface Vlan1 is down (Administratively down), line protocol is down, autostate enabled Ethernet154/...
[ "def", "parse_intf_section", "(", "interface", ")", ":", "interface", "=", "interface", ".", "strip", "(", ")", "re_protocol", "=", "r\"^(?P<intf_name>\\S+?)\\s+is\\s+(?P<status>.+?)\"", "r\",\\s+line\\s+protocol\\s+is\\s+(?P<protocol>\\S+).*$\"", "re_intf_name_state", "=", "r\...
Parse a single entry from show interfaces output. Different cases: mgmt0 is up admin state is up Ethernet2/1 is up admin state is up, Dedicated Interface Vlan1 is down (Administratively down), line protocol is down, autostate enabled Ethernet154/1/48 is up (with no 'admin state')
[ "Parse", "a", "single", "entry", "from", "show", "interfaces", "output", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L74-L169
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
NXOSSSHDriver._get_diff
def _get_diff(self): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() command = ('show diff rollback-patch file {0} file {1}'.format( 'sot_file', self.replace_file.split('/')[-1])) diff_out = self.device.send_comman...
python
def _get_diff(self): """Get a diff between running config and a proposed file.""" diff = [] self._create_sot_file() command = ('show diff rollback-patch file {0} file {1}'.format( 'sot_file', self.replace_file.split('/')[-1])) diff_out = self.device.send_comman...
[ "def", "_get_diff", "(", "self", ")", ":", "diff", "=", "[", "]", "self", ".", "_create_sot_file", "(", ")", "command", "=", "(", "'show diff rollback-patch file {0} file {1}'", ".", "format", "(", "'sot_file'", ",", "self", ".", "replace_file", ".", "split", ...
Get a diff between running config and a proposed file.
[ "Get", "a", "diff", "between", "running", "config", "and", "a", "proposed", "file", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L595-L613
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
NXOSSSHDriver._save_to_checkpoint
def _save_to_checkpoint(self, filename): """Save the current running config to the given file.""" command = 'checkpoint file {}'.format(filename) self.device.send_command(command)
python
def _save_to_checkpoint(self, filename): """Save the current running config to the given file.""" command = 'checkpoint file {}'.format(filename) self.device.send_command(command)
[ "def", "_save_to_checkpoint", "(", "self", ",", "filename", ")", ":", "command", "=", "'checkpoint file {}'", ".", "format", "(", "filename", ")", "self", ".", "device", ".", "send_command", "(", "command", ")" ]
Save the current running config to the given file.
[ "Save", "the", "current", "running", "config", "to", "the", "given", "file", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L657-L660
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
NXOSSSHDriver.get_facts
def get_facts(self): """Return a set of facts from the devices.""" # default values. vendor = u'Cisco' uptime = -1 serial_number, fqdn, os_version, hostname, domain_name = ('',) * 5 # obtain output from device show_ver = self.device.send_command('show version') ...
python
def get_facts(self): """Return a set of facts from the devices.""" # default values. vendor = u'Cisco' uptime = -1 serial_number, fqdn, os_version, hostname, domain_name = ('',) * 5 # obtain output from device show_ver = self.device.send_command('show version') ...
[ "def", "get_facts", "(", "self", ")", ":", "# default values.", "vendor", "=", "u'Cisco'", "uptime", "=", "-", "1", "serial_number", ",", "fqdn", ",", "os_version", ",", "hostname", ",", "domain_name", "=", "(", "''", ",", ")", "*", "5", "# obtain output f...
Return a set of facts from the devices.
[ "Return", "a", "set", "of", "facts", "from", "the", "devices", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L736-L799
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
NXOSSSHDriver.get_arp_table
def get_arp_table(self): """ Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ { ...
python
def get_arp_table(self): """ Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ { ...
[ "def", "get_arp_table", "(", "self", ")", ":", "arp_table", "=", "[", "]", "command", "=", "'show ip arp vrf default | exc INCOMPLETE'", "output", "=", "self", ".", "device", ".", "send_command", "(", "command", ")", "separator", "=", "r\"^Address\\s+Age.*Interface....
Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ { 'interface' : 'MgmtEth0/RSP0/CPU0...
[ "Get", "arp", "table", "information", "." ]
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L1037-L1105
napalm-automation/napalm-nxos
napalm_nxos_ssh/nxos_ssh.py
NXOSSSHDriver.get_mac_address_table
def get_mac_address_table(self): """ Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (...
python
def get_mac_address_table(self): """ Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (...
[ "def", "get_mac_address_table", "(", "self", ")", ":", "# The '*' is stripped out later", "RE_MACTABLE_FORMAT1", "=", "r\"^\\s+{}\\s+{}\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\"", ".", "format", "(", "VLAN_REGEX", ",", "MAC_REGEX", ")", "RE_MACTABLE_FORMAT2", "=", "r\"^\\s+{}\...
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address Table, having the following keys * mac (string) * interface (string) * vlan (int) * active (boolean) * static (boolean) * moves (int) * last...
[ "Returns", "a", "lists", "of", "dictionaries", ".", "Each", "dictionary", "represents", "an", "entry", "in", "the", "MAC", "Address", "Table", "having", "the", "following", "keys", "*", "mac", "(", "string", ")", "*", "interface", "(", "string", ")", "*", ...
train
https://github.com/napalm-automation/napalm-nxos/blob/936d641c99e068817abf247e0e5571fc31b3a92a/napalm_nxos_ssh/nxos_ssh.py#L1220-L1320
celiao/django-rest-authemail
authemail/views.py
Logout.get
def get(self, request, format=None): """ Remove all auth tokens owned by request.user. """ tokens = Token.objects.filter(user=request.user) for token in tokens: token.delete() content = {'success': _('User logged out.')} return Response(content, status...
python
def get(self, request, format=None): """ Remove all auth tokens owned by request.user. """ tokens = Token.objects.filter(user=request.user) for token in tokens: token.delete() content = {'success': _('User logged out.')} return Response(content, status...
[ "def", "get", "(", "self", ",", "request", ",", "format", "=", "None", ")", ":", "tokens", "=", "Token", ".", "objects", ".", "filter", "(", "user", "=", "request", ".", "user", ")", "for", "token", "in", "tokens", ":", "token", ".", "delete", "(",...
Remove all auth tokens owned by request.user.
[ "Remove", "all", "auth", "tokens", "owned", "by", "request", ".", "user", "." ]
train
https://github.com/celiao/django-rest-authemail/blob/7295a4061a46b058595dae19b14c612f0eb0393a/authemail/views.py#L130-L138
celiao/django-rest-authemail
authemail/wrapper.py
API._set_attrs_to_values
def _set_attrs_to_values(self, response={}): """ Set attributes to dictionary values so can access via dot notation. """ for key in response.keys(): setattr(self, key, response[key])
python
def _set_attrs_to_values(self, response={}): """ Set attributes to dictionary values so can access via dot notation. """ for key in response.keys(): setattr(self, key, response[key])
[ "def", "_set_attrs_to_values", "(", "self", ",", "response", "=", "{", "}", ")", ":", "for", "key", "in", "response", ".", "keys", "(", ")", ":", "setattr", "(", "self", ",", "key", ",", "response", "[", "key", "]", ")" ]
Set attributes to dictionary values so can access via dot notation.
[ "Set", "attributes", "to", "dictionary", "values", "so", "can", "access", "via", "dot", "notation", "." ]
train
https://github.com/celiao/django-rest-authemail/blob/7295a4061a46b058595dae19b14c612f0eb0393a/authemail/wrapper.py#L47-L52
acoomans/flask-autodoc
flask_autodoc/autodoc.py
Autodoc.add_custom_nl2br_filters
def add_custom_nl2br_filters(self, app): """Add a custom filter nl2br to jinja2 Replaces all newline to <BR> """ _paragraph_re = re.compile(r'(?:\r\n|\r|\n){3,}') @app.template_filter() @evalcontextfilter def nl2br(eval_ctx, value): result = '\n\n'.j...
python
def add_custom_nl2br_filters(self, app): """Add a custom filter nl2br to jinja2 Replaces all newline to <BR> """ _paragraph_re = re.compile(r'(?:\r\n|\r|\n){3,}') @app.template_filter() @evalcontextfilter def nl2br(eval_ctx, value): result = '\n\n'.j...
[ "def", "add_custom_nl2br_filters", "(", "self", ",", "app", ")", ":", "_paragraph_re", "=", "re", ".", "compile", "(", "r'(?:\\r\\n|\\r|\\n){3,}'", ")", "@", "app", ".", "template_filter", "(", ")", "@", "evalcontextfilter", "def", "nl2br", "(", "eval_ctx", ",...
Add a custom filter nl2br to jinja2 Replaces all newline to <BR>
[ "Add", "a", "custom", "filter", "nl2br", "to", "jinja2", "Replaces", "all", "newline", "to", "<BR", ">" ]
train
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L51-L62
acoomans/flask-autodoc
flask_autodoc/autodoc.py
Autodoc.doc
def doc(self, groups=None, set_location=True, **properties): """Add flask route to autodoc for automatic documentation Any route decorated with this method will be added to the list of routes to be documented by the generate() or html() methods. By default, the route is added to the 'a...
python
def doc(self, groups=None, set_location=True, **properties): """Add flask route to autodoc for automatic documentation Any route decorated with this method will be added to the list of routes to be documented by the generate() or html() methods. By default, the route is added to the 'a...
[ "def", "doc", "(", "self", ",", "groups", "=", "None", ",", "set_location", "=", "True", ",", "*", "*", "properties", ")", ":", "def", "decorator", "(", "f", ")", ":", "# Get previous group list (if any)", "if", "f", "in", "self", ".", "func_groups", ":"...
Add flask route to autodoc for automatic documentation Any route decorated with this method will be added to the list of routes to be documented by the generate() or html() methods. By default, the route is added to the 'all' group. By specifying group or groups argument, the route can...
[ "Add", "flask", "route", "to", "autodoc", "for", "automatic", "documentation" ]
train
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L64-L111
acoomans/flask-autodoc
flask_autodoc/autodoc.py
Autodoc.generate
def generate(self, groups='all', sort=None): """Return a list of dict describing the routes specified by the doc() method Each dict contains: - methods: the set of allowed methods (ie ['GET', 'POST']) - rule: relative url (ie '/user/<int:id>') - endpoint: function nam...
python
def generate(self, groups='all', sort=None): """Return a list of dict describing the routes specified by the doc() method Each dict contains: - methods: the set of allowed methods (ie ['GET', 'POST']) - rule: relative url (ie '/user/<int:id>') - endpoint: function nam...
[ "def", "generate", "(", "self", ",", "groups", "=", "'all'", ",", "sort", "=", "None", ")", ":", "groups_to_generate", "=", "list", "(", ")", "if", "type", "(", "groups", ")", "is", "list", ":", "groups_to_generate", "=", "groups", "elif", "type", "(",...
Return a list of dict describing the routes specified by the doc() method Each dict contains: - methods: the set of allowed methods (ie ['GET', 'POST']) - rule: relative url (ie '/user/<int:id>') - endpoint: function name (ie 'show_user') - doc: docstring of the func...
[ "Return", "a", "list", "of", "dict", "describing", "the", "routes", "specified", "by", "the", "doc", "()", "method" ]
train
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L113-L166
acoomans/flask-autodoc
flask_autodoc/autodoc.py
Autodoc.html
def html(self, groups='all', template=None, **context): """Return an html string of the routes specified by the doc() method A template can be specified. A list of routes is available under the 'autodoc' value (refer to the documentation for the generate() for a description of available...
python
def html(self, groups='all', template=None, **context): """Return an html string of the routes specified by the doc() method A template can be specified. A list of routes is available under the 'autodoc' value (refer to the documentation for the generate() for a description of available...
[ "def", "html", "(", "self", ",", "groups", "=", "'all'", ",", "template", "=", "None", ",", "*", "*", "context", ")", ":", "context", "[", "'autodoc'", "]", "=", "context", "[", "'autodoc'", "]", "if", "'autodoc'", "in", "context", "else", "self", "....
Return an html string of the routes specified by the doc() method A template can be specified. A list of routes is available under the 'autodoc' value (refer to the documentation for the generate() for a description of available values). If no template is specified, a default template i...
[ "Return", "an", "html", "string", "of", "the", "routes", "specified", "by", "the", "doc", "()", "method" ]
train
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/flask_autodoc/autodoc.py#L168-L194
jim-easterbrook/Photini
src/photini/imagelist.py
ImageList.unsaved_files_dialog
def unsaved_files_dialog( self, all_files=False, with_cancel=True, with_discard=True): """Return true if OK to continue with close or quit or whatever""" for image in self.images: if image.metadata.changed() and (all_files or image.selected): break else: ...
python
def unsaved_files_dialog( self, all_files=False, with_cancel=True, with_discard=True): """Return true if OK to continue with close or quit or whatever""" for image in self.images: if image.metadata.changed() and (all_files or image.selected): break else: ...
[ "def", "unsaved_files_dialog", "(", "self", ",", "all_files", "=", "False", ",", "with_cancel", "=", "True", ",", "with_discard", "=", "True", ")", ":", "for", "image", "in", "self", ".", "images", ":", "if", "image", ".", "metadata", ".", "changed", "("...
Return true if OK to continue with close or quit or whatever
[ "Return", "true", "if", "OK", "to", "continue", "with", "close", "or", "quit", "or", "whatever" ]
train
https://github.com/jim-easterbrook/Photini/blob/06f1b1988db23a5cad98bbc6c16406a64a6c556d/src/photini/imagelist.py#L748-L772
jim-easterbrook/Photini
src/photini/metadata.py
DateTime.from_ISO_8601
def from_ISO_8601(cls, date_string, time_string, tz_string): """Sufficiently general ISO 8601 parser. Inputs must be in "basic" format, i.e. no '-' or ':' separators. See https://en.wikipedia.org/wiki/ISO_8601 """ # parse tz_string if tz_string: tz_offset = ...
python
def from_ISO_8601(cls, date_string, time_string, tz_string): """Sufficiently general ISO 8601 parser. Inputs must be in "basic" format, i.e. no '-' or ':' separators. See https://en.wikipedia.org/wiki/ISO_8601 """ # parse tz_string if tz_string: tz_offset = ...
[ "def", "from_ISO_8601", "(", "cls", ",", "date_string", ",", "time_string", ",", "tz_string", ")", ":", "# parse tz_string", "if", "tz_string", ":", "tz_offset", "=", "(", "int", "(", "tz_string", "[", "1", ":", "3", "]", ")", "*", "60", ")", "+", "int...
Sufficiently general ISO 8601 parser. Inputs must be in "basic" format, i.e. no '-' or ':' separators. See https://en.wikipedia.org/wiki/ISO_8601
[ "Sufficiently", "general", "ISO", "8601", "parser", "." ]
train
https://github.com/jim-easterbrook/Photini/blob/06f1b1988db23a5cad98bbc6c16406a64a6c556d/src/photini/metadata.py#L412-L436
acoomans/flask-autodoc
examples/factory/blog/frontend.py
post_post
def post_post(): """Create a new post. Form Data: title, content, authorid. """ authorid = request.form.get('authorid', None) Post(request.form['title'], request.form['content'], users[authorid]) return redirect("/posts")
python
def post_post(): """Create a new post. Form Data: title, content, authorid. """ authorid = request.form.get('authorid', None) Post(request.form['title'], request.form['content'], users[authorid]) return redirect("/posts")
[ "def", "post_post", "(", ")", ":", "authorid", "=", "request", ".", "form", ".", "get", "(", "'authorid'", ",", "None", ")", "Post", "(", "request", ".", "form", "[", "'title'", "]", ",", "request", ".", "form", "[", "'content'", "]", ",", "users", ...
Create a new post. Form Data: title, content, authorid.
[ "Create", "a", "new", "post", ".", "Form", "Data", ":", "title", "content", "authorid", "." ]
train
https://github.com/acoomans/flask-autodoc/blob/6c77c8935b71fbf3243b5e589c5c255d0299d853/examples/factory/blog/frontend.py#L59-L67
niklasb/webkit-server
webkit_server.py
SelectionMixin.xpath
def xpath(self, xpath): """ Finds another node by XPath originating at the current node. """ return [self.get_node_factory().create(node_id) for node_id in self._get_xpath_ids(xpath).split(",") if node_id]
python
def xpath(self, xpath): """ Finds another node by XPath originating at the current node. """ return [self.get_node_factory().create(node_id) for node_id in self._get_xpath_ids(xpath).split(",") if node_id]
[ "def", "xpath", "(", "self", ",", "xpath", ")", ":", "return", "[", "self", ".", "get_node_factory", "(", ")", ".", "create", "(", "node_id", ")", "for", "node_id", "in", "self", ".", "_get_xpath_ids", "(", "xpath", ")", ".", "split", "(", "\",\"", "...
Finds another node by XPath originating at the current node.
[ "Finds", "another", "node", "by", "XPath", "originating", "at", "the", "current", "node", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L21-L25
niklasb/webkit-server
webkit_server.py
SelectionMixin.css
def css(self, css): """ Finds another node by a CSS selector relative to the current node. """ return [self.get_node_factory().create(node_id) for node_id in self._get_css_ids(css).split(",") if node_id]
python
def css(self, css): """ Finds another node by a CSS selector relative to the current node. """ return [self.get_node_factory().create(node_id) for node_id in self._get_css_ids(css).split(",") if node_id]
[ "def", "css", "(", "self", ",", "css", ")", ":", "return", "[", "self", ".", "get_node_factory", "(", ")", ".", "create", "(", "node_id", ")", "for", "node_id", "in", "self", ".", "_get_css_ids", "(", "css", ")", ".", "split", "(", "\",\"", ")", "i...
Finds another node by a CSS selector relative to the current node.
[ "Finds", "another", "node", "by", "a", "CSS", "selector", "relative", "to", "the", "current", "node", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L27-L31
niklasb/webkit-server
webkit_server.py
Node.get_bool_attr
def get_bool_attr(self, name): """ Returns the value of a boolean HTML attribute like `checked` or `disabled` """ val = self.get_attr(name) return val is not None and val.lower() in ("true", name)
python
def get_bool_attr(self, name): """ Returns the value of a boolean HTML attribute like `checked` or `disabled` """ val = self.get_attr(name) return val is not None and val.lower() in ("true", name)
[ "def", "get_bool_attr", "(", "self", ",", "name", ")", ":", "val", "=", "self", ".", "get_attr", "(", "name", ")", "return", "val", "is", "not", "None", "and", "val", ".", "lower", "(", ")", "in", "(", "\"true\"", ",", "name", ")" ]
Returns the value of a boolean HTML attribute like `checked` or `disabled`
[ "Returns", "the", "value", "of", "a", "boolean", "HTML", "attribute", "like", "checked", "or", "disabled" ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L68-L72
niklasb/webkit-server
webkit_server.py
Node.set_attr
def set_attr(self, name, value): """ Sets the value of an attribute. """ self.exec_script("node.setAttribute(%s, %s)" % (repr(name), repr(value)))
python
def set_attr(self, name, value): """ Sets the value of an attribute. """ self.exec_script("node.setAttribute(%s, %s)" % (repr(name), repr(value)))
[ "def", "set_attr", "(", "self", ",", "name", ",", "value", ")", ":", "self", ".", "exec_script", "(", "\"node.setAttribute(%s, %s)\"", "%", "(", "repr", "(", "name", ")", ",", "repr", "(", "value", ")", ")", ")" ]
Sets the value of an attribute.
[ "Sets", "the", "value", "of", "an", "attribute", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L78-L80
niklasb/webkit-server
webkit_server.py
Node.value
def value(self): """ Returns the node's value. """ if self.is_multi_select(): return [opt.value() for opt in self.xpath(".//option") if opt["selected"]] else: return self._invoke("value")
python
def value(self): """ Returns the node's value. """ if self.is_multi_select(): return [opt.value() for opt in self.xpath(".//option") if opt["selected"]] else: return self._invoke("value")
[ "def", "value", "(", "self", ")", ":", "if", "self", ".", "is_multi_select", "(", ")", ":", "return", "[", "opt", ".", "value", "(", ")", "for", "opt", "in", "self", ".", "xpath", "(", "\".//option\"", ")", "if", "opt", "[", "\"selected\"", "]", "]...
Returns the node's value.
[ "Returns", "the", "node", "s", "value", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L82-L89
niklasb/webkit-server
webkit_server.py
Client.set_header
def set_header(self, key, value): """ Sets a HTTP header for future requests. """ self.conn.issue_command("Header", _normalize_header(key), value)
python
def set_header(self, key, value): """ Sets a HTTP header for future requests. """ self.conn.issue_command("Header", _normalize_header(key), value)
[ "def", "set_header", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "conn", ".", "issue_command", "(", "\"Header\"", ",", "_normalize_header", "(", "key", ")", ",", "value", ")" ]
Sets a HTTP header for future requests.
[ "Sets", "a", "HTTP", "header", "for", "future", "requests", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L250-L252
niklasb/webkit-server
webkit_server.py
Client.headers
def headers(self): """ Returns a list of the last HTTP response headers. Header keys are normalized to capitalized form, as in `User-Agent`. """ headers = self.conn.issue_command("Headers") res = [] for header in headers.split("\r"): key, value = header.split(": ", 1) for line in val...
python
def headers(self): """ Returns a list of the last HTTP response headers. Header keys are normalized to capitalized form, as in `User-Agent`. """ headers = self.conn.issue_command("Headers") res = [] for header in headers.split("\r"): key, value = header.split(": ", 1) for line in val...
[ "def", "headers", "(", "self", ")", ":", "headers", "=", "self", ".", "conn", ".", "issue_command", "(", "\"Headers\"", ")", "res", "=", "[", "]", "for", "header", "in", "headers", ".", "split", "(", "\"\\r\"", ")", ":", "key", ",", "value", "=", "...
Returns a list of the last HTTP response headers. Header keys are normalized to capitalized form, as in `User-Agent`.
[ "Returns", "a", "list", "of", "the", "last", "HTTP", "response", "headers", ".", "Header", "keys", "are", "normalized", "to", "capitalized", "form", "as", "in", "User", "-", "Agent", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L262-L272
niklasb/webkit-server
webkit_server.py
Client.eval_script
def eval_script(self, expr): """ Evaluates a piece of Javascript in the context of the current page and returns its value. """ ret = self.conn.issue_command("Evaluate", expr) return json.loads("[%s]" % ret)[0]
python
def eval_script(self, expr): """ Evaluates a piece of Javascript in the context of the current page and returns its value. """ ret = self.conn.issue_command("Evaluate", expr) return json.loads("[%s]" % ret)[0]
[ "def", "eval_script", "(", "self", ",", "expr", ")", ":", "ret", "=", "self", ".", "conn", ".", "issue_command", "(", "\"Evaluate\"", ",", "expr", ")", "return", "json", ".", "loads", "(", "\"[%s]\"", "%", "ret", ")", "[", "0", "]" ]
Evaluates a piece of Javascript in the context of the current page and returns its value.
[ "Evaluates", "a", "piece", "of", "Javascript", "in", "the", "context", "of", "the", "current", "page", "and", "returns", "its", "value", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L274-L278
niklasb/webkit-server
webkit_server.py
Client.render
def render(self, path, width = 1024, height = 1024): """ Renders the current page to a PNG file (viewport size in pixels). """ self.conn.issue_command("Render", path, width, height)
python
def render(self, path, width = 1024, height = 1024): """ Renders the current page to a PNG file (viewport size in pixels). """ self.conn.issue_command("Render", path, width, height)
[ "def", "render", "(", "self", ",", "path", ",", "width", "=", "1024", ",", "height", "=", "1024", ")", ":", "self", ".", "conn", ".", "issue_command", "(", "\"Render\"", ",", "path", ",", "width", ",", "height", ")" ]
Renders the current page to a PNG file (viewport size in pixels).
[ "Renders", "the", "current", "page", "to", "a", "PNG", "file", "(", "viewport", "size", "in", "pixels", ")", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L284-L286
niklasb/webkit-server
webkit_server.py
Client.cookies
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()]
python
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", ")", ":", "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.
[ "Returns", "a", "list", "of", "all", "cookies", "in", "cookie", "string", "format", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L301-L305
niklasb/webkit-server
webkit_server.py
Client.set_attribute
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_...
python
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", ")", ":", "value", "=", "\"true\"", "if", "value", "else", "\"false\"", "self", ".", "conn", ".", "issue_command", "(", "\"SetAttribute\"", ",", "self", ".", "_normalize_attr", "(...
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...
[ "Sets", "a", "custom", "attribute", "for", "our", "Webkit", "instance", ".", "Possible", "attributes", "are", ":" ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L314-L339
niklasb/webkit-server
webkit_server.py
Client.set_html
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...
python
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", ")", ":", "if", "url", ":", "self", ".", "conn", ".", "issue_command", "(", "'SetHtml'", ",", "html", ",", "url", ")", "else", ":", "self", ".", "conn", ".", "issue_command", "("...
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.
[ "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...
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L347-L354
niklasb/webkit-server
webkit_server.py
Client.set_proxy
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)
python
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", "=", "\"\"", ")", ":", "self", ".", "conn", ".", "issue_command", "(", "\"SetProxy\"", ",", "host", ",", "port", ","...
Sets a custom HTTP proxy to use for future requests.
[ "Sets", "a", "custom", "HTTP", "proxy", "to", "use", "for", "future", "requests", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L356-L361
niklasb/webkit-server
webkit_server.py
Server.connect
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
python
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", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "connect", "(", "(", "\"127.0.0.1\"", ",", "self", ".", "_port", ")", ")", "return", "s...
Returns a new socket connection to this server.
[ "Returns", "a", "new", "socket", "connection", "to", "this", "server", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L437-L441
niklasb/webkit-server
webkit_server.py
SocketBuffer.read_line
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...
python
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", ")", ":", "while", "True", ":", "newline_idx", "=", "self", ".", "buf", ".", "find", "(", "b\"\\n\"", ")", "if", "newline_idx", ">=", "0", ":", "res", "=", "self", ".", "buf", "[", ":", "newline_idx", "]", "self", "...
Consume one line from the stream.
[ "Consume", "one", "line", "from", "the", "stream", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L475-L486
niklasb/webkit-server
webkit_server.py
SocketBuffer.read
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
python
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", ")", ":", "while", "len", "(", "self", ".", "buf", ")", "<", "n", ":", "chunk", "=", "self", ".", "f", ".", "recv", "(", "4096", ")", "if", "not", "chunk", ":", "raise", "EndOfStreamError", "(", ")", "self"...
Consume `n` characters from the stream.
[ "Consume", "n", "characters", "from", "the", "stream", "." ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L488-L496
niklasb/webkit-server
webkit_server.py
ServerConnection.issue_command
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()
python
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", ")", ":", "self", ".", "_writeline", "(", "cmd", ")", "self", ".", "_writeline", "(", "str", "(", "len", "(", "args", ")", ")", ")", "for", "arg", "in", "args", ":", "arg", "=", ...
Sends and receives a message to/from the server
[ "Sends", "and", "receives", "a", "message", "to", "/", "from", "the", "server" ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L511-L520
niklasb/webkit-server
webkit_server.py
ServerConnection._read_response
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...
python
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", ")", ":", "result", "=", "self", ".", "buf", ".", "read_line", "(", ")", ".", "decode", "(", "\"utf-8\"", ")", "if", "not", "result", ":", "raise", "NoResponseError", "(", "\"No response received from server.\"", ")", "m...
Reads a complete response packet from the server
[ "Reads", "a", "complete", "response", "packet", "from", "the", "server" ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L522-L532
niklasb/webkit-server
webkit_server.py
ServerConnection._read_message
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")
python
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", ")", ":", "size", "=", "int", "(", "self", ".", "buf", ".", "read_line", "(", ")", ".", "decode", "(", "\"utf-8\"", ")", ")", "return", "self", ".", "buf", ".", "read", "(", "size", ")", ".", "decode", "(", "\...
Reads a single size-annotated message from the server
[ "Reads", "a", "single", "size", "-", "annotated", "message", "from", "the", "server" ]
train
https://github.com/niklasb/webkit-server/blob/c9e3a8394b8c51000c35f8a56fb770580562b544/webkit_server.py#L534-L537
hanneshapke/pyzillow
pyzillow/pyzillow.py
ZillowWrapper.get_deep_search_results
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 } ...
python
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", ")", ":", "url", "=", "'http://www.zillow.com/webservice/GetDeepSearchResults.htm'", "params", "=", "{", "'address'", ":", "address", ",", "'citystatezip'", ":", "zipcode", ",", "'zws-id'",...
GetDeepSearchResults API
[ "GetDeepSearchResults", "API" ]
train
https://github.com/hanneshapke/pyzillow/blob/1de937669da4ec1eb779b4615f903d3e5bd0eca6/pyzillow/pyzillow.py#L20-L31
hanneshapke/pyzillow
pyzillow/pyzillow.py
ZillowWrapper.get_updated_property_details
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)
python
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", ")", ":", "url", "=", "'http://www.zillow.com/webservice/GetUpdatedPropertyDetails.htm'", "params", "=", "{", "'zpid'", ":", "zpid", ",", "'zws-id'", ":", "self", ".", "api_key", "}", "return", "self",...
GetUpdatedPropertyDetails API
[ "GetUpdatedPropertyDetails", "API" ]
train
https://github.com/hanneshapke/pyzillow/blob/1de937669da4ec1eb779b4615f903d3e5bd0eca6/pyzillow/pyzillow.py#L33-L43
kylefox/python-image-orientation-patch
img_rotate/__init__.py
fix_orientation
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...
python
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", ")", ":", "path", "=", "None", "if", "not", "isinstance", "(", "img", ",", "Image", ".", "Image", ")", ":", "path", "=", "img", "img", "=", "Image", ".", "open", "(", "path", ")"...
`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", "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...
train
https://github.com/kylefox/python-image-orientation-patch/blob/7941763d732a3bec0497991479be3c57aedd3415/img_rotate/__init__.py#L25-L54
anfema/integrate
integrate/check.py
Check.log_error
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): ...
python
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", ")", ":", "if", "message", ":", "msg", "=", "message", "+", "\": \"", "+", "error", "else", ":", "msg", "=", "error", "tb", "=", "t...
Add an error message and optional user message to the error list
[ "Add", "an", "error", "message", "and", "optional", "user", "message", "to", "the", "error", "list" ]
train
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L12-L29
anfema/integrate
integrate/check.py
Check.equal
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
python
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", ")", ":", "if", "a", "!=", "b", ":", "self", ".", "log_error", "(", "\"{} != {}\"", ".", "format", "(", "str", "(", "a", ")", ",", "str", "(", "b", ")", ")", ",", ...
Check if two values are equal
[ "Check", "if", "two", "values", "are", "equal" ]
train
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L35-L40
anfema/integrate
integrate/check.py
Check.is_not_none
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
python
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", ")", ":", "if", "a", "is", "None", ":", "self", ".", "log_error", "(", "\"{} is None\"", ".", "format", "(", "str", "(", "a", ")", ")", ",", "message", ")", "return", "False"...
Check if a value is not None
[ "Check", "if", "a", "value", "is", "not", "None" ]
train
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L56-L61
anfema/integrate
integrate/check.py
Check.raises
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...
python
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", ")", ":", "try", ":", "result", "=", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "log_error", "(", "\"{} d...
Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function
[ "Check", "if", "a", "function", "raises", "a", "specified", "exception", "type", "*", "args", "and", "**", "kwargs", "are", "forwarded", "to", "the", "function" ]
train
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L82-L99
anfema/integrate
integrate/check.py
Check.does_not_raise
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...
python
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", ")", ":", "try", ":", "return", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Exception", "as", "e", ":", "self", ".", "log_e...
Check if a function does not raise an exception, *args and **kwargs are forwarded to the function
[ "Check", "if", "a", "function", "does", "not", "raise", "an", "exception", "*", "args", "and", "**", "kwargs", "are", "forwarded", "to", "the", "function" ]
train
https://github.com/anfema/integrate/blob/e9d3bb8f0613e82184735ee67a42ea01b1a9b1b7/integrate/check.py#L101-L112
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
calculate_color_temperature
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 = ...
python
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", ")", ":", "# 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.
[ "Converts", "the", "raw", "R", "/", "G", "/", "B", "values", "to", "color", "temperature", "in", "degrees", "Kelvin", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L102-L124
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
calculate_lux
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)
python
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", ")", ":", "illuminance", "=", "(", "-", "0.32466", "*", "r", ")", "+", "(", "1.57837", "*", "g", ")", "+", "(", "-", "0.73191", "*", "b", ")", "return", "int", "(", "illuminance", ")" ]
Converts the raw R/G/B values to luminosity in lux.
[ "Converts", "the", "raw", "R", "/", "G", "/", "B", "values", "to", "luminosity", "in", "lux", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L126-L129
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725._write8
def _write8(self, reg, value): """Write a 8-bit value to a register.""" self._device.write8(TCS34725_COMMAND_BIT | reg, value)
python
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", ")", ":", "self", ".", "_device", ".", "write8", "(", "TCS34725_COMMAND_BIT", "|", "reg", ",", "value", ")" ]
Write a 8-bit value to a register.
[ "Write", "a", "8", "-", "bit", "value", "to", "a", "register", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L161-L163
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.enable
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))
python
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", ")", ":", "# Flip on the power and enable bits.", "self", ".", "_write8", "(", "TCS34725_ENABLE", ",", "TCS34725_ENABLE_PON", ")", "time", ".", "sleep", "(", "0.01", ")", "self", ".", "_write8", "(", "TCS34725_ENABLE", ",", "(", "...
Enable the chip.
[ "Enable", "the", "chip", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L165-L170
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.disable
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)
python
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", ")", ":", "# Flip off the power on and enable bits.", "reg", "=", "self", ".", "_readU8", "(", "TCS34725_ENABLE", ")", "reg", "&=", "~", "(", "TCS34725_ENABLE_PON", "|", "TCS34725_ENABLE_AEN", ")", "self", ".", "_write8", "(", "TCS...
Disable the chip (power down).
[ "Disable", "the", "chip", "(", "power", "down", ")", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L172-L177
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.set_integration_time
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 -...
python
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", ")", ":", "self", ".", "_integration_time", "=", "integration_time", "self", ".", "_write8", "(", "TCS34725_ATIME", ",", "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...
[ "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...
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L179-L190
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.get_raw_data
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...
python
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", ")", ":", "# Read each color register.", "r", "=", "self", ".", "_readU16LE", "(", "TCS34725_RDATAL", ")", "g", "=", "self", ".", "_readU16LE", "(", "TCS34725_GDATAL", ")", "b", "=", "self", ".", "_readU16LE", "(", "TCS347...
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).
[ "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", ")", "."...
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L214-L226
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.set_interrupt
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...
python
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_reg", "=", "self", ".", "_readU8", "(", "TCS34725_ENABLE", ")", "if", "enabled", ":", "enable_reg", "|=", "TCS34725_ENABLE_AIEN", "else", ":", "enable_reg", "&=", "~", "TCS34725_ENABLE_AIEN",...
Enable or disable interrupts by setting enabled to True or False.
[ "Enable", "or", "disable", "interrupts", "by", "setting", "enabled", "to", "True", "or", "False", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L228-L236
adafruit/Adafruit_Python_TCS34725
Adafruit_TCS34725/TCS34725.py
TCS34725.set_interrupt_limits
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)
python
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", ")", ":", "self", ".", "_device", ".", "write8", "(", "0x04", ",", "low", "&", "0xFF", ")", "self", ".", "_device", ".", "write8", "(", "0x05", ",", "low", ">>", "8", ")", "self",...
Set the interrupt limits to provied unsigned 16-bit threshold values.
[ "Set", "the", "interrupt", "limits", "to", "provied", "unsigned", "16", "-", "bit", "threshold", "values", "." ]
train
https://github.com/adafruit/Adafruit_Python_TCS34725/blob/996396cd095522d788b7b15d20fd44e566c8464e/Adafruit_TCS34725/TCS34725.py#L242-L248
latture/json2table
json2table/json2table.py
convert
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...
python
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", ")", ":", "json_converter", "=", "JsonConverter", "(", "build_direction", "=", "build_direction", ",", "table_attributes", "=", "table_attribut...
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...
[ "Converts", "JSON", "to", "HTML", "Table", "format", "." ]
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L12-L48
latture/json2table
json2table/json2table.py
JsonConverter.convert
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....
python
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", ")", ":", "html_output", "=", "self", ".", "_table_opening_tag", "if", "self", ".", "_build_top_to_bottom", ":", "html_output", "+=", "self", ".", "_markup_header_row", "(", "json_input", ".", "keys", "(", ")",...
Converts JSON to HTML Table format. Parameters ---------- json_input : dict JSON object to convert into HTML. Returns ------- str String of converted HTML.
[ "Converts", "JSON", "to", "HTML", "Table", "format", "." ]
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L73-L109
latture/json2table
json2table/json2table.py
JsonConverter._dict_to_html_attributes
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 ...
python
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", ")", ":", "if", "d", "is", "None", ":", "return", "\"\"", "return", "\"\"", ".", "join", "(", "\" {}=\\\"{}\\\"\"", ".", "format", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "iter", "("...
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 ...
[ "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...
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L144-L164
latture/json2table
json2table/json2table.py
JsonConverter._list_of_dicts_to_column_headers
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 ...
python
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", ")", ":", "if", "len", "(", "list_of_dicts", ")", "<", "2", "or", "not", "all", "(", "isinstance", "(", "item", ",", "dict", ")", "for", "item", "in", "list_of_dicts", ")", ":", "return", "No...
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...
[ "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", "." ]
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L167-L190
latture/json2table
json2table/json2table.py
JsonConverter._markup
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 ...
python
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", ")", ":", "if", "entry", "is", "None", ":", "return", "\"\"", "if", "isinstance", "(", "entry", ",", "list", ")", ":", "list_markup", "=", "\"<ul>\"", "for", "item", "in", "entry", ":", "list_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.
[ "Recursively", "generates", "HTML", "for", "the", "current", "entry", "." ]
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L192-L218
latture/json2table
json2table/json2table.py
JsonConverter._maybe_club
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...
python
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", ")", ":", "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...
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 -------...
[ "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...
train
https://github.com/latture/json2table/blob/8bd1363f54ee4fd608ffb7677761526184a9da83/json2table/json2table.py#L220-L272
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/tpl.py
TplApi.update_voice_notify
def update_voice_notify(self, param, must=[APIKEY, TPL_ID, TPL_CONTENT]): '''修改语音通知模版 注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错! 参数: 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 tpl_id Long 是 模板...
python
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", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ...
修改语音通知模版 注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错! 参数: 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 tpl_id Long 是 模板id,64位长整形。指定id时返回id对应的模板。未指定时返回所有模板 9527 tpl_content String 是 模板i...
[ "修改语音通知模版", "注意:模板成功修改之后需要重新审核才能使用!同时提醒您如果修改了变量,务必重新测试,以免替换出错!", "参数:", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "tpl_id", "Long", "是", "模板id,64位长整形。指定id时返回id对应的模板。未指定时返回所有模板", "9527", "tpl_content", "String", "是"...
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/tpl.py#L144-L163
yunpian/yunpian-python-sdk
yunpian_python_sdk/model/result.py
Result.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 ...
python
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", ")", ":", "if", "code", "or", "ret_r", ":", "self", ".", "_code", "=", "code", "return", "self", "return", "self", ".", "_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
[ "Args", ":", "code", ":", "(", "Optional", ")", "set", "code", "ret_r", ":", "(", "Optional", ")", "force", "to", "return", "Result", ".", "Default", "value", "is", "False", "returns", ":", "response", "code", "(", "0", "-", "success", "others", "-", ...
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L33-L44
yunpian/yunpian-python-sdk
yunpian_python_sdk/model/result.py
Result.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
python
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", ")", ":", "if", "msg", "or", "ret_r", ":", "self", ".", "_msg", "=", "msg", "return", "self", "return", "self", ".", "_msg" ]
code's message
[ "code", "s", "message" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L46-L51
yunpian/yunpian-python-sdk
yunpian_python_sdk/model/result.py
Result.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
python
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", ")", ":", "if", "detail", "or", "ret_r", ":", "self", ".", "_detail", "=", "detail", "return", "self", "return", "self", ".", "_detail" ]
code's detail
[ "code", "s", "detail" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L53-L58
yunpian/yunpian-python-sdk
yunpian_python_sdk/model/result.py
Result.data
def data(self, data=None, ret_r=False): '''response data''' if data or ret_r: self._data = data return self return self._data
python
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", ")", ":", "if", "data", "or", "ret_r", ":", "self", ".", "_data", "=", "data", "return", "self", "return", "self", ".", "_data" ]
response data
[ "response", "data" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/model/result.py#L60-L65
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/user.py
UserApi.get
def get(self, param=None, must=[APIKEY]): '''查账户信息 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 Args: param: (Optional) Results: Result ''' param = {} if param is None else param r = s...
python
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", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "...
查账户信息 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 Args: param: (Optional) Results: Result
[ "查账户信息", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "Args", ":", "param", ":", "(", "Optional", ")", "Results", ":", "Result" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/user.py#L19-L35
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/ypapi.py
YunpianApi._init
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...
python
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", ")", ":", "assert", "clnt", ",", "\"clnt is None\"", "self", ".", "_clnt", "=", "clnt", "self", ".", "_apikey", "=", "clnt", ".", "apikey", "(", ")", "self", ".", "_version", "=", "clnt", ".", "conf", "(", ...
initialize api by YunpianClient
[ "initialize", "api", "by", "YunpianClient" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L94-L101
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/ypapi.py
YunpianApi.name
def name(self, name=None): '''api name, default is module.__name__''' if name: self._name = name return self return self._name
python
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", ")", ":", "if", "name", ":", "self", ".", "_name", "=", "name", "return", "self", "return", "self", ".", "_name" ]
api name, default is module.__name__
[ "api", "name", "default", "is", "module", ".", "__name__" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L139-L144
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/ypapi.py
YunpianApi.post
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...
python
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", ")", ":", "try", ":", "rsp", "=", "self", ".", "client", "(", ")", ".", "post", "(", "self", ".", "uri", "(", ")", ",", "param", ")", "# print(rsp)", "return", "self", ".", "result",...
Args: param: request parameters h: ResultHandler r: YunpianApiResult
[ "Args", ":", "param", ":", "request", "parameters", "h", ":", "ResultHandler", "r", ":", "YunpianApiResult" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L150-L162
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/ypapi.py
YunpianApi.verify_param
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...
python
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", ")", ":", "if", "APIKEY", "not", "in", "param", ":", "param", "[", "APIKEY", "]", "=", "self", ".", "apikey", "(", ")", "r", "=", "Result", "("...
return Code.ARGUMENT_MISSING if every key in must not found in param
[ "return", "Code", ".", "ARGUMENT_MISSING", "if", "every", "key", "in", "must", "not", "found", "in", "param" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/ypapi.py#L180-L191
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
_YunpianConf.custom_conf
def custom_conf(self, conf): '''custom apikey and http parameters''' if conf: for (key, val) in conf.items(): self.__conf[key] = val return self
python
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", ")", ":", "if", "conf", ":", "for", "(", "key", ",", "val", ")", "in", "conf", ".", "items", "(", ")", ":", "self", ".", "__conf", "[", "key", "]", "=", "val", "return", "self" ]
custom apikey and http parameters
[ "custom", "apikey", "and", "http", "parameters" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L59-L64
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
_YunpianConf.conf
def conf(self, key): '''get config''' return self.__conf[key] if key in self.__conf else _YunpianConf.YP_CONF.get(key)
python
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", ")", ":", "return", "self", ".", "__conf", "[", "key", "]", "if", "key", "in", "self", ".", "__conf", "else", "_YunpianConf", ".", "YP_CONF", ".", "get", "(", "key", ")" ]
get config
[ "get", "config" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L73-L75
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
_ApiFactory.api
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...
python
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", ")", ":", "assert", "name", ",", "'name is none'", "if", "flow", ".", "__name__", "==", "name", ":", "api", "=", "flow", ".", "FlowApi", "(", ")", "elif", "sign", ".", "__name__", "==", "name", ":", "api", "=...
return special API by package's name
[ "return", "special", "API", "by", "package", "s", "name" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L85-L105
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
YunpianClient.conf
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
python
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", ")", ":", "if", "key", "is", "None", ":", "return", "self", ".", "_ypconf", "val", "=", "self", ".", "_ypconf", ".", "conf", "(", "key", ")", "return", "defval", "if...
return YunpianConf if key=None, else return value in YunpianConf
[ "return", "YunpianConf", "if", "key", "=", "None", "else", "return", "value", "in", "YunpianConf" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L175-L180
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
YunpianClient.post
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...
python
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", "=", "{", "}", ")", ":", "if", "'Api-Lang'", "not", "in", "headers", ":", "headers", "[", "'Api-Lang'", "]", "=", "'python'", "if", "'Content-Type...
response json text
[ "response", "json", "text" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L185-L193
yunpian/yunpian-python-sdk
yunpian_python_sdk/ypclient.py
YunpianClient.urlEncodeAndJoin
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...
python
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", "=", "','", ")", ":", "try", ":", "from", "urllib", ".", "parse", "import", "quote_plus", "as", "encode", "return", "sepr", ".", "join", "(", "[", "encode", "(", "x", ",", "encoding", "...
sepr.join(urlencode(seq)) Args: seq: string list to be urlencoded sepr: join seq with sepr Returns: str
[ "sepr", ".", "join", "(", "urlencode", "(", "seq", "))", "Args", ":", "seq", ":", "string", "list", "to", "be", "urlencoded", "sepr", ":", "join", "seq", "with", "sepr", "Returns", ":", "str" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/ypclient.py#L195-L208
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/voice.py
VoiceApi.send
def send(self, param, must=[APIKEY, MOBILE, CODE]): '''发语音验证码 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000 code String 是 验证码,支持4~6位阿拉伯数字 1234 encrypt String 否 加密方式 使用加密 tea (不再使用) ...
python
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", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":", "retur...
发语音验证码 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000 code String 是 验证码,支持4~6位阿拉伯数字 1234 encrypt String 否 加密方式 使用加密 tea (不再使用) _sign String 否 签名字段 参考使用加密 393d079e0a00912335adfe46f4a2e10f (...
[ "发语音验证码" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/voice.py#L20-L42
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/sms.py
SmsApi.single_send
def single_send(self, param, must=[APIKEY, MOBILE, TEXT]): '''单条发送 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码 (针对国际短信,m...
python
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", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ":", ...
单条发送 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 mobile String 是 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码 (针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见: ...
[ "单条发送", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "是", "接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是", "+", "号开头", "(", "+", "号需要urlencode处理,否则会出现格式错误", ")", ",国际号码不以", "+", "开头将被认为是中国地区的号码", "...
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L50-L77
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/sms.py
SmsApi.pull_reply
def pull_reply(self, param=None, must=[APIKEY]): '''获取回复短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size Integer 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result ''' param =...
python
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", "]", ")", ":", "param", "=", "{", "}", "if", "param", "is", "None", "else", "param", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", "...
获取回复短信 参数名 类型 是否必须 描述 示例 apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526 page_size Integer 否 每页个数,最大100个,默认20个 20 Args: param: Results: Result
[ "获取回复短信", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "page_size", "Integer", "否", "每页个数,最大100个,默认20个", "20", "Args", ":", "param", ":", "Results", ":", "Result" ]
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L157-L174
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/sms.py
SmsApi.get_reply
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 ...
python
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", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", ...
查回复的短信 参数名 类型 是否必须 描述 示例 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...
[ "查回复的短信", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "start_time", "String", "是", "短信回复开始时间", "2013", "-", "08", "-", "11", "00", ":", "00", ":", "00", "end_time", "String", "是", "短信回复结束时间", "2013"...
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L177-L199
yunpian/yunpian-python-sdk
yunpian_python_sdk/api/sms.py
SmsApi.get_record
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 是 短信发送结束时间...
python
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", "]", ")", ":", "r", "=", "self", ".", "verify_param", "(", "param", ",", "must", ")", "if", "not", "r", ".", "is_succ", "(", ")", ...
查短信发送记录 参数名 类型 是否必须 描述 示例 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 ...
[ "查短信发送记录", "参数名", "类型", "是否必须", "描述", "示例", "apikey", "String", "是", "用户唯一标识", "9b11127a9701975c734b8aee81ee3526", "mobile", "String", "否", "需要查询的手机号", "15205201314", "start_time", "String", "是", "短信发送开始时间", "2013", "-", "08", "-", "11", "00", ":", "00", ":", ...
train
https://github.com/yunpian/yunpian-python-sdk/blob/405a1196ec83fdf29ff454f74ef036974be11970/yunpian_python_sdk/api/sms.py#L220-L240