Returns SystemRequirementsDict encapsulating system requirements.
        It can extract only entrypoints with specific fields ('clusterSpec',
        'instanceType', etc), depending on the value of _type.
540597
def from_sys_requirements(cls, system_requirements, _type='all'):
        
        if _type not in ('all', 'clusterSpec', 'instanceType'):
            raise DXError("Expected '_type' to be either 'all', 'clusterSpec', or 'instanceType'")

        if _type == 'all':
            return cls(system_requirements)

        extracted = defaultdict(dict)
        for entrypoint, req in system_requirements.items():
            if _type in req:
                extracted[entrypoint][_type] = req[_type]
        return cls(dict(extracted))
691339
def select_resources(self, request, runtime_context):  # pylint: disable=unused-argument
        # type: (Dict[str, int], RuntimeContext) -> Dict[str, int]
        
        result = {}  # type: Dict[str, int]
        maxrsc = {
            "cores": self.max_cores,
            "ram": self.max_ram
        }
        for rsc in ("cores", "ram"):
            if request[rsc+"Min"] > maxrsc[rsc]:
                raise WorkflowException(
                    "Requested at least %d %s but only %d available" %
                    (request[rsc+"Min"], rsc, maxrsc[rsc]))
            if request[rsc+"Max"] < maxrsc[rsc]:
                result[rsc] = request[rsc+"Max"]
            else:
                result[rsc] = maxrsc[rsc]

        return result
141207
async def InstanceTypes(self, constraints):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Cloud',
                   request='InstanceTypes',
                   version=1,
                   params=_params)
        _params['constraints'] = constraints
        reply = await self.rpc(msg)
        return reply
250367
def get_environment_requirements_list():
    
    requirement_list = []
    requirements = check_output([sys.executable, '-m', 'pip', 'freeze'])

    for requirement in requirements.split():
        requirement_list.append(requirement.decode("utf-8"))

    return requirement_list
957416
def get_setup_requires():
    
    # don't force requirements if just asking for help
    if {'--help', '--help-commands'}.intersection(sys.argv):
        return list()

    # otherwise collect all requirements for all known commands
    reqlist = []
    for cmd, dependencies in SETUP_REQUIRES.items():
        if cmd in sys.argv:
            reqlist.extend(dependencies)

    return reqlist
1260545
def parse_specs(cls, target_specs, build_root=None, exclude_patterns=None, tags=None):
    
    build_root = build_root or get_buildroot()
    spec_parser = CmdLineSpecParser(build_root)

    dependencies = tuple(OrderedSet(spec_parser.parse_spec(spec_str) for spec_str in target_specs))
    return Specs(
      dependencies=dependencies,
      exclude_patterns=exclude_patterns if exclude_patterns else tuple(),
      tags=tags)
255191
def _get_implicit_requirements(
        self,
        fields,
        requirements
    ):
        """"""
        for name, field in six.iteritems(fields):
            source = field.source
            # Requires may be manually set on the field -- if not,
            # assume the field requires only its source.
            requires = getattr(field, 'requires', None) or [source]
            for require in requires:
                if not require:
                    # ignore fields with empty source
                    continue

                requirement = require.split('.')
                if requirement[-1] == '':
                    # Change 'a.b.' -> 'a.b.*',
                    # supporting 'a.b.' for backwards compatibility.
                    requirement[-1] = '*'
                requirements.insert(requirement, TreeMap(), update=True)
782338
def _system_parameters(**kwargs):
    
    return {key: value for key, value in kwargs.items()
            if (value is not None or value == {})}
699121
def _system(self, *args, **kwargs):
        '''
        
        '''
        sysinfo = SysInfo(__grains__.get("kernel"))

        data = dict()
        data['cpu'] = sysinfo._get_cpu()
        data['disks'] = sysinfo._get_fs()
        data['mounts'] = sysinfo._get_mounts()
        data['memory'] = sysinfo._get_mem()
        data['network'] = sysinfo._get_network()
        data['os'] = sysinfo._get_os()

        return data
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
7893
def as_tuple(ireq):
    

    if not is_pinned_requirement(ireq):
        raise TypeError("Expected a pinned InstallRequirement, got {}".format(ireq))

    name = key_from_req(ireq.req)
    version = first(ireq.specifier._specs)._spec[1]
    extras = tuple(sorted(ireq.extras))
    return name, version, extras
1154788
def get_requirements(source):
    

    install_reqs = parse_requirements(filename=source, session=PipSession())

    return [str(ir.req) for ir in install_reqs]
850580
def avail_sizes(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_sizes function must be called with '
            '-f or --function, or with the --list-sizes option'
        )

    params = {'Action': 'DescribeInstanceTypes'}
    items = query(params=params)

    ret = {}
    for image in items['InstanceTypes']['InstanceType']:
        ret[image['InstanceTypeId']] = {}
        for item in image:
            ret[image['InstanceTypeId']][item] = six.text_type(image[item])

    return ret
1360199
def get_requirements():
    

    requirements = []
    with open(
        os.path.join(BASE_DIRECTORY, 'requirements.txt'),
        'r',
        encoding='utf-8'
    ) as requirements_file:
        lines = requirements_file.readlines()
        for line in lines:
            requirements.append(line.strip())
    return requirements
1196606
def get_system_properties(server=None):
    '''
    
    '''
    properties = {}
    data = _api_get('system-properties', server)

    # Get properties into a dict
    if any(data['extraProperties']['systemProperties']):
        for element in data['extraProperties']['systemProperties']:
            properties[element['name']] = element['value']
        return properties
    return {}
215293
def subsystems(self):
    """"""
    ret = set()
    for task_type in self.task_types():
      ret.update([dep.subsystem_cls for dep in task_type.subsystem_dependencies_iter()])
    return ret
1236103
def required_types(self):
        
        required_types = set(x.type for x in self.params)
        required_types.add(self.type)
        required_types.discard(None)
        return required_types