当前位置: 首页>>代码示例>>Python>>正文


Python Factory.Factory类代码示例

本文整理汇总了Python中Factory.Factory的典型用法代码示例。如果您正苦于以下问题:Python Factory类的具体用法?Python Factory怎么用?Python Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize

	def initialize(self, fileIn = None):
		fin = open(fileIn, 'r')
		read = [line for line in fin.read().splitlines() if len(line) > 0]
		fin.close()

		self.attributes = Factory().construct([line for line in read if len(line) > 0 and line[0] == '@'])
		self.examples 	= Factory().construct([line for line in read if len(line) > 0 and line[0] == '#'], self.attributes)
		self.name 		= read[0]
开发者ID:gabastil,项目名称:pyClassifiers,代码行数:8,代码来源:DataSet.py

示例2: load

def load(filename):
	factory = Factory()
	lines = read(filename)
	lineNumber = 0
	while lineNumber <= len(lines) - 3:
		if empty(lines[lineNumber]):
			lineNumber += 1
		else:
			factory.add_conveyor(lines[lineNumber:lineNumber+3])
			lineNumber += 3
	return factory
开发者ID:CoderNight,项目名称:tampa-coder-night-006,代码行数:11,代码来源:lasersVrobots.py

示例3: index

def index():
	'''
		Json receiving request from client has 3 key
		[component] : destination component
		[message]   : content of user speech changed to text
		[device_id] : device id of client (unique)
	'''
	factory = Factory()
	component = request.json["component"]
	device_id = request.json["device_id"]
	message   = request.json["message"]
	result = factory.getResult(component, message, device_id)
	return jsonify(result), 200
开发者ID:SinaKhorami,项目名称:IPA,代码行数:13,代码来源:Main.py

示例4: initialize

	def initialize(self, filePath):
		""" load data and initialize this class's data: (1) name, (2) attributes, (3) examples """
		fin = open(filePath, 'r')
		read = [line for line in fin.read().splitlines() if len(line) > 0]
		fin.close()

		self.name 		= read[0]
		self.attributes = Factory().build(read)
		self.examples	= Factory().build(read, self.attributes)
开发者ID:gabastil,项目名称:Python_MacBookAir_NLP_Cebuano_Scripts,代码行数:9,代码来源:DataSet.py

示例5: __init__

  def __init__(self, argv, app_name, moose_dir):
    self.factory = Factory()

    self.test_table = []
    self.num_passed = 0
    self.num_failed = 0
    self.num_skipped = 0
    self.num_pending = 0
    self.host_name = gethostname()
    self.moose_dir = os.path.abspath(moose_dir) + '/'
    self.run_tests_dir = os.path.abspath('.')
    self.code = '2d2d6769726c2d6d6f6465'
    # Assume libmesh is a peer directory to MOOSE if not defined
    if os.environ.has_key("LIBMESH_DIR"):
      self.libmesh_dir = os.environ['LIBMESH_DIR']
    else:
      self.libmesh_dir = self.moose_dir + '../libmesh/installed'
    self.file = None

    # Parse arguments
    self.parseCLArgs(argv)

    self.checks = {}
    self.checks['platform'] = getPlatforms()
    self.checks['compiler'] = getCompilers(self.libmesh_dir)
    self.checks['petsc_version'] = getPetscVersion(self.libmesh_dir)
    self.checks['mesh_mode'] = getLibMeshConfigOption(self.libmesh_dir, 'mesh_mode')
    self.checks['dtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'dtk')
    self.checks['library_mode'] = getSharedOption(self.libmesh_dir)
    self.checks['unique_ids'] = getLibMeshConfigOption(self.libmesh_dir, 'unique_ids')
    self.checks['vtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'vtk')
    self.checks['tecplot'] =  getLibMeshConfigOption(self.libmesh_dir, 'tecplot')

    # Override the MESH_MODE option if using '--parallel-mesh' option
    if self.options.parallel_mesh == True or \
          (self.options.cli_args != None and \
          self.options.cli_args.find('--parallel-mesh') != -1):

      option_set = set()
      option_set.add('ALL')
      option_set.add('PARALLEL')
      self.checks['mesh_mode'] = option_set

    method = set()
    method.add('ALL')
    method.add(self.options.method.upper())
    self.checks['method'] = method

    self.initialize(argv, app_name)
开发者ID:atomica,项目名称:moose,代码行数:49,代码来源:TestHarness.py

示例6: __init__

  def __init__(self, argv, app_name, moose_dir):
    self.factory = Factory()

    # Get dependant applications and load dynamic tester plugins
    # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
    dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
    sys.path.append(os.path.join(moose_dir, 'framework', 'scripts'))   # For find_dep_apps.py

    # Use the find_dep_apps script to get the dependant applications for an app
    import find_dep_apps
    depend_app_dirs = find_dep_apps.findDepApps(app_name)
    dirs.extend([os.path.join(my_dir, 'scripts', 'TestHarness') for my_dir in depend_app_dirs.split('\n')])

    # Finally load the plugins!
    self.factory.loadPlugins(dirs, 'testers', Tester)

    self.test_table = []
    self.num_passed = 0
    self.num_failed = 0
    self.num_skipped = 0
    self.num_pending = 0
    self.host_name = gethostname()
    self.moose_dir = moose_dir
    self.run_tests_dir = os.path.abspath('.')
    self.code = '2d2d6769726c2d6d6f6465'
    # Assume libmesh is a peer directory to MOOSE if not defined
    if os.environ.has_key("LIBMESH_DIR"):
      self.libmesh_dir = os.environ['LIBMESH_DIR']
    else:
      self.libmesh_dir = os.path.join(self.moose_dir, 'libmesh', 'installed')
    self.file = None

    # Parse arguments
    self.parseCLArgs(argv)

    self.checks = {}
    self.checks['platform'] = getPlatforms()
    self.checks['compiler'] = getCompilers(self.libmesh_dir)
    self.checks['petsc_version'] = getPetscVersion(self.libmesh_dir)
    self.checks['mesh_mode'] = getLibMeshConfigOption(self.libmesh_dir, 'mesh_mode')
    self.checks['dtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'dtk')
    self.checks['library_mode'] = getSharedOption(self.libmesh_dir)
    self.checks['unique_ids'] = getLibMeshConfigOption(self.libmesh_dir, 'unique_ids')
    self.checks['vtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'vtk')
    self.checks['tecplot'] =  getLibMeshConfigOption(self.libmesh_dir, 'tecplot')

    # Override the MESH_MODE option if using '--parallel-mesh' option
    if self.options.parallel_mesh == True or \
          (self.options.cli_args != None and \
          self.options.cli_args.find('--parallel-mesh') != -1):

      option_set = set()
      option_set.add('ALL')
      option_set.add('PARALLEL')
      self.checks['mesh_mode'] = option_set

    method = set()
    method.add('ALL')
    method.add(self.options.method.upper())
    self.checks['method'] = method

    self.initialize(argv, app_name)
开发者ID:liuwenf,项目名称:moose,代码行数:62,代码来源:TestHarness.py

示例7: buildAndRun

class TestHarness:

  @staticmethod
  def buildAndRun(argv, app_name, moose_dir):
    if '--store-timing' in argv:
      harness = TestTimer(argv, app_name, moose_dir)
    else:
      harness = TestHarness(argv, app_name, moose_dir)

    harness.findAndRunTests()

  def __init__(self, argv, app_name, moose_dir):
    self.factory = Factory()

    # Get dependant applications and load dynamic tester plugins
    # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
    dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
    sys.path.append(os.path.join(moose_dir, 'framework', 'scripts'))   # For find_dep_apps.py

    # Use the find_dep_apps script to get the dependant applications for an app
    import find_dep_apps
    depend_app_dirs = find_dep_apps.findDepApps(app_name)
    dirs.extend([os.path.join(my_dir, 'scripts', 'TestHarness') for my_dir in depend_app_dirs.split('\n')])

    # Finally load the plugins!
    self.factory.loadPlugins(dirs, 'testers', Tester)

    self.test_table = []
    self.num_passed = 0
    self.num_failed = 0
    self.num_skipped = 0
    self.num_pending = 0
    self.host_name = gethostname()
    self.moose_dir = moose_dir
    self.run_tests_dir = os.path.abspath('.')
    self.code = '2d2d6769726c2d6d6f6465'
    # Assume libmesh is a peer directory to MOOSE if not defined
    if os.environ.has_key("LIBMESH_DIR"):
      self.libmesh_dir = os.environ['LIBMESH_DIR']
    else:
      self.libmesh_dir = os.path.join(self.moose_dir, 'libmesh', 'installed')
    self.file = None

    # Parse arguments
    self.parseCLArgs(argv)

    self.checks = {}
    self.checks['platform'] = getPlatforms()
    self.checks['compiler'] = getCompilers(self.libmesh_dir)
    self.checks['petsc_version'] = getPetscVersion(self.libmesh_dir)
    self.checks['mesh_mode'] = getLibMeshConfigOption(self.libmesh_dir, 'mesh_mode')
    self.checks['dtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'dtk')
    self.checks['library_mode'] = getSharedOption(self.libmesh_dir)
    self.checks['unique_ids'] = getLibMeshConfigOption(self.libmesh_dir, 'unique_ids')
    self.checks['vtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'vtk')
    self.checks['tecplot'] =  getLibMeshConfigOption(self.libmesh_dir, 'tecplot')

    # Override the MESH_MODE option if using '--parallel-mesh' option
    if self.options.parallel_mesh == True or \
          (self.options.cli_args != None and \
          self.options.cli_args.find('--parallel-mesh') != -1):

      option_set = set()
      option_set.add('ALL')
      option_set.add('PARALLEL')
      self.checks['mesh_mode'] = option_set

    method = set()
    method.add('ALL')
    method.add(self.options.method.upper())
    self.checks['method'] = method

    self.initialize(argv, app_name)

  def findAndRunTests(self):
    self.preRun()
    self.start_time = clock()

    # PBS STUFF
    if self.options.pbs and os.path.exists(self.options.pbs):
      self.options.processingPBS = True
      self.processPBSResults()
    else:
      self.options.processingPBS = False
      for dirpath, dirnames, filenames in os.walk(os.getcwd(), followlinks=True):
        if (self.test_match.search(dirpath) and "contrib" not in os.path.relpath(dirpath, os.getcwd())):
          for file in filenames:
            # set cluster_handle to be None initially (happens for each test)
            self.options.cluster_handle = None
            # See if there were other arguments (test names) passed on the command line
            if file == self.options.input_file_name: #and self.test_match.search(file):
              saved_cwd = os.getcwd()
              sys.path.append(os.path.abspath(dirpath))
              os.chdir(dirpath)

              if self.prunePath(file):
                continue

              # Build a Warehouse to hold the MooseObjects
              warehouse = Warehouse()
#.........这里部分代码省略.........
开发者ID:liuwenf,项目名称:moose,代码行数:101,代码来源:TestHarness.py

示例8: Factory

from Factory import Factory

if __name__ == '__main__':
    factory = Factory()
    person = factory.getPerson("Hyeon", "M")
开发者ID:namkunghyeon,项目名称:python_design_patterns,代码行数:5,代码来源:__init__.py

示例9: len

            self.startButton.addJavascriptEvent('onclick', self.jsSetNavigationIndex(0))
        else:
            self.backButton.hide()
            self.startButton.hide()

        pageList = self._pages_.pageList()
        if len(pageList) > 1:
            for page in self._pages_.pageList():
                link = self.pageLinks.addChildElement(Buttons.Link())
                link.setText(unicode(page / self._pages_.itemsPerPage + 1))
                link.addClass('SpacedWord')
                if page != self._index_.value():
                    link.setDestination('#Link')
                    link.addJavascriptEvent('onclick', self.jsSetNavigationIndex(page))

Factory.addProduct(ItemPager)


class JumpToLetter(Layout.Vertical):
    """
        Provides a simple set of links that allow a user to jump to a particular letter
    """
    letters = map(chr, xrange(ord('A'), ord('Z') + 1))
    signals = Layout.Vertical.signals + ['jsLetterClicked']

    def __init__(self, id, name=None, parent=None):
        Layout.Vertical.__init__(self, id, name, parent)
        self.addClass("WJumpToLetter")
        self.style['float'] = "left"

        self.__letterMap__ = {}
开发者ID:spendyala,项目名称:webelements,代码行数:31,代码来源:Navigation.py

示例10: __init__

  def __init__(self, argv, app_name, moose_dir):
    self.factory = Factory()

    # Build a Warehouse to hold the MooseObjects
    self.warehouse = Warehouse()

    # Get dependant applications and load dynamic tester plugins
    # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
    dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
    sys.path.append(os.path.join(moose_dir, 'framework', 'scripts'))   # For find_dep_apps.py

    # Use the find_dep_apps script to get the dependant applications for an app
    import find_dep_apps
    depend_app_dirs = find_dep_apps.findDepApps(app_name)
    dirs.extend([os.path.join(my_dir, 'scripts', 'TestHarness') for my_dir in depend_app_dirs.split('\n')])

    # Finally load the plugins!
    self.factory.loadPlugins(dirs, 'testers', Tester)

    self.test_table = []
    self.num_passed = 0
    self.num_failed = 0
    self.num_skipped = 0
    self.num_pending = 0
    self.host_name = gethostname()
    self.moose_dir = moose_dir
    self.base_dir = os.getcwd()
    self.run_tests_dir = os.path.abspath('.')
    self.code = '2d2d6769726c2d6d6f6465'
    self.error_code = 0x0
    # Assume libmesh is a peer directory to MOOSE if not defined
    if os.environ.has_key("LIBMESH_DIR"):
      self.libmesh_dir = os.environ['LIBMESH_DIR']
    else:
      self.libmesh_dir = os.path.join(self.moose_dir, 'libmesh', 'installed')
    self.file = None

    # Parse arguments
    self.parseCLArgs(argv)

    self.checks = {}
    self.checks['platform'] = getPlatforms()

    # The TestHarness doesn't strictly require the existence of libMesh in order to run. Here we allow the user
    # to select whether they want to probe for libMesh configuration options.
    if self.options.skip_config_checks:
      self.checks['compiler'] = set(['ALL'])
      self.checks['petsc_version'] = 'N/A'
      self.checks['library_mode'] = set(['ALL'])
      self.checks['mesh_mode'] = set(['ALL'])
      self.checks['dtk'] = set(['ALL'])
      self.checks['unique_ids'] = set(['ALL'])
      self.checks['vtk'] = set(['ALL'])
      self.checks['tecplot'] = set(['ALL'])
      self.checks['dof_id_bytes'] = set(['ALL'])
      self.checks['petsc_debug'] = set(['ALL'])
      self.checks['curl'] = set(['ALL'])
      self.checks['tbb'] = set(['ALL'])
      self.checks['superlu'] = set(['ALL'])
      self.checks['unique_id'] = set(['ALL'])
      self.checks['cxx11'] = set(['ALL'])
      self.checks['asio'] =  set(['ALL'])
    else:
      self.checks['compiler'] = getCompilers(self.libmesh_dir)
      self.checks['petsc_version'] = getPetscVersion(self.libmesh_dir)
      self.checks['library_mode'] = getSharedOption(self.libmesh_dir)
      self.checks['mesh_mode'] = getLibMeshConfigOption(self.libmesh_dir, 'mesh_mode')
      self.checks['dtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'dtk')
      self.checks['unique_ids'] = getLibMeshConfigOption(self.libmesh_dir, 'unique_ids')
      self.checks['vtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'vtk')
      self.checks['tecplot'] =  getLibMeshConfigOption(self.libmesh_dir, 'tecplot')
      self.checks['dof_id_bytes'] = getLibMeshConfigOption(self.libmesh_dir, 'dof_id_bytes')
      self.checks['petsc_debug'] = getLibMeshConfigOption(self.libmesh_dir, 'petsc_debug')
      self.checks['curl'] =  getLibMeshConfigOption(self.libmesh_dir, 'curl')
      self.checks['tbb'] =  getLibMeshConfigOption(self.libmesh_dir, 'tbb')
      self.checks['superlu'] =  getLibMeshConfigOption(self.libmesh_dir, 'superlu')
      self.checks['unique_id'] =  getLibMeshConfigOption(self.libmesh_dir, 'unique_id')
      self.checks['cxx11'] =  getLibMeshConfigOption(self.libmesh_dir, 'cxx11')
      self.checks['asio'] =  getIfAsioExists(self.moose_dir)

    # Override the MESH_MODE option if using '--parallel-mesh' option
    if self.options.parallel_mesh == True or \
          (self.options.cli_args != None and \
          self.options.cli_args.find('--parallel-mesh') != -1):

      option_set = set(['ALL', 'PARALLEL'])
      self.checks['mesh_mode'] = option_set

    method = set(['ALL', self.options.method.upper()])
    self.checks['method'] = method

    self.initialize(argv, app_name)
开发者ID:Teslos,项目名称:moose,代码行数:92,代码来源:TestHarness.py

示例11: DataSet

class DataSet(object):
	"""
	DataSet

	Data structure used to load in .gla files, train, and test data using various classifiers.
	"""

	def __init__(self, fileIn = None):
		self.name		 = None

		self.attributes  = None
		self.examples	 = None
		self.initialize(fileIn = fileIn)

	def convert(self, data):
		return [self.attributes.get(i).getValue(d.replace('#', '')) for i,d in enumerate(data.split())]

	def initialize(self, fileIn = None):
		fin = open(fileIn, 'r')
		read = [line for line in fin.read().splitlines() if len(line) > 0]
		fin.close()

		self.attributes = Factory().construct([line for line in read if len(line) > 0 and line[0] == '@'])
		self.examples 	= Factory().construct([line for line in read if len(line) > 0 and line[0] == '#'], self.attributes)
		self.name 		= read[0]

	def getName(self):
		return self.name

	def setName(self, name):
		self.name = name

	def getAttributeNames(self):
		return [self.attributes.get(a).getName() for a in self.attributes.data]

	def getAttributeTypes(self):
		return [self.attributes.get(a).getType() for a in self.attributes.data]

	def getAttribute(self, attribute = None):
		return self.attributes.get(attribute)

	def getAttributes(self, unit = None):
		if 	 unit == 0: return self.attributes.data.keys()
		elif unit == 1: return self.attributes.data.values()
		else:			return self.attributes

	def getClasses(self, unit = 1):
		return self.attributes.getClassAttribute().getValues()

	def getExample(self, n = None):
		return self.examples.getExamples(n)

	def getExamples(self):
		return self.examples

	def getExamplesWithValue(self, a, v, c = 0):
		"""
			a:	indicates the attribute index
			v:	indicates the attribute value
			c:	indicates the attribute class/label
		"""
		if a == -1:
			return [e.getValue() + [e.getLabel()] for e in self.examples.getExamples(c) if e.getLabel() == v]
		return [e.getValue() + [e.getLabel()] for e in self.examples.getExamples(c) if e.getValue(a) == v]

	def getType(self, i):
		if type(i) == type(str()):
			labels = [self.attributes[k].name for k in self.attributes.keys()]
			i = labels.index(i)
		return self.attributes.get(i).getType()

	def isNumeric(self, i):
		if self.getType(i) in ['n', 'num', 'number', 'numeric']:
			return True
		return False

	def getSize(self, of = 'a'):
		if of in [0, 'a', 'at', 'attr', 'attribute', 'attributes']: return len(self.getAttributes(0))
		if of in [1, 'e', 'ex', 'exam', 'example', 'examples']: 	return len(self.getExamples())

	def getValues(self, attribute = None):
		return self.attributes.get(attribute).getValues()

	def getTrainTestSet(self, p = .6):
		examples = self.getExamples()
		n = int(len(examples) * p)
		s = sample(examples, n)
		
		train = ExampleSet()
		tests = ExampleSet()

		for example in examples:
			if example in s: 			train.add(example)
			elif example not in train: 	tests.add(example)

		return train, tests


	def getTrainValidateTestSet(self, p = .6, v = .5):
		examples = self.getExamples()
#.........这里部分代码省略.........
开发者ID:gabastil,项目名称:pyClassifiers,代码行数:101,代码来源:DataSet.py

示例12: DataSet

class DataSet(object):

	def __init__(self, filePath=None):
		self.name		= None
		self.attributes = None
		self.examples   = ExampleSet()

		self.iteration_index = 0
		
		if filePath is not None:
			self.initialize(filePath)

	def __iter__(self):
		""" allow for iteration over the examples """
		return self

	def next(self):
		""" get next item in iteration
			@return	Example object
		"""
		try:
			self.iteration_index += 1
			return self.examples[self.iteration_index-1]
		except(IndexError):
			self.iteration_index = 0
			raise StopIteration

	def addAttribute(self, attribute):
		""" add attribute to attributes """
		self.attributes.add(attribute)

	def addExample(self, example):
		""" add example object to examples """
		self.examples.add(example)

	def convert(self, stringData):
		""" return Example class object from string input """
		return [self.attributes.get(i).getValues(a) for i,a in enumerate(stringData.replace('#', '').split())]

	def getName(self):
		"""	return dataset name """
		return self.name

	def getAttribute(self, i = None):
		"""	return ith attribute """
		return self.attributes.get(i)

	def getAttributes(self):
		"""	return all attributes """
		return self.attributes

	def getValueAttributes(self):
		""" """
		return [self.attributes[i] for i in range(len(self.attributes))[:-1]]

	def getLabelAttributes(self):
		""" """
		return self.attributes[-1]

	def getExample(self, i = None):
		""" return ith example """
		return self.examples.get(i)

	def getExamples(self):
		return self.examples

	def getExamplesByClass(self, i = None):
		""" return examples with label i """
		return ExampleSet(self.examples.getExamples(i))

	def getExamplesByAttribute(self, a, v, c = 1):
		""" return examples with specified (a) attribute, (v) value, (c) label """
		return [e.getValues() + [e.getLabel()] for e in self.examples if (e.getValue(a) == v) and (e.getLabel() == c)]

	def getLabels(self):
		""" return class labels """
		return self.attributes[-1].getValues()

	def getTrainTestSet(self, percent = .6):
		""" return tuple of testing and training subsets of data with ratio 'percent' """
		if percent > .9: percent = .9
		if percent < .1: percent = .1

		n = int(len(self.examples) * percent)

		trainSet = Factory().build(random.sample(self.examples, n), self.attributes)
		testSet  = Factory().build([example for example in self.examples if example not in trainSet], self.attributes)

		return trainSet, testSet

	def setSeed(self, n = 10):
		""" set seed number for randomizer """
		random.seed(n)

	def initialize(self, filePath):
		""" load data and initialize this class's data: (1) name, (2) attributes, (3) examples """
		fin = open(filePath, 'r')
		read = [line for line in fin.read().splitlines() if len(line) > 0]
		fin.close()

#.........这里部分代码省略.........
开发者ID:gabastil,项目名称:Python_MacBookAir_NLP_Cebuano_Scripts,代码行数:101,代码来源:DataSet.py

示例13: __init__

 def __init__(self):
   self.factory = Factory()
开发者ID:Jieun2,项目名称:moose,代码行数:2,代码来源:cluster_launcher.py

示例14: joinRows

        """
        for row in rows:
            newRow = self.addRow()
            for col, value in row.iteritems():
                self.setCell(newRow, col, value)

    def joinRows(self, columnName, rows):
        """
            Will join a column across the given rows
        """
        row = rows.pop(0)
        row.actualCell(columnName).attributes['rowspan'] = len(rows) + 1
        for row in rows:
            row.actualCell(columnName).replaceWith(Display.Empty())

Factory.addProduct(Table)

Column = Table.Column
Row = Table.Row
Header = Table.Header


class StoredValue(Layout.Box):
    """
        Defines a label:value pair that will be passed into the request
    """
    __slots__ = ('label', 'value', 'valueDisplay')
    def __init__(self, id=None, name=None, parent=None, **kwargs):
        Layout.Box.__init__(self, name=name + "Container", parent=parent)

        self.addClass("WStoredValue")
开发者ID:ankurchopra87,项目名称:webelements,代码行数:31,代码来源:DataViews.py

示例15: buildAndRun

class TestHarness:
    @staticmethod
    def buildAndRun(argv, app_name, moose_dir):
        if "--store-timing" in argv:
            harness = TestTimer(argv, app_name, moose_dir)
        else:
            harness = TestHarness(argv, app_name, moose_dir)

        harness.findAndRunTests()

    def __init__(self, argv, app_name, moose_dir):
        self.factory = Factory()

        # Get dependant applications and load dynamic tester plugins
        # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
        dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
        sys.path.append(os.path.join(moose_dir, "framework", "scripts"))  # For find_dep_apps.py

        # Use the find_dep_apps script to get the dependant applications for an app
        import find_dep_apps

        depend_app_dirs = find_dep_apps.findDepApps(app_name)
        dirs.extend([os.path.join(my_dir, "scripts", "TestHarness") for my_dir in depend_app_dirs.split("\n")])

        # Finally load the plugins!
        self.factory.loadPlugins(dirs, "testers", Tester)

        self.test_table = []
        self.num_passed = 0
        self.num_failed = 0
        self.num_skipped = 0
        self.num_pending = 0
        self.host_name = gethostname()
        self.moose_dir = moose_dir
        self.run_tests_dir = os.path.abspath(".")
        self.code = "2d2d6769726c2d6d6f6465"
        self.error_code = 0x0
        # Assume libmesh is a peer directory to MOOSE if not defined
        if os.environ.has_key("LIBMESH_DIR"):
            self.libmesh_dir = os.environ["LIBMESH_DIR"]
        else:
            self.libmesh_dir = os.path.join(self.moose_dir, "libmesh", "installed")
        self.file = None

        # Parse arguments
        self.parseCLArgs(argv)

        self.checks = {}
        self.checks["platform"] = getPlatforms()

        # The TestHarness doesn't strictly require the existence of libMesh in order to run. Here we allow the user
        # to select whether they want to probe for libMesh configuration options.
        if self.options.skip_config_checks:
            self.checks["compiler"] = set(["ALL"])
            self.checks["petsc_version"] = "N/A"
            self.checks["library_mode"] = set(["ALL"])
            self.checks["mesh_mode"] = set(["ALL"])
            self.checks["dtk"] = set(["ALL"])
            self.checks["unique_ids"] = set(["ALL"])
            self.checks["vtk"] = set(["ALL"])
            self.checks["tecplot"] = set(["ALL"])
            self.checks["dof_id_bytes"] = set(["ALL"])
            self.checks["petsc_debug"] = set(["ALL"])
            self.checks["curl"] = set(["ALL"])
            self.checks["tbb"] = set(["ALL"])
        else:
            self.checks["compiler"] = getCompilers(self.libmesh_dir)
            self.checks["petsc_version"] = getPetscVersion(self.libmesh_dir)
            self.checks["library_mode"] = getSharedOption(self.libmesh_dir)
            self.checks["mesh_mode"] = getLibMeshConfigOption(self.libmesh_dir, "mesh_mode")
            self.checks["dtk"] = getLibMeshConfigOption(self.libmesh_dir, "dtk")
            self.checks["unique_ids"] = getLibMeshConfigOption(self.libmesh_dir, "unique_ids")
            self.checks["vtk"] = getLibMeshConfigOption(self.libmesh_dir, "vtk")
            self.checks["tecplot"] = getLibMeshConfigOption(self.libmesh_dir, "tecplot")
            self.checks["dof_id_bytes"] = getLibMeshConfigOption(self.libmesh_dir, "dof_id_bytes")
            self.checks["petsc_debug"] = getLibMeshConfigOption(self.libmesh_dir, "petsc_debug")
            self.checks["curl"] = getLibMeshConfigOption(self.libmesh_dir, "curl")
            self.checks["tbb"] = getLibMeshConfigOption(self.libmesh_dir, "tbb")

        # Override the MESH_MODE option if using '--parallel-mesh' option
        if self.options.parallel_mesh == True or (
            self.options.cli_args != None and self.options.cli_args.find("--parallel-mesh") != -1
        ):

            option_set = set(["ALL", "PARALLEL"])
            self.checks["mesh_mode"] = option_set

        method = set(["ALL", self.options.method.upper()])
        self.checks["method"] = method

        self.initialize(argv, app_name)

    """
  Recursively walks the current tree looking for tests to run
  Error codes:
  0x0  - Success
  0x0* - Parser error
  0x1* - TestHarness error
  """

#.........这里部分代码省略.........
开发者ID:rogermue,项目名称:moose,代码行数:101,代码来源:TestHarness.py


注:本文中的Factory.Factory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。