本文整理汇总了Python中utils.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
vt_mysqlbinlog = os.environ.get('VT_MYSQL_ROOT') + '/bin/vt_mysqlbinlog'
if not os.path.isfile(vt_mysqlbinlog):
sys.exit("%s is not present, please install it and then re-run the test" % vt_mysqlbinlog)
print "Note: This is a slow test, has a couple of sleeps in it to simulate proper state changes"
utils.main()
示例2: load
def load():
import base
base.main(dp)
import text_parse
text_parse.main(dp)
import utils
utils.main(dp)
import vortaro
vortaro.main(dp)
import xkcd
xkcd.main(dp)
示例3: main
def main(argv):
load_all = True
dump_all = True
curr_frame = dict(start_day=1, start_hour=0,end_day=1,end_hour=1,year = 2009, month = 7)
from config import update_time_frame
try:
opts, args = getopt.getopt(argv,"h",["sd=","sh=","ed=","eh="])
except getopt.GetoptError:
print 'driver-analysis --sd --sh --ed --eh '
sys.exit(2)
for opt, arg in opts:
if opt == 'h':
print 'driver-analysis --sd --sh --ed --eh '
sys.exit()
elif opt=="--sd":
curr_frame["start_day"] = int(arg)
elif opt=="--sh":
curr_frame["start_hour"] = int(arg)
elif opt=="--ed":
curr_frame["end_day"] = int(arg)
elif opt=="--eh":
curr_frame["end_hour"] = int(arg)
print curr_frame
# time_frame_list = [dict(start_day=1, start_hour=0,end_day=1,end_hour=1,year = 2009, month = 7),
# dict(start_day=10, start_hour=0,end_day=11,end_hour=0,year = 2012, month = 4),
# dict(start_day=11, start_hour=0,end_day=12,end_hour=0,year = 2012, month = 4),
# dict(start_day=12, start_hour=0,end_day=13,end_hour=0,year = 2012, month = 4),
# dict(start_day=13, start_hour=0,end_day=14,end_hour=0,year = 2012, month = 4),
# dict(start_day=15, start_hour=0,end_day=16,end_hour=0,year = 2012, month = 4),
# ]
update_time_frame(curr_frame)
import utils
utils.main()
import grid
grid.main(reload=load_all, dump=dump_all)
import input_data
# cProfile.run('input_data.main(reload_trip=load_all, reload_log=load_all, dump_trip=dump_all, dump_log=dump_all)')
input_data.main(reload_trip=load_all, reload_log=load_all, dump_trip=dump_all, dump_log=dump_all)
import driver_income
driver_income.main(reload=load_all, dump=dump_all)
import driver_state_stats
driver_state_stats.main(reload=load_all, dump=dump_all)
import relative_demand_grid
relative_demand_grid.main(reload=load_all, dump= dump_all, dump_csv = dump_all)
import zone_driver
zone_driver.main(reload=load_all, dump= dump_all)
print "job done!"
示例4: main
def main():
parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
parser.add_option('-e', '--environment_type', help='Environment type',
default=None)
parser.add_option('-n', '--name', help='Environment name', default=None)
parser.add_option('-p', '--environment_params',
help='Environment parameters if creating an environment '
'for the test', default=None)
parser.add_option('-t', '--test_params', help='Test parameters',
default=None)
utils.add_options(parser)
global _options
_options, _ = parser.parse_args()
del sys.argv[1:]
utils.main()
示例5: setUp
def setUp():
"""Sets up VtGate for integration tests in Java client"""
create_table = '''create table vtgate_test (
id bigint auto_increment,
name varchar(64),
age SMALLINT,
percent DECIMAL(5,2),
keyspace_id bigint(20) unsigned NOT NULL,
primary key (id)
) Engine=InnoDB'''
vtgatev2_test.create_tables.append(create_table)
utils.main(vtgatev2_test)
# this is read in Java test to set up connection params
sys.stdout.write(json.dumps({
"port": vtgatev2_test.vtgate_port,
"keyspace_name": vtgatev2_test.KEYSPACE_NAME,
"shard_kid_map": vtgatev2_test.shard_kid_map,
}))
sys.stdout.flush()
示例6: get
def get(self, anno_id):
# they can request a certain format by ending with .gobe whatever.
self.response.headers['Content-type'] = 'text/plain';
if anno_id == "":
a = Annotation.all().order("-date").get()
elif anno_id != "all":
a = Annotation.all().filter('anno_id = ', anno_id).get()
if a is None: a = Annotation()
content = a.content
if a.format and a.format != "gobe":
content = [x.strip() for x in content.split("\n")]
content = utils.main(content, a.format, force_tabs=True)
self.response.out.write(content or "")
示例7: Diagnostico
def Diagnostico():
funciones.LimpiaDirectorio(ruta)
utils.main()
ProcesosComunes()
示例8: Completo
def Completo():
funciones.LimpiaDirectorio(ruta)
speedtest.main()
utils.main()
ProcesosComunes()
示例9:
#!/usr/bin/env python
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Re-runs backup.py with use_mysqlctld=True."""
import backup
import utils
if __name__ == '__main__':
backup.use_mysqlctld = True
utils.main(backup)
示例10: remove_possession
self.game_data[item.name] = item
def remove_possession(self, name):
item = self.game_data[name]
item.count -= 1
if not item.count:
del self.game_data[name]
self.possessions.remove(item)
def make_opt_epilog(self):
return ""
def add_quiz_answer(self, q, a):
self.game_data[q] = a
self.quiz_answers.append([q, a])
def first_situation(self):
return OpeningCredits(self)
def _jump_to_situation(self):
if self.jump_to.endswith(".csv"):
self.jump_to = "MainSituation_%s" % self.jump_to.split(".csv")[0]
sit = globals()[self.jump_to](self)
utils._log("JUMPING TO SITUATION: %s (%s)" % (self.jump_to, sit.__class__.__name__))
return sit
if __name__ == "__main__":
utils.main(InTheEndGame)
示例11:
#!/usr/bin/env python
#
# Copyright 2013, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""Re-runs merge_sharding.py with a varbinary keyspace_id."""
from vtdb import keyrange_constants
import base_sharding
import merge_sharding
import utils
if __name__ == '__main__':
base_sharding.keyspace_id_type = keyrange_constants.KIT_BYTES
utils.main(merge_sharding)
示例12: add_test_options
except urllib2.HTTPError as e:
self.assertEqual(e.code, 307)
# Verify that the command logged something and its available at /status.
status = urllib2.urlopen(worker_base_url + '/status').read()
self.assertIn(
"Ping command was called with message: 'pong'", status,
'Command did not log output to /status')
# Reset the job.
urllib2.urlopen(worker_base_url + '/reset').read()
status_after_reset = urllib2.urlopen(worker_base_url + '/status').read()
self.assertIn(
'This worker is idle.', status_after_reset,
'/status does not indicate that the reset was successful')
def add_test_options(parser):
parser.add_option(
'--num_insert_rows', type='int', default=100,
help='The number of rows, per shard, that we should insert before '
'resharding for this test.')
parser.add_option(
'--num_insert_rows_before_reparent_test', type='int', default=3000,
help='The number of rows, per shard, that we should insert before '
'running TestReparentDuringWorkerCopy (supersedes --num_insert_rows in '
'that test). There must be enough rows such that SplitClone takes '
'several seconds to run while we run a planned reparent.')
if __name__ == '__main__':
utils.main(test_options=add_test_options)
示例13:
#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Re-runs vtgatev2_test.py with a l2vtgate process."""
import utils
import vtgatev2_test
# This test is just re-running an entire vtgatev2_test.py with a
# l2vtgate process in the middle.
if __name__ == '__main__':
vtgatev2_test.use_l2vtgate = True
utils.main(vtgatev2_test)
示例14: main
def main():
print "Note: This is a slow test, has a couple of sleeps in it to simulate proper state changes"
utils.main()
示例15:
#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Re-runs update_stream.py with RBR."""
import update_stream
import utils
if __name__ == '__main__':
update_stream.use_rbr = True
utils.main(update_stream)