本文整理汇总了Python中Config.Config方法的典型用法代码示例。如果您正苦于以下问题:Python Config.Config方法的具体用法?Python Config.Config怎么用?Python Config.Config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.Config方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self, connect_info):
self._vmid = connect_info[0]
self._host = connect_info[1]
self._port = connect_info[2]
self._stub = None
self._channel = None
client_cert = Config().batch.client_cert
credential = grpc.ssl_channel_credentials(
root_certificates=client_cert.ca_cert,
private_key=client_cert.key,
certificate_chain=client_cert.cert
)
self._channel = grpc.secure_channel(
self._host + ":" + self._port, credential)
self._stub = agent_pb2_grpc.pcoccNodeStub(self._channel)
示例2: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self, wsdlsource, config=Config, **kw ):
reader = wstools.WSDLTools.WSDLReader()
self.wsdl = None
# From Mark Pilgrim's "Dive Into Python" toolkit.py--open anything.
if self.wsdl is None and hasattr(wsdlsource, "read"):
print 'stream:', wsdlsource
try:
self.wsdl = reader.loadFromStream(wsdlsource)
except xml.parsers.expat.ExpatError, e:
newstream = urllib.URLopener(key_file=config.SSL.key_file, cert_file=config.SSL.cert_file).open(wsdlsource)
buf = newstream.readlines()
raise Error, "Unable to parse WSDL file at %s: \n\t%s" % \
(wsdlsource, "\t".join(buf))
# NOT TESTED (as of April 17, 2003)
#if self.wsdl is None and wsdlsource == '-':
# import sys
# self.wsdl = reader.loadFromStream(sys.stdin)
# print 'stdin'
示例3: runPhase
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def runPhase(self, phase):
if phase == STEP_SCRATCH_BUILD:
return self.mc.scratchBuildBranches(self.branches)
if phase == STEP_PUSH:
return self.mc.pushBranches(self.branches)
if phase == STEP_BUILD:
return self.mc.buildBranches(self.branches)
if phase == STEP_UPDATE:
branches = Config().getUpdates()
branches = list(set(branches) & set(self.branches))
return self.mc.updateBuilds(branches, self.new)
if phase == STEP_OVERRIDE:
branches = Config().getUpdates()
branches = list(set(branches) & set(self.branches))
return self.mc.overrideBuilds(branches)
return 1
示例4: _get_endpoint
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def _get_endpoint(self, target):
self._endpoints_lock.acquire()
if not target in self._endpoints:
endp = Config().batch.read_key(
"cluster/user",
"hostagent/vms/{0}".format(target),
blocking=True)
self._endpoints[target]= endp.split(":")
self._endpoints_lock.release()
return self._endpoints[target]
示例5: _connect
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def _connect(self):
me = self._vmid
parent_id = (me + self._tree_width - 1) // self._tree_width - 1
children_ids = []
for i in range(self._tree_width):
child = me * self._tree_width + i + 1
if child < self._tree_size:
children_ids.append(child)
self._parent_id = parent_id
self._children_ids = children_ids
client_cert = Config().batch.ca_cert
credential = grpc.ssl_channel_credentials(
root_certificates=client_cert.ca_cert,
private_key=client_cert.key,
certificate_chain=client_cert.cert
)
if parent_id >= 0:
pinfo = self._get_endpoint(parent_id)
self._parent_chan = grpc.secure_channel(pinfo[1] + ":" + pinfo[2], credential)
self._parent_stub = agent_pb2_grpc.pcoccNodeStub(self._parent_chan)
for child in children_ids:
pinfo = self._get_endpoint(child)
self._children_chans[child] = grpc.secure_channel(pinfo[1] + ":" + pinfo[2], credential)
self._children_stubs[child] = agent_pb2_grpc.pcoccNodeStub(self._children_chans[child])
示例6: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self):
## set priviate values
self.config = Config(workpath)
self.pid = os.getpid()
self.pname = 'ETL.py'
## logger initial
self.loggerInit()
## lock initial
self.lockObj = Lock(
self.pname,
self.pid,
self.config.LOCK_DIR,
self.config.LOCK_FILE,
self.logger)
## debug output
self.logger.debug('ETL Initial Start')
self.logger.debug('[SYS_BUFFER_SIZE][%s]' % (self.config.SYS_BUFFER_SIZE))
self.logger.debug('[SYS_BUFFER_WAIT][%s]' % (self.config.SYS_BUFFER_WAIT))
self.logger.debug('[MQ_SERVER][%s]' % (self.config.MQ_SERVER))
self.logger.debug('[MQ_PORT][%s]' % (self.config.MQ_PORT))
self.logger.debug('[MQ_QUEUE][%s]' % (self.config.MQ_QUEUE))
self.logger.debug('[MARIADB_HOST][%s]' % (self.config.MARIADB_HOST))
self.logger.debug('[MARIADB_PORT][%s]' % (self.config.MARIADB_PORT))
self.logger.debug('[MARIADB_USER][%s]' % (self.config.MARIADB_USER))
self.logger.debug('[MARIADB_PASSWORD][%s]' % (self.config.MARIADB_PASSWORD))
self.logger.debug('[MARIADB_DATABASE][%s]' % (self.config.MARIADB_DATABASE))
self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR))
self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE))
self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR))
self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE))
self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL))
self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE))
self.logger.debug(
'[LOG_BACKUP_COUNT][%s]' %
(self.config.LOG_BACKUP_COUNT))
self.logger.debug('ETL Initial Done')
## initial logger
示例7: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self):
## set priviate values
self.config = Config(workpath)
self.pid = os.getpid()
self.pname = 'Asset.py'
## logger initial
self.loggerInit()
## lock initial
self.lockObj = Lock(
self.pname,
self.pid,
self.config.LOCK_DIR,
self.config.LOCK_FILE,
self.logger)
## debug output
self.logger.debug('Asset Initial Start')
self.logger.debug('[SYS_CIS][%s]' % (self.config.SYS_CIS))
self.logger.debug('[SYS_SAVE_CSV][%s]' % (self.config.SYS_SAVE_CSV))
self.logger.debug('[SYS_CSV_DIR][%s]' % (self.config.SYS_CSV_DIR))
self.logger.debug('[MQ_SERVERS][%s]' % (self.config.MQ_SERVERS))
self.logger.debug('[MQ_PORT][%s]' % (self.config.MQ_PORT))
self.logger.debug('[MQ_QUEUE][%s]' % (self.config.MQ_QUEUE))
self.logger.debug('[SUBPROC_SCRIPTSDIR][%s]' % (self.config.SUBPROC_SCRIPTSDIR))
self.logger.debug('[SUBPROC_TIMEOUT][%s]' % (self.config.SUBPROC_TIMEOUT))
self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR))
self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE))
self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR))
self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE))
self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL))
self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE))
self.logger.debug(
'[LOG_BACKUP_COUNT][%s]' %
(self.config.LOG_BACKUP_COUNT))
self.logger.debug('Asset Initial Done')
## initial logger
示例8: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self):
## set priviate values
self.config = Config(workpath)
self.pid = os.getpid()
self.pname = 'Scheduler.py'
## logger initial
self.loggerInit()
## lock initial
self.lockObj = Lock(
self.pname,
self.pid,
self.config.LOCK_DIR,
self.config.LOCK_FILE,
self.logger)
## debug output
self.logger.debug('Scheduler Initial Start')
self.logger.debug('[SYS_CFG_DIR][%s]' % (self.config.SYS_CFG_DIR))
self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR))
self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE))
self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR))
self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE))
self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL))
self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE))
self.logger.debug(
'[LOG_BACKUP_COUNT][%s]' %
(self.config.LOG_BACKUP_COUNT))
self.logger.debug('Scheduler Initial Done')
## initial logger
示例9: loadCommonProviderPrefixes
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def loadCommonProviderPrefixes(self):
golang_mapping_path = Config().getGolangCommonProviderPrefixes()
try:
with open(golang_mapping_path, 'r') as file:
prefixes = []
content = file.read()
for line in content.split('\n'):
if line == "" or line[0] == '#':
continue
prefixes.append( line.strip() )
return True, prefixes
except IOError, e:
self.err = "Unable to read from %s: %s" % (golang_mapping_path, e)
示例10: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self, dry=False, debug=False, new=False):
self.phase = STEP_END
self.endphase = STEP_END
self.mc = MultiCommand(dry=dry, debug=debug)
self.branches = Config().getBranches()
self.new = new
示例11: __init__
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def __init__(self):
this_file_dir = os.path.split(os.path.realpath(__file__))[0]
config_file_path = os.path.join(this_file_dir, 'config.ini')
self.config = Config.Config(config_file_path)
示例12: Start
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def Start(self):
from Tasks import TASKS
self.tasks = [task(self) for task in TASKS]
from Config import Config
self.config = Config(self, join(self.outputDir, "Build.ini"))
for task in self.tasks:
task.Setup()
(self.appVersion, self.appVersionInfo) = GetVersion(self)
if self.showGui:
import Gui
Gui.Main(self)
else:
builder.Tasks.Main(self)
示例13: records_generator
# 需要导入模块: import Config [as 别名]
# 或者: from Config import Config [as 别名]
def records_generator(height,
width,
channels,
data_path,
label_path,
name,
flip=False,
augmentation=False,
gray=False,
green=False,
binary=False):
"""
Generates tfrecords.
:param height: image height
:type heights: int
:param width: image width
:type width: int
:param channels: image channels
:type channels: int
:param data_path: path to load data np.array
:type data_path: str
:param record_path: path to load labels np.array
:type label_path: str
:param name: path to save tfrecord
:type name: str
:param flip: param to control if the data
will be flipped
:type flip: boolean
:param augmentation: param to control if the data
will augmented
:type augmentation: boolean
:param gray: param to control if the data
will be grayscale images
:type gray: boolean
:param green: param to control if the data will use only
the green channel
:type green: boolean
:param binary: param to control if the data will be binarized
:type binary: boolean
"""
config = Config(height=height,
width=width,
channels=channels)
data = DataHolder(config,
data_path=data_path,
label_path=label_path,
record_path=name,
flip=flip,
augmentation=augmentation,
gray=gray,
green=green,
binary=binary,
records=None)
data.create_records()