Check if pyproject.toml file exists and is a poetry project.
969263
function isPoetryProject(servicePath) {
  const pyprojectPath = path.join(servicePath, 'pyproject.toml');

  if (!fse.existsSync(pyprojectPath)) {
    return false;
  }

  const pyprojectToml = fs.readFileSync(pyprojectPath);
  const pyproject = tomlParse(pyprojectToml);

  const buildSystemReqs =
    (pyproject['build-system'] && pyproject['build-system']['requires']) || [];

  for (var i = 0; i < buildSystemReqs.length; i++) {
    if (buildSystemReqs[i].startsWith('poetry')) {
      return true;
    }
  }

  return false;
}
322895
def is_url(text):
    
    if text is None:
        return False
    text = text.lower()
    return text.startswith('http://') or text.startswith('https://') or \
        text.startswith('urn:') or text.startswith('file://')
543290
def consult_robots_txt(self, request: HTTPRequest) -> bool:
        '''
        '''
        if not self._robots_txt_checker:
            return True

        result = yield from self._robots_txt_checker.can_fetch(request)
        return result
461212
def check_path(filename, reporter=modReporter.Default, settings_path=None, **setting_overrides):
    """"""
    try:
        with open(filename, 'U') as f:
            codestr = f.read() + '\n'
    except UnicodeError:
        reporter.unexpected_error(filename, 'problem decoding source')
        return 1
    except IOError:
        msg = sys.exc_info()[1]
        reporter.unexpected_error(filename, msg.args[1])
        return 1
    return check(codestr, filename, reporter, settings_path, **setting_overrides)
711367
def is_repo_instance(cls, path):
        
        try:
            cls.get_version(path)
            return True
        except subprocess.CalledProcessError:
            # Git returns non-zero status
            return False
        except OSError:
            # Git unavailable?
            return False
434971
def check_has_path(self, api):
        ''''''
        if not hasattr(api, 'path'):
            msg = 'The Api class "{}" lacks a `path` attribute.'
            return [msg.format(api.__name__)]
22312
def file_is_present(self, file_path):
        
        p = self.p(file_path)
        if not os.path.exists(p):
            return False
        if not os.path.isfile(p):
            raise IOError("%s is not a file" % file_path)
        return True
1022878
def check_file(
    state,
    fname,
    missing_msg="Did you create a file named `{}`?",
    is_dir_msg="Want to check a file named `{}`, but found a directory.",
    parse=True,
    use_fs=True,
    use_solution=False,
):
    

    if use_fs:
        p = Path(fname)
        if not p.exists():
            state.report(Feedback(missing_msg.format(fname)))  # test file exists
        if p.is_dir():
            state.report(Feedback(is_dir_msg.format(fname)))  # test its not a dir

        code = p.read_text()
    else:
        code = _get_fname(state, "student_code", fname)

        if code is None:
            state.report(Feedback(missing_msg.format(fname)))  # test file exists

    sol_kwargs = {"solution_code": None, "solution_ast": None}
    if use_solution:
        sol_code = _get_fname(state, "solution_code", fname)
        if sol_code is None:
            raise Exception("Solution code does not have file named: %s" % fname)
        sol_kwargs["solution_code"] = sol_code
        sol_kwargs["solution_ast"] = (
            state.parse(sol_code, test=False) if parse else None
        )

    return state.to_child(
        student_code=code,
        student_ast=state.parse(code) if parse else None,
        fname=fname,
        **sol_kwargs
    )
264139
def is_file(dirname):
    ''''''
    if not os.path.isfile(dirname):
        msg = "{0} is not an existing file".format(dirname)
        raise argparse.ArgumentTypeError(msg)
    else:
        return dirname
127715
def project_exists(response: 'environ.Response', path: str) -> bool:
    

    if os.path.exists(path):
        return True

    response.fail(
        code='PROJECT_NOT_FOUND',
        message='The project path does not exist',
        path=path
    ).console(
        """
        [ERROR]: Unable to open project. The specified path does not exist:

          {path}
        """.format(path=path)
    )
    return False
61199
def is_installable_dir(path):
    # type: (str) -> bool
    
    if not os.path.isdir(path):
        return False
    setup_py = os.path.join(path, 'setup.py')
    if os.path.isfile(setup_py):
        return True
    pyproject_toml = os.path.join(path, 'pyproject.toml')
    if os.path.isfile(pyproject_toml):
        return True
    return False
550063
def have(cmd):
    """"""

    try:
        # Python 3.3+ only
        from shutil import which
    except ImportError:
        def which(cmd):
            """
            Given a command, return the path which conforms to the given mode
            on the PATH, or None if there is no such file.
            """

            def _access_check(path):
                """
                Check that a given file can be accessed with the correct mode.
                Additionally check that `path` is not a directory.
                """
                return (os.path.exists(path) and os.access(
                    path, os.F_OK | os.X_OK) and not os.path.isdir(path))

            # If we're given a path with a directory part, look it up directly
            # rather than referring to PATH directories. This includes checking
            # relative to the current directory, e.g. ./script
            if os.path.dirname(cmd):
                if _access_check(cmd):
                    return cmd
                return None

            paths = os.environ.get('PATH', os.defpath.lstrip(':')).split(':')

            seen = set()
            for path in paths:
                if path not in seen:
                    seen.add(path)
                    name = os.path.join(path, cmd)
                    if _access_check(name):
                        return name
            return None

    return which(cmd) is not None
308322
def supports_py3(project_name):
    """"""
    log = logging.getLogger("ciu")
    log.info("Checking {} ...".format(project_name))
    request = requests.get("https://pypi.org/pypi/{}/json".format(project_name))
    if request.status_code >= 400:
        log = logging.getLogger("ciu")
        log.warning("problem fetching {}, assuming ported ({})".format(
                        project_name, request.status_code))
        return True
    response = request.json()
    return any(c.startswith("Programming Language :: Python :: 3")
               for c in response["info"]["classifiers"])
409012
def check(module):
  global passed, failed
  '''
  
  '''
  module_name = module.rsplit('/', 1)[1]
  if module[-3:] == ".py" and module_name not in IGNORED_FILES:
    print ("CHECKING ", module)
    pout = os.popen('pylint %s'% module, 'r')
    for line in pout:
      if "Your code has been rated at" in line:
        print ("PASSED pylint inspection: " + line)
        passed += 1
        return True
      if "-error" in line:
        print ("FAILED pylint inspection: " + line)
        failed += 1
        errors.append("FILE: " + module)
        errors.append("FAILED pylint inspection: " + line)
        return False
45851
def IsFileStatEntry(self, original_result):
    """"""
    return (original_result.pathspec.pathtype in [
        rdf_paths.PathSpec.PathType.OS, rdf_paths.PathSpec.PathType.TSK
    ])
273205
def probe_project(python_module):
    
    log.info('Checking project for changes requirements.')
    return (
        has_tools()
        and has_setup()
        and has_metadata(python_module)
        and has_test_runner()
        and has_readme()
        and has_changelog()
    )
727352
def checkmagic(self):
        
        self.lib.seek(self.start)  # default - magic is at start of file

        if self.lib.read(len(self.MAGIC)) != self.MAGIC:
            raise ArchiveReadError("%s is not a valid %s archive file"
                                   % (self.path, self.__class__.__name__))

        if self.lib.read(len(self.pymagic)) != self.pymagic:
            raise ArchiveReadError("%s has version mismatch to dll" %
                (self.path))

        self.lib.read(4)