Selects importer based on input file type.
175778
def _get_importer(input_file):
    """"""
    __, ext = os.path.splitext(input_file)
    ext = ext.lower()

    if "ostriz" in input_file:
        from dump2polarion.results import ostriztools

        importer = ostriztools.import_ostriz
    elif ext == ".xml":
        # expect junit-report from pytest
        from dump2polarion.results import junittools

        importer = junittools.import_junit
    elif ext == ".csv":
        from dump2polarion.results import csvtools

        importer = csvtools.import_csv
    elif ext in dbtools.SQLITE_EXT:
        importer = dbtools.import_sqlite
    elif ext == ".json":
        from dump2polarion.results import jsontools

        importer = jsontools.import_json
    else:
        raise Dump2PolarionException("Cannot recognize type of input data, add file extension.")

    return importer
609421
def _preferred_filetype(self, filetypes):
        
        if not isinstance(filetypes, list):
            filetypes = [filetypes]

        # look through the file types and use the first one that we have loaded
        for filetype in filetypes:
            if filetype in self.file_handlers:
                return filetype
        return None
1299056
def __get_indexer(in_fns, selected_type=None):
  """"""
  indexer = None
  if selected_type is not None:
    indexer = get_indexer_by_filetype(selected_type)
  else:
    if len(in_fns) == 0:
      raise IndexError("reading from stdin, unable to guess input file " +
                       "type, use -t option to set manually.\n")
    else:
      extension = set([os.path.splitext(f)[1] for f in in_fns])
      assert(len(extension) >= 1)
      if len(extension) > 1:
        raise IndexError("more than one file extension present, unable " +
                         "to get input type, use -t option to set manually.\n")
      else:
        indexer = get_indexer_by_file_extension(list(extension)[0])
  assert(indexer is not None)
  return indexer
541387
def select(files, start, stop):
    
    if start or stop:
        if start is None:
            start = 0
        if stop is None:
            stop = len(files)
        files = files[start:stop]
    return files
773761
def import_file(self, ):
        
        tfi = self.get_taskfileinfo_selection()
        if tfi:
            self.reftrack.import_file(tfi)
984257
def _resolve_import(name):
    """"""
    if name in sys.modules:
        return getattr(sys.modules[name], '__file__', name + '.so')
    return _resolve_import_versioned(name)
969962
def select(read_streams, write_streams, timeout=0):
    

    exception_streams = []

    try:
        return builtin_select.select(
            read_streams,
            write_streams,
            exception_streams,
            timeout,
        )[0:2]
    except builtin_select.error as e:
        # POSIX signals interrupt select()
        no = e.errno if six.PY3 else e[0]
        if no == errno.EINTR:
            return ([], [])
        else:
            raise e
1052507
def file_type(self, value):
        
        if isinstance(value, FileType):
            self._file_type = value
        else:
            self._file_type = FileType(value)
891475
function checkImport(jsonImport, importType) {
        if (!jsonImport) {
            return 'Import should always be a valid JSON object!';
        }

        switch (importType) {
            case CONSTANTS.EXPORT_TYPE_PROJECT:
                if (jsonImport._metadata && jsonImport._metadata.type) {
                    if (jsonImport._metadata.type !== CONSTANTS.EXPORT_TYPE_PROJECT) {
                        return 'Import is of type \'' + CONSTANTS.EXPORT_TYPE_LIBRARY + '\' and not of \'' +
                            CONSTANTS.EXPORT_TYPE_PROJECT + '\'!';
                    }
                } else if (jsonImport.root && typeof jsonImport.root.path === 'string') {
                    if (jsonImport.root.path !== '') {
                        return 'Import is of type \'' + CONSTANTS.EXPORT_TYPE_LIBRARY + '\' and not of \'' +
                            CONSTANTS.EXPORT_TYPE_PROJECT + '\'!';
                    }
                } else {
                    return 'Import data is probably incomplete and should not be used!';
                }
                break;
            case CONSTANTS.EXPORT_TYPE_LIBRARY:
                if (jsonImport._metadata && jsonImport._metadata.type) {
                    if (jsonImport._metadata.type !== CONSTANTS.EXPORT_TYPE_LIBRARY) {
                        return 'Import is of type \'' + CONSTANTS.EXPORT_TYPE_PROJECT + '\' and not of \'' +
                            CONSTANTS.EXPORT_TYPE_LIBRARY + '\'!';
                    }
                } else if (jsonImport.root && typeof jsonImport.root.path === 'string') {
                    if (jsonImport.root.path === '') {
                        return 'Import is of type \'' + CONSTANTS.EXPORT_TYPE_PROJECT + '\' and not of \'' +
                            CONSTANTS.EXPORT_TYPE_LIBRARY + '\'!';
                    }
                } else {
                    return 'Import data is probably incomplete and should not be used!';
                }
                break;
            default:
                return 'Invalid type, cannot checked!';
        }

        return null;
    }
307769
def select_from(self, parent_path):
        """"""
        path_cls = type(parent_path)
        is_dir = path_cls.is_dir
        exists = path_cls.exists
        scandir = parent_path._accessor.scandir
        if not is_dir(parent_path):
            return iter([])
        return self._select_from(parent_path, is_dir, exists, scandir)
123500
function checkImportCall(node) {
    if (node.callee.type !== 'Import') return
    if (node.arguments.length !== 1) return

    const modulePath = node.arguments[0]
    if (modulePath.type !== 'Literal') return
    if (typeof modulePath.value !== 'string') return

    checkSourceValue(modulePath, node)
  }
384995
def select_renderer(self, request, renderers):
        
        if not len(request.accept_mimetypes):
            return renderers[0], renderers[0].mimetype

        for mimetype, quality in request.accept_mimetypes:
            accept_mimetype = MimeType.parse(mimetype)
            for renderer in renderers:
                if accept_mimetype.match(renderer.mimetype):
                    return renderer, renderer.mimetype.replace(params=accept_mimetype.params)

        return None, None
1091432
def handle_import(self, name, compilation, rule):
        
        original_path = PurePath(name)

        search_exts = list(compilation.compiler.dynamic_extensions)
        if original_path.suffix and original_path.suffix in search_exts:
            basename = original_path.stem
        else:
            basename = original_path.name

        if original_path.is_absolute():
            # Remove the beginning slash
            search_path = original_path.relative_to('/').parent
        elif rule.source_file.origin:
            search_path = rule.source_file.origin
            if original_path.parent:
                search_path = os.path.normpath(str(search_path / original_path.parent))
        else:
            search_path = original_path.parent

        for prefix, suffix in product(('_', ''), search_exts):
            filename = PurePath(prefix + basename + suffix)

            full_filename, storage = get_file_and_storage(str(search_path / filename))

            if full_filename:
                with storage.open(full_filename) as f:
                    return SourceFile.from_file(f, origin=search_path, relpath=filename)
579506
def _select_input(self):
        """"""
        line, index = self.get_position('eof')
        if self.current_prompt_pos is None:
            pline, pindex = line, index
        else:
            pline, pindex = self.current_prompt_pos
        self.setSelection(pline, pindex, line, index)
1056343
function convertImports(imports) {
		    	for (var file in imports) {
				    if (imports.hasOwnProperty(file)) {
				        postCssInputs[file] = new Input(imports[file], file !== "input" ? { from: file } : undefined);
				    }
				}
			}
1284637
def toggle_auto_import(self, checked):
        """"""
        self.combo.validate_current_text()
        self.set_option('automatic_import', checked)
        self.force_refresh()
1131257
def default_input_type(attribute_name, column, options)
      return options[:as].to_sym if options[:as]
      custom_type = find_custom_type(attribute_name.to_s) and return custom_type
      return :select             if options[:collection]

      input_type = column.try(:type)
      case input_type
      when :timestamp
        :datetime
      when :string, :citext, nil
        case attribute_name.to_s
        when /(?:\b|\W|_)password(?:\b|\W|_)/  then :password
        when /(?:\b|\W|_)time_zone(?:\b|\W|_)/ then :time_zone
        when /(?:\b|\W|_)country(?:\b|\W|_)/   then :country
        when /(?:\b|\W|_)email(?:\b|\W|_)/     then :email
        when /(?:\b|\W|_)phone(?:\b|\W|_)/     then :tel
        when /(?:\b|\W|_)url(?:\b|\W|_)/       then :url
        else
          file_method?(attribute_name) ? :file : (input_type || :string)
        end
      else
        input_type
      end
    end