Exemplo n.º 1
0
 def test_list(self):
     self.assertEqual(
         prose.read(((), "1", '"hi"', "x")), {
             "underlying": ({
                 'underlying': (),
                 'display': "()",
                 "scope": {}
             }, {
                 "underlying": 1,
                 "display": "1",
                 "scope": {}
             }, {
                 "underlying": "hi",
                 "display": '"hi"',
                 "scope": {}
             }, {
                 "underlying": "x",
                 "display": "x",
                 "scope": {}
             }),
             "display":
             '(() 1 "hi" x)',
             "scope": {}
         })
Exemplo n.º 2
0
 def test_int(self):
     self.assertEqual(prose.read(INT), {
         "underlying": int(INT),
         "display": INT,
         "scope": {}
     })
Exemplo n.º 3
0
#!/usr/bin/env python3

import unittest
from doctest import testmod
import __init__ as prose

INT = "1"
STR = '"hi"'
VAR = "x"
LIST = (prose.read(()), INT, STR, VAR)


class Test_entry_is_int(unittest.TestCase):
    def test_empty_list(self):
        self.assertFalse(prose.entry_is_int(()))

    def test_int(self):
        self.assertTrue(prose.entry_is_int(INT))

    def test_str(self):
        self.assertFalse(prose.entry_is_int(STR))

    def test_var(self):
        self.assertFalse(prose.entry_is_int(VAR))

    def test_list(self):
        self.assertFalse(prose.entry_is_int(LIST))


class Test_entry_is_str(unittest.TestCase):
    def test_empty_list(self):
Exemplo n.º 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["version"]

path = os.path.join(REPO, "version.txt")
if os.path.exists(path) and os.path.isfile(path):
    version = read(path)
else:
    if __name__ == "__main__":
        print("%s NOT EXISTS" % path)
    if "VERSION" in os.environ:
        version = os.environ["VERSION"]

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))
Exemplo n.º 5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["url"]


path = os.path.join(REPO, "url.txt")
if os.path.exists(path) and os.path.isfile(path):
    url = read(path)
else:
    if __name__ == "__main__":
        print("SKIP: %s NOT EXISTS" % path)

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))
Exemplo n.º 6
0
                    help="full path for python modules import path.")
parser.add_argument(
    "--list_imppath",
    type=list,
    help='list "a b c" of full path for python modules import path.')
args = parser.parse_args()

usage = 'Usage: python {} [config_file_path]'.format(__file__)

# config file
if args.config:
    configfilepath = args.config
else:
    configfilepath = os.getcwd() + '/config.toml'

# additional import path
if args.imppath:
    sys.path.append(args.imppath)

if args.list_imppath:
    for path in list_imppath:
        sys.path.append(args.imppath)
'''
if len(sys.argv) > 1:
  configfilepath = sys.argv[1]
else:
  configfilepath = os.getcwd()+'/config.toml'
'''

sensorhandler.read(configfilepath)
Exemplo n.º 7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["keywords"]

path = os.path.join(REPO, "keywords.txt")  # separated by " " space
if os.path.exists(path) and os.path.isfile(path):
    keywords = read(path)
else:
    if __name__ == "__main__":
        print("SKIP: %s NOT EXISTS" % path)

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))
Exemplo n.º 8
0
 def test_str(self):
     self.assertTrue(prose.value_is_str(prose.read(STR)))
Exemplo n.º 9
0
 def test_var(self):
     self.assertFalse(prose.value_is_str(prose.read(VAR)))
Exemplo n.º 10
0
 def test_empty_list(self):
     self.assertFalse(prose.value_is_str(prose.read(())))
Exemplo n.º 11
0
 def test_int(self):
     self.assertFalse(prose.value_is_str(prose.read(INT)))
Exemplo n.º 12
0
 def test_str(self):
     self.assertFalse(prose.value_is_int(prose.read(STR)))
Exemplo n.º 13
0
 def test_int(self):
     self.assertTrue(prose.value_is_int(prose.read(INT)))
Exemplo n.º 14
0
 def test_list(self):
     self.assertTrue(prose.value_is_list(prose.read(LIST)))
Exemplo n.º 15
0
 def test_str(self):
     self.assertEqual(prose.read(STR), {
         "underlying": eval(STR),
         "display": STR,
         "scope": {}
     })
Exemplo n.º 16
0
 def test_list(self):
     self.assertFalse(prose.value_is_str(prose.read(LIST)))
Exemplo n.º 17
0
 def test_var(self):
     self.assertEqual(prose.read(VAR), {
         "underlying": VAR,
         "display": VAR,
         "scope": {}
     })
Exemplo n.º 18
0
 def test_empty_list(self):
     self.assertEqual(prose.evaluate(prose.read(())), prose.read(()))
Exemplo n.º 19
0
 def test_empty_list(self):
     self.assertTrue(prose.value_is_list(prose.read(())))
Exemplo n.º 20
0
 def test_int(self):
     self.assertEqual(prose.evaluate(prose.read(INT)), prose.read(INT))
Exemplo n.º 21
0
# -*- coding: utf-8 -*-
# original: https://raw.githubusercontent.com/UedaTakeyuki/slider/master/mh_z19.py
#
# © Takeyuki UEDA 2015 -
import __init__ as mh_z19

value = mh_z19.read()
print (value)
Exemplo n.º 22
0
 def test_var(self):
     prose.variables[VAR] = prose.evaluate(prose.read(INT))
     self.assertEqual(prose.evaluate(prose.read(VAR)), prose.read(INT))
     del prose.variables[VAR]
Exemplo n.º 23
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["description"]

description = None
filenames = ["description", "description.txt"]
# ./description, ./description.txt
for filename in filenames:
    path = os.path.join(REPO, filename)
    if os.path.exists(path) and os.path.isfile(path):
        description = read(path)
if description is None and __name__ == "__main__":
    print("SKIP: %s NOT EXISTS" % ", ".join(filenames))
if not description and "DESCRIPTION" in os.environ:
    description = os.environ["DESCRIPTION"]

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))
Exemplo n.º 24
0
 def test_str(self):
     self.assertEqual(prose.evaluate(prose.read(STR)), prose.read(STR))
Exemplo n.º 25
0
'''

# additional import path
'''
if args.imppath:
	sys.path.append(args.imppath)
'''
if args.imppaths:
    for imppath in args.imppaths:
        sys.path.append(imppath)
'''
if len(sys.argv) > 1:
  configfilepath = sys.argv[1]
else:
  configfilepath = os.getcwd()+'/config.toml'
'''

if args.interval:
    while True:
        now = datetime.datetime.now()
        pondslider.read(args.config)
        pondslider.read2(args.sensor_handlers, args.value_handlers)
        now_after = datetime.datetime.now()
        elapsed = (now_after - now).seconds + float(
            (now_after - now).microseconds) / 1000000
        if (elapsed < args.interval * 60):
            time.sleep(args.interval * 60 - elapsed)
else:
    pondslider.read(args.config)
    pondslider.read2(args.sensor_handlers, args.value_handlers)
Exemplo n.º 26
0
 def test_empty_list(self):
     self.assertEqual(prose.read(()), {
         "underlying": (),
         "display": "()",
         "scope": {}
     })
Exemplo n.º 27
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["long_description"]

for name in ["README.rst", "README", "README.txt"]:
    fullpath = os.path.join(REPO, name)
    if not os.path.exists(fullpath):
        continue
    if not os.path.isfile(fullpath):
        continue
    long_description = read(fullpath)
    break

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))
Exemplo n.º 28
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from __init__ import REPO, read

__all__ = ["platforms"]

path = os.path.join(REPO, "platforms.txt")
if os.path.exists(path) and os.path.isfile(path):
    platforms = read(path)
else:
    if __name__ == "__main__":
        print("SKIP: %s NOT EXISTS" % path)

if __name__ == "__main__":
    for k in __all__:
        if k in globals():
            print("%s: %s" % (k, globals()[k]))