forked from wgj/pyTSLPy
Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
92df174c95 | |
|
|
560885b44d | |
|
|
4bb11a026e | |
|
|
91f490ff45 |
|
|
@ -19,9 +19,9 @@ def connectOptions(alias):
|
||||||
f = connectConfigFile
|
f = connectConfigFile
|
||||||
else:
|
else:
|
||||||
f = 'tslclient.ini'
|
f = 'tslclient.ini'
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser(delimiters=('=',))
|
||||||
config.read(f)
|
config.read(f)
|
||||||
if alias in config:
|
if alias in config.sections():
|
||||||
return config[alias]
|
return config[alias]
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ def GetComputeBitsOption():
|
||||||
def GetService():
|
def GetService():
|
||||||
global defaultConnection
|
global defaultConnection
|
||||||
if defaultConnection:
|
if defaultConnection:
|
||||||
defaultConnection.default_service()
|
return defaultConnection.default_service()
|
||||||
|
|
||||||
|
|
||||||
def parse_params(params):
|
def parse_params(params):
|
||||||
|
|
@ -100,7 +100,7 @@ def parse_params(params):
|
||||||
if 'Cycle' in params:
|
if 'Cycle' in params:
|
||||||
pp['cycle'] = params['Cycle']
|
pp['cycle'] = params['Cycle']
|
||||||
if 'CurrentDate' in params:
|
if 'CurrentDate' in params:
|
||||||
pp['time'] = params['CurrentDate']
|
pp['time'] = pyTSL.DoubleToDatetime(params['CurrentDate'])
|
||||||
if 'bRate' in params:
|
if 'bRate' in params:
|
||||||
pp['rate'] = params['bRate']
|
pp['rate'] = params['bRate']
|
||||||
if 'RateDay' in params:
|
if 'RateDay' in params:
|
||||||
|
|
@ -123,7 +123,7 @@ def RemoteExecute(script, params):
|
||||||
if defaultConnection:
|
if defaultConnection:
|
||||||
pp = parse_params(params)
|
pp = parse_params(params)
|
||||||
r = defaultConnection.exec(script, **pp)
|
r = defaultConnection.exec(script, **pp)
|
||||||
return r.error(), r.value()
|
return r.error(), r.value(), r.message()
|
||||||
return -1, '连接错误'
|
return -1, '连接错误'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -131,19 +131,11 @@ def RemoteCallFunc(func, args, params):
|
||||||
global defaultConnection
|
global defaultConnection
|
||||||
if defaultConnection:
|
if defaultConnection:
|
||||||
pp = parse_params(params)
|
pp = parse_params(params)
|
||||||
r = defaultConnection.clas(func, *args, **pp)
|
r = defaultConnection.call(func, *args, **pp)
|
||||||
return r.error(), r.value()
|
return r.error(), r.value(), r.message()
|
||||||
return -1, '连接错误'
|
return -1, '连接错误'
|
||||||
|
|
||||||
|
|
||||||
def SetSysParam():
|
|
||||||
assert 0
|
|
||||||
|
|
||||||
|
|
||||||
def GetSysParam():
|
|
||||||
assert 0
|
|
||||||
|
|
||||||
|
|
||||||
def EncodeDate(y, m, d):
|
def EncodeDate(y, m, d):
|
||||||
return pyTSL.DatetimeToDouble(datetime.datetime(y, m, d))
|
return pyTSL.DatetimeToDouble(datetime.datetime(y, m, d))
|
||||||
|
|
||||||
|
|
@ -163,12 +155,12 @@ def DecodeDate(dt):
|
||||||
|
|
||||||
def DecodeTime(dt):
|
def DecodeTime(dt):
|
||||||
d = pyTSL.DoubleToDatetime(dt)
|
d = pyTSL.DoubleToDatetime(dt)
|
||||||
return d.hour, d.minute, d.second, d.microsecond * 1000
|
return d.hour, d.minute, d.second, d.microsecond / 1000
|
||||||
|
|
||||||
|
|
||||||
def DecodeDateTime(dt):
|
def DecodeDateTime(dt):
|
||||||
d = pyTSL.DoubleToDatetime(dt)
|
d = pyTSL.DoubleToDatetime(dt)
|
||||||
return d.year, d.month, d.day, d.hour, d.minute, d.second, d.microsecond * 1000
|
return d.year, d.month, d.day, d.hour, d.minute, d.second, d.microsecond / 1000
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="pyTSLPy",
|
||||||
|
version="0.3",
|
||||||
|
author="Wei guangjing",
|
||||||
|
author_email="vcc@py3k.cn",
|
||||||
|
description="用pyTSL模拟TSLPy",
|
||||||
|
url="https://py3k.cn/pyTSLPy/",
|
||||||
|
packages=['pyTSLPy'],
|
||||||
|
install_requires=['tspytsl>=1.0'],
|
||||||
|
classifiers = [
|
||||||
|
'Development Status :: 5 - Production/Stable',
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'Topic :: Software Development :: Libraries',
|
||||||
|
'License :: OSI Approved :: MIT License',
|
||||||
|
'Programming Language :: Python :: 3'
|
||||||
|
]
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue