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


Python Parameters.distance_threshold方法代码示例

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


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

示例1: load_parameters

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import distance_threshold [as 别名]
 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,代码行数:13,代码来源:report.py

示例2: scan

# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import distance_threshold [as 别名]
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,代码行数:55,代码来源:cli.py


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