コード例 #1
0
        """
        Extract the data from the relevant regex groups and assign to elements
        of the data dictionary.
        """
        # Use the date_time_string to calculate an epoch timestamp (seconds since
        # 1970-01-01)
        epts = dcl_to_epoch(match.group(1))
        self.data.time.append(epts)
        self.data.dcl_date_time_string.append(str(match.group(1)))

        # Assign the remaining MET data to the named parameters
        self.data.hydrogen_concentration.append(float(match.group(2)))


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for hydrogen
    hydrogen = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    hydrogen.load_ascii()
    hydrogen.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, hydrogen.data.toDict())
コード例 #2
0
ファイル: parse_pwrsys.py プロジェクト: emiliom/cgsn-parsers
        self.data.internal_current.append(float(match.group(47)))
        self.data.internal_temperature.append(float(match.group(48)))
        self.data.fuel_cell_volume.append(float(match.group(49)))
        self.data.seawater_ground_state.append(int(match.group(50)))
        self.data.seawater_ground_positve.append(float(match.group(51)))
        self.data.seawater_ground_negative.append(float(match.group(52)))
        self.data.cvt_state.append(int(match.group(53)))
        self.data.cvt_voltage.append(float(match.group(54)))
        self.data.cvt_current.append(float(match.group(55)))
        self.data.cvt_interlock.append(int(match.group(56)))
        self.data.cvt_temperature.append(float(match.group(57)))
        self.data.error_flag3.append(str(match.group(58)))


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for PWRSYS
    pwrsys = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    pwrsys.load_ascii()
    pwrsys.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, pwrsys.data.toDict())
コード例 #3
0
__version__ = '1.2.1'

import argparse
import io
import os
import sys

from quake import bsp, wad
from common import Parser, ResolvePathAction, read_from_stdin

if __name__ == '__main__':
    parser = Parser(
        prog='bsp2wad',
        description='Default action is to create a wad archive from '
        'miptextures extracted from the given bsp file.'
        '\nIf list is omitted, pak will use stdin.',
        epilog='example: bsp2wad {0} => creates the wad file {1}'.format(
            'e1m1.bsp', 'e1m1.wad'))

    parser.add_argument('list',
                        nargs='*',
                        action=ResolvePathAction,
                        default=read_from_stdin())

    parser.add_argument('-d',
                        metavar='file.wad',
                        dest='dest',
                        default=os.getcwd(),
                        action=ResolvePathAction,
                        help='wad file to create')
コード例 #4
0
"""

__version__ = '1.0.1'

import argparse
import os
import sys
from tabulate import tabulate

from quake import pak
from common import Parser, ResolvePathAction

if __name__ == '__main__':
    parser = Parser(
        prog='unpak',
        description='Default action is to extract files to xdir.',
        epilog='example: unpak PAK0.PAK -d {0} => extract all files to {0}'.
        format(os.path.expanduser('./extracted')))

    parser.add_argument('file', metavar='file.pak', action=ResolvePathAction)

    parser.add_argument('-l', '--list', action='store_true', help='list files')

    parser.add_argument('-d',
                        metavar='xdir',
                        dest='dest',
                        default=os.getcwd(),
                        action=ResolvePathAction,
                        help='extract files into xdir')

    parser.add_argument('-q',
コード例 #5
0
import array
import argparse
import os
import struct
import sys

from PIL import Image

from quake import lmp
from common import Parser, ResolvePathAction

if __name__ == '__main__':
    parser = Parser(
        prog='lumpr',
        description=
        'Default action is to convert a lmp file to an image and vice versa.',
        epilog='examples: lumpr lump.lmp  => convert lump.lmp to lump.png')

    parser.add_argument('file', action=ResolvePathAction)

    parser.add_argument('-v',
                        '--version',
                        dest='version',
                        action='version',
                        help=argparse.SUPPRESS,
                        version='{} version {}'.format(parser.prog,
                                                       __version__))

    args = parser.parse_args()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'


import sys
sys.path.append('..')

from common import Parser, find_bosses_of_location_ds2


p = Parser.DS2(log=False).parse()

for location in p.get_locations():
    print(f'{location} -> {p.get_location_by_url(location)}')

    for boss, url in p.get_location_by_bosses(location):
        print(f'   {boss} -> {url}')

    print()

print()

bosses_of_location = find_bosses_of_location_ds2()
print(len(bosses_of_location), bosses_of_location)
コード例 #7
0
ファイル: unwad.py プロジェクト: dommul/game-tools
import array
import argparse
import os
import sys
from tabulate import tabulate

from PIL import Image

from quake import lmp, wad
from common import Parser, ResolvePathAction

if __name__ == '__main__':
    parser = Parser(
        prog='unwad',
        description=
        'Default action is to convert files to png format and extract to xdir.',
        epilog='example: unwad gfx.wad -d {0} => extract all files to {0}'.
        format(os.path.expanduser('./extracted')))

    parser.add_argument('file', metavar='file.wad', action=ResolvePathAction)

    parser.add_argument('-l', '--list', action='store_true', help='list files')

    parser.add_argument('-d',
                        metavar='xdir',
                        default=os.getcwd(),
                        dest='dest',
                        action=ResolvePathAction,
                        help='extract files into xdir')

    parser.add_argument('-q',
コード例 #8
0
ファイル: parse_adcp.py プロジェクト: emiliom/cgsn-parsers
        for row in range(1, N):
            (a, b, c, d) = unpack('<4B', chunk[offset + 2: offset + 6])
            percent1.append(a)
            percent2.append(b)
            percent3.append(c)
            percent4.append(d)
            offset += 4

        self.data.percent.good_3beam.append(percent1)
        self.data.percent.transforms_reject.append(percent2)
        self.data.percent.bad_beams.append(percent3)
        self.data.percent.good_4beam.append(percent4)


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for PWRSYS
    adcp = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    adcp.load_ascii()
    adcp.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, adcp.data.toDict())
コード例 #9
0
import argparse
import os
import struct
import sys

from PIL import Image

from quake import spr
from common import Parser, ResolvePathAction, read_from_stdin

if __name__ == '__main__':
    parser = Parser(
        prog='image2spr',
        description='Default action is to convert an image file(s)'
        ' to an spr.\nIf image file is omitted, '
        'image2spr will use stdin.',
        epilog='example: image2spr {1} {0} => converts {0} to {1}'.format(
            'anim.gif', 'anim.spr'))

    parser.add_argument('dest_file',
                        metavar='file.spr',
                        action=ResolvePathAction,
                        help='spr file to create')

    parser.add_argument('source_files',
                        nargs='*',
                        metavar='file.gif',
                        action=ResolvePathAction,
                        default=read_from_stdin(),
                        help='image source file')
コード例 #10
0
ファイル: parse_metbk.py プロジェクト: emiliom/cgsn-parsers
        # Assign the remaining MET data to the named parameters
        self.data.barometric_pressure.append(float(match.group(2)))
        self.data.relative_humidity.append(float(match.group(3)))
        self.data.air_temperature.append(float(match.group(4)))
        self.data.longwave_irradiance.append(float(match.group(5)))
        self.data.precipitation_level.append(float(match.group(6)))
        self.data.sea_surface_temperature.append(float(match.group(7)))
        self.data.sea_surface_conductivity.append(float(match.group(8)))
        self.data.shortwave_irradiance.append(float(match.group(9)))
        self.data.eastward_wind_velocity.append(float(match.group(10)))
        self.data.northward_wind_velocity.append(float(match.group(11)))


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for METBK
    metbk = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    metbk.load_ascii()
    metbk.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, metbk.data.toDict())
コード例 #11
0
import argparse
import io
import os
import struct
import sys

from PIL import Image

from quake import bsp, lmp, wad
from common import Parser, ResolvePathAction, read_from_stdin

if __name__ == '__main__':
    parser = Parser(prog='wad',
                    description='Default action is to add or replace wad files '
                                'entries from list.\nIf list is omitted, wad will '
                                'use stdin.',
                    epilog='example: wad {0} {1} => adds {1} to {0}'.format('tex.wad', 'image.png'))

    parser.add_argument('file',
                        metavar='file.wad',
                        action=ResolvePathAction,
                        help='wad file to ')

    parser.add_argument('list',
                        nargs='*',
                        action=ResolvePathAction,
                        default=read_from_stdin())

    parser.add_argument('-t',
                        dest='type',
コード例 #12
0
def startServer(port=51999):
    parser = Parser.TransDataParser()
    controler = Server.ControlServer(r"D:\develop\ptpweb\db\trans.db")
    controler.setParser(parser)
    controler.start(port)
コード例 #13
0
    def click_proc(self, params=None, checkResult=None, variable=None):
        self.init()
        if not isinstance(params, dict):
            params = {}
        self.assignData(params)
        if not isinstance(checkResult, dict):
            params = {}
        self.assignData(checkResult)

        # 测试日志
        #logFile = "/Users/xiongyi/Downloads/20191204183834DeviceLog.log"
        #deviceLog = DeviceLog.DeviceLog()
        #missionMid = deviceLog.log_read(logFile, checkResult)

        # 获取cms的推荐位
        parser = Parser.Parser(self.variable)
        clickParams = parser.filter(params)

        # 目前其实还只支持点击一个,因为第一次跑完后appuim就退出了,并且测试用例的结果也只支持一次,后面会覆盖前面的结果
        # 后续改进是把每次点击都触发一个测试用例,并且单独记录结果集,并且可以自动启动appium
        navigate = Navigate.Naviage(self.variable)
        clickSuccess = []
        clickFail = []
        clickMsg = []
        for param in clickParams:
            if len(param) < 1:
                continue
            logging.info("click ad space: " + str(param))
            # 通过adb记录设备日志
            logPath = os.path.join(os.getcwd(), 'results/device_logs/')
            logFileName = time.strftime('%Y%m%d%H%M%S') + 'DeviceLog.log'
            logFile = os.path.join(logPath, logFileName)
            if not os.path.exists(logPath):
                os.makedirs(logPath)
            deviceLog = DeviceLog.DeviceLog(self.variable)
            deviceLog.connect()
            deviceLog.clear_cache()
            deviceLog.log_start(logFile)

            # 通过appium启动遍历
            if not navigate.startup():
                clickFail.append(False)
                clickMsg.append(str(param) + ",fail,device can't be connected")
                deviceLog.disconnect()
                navigate.disconnect()
                continue

            navigate.click(param)
            deviceLog.disconnect()
            navigate.disconnect()

            missionMid = deviceLog.log_read(logFile, checkResult)
            if len(missionMid) > 0:
                strSplit = ","
                clickFail.append(False)
                clickMsg.append(
                    str(param) + ",fail,mid: " + strSplit.join(missionMid) +
                    " can't be found,device log: " + logFileName)
            else:
                clickSuccess.append(True)
                clickMsg.append(
                    str(param) + ",pass,device log: " + logFileName)

        if len(clickSuccess) == 0 and len(clickFail) == 0:
            self.success = False
            self.msg = "no content to click"
        elif len(clickFail) > 0:
            self.success = False
            strSplit = "<br>"
            self.msg = strSplit.join(clickMsg)
        else:
            self.success = True
            strSplit = "<br>"
            self.msg = strSplit.join(clickMsg)
コード例 #14
0
ファイル: question3.py プロジェクト: mtswiss/UniWork
#! /usr/local/bin/python
import sys
from common import Parser
pre_parser=Parser(sys.argv[1])
if pre_parser.is_LL():
	for line in open(sys.argv[2],'rU'):
		input=line[:-1]+'$'
		print pre_parser.parsing(input)
else:
	print 'Grammar is not LL(1)!'
コード例 #15
0
ファイル: question3.py プロジェクト: mtswiss/UniWork
#! /usr/local/bin/python
import sys
from common import Parser
pre_parser = Parser(sys.argv[1])
if pre_parser.is_LL():
    for line in open(sys.argv[2], 'rU'):
        input = line[:-1] + '$'
        print pre_parser.parsing(input)
else:
    print 'Grammar is not LL(1)!'
コード例 #16
0
ファイル: bsp2svg.py プロジェクト: dommul/game-tools
import argparse
import os
import sys

import numpy as np
import svgwrite

from quake import bsp
from bsphelper import Bsp
from common import Parser, ResolvePathAction

if __name__ == '__main__':
    parser = Parser(
        prog='bsp2svg',
        description='Default action is to create an svg document '
        'from the given bsp file.',
        epilog='example: bsp2svg {0} => creates the svg file {1}'.format(
            'e1m1.bsp', 'e1m1.svg'))

    parser.add_argument('file', metavar='file.bsp', action=ResolvePathAction)

    parser.add_argument('-d',
                        metavar='file.svg',
                        dest='dest',
                        default=os.getcwd(),
                        action=ResolvePathAction,
                        help='svg file to create')

    parser.add_argument('-q',
                        dest='quiet',
                        action='store_true',
コード例 #17
0
        self.data.wake_time_count.append(float(match.group(55)))
        self.data.wake_power_count.append(int(match.group(56)))

        self.data.power_state.append(int(match.group(57)))
        self.data.power_board_mode.append(int(match.group(58)))
        self.data.power_voltage_select.append(int(match.group(59)))
        self.data.power_voltage_main.append(float(match.group(60)))
        self.data.power_current_main.append(float(match.group(61)))
        self.data.power_voltage_12.append(float(match.group(62)))
        self.data.power_current_12.append(float(match.group(63)))
        self.data.power_voltage_24.append(float(match.group(64)))
        self.data.power_current_24.append(float(match.group(65)))


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for METBK
    superv = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    superv.load_ascii()
    superv.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, superv.data.toDict())
コード例 #18
0
ファイル: parse_wavss.py プロジェクト: emiliom/cgsn-parsers
        self.data.mean_spectral_period.append(float(match.group(7)))
        self.data.maximum_wave_height.append(float(match.group(8)))
        self.data.significant_wave_height.append(float(match.group(9)))
        self.data.significant_wave_period.append(float(match.group(10)))
        self.data.average_tenth_height.append(float(match.group(11)))
        self.data.average_tenth_period.append(float(match.group(12)))
        self.data.average_wave_period.append(float(match.group(13)))
        self.data.peak_period.append(float(match.group(14)))
        self.data.peak_period_read.append(float(match.group(15)))
        self.data.spectral_wave_height.append(float(match.group(16)))
        self.data.mean_wave_direction.append(float(match.group(17)))
        self.data.mean_directional_spread.append(float(match.group(18)))


if __name__ == '__main__':
    # load the input arguments
    args = inputs()
    infile = os.path.abspath(args.infile)
    outfile = os.path.abspath(args.outfile)

    # initialize the Parser object for wavss
    wavss = Parser(infile)

    # load the data into a buffered object and parse the data into a dictionary
    wavss.load_ascii()
    wavss.parse_data()

    # write the resulting Bunch object via the toDict method to a matlab
    # formatted structured array.
    sio.savemat(outfile, wavss.data.toDict())
コード例 #19
0
ファイル: spr2image.py プロジェクト: dommul/game-tools
__version__ = '1.0.0'

import array
import argparse
import os
import sys

from PIL import Image

from quake import spr
from common import Parser, ResolvePathAction

if __name__ == '__main__':
    parser = Parser(
        prog='spr2image',
        description='Default action is to convert a spr file to a gif.',
        epilog=
        'example: spr2image bubble.spr => convert bubble.spr to bubble.gif')

    parser.add_argument('file', metavar='file.spr', action=ResolvePathAction)

    parser.add_argument('-d',
                        metavar='file.gif',
                        dest='dest',
                        default=os.getcwd(),
                        action=ResolvePathAction,
                        help='image file to create')

    parser.add_argument('-q',
                        dest='quiet',
                        action='store_true',
コード例 #20
0
'''
@author: jun
'''
from common import Master
from common import Parser
from common import Server

if __name__ == '__main__':
    master = Master.Master()
    parser = Parser.CmdParser()
    agent = Server.AgentServer()
    agent.setMaster(master)
    agent.setParser(parser)
    agent.start(51888)
    print 'exit.'