Checks if requirements in `path` can be updated if insecure.
        :param path: string, path to requirement file
        :return: bool
431096
def can_update_insecure(self, path):
        
        return self._get_requirement_attr("update", path=path) in (Config.UPDATE_ALL,
                                                                   Config.UPDATE_INSECURE,
                                                                   Config.UPDATE_INSECURE_TYPO)
1029696
def is_valid(file_path):
    
    from os import path, stat

    can_open = False

    try:
        with open(file_path) as fp:
            can_open = True
    except IOError:
        return False

    is_file = path.isfile(file_path)

    return path.exists(file_path) and is_file and stat(file_path).st_size > 0
688839
def install_requirements(self, path, index=None):
        
        cmd = 'install -r {0}'.format(path)
        if index:

            cmd = 'install --index-url {0} -r {1}'.format(index, path)

        self.pip(cmd)
733410
def downloaded_reqs_from_path(path, argv):
    
    finder = package_finder(argv)
    return [DownloadedReq(req, argv, finder) for req in
            _parse_requirements(path, finder)]
1079722
def check_path(file_path):
    '''
        
    '''
    directory = os.path.dirname(file_path)
    if directory != '':
        if not os.path.exists(directory):
            os.makedirs(directory, 0o775)
370388
def check_input_file(self, path):
        
        if not gf.file_can_be_read(path):
            self.print_error(u"Unable to read file '%s'" % (path))
            self.print_error(u"Make sure the file path is written/escaped correctly and that you have read permission on it")
            return False
        return True
70005
def load_path(self, path):
        

        if not foundations.common.path_exists(path):
            return False

        if os.path.isfile(path):
            if path in self.list_files():
                self.set_current_editor(path)
            else:
                self.load_file(path)
        else:
            if not path in self.list_projects():
                self.add_project(path)
        return True
507051
def valid_file(path: str) -> bool:
    
    path = Path(path).expanduser()
    log.debug("checking if %s is a valid file", path)
    return path.exists() and path.is_file()
813261
def _writable_required(self, path):
        # type: (Text) -> FS
        
        if self.write_fs is None:
            raise errors.ResourceReadOnly(path)
        return self.write_fs
1315458
def get_requirements_information(self, path: Path) -> Tuple[RequirementsOptions, Optional[str]]:
        
        if self.pipfile_location is not None:
            pipfile = path / self.pipfile_location / "Pipfile"
            pipfile_lock = path / self.pipfile_location / "Pipfile.lock"

            pipfile_exists = pipfile.exists()
            pipfile_lock_exists = pipfile_lock.exists()

            if pipfile_exists and pipfile_lock_exists:
                option = RequirementsOptions.pipfile
                return option, self.hash_file_contents(option, pipfile_lock)
            elif pipfile_exists:
                raise BuildError("Only the Pipfile is included in the repository, Arca does not support that.")
            elif pipfile_lock_exists:
                raise BuildError("Only the Pipfile.lock file is include in the repository, Arca does not support that.")

        if self.requirements_location:
            requirements_file = path / self.requirements_location

            if requirements_file.exists():
                option = RequirementsOptions.requirements_txt
                return option, self.hash_file_contents(option, requirements_file)

        return RequirementsOptions.no_requirements, None
889419
def check_requirements(script_path, requirements_file = None):
    
    script_dir = os.path.dirname(script_path)
    opinel_min_version = opinel_max_version = boto3_min_version = boto3_max_version = None
    # Requirements file is either next to the script or in data/requirements
    if not requirements_file:
        requirements_file = os.path.join(script_dir, 'data/requirements.txt')
        if not os.path.isfile(requirements_file):
            requirements_file = os.path.join(script_dir, 'requirements.txt')
    with open(requirements_file, 'rt') as f:
        for requirement in f.readlines():
            opinel_requirements = re_opinel.match(requirement)
            if opinel_requirements:
                opinel_requirements = opinel_requirements.groups()
                opinel_min_version = opinel_requirements[0]
                opinel_max_version = opinel_requirements[1]
            boto3_requirements = re_boto3.match(requirement)
            if boto3_requirements:
                boto3_requirements = boto3_requirements.groups()
                boto3_min_version = boto3_requirements[0]
                boto3_max_version = boto3_requirements[1]
    if not check_versions(opinel_min_version, OPINEL_VERSION, opinel_max_version, 'opinel'):
        return False
    if not check_versions(boto3_min_version, boto3.__version__, boto3_max_version, 'boto3'):
        return False
    return True
285652
def check(path_dir, requirements_name='requirements.txt'):
    ''''''
    requirements = _load_requirements(requirements_name, path_dir)
    imported_modules = _iter_modules(path_dir)
    installed_packages = _list_installed_packages()

    imported_modules.update(_excluded_imports())

    diff = {lib for lib in installed_packages if lib not in imported_modules}
    with_dependencies, _ = _list_dependencies(diff)
    unused_dependencies = sorted([d for d in diff if d in requirements])

    for unused_dependency in unused_dependencies:
        if with_dependencies.get(unused_dependency):
            print('    - {}'.format(unused_dependency))
            for dependency in with_dependencies.get(unused_dependency):
                print('\t - {}'.format(dependency))
        else:
            print('    - {}'.format(unused_dependency))
670495
def make_sure_path_exists(self, path):
        
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise
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
415147
def ensure_compliance(self):
        
        for p in self.paths:
            if os.path.exists(p):
                if self.is_compliant(p):
                    continue

                log('File %s is not in compliance.' % p, level=INFO)
            else:
                if not self.always_comply:
                    log("Non-existent path '%s' - skipping compliance check"
                        % (p), level=INFO)
                    continue

            if self._take_action():
                log("Applying compliance criteria to '%s'" % (p), level=INFO)
                self.comply(p)
1254266
def check_file_path(self, path):
        
        if os.path.exists(path) is not True:
            msg = "File Not Found {}".format(path)
            raise OSError(msg)
515566
def update_required(srcpth, dstpth):
    

    return not os.path.exists(dstpth) or \
        os.stat(srcpth).st_mtime > os.stat(dstpth).st_mtime