repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
crdoconnor/commandlib
hitch/key.py
Engine.set_up
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() for script in self.given.get("scripts", []): ...
python
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() for script in self.given.get("scripts", []): ...
[ "def", "set_up", "(", "self", ")", ":", "self", ".", "path", ".", "state", "=", "self", ".", "path", ".", "gen", ".", "joinpath", "(", "\"state\"", ")", "if", "self", ".", "path", ".", "state", ".", "exists", "(", ")", ":", "self", ".", "path", ...
Set up your applications and the test environment.
[ "Set", "up", "your", "applications", "and", "the", "test", "environment", "." ]
b630364fd7b0d189b388e22a7f43235d182e12e4
https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/hitch/key.py#L38-L65
train
Set up your applications and the test environment.
lbryio/aioupnp
aioupnp/upnp.py
UPnP.get_specific_port_mapping
async def get_specific_port_mapping(self, external_port: int, protocol: str) -> Dict: """ :param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: (int) <internal port>, (str) <lan ip>, (bool) <enabled>, (str) <description>, (int) <lease t...
python
async def get_specific_port_mapping(self, external_port: int, protocol: str) -> Dict: """ :param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: (int) <internal port>, (str) <lan ip>, (bool) <enabled>, (str) <description>, (int) <lease t...
[ "async", "def", "get_specific_port_mapping", "(", "self", ",", "external_port", ":", "int", ",", "protocol", ":", "str", ")", "->", "Dict", ":", "try", ":", "result", "=", "await", "self", ".", "gateway", ".", "commands", ".", "GetSpecificPortMappingEntry", ...
:param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: (int) <internal port>, (str) <lan ip>, (bool) <enabled>, (str) <description>, (int) <lease time>
[ ":", "param", "external_port", ":", "(", "int", ")", "external", "port", "to", "listen", "on", ":", "param", "protocol", ":", "(", "str", ")", "UDP", "|", "TCP", ":", "return", ":", "(", "int", ")", "<internal", "port", ">", "(", "str", ")", "<lan"...
a404269d91cff5358bcffb8067b0fd1d9c6842d3
https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/upnp.py#L126-L141
train
Get specific port mapping.
lbryio/aioupnp
aioupnp/upnp.py
UPnP.delete_port_mapping
async def delete_port_mapping(self, external_port: int, protocol: str) -> None: """ :param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: None """ return await self.gateway.commands.DeletePortMapping( NewRemo...
python
async def delete_port_mapping(self, external_port: int, protocol: str) -> None: """ :param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: None """ return await self.gateway.commands.DeletePortMapping( NewRemo...
[ "async", "def", "delete_port_mapping", "(", "self", ",", "external_port", ":", "int", ",", "protocol", ":", "str", ")", "->", "None", ":", "return", "await", "self", ".", "gateway", ".", "commands", ".", "DeletePortMapping", "(", "NewRemoteHost", "=", "\"\""...
:param external_port: (int) external port to listen on :param protocol: (str) 'UDP' | 'TCP' :return: None
[ ":", "param", "external_port", ":", "(", "int", ")", "external", "port", "to", "listen", "on", ":", "param", "protocol", ":", "(", "str", ")", "UDP", "|", "TCP", ":", "return", ":", "None" ]
a404269d91cff5358bcffb8067b0fd1d9c6842d3
https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/upnp.py#L144-L152
train
Delete the port mapping for the specified external port and protocol.
lbryio/aioupnp
aioupnp/upnp.py
UPnP.get_status_info
async def get_status_info(self) -> Tuple[str, str, int]: """Returns (NewConnectionStatus, NewLastConnectionError, NewUptime)""" return await self.gateway.commands.GetStatusInfo()
python
async def get_status_info(self) -> Tuple[str, str, int]: """Returns (NewConnectionStatus, NewLastConnectionError, NewUptime)""" return await self.gateway.commands.GetStatusInfo()
[ "async", "def", "get_status_info", "(", "self", ")", "->", "Tuple", "[", "str", ",", "str", ",", "int", "]", ":", "return", "await", "self", ".", "gateway", ".", "commands", ".", "GetStatusInfo", "(", ")" ]
Returns (NewConnectionStatus, NewLastConnectionError, NewUptime)
[ "Returns", "(", "NewConnectionStatus", "NewLastConnectionError", "NewUptime", ")" ]
a404269d91cff5358bcffb8067b0fd1d9c6842d3
https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/upnp.py#L271-L273
train
Returns the status of the current session.
lbryio/aioupnp
aioupnp/upnp.py
UPnP.x_get_ics_statistics
async def x_get_ics_statistics(self) -> Tuple[int, int, int, int, str, str]: """Returns (TotalBytesSent, TotalBytesReceived, TotalPacketsSent, TotalPacketsReceived, Layer1DownstreamMaxBitRate, Uptime)""" return await self.gateway.commands.X_GetICSStatistics()
python
async def x_get_ics_statistics(self) -> Tuple[int, int, int, int, str, str]: """Returns (TotalBytesSent, TotalBytesReceived, TotalPacketsSent, TotalPacketsReceived, Layer1DownstreamMaxBitRate, Uptime)""" return await self.gateway.commands.X_GetICSStatistics()
[ "async", "def", "x_get_ics_statistics", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", ",", "int", ",", "int", ",", "str", ",", "str", "]", ":", "return", "await", "self", ".", "gateway", ".", "commands", ".", "X_GetICSStatistics", "(", ")" ]
Returns (TotalBytesSent, TotalBytesReceived, TotalPacketsSent, TotalPacketsReceived, Layer1DownstreamMaxBitRate, Uptime)
[ "Returns", "(", "TotalBytesSent", "TotalBytesReceived", "TotalPacketsSent", "TotalPacketsReceived", "Layer1DownstreamMaxBitRate", "Uptime", ")" ]
a404269d91cff5358bcffb8067b0fd1d9c6842d3
https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/upnp.py#L311-L313
train
Gets the iICS statistics.
lbryio/aioupnp
aioupnp/upnp.py
UPnP.run_cli
def run_cli(cls, method, igd_args: OrderedDict, lan_address: str = '', gateway_address: str = '', timeout: int = 30, interface_name: str = 'default', unicast: bool = True, kwargs: dict = None, loop=None) -> None: """ :param method: the command name :param igd_args: ordered case s...
python
def run_cli(cls, method, igd_args: OrderedDict, lan_address: str = '', gateway_address: str = '', timeout: int = 30, interface_name: str = 'default', unicast: bool = True, kwargs: dict = None, loop=None) -> None: """ :param method: the command name :param igd_args: ordered case s...
[ "def", "run_cli", "(", "cls", ",", "method", ",", "igd_args", ":", "OrderedDict", ",", "lan_address", ":", "str", "=", "''", ",", "gateway_address", ":", "str", "=", "''", ",", "timeout", ":", "int", "=", "30", ",", "interface_name", ":", "str", "=", ...
:param method: the command name :param igd_args: ordered case sensitive M-SEARCH headers, if provided all headers to be used must be provided :param lan_address: the ip address of the local interface :param gateway_address: the ip address of the gateway :param timeout: timeout, in second...
[ ":", "param", "method", ":", "the", "command", "name", ":", "param", "igd_args", ":", "ordered", "case", "sensitive", "M", "-", "SEARCH", "headers", "if", "provided", "all", "headers", "to", "be", "used", "must", "be", "provided", ":", "param", "lan_addres...
a404269d91cff5358bcffb8067b0fd1d9c6842d3
https://github.com/lbryio/aioupnp/blob/a404269d91cff5358bcffb8067b0fd1d9c6842d3/aioupnp/upnp.py#L343-L403
train
This is the main function for the command - line interface.
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.authenticate
def authenticate(self, username: str, password: str) -> bool: """Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull """ self.username = username self.password = password auth_p...
python
def authenticate(self, username: str, password: str) -> bool: """Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull """ self.username = username self.password = password auth_p...
[ "def", "authenticate", "(", "self", ",", "username", ":", "str", ",", "password", ":", "str", ")", "->", "bool", ":", "self", ".", "username", "=", "username", "self", ".", "password", "=", "password", "auth_payload", "=", "\"\"\"<authenticate1 xmlns=\\\"utcs\...
Do an Authentricate request and save the cookie returned to be used on the following requests. Return True if the request was successfull
[ "Do", "an", "Authentricate", "request", "and", "save", "the", "cookie", "returned", "to", "be", "used", "on", "the", "following", "requests", ".", "Return", "True", "if", "the", "request", "was", "successfull" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L27-L51
train
Do an Authentricate request and save the cookie returned to be used Return True if the request was successfull otherwise Return False
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.get_state
def get_state(self) -> str: """Get the controller state""" xdoc = self.connection.soap_action('/ws/ControllerService', 'getState', "") if xdoc: return xdoc.find('./SOAP-ENV:Body/ns1:getState1/ns1:state', IHCSoapC...
python
def get_state(self) -> str: """Get the controller state""" xdoc = self.connection.soap_action('/ws/ControllerService', 'getState', "") if xdoc: return xdoc.find('./SOAP-ENV:Body/ns1:getState1/ns1:state', IHCSoapC...
[ "def", "get_state", "(", "self", ")", "->", "str", ":", "xdoc", "=", "self", ".", "connection", ".", "soap_action", "(", "'/ws/ControllerService'", ",", "'getState'", ",", "\"\"", ")", "if", "xdoc", ":", "return", "xdoc", ".", "find", "(", "'./SOAP-ENV:Bod...
Get the controller state
[ "Get", "the", "controller", "state" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L53-L60
train
Get the current state of the current user
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.wait_for_state_change
def wait_for_state_change(self, state: str, waitsec) -> str: """Wait for controller state change and return state""" payload = """<ns1:waitForControllerStateChange1 xmlns:ns1=\"utcs\" xsi:type=\"ns1:WSControllerState\"> <ns1:state xsi:type=\"xsd:string\">{state}...
python
def wait_for_state_change(self, state: str, waitsec) -> str: """Wait for controller state change and return state""" payload = """<ns1:waitForControllerStateChange1 xmlns:ns1=\"utcs\" xsi:type=\"ns1:WSControllerState\"> <ns1:state xsi:type=\"xsd:string\">{state}...
[ "def", "wait_for_state_change", "(", "self", ",", "state", ":", "str", ",", "waitsec", ")", "->", "str", ":", "payload", "=", "\"\"\"<ns1:waitForControllerStateChange1\n xmlns:ns1=\\\"utcs\\\" xsi:type=\\\"ns1:WSControllerState\\\">\n <ns1:stat...
Wait for controller state change and return state
[ "Wait", "for", "controller", "state", "change", "and", "return", "state" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L62-L79
train
Wait for controller state change and return state
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.get_project
def get_project(self) -> str: """Get the ihc project""" xdoc = self.connection.soap_action('/ws/ControllerService', 'getIHCProject', "") if xdoc: base64data = xdoc.find( './SOAP-ENV:Body/ns1:getIHCProject1/ns1:data', ...
python
def get_project(self) -> str: """Get the ihc project""" xdoc = self.connection.soap_action('/ws/ControllerService', 'getIHCProject', "") if xdoc: base64data = xdoc.find( './SOAP-ENV:Body/ns1:getIHCProject1/ns1:data', ...
[ "def", "get_project", "(", "self", ")", "->", "str", ":", "xdoc", "=", "self", ".", "connection", ".", "soap_action", "(", "'/ws/ControllerService'", ",", "'getIHCProject'", ",", "\"\"", ")", "if", "xdoc", ":", "base64data", "=", "xdoc", ".", "find", "(", ...
Get the ihc project
[ "Get", "the", "ihc", "project" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L81-L94
train
Get the ihc project
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.set_runtime_value_bool
def set_runtime_value_bool(self, resourceid: int, value: bool) -> bool: """Set a boolean runtime value""" if value: boolvalue = "true" else: boolvalue = "false" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/20...
python
def set_runtime_value_bool(self, resourceid: int, value: bool) -> bool: """Set a boolean runtime value""" if value: boolvalue = "true" else: boolvalue = "false" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/20...
[ "def", "set_runtime_value_bool", "(", "self", ",", "resourceid", ":", "int", ",", "value", ":", "bool", ")", "->", "bool", ":", "if", "value", ":", "boolvalue", "=", "\"true\"", "else", ":", "boolvalue", "=", "\"false\"", "payload", "=", "\"\"\"\n ...
Set a boolean runtime value
[ "Set", "a", "boolean", "runtime", "value" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L96-L119
train
Set a boolean runtime value
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.set_runtime_value_int
def set_runtime_value_int(self, resourceid: int, intvalue: int): """Set a integer runtime value""" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> <value i:type=\"a:WSIntegerValue\" xmlns:a=\"utcs.values\"> ...
python
def set_runtime_value_int(self, resourceid: int, intvalue: int): """Set a integer runtime value""" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> <value i:type=\"a:WSIntegerValue\" xmlns:a=\"utcs.values\"> ...
[ "def", "set_runtime_value_int", "(", "self", ",", "resourceid", ":", "int", ",", "intvalue", ":", "int", ")", ":", "payload", "=", "\"\"\"\n <setResourceValue1 xmlns=\\\"utcs\\\"\n xmlns:i=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\n <value i:...
Set a integer runtime value
[ "Set", "a", "integer", "runtime", "value" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L121-L139
train
Set a integer runtime value
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.set_runtime_value_float
def set_runtime_value_float(self, resourceid: int, floatvalue: float): """Set a flot runtime value""" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> <value i:type=\"a:WSFloatingPointValue\" xmlns:a=\"utcs.values\...
python
def set_runtime_value_float(self, resourceid: int, floatvalue: float): """Set a flot runtime value""" payload = """ <setResourceValue1 xmlns=\"utcs\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> <value i:type=\"a:WSFloatingPointValue\" xmlns:a=\"utcs.values\...
[ "def", "set_runtime_value_float", "(", "self", ",", "resourceid", ":", "int", ",", "floatvalue", ":", "float", ")", ":", "payload", "=", "\"\"\"\n <setResourceValue1 xmlns=\\\"utcs\\\"\n xmlns:i=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\n <va...
Set a flot runtime value
[ "Set", "a", "flot", "runtime", "value" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L141-L160
train
Set a flot runtime value
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.get_runtime_value
def get_runtime_value(self, resourceid: int): """Get runtime value of specified resource it The returned value will be boolean, integer or float Return None if resource cannot be found or on error """ payload = """<getRuntimeValue1 xmlns="utcs">{id}</getRuntimeValue1> ...
python
def get_runtime_value(self, resourceid: int): """Get runtime value of specified resource it The returned value will be boolean, integer or float Return None if resource cannot be found or on error """ payload = """<getRuntimeValue1 xmlns="utcs">{id}</getRuntimeValue1> ...
[ "def", "get_runtime_value", "(", "self", ",", "resourceid", ":", "int", ")", ":", "payload", "=", "\"\"\"<getRuntimeValue1 xmlns=\"utcs\">{id}</getRuntimeValue1>\n \"\"\"", ".", "format", "(", "id", "=", "resourceid", ")", "xdoc", "=", "self", ".", "c...
Get runtime value of specified resource it The returned value will be boolean, integer or float Return None if resource cannot be found or on error
[ "Get", "runtime", "value", "of", "specified", "resource", "it", "The", "returned", "value", "will", "be", "boolean", "integer", "or", "float", "Return", "None", "if", "resource", "cannot", "be", "found", "or", "on", "error" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L162-L196
train
Get runtime value of specified resource it
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.enable_runtime_notifications
def enable_runtime_notifications(self, resourceids): """Enable notification for specified resource ids""" idsarr = "" for ihcid in resourceids: idsarr += "<a:arrayItem>{id}</a:arrayItem>".format(id=ihcid) payload = """<enableRuntimeValueNotifications1 xmlns=\"utcs\" ...
python
def enable_runtime_notifications(self, resourceids): """Enable notification for specified resource ids""" idsarr = "" for ihcid in resourceids: idsarr += "<a:arrayItem>{id}</a:arrayItem>".format(id=ihcid) payload = """<enableRuntimeValueNotifications1 xmlns=\"utcs\" ...
[ "def", "enable_runtime_notifications", "(", "self", ",", "resourceids", ")", ":", "idsarr", "=", "\"\"", "for", "ihcid", "in", "resourceids", ":", "idsarr", "+=", "\"<a:arrayItem>{id}</a:arrayItem>\"", ".", "format", "(", "id", "=", "ihcid", ")", "payload", "=",...
Enable notification for specified resource ids
[ "Enable", "notification", "for", "specified", "resource", "ids" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L202-L219
train
Enable notification for specified resource ids
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.wait_for_resource_value_changes
def wait_for_resource_value_changes(self, wait: int=10): """ Long polling for changes and return a dictionary with resource:value for changes """ changes = {} payload = """<waitForResourceValueChanges1 xmlns=\"utcs\">{timeout}</waitForResourceValueCha...
python
def wait_for_resource_value_changes(self, wait: int=10): """ Long polling for changes and return a dictionary with resource:value for changes """ changes = {} payload = """<waitForResourceValueChanges1 xmlns=\"utcs\">{timeout}</waitForResourceValueCha...
[ "def", "wait_for_resource_value_changes", "(", "self", ",", "wait", ":", "int", "=", "10", ")", ":", "changes", "=", "{", "}", "payload", "=", "\"\"\"<waitForResourceValueChanges1\n xmlns=\\\"utcs\\\">{timeout}</waitForResourceValueChanges1>\n ...
Long polling for changes and return a dictionary with resource:value for changes
[ "Long", "polling", "for", "changes", "and", "return", "a", "dictionary", "with", "resource", ":", "value", "for", "changes" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L221-L258
train
Long polling for changes and return a dictionary with resource : value for changes
dingusdk/PythonIhcSdk
ihcsdk/ihcclient.py
IHCSoapClient.get_user_log
def get_user_log(self, language='da'): """Get the controller state""" payload = """<getUserLog1 xmlns="utcs" /> <getUserLog2 xmlns="utcs">0</getUserLog2> <getUserLog3 xmlns="utcs">{language}</getUserLog3> """.format(language=language) ...
python
def get_user_log(self, language='da'): """Get the controller state""" payload = """<getUserLog1 xmlns="utcs" /> <getUserLog2 xmlns="utcs">0</getUserLog2> <getUserLog3 xmlns="utcs">{language}</getUserLog3> """.format(language=language) ...
[ "def", "get_user_log", "(", "self", ",", "language", "=", "'da'", ")", ":", "payload", "=", "\"\"\"<getUserLog1 xmlns=\"utcs\" />\n <getUserLog2 xmlns=\"utcs\">0</getUserLog2>\n <getUserLog3 xmlns=\"utcs\">{language}</getUserLog3>\n ...
Get the controller state
[ "Get", "the", "controller", "state" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcclient.py#L260-L274
train
Get the controller state of the user log
Grumbel/procmem
procmem/memory_region.py
MemoryRegion._add_info_from_string
def _add_info_from_string(self, text): """Parse additional info from /proc/$PID/smaps""" match = MemoryRegion.info_re.match(text) assert match is not None name = match.group(1) kb_count = int(match.group(2)) self.info[name] = kb_count * 1024
python
def _add_info_from_string(self, text): """Parse additional info from /proc/$PID/smaps""" match = MemoryRegion.info_re.match(text) assert match is not None name = match.group(1) kb_count = int(match.group(2)) self.info[name] = kb_count * 1024
[ "def", "_add_info_from_string", "(", "self", ",", "text", ")", ":", "match", "=", "MemoryRegion", ".", "info_re", ".", "match", "(", "text", ")", "assert", "match", "is", "not", "None", "name", "=", "match", ".", "group", "(", "1", ")", "kb_count", "="...
Parse additional info from /proc/$PID/smaps
[ "Parse", "additional", "info", "from", "/", "proc", "/", "$PID", "/", "smaps" ]
a832a02c4ac79c15f108c72b251820e959a16639
https://github.com/Grumbel/procmem/blob/a832a02c4ac79c15f108c72b251820e959a16639/procmem/memory_region.py#L126-L133
train
Parse additional info from a string.
Grumbel/procmem
procmem/memory_region.py
MemoryRegion._from_match
def _from_match(match): """Create a MemoryRegion object from a string in the format found in /proc/$PID/maps""" addr_beg, addr_end, r, w, x, p, offset, dev, inode, pathname = match.groups() return MemoryRegion(addr_beg=int(addr_beg, 16), addr_end=int(addr_end, 16), ...
python
def _from_match(match): """Create a MemoryRegion object from a string in the format found in /proc/$PID/maps""" addr_beg, addr_end, r, w, x, p, offset, dev, inode, pathname = match.groups() return MemoryRegion(addr_beg=int(addr_beg, 16), addr_end=int(addr_end, 16), ...
[ "def", "_from_match", "(", "match", ")", ":", "addr_beg", ",", "addr_end", ",", "r", ",", "w", ",", "x", ",", "p", ",", "offset", ",", "dev", ",", "inode", ",", "pathname", "=", "match", ".", "groups", "(", ")", "return", "MemoryRegion", "(", "addr...
Create a MemoryRegion object from a string in the format found in /proc/$PID/maps
[ "Create", "a", "MemoryRegion", "object", "from", "a", "string", "in", "the", "format", "found", "in", "/", "proc", "/", "$PID", "/", "maps" ]
a832a02c4ac79c15f108c72b251820e959a16639
https://github.com/Grumbel/procmem/blob/a832a02c4ac79c15f108c72b251820e959a16639/procmem/memory_region.py#L148-L160
train
Create a MemoryRegion object from a regex match object.
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
_get_node
def _get_node(response, *ancestors): """ Traverse tree to node """ document = response for ancestor in ancestors: if ancestor not in document: return {} else: document = document[ancestor] return document
python
def _get_node(response, *ancestors): """ Traverse tree to node """ document = response for ancestor in ancestors: if ancestor not in document: return {} else: document = document[ancestor] return document
[ "def", "_get_node", "(", "response", ",", "*", "ancestors", ")", ":", "document", "=", "response", "for", "ancestor", "in", "ancestors", ":", "if", "ancestor", "not", "in", "document", ":", "return", "{", "}", "else", ":", "document", "=", "document", "[...
Traverse tree to node
[ "Traverse", "tree", "to", "node" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L20-L28
train
Traverse tree to node
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner.update_token
def update_token(self): """ Get token from key and secret """ headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ' + base64.b64encode( (self._key + ':' + self._secret).encode()).decode() } data = {'grant_ty...
python
def update_token(self): """ Get token from key and secret """ headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic ' + base64.b64encode( (self._key + ':' + self._secret).encode()).decode() } data = {'grant_ty...
[ "def", "update_token", "(", "self", ")", ":", "headers", "=", "{", "'Content-Type'", ":", "'application/x-www-form-urlencoded'", ",", "'Authorization'", ":", "'Basic '", "+", "base64", ".", "b64encode", "(", "(", "self", ".", "_key", "+", "':'", "+", "self", ...
Get token from key and secret
[ "Get", "token", "from", "key", "and", "secret" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L40-L54
train
Update the token from the key and secret
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner.location_nearbystops
def location_nearbystops(self, origin_coord_lat, origin_coord_long): """ location.nearbystops """ response = self._request( 'location.nearbystops', originCoordLat=origin_coord_lat, originCoordLong=origin_coord_long) return _get_node(response, 'LocationList', '...
python
def location_nearbystops(self, origin_coord_lat, origin_coord_long): """ location.nearbystops """ response = self._request( 'location.nearbystops', originCoordLat=origin_coord_lat, originCoordLong=origin_coord_long) return _get_node(response, 'LocationList', '...
[ "def", "location_nearbystops", "(", "self", ",", "origin_coord_lat", ",", "origin_coord_long", ")", ":", "response", "=", "self", ".", "_request", "(", "'location.nearbystops'", ",", "originCoordLat", "=", "origin_coord_lat", ",", "originCoordLong", "=", "origin_coord...
location.nearbystops
[ "location", ".", "nearbystops" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L64-L70
train
Get a list of stop locations that are nearbystops.
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner.location_name
def location_name(self, name): """ location.name """ response = self._request( 'location.name', input=name) return _get_node(response, 'LocationList', 'StopLocation')
python
def location_name(self, name): """ location.name """ response = self._request( 'location.name', input=name) return _get_node(response, 'LocationList', 'StopLocation')
[ "def", "location_name", "(", "self", ",", "name", ")", ":", "response", "=", "self", ".", "_request", "(", "'location.name'", ",", "input", "=", "name", ")", "return", "_get_node", "(", "response", ",", "'LocationList'", ",", "'StopLocation'", ")" ]
location.name
[ "location", ".", "name" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L80-L85
train
Get a location by name.
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner.arrivalboard
def arrivalboard(self, stop_id, date=None, direction=None): """ arrivalBoard """ date = date if date else datetime.now() request_parameters = { 'id': stop_id, 'date': date.strftime(DATE_FORMAT), 'time': date.strftime(TIME_FORMAT) } if direction...
python
def arrivalboard(self, stop_id, date=None, direction=None): """ arrivalBoard """ date = date if date else datetime.now() request_parameters = { 'id': stop_id, 'date': date.strftime(DATE_FORMAT), 'time': date.strftime(TIME_FORMAT) } if direction...
[ "def", "arrivalboard", "(", "self", ",", "stop_id", ",", "date", "=", "None", ",", "direction", "=", "None", ")", ":", "date", "=", "date", "if", "date", "else", "datetime", ".", "now", "(", ")", "request_parameters", "=", "{", "'id'", ":", "stop_id", ...
arrivalBoard
[ "arrivalBoard" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L89-L102
train
Get the arrival board for a stop.
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner.trip
def trip(self, origin_id, dest_id, date=None): """ trip """ date = date if date else datetime.now() response = self._request( 'trip', originId=origin_id, destId=dest_id, date=date.strftime(DATE_FORMAT), time=date.strftime(TIME_FORMAT)) ...
python
def trip(self, origin_id, dest_id, date=None): """ trip """ date = date if date else datetime.now() response = self._request( 'trip', originId=origin_id, destId=dest_id, date=date.strftime(DATE_FORMAT), time=date.strftime(TIME_FORMAT)) ...
[ "def", "trip", "(", "self", ",", "origin_id", ",", "dest_id", ",", "date", "=", "None", ")", ":", "date", "=", "date", "if", "date", "else", "datetime", ".", "now", "(", ")", "response", "=", "self", ".", "_request", "(", "'trip'", ",", "originId", ...
trip
[ "trip" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L123-L132
train
Get a list of all Trip objects from a source.
persandstrom/python-vasttrafik
vasttrafik/journy_planner.py
JournyPlanner._request
def _request(self, service, **parameters): """ request builder """ urlformat = "{baseurl}/{service}?{parameters}&format=json" url = urlformat.format( baseurl=API_BASE_URL, service=service, parameters="&".join([ "{}={}".format(key, value) for ke...
python
def _request(self, service, **parameters): """ request builder """ urlformat = "{baseurl}/{service}?{parameters}&format=json" url = urlformat.format( baseurl=API_BASE_URL, service=service, parameters="&".join([ "{}={}".format(key, value) for ke...
[ "def", "_request", "(", "self", ",", "service", ",", "*", "*", "parameters", ")", ":", "urlformat", "=", "\"{baseurl}/{service}?{parameters}&format=json\"", "url", "=", "urlformat", ".", "format", "(", "baseurl", "=", "API_BASE_URL", ",", "service", "=", "servic...
request builder
[ "request", "builder" ]
9c657fde1e91229c5878ea25530260596d296d37
https://github.com/persandstrom/python-vasttrafik/blob/9c657fde1e91229c5878ea25530260596d296d37/vasttrafik/journy_planner.py#L134-L151
train
request method for getting a specific object from the API
Capitains/MyCapytain
MyCapytain/common/utils/_graph.py
expand_namespace
def expand_namespace(nsmap, string): """ If the string starts with a known prefix in nsmap, replace it by full URI :param nsmap: Dictionary of prefix -> uri of namespace :param string: String in which to replace the namespace :return: Expanded string with no namespace """ for ns in nsmap: ...
python
def expand_namespace(nsmap, string): """ If the string starts with a known prefix in nsmap, replace it by full URI :param nsmap: Dictionary of prefix -> uri of namespace :param string: String in which to replace the namespace :return: Expanded string with no namespace """ for ns in nsmap: ...
[ "def", "expand_namespace", "(", "nsmap", ",", "string", ")", ":", "for", "ns", "in", "nsmap", ":", "if", "isinstance", "(", "string", ",", "str", ")", "and", "isinstance", "(", "ns", ",", "str", ")", "and", "string", ".", "startswith", "(", "ns", "+"...
If the string starts with a known prefix in nsmap, replace it by full URI :param nsmap: Dictionary of prefix -> uri of namespace :param string: String in which to replace the namespace :return: Expanded string with no namespace
[ "If", "the", "string", "starts", "with", "a", "known", "prefix", "in", "nsmap", "replace", "it", "by", "full", "URI" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/utils/_graph.py#L72-L82
train
Expands a string with a known prefix in nsmap.
Capitains/MyCapytain
MyCapytain/common/utils/_graph.py
Subgraph.graphiter
def graphiter(self, graph, target, ascendants=0, descendants=1): """ Iter on a graph to finds object connected :param graph: Graph to serialize :type graph: Graph :param target: Node to iterate over :type target: Node :param ascendants: Number of level to iter over upwar...
python
def graphiter(self, graph, target, ascendants=0, descendants=1): """ Iter on a graph to finds object connected :param graph: Graph to serialize :type graph: Graph :param target: Node to iterate over :type target: Node :param ascendants: Number of level to iter over upwar...
[ "def", "graphiter", "(", "self", ",", "graph", ",", "target", ",", "ascendants", "=", "0", ",", "descendants", "=", "1", ")", ":", "asc", "=", "0", "+", "ascendants", "if", "asc", "!=", "0", ":", "asc", "-=", "1", "desc", "=", "0", "+", "descenda...
Iter on a graph to finds object connected :param graph: Graph to serialize :type graph: Graph :param target: Node to iterate over :type target: Node :param ascendants: Number of level to iter over upwards (-1 = No Limit) :param descendants: Number of level to iter over d...
[ "Iter", "on", "a", "graph", "to", "finds", "object", "connected" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/utils/_graph.py#L21-L63
train
Iterate over a graph to find object connected to a target node.
potatolondon/gae-pytz
pytz/__init__.py
timezone
def timezone(zone): r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(u'US/Eastern') is eastern True >>> utc_dt = ...
python
def timezone(zone): r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(u'US/Eastern') is eastern True >>> utc_dt = ...
[ "def", "timezone", "(", "zone", ")", ":", "if", "zone", ".", "upper", "(", ")", "==", "'UTC'", ":", "return", "utc", "try", ":", "zone", "=", "zone", ".", "encode", "(", "'US-ASCII'", ")", "except", "UnicodeEncodeError", ":", "# All valid timezones are ASC...
r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(u'US/Eastern') is eastern True >>> utc_dt = datetime(2002, 10, 27, 6...
[ "r", "Return", "a", "datetime", ".", "tzinfo", "implementation", "for", "the", "given", "timezone" ]
24741951a7af3e79cd8727ae3f79265decc93fef
https://github.com/potatolondon/gae-pytz/blob/24741951a7af3e79cd8727ae3f79265decc93fef/pytz/__init__.py#L90-L140
train
r Returns a datetime. tzinfo implementation for the given timezone.
xflr6/features
features/tools.py
uniqued
def uniqued(iterable): """Return unique list of items preserving order. >>> uniqued([3, 2, 1, 3, 2, 1, 0]) [3, 2, 1, 0] """ seen = set() add = seen.add return [i for i in iterable if i not in seen and not add(i)]
python
def uniqued(iterable): """Return unique list of items preserving order. >>> uniqued([3, 2, 1, 3, 2, 1, 0]) [3, 2, 1, 0] """ seen = set() add = seen.add return [i for i in iterable if i not in seen and not add(i)]
[ "def", "uniqued", "(", "iterable", ")", ":", "seen", "=", "set", "(", ")", "add", "=", "seen", ".", "add", "return", "[", "i", "for", "i", "in", "iterable", "if", "i", "not", "in", "seen", "and", "not", "add", "(", "i", ")", "]" ]
Return unique list of items preserving order. >>> uniqued([3, 2, 1, 3, 2, 1, 0]) [3, 2, 1, 0]
[ "Return", "unique", "list", "of", "items", "preserving", "order", "." ]
f985304dd642da6ecdc66d85167d00daa4efe5f4
https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/tools.py#L10-L18
train
Return unique list of items preserving order.
xflr6/features
features/tools.py
butlast
def butlast(iterable): """Yield all items from ``iterable`` except the last one. >>> list(butlast(['spam', 'eggs', 'ham'])) ['spam', 'eggs'] >>> list(butlast(['spam'])) [] >>> list(butlast([])) [] """ iterable = iter(iterable) try: first = next(iterable) except Sto...
python
def butlast(iterable): """Yield all items from ``iterable`` except the last one. >>> list(butlast(['spam', 'eggs', 'ham'])) ['spam', 'eggs'] >>> list(butlast(['spam'])) [] >>> list(butlast([])) [] """ iterable = iter(iterable) try: first = next(iterable) except Sto...
[ "def", "butlast", "(", "iterable", ")", ":", "iterable", "=", "iter", "(", "iterable", ")", "try", ":", "first", "=", "next", "(", "iterable", ")", "except", "StopIteration", ":", "return", "for", "second", "in", "iterable", ":", "yield", "first", "first...
Yield all items from ``iterable`` except the last one. >>> list(butlast(['spam', 'eggs', 'ham'])) ['spam', 'eggs'] >>> list(butlast(['spam'])) [] >>> list(butlast([])) []
[ "Yield", "all", "items", "from", "iterable", "except", "the", "last", "one", "." ]
f985304dd642da6ecdc66d85167d00daa4efe5f4
https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/tools.py#L21-L40
train
Yield all items from iterable except the last one.
xflr6/features
features/tools.py
generic_translate
def generic_translate(frm=None, to=None, delete=''): """Return a translate function for strings and unicode. >>> translate = generic_translate('Hoy', 'Bad', 'r') >>> translate('Holy grail') 'Bald gail' >>> translate(u'Holy grail') == u'Bald gail' True """ if PY2: delete_dict =...
python
def generic_translate(frm=None, to=None, delete=''): """Return a translate function for strings and unicode. >>> translate = generic_translate('Hoy', 'Bad', 'r') >>> translate('Holy grail') 'Bald gail' >>> translate(u'Holy grail') == u'Bald gail' True """ if PY2: delete_dict =...
[ "def", "generic_translate", "(", "frm", "=", "None", ",", "to", "=", "None", ",", "delete", "=", "''", ")", ":", "if", "PY2", ":", "delete_dict", "=", "dict", ".", "fromkeys", "(", "ord", "(", "unicode", "(", "d", ")", ")", "for", "d", "in", "del...
Return a translate function for strings and unicode. >>> translate = generic_translate('Hoy', 'Bad', 'r') >>> translate('Holy grail') 'Bald gail' >>> translate(u'Holy grail') == u'Bald gail' True
[ "Return", "a", "translate", "function", "for", "strings", "and", "unicode", "." ]
f985304dd642da6ecdc66d85167d00daa4efe5f4
https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/tools.py#L43-L79
train
Return a translate function for strings and unicode.
etingof/pysnmpcrypto
pysnmpcrypto/des3.py
_cryptography_cipher
def _cryptography_cipher(key, iv): """Build a cryptography TripleDES Cipher object. :param bytes key: Encryption key :param bytesiv iv: Initialization vector :returns: TripleDES Cipher instance :rtype: cryptography.hazmat.primitives.ciphers.Cipher """ return Cipher( algorithm=algori...
python
def _cryptography_cipher(key, iv): """Build a cryptography TripleDES Cipher object. :param bytes key: Encryption key :param bytesiv iv: Initialization vector :returns: TripleDES Cipher instance :rtype: cryptography.hazmat.primitives.ciphers.Cipher """ return Cipher( algorithm=algori...
[ "def", "_cryptography_cipher", "(", "key", ",", "iv", ")", ":", "return", "Cipher", "(", "algorithm", "=", "algorithms", ".", "TripleDES", "(", "key", ")", ",", "mode", "=", "modes", ".", "CBC", "(", "iv", ")", ",", "backend", "=", "default_backend", "...
Build a cryptography TripleDES Cipher object. :param bytes key: Encryption key :param bytesiv iv: Initialization vector :returns: TripleDES Cipher instance :rtype: cryptography.hazmat.primitives.ciphers.Cipher
[ "Build", "a", "cryptography", "TripleDES", "Cipher", "object", "." ]
9b92959f5e2fce833fa220343ca12add3134a77c
https://github.com/etingof/pysnmpcrypto/blob/9b92959f5e2fce833fa220343ca12add3134a77c/pysnmpcrypto/des3.py#L28-L40
train
Build a cryptography TripleDES Cipher object.
totalgood/twip
twip/wip/build_pycon_slides.py
parse_args
def parse_args(args): """ Parse command line parameters :param args: command line parameters as list of strings :return: command line parameters as :obj:`argparse.Namespace` """ parser = argparse.ArgumentParser( description="Build html reveal.js slides from markdown in docs/ dir") p...
python
def parse_args(args): """ Parse command line parameters :param args: command line parameters as list of strings :return: command line parameters as :obj:`argparse.Namespace` """ parser = argparse.ArgumentParser( description="Build html reveal.js slides from markdown in docs/ dir") p...
[ "def", "parse_args", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Build html reveal.js slides from markdown in docs/ dir\"", ")", "parser", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "help", "="...
Parse command line parameters :param args: command line parameters as list of strings :return: command line parameters as :obj:`argparse.Namespace`
[ "Parse", "command", "line", "parameters" ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/wip/build_pycon_slides.py#L25-L59
train
Parse command line parameters as list of strings
totalgood/twip
twip/wip/build_pycon_slides.py
update_git_repo
def update_git_repo(): """Because GitPython sucks (cmd.commit() hangs) # pip install GitPython # import git # repo = git.Repo('.') # g = git.cmd.Git('.') # g.pull() # g.push() # g.commit() """ today commands = """ git add docs/*.html git add docs/images/ ...
python
def update_git_repo(): """Because GitPython sucks (cmd.commit() hangs) # pip install GitPython # import git # repo = git.Repo('.') # g = git.cmd.Git('.') # g.pull() # g.push() # g.commit() """ today commands = """ git add docs/*.html git add docs/images/ ...
[ "def", "update_git_repo", "(", ")", ":", "today", "commands", "=", "\"\"\"\n git add docs/*.html\n git add docs/images/\n git add docs*.ipynb\n git commit -am \"autocommit new docs build {}\"\n git push hobson\n git push origin\n\n git checkout master...
Because GitPython sucks (cmd.commit() hangs) # pip install GitPython # import git # repo = git.Repo('.') # g = git.cmd.Git('.') # g.pull() # g.push() # g.commit()
[ "Because", "GitPython", "sucks", "(", "cmd", ".", "commit", "()", "hangs", ")" ]
5c0411d2acfbe5b421841072814c9152591c03f7
https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/wip/build_pycon_slides.py#L77-L116
train
Update Git repository with new contents.
Capitains/MyCapytain
MyCapytain/common/utils/dts.py
parse_metadata
def parse_metadata(metadata_obj: Metadata, metadata_dictionary: dict) -> None: """ Adds to a Metadata object any DublinCore or dts:Extensions object found in the given dictionary :param metadata_obj: :param metadata_dictionary: """ for key, value_set in metadata_dictionary.get("https://w3id.org...
python
def parse_metadata(metadata_obj: Metadata, metadata_dictionary: dict) -> None: """ Adds to a Metadata object any DublinCore or dts:Extensions object found in the given dictionary :param metadata_obj: :param metadata_dictionary: """ for key, value_set in metadata_dictionary.get("https://w3id.org...
[ "def", "parse_metadata", "(", "metadata_obj", ":", "Metadata", ",", "metadata_dictionary", ":", "dict", ")", "->", "None", ":", "for", "key", ",", "value_set", "in", "metadata_dictionary", ".", "get", "(", "\"https://w3id.org/dts/api#dublincore\"", ",", "[", "{", ...
Adds to a Metadata object any DublinCore or dts:Extensions object found in the given dictionary :param metadata_obj: :param metadata_dictionary:
[ "Adds", "to", "a", "Metadata", "object", "any", "DublinCore", "or", "dts", ":", "Extensions", "object", "found", "in", "the", "given", "dictionary" ]
b11bbf6b6ae141fc02be70471e3fbf6907be6593
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/utils/dts.py#L11-L26
train
Parses the given dictionary into a Metadata object.
hickeroar/LatLon23
LatLon23/__init__.py
string2geocoord
def string2geocoord(coord_str, coord_class, format_str = 'D'): ''' Create a GeoCoord object (e.g. Latitude or Longitude) from a string. Inputs: coord_str (str) - a string representation of a geographic coordinate (e.g. '5.083 N'). Each section of the string must be separated by some kind o...
python
def string2geocoord(coord_str, coord_class, format_str = 'D'): ''' Create a GeoCoord object (e.g. Latitude or Longitude) from a string. Inputs: coord_str (str) - a string representation of a geographic coordinate (e.g. '5.083 N'). Each section of the string must be separated by some kind o...
[ "def", "string2geocoord", "(", "coord_str", ",", "coord_class", ",", "format_str", "=", "'D'", ")", ":", "new_coord", "=", "coord_class", "(", ")", "# Dictionary of functions for setting variables in the coordinate class:", "format2value", "=", "{", "'H'", ":", "new_coo...
Create a GeoCoord object (e.g. Latitude or Longitude) from a string. Inputs: coord_str (str) - a string representation of a geographic coordinate (e.g. '5.083 N'). Each section of the string must be separated by some kind of a separator character ('5.083N' is invalid). coord_clas...
[ "Create", "a", "GeoCoord", "object", "(", "e", ".", "g", ".", "Latitude", "or", "Longitude", ")", "from", "a", "string", ".", "Inputs", ":", "coord_str", "(", "str", ")", "-", "a", "string", "representation", "of", "a", "geographic", "coordinate", "(", ...
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L289-L337
train
Converts a string representation of a geographic coordinate into a GeoCoord object.
hickeroar/LatLon23
LatLon23/__init__.py
string2latlon
def string2latlon(lat_str, lon_str, format_str): ''' Create a LatLon object from a pair of strings. Inputs: lat_str (str) - string representation of a latitude (e.g. '5 52 59.88 N') lon_str (str) - string representation of a longitude (e.g. '162 4 59.88 W') format_str (str) - format ...
python
def string2latlon(lat_str, lon_str, format_str): ''' Create a LatLon object from a pair of strings. Inputs: lat_str (str) - string representation of a latitude (e.g. '5 52 59.88 N') lon_str (str) - string representation of a longitude (e.g. '162 4 59.88 W') format_str (str) - format ...
[ "def", "string2latlon", "(", "lat_str", ",", "lon_str", ",", "format_str", ")", ":", "lat", "=", "string2geocoord", "(", "lat_str", ",", "Latitude", ",", "format_str", ")", "lon", "=", "string2geocoord", "(", "lon_str", ",", "Longitude", ",", "format_str", "...
Create a LatLon object from a pair of strings. Inputs: lat_str (str) - string representation of a latitude (e.g. '5 52 59.88 N') lon_str (str) - string representation of a longitude (e.g. '162 4 59.88 W') format_str (str) - format in which the coordinate strings are given (e.g. for...
[ "Create", "a", "LatLon", "object", "from", "a", "pair", "of", "strings", ".", "Inputs", ":", "lat_str", "(", "str", ")", "-", "string", "representation", "of", "a", "latitude", "(", "e", ".", "g", ".", "5", "52", "59", ".", "88", "N", ")", "lon_str...
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L547-L562
train
Convert a string representation of a latitude and longitude into a LatLon object.
hickeroar/LatLon23
LatLon23/__init__.py
GeoCoord._calc_degreeminutes
def _calc_degreeminutes(decimal_degree): ''' Calculate degree, minute second from decimal degree ''' sign = compare(decimal_degree, 0) # Store whether the coordinate is negative or positive decimal_degree = abs(decimal_degree) degree = decimal_degree//1 # Truncate degree ...
python
def _calc_degreeminutes(decimal_degree): ''' Calculate degree, minute second from decimal degree ''' sign = compare(decimal_degree, 0) # Store whether the coordinate is negative or positive decimal_degree = abs(decimal_degree) degree = decimal_degree//1 # Truncate degree ...
[ "def", "_calc_degreeminutes", "(", "decimal_degree", ")", ":", "sign", "=", "compare", "(", "decimal_degree", ",", "0", ")", "# Store whether the coordinate is negative or positive", "decimal_degree", "=", "abs", "(", "decimal_degree", ")", "degree", "=", "decimal_degre...
Calculate degree, minute second from decimal degree
[ "Calculate", "degree", "minute", "second", "from", "decimal", "degree" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L73-L87
train
Calculate degree minute second from decimal degree
hickeroar/LatLon23
LatLon23/__init__.py
GeoCoord._update
def _update(self): ''' Given degree, minute, and second information, clean up the variables and make them consistent (for example, if minutes > 60, add extra to degrees, or if degrees is a decimal, add extra to minutes). ''' self.decimal_degree = self._calc_decimaldegree(...
python
def _update(self): ''' Given degree, minute, and second information, clean up the variables and make them consistent (for example, if minutes > 60, add extra to degrees, or if degrees is a decimal, add extra to minutes). ''' self.decimal_degree = self._calc_decimaldegree(...
[ "def", "_update", "(", "self", ")", ":", "self", ".", "decimal_degree", "=", "self", ".", "_calc_decimaldegree", "(", "self", ".", "degree", ",", "self", ".", "minute", ",", "self", ".", "second", ")", "self", ".", "degree", ",", "self", ".", "minute",...
Given degree, minute, and second information, clean up the variables and make them consistent (for example, if minutes > 60, add extra to degrees, or if degrees is a decimal, add extra to minutes).
[ "Given", "degree", "minute", "and", "second", "information", "clean", "up", "the", "variables", "and", "make", "them", "consistent", "(", "for", "example", "if", "minutes", ">", "60", "add", "extra", "to", "degrees", "or", "if", "degrees", "is", "a", "deci...
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L89-L96
train
Update the internal representation of the object.
hickeroar/LatLon23
LatLon23/__init__.py
GeoCoord.to_string
def to_string(self, format_str): ''' Output lat, lon coordinates as string in chosen format Inputs: format (str) - A string of the form A%B%C where A, B and C are identifiers. Unknown identifiers (e.g. ' ', ', ' or '_' will be inserted as separators in a p...
python
def to_string(self, format_str): ''' Output lat, lon coordinates as string in chosen format Inputs: format (str) - A string of the form A%B%C where A, B and C are identifiers. Unknown identifiers (e.g. ' ', ', ' or '_' will be inserted as separators in a p...
[ "def", "to_string", "(", "self", ",", "format_str", ")", ":", "format2value", "=", "{", "'H'", ":", "self", ".", "get_hemisphere", "(", ")", ",", "'M'", ":", "abs", "(", "self", ".", "decimal_minute", ")", ",", "'m'", ":", "int", "(", "abs", "(", "...
Output lat, lon coordinates as string in chosen format Inputs: format (str) - A string of the form A%B%C where A, B and C are identifiers. Unknown identifiers (e.g. ' ', ', ' or '_' will be inserted as separators in a position corresponding to the position in format. ...
[ "Output", "lat", "lon", "coordinates", "as", "string", "in", "chosen", "format", "Inputs", ":", "format", "(", "str", ")", "-", "A", "string", "of", "the", "form", "A%B%C", "where", "A", "B", "and", "C", "are", "identifiers", ".", "Unknown", "identifiers...
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L112-L139
train
Converts the current object into a string in the chosen format.
hickeroar/LatLon23
LatLon23/__init__.py
Longitude.set_hemisphere
def set_hemisphere(self, hemi_str): ''' Given a hemisphere identifier, set the sign of the coordinate to match that hemisphere ''' if hemi_str == 'W': self.degree = abs(self.degree)*-1 self.minute = abs(self.minute)*-1 self.second = abs(self.second)*-1...
python
def set_hemisphere(self, hemi_str): ''' Given a hemisphere identifier, set the sign of the coordinate to match that hemisphere ''' if hemi_str == 'W': self.degree = abs(self.degree)*-1 self.minute = abs(self.minute)*-1 self.second = abs(self.second)*-1...
[ "def", "set_hemisphere", "(", "self", ",", "hemi_str", ")", ":", "if", "hemi_str", "==", "'W'", ":", "self", ".", "degree", "=", "abs", "(", "self", ".", "degree", ")", "*", "-", "1", "self", ".", "minute", "=", "abs", "(", "self", ".", "minute", ...
Given a hemisphere identifier, set the sign of the coordinate to match that hemisphere
[ "Given", "a", "hemisphere", "identifier", "set", "the", "sign", "of", "the", "coordinate", "to", "match", "that", "hemisphere" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L269-L284
train
Given a hemisphere identifier set the sign of the coordinate to match that hemisphere.
hickeroar/LatLon23
LatLon23/__init__.py
LatLon.project
def project(self, projection): ''' Return coordinates transformed to a given projection Projection should be a basemap or pyproj projection object or similar ''' x, y = projection(self.lon.decimal_degree, self.lat.decimal_degree) return (x, y)
python
def project(self, projection): ''' Return coordinates transformed to a given projection Projection should be a basemap or pyproj projection object or similar ''' x, y = projection(self.lon.decimal_degree, self.lat.decimal_degree) return (x, y)
[ "def", "project", "(", "self", ",", "projection", ")", ":", "x", ",", "y", "=", "projection", "(", "self", ".", "lon", ".", "decimal_degree", ",", "self", ".", "lat", ".", "decimal_degree", ")", "return", "(", "x", ",", "y", ")" ]
Return coordinates transformed to a given projection Projection should be a basemap or pyproj projection object or similar
[ "Return", "coordinates", "transformed", "to", "a", "given", "projection", "Projection", "should", "be", "a", "basemap", "or", "pyproj", "projection", "object", "or", "similar" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L370-L376
train
Return coordinates transformed to a given projection
hickeroar/LatLon23
LatLon23/__init__.py
LatLon._pyproj_inv
def _pyproj_inv(self, other, ellipse = 'WGS84'): ''' Perform Pyproj's inv operation on two LatLon objects Returns the initial heading and reverse heading in degrees, and the distance in km. ''' lat1, lon1 = self.lat.decimal_degree, self.lon.decimal_degree lat2, lo...
python
def _pyproj_inv(self, other, ellipse = 'WGS84'): ''' Perform Pyproj's inv operation on two LatLon objects Returns the initial heading and reverse heading in degrees, and the distance in km. ''' lat1, lon1 = self.lat.decimal_degree, self.lon.decimal_degree lat2, lo...
[ "def", "_pyproj_inv", "(", "self", ",", "other", ",", "ellipse", "=", "'WGS84'", ")", ":", "lat1", ",", "lon1", "=", "self", ".", "lat", ".", "decimal_degree", ",", "self", ".", "lon", ".", "decimal_degree", "lat2", ",", "lon2", "=", "other", ".", "l...
Perform Pyproj's inv operation on two LatLon objects Returns the initial heading and reverse heading in degrees, and the distance in km.
[ "Perform", "Pyproj", "s", "inv", "operation", "on", "two", "LatLon", "objects", "Returns", "the", "initial", "heading", "and", "reverse", "heading", "in", "degrees", "and", "the", "distance", "in", "km", "." ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L384-L397
train
Perform Pyproj s inv operation on two LatLon objects returning the initial heading and reverse heading in degrees and the distance in km.
hickeroar/LatLon23
LatLon23/__init__.py
LatLon.distance_sphere
def distance_sphere(self, other, radius = 6371.0): ''' -- Deprecated in v0.70. Use distance(other, ellipse = 'sphere') instead -- Returns great circle distance between two lat/lon coordinates on a sphere using the Haversine formula. The default radius corresponds to the FAI sphere ...
python
def distance_sphere(self, other, radius = 6371.0): ''' -- Deprecated in v0.70. Use distance(other, ellipse = 'sphere') instead -- Returns great circle distance between two lat/lon coordinates on a sphere using the Haversine formula. The default radius corresponds to the FAI sphere ...
[ "def", "distance_sphere", "(", "self", ",", "other", ",", "radius", "=", "6371.0", ")", ":", "warnings", ".", "warn", "(", "\"Deprecated in v0.70. Use distance(other, ellipse = 'sphere') instead\"", ",", "DeprecationWarning", ")", "lat1", ",", "lon1", "=", "self", "...
-- Deprecated in v0.70. Use distance(other, ellipse = 'sphere') instead -- Returns great circle distance between two lat/lon coordinates on a sphere using the Haversine formula. The default radius corresponds to the FAI sphere with units in km.
[ "--", "Deprecated", "in", "v0", ".", "70", ".", "Use", "distance", "(", "other", "ellipse", "=", "sphere", ")", "instead", "--" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L423-L445
train
Calculates the great circle distance between two lat - lon coordinates on a sphere.
hickeroar/LatLon23
LatLon23/__init__.py
LatLon.offset
def offset(self, heading_initial, distance, ellipse = 'WGS84'): ''' Offset a LatLon object by a heading (in degrees) and distance (in km) to return a new LatLon object ''' lat1, lon1 = self.lat.decimal_degree, self.lon.decimal_degree g = pyproj.Geod(ellps = ellipse) ...
python
def offset(self, heading_initial, distance, ellipse = 'WGS84'): ''' Offset a LatLon object by a heading (in degrees) and distance (in km) to return a new LatLon object ''' lat1, lon1 = self.lat.decimal_degree, self.lon.decimal_degree g = pyproj.Geod(ellps = ellipse) ...
[ "def", "offset", "(", "self", ",", "heading_initial", ",", "distance", ",", "ellipse", "=", "'WGS84'", ")", ":", "lat1", ",", "lon1", "=", "self", ".", "lat", ".", "decimal_degree", ",", "self", ".", "lon", ".", "decimal_degree", "g", "=", "pyproj", "....
Offset a LatLon object by a heading (in degrees) and distance (in km) to return a new LatLon object
[ "Offset", "a", "LatLon", "object", "by", "a", "heading", "(", "in", "degrees", ")", "and", "distance", "(", "in", "km", ")", "to", "return", "a", "new", "LatLon", "object" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L447-L456
train
Offset a LatLon object by a heading and distance.
hickeroar/LatLon23
LatLon23/__init__.py
LatLon.to_string
def to_string(self, formatter = 'D'): ''' Return string representation of lat and lon as a 2-element tuple using the format specified by formatter ''' return (self.lat.to_string(formatter), self.lon.to_string(formatter))
python
def to_string(self, formatter = 'D'): ''' Return string representation of lat and lon as a 2-element tuple using the format specified by formatter ''' return (self.lat.to_string(formatter), self.lon.to_string(formatter))
[ "def", "to_string", "(", "self", ",", "formatter", "=", "'D'", ")", ":", "return", "(", "self", ".", "lat", ".", "to_string", "(", "formatter", ")", ",", "self", ".", "lon", ".", "to_string", "(", "formatter", ")", ")" ]
Return string representation of lat and lon as a 2-element tuple using the format specified by formatter
[ "Return", "string", "representation", "of", "lat", "and", "lon", "as", "a", "2", "-", "element", "tuple", "using", "the", "format", "specified", "by", "formatter" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L458-L463
train
Return a string representation of lat and lon as a 2 - element tuple using the format specified by formatter
hickeroar/LatLon23
LatLon23/__init__.py
LatLon._sub_latlon
def _sub_latlon(self, other): ''' Called when subtracting a LatLon object from self ''' inv = self._pyproj_inv(other) heading = inv['heading_reverse'] distance = inv['distance'] return GeoVector(initial_heading = heading, distance = distance)
python
def _sub_latlon(self, other): ''' Called when subtracting a LatLon object from self ''' inv = self._pyproj_inv(other) heading = inv['heading_reverse'] distance = inv['distance'] return GeoVector(initial_heading = heading, distance = distance)
[ "def", "_sub_latlon", "(", "self", ",", "other", ")", ":", "inv", "=", "self", ".", "_pyproj_inv", "(", "other", ")", "heading", "=", "inv", "[", "'heading_reverse'", "]", "distance", "=", "inv", "[", "'distance'", "]", "return", "GeoVector", "(", "initi...
Called when subtracting a LatLon object from self
[ "Called", "when", "subtracting", "a", "LatLon", "object", "from", "self" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L474-L481
train
Returns a GeoVector object that is the difference between self and other.
hickeroar/LatLon23
LatLon23/__init__.py
GeoVector._update
def _update(self): ''' Calculate heading and distance from dx and dy ''' try: theta_radians = math.atan(float(self.dy)/self.dx) except ZeroDivisionError: if self.dy > 0: theta_radians = 0.5*math.pi elif self.dy < 0: theta_radians = 1.5*math.pi ...
python
def _update(self): ''' Calculate heading and distance from dx and dy ''' try: theta_radians = math.atan(float(self.dy)/self.dx) except ZeroDivisionError: if self.dy > 0: theta_radians = 0.5*math.pi elif self.dy < 0: theta_radians = 1.5*math.pi ...
[ "def", "_update", "(", "self", ")", ":", "try", ":", "theta_radians", "=", "math", ".", "atan", "(", "float", "(", "self", ".", "dy", ")", "/", "self", ".", "dx", ")", "except", "ZeroDivisionError", ":", "if", "self", ".", "dy", ">", "0", ":", "t...
Calculate heading and distance from dx and dy
[ "Calculate", "heading", "and", "distance", "from", "dx", "and", "dy" ]
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L608-L621
train
Update the internal state of the object.
hickeroar/LatLon23
LatLon23/__init__.py
GeoVector.almost_equals
def almost_equals(self, other, e = 0.000001): ''' Sometimes required for comparing GeoVectors if float error has occurred. Determine if self and other (another GeoVector) are equal to within e km of each other in dx and dy. The default (e = 0.000001) will return True if self and ...
python
def almost_equals(self, other, e = 0.000001): ''' Sometimes required for comparing GeoVectors if float error has occurred. Determine if self and other (another GeoVector) are equal to within e km of each other in dx and dy. The default (e = 0.000001) will return True if self and ...
[ "def", "almost_equals", "(", "self", ",", "other", ",", "e", "=", "0.000001", ")", ":", "return", "abs", "(", "self", ".", "dx", "-", "other", ".", "dx", ")", "<", "e", "and", "abs", "(", "self", ".", "dy", "-", "other", ".", "dy", ")", "<", ...
Sometimes required for comparing GeoVectors if float error has occurred. Determine if self and other (another GeoVector) are equal to within e km of each other in dx and dy. The default (e = 0.000001) will return True if self and other are less than 1 mm apart in distance.
[ "Sometimes", "required", "for", "comparing", "GeoVectors", "if", "float", "error", "has", "occurred", ".", "Determine", "if", "self", "and", "other", "(", "another", "GeoVector", ")", "are", "equal", "to", "within", "e", "km", "of", "each", "other", "in", ...
1ff728216ae51055034f4c915fa715446b34549f
https://github.com/hickeroar/LatLon23/blob/1ff728216ae51055034f4c915fa715446b34549f/LatLon23/__init__.py#L623-L631
train
Return True if self and other are almost equal to within e km of each other in dx and dy.
exosite-labs/pyonep
pyonep/onep.py
DeferredRequests._authstr
def _authstr(self, auth): """Convert auth to str so that it can be hashed""" if type(auth) is dict: return '{' + ','.join(["{0}:{1}".format(k, auth[k]) for k in sorted(auth.keys())]) + '}' return auth
python
def _authstr(self, auth): """Convert auth to str so that it can be hashed""" if type(auth) is dict: return '{' + ','.join(["{0}:{1}".format(k, auth[k]) for k in sorted(auth.keys())]) + '}' return auth
[ "def", "_authstr", "(", "self", ",", "auth", ")", ":", "if", "type", "(", "auth", ")", "is", "dict", ":", "return", "'{'", "+", "','", ".", "join", "(", "[", "\"{0}:{1}\"", ".", "format", "(", "k", ",", "auth", "[", "k", "]", ")", "for", "k", ...
Convert auth to str so that it can be hashed
[ "Convert", "auth", "to", "str", "so", "that", "it", "can", "be", "hashed" ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L52-L56
train
Convert auth to str so that it can be hashed
exosite-labs/pyonep
pyonep/onep.py
DeferredRequests.add
def add(self, auth, method, args, notimeout=False): """Append a deferred request for a particular auth/CIK.""" authstr = self._authstr(auth) self._requests.setdefault(authstr, []).append((method, args)) self._notimeouts.setdefault(authstr, False) if notimeout: self._n...
python
def add(self, auth, method, args, notimeout=False): """Append a deferred request for a particular auth/CIK.""" authstr = self._authstr(auth) self._requests.setdefault(authstr, []).append((method, args)) self._notimeouts.setdefault(authstr, False) if notimeout: self._n...
[ "def", "add", "(", "self", ",", "auth", ",", "method", ",", "args", ",", "notimeout", "=", "False", ")", ":", "authstr", "=", "self", ".", "_authstr", "(", "auth", ")", "self", ".", "_requests", ".", "setdefault", "(", "authstr", ",", "[", "]", ")"...
Append a deferred request for a particular auth/CIK.
[ "Append", "a", "deferred", "request", "for", "a", "particular", "auth", "/", "CIK", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L58-L64
train
Append a deferred request for a particular auth / CIK.
exosite-labs/pyonep
pyonep/onep.py
DeferredRequests.has_requests
def has_requests(self, auth): """Returns True if there are any deferred requests for auth/CIK, False otherwise.""" authstr = self._authstr(auth) return (authstr in self._requests and len(self._requests[authstr]) > 0)
python
def has_requests(self, auth): """Returns True if there are any deferred requests for auth/CIK, False otherwise.""" authstr = self._authstr(auth) return (authstr in self._requests and len(self._requests[authstr]) > 0)
[ "def", "has_requests", "(", "self", ",", "auth", ")", ":", "authstr", "=", "self", ".", "_authstr", "(", "auth", ")", "return", "(", "authstr", "in", "self", ".", "_requests", "and", "len", "(", "self", ".", "_requests", "[", "authstr", "]", ")", ">"...
Returns True if there are any deferred requests for auth/CIK, False otherwise.
[ "Returns", "True", "if", "there", "are", "any", "deferred", "requests", "for", "auth", "/", "CIK", "False", "otherwise", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L69-L74
train
Returns True if there are any deferred requests for the given auth.
exosite-labs/pyonep
pyonep/onep.py
OnepV1._callJsonRPC
def _callJsonRPC(self, auth, callrequests, returnreq=False, notimeout=False): """Calls the Exosite One Platform RPC API. If returnreq is False, result is a tuple with this structure: (success (boolean), response) If returnreq is True, result is a list of tuples with ...
python
def _callJsonRPC(self, auth, callrequests, returnreq=False, notimeout=False): """Calls the Exosite One Platform RPC API. If returnreq is False, result is a tuple with this structure: (success (boolean), response) If returnreq is True, result is a list of tuples with ...
[ "def", "_callJsonRPC", "(", "self", ",", "auth", ",", "callrequests", ",", "returnreq", "=", "False", ",", "notimeout", "=", "False", ")", ":", "# get full auth (auth could be a CIK str)", "auth", "=", "self", ".", "_getAuth", "(", "auth", ")", "jsonreq", "=",...
Calls the Exosite One Platform RPC API. If returnreq is False, result is a tuple with this structure: (success (boolean), response) If returnreq is True, result is a list of tuples with this structure: (request, success, response) notimeou...
[ "Calls", "the", "Exosite", "One", "Platform", "RPC", "API", ".", "If", "returnreq", "is", "False", "result", "is", "a", "tuple", "with", "this", "structure", ":", "(", "success", "(", "boolean", ")", "response", ")" ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L130-L198
train
Calls the Exosite One Platform RPC API.
exosite-labs/pyonep
pyonep/onep.py
OnepV1._getAuth
def _getAuth(self, auth): """Create the authorization/identification portion of a request.""" if type(auth) is dict: return auth else: # auth is string if None != self._clientid: return {"cik": auth, "client_id": self._clientid} eli...
python
def _getAuth(self, auth): """Create the authorization/identification portion of a request.""" if type(auth) is dict: return auth else: # auth is string if None != self._clientid: return {"cik": auth, "client_id": self._clientid} eli...
[ "def", "_getAuth", "(", "self", ",", "auth", ")", ":", "if", "type", "(", "auth", ")", "is", "dict", ":", "return", "auth", "else", ":", "# auth is string", "if", "None", "!=", "self", ".", "_clientid", ":", "return", "{", "\"cik\"", ":", "auth", ","...
Create the authorization/identification portion of a request.
[ "Create", "the", "authorization", "/", "identification", "portion", "of", "a", "request", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L200-L210
train
Create the authorization portion of a request.
exosite-labs/pyonep
pyonep/onep.py
OnepV1._call
def _call(self, method, auth, arg, defer, notimeout=False): """Calls the Exosite One Platform RPC API. If `defer` is False, result is a tuple with this structure: (success (boolean), response) Otherwise, the result is just True. notimeout, if True, ignores th...
python
def _call(self, method, auth, arg, defer, notimeout=False): """Calls the Exosite One Platform RPC API. If `defer` is False, result is a tuple with this structure: (success (boolean), response) Otherwise, the result is just True. notimeout, if True, ignores th...
[ "def", "_call", "(", "self", ",", "method", ",", "auth", ",", "arg", ",", "defer", ",", "notimeout", "=", "False", ")", ":", "if", "defer", ":", "self", ".", "deferred", ".", "add", "(", "auth", ",", "method", ",", "arg", ",", "notimeout", "=", "...
Calls the Exosite One Platform RPC API. If `defer` is False, result is a tuple with this structure: (success (boolean), response) Otherwise, the result is just True. notimeout, if True, ignores the reuseconnection setting, creating a new connection with no...
[ "Calls", "the", "Exosite", "One", "Platform", "RPC", "API", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L221-L238
train
Calls the Exosite One Platform RPC API.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.send_deferred
def send_deferred(self, auth): """Send all deferred requests for a particular CIK/auth.""" if self.deferred.has_requests(auth): method_arg_pairs = self.deferred.get_method_args_pairs(auth) calls = self._composeCalls(method_arg_pairs) # should this call be made with no...
python
def send_deferred(self, auth): """Send all deferred requests for a particular CIK/auth.""" if self.deferred.has_requests(auth): method_arg_pairs = self.deferred.get_method_args_pairs(auth) calls = self._composeCalls(method_arg_pairs) # should this call be made with no...
[ "def", "send_deferred", "(", "self", ",", "auth", ")", ":", "if", "self", ".", "deferred", ".", "has_requests", "(", "auth", ")", ":", "method_arg_pairs", "=", "self", ".", "deferred", ".", "get_method_args_pairs", "(", "auth", ")", "calls", "=", "self", ...
Send all deferred requests for a particular CIK/auth.
[ "Send", "all", "deferred", "requests", "for", "a", "particular", "CIK", "/", "auth", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L243-L257
train
Send all deferred requests for a particular CIK / auth.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.activate
def activate(self, auth, codetype, code, defer=False): """ Given an activation code, activate an entity for the client specified in <ResourceID>. Args: auth: <cik> codetype: Type of code being activated. code: Code to activate. """ return self._call(...
python
def activate(self, auth, codetype, code, defer=False): """ Given an activation code, activate an entity for the client specified in <ResourceID>. Args: auth: <cik> codetype: Type of code being activated. code: Code to activate. """ return self._call(...
[ "def", "activate", "(", "self", ",", "auth", ",", "codetype", ",", "code", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'activate'", ",", "auth", ",", "[", "codetype", ",", "code", "]", ",", "defer", ")" ]
Given an activation code, activate an entity for the client specified in <ResourceID>. Args: auth: <cik> codetype: Type of code being activated. code: Code to activate.
[ "Given", "an", "activation", "code", "activate", "an", "entity", "for", "the", "client", "specified", "in", "<ResourceID", ">", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L268-L277
train
Activate an entity for the client specified in the resource ID.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.create
def create(self, auth, type, desc, defer=False): """ Create something in Exosite. Args: auth: <cik> type: What thing to create. desc: Information about thing. """ return self._call('create', auth, [type, desc], defer)
python
def create(self, auth, type, desc, defer=False): """ Create something in Exosite. Args: auth: <cik> type: What thing to create. desc: Information about thing. """ return self._call('create', auth, [type, desc], defer)
[ "def", "create", "(", "self", ",", "auth", ",", "type", ",", "desc", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'create'", ",", "auth", ",", "[", "type", ",", "desc", "]", ",", "defer", ")" ]
Create something in Exosite. Args: auth: <cik> type: What thing to create. desc: Information about thing.
[ "Create", "something", "in", "Exosite", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L279-L287
train
Create something in Exosite.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.createDataport
def createDataport(self, auth, desc, defer=False): """Create a dataport resource. "format" and "retention" are required { "format": "float" | "integer" | "string", "meta": string = "", "name": string = "", "preprocess": list ...
python
def createDataport(self, auth, desc, defer=False): """Create a dataport resource. "format" and "retention" are required { "format": "float" | "integer" | "string", "meta": string = "", "name": string = "", "preprocess": list ...
[ "def", "createDataport", "(", "self", ",", "auth", ",", "desc", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'create'", ",", "auth", ",", "[", "'dataport'", ",", "desc", "]", ",", "defer", ")" ]
Create a dataport resource. "format" and "retention" are required { "format": "float" | "integer" | "string", "meta": string = "", "name": string = "", "preprocess": list = [], "public": boolean = false, ...
[ "Create", "a", "dataport", "resource", ".", "format", "and", "retention", "are", "required", "{", "format", ":", "float", "|", "integer", "|", "string", "meta", ":", "string", "=", "name", ":", "string", "=", "preprocess", ":", "list", "=", "[]", "public...
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L289-L305
train
Create a dataport resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.drop
def drop(self, auth, resource, defer=False): """ Deletes the specified resource. Args: auth: <cik> resource: <ResourceID> """ return self._call('drop', auth, [resource], defer)
python
def drop(self, auth, resource, defer=False): """ Deletes the specified resource. Args: auth: <cik> resource: <ResourceID> """ return self._call('drop', auth, [resource], defer)
[ "def", "drop", "(", "self", ",", "auth", ",", "resource", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'drop'", ",", "auth", ",", "[", "resource", "]", ",", "defer", ")" ]
Deletes the specified resource. Args: auth: <cik> resource: <ResourceID>
[ "Deletes", "the", "specified", "resource", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L310-L317
train
Deletes the specified resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.flush
def flush(self, auth, resource, options=None, defer=False): """ Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits. """ args = [resource] if options is not None...
python
def flush(self, auth, resource, options=None, defer=False): """ Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits. """ args = [resource] if options is not None...
[ "def", "flush", "(", "self", ",", "auth", ",", "resource", ",", "options", "=", "None", ",", "defer", "=", "False", ")", ":", "args", "=", "[", "resource", "]", "if", "options", "is", "not", "None", ":", "args", ".", "append", "(", "options", ")", ...
Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits.
[ "Empties", "the", "specified", "resource", "of", "data", "per", "specified", "constraints", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L319-L330
train
Empties the specified resource of data per specified constraints.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.grant
def grant(self, auth, resource, permissions, ttl=None, defer=False): """ Grant resources with specific permissions and return a token. Args: auth: <cik> resource: Alias or ID of resource. permissions: permissions of resources. ttl: Time To Live. "...
python
def grant(self, auth, resource, permissions, ttl=None, defer=False): """ Grant resources with specific permissions and return a token. Args: auth: <cik> resource: Alias or ID of resource. permissions: permissions of resources. ttl: Time To Live. "...
[ "def", "grant", "(", "self", ",", "auth", ",", "resource", ",", "permissions", ",", "ttl", "=", "None", ",", "defer", "=", "False", ")", ":", "args", "=", "[", "resource", ",", "permissions", "]", "if", "ttl", "is", "not", "None", ":", "args", ".",...
Grant resources with specific permissions and return a token. Args: auth: <cik> resource: Alias or ID of resource. permissions: permissions of resources. ttl: Time To Live.
[ "Grant", "resources", "with", "specific", "permissions", "and", "return", "a", "token", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L332-L344
train
Grant resources with specific permissions and return a token.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.info
def info(self, auth, resource, options={}, defer=False): """ Request creation and usage information of specified resource according to the specified options. Args: auth: <cik> resource: Alias or ID of resource options: Options to define what info you would li...
python
def info(self, auth, resource, options={}, defer=False): """ Request creation and usage information of specified resource according to the specified options. Args: auth: <cik> resource: Alias or ID of resource options: Options to define what info you would li...
[ "def", "info", "(", "self", ",", "auth", ",", "resource", ",", "options", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'info'", ",", "auth", ",", "[", "resource", ",", "options", "]", ",", "defer", ")...
Request creation and usage information of specified resource according to the specified options. Args: auth: <cik> resource: Alias or ID of resource options: Options to define what info you would like returned.
[ "Request", "creation", "and", "usage", "information", "of", "specified", "resource", "according", "to", "the", "specified", "options", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L346-L355
train
Request creation and usage information of specified resource according to the specified options.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.listing
def listing(self, auth, types, options=None, resource=None, defer=False): """This provides backward compatibility with two previous variants of listing. To use the non-deprecated API, pass both options and resource.""" if options is None: # This variant is deprecated ...
python
def listing(self, auth, types, options=None, resource=None, defer=False): """This provides backward compatibility with two previous variants of listing. To use the non-deprecated API, pass both options and resource.""" if options is None: # This variant is deprecated ...
[ "def", "listing", "(", "self", ",", "auth", ",", "types", ",", "options", "=", "None", ",", "resource", "=", "None", ",", "defer", "=", "False", ")", ":", "if", "options", "is", "None", ":", "# This variant is deprecated", "return", "self", ".", "_call",...
This provides backward compatibility with two previous variants of listing. To use the non-deprecated API, pass both options and resource.
[ "This", "provides", "backward", "compatibility", "with", "two", "previous", "variants", "of", "listing", ".", "To", "use", "the", "non", "-", "deprecated", "API", "pass", "both", "options", "and", "resource", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L357-L376
train
This provides backward compatibility with two previous variants of listing. To use the non - deprecated API pass both options and resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.lookup
def lookup(self, auth, type, mapping, defer=False): """ Look up a Resource ID by alias, owned Resource ID, or share activation code under the client specified in <ClientID>. Args: auth: <cik> type: Type of resource to lookup (alias | owner | shared) mapping: ...
python
def lookup(self, auth, type, mapping, defer=False): """ Look up a Resource ID by alias, owned Resource ID, or share activation code under the client specified in <ClientID>. Args: auth: <cik> type: Type of resource to lookup (alias | owner | shared) mapping: ...
[ "def", "lookup", "(", "self", ",", "auth", ",", "type", ",", "mapping", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'lookup'", ",", "auth", ",", "[", "type", ",", "mapping", "]", ",", "defer", ")" ]
Look up a Resource ID by alias, owned Resource ID, or share activation code under the client specified in <ClientID>. Args: auth: <cik> type: Type of resource to lookup (alias | owner | shared) mapping: Based on resource type defined above.
[ "Look", "up", "a", "Resource", "ID", "by", "alias", "owned", "Resource", "ID", "or", "share", "activation", "code", "under", "the", "client", "specified", "in", "<ClientID", ">", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L378-L387
train
Look up a Resource ID by alias owned Resource ID or share activation code under the base resource ID.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.map
def map(self, auth, resource, alias, defer=False): """ Creates an alias for a resource. Args: auth: <cik> resource: <ResourceID> alias: alias to create (map) """ return self._call('map', auth, ['alias', resource, alias], defer)
python
def map(self, auth, resource, alias, defer=False): """ Creates an alias for a resource. Args: auth: <cik> resource: <ResourceID> alias: alias to create (map) """ return self._call('map', auth, ['alias', resource, alias], defer)
[ "def", "map", "(", "self", ",", "auth", ",", "resource", ",", "alias", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'map'", ",", "auth", ",", "[", "'alias'", ",", "resource", ",", "alias", "]", ",", "defer", ")" ]
Creates an alias for a resource. Args: auth: <cik> resource: <ResourceID> alias: alias to create (map)
[ "Creates", "an", "alias", "for", "a", "resource", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L389-L397
train
Creates an alias for a resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.move
def move(self, auth, resource, destinationresource, options={"aliases": True}, defer=False): """ Moves a resource from one parent client to another. Args: auth: <cik> resource: Identifed resource to be moved. destinationresource: resource of client resource is being ...
python
def move(self, auth, resource, destinationresource, options={"aliases": True}, defer=False): """ Moves a resource from one parent client to another. Args: auth: <cik> resource: Identifed resource to be moved. destinationresource: resource of client resource is being ...
[ "def", "move", "(", "self", ",", "auth", ",", "resource", ",", "destinationresource", ",", "options", "=", "{", "\"aliases\"", ":", "True", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'move'", ",", "auth", ",", "[...
Moves a resource from one parent client to another. Args: auth: <cik> resource: Identifed resource to be moved. destinationresource: resource of client resource is being moved to.
[ "Moves", "a", "resource", "from", "one", "parent", "client", "to", "another", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L399-L407
train
Moves a resource from one parent client to another.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.read
def read(self, auth, resource, options, defer=False): """ Read value(s) from a dataport. Calls a function that builds a request to read the dataport specified by an alias or rid and returns timeseries data as defined by the options. Args: auth: Takes the device cik ...
python
def read(self, auth, resource, options, defer=False): """ Read value(s) from a dataport. Calls a function that builds a request to read the dataport specified by an alias or rid and returns timeseries data as defined by the options. Args: auth: Takes the device cik ...
[ "def", "read", "(", "self", ",", "auth", ",", "resource", ",", "options", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'read'", ",", "auth", ",", "[", "resource", ",", "options", "]", ",", "defer", ")" ]
Read value(s) from a dataport. Calls a function that builds a request to read the dataport specified by an alias or rid and returns timeseries data as defined by the options. Args: auth: Takes the device cik resource: Takes the dataport alias or rid. options...
[ "Read", "value", "(", "s", ")", "from", "a", "dataport", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L409-L420
train
Reads the value of a dataport.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.record
def record(self, auth, resource, entries, options={}, defer=False): """ Records a list of historical entries to the resource specified. Note: This API is depricated, use recordbatch instead. Calls a function that bulids a request that writes a list of historical entries to the specifie...
python
def record(self, auth, resource, entries, options={}, defer=False): """ Records a list of historical entries to the resource specified. Note: This API is depricated, use recordbatch instead. Calls a function that bulids a request that writes a list of historical entries to the specifie...
[ "def", "record", "(", "self", ",", "auth", ",", "resource", ",", "entries", ",", "options", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'record'", ",", "auth", ",", "[", "resource", ",", "entries", ","...
Records a list of historical entries to the resource specified. Note: This API is depricated, use recordbatch instead. Calls a function that bulids a request that writes a list of historical entries to the specified resource. Args: auth: Takes the device cik re...
[ "Records", "a", "list", "of", "historical", "entries", "to", "the", "resource", "specified", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L422-L436
train
Records a list of historical entries to the specified resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.recordbatch
def recordbatch(self, auth, resource, entries, defer=False): """ Records a list of historical entries to the resource specified. Calls a function that bulids a request that writes a list of historical entries to the specified resource. Args: auth: Takes the device cik ...
python
def recordbatch(self, auth, resource, entries, defer=False): """ Records a list of historical entries to the resource specified. Calls a function that bulids a request that writes a list of historical entries to the specified resource. Args: auth: Takes the device cik ...
[ "def", "recordbatch", "(", "self", ",", "auth", ",", "resource", ",", "entries", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'recordbatch'", ",", "auth", ",", "[", "resource", ",", "entries", "]", ",", "defer", ")" ]
Records a list of historical entries to the resource specified. Calls a function that bulids a request that writes a list of historical entries to the specified resource. Args: auth: Takes the device cik resource: Takes the dataport alias or rid. entries: A ...
[ "Records", "a", "list", "of", "historical", "entries", "to", "the", "resource", "specified", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L438-L449
train
Records a list of historical entries to the resource specified.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.revoke
def revoke(self, auth, codetype, code, defer=False): """ Given an activation code, the associated entity is revoked after which the activation code can no longer be used. Args: auth: Takes the owner's cik codetype: The type of code to revoke (client | share) ...
python
def revoke(self, auth, codetype, code, defer=False): """ Given an activation code, the associated entity is revoked after which the activation code can no longer be used. Args: auth: Takes the owner's cik codetype: The type of code to revoke (client | share) ...
[ "def", "revoke", "(", "self", ",", "auth", ",", "codetype", ",", "code", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'revoke'", ",", "auth", ",", "[", "codetype", ",", "code", "]", ",", "defer", ")" ]
Given an activation code, the associated entity is revoked after which the activation code can no longer be used. Args: auth: Takes the owner's cik codetype: The type of code to revoke (client | share) code: Code specified by <codetype> (cik | share-activation-code)
[ "Given", "an", "activation", "code", "the", "associated", "entity", "is", "revoked", "after", "which", "the", "activation", "code", "can", "no", "longer", "be", "used", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L451-L460
train
Revoke an associated entity with the given activation code.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.share
def share(self, auth, resource, options={}, defer=False): """ Generates a share code for the given resource. Args: auth: <cik> resource: The identifier of the resource. options: Dictonary of options. """ return self._call('share', auth, [resource, opt...
python
def share(self, auth, resource, options={}, defer=False): """ Generates a share code for the given resource. Args: auth: <cik> resource: The identifier of the resource. options: Dictonary of options. """ return self._call('share', auth, [resource, opt...
[ "def", "share", "(", "self", ",", "auth", ",", "resource", ",", "options", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'share'", ",", "auth", ",", "[", "resource", ",", "options", "]", ",", "defer", ...
Generates a share code for the given resource. Args: auth: <cik> resource: The identifier of the resource. options: Dictonary of options.
[ "Generates", "a", "share", "code", "for", "the", "given", "resource", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L462-L470
train
Generates a share code for the given resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.update
def update(self, auth, resource, desc={}, defer=False): """ Updates the description of the resource. Args: auth: <cik> for authentication resource: Resource to be updated desc: A Dictionary containing the update for the resource. """ return self._call...
python
def update(self, auth, resource, desc={}, defer=False): """ Updates the description of the resource. Args: auth: <cik> for authentication resource: Resource to be updated desc: A Dictionary containing the update for the resource. """ return self._call...
[ "def", "update", "(", "self", ",", "auth", ",", "resource", ",", "desc", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'update'", ",", "auth", ",", "[", "resource", ",", "desc", "]", ",", "defer", ")" ...
Updates the description of the resource. Args: auth: <cik> for authentication resource: Resource to be updated desc: A Dictionary containing the update for the resource.
[ "Updates", "the", "description", "of", "the", "resource", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L478-L486
train
Updates the description of the resource.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.usage
def usage(self, auth, resource, metric, starttime, endtime, defer=False): """ Returns metric usage for client and its subhierarchy. Args: auth: <cik> for authentication resource: ResourceID metrics: Metric to measure (as string), it may be an entity or consumable. ...
python
def usage(self, auth, resource, metric, starttime, endtime, defer=False): """ Returns metric usage for client and its subhierarchy. Args: auth: <cik> for authentication resource: ResourceID metrics: Metric to measure (as string), it may be an entity or consumable. ...
[ "def", "usage", "(", "self", ",", "auth", ",", "resource", ",", "metric", ",", "starttime", ",", "endtime", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'usage'", ",", "auth", ",", "[", "resource", ",", "metric", ",", ...
Returns metric usage for client and its subhierarchy. Args: auth: <cik> for authentication resource: ResourceID metrics: Metric to measure (as string), it may be an entity or consumable. starttime: Start time of window to measure useage (format is ___). ...
[ "Returns", "metric", "usage", "for", "client", "and", "its", "subhierarchy", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L488-L499
train
Returns the usage for a specific resource and its subhierarchy.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.wait
def wait(self, auth, resource, options, defer=False): """ This is a HTTP Long Polling API which allows a user to wait on specific resources to be updated. Args: auth: <cik> for authentication resource: <ResourceID> to specify what resource to wait on. options...
python
def wait(self, auth, resource, options, defer=False): """ This is a HTTP Long Polling API which allows a user to wait on specific resources to be updated. Args: auth: <cik> for authentication resource: <ResourceID> to specify what resource to wait on. options...
[ "def", "wait", "(", "self", ",", "auth", ",", "resource", ",", "options", ",", "defer", "=", "False", ")", ":", "# let the server control the timeout", "return", "self", ".", "_call", "(", "'wait'", ",", "auth", ",", "[", "resource", ",", "options", "]", ...
This is a HTTP Long Polling API which allows a user to wait on specific resources to be updated. Args: auth: <cik> for authentication resource: <ResourceID> to specify what resource to wait on. options: Options for the wait including a timeout (in ms), (max 5min) and...
[ "This", "is", "a", "HTTP", "Long", "Polling", "API", "which", "allows", "a", "user", "to", "wait", "on", "specific", "resources", "to", "be", "updated", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L501-L512
train
This is a HTTP Long Polling API which allows a user to wait on specific resources to be updated.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.write
def write(self, auth, resource, value, options={}, defer=False): """ Writes a single value to the resource specified. Args: auth: cik for authentication. resource: resource to write to. value: value to write options: options. """ return se...
python
def write(self, auth, resource, value, options={}, defer=False): """ Writes a single value to the resource specified. Args: auth: cik for authentication. resource: resource to write to. value: value to write options: options. """ return se...
[ "def", "write", "(", "self", ",", "auth", ",", "resource", ",", "value", ",", "options", "=", "{", "}", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'write'", ",", "auth", ",", "[", "resource", ",", "value", ",", "o...
Writes a single value to the resource specified. Args: auth: cik for authentication. resource: resource to write to. value: value to write options: options.
[ "Writes", "a", "single", "value", "to", "the", "resource", "specified", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L514-L523
train
Writes a single value to the resource specified.
exosite-labs/pyonep
pyonep/onep.py
OnepV1.writegroup
def writegroup(self, auth, entries, defer=False): """ Writes the given values for the respective resources in the list, all writes have same timestamp. Args: auth: cik for authentication. entries: List of key, value lists. eg. [[key, value], [k,v],,,] """ ...
python
def writegroup(self, auth, entries, defer=False): """ Writes the given values for the respective resources in the list, all writes have same timestamp. Args: auth: cik for authentication. entries: List of key, value lists. eg. [[key, value], [k,v],,,] """ ...
[ "def", "writegroup", "(", "self", ",", "auth", ",", "entries", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'writegroup'", ",", "auth", ",", "[", "entries", "]", ",", "defer", ")" ]
Writes the given values for the respective resources in the list, all writes have same timestamp. Args: auth: cik for authentication. entries: List of key, value lists. eg. [[key, value], [k,v],,,]
[ "Writes", "the", "given", "values", "for", "the", "respective", "resources", "in", "the", "list", "all", "writes", "have", "same", "timestamp", "." ]
d27b621b00688a542e0adcc01f3e3354c05238a1
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L525-L533
train
Writes the given values for the respective resources in the list.
aiidateam/aiida-codtools
aiida_codtools/parsers/cif_split_primitive.py
CifSplitPrimitiveParser.parse_stdout
def parse_stdout(self, filelike): """Parse the content written by the script to standard out. The standard output will contain a list of relative filepaths where the generated CIF files have been written. :param filelike: filelike object of stdout :returns: an exit code in case of an e...
python
def parse_stdout(self, filelike): """Parse the content written by the script to standard out. The standard output will contain a list of relative filepaths where the generated CIF files have been written. :param filelike: filelike object of stdout :returns: an exit code in case of an e...
[ "def", "parse_stdout", "(", "self", ",", "filelike", ")", ":", "from", "aiida", ".", "orm", "import", "CifData", "content", "=", "filelike", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "not", "content", ":", "return", "self", ".", "exit_codes"...
Parse the content written by the script to standard out. The standard output will contain a list of relative filepaths where the generated CIF files have been written. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise
[ "Parse", "the", "content", "written", "by", "the", "script", "to", "standard", "out", "." ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/parsers/cif_split_primitive.py#L18-L47
train
Parse the content written by the script to standard out.
aiidateam/aiida-codtools
aiida_codtools/parsers/cif_cod_numbers.py
CifCodNumbersParser.parse_stdout
def parse_stdout(self, filelike): """Parse the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise """ from aiida.orm import Dict numbers = {} content = filelike.rea...
python
def parse_stdout(self, filelike): """Parse the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise """ from aiida.orm import Dict numbers = {} content = filelike.rea...
[ "def", "parse_stdout", "(", "self", ",", "filelike", ")", ":", "from", "aiida", ".", "orm", "import", "Dict", "numbers", "=", "{", "}", "content", "=", "filelike", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "not", "content", ":", "return", ...
Parse the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise
[ "Parse", "the", "content", "written", "by", "the", "script", "to", "standard", "out", "." ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/parsers/cif_cod_numbers.py#L18-L42
train
Parse the content written by the script to standard out.
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_p
def bm3_p(v, v0, k0, k0p, p_ref=0.0): """ calculate pressure from 3rd order Birch-Murnathan equation :param v: volume at different pressures :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different con...
python
def bm3_p(v, v0, k0, k0p, p_ref=0.0): """ calculate pressure from 3rd order Birch-Murnathan equation :param v: volume at different pressures :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different con...
[ "def", "bm3_p", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "p_ref", "=", "0.0", ")", ":", "return", "cal_p_bm3", "(", "v", ",", "[", "v0", ",", "k0", ",", "k0p", "]", ",", "p_ref", "=", "p_ref", ")" ]
calculate pressure from 3rd order Birch-Murnathan equation :param v: volume at different pressures :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions :param p_ref: reference pressure (defa...
[ "calculate", "pressure", "from", "3rd", "order", "Birch", "-", "Murnathan", "equation" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L12-L23
train
calculate pressure from 3rd order Birch - Murnathan equation
SHDShim/pytheos
pytheos/eqn_bm3.py
cal_p_bm3
def cal_p_bm3(v, k, p_ref=0.0): """ calculate pressure from 3rd order Birch-Murnaghan equation :param v: volume at different pressures :param k: [v0, k0, k0p] :param p_ref: reference pressure, default = 0. :return: static pressure """ vvr = v / k[0] p = (p_ref - 0.5 * (3. * k[1] - 5...
python
def cal_p_bm3(v, k, p_ref=0.0): """ calculate pressure from 3rd order Birch-Murnaghan equation :param v: volume at different pressures :param k: [v0, k0, k0p] :param p_ref: reference pressure, default = 0. :return: static pressure """ vvr = v / k[0] p = (p_ref - 0.5 * (3. * k[1] - 5...
[ "def", "cal_p_bm3", "(", "v", ",", "k", ",", "p_ref", "=", "0.0", ")", ":", "vvr", "=", "v", "/", "k", "[", "0", "]", "p", "=", "(", "p_ref", "-", "0.5", "*", "(", "3.", "*", "k", "[", "1", "]", "-", "5.", "*", "p_ref", ")", "*", "(", ...
calculate pressure from 3rd order Birch-Murnaghan equation :param v: volume at different pressures :param k: [v0, k0, k0p] :param p_ref: reference pressure, default = 0. :return: static pressure
[ "calculate", "pressure", "from", "3rd", "order", "Birch", "-", "Murnaghan", "equation" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L26-L39
train
calculate pressure from 3rd order Birch - Murnaghan equation
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_v
def bm3_v(p, v0, k0, k0p, p_ref=0.0, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different condi...
python
def bm3_v(p, v0, k0, k0p, p_ref=0.0, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different condi...
[ "def", "bm3_v", "(", "p", ",", "v0", ",", "k0", ",", "k0p", ",", "p_ref", "=", "0.0", ",", "min_strain", "=", "0.01", ")", ":", "if", "isuncertainties", "(", "[", "p", ",", "v0", ",", "k0", ",", "k0p", "]", ")", ":", "f_u", "=", "np", ".", ...
find volume at given pressure using brenth in scipy.optimize :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions :param p_ref: reference pressure (default = 0) :param...
[ "find", "volume", "at", "given", "pressure", "using", "brenth", "in", "scipy", ".", "optimize" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L65-L82
train
find volume at given pressure using brenth in scipy. optimize
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_k
def bm3_k(p, v0, k0, k0p): """ calculate bulk modulus, wrapper for cal_k_bm3 cannot handle uncertainties :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions :...
python
def bm3_k(p, v0, k0, k0p): """ calculate bulk modulus, wrapper for cal_k_bm3 cannot handle uncertainties :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions :...
[ "def", "bm3_k", "(", "p", ",", "v0", ",", "k0", ",", "k0p", ")", ":", "return", "cal_k_bm3", "(", "p", ",", "[", "v0", ",", "k0", ",", "k0p", "]", ")" ]
calculate bulk modulus, wrapper for cal_k_bm3 cannot handle uncertainties :param p: pressure :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions :return: bulk modulus at high pressure
[ "calculate", "bulk", "modulus", "wrapper", "for", "cal_k_bm3", "cannot", "handle", "uncertainties" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L96-L107
train
calculate bulk modulus at high pressure
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_dPdV
def bm3_dPdV(v, v0, k0, k0p, precision=1.e-5): """ calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: ...
python
def bm3_dPdV(v, v0, k0, k0p, precision=1.e-5): """ calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: ...
[ "def", "bm3_dPdV", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "1.e-5", ")", ":", "def", "f_scalar", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "precision", ")", ":", "return", "derivative", "(", "bm...
calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditions...
[ "calculate", "dP", "/", "dV", "for", "numerical", "calculation", "of", "bulk", "modulus", "according", "to", "test", "this", "differs", "from", "analytical", "result", "by", "1", ".", "e", "-", "5" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L110-L125
train
calculate dP / dV for bulk modulus at different conditions
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_k_num
def bm3_k_num(v, v0, k0, k0p, precision=1.e-5): """ calculate bulk modulus numerically from volume, not pressure according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k...
python
def bm3_k_num(v, v0, k0, k0p, precision=1.e-5): """ calculate bulk modulus numerically from volume, not pressure according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k...
[ "def", "bm3_k_num", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "1.e-5", ")", ":", "return", "-", "1.", "*", "v", "*", "bm3_dPdV", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "precision", ")" ]
calculate bulk modulus numerically from volume, not pressure according to test this differs from analytical result by 1.e-5 :param v: volume :param v0: volume at reference conditions :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at different conditi...
[ "calculate", "bulk", "modulus", "numerically", "from", "volume", "not", "pressure", "according", "to", "test", "this", "differs", "from", "analytical", "result", "by", "1", ".", "e", "-", "5" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L128-L140
train
calculate bulk modulus numerically from volume not pressure according to test this differs from analytical result by 1. e - 5
SHDShim/pytheos
pytheos/eqn_bm3.py
cal_k_bm3
def cal_k_bm3(p, k): """ calculate bulk modulus :param p: pressure :param k: [v0, k0, k0p] :return: bulk modulus at high pressure """ v = cal_v_bm3(p, k) return cal_k_bm3_from_v(v, k)
python
def cal_k_bm3(p, k): """ calculate bulk modulus :param p: pressure :param k: [v0, k0, k0p] :return: bulk modulus at high pressure """ v = cal_v_bm3(p, k) return cal_k_bm3_from_v(v, k)
[ "def", "cal_k_bm3", "(", "p", ",", "k", ")", ":", "v", "=", "cal_v_bm3", "(", "p", ",", "k", ")", "return", "cal_k_bm3_from_v", "(", "v", ",", "k", ")" ]
calculate bulk modulus :param p: pressure :param k: [v0, k0, k0p] :return: bulk modulus at high pressure
[ "calculate", "bulk", "modulus" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L143-L152
train
calculate bulk modulus at high pressure
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_g
def bm3_g(p, v0, g0, g0p, k0, k0p): """ calculate shear modulus at given pressure. not fully tested with mdaap. :param p: pressure :param v0: volume at reference condition :param g0: shear modulus at reference condition :param g0p: pressure derivative of shear modulus at reference condition...
python
def bm3_g(p, v0, g0, g0p, k0, k0p): """ calculate shear modulus at given pressure. not fully tested with mdaap. :param p: pressure :param v0: volume at reference condition :param g0: shear modulus at reference condition :param g0p: pressure derivative of shear modulus at reference condition...
[ "def", "bm3_g", "(", "p", ",", "v0", ",", "g0", ",", "g0p", ",", "k0", ",", "k0p", ")", ":", "return", "cal_g_bm3", "(", "p", ",", "[", "g0", ",", "g0p", "]", ",", "[", "v0", ",", "k0", ",", "k0p", "]", ")" ]
calculate shear modulus at given pressure. not fully tested with mdaap. :param p: pressure :param v0: volume at reference condition :param g0: shear modulus at reference condition :param g0p: pressure derivative of shear modulus at reference condition :param k0: bulk modulus at reference condit...
[ "calculate", "shear", "modulus", "at", "given", "pressure", ".", "not", "fully", "tested", "with", "mdaap", "." ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L168-L181
train
calculate shear modulus at given pressure
SHDShim/pytheos
pytheos/eqn_bm3.py
cal_g_bm3
def cal_g_bm3(p, g, k): """ calculate shear modulus at given pressure :param p: pressure :param g: [g0, g0p] :param k: [v0, k0, k0p] :return: shear modulus at high pressure """ v = cal_v_bm3(p, k) v0 = k[0] k0 = k[1] kp = k[2] g0 = g[0] gp = g[1] f = 0.5 * ((v / ...
python
def cal_g_bm3(p, g, k): """ calculate shear modulus at given pressure :param p: pressure :param g: [g0, g0p] :param k: [v0, k0, k0p] :return: shear modulus at high pressure """ v = cal_v_bm3(p, k) v0 = k[0] k0 = k[1] kp = k[2] g0 = g[0] gp = g[1] f = 0.5 * ((v / ...
[ "def", "cal_g_bm3", "(", "p", ",", "g", ",", "k", ")", ":", "v", "=", "cal_v_bm3", "(", "p", ",", "k", ")", "v0", "=", "k", "[", "0", "]", "k0", "=", "k", "[", "1", "]", "kp", "=", "k", "[", "2", "]", "g0", "=", "g", "[", "0", "]", ...
calculate shear modulus at given pressure :param p: pressure :param g: [g0, g0p] :param k: [v0, k0, k0p] :return: shear modulus at high pressure
[ "calculate", "shear", "modulus", "at", "given", "pressure" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L184-L202
train
calculate shear modulus at given pressure
SHDShim/pytheos
pytheos/eqn_bm3.py
bm3_big_F
def bm3_big_F(p, v, v0): """ calculate big F for linearlized form not fully tested :param p: :param f: :return: """ f = bm3_small_f(v, v0) return cal_big_F(p, f)
python
def bm3_big_F(p, v, v0): """ calculate big F for linearlized form not fully tested :param p: :param f: :return: """ f = bm3_small_f(v, v0) return cal_big_F(p, f)
[ "def", "bm3_big_F", "(", "p", ",", "v", ",", "v0", ")", ":", "f", "=", "bm3_small_f", "(", "v", ",", "v0", ")", "return", "cal_big_F", "(", "p", ",", "f", ")" ]
calculate big F for linearlized form not fully tested :param p: :param f: :return:
[ "calculate", "big", "F", "for", "linearlized", "form", "not", "fully", "tested" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_bm3.py#L217-L227
train
calculate big F for linearlized form not fully tested
dingusdk/PythonIhcSdk
ihcsdk/ihcsslconnection.py
IHCSSLConnection.soap_action
def soap_action(self, service, action, payloadbody): """Do a soap request""" payload = self.soapenvelope.format(body=payloadbody).encode('utf-8') headers = {"Host": self.url, "Content-Type": "text/xml; charset=UTF-8", "Cache-Control": "no-cache", ...
python
def soap_action(self, service, action, payloadbody): """Do a soap request""" payload = self.soapenvelope.format(body=payloadbody).encode('utf-8') headers = {"Host": self.url, "Content-Type": "text/xml; charset=UTF-8", "Cache-Control": "no-cache", ...
[ "def", "soap_action", "(", "self", ",", "service", ",", "action", ",", "payloadbody", ")", ":", "payload", "=", "self", ".", "soapenvelope", ".", "format", "(", "body", "=", "payloadbody", ")", ".", "encode", "(", "'utf-8'", ")", "headers", "=", "{", "...
Do a soap request
[ "Do", "a", "soap", "request" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcsslconnection.py#L20-L39
train
Do a soap request
dingusdk/PythonIhcSdk
ihcsdk/ihcsslconnection.py
TLSv1Adapter.init_poolmanager
def init_poolmanager(self, connections, maxsize, block=requests.adapters.DEFAULT_POOLBLOCK, **pool_kwargs): """Initialize poolmanager with cipher and Tlsv1""" context = create_urllib3_context(ciphers=self.CIPHERS, ...
python
def init_poolmanager(self, connections, maxsize, block=requests.adapters.DEFAULT_POOLBLOCK, **pool_kwargs): """Initialize poolmanager with cipher and Tlsv1""" context = create_urllib3_context(ciphers=self.CIPHERS, ...
[ "def", "init_poolmanager", "(", "self", ",", "connections", ",", "maxsize", ",", "block", "=", "requests", ".", "adapters", ".", "DEFAULT_POOLBLOCK", ",", "*", "*", "pool_kwargs", ")", ":", "context", "=", "create_urllib3_context", "(", "ciphers", "=", "self",...
Initialize poolmanager with cipher and Tlsv1
[ "Initialize", "poolmanager", "with", "cipher", "and", "Tlsv1" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcsslconnection.py#L47-L55
train
Initialize poolmanager with cipher and Tlsv1
dingusdk/PythonIhcSdk
ihcsdk/ihcsslconnection.py
TLSv1Adapter.proxy_manager_for
def proxy_manager_for(self, proxy, **proxy_kwargs): """Ensure cipher and Tlsv1""" context = create_urllib3_context(ciphers=self.CIPHERS, ssl_version=ssl.PROTOCOL_TLSv1) proxy_kwargs['ssl_context'] = context return super(TLSv1Adapter, self).proxy_m...
python
def proxy_manager_for(self, proxy, **proxy_kwargs): """Ensure cipher and Tlsv1""" context = create_urllib3_context(ciphers=self.CIPHERS, ssl_version=ssl.PROTOCOL_TLSv1) proxy_kwargs['ssl_context'] = context return super(TLSv1Adapter, self).proxy_m...
[ "def", "proxy_manager_for", "(", "self", ",", "proxy", ",", "*", "*", "proxy_kwargs", ")", ":", "context", "=", "create_urllib3_context", "(", "ciphers", "=", "self", ".", "CIPHERS", ",", "ssl_version", "=", "ssl", ".", "PROTOCOL_TLSv1", ")", "proxy_kwargs", ...
Ensure cipher and Tlsv1
[ "Ensure", "cipher", "and", "Tlsv1" ]
7e2067e009fe7600b49f30bff1cf91dc72fc891e
https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihcsslconnection.py#L57-L63
train
Ensure cipher and Tlsv1
aiidateam/aiida-codtools
aiida_codtools/parsers/cif_cell_contents.py
CifCellContentsParser.parse_stdout
def parse_stdout(self, filelike): """Parse the formulae from the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise """ from aiida.orm import Dict formulae = {} con...
python
def parse_stdout(self, filelike): """Parse the formulae from the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise """ from aiida.orm import Dict formulae = {} con...
[ "def", "parse_stdout", "(", "self", ",", "filelike", ")", ":", "from", "aiida", ".", "orm", "import", "Dict", "formulae", "=", "{", "}", "content", "=", "filelike", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "not", "content", ":", "return",...
Parse the formulae from the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise
[ "Parse", "the", "formulae", "from", "the", "content", "written", "by", "the", "script", "to", "standard", "out", "." ]
da5e4259b7a2e86cf0cc3f997e11dd36d445fa94
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/parsers/cif_cell_contents.py#L18-L42
train
Parse the formulae from the content written by the script to standard out.
xflr6/features
features/__init__.py
make_features
def make_features(context, frmat='table', str_maximal=False): """Return a new feature system from context string in the given format. Args: context (str): Formal context table as plain-text string. frmat: Format of the context string (``'table'``, ``'cxt'``, ``'csv'``). str_maximal (boo...
python
def make_features(context, frmat='table', str_maximal=False): """Return a new feature system from context string in the given format. Args: context (str): Formal context table as plain-text string. frmat: Format of the context string (``'table'``, ``'cxt'``, ``'csv'``). str_maximal (boo...
[ "def", "make_features", "(", "context", ",", "frmat", "=", "'table'", ",", "str_maximal", "=", "False", ")", ":", "config", "=", "Config", ".", "create", "(", "context", "=", "context", ",", "format", "=", "frmat", ",", "str_maximal", "=", "str_maximal", ...
Return a new feature system from context string in the given format. Args: context (str): Formal context table as plain-text string. frmat: Format of the context string (``'table'``, ``'cxt'``, ``'csv'``). str_maximal (bool): Example: >>> make_features(''' ... |+ma...
[ "Return", "a", "new", "feature", "system", "from", "context", "string", "in", "the", "given", "format", "." ]
f985304dd642da6ecdc66d85167d00daa4efe5f4
https://github.com/xflr6/features/blob/f985304dd642da6ecdc66d85167d00daa4efe5f4/features/__init__.py#L31-L50
train
Return a new feature system from a context string in the given format.
SHDShim/pytheos
pytheos/eqn_vinet.py
vinet_p
def vinet_p(v, v0, k0, k0p): """ calculate pressure from vinet equation :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :return: pressure in ...
python
def vinet_p(v, v0, k0, k0p): """ calculate pressure from vinet equation :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :return: pressure in ...
[ "def", "vinet_p", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ")", ":", "# unumpy.exp works for both numpy and unumpy", "# so I set uncertainty default.", "# if unumpy.exp is used for lmfit, it generates an error", "return", "cal_p_vinet", "(", "v", ",", "[", "v0", ",", ...
calculate pressure from vinet equation :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :return: pressure in GPa
[ "calculate", "pressure", "from", "vinet", "equation" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_vinet.py#L13-L27
train
calculate pressure from vinet equation
SHDShim/pytheos
pytheos/eqn_vinet.py
vinet_v_single
def vinet_v_single(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: ...
python
def vinet_v_single(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: ...
[ "def", "vinet_v_single", "(", "p", ",", "v0", ",", "k0", ",", "k0p", ",", "min_strain", "=", "0.01", ")", ":", "if", "p", "<=", "1.e-5", ":", "return", "v0", "def", "f_diff", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "p", ")", ":", "re...
find volume at given pressure using brenth in scipy.optimize this is for single p value, not vectorized :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :...
[ "find", "volume", "at", "given", "pressure", "using", "brenth", "in", "scipy", ".", "optimize", "this", "is", "for", "single", "p", "value", "not", "vectorized" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_vinet.py#L53-L71
train
find volume at given pressure using brenth in scipy. optimize this is for single p value not vectorized
SHDShim/pytheos
pytheos/eqn_vinet.py
vinet_v
def vinet_v(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :param min_strain: de...
python
def vinet_v(p, v0, k0, k0p, min_strain=0.01): """ find volume at given pressure :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :param min_strain: de...
[ "def", "vinet_v", "(", "p", ",", "v0", ",", "k0", ",", "k0p", ",", "min_strain", "=", "0.01", ")", ":", "if", "isuncertainties", "(", "[", "p", ",", "v0", ",", "k0", ",", "k0p", "]", ")", ":", "f_u", "=", "np", ".", "vectorize", "(", "uct", "...
find volume at given pressure :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :param min_strain: defining minimum v/v0 value to search volume for :return...
[ "find", "volume", "at", "given", "pressure" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_vinet.py#L74-L91
train
vinet_v_single function returns the vinet volume at given pressure
SHDShim/pytheos
pytheos/eqn_vinet.py
vinet_k
def vinet_k(p, v0, k0, k0p, numerical=False): """ calculate bulk modulus, wrapper for cal_k_vinet cannot handle uncertainties :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus...
python
def vinet_k(p, v0, k0, k0p, numerical=False): """ calculate bulk modulus, wrapper for cal_k_vinet cannot handle uncertainties :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus...
[ "def", "vinet_k", "(", "p", ",", "v0", ",", "k0", ",", "k0p", ",", "numerical", "=", "False", ")", ":", "f_u", "=", "uct", ".", "wrap", "(", "cal_k_vinet", ")", "return", "f_u", "(", "p", ",", "[", "v0", ",", "k0", ",", "k0p", "]", ")" ]
calculate bulk modulus, wrapper for cal_k_vinet cannot handle uncertainties :param p: pressure in GPa :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at reference conditions :return: bulk modulus at high...
[ "calculate", "bulk", "modulus", "wrapper", "for", "cal_k_vinet", "cannot", "handle", "uncertainties" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_vinet.py#L106-L118
train
calculate bulk modulus at high pressure in a uncertainties
SHDShim/pytheos
pytheos/eqn_vinet.py
vinet_dPdV
def vinet_dPdV(v, v0, k0, k0p, precision=1.e-5): """ calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference condit...
python
def vinet_dPdV(v, v0, k0, k0p, precision=1.e-5): """ calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference condit...
[ "def", "vinet_dPdV", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "1.e-5", ")", ":", "def", "f_scalar", "(", "v", ",", "v0", ",", "k0", ",", "k0p", ",", "precision", "=", "1.e-5", ")", ":", "return", "derivative", "(", "vine...
calculate dP/dV for numerical calculation of bulk modulus according to test this differs from analytical result by 1.e-5 :param v: unit-cell volume in A^3 :param v0: unit-cell volume in A^3 at 1 bar :param k0: bulk modulus at reference conditions :param k0p: pressure derivative of bulk modulus at r...
[ "calculate", "dP", "/", "dV", "for", "numerical", "calculation", "of", "bulk", "modulus", "according", "to", "test", "this", "differs", "from", "analytical", "result", "by", "1", ".", "e", "-", "5" ]
be079624405e92fbec60c5ead253eb5917e55237
https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_vinet.py#L121-L136
train
calculate dP / dV for bulk modulus at reference conditions