Check if the requirement is satisfied by the marker.

    This function checks for a given Requirement whether its environment marker
    is satisfied on the current platform. Currently only the python version and
    system platform are checked.
559240
def _requirement_filter_by_marker(req):
    # type: (pkg_resources.Requirement) -> bool
    
    if hasattr(req, 'marker') and req.marker:
        marker_env = {
            'python_version': '.'.join(map(str, sys.version_info[:2])),
            'sys_platform': sys.platform
        }
        if not req.marker.evaluate(environment=marker_env):
            return False
    return True
1179817
def validate(args):
    
    if args.format not in FORMATTERS:
        print(
            "Subtitle format not supported. "
            "Run with --list-formats to see all supported formats."
        )
        return False

    if args.src_language not in LANGUAGE_CODES.keys():
        print(
            "Source language not supported. "
            "Run with --list-languages to see all supported languages."
        )
        return False

    if args.dst_language not in LANGUAGE_CODES.keys():
        print(
            "Destination language not supported. "
            "Run with --list-languages to see all supported languages."
        )
        return False

    if not args.source_path:
        print("Error: You need to specify a source path.")
        return False

    return True
543870
def _fulfills_version_spec(versions, oper, desired_version,
                           ignore_epoch=False):
    '''
    
    '''
    cmp_func = __salt__.get('pkg.version_cmp')
    # stripping "with_origin" dict wrapper
    if salt.utils.platform.is_freebsd():
        if isinstance(versions, dict) and 'version' in versions:
            versions = versions['version']
    for ver in versions:
        if (oper == '==' and fnmatch.fnmatch(ver, desired_version)) \
                or salt.utils.versions.compare(ver1=ver,
                                               oper=oper,
                                               ver2=desired_version,
                                               cmp_func=cmp_func,
                                               ignore_epoch=ignore_epoch):
            return True
    return False
606001
def check_dependencies(specs)
      missing = check_app_requirement(specs)

      present = exclude_specs(installed, specs)
      future = present + specs

      check_all_dependencies(specs, future, missing)
    end
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()
    )
7842
private boolean checkPlugin(final String currentPlugin) {
        final Features pluginFeatures = pluginTable.get(currentPlugin);
        final Iterator<PluginRequirement> iter = pluginFeatures.getRequireListIter();
        // check whether dependcy is satisfied
        while (iter.hasNext()) {
            boolean anyPluginFound = false;
            final PluginRequirement requirement = iter.next();
            final Iterator<String> requiredPluginIter = requirement.getPlugins();
            while (requiredPluginIter.hasNext()) {
                // Iterate over all alternatives in plugin requirement.
                final String requiredPlugin = requiredPluginIter.next();
                if (pluginTable.containsKey(requiredPlugin)) {
                    if (!loadedPlugin.contains(requiredPlugin)) {
                        // required plug-in is not loaded
                        loadPlugin(requiredPlugin);
                    }
                    // As soon as any plugin is found, it's OK.
                    anyPluginFound = true;
                }
            }
            if (!anyPluginFound && requirement.getRequired()) {
                // not contain any plugin required by current plugin
                final String msg = MessageUtils.getMessage("DOTJ020W", requirement.toString(), currentPlugin).toString();
                throw new RuntimeException(msg);
            }
        }
        return true;
    }
1106353
def validate_api_compatibility(args):
  
  if args.api_version and args.api_version < MINIMUM_SUPPORTED_API_VERSION:
    print("ERROR: Given API version: {0}. Minimum supported API version: {1}"
          .format(args.api_version, MINIMUM_SUPPORTED_API_VERSION))
1089825
def check_marker_kwargs(self, kwargs):
        
        text = kwargs.get("text", "")
        if not isinstance(text, str) and text is not None:
            raise TypeError("text argument is not of str type")
        for color in (item for item in (prefix + color for prefix in ["active_", "hover_", ""]
                                        for color in ["background", "foreground", "outline"])):
            value = kwargs.get(color, "")
            if value == "default":
                continue
            if not isinstance(value, str):
                raise TypeError("{} argument not of str type".format(color))
        font = kwargs.get("font", ("default", 10))
        if (not isinstance(font, tuple) or not len(font) > 0 or not isinstance(font[0], str)) and font != "default":
            raise ValueError("font argument is not a valid font tuple")
        for border in (prefix + "border" for prefix in ["active_", "hover_", ""]):
            border_v = kwargs.get(border, 0)
            if border_v == "default":
                continue
            if not isinstance(border_v, int) or border_v < 0:
                raise ValueError("{} argument is not of int type or smaller than zero".format(border))
        iid = kwargs.get("iid", "-1")
        if not isinstance(iid, str):
            raise TypeError("iid argument not of str type")
        if iid == "":
            raise ValueError("iid argument empty string")
        for boolean_arg in ["move", "category_change", "allow_overlap", "snap_to_ticks"]:
            value = kwargs.get(boolean_arg, False)
            if value == "default":
                continue
            if not isinstance(value, bool):
                raise TypeError("{} argument is not of bool type".format(boolean_arg))
        tags = kwargs.get("tags", ())
        if not isinstance(tags, tuple):
            raise TypeError("tags argument is not of tuple type")
        for tag in tags:
            if not isinstance(tag, str):
                raise TypeError("one or more values in tags argument is not of str type")
            if tag not in self._tags:
                raise ValueError("unknown tag in tags argument")
877258
def get_agent_requirement_line(check, version):
    
    package_name = get_package_name(check)

    # no manifest
    if check in ('datadog_checks_base', 'datadog_checks_downloader'):
        return '{}=={}'.format(package_name, version)

    m = load_manifest(check)
    platforms = sorted(m.get('supported_os', []))

    # all platforms
    if platforms == ALL_PLATFORMS:
        return '{}=={}'.format(package_name, version)
    # one specific platform
    elif len(platforms) == 1:
        return "{}=={}; sys_platform == '{}'".format(package_name, version, PLATFORMS_TO_PY.get(platforms[0]))
    elif platforms:
        if 'windows' not in platforms:
            return "{}=={}; sys_platform != 'win32'".format(package_name, version)
        elif 'mac_os' not in platforms:
            return "{}=={}; sys_platform != 'darwin'".format(package_name, version)
        elif 'linux' not in platforms:
            return "{}=={}; sys_platform != 'linux2'".format(package_name, version)

    raise ManifestError("Can't parse the `supported_os` list for the check {}: {}".format(check, platforms))
179229
def check(self, version):  # Ignore PyDocStyleBear
        

        def _compare_spec(spec):
            if len(spec) == 1:
                spec = ("=", spec[0])

            token = Tokens.operators.index(spec[0])
            comparison = compare_version(version, spec[1])
            if token in [Tokens.EQ1, Tokens.EQ2]:
                return comparison == 0
            elif token == Tokens.GT:
                return comparison == 1
            elif token == Tokens.LT:
                return comparison == -1
            elif token == Tokens.GTE:
                return comparison >= 0
            elif token == Tokens.LTE:
                return comparison <= 0
            elif token == Tokens.NEQ:
                return comparison != 0
            else:
                raise ValueError("Invalid comparison token")

        results, intermediaries = False, False
        for spec in self.spec:
            if isinstance(spec, list):
                intermediary = True
                for sub in spec:
                    intermediary &= _compare_spec(sub)
                intermediaries |= intermediary
            elif isinstance(spec, tuple):
                results |= _compare_spec(spec)

        return results or intermediaries
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))
848616
def _has_requirements(self):
        
        self._closed()

        return any([self.has_workflow_step, self.has_scatter_requirement,
                   self.has_multiple_inputs])
213897
private static boolean check(
            final double pXA, final double pYA, final double pXB, final double pYB,
            final double pXC, final double pYC, final double pXD, final double pYD,
            final PointL pIntersection,
            final double pXI, final double pYI
    ) {
        if (pXI < Math.min(pXA, pXB) || pXI > Math.max(pXA, pXB)) {
            return false;
        }
        if (pXI < Math.min(pXC, pXD) || pXI > Math.max(pXC, pXD)) {
            return false;
        }
        if (pYI < Math.min(pYA, pYB) || pYI > Math.max(pYA, pYB)) {
            return false;
        }
        if (pYI < Math.min(pYC, pYD) || pYI > Math.max(pYC, pYD)) {
            return false;
        }
        if (pIntersection != null) {
            pIntersection.x = Math.round(pXI);
            pIntersection.y = Math.round(pYI);
        }
        return true;
    }
1067544
function checkRequirements () {
      // Check if git version meets requirements
      var gitVersion = (shelljs.exec('git --version', {silent: true}).output.match(/\d+\.\d+\.\d+/) || []).shift();
      if (!gitVersion || semver.lt(gitVersion, '1.8.0')) {
        throw('Current Git version is ' + gitVersion + '. This plugin requires Git >= 1.8.0.');
      }

      // Check that build directory exists
      if (!fs.existsSync(options.dir)) {
        throw('Build directory "' + options.dir + '" doesn\'t exist. Nothing to version.');
      }

      // Check that build directory conteins files
      if (fs.readdirSync(options.dir).length === 0) {
        throw('Build directory "' + options.dir + '" is empty. Nothing to version.');
      }

      // If connectCommits is true check that the main project's working
      // directory is clean
      if (options.connectCommits) {
        var gitDiffOutput = shelljs.exec('git diff').output;
        if (gitDiffOutput !== '') {
          throw ('There are uncommitted changes in your working directory. \n' +
          'Please commit changes to the main project before you commit to \n' +
          'the built code.\n');
        }
      }

      if (options.shallowFetch && semver.lt(gitVersion, '1.9.0')) {
        throw('Current Git version is ' + gitVersion + '. Option "shallowFetch" is supported on Git >= 1.9.0.');
      }
    }
1052487
public boolean isApplicable(IMarker marker) {
        ASTVisitor prescanVisitor = getApplicabilityVisitor();
        if (prescanVisitor instanceof ApplicabilityVisitor) {       //this has an implicit null check
            return findApplicability(prescanVisitor, marker);
        }
        return true;
    }
1059381
def prerequisite_check():
    

    # Check Python version
    if sys.version_info < (3, 6):
        version_str = "%s.%s.%s" % sys.version_info[:3]
        # TRANSLATORS: This word is used as a part of search query suggested to users,
        # it may appears in context like "Ubuntu 16.04 install Python 3.7"
        search_url = build_search_query(_("install") + " Python 3.7")
        return _("EH Forwarder Bot requires a minimum of Python 3.6 to run.  You "
                 "are currently using Python {version}. \n"
                 "\n"
                 "You may want to try:\n"
                 "{url}").format(version=version_str, url=search_url)

    # Check installations of modules
    modules_err = _("You may want to visit the modules repository to find a list of "
                    "available modules to install.\n"
                    "https://github.com/blueset/ehForwarderBot/wiki/Channels-Repository")
    # 1. At least 1 master channel must be installed
    try:
        next(pkg_resources.iter_entry_points("ehforwarderbot.master"))
    except StopIteration:
        return _("No master channel detected.  EH Forwarder Bot requires at least one "
                 "master channel installed to run.") + "\n\n" + modules_err

    # 2. At least 1 slave channel must be installed
    try:
        next(pkg_resources.iter_entry_points("ehforwarderbot.slave"))
    except StopIteration:
        return _("No slave channel detected.  EH Forwarder Bot requires at least one "
                 "slave channel installed to run.") + "\n\n" + modules_err
523031
def check_other(self):
        
        if self.reqs:
            self.stdout.write(self.style.ERROR("\nOnly pypi and github based requirements are supported:"))
            for name, req in self.reqs.items():
                if "dist" in req:
                    pkg_info = "{dist.project_name} {dist.version}".format(dist=req["dist"])
                elif "url" in req:
                    pkg_info = "{url}".format(url=req["url"])
                else:
                    pkg_info = "unknown package"
                self.stdout.write(self.style.BOLD("{pkg_info:40} is not a pypi or github requirement".format(pkg_info=pkg_info)))