コード例 #1
0
 def test_ui(self):
     with mock.patch.object(sys, 'argv', ["database.py"]):
         with self.assertRaises(SystemExit):
             database.main()
     with mock.patch.object(sys, 'argv', ['database.py', 'test.db']):
         with mock.patch.object(database.Table, '__init__', side_effect=database.ErrorDatabase()):
             with self.assertRaises(SystemExit):
                 database.main()
コード例 #2
0
def main():
    tree.main()
    database.main()
    # fs.main()
    tornado.ioloop.IOLoop.instance().call_later(20, miner.main)

    server = Application()
    server.listen(tree.current_port)
    tornado.ioloop.IOLoop.instance().add_callback(tree.connect)
    tornado.ioloop.IOLoop.instance().start()
コード例 #3
0
ファイル: tests.py プロジェクト: Raumo0/ByFlyPy
 def test_ui(self):
     with mock.patch.object(sys, 'argv', ["database.py"]):
         with self.assertRaises(SystemExit):
             database.main()
     with mock.patch.object(sys, 'argv', ['database.py', 'test.db']):
         with mock.patch.object(database.Table,
                                '__init__',
                                side_effect=database.ErrorDatabase()):
             with self.assertRaises(SystemExit):
                 database.main()
コード例 #4
0
	def Check(self,MainWindow):
		while True:
			number=check_number.full_number()

			print(number)

			self.detecting_number.setText(number)
			self.picture.setPixmap(QPixmap('car.jpg'))
			who=database.main(number)
			self.disabled_or_public.setText(who)
コード例 #5
0
def main():
    global current_host
    global current_port
    global parent_host
    global parent_port
    global control_host
    global control_port
    global node_sk

    parser = argparse.ArgumentParser(description="node description")
    parser.add_argument('--host', default="127.0.0.1")
    parser.add_argument('--port')
    parser.add_argument('--parent_host', default="127.0.0.1")
    parser.add_argument('--parent_port', default=2018)
    parser.add_argument('--control_host')
    parser.add_argument('--control_port', default=8000)

    args = parser.parse_args()
    current_host = args.host
    current_port = args.port
    parent_host = args.parent_host
    parent_port = args.parent_port
    control_host = args.control_host
    control_port = args.control_port

    if setting.BOOTSTRAP_BY_PORT_NO:
        if int(current_port) > 8002:
            no = int(current_port) - 8001
            parent_port = (no >> 1) + 8001

    database.main()

    # parser.add_argument('--pirvate_key', default=)
    # pirvate_key_file = args.pirvate_key
    node_sk = SigningKey.from_pem(open('data/pk/pk'+current_port).read())
    tornado.ioloop.IOLoop.instance().call_later(int(current_port)-8000, connect)
コード例 #6
0
    datefmt='%Y-%m-%d %H:%M:%S',
    level=logging.DEBUG)

logging.warning("SERVER STARTUP")
logging.debug("The path is:" + PATH)
print("SERVER STARTUP")
logging.warning(f"The socket is starting up on port number:{_PORT_NUMBER}")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
logging.info(f"Successfully started a server:{sock}")
sock.bind(('', _PORT_NUMBER))
sock.listen(_MAX_CONNECT)

########
# Look at presistent connections
########
process = db.main()
process.setConnection()

try:
    while True:
        logging.debug("The server is in IDLE condition")
        clientSocket, address = sock.accept()
        # print(f"{clientSocket}:{address}")
        logging.info(
            f"Got a request from {address},the clientSocket is {clientSocket}")
        data = clientSocket.recv(_BUFFER_SIZE)
        if (len(data) == _BUFFER_SIZE):
            logging.warning(
                "The data size and the buffer size is the same, data could have been lost!"
            )
            reply = {}
コード例 #7
0
 def TestWord(self, word, response):
     with patch('builtins.input', return_value=word), patch('sys.stdout', new=StringIO()) as fake_out:
         main()
         self.assertEqual(fake_out.getvalue().strip(), response)
コード例 #8
0
ファイル: main.py プロジェクト: dwbi-ticmi/test_DWH
import os

#file python
import database as dbase
import telnet_set_redis as set_data
import telnet_get_redis_to_db as get_data


### using scheduler to running set_data and get_data (pipelibn)
dbase.main()
# set_data.main()
コード例 #9
0
from serial import Serial
import random
import time
import database

port = Serial('COM3', 9600)
port.close()
port.open()

while True:
    final_string = database.main()
    port.write(str.encode(final_string))
    time.sleep(2)
コード例 #10
0
ファイル: GUI.py プロジェクト: sharukkhan080/TrafficRules
 def add(self):
     db.main(number)
     self.query()
コード例 #11
0
ファイル: main.py プロジェクト: Enether/python_wow
    main_character._equip_weapon(starter_weapon)
    print(f'Character {main_character.name} created!')

    zone_object = get_zone_object(main_character.current_zone)  # type: Zone

    alive_npcs, _ = zone_object.get_cs_npcs()
    alive_monsters, _ = zone_object.get_cs_monsters()

    print_live_npcs(zone_object, print_all=True)
    print_live_monsters(zone_object)

    # main game loop
    while True:
        route_main_commands(main_character, zone_object)


def get_zone_object(zone: str) -> Zone:
    """
    :param zone: The name of the zone
    :return: Returns a class object from the ZONES dictionary
    """
    return ZONES[zone]


def on_exit_handler(character):
    """ saves the character when the user quits the game"""
    save_character(character)

if __name__ == '__main__':
    main()
コード例 #12
0
ファイル: main.py プロジェクト: wgeyes/python_wow
    print(f'Character {main_character.name} created!')

    zone_object = get_zone_object(main_character.current_zone)  # type: Zone

    alive_npcs, _ = zone_object.get_cs_npcs()
    alive_monsters, _ = zone_object.get_cs_monsters()

    print_live_npcs(zone_object, print_all=True)
    print_live_monsters(zone_object)

    # main game loop
    while True:
        route_main_commands(main_character, zone_object)


def get_zone_object(zone: str) -> Zone:
    """
    :param zone: The name of the zone
    :return: Returns a class object from the ZONES dictionary
    """
    return ZONES[zone]


def on_exit_handler(character):
    """ saves the character when the user quits the game"""
    save_character(character)


if __name__ == '__main__':
    main()
コード例 #13
0
from PythonCrawler import Crawler, findInfo, returnInfo
from BeerClass import Beers, Websites, PubWebsite
from database import main, delete

urls = set()
drinkInfo = set()
website = Websites()

for a in website.baseURL:
    urls = Crawler(a.URL, a.newURL)
    drinkInfo = findInfo(urls, a.endOfURL, a.brewery, a.name, a.Type, a.ABV,
                         a.IBU, a.description)
    returnInfo(drinkInfo)
    print(
        "=================================================================================="
    )

delete()

for i in drinkInfo:
    main(i)
コード例 #14
0
def main(shows):
    database.main()
    for showURL in shows:
        show = getShowDetails(showURL)
        getEpisodeDetails(show)