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


Python parameters.Parameters类代码示例

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


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

示例1: __open_selected

	def __open_selected(self, widget, path):
		"""Open selected item in either active, or new tab"""
		# unquote path before giving it to handler
		if path is not None and '://' in path:
			data = path.split('://', 1)
			data[1] = urllib.unquote(data[1])
			path = '://'.join(data)

		# open selected item
		if self._open_in_new_tab:
			# create new tab
			options = Parameters()
			options.set('path', path)

			self._application.create_tab(
							self._object._notebook,
							self._object.__class__,
							options
						)

		elif hasattr(self._object, 'change_path'):
			self._object.change_path(path)

		# reset values
		self._open_in_new_tab = False

		return True
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:27,代码来源:bookmarks_menu.py

示例2: _change_path

	def _change_path(self, widget=None, new_tab=False):
		"""Change to selected path"""
		selection = self._history_list.get_selection()
		item_list, selected_iter = selection.get_selected()

		# if selection is valid, change to selected path
		if selected_iter is not None:
			path = item_list.get_value(selected_iter, Column.PATH)

			if not new_tab:
				# change path
				self._parent._handle_history_click(path=path)

			else:
				# create a new tab
				options = Parameters()
				options.set('path', path)

				self._application.create_tab(
								self._parent._notebook,
								self._parent.__class__,
								options
							)

			# close dialog
			self._close()
开发者ID:stefaniuk,项目名称:playground,代码行数:26,代码来源:history_list.py

示例3: countRegions

def countRegions():
    # Requires: -the first command line argument is the name of the
    #            image to be segmented
    #           -the second command line argument is the color space being
    #            used, either RGB, HSV, or HLS
    # Effects: -calls closure with count foreground argument on, returns
    #           count of distinct foreground objects
    
    colorSpace = argv[2].lower()
    
    if not (colorSpace in ["rgb", "hsv", "hls"]):
        print "Second argument not one of RGB, HSV, or HLS"
        print "The first argument should be the name of the image to be segmented"
        print "Followed by the desire color space representation"
        exit(1)
    
    try:
        image = Image.open(argv[1])
        imageData = colorSpaceConvert(list(image.getdata()), argv[2].lower())
    except:
        print "Invalid or no image name given"
        print "The first argument should be the name of the image to be segmented"
        print "Followed by the desire color space representation"
        exit(1)
        
    if colorSpace == "rgb":
        redMinMax = raw_input("Red min-max, between 0 and 255: ")
        greenMinMax = raw_input("Green min-max, between 0 and 255: ")
        blueMinMax = raw_input("Blue min-max, between 0 and 255: ")
        redMinMax = [float(x) / 255.0 for x in redMinMax.split()]
        greenMinMax = [float(x) / 255.0 for x in greenMinMax.split()]
        blueMinMax = [float(x) / 255.0 for x in blueMinMax.split()]
        colorRanges = [redMinMax, greenMinMax, blueMinMax]
    elif colorSpace == "hsv":
        hueMinMax = raw_input("Hue min-max, between 0 and 360: ")
        satMinMax = raw_input("Saturation min-max, between 0 and 100: ")
        valMinMax = raw_input("Value min-max, between 0 and 100: ")
        hueMinMax = [float(x) / 360.0 for x in hueMinMax.split()]
        satMinMax = [float(x) / 100.0 for x in satMinMax.split()]
        valMinMax = [float(x) / 100.0 for x in valMinMax.split()]
        colorRanges = [hueMinMax, satMinMax, valMinMax]
    else:
        hueMinMax = raw_input("Hue min-max, between 0 and 360: ")
        lightMinMax = raw_input("Lightness min-max, between 0 and 100: ")
        satMinMax = raw_input("Saturation min-max, between 0 and 100: ")
        hueMinMax = [float(x) / 360.0 for x in hueMinMax.split()]
        lightMinMax = [float(x) / 100.0 for x in lightMinMax.split()]
        satMinMax = [float(x) / 100.0 for x in satMinMax.split()]
        colorRanges = [hueMinMax, lightMinMax, satMinMax]
    
    param = Parameters()
    param.setImageSize(image.size)
    param.setColorRanges(colorRanges)
    
    seg = segmentation.colorSegmenter()
    mask = seg.segmentImage(imageData, param, True)
    
    close = closure.closure()
    close.segmentRegions(mask, param, 0, True, False)
开发者ID:Ali09,项目名称:image-segmentation,代码行数:59,代码来源:count.py

示例4: _create_file_list

	def _create_file_list(self, widget=None, data=None):
		"""Create file list in parent notebook"""
		self.__update_path_from_pid()
		DefaultList = self._parent.plugin_classes['file_list']
		options = Parameters()
		options.set('path', self.path)
		self._parent.create_tab(self._notebook, DefaultList, options)
		return True
开发者ID:Alwnikrotikz,项目名称:sunflower-fm,代码行数:8,代码来源:plugin.py

示例5: _close_tab

	def _close_tab(self, widget=None, data=None):
		"""Provide additional functionality"""
		if self._notebook.get_n_pages() == 1:
			DefaultList = self._parent.plugin_classes['file_list']
			options = Parameters()
			options.set('path', self.path)

			self._parent.create_tab(self._notebook, DefaultList, options)

		return Terminal._close_tab(self, widget, data)
开发者ID:stefaniuk,项目名称:playground,代码行数:10,代码来源:plugin.py

示例6: open_file

	def open_file(self, selection, application_info=None, exec_command=None):
		"""Open filename using config file or specified execute command"""
		if application_info is not None:
			# get command from config file
			command = application_info.command_line
			
		elif exec_command is not None:
			# use specified command
			command = exec_command
		
		else:
			# raise exception, we need at least one argument
			raise AttributeError('Error opening file. We need command or application to be specified.')
		
		exec_string = self.__format_command_string(selection, command)

		# open selected file(s)
		split_command = shlex.split(exec_string)
		test_command = split_command[0] if len(split_command) > 1 else exec_string

		if is_x_app(test_command):
			os.system('{0} &'.format(exec_string))

		else:
			active_object = self._application.get_active_object()

			options = Parameters()
			options.set('close_with_child', True)
			options.set('shell_command', split_command[0])
			options.set('arguments', split_command)
			options.set('path', os.path.dirname(selection[0]))

			self._application.create_terminal_tab(active_object._notebook, options)
开发者ID:stefaniuk,项目名称:playground,代码行数:33,代码来源:associations.py

示例7: edit_file

	def edit_file(self, selection):
		"""Edit selected filename"""
		section = self._application.options.section('editor')
		command = section.get('default_editor')

		exec_string = self.__format_command_string(selection, command)

		# open selected file(s)
		split_command = shlex.split(exec_string)
		test_command = split_command[0] if len(split_command) > 1 else exec_string

		if (section.get('terminal_command') and section.get('type') == 1) \
		or not is_x_app(test_command):
			active_object = self._application.get_active_object()

			options = Parameters()
			options.set('close_with_child', True)
			options.set('shell_command', split_command[0])
			options.set('arguments', split_command)
			options.set('path', os.path.dirname(selection[0]))

			self._application.create_terminal_tab(active_object._notebook, options)

		else:
			os.system('{0} &'.format(exec_string))
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:25,代码来源:associations.py

示例8: load_parameters

 def load_parameters(json_parameters):
   parameters = Parameters()
   parameters.clustering_threshold = json_parameters['clustering_threshold']
   parameters.size_threshold = json_parameters['size_threshold']
   parameters.distance_threshold = json_parameters['distance_threshold']
   parameters.hashing_depth = json_parameters['hashing_depth']
   parameters.clusterize_using_dcup = json_parameters['clusterize_using_dcup']
   parameters.clusterize_using_hash = json_parameters['clusterize_using_hash']
   parameters.report_unifiers = json_parameters['report_unifiers']
   parameters.force = json_parameters['force']
   parameters.use_diff = json_parameters['use_diff']
开发者ID:Zomega,项目名称:orphanblack,代码行数:11,代码来源:report.py

示例9: create_terminal

	def create_terminal(self, path, position=None):
		options = Parameters()
		options.set('path', path)

		if position == 'left':
			notebook = self._application.left_notebook
		elif position == 'right':
			notebook = self._application.right_notebook
		else:
			notebook = self._application.get_active_notebook()

		self._application.create_tab(notebook, self._application.plugin_classes['system_terminal'], options)
开发者ID:darkelement,项目名称:Sunflower,代码行数:12,代码来源:dbus_interface.py

示例10: scan

def scan(language, file_manifest, source_file_names):

  # Determine the files to scan. If no files are given, use a default manifest.
  if len(source_file_names) == 0 and file_manifest is None:
    file_manifest = manifest.default_manifest(language)

  source_file_names = set(source_file_names)
  if file_manifest is not None:
    source_file_names.update(set(manifest.contents(file_manifest)))

  supplier = ast_suppliers.abstract_syntax_tree_suppliers[language]

  # TODO: Configuration files!
  parameters = Parameters()
  parameters.distance_threshold = supplier.distance_threshold
  parameters.size_threshold = supplier.size_threshold

  source_files = []

  report = Report(parameters)

  def parse_file(file_name):
    try:
      logging.info('Parsing ' + file_name + '...')
      source_file = supplier(file_name, parameters)
      source_file.getTree().propagateCoveredLineNumbers()
      source_file.getTree().propagateHeight()
      source_files.append(source_file)
      report.addFileName(file_name)
      logging.info('done')
    except:
      logging.warn('Can\'t parse "%s" \n: ' % (file_name,) + traceback.format_exc())

  for file_name in source_file_names:
      parse_file(file_name)

  duplicates = clone_detection_algorithm.findDuplicateCode(source_files, report)
  n = 1
  for duplicate in duplicates:
    distance = duplicate.calcDistance()
    summary = CloneSummary(
      "Clone #"+str(n),
      [  # TODO: This is a mess! Most of this info should be assembled on the fly and in member functions.
       Snippet(
        duplicate[i].getSourceFile()._file_name,
        duplicate[i].getCoveredLineNumbers(),
        '\n'.join([line for line in duplicate[i].getSourceLines()])
        ) for i in [0, 1]], distance)
    report.addClone(summary)
    n += 1
  report.sortByCloneSize()

  save_report(".orphanblack", report)
开发者ID:Zomega,项目名称:orphanblack,代码行数:53,代码来源:cli.py

示例11: create_terminal

    def create_terminal(self, path, position=None):
        """Expose method for creating terminal tab."""
        options = Parameters()
        options.set("path", path)

        if position == "left":
            notebook = self._application.left_notebook

        elif position == "right":
            notebook = self._application.right_notebook

        else:
            notebook = self._application.get_active_notebook()

        self._application.create_tab(notebook, self._application.plugin_classes["system_terminal"], options)
开发者ID:Alwnikrotikz,项目名称:sunflower-fm,代码行数:15,代码来源:dbus_interface.py

示例12: create_tab

	def create_tab(self, path, position=None):
		"""Expose method for creating standard tab."""
		options = Parameters()
		options.set('path', path)

		if position == 'left':
			notebook = self._application.left_notebook

		elif position == 'right':
			notebook = self._application.right_notebook

		else:
			notebook = self._application.get_active_notebook()

		self._application.create_tab(notebook, self._application.plugin_classes['file_list'], options)
开发者ID:SmokeyCosmy,项目名称:Sunflower,代码行数:15,代码来源:dbus_interface.py

示例13: __init__

 def __init__(self):
     self.words = list()
     self.list_number = 2
     self.min = dict()
     self.max = dict()
     self.first_list = list()
     self.second_list = list()
     self.first_list_output = list()
     self.second_list_output = list()
     self.minimum = None
     self.length = 0
     self.number_of_same = 0
     self.allow = True
     self.same = list()
     self.statistics = None
     self.key_for_differ_feature = ""
     self.which_higher = None
     self.p_values = list()
     self.time_begin = None
     self.success = True
     self.first_list_equality_counter = dict()
     self.second_list_equality_counter = dict()
     self.should_append_first = dict()
     self.should_append_second = dict()
     self.numeric_features = list()
     self.categorical_features = dict()
     self.categorical_features_list = list()
     self.len_of_numeric = 0
     self.len_of_categorical = 0
     self.parameters = Parameters()
开发者ID:gree-gorey,项目名称:losc,代码行数:30,代码来源:store.py

示例14: __init__

    def __init__(self):
        print 'call me'
        self.parameters = Parameters()
        if LBL:
            graph.output_weights = self.parameters.output_weights
            graph.output_biases = self.parameters.output_biases
            graph.score_biases = self.parameters.score_biases
        else:
            graph.hidden_weights = self.parameters.hidden_weights
            graph.hidden_biases = self.parameters.hidden_biases
            graph.output_weights = self.parameters.output_weights
            graph.output_biases = self.parameters.output_biases

#        (self.graph_train, self.graph_predict, self.graph_verbose_predict) = graph.functions(self.parameters)
        import sets
        self.train_loss = MovingAverage()
        self.train_err = MovingAverage()
        self.train_lossnonzero = MovingAverage()
        self.train_squashloss = MovingAverage()
        self.train_unpenalized_loss = MovingAverage()
        self.train_l1penalty = MovingAverage()
        self.train_unpenalized_lossnonzero = MovingAverage()
        self.train_correct_score = MovingAverage()
        self.train_noise_score = MovingAverage()
        self.train_cnt = 0
开发者ID:everwind,项目名称:DNNNLP,代码行数:25,代码来源:model.py

示例15: main

def main():
    application = QApplication(sys.argv)
    application.quitOnLastWindowClosed = True

    params = Parameters()
    if os.path.isfile("default.cfg"):
        try:
            params.load_from_file("default.cfg")
        except:
            # Even if the operation fails the object should still be usable.
            pass

    window = ApplicationWidget(params)
    window.show()

    sys.exit(application.exec_())
开发者ID:RoopeSavolainen,项目名称:SwarmSimulator,代码行数:16,代码来源:__main__.py


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