本文整理汇总了Python中Configuration.Configuration类的典型用法代码示例。如果您正苦于以下问题:Python Configuration类的具体用法?Python Configuration怎么用?Python Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_defaults
def test_defaults(self):
"""Check that we load configuration defaults correctly"""
a_config = Configuration()
maus_config = json.loads(a_config.getConfigJSON())
## test setup
maus_root_dir = os.environ.get('MAUS_ROOT_DIR')
self.assertNotEqual(maus_root_dir, None)
config_dict = {}
default_filename = \
'%s/src/common_py/ConfigurationDefaults.py' % maus_root_dir
exec(open(default_filename,'r').read(), globals(), #pylint:disable=W0122
config_dict) #pylint:disable=W0122
# compare; note we are allowed additional entries in maus_config that
# are hard coded (e.g. version number)
exclusions = [
"maus_version", # changed at runtime, tested below
"reconstruction_geometry_filename", # changed at runtime, tested below
"os", # module needed to use environment variables
"__doc__", # docstring from ConfigurationDefaults
]
for key in config_dict.keys():
if key not in exclusions:
self.assertEqual(config_dict[key], maus_config[key])
示例2: main
def main():
configuration = Configuration();
configuration.mRobotArm.move( math.pi/3, -math.pi/5 );
# initialize the pygame module
pygame.init()
# load and set the logo
#logo = pygame.image.load("logo32x32.png")
#pygame.display.set_icon(logo)
pygame.display.set_caption("minimal program")
# create a surface on screen that has the size of 240 x 180
screen = pygame.display.set_mode((1366,768))
white = (255,255,255)
# define a variable to control the main loop
running = True
screen.fill(white)
# main loop
while running:
# event handling, gets all event from the eventqueue
for event in pygame.event.get():
# only do something if the event is of type QUIT
if event.type == pygame.QUIT:
# change the value to False, to exit the main loop
running = False
elif event.type == pygame.KEYDOWN:
pass
configuration.render( screen );
pygame.display.flip()
示例3: test_setAttr_wrongName
def test_setAttr_wrongName(self):
c = Configuration(self.stringParametersConfig())
try:
c.WrongParam1 = "ParamValue"
self.fail("Exception expected")
except AttributeError, e:
self.assertEquals("WrongParam1", e.args[0])
示例4: test_setAttr_wrongType
def test_setAttr_wrongType(self):
c = Configuration(self.stringParametersConfig())
try:
c.ConfigParam1 = 1
self.fail("Exception expected")
except TypeError, e:
self.assertEquals("str value expected, got int", e.args[0])
示例5: setUp
def setUp(self):
"""
Check for at least one active Celery worker else skip the
test.
@param self Object reference.
"""
self.__inspection = inspect()
try:
active_nodes = self.__inspection.active()
except Exception: # pylint:disable = W0703
unittest.TestCase.skipTest(self,
"Skip - RabbitMQ seems to be down")
if (active_nodes == None):
unittest.TestCase.skipTest(self,
"Skip - No active Celery workers")
# Get the current MAUS version.
configuration = Configuration()
self.config_doc = configuration.getConfigJSON()
config_dictionary = json.loads(self.config_doc)
self.__version = config_dictionary["maus_version"]
# Reset the worker. Invoke twice in case the first attempt
# fails due to mess left by previous test.
self.reset_worker()
self.reset_worker()
if maus_cpp.globals.has_instance():
maus_cpp.globals.death()
maus_cpp.globals.birth(self.config_doc)
示例6: __init__
def __init__(self,inifile,ini_section,ini_options):
self.ini_section = ini_section
self.inifile = inifile
self.ini_options = ini_options
Configuration.__init__(self,inifile)
self.validate_section(self.ini_section,self.ini_options)
self.use_gridmanager = False
self.userjob_classads_required = False
self.daemon_list = None
self.schedd_name_suffix = "jobs"
self.client_only_install = False # VOFrontend is only one which will reset
self.condor_version = None
self.condor_first_dir = None
#--- secondary schedd files --
## self.schedd_setup_file = "new_schedd_setup.sh"
## self.schedd_init_file = "init_schedd.sh"
## self.schedd_startup_file = "start_master_schedd.sh"
self.schedd_initd_function = "return # no secondary schedds"
#--- condor config data --
self.condor_config_data = { "00_gwms_general" : "",
"01_gwms_collectors" : "",
"02_gwms_schedds" : "",
"03_gwms_local" : "",
"11_gwms_secondary_collectors" : "",
}
#-- classes used ---
self.certs = None
self.get_certs()
示例7: __init__
def __init__(self, interface=None, channel=None, encryption=None,\
wps=False, target_bssid=None, output_file_prefix='airodump',\
ivs_only=False):
'''
Sets up airodump arguments, doesn't start process yet
'''
Configuration.initialize()
if interface == None:
interface = Configuration.interface
if interface == None:
raise Exception("Wireless interface must be defined (-i)")
self.interface = interface
self.targets = []
if channel == None:
channel = Configuration.target_channel
self.channel = channel
self.encryption = encryption
self.wps = wps
self.target_bssid = target_bssid
self.output_file_prefix = output_file_prefix
self.ivs_only = ivs_only
示例8: test
def test() :
cl = CommandLine(['poide','KUUU','-fhw','88888','45','1','7'])
cl.parse()
print cl.get_usage()
configuration = Configuration()
configuration.show()
示例9: __init__
def __init__(self, interface=None, channel=None, encryption=None,\
wps=False, target_bssid=None, output_file_prefix='airodump',\
ivs_only=False, skip_wash=False):
'''
Sets up airodump arguments, doesn't start process yet
'''
Configuration.initialize()
if interface == None:
interface = Configuration.interface
if interface == None:
raise Exception("Wireless interface must be defined (-i)")
self.interface = interface
self.targets = []
if channel == None:
channel = Configuration.target_channel
self.channel = channel
self.five_ghz = Configuration.five_ghz
self.encryption = encryption
self.wps = wps
self.target_bssid = target_bssid
self.output_file_prefix = output_file_prefix
self.ivs_only = ivs_only
self.skip_wash = skip_wash
# For tracking decloaked APs (previously were hidden)
self.decloaking = False
self.decloaked_targets = []
self.decloaked_times = {} # Map of BSSID(str) -> epoch(int) of last deauth
示例10: test_new_value
def test_new_value(self):
"""Test that we can create a configuration value from an input file"""
string_file = io.StringIO(u"test = 4")
config = Configuration()
value = config.getConfigJSON(string_file)
json_value = json.loads(value)
self.assertEqual(json_value["test"], 4)
示例11: test_code_full
def test_code_full(self):
c = Configuration(self.stringParametersConfig())
c['ConfigParam1'] = 'newvalue'
self.assertEquals(
"network.Processing1['ConfigParam3'] = 'Param3'\n"
"network.Processing1['ConfigParam2'] = 'Param2'\n"
"network.Processing1['ConfigParam1'] = 'newvalue'\n"
, c.code("Processing1", fullConfig = True))
示例12: uiconf
def uiconf(key):
conf = confs.get(key, None)
if conf is None:
from Configuration import Configuration
conf = Configuration()
conf.CONF_FILE = __default_ui_config__
confs[key] = conf
return conf
示例13: find_files
def find_files(self, endswith=None):
''' Finds all files in the temp directory that start with the output_file_prefix '''
result = []
for fil in os.listdir(Configuration.temp()):
if fil.startswith(self.output_file_prefix):
if not endswith or fil.endswith(endswith):
result.append(Configuration.temp() + fil)
return result
示例14: __init__
def __init__(self):
try:
configuration = Configuration()
self.session = configuration.getConfig()
print 'hello'
maxHotelId = self.session.query(func.max(TaHotelReview1.id)).first()
print maxHotelId
except Exception as ex:
print ex
示例15: edit_racestart
def edit_racestart(cls, previous_file):
"""
Updates the race start parameters in the configuration
file and builds a test video.
"""
try:
print(
"Editing configuration file {}".format(
previous_file))
config = Configuration(previous_file)
config.modify_racestart()
print(
"Creating low-quality video as {}".format(
config.output_video))
print(
"If video trimming needs to be adjusted, run the ",
"Project CARS Replay Enhancer with the `-t` option.")
print("\n")
print(
"To synchronize telemetry with video, run the ",
"Project CARS Replay Enhancer with the `-r` option.")
print(
"Set the synchronization offset to the value shown ",
"on the Timer when the viewed car crosses the start ",
"finish line to begin lap 2.")
try:
replay = cls(config.config_file)
except ValueError as error:
print("Invalid JSON in configuration file: {}".format(
error))
else:
start_video = replay.build_default_video(False)
end_video = replay.build_default_video(False)
start_video = start_video.set_duration(
start_video.duration).subclip(0, 185)
if replay.show_champion:
end_video = end_video.set_duration(
end_video.duration).subclip(
end_video.duration-120)
else:
end_video = end_video.set_duration(
end_video.duration).subclip(
end_video.duration-100)
output = mpy.concatenate_videoclips(
[start_video, end_video])
output.write_videofile(
replay.output_video,
fps=10,
preset='superfast')
except KeyboardInterrupt:
raise