Beispiel #1
0
def main(event, context):
    # 初始化日志文件
    utils.initLog('log.txt')
    utils.clearLog()
    config = utils.readJsonFile('config.json')
    # artUrl = getArticle()
    # getSubscribeUrl(artUrl)
    getSubscribeUrl()
Beispiel #2
0
def main():
    utils.initLog('archgenxml.log')
    utils.addConsoleLogging()
    log = logging.getLogger('main')

    log.debug("Reading command line options first.")
    (settings, args) = parser.parse_args()
    try:
        model = args[0]
        log.debug("Model file is '%s'.", model)
    except:
        log.critical("Hey, we need to be passed a UML file as an argument!")
        parser.print_help()
        sys.exit(2)

    print utils.ARCHGENXML_VERSION_LINE % str(utils.version())

    # This is a little bit hacky. Probably should read optparse's doc
    # better. [Reinout]

    log.debug("Figuring out the settings we're passing to the "
              "main program...")
    keys = dir(settings)
    keys = [
        key for key in keys if not key.startswith('_')
        and not key in ['ensure_value', 'read_file', 'read_module']
    ]
    log.debug("Keys available through the option parser: %r.", keys)
    options = {}
    for key in keys:
        options[key] = getattr(settings, key)
        log.debug("Option '%s' has value '%s'.", key, options[key])

    # if outfilename is not given by the -o option try getting the second
    # regular argument
    if not options['outfilename']:
        log.debug("Outfilename not specified in the options. "
                  "Trying second loose commandline argument.")
        if len(args) > 1:
            options['outfilename'] = args[1]
        else:
            log.debug("No second argument found: keeping outfilename empty.")
            # the output dir will be named after the model

    # hook into sys.excepthook if the user requested it
    if options['pdb_on_exception']:
        sys.excepthook = info

    # start generation
    gen = ArchetypesGenerator(model, **options)
    gen.parseAndGenerate()
Beispiel #3
0
def main(argv):
	# Overhead to manage command line opts and config file
	p = getCmdLineParser()
	args = p.parse_args()
	cfg.read(args.config_file)

	logger = utils.initLog(cfg)

	log_line = {"function": "main", "event_type": "Start", "event": "Connecting to Snowflake", 
			 		"user":cfg.get('snowflake','user'),"account":cfg.get('snowflake','account'), "warehouse":cfg.get('snowflake','warehouse'),
			 		"database":cfg.get('snowflake','database'),"schema":cfg.get('snowflake','schema'), "role":cfg.get('snowflake','role')
			}
	logger.info(json.dumps(log_line))
	tick = datetime.now()
	snowflake_connection = snowflake.connector.connect(
		 user=cfg.get('snowflake','user'),
		 password=cfg.get('snowflake','password'),
		 account=cfg.get('snowflake','account'),
		 warehouse=cfg.get('snowflake','warehouse'),
		 database=cfg.get('snowflake','database'),
		 schema=cfg.get('snowflake','schema'),
		 role=cfg.get('snowflake','role')
	 )
	dur = datetime.now() - tick
	log_line = {"function": "main", "event_type": "End", "event": "Connecting to Snowflake", "duration":dur.total_seconds()}
	logger.info(json.dumps(log_line))

	station_list = stations.LoadStations(snowflake_connection, cfg, '2019-06-30')
	model.save_poisson_results(snowflake_connection, cfg, station_list, include_rebalance = False)
	snowflake_connection.close()
Beispiel #4
0
def map():
    if current_user.is_authenticated:
        log = initLog()
        log.info("用户:{0}登陆成功".format(current_user.name))
    else:
        return redirect(url_for('login'))
    lineForm = PolyLineForm()
    lineForm.name(class_='lineform')
    layerform = LayerForm()
    return render_template('map/map.html', form=lineForm, layerform=layerform)
Beispiel #5
0
import glob

# Read the configuation options from file, determine the reference file
# and list of sequence files.
options = getOptions()
reference = options['reference']
#sequences = options['sequences']
sequencePatterns = options['sequences']
sequences = []
if type(sequencePatterns) == list:
    for pattern in sequencePatterns:
        sequences.append(glob.glob(pattern))
else:
    sequences = glob.glob(sequencePatterns)
# Start the logging process.
logger = initLog(options)
# Get information about chromosomes in the reference file
chromosomes = chromInfo(reference)

# Index the reference file.
@files(reference, reference + '.bwt', logger)
def mkRefDataBase(reference, output, logger):
    runStage('mkRefDataBase', logger, options, reference, output)

# Align sequence reads to the reference genome.
@follows(mkRefDataBase)
@transform(sequences, suffix('.fastq'), '.sai', logger)
def alignSequence(sequence, output, logger):
    runStage('alignSequence', logger, options, reference, sequence, output)

input = r'(.+)_1\.sai'
		log.info('(MSG)write ClassDefinition: Ok')



if __name__ == '__main__':
 	if len(sys.argv) < 2:
 		print "USAGE: WriteWordMain.py input.xls"
 		sys.exit()

	inPath = sys.argv[0]
	CONS.setConstant(inPath)

	#CONS.LOG_FILE

	utils.initLog(CONS.LOG_FILE)
	utils.addConsoleLogging()
	log = logging.getLogger('ExcelMain')

	#log.debug("argv0: ['%s'], attrs.getValue(attrName): ['%s']",attrName, attrs.getValue(attrName))
	log.debug("---input argument---")
	log.debug("sys.argv[0]: ['%s']",sys.argv[0])
	log.debug("sys.argv[1]: ['%s']",sys.argv[1])
	

	aReaderAppEnv = ReaderAppEnv.ReaderAppEnv()
	aReaderAppEnv.saveAppEnvInfo(CONS.INPUT_APP_ENV_XML)

	if aReaderAppEnv.appEnvData["isClassDefinition"]=='True':
		deliverableType = 'Class'
		aWriteWordMain = WriteWordMain()
Beispiel #7
0
def main(event, context):
    # 初始化日志文件
    utils.initLog('log.txt')
    utils.clearLog()
    savePoint('https://proxies.bihai.cf/vmess/sub?nc=CN&type=vmess,trojan',
              'vmess.txt')
Beispiel #8
0
including the actual commands which are run at each stage.
'''

from ruffus import *
import os.path
import shutil
from utils import (runStage, splitPath, getOptions, initLog, getCommand)

# Read the configuation options from file, determine the reference file
# and list of sequence files.
options = getOptions()
reference = options['reference']
sequences = options['sequences']
isPairedEnd = options['pipeline']['paired']
# Start the logging process.
logger = initLog(options)


# Index the reference file.
@files(reference, reference + '.bwt', logger)
def mkRefDataBase(reference, output, logger):
    runStage('mkRefDataBase', logger, options, reference, output)


# Index the reference file.
# XXX not sure why we need to do both mkRefDataBase and indexReference.
@follows(mkRefDataBase)
@files(reference, reference + '.fai', logger)
def indexReference(reference, output, logger):
    runStage('indexReference', logger, options, reference, output)
# -*- coding: utf-8 -*-
# start
import sys;sys.path.append("C://_projectautomation/source/common")
import logging
import utils
import xmiCommonUtil as xmiUtil
from ModelInfo import *

from WriterExcel import *
from ParseXmiMain import *

# ToDo: xmi파싱 부분을 공통화해라..
utils.initLog('ExcelMain.log')
utils.addConsoleLogging()
log = logging.getLogger('ExcelMain')

from Constants import *
CONS = Constants()

class ExcelMain:
	def writeExcelClassDefinition(self):
		aModelInfo = self.getModel()

		aWriterExcel = WriterExcel()
		aWriterExcel.writeExcelClassDefinition(aModelInfo)
		print "(MSG) Ok"
	def writeExcelClassList(self):
		aModelInfo = self.getModel()

		aWriterExcel = WriterExcel()
		aWriterExcel.writeExcelClassList(aModelInfo)
Beispiel #10
0
        self.assertEquals(result, expected)

    def testGetMethodNames(self):
        """ Find the correct two names
        """
        names = ['parserMethod', 'parserMethod2']
        self.assertEquals(self.klass.getMethodNames().sort(), names.sort())

    def testGetProtectionDeclaration(self):
        """ Find the security.declare... for a manual method
        """
        expected = "    security.declarePublic('parserMethod2')"
        self.assertEquals(self.klass.getProtectionDeclaration('parserMethod2'),
                          expected)


def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestPyModule))
    suite.addTest(unittest.makeSuite(TestPyCodeElement))
    suite.addTest(unittest.makeSuite(TestPyFunction))
    suite.addTest(unittest.makeSuite(TestPyMethod))
    suite.addTest(unittest.makeSuite(TestPyClass))
    return suite


if __name__ == '__main__':
    import utils
    utils.initLog('runalltests.log')
    unittest.main()