当前位置: 首页>>代码示例>>Python>>正文


Python compat.OrderedDict方法代码示例

本文整理汇总了Python中botocore.compat.OrderedDict方法的典型用法代码示例。如果您正苦于以下问题:Python compat.OrderedDict方法的具体用法?Python compat.OrderedDict怎么用?Python compat.OrderedDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botocore.compat的用法示例。


在下文中一共展示了compat.OrderedDict方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def __init__(self, name, section_names=None, target='man', context=None):
        """Provides a Hierarichial structure to a ReSTDocument

        You can write to it similiar to as you can to a ReSTDocument but
        has an innate structure for more orginaztion and abstraction.

        :param name: The name of the document
        :param section_names: A list of sections to be included
            in the document.
        :param target: The target documentation of the Document structure
        :param context: A dictionary of data to store with the strucuture. These
            are only stored per section not the entire structure.
        """
        super(DocumentStructure, self).__init__(target=target)
        self._name = name
        self._structure = OrderedDict()
        self._path = [self._name]
        self._context = {}
        if context is not None:
            self._context = context
        if section_names is not None:
            self._generate_structure(section_names) 
开发者ID:skarlekar,项目名称:faces,代码行数:24,代码来源:restdoc.py

示例2: load_file

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def load_file(self, file_path):
        """Attempt to load the file path.

        :type file_path: str
        :param file_path: The full path to the file to load without
            the '.json' extension.

        :return: The loaded data if it exists, otherwise None.

        """
        full_path = file_path + '.json'
        if not os.path.isfile(full_path):
            return

        # By default the file will be opened with locale encoding on Python 3.
        # We specify "utf8" here to ensure the correct behavior.
        with open(full_path, 'rb') as fp:
            payload = fp.read().decode('utf-8')
            logger.debug("Loading JSON file: %s", full_path)
            return json.loads(payload, object_pairs_hook=OrderedDict) 
开发者ID:skarlekar,项目名称:faces,代码行数:22,代码来源:loaders.py

示例3: build_model

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def build_model(self):
        """Build the model based on the provided members.

        :rtype: botocore.model.StructureShape
        :return: The built StructureShape object.

        """
        shapes = OrderedDict()
        denormalized = {
            'type': 'structure',
            'members': self._members,
        }
        self._build_model(denormalized, shapes, self.name)
        resolver = ShapeResolver(shape_map=shapes)
        return StructureShape(shape_name=self.name,
                              shape_model=shapes[self.name],
                              shape_resolver=resolver) 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:model.py

示例4: _build_emrfs_properties

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def _build_emrfs_properties(emrfs_args):
    """
    Assumption: emrfs_args is valid i.e. all required attributes are present
    """
    emrfs_properties = OrderedDict()

    if _need_to_configure_consistent_view(emrfs_args):
        _update_properties_for_consistent_view(emrfs_properties, emrfs_args)

    if _need_to_configure_sse(emrfs_args):
        _update_properties_for_sse(emrfs_properties, emrfs_args)

    if _need_to_configure_cse(emrfs_args, 'KMS'):
        _update_properties_for_cse(emrfs_properties, emrfs_args, 'KMS')

    if _need_to_configure_cse(emrfs_args, 'CUSTOM'):
        _update_properties_for_cse(emrfs_properties, emrfs_args, 'CUSTOM')

    if 'Args' in emrfs_args:
        for arg_value in emrfs_args.get('Args'):
            key, value = emrutils.split_to_key_value(arg_value)
            emrfs_properties[key] = value

    return emrfs_properties 
开发者ID:gkrizek,项目名称:bash-lambda-layer,代码行数:26,代码来源:emrfsutils.py

示例5: get_cluster_entry

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def get_cluster_entry(self):
        """
        Return a cluster entry generated using
        the previously obtained description.
        """

        cert_data = self._get_cluster_description().get("certificateAuthority",
                                                        {"data": ""})["data"]
        endpoint = self._get_cluster_description().get("endpoint")
        arn = self._get_cluster_description().get("arn")

        return OrderedDict([
            ("cluster", OrderedDict([
                ("certificate-authority-data", cert_data),
                ("server", endpoint)
            ])),
            ("name", arn)
        ]) 
开发者ID:gkrizek,项目名称:bash-lambda-layer,代码行数:20,代码来源:update_kubeconfig.py

示例6: _build_arg_table

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def _build_arg_table(self):
        arg_table = OrderedDict()
        self._session.emit('building-arg-table.%s' % self.NAME,
                           arg_table=self.ARG_TABLE)
        for arg_data in self.ARG_TABLE:

            # If a custom schema was passed in, create the argument_model
            # so that it can be validated and docs can be generated.
            if 'schema' in arg_data:
                argument_model = create_argument_model_from_schema(
                    arg_data.pop('schema'))
                arg_data['argument_model'] = argument_model
            custom_argument = CustomArgument(**arg_data)

            arg_table[arg_data['name']] = custom_argument
        return arg_table 
开发者ID:gkrizek,项目名称:bash-lambda-layer,代码行数:18,代码来源:commands.py

示例7: remove_all_sections

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def remove_all_sections(self):
        self._structure = OrderedDict() 
开发者ID:skarlekar,项目名称:faces,代码行数:4,代码来源:restdoc.py

示例8: _generate_type_structure

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def _generate_type_structure(self, shape, stack):
        if stack.count(shape.name) > 1:
            return {}
        skeleton = OrderedDict()
        for member_name, member_shape in shape.members.items():
            skeleton[member_name] = self._generate_skeleton(
                member_shape, stack, name=member_name)
        return skeleton 
开发者ID:skarlekar,项目名称:faces,代码行数:10,代码来源:utils.py

示例9: _generate_type_map

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def _generate_type_map(self, shape, stack):
        key_shape = shape.key
        value_shape = shape.value
        assert key_shape.type_name == 'string'
        return OrderedDict([
            ('KeyName', self._generate_skeleton(value_shape, stack)),
        ]) 
开发者ID:skarlekar,项目名称:faces,代码行数:9,代码来源:utils.py

示例10: __init__

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def __init__(self, name=None):
        self.members = OrderedDict()
        self._name_generator = ShapeNameGenerator()
        if name is None:
            self.name = self._name_generator.new_shape_name('structure') 
开发者ID:skarlekar,项目名称:faces,代码行数:7,代码来源:model.py

示例11: _build_structure

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def _build_structure(self, model, shapes):
        members = OrderedDict()
        shape = self._build_initial_shape(model)
        shape['members'] = members

        for name, member_model in model['members'].items():
            member_shape_name = self._get_shape_name(member_model)
            members[name] = {'shape': member_shape_name}
            self._build_model(member_model, shapes, member_shape_name)
        return shape 
开发者ID:skarlekar,项目名称:faces,代码行数:12,代码来源:model.py

示例12: build_policy

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def build_policy(self, resource, date_less_than,
                     date_greater_than=None, ip_address=None):
        """A helper to build policy.

        :type resource: str
        :param resource: The URL or the stream filename of the protected object

        :type date_less_than: datetime
        :param date_less_than: The URL will expire after the time has passed

        :type date_greater_than: datetime
        :param date_greater_than: The URL will not be valid until this time

        :type ip_address: str
        :param ip_address: Use 'x.x.x.x' for an IP, or 'x.x.x.x/x' for a subnet

        :rtype: str
        :return: The policy in a compact string.
        """
        # Note:
        # 1. Order in canned policy is significant. Special care has been taken
        #    to ensure the output will match the order defined by the document.
        #    There is also a test case to ensure that order.
        #    SEE: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html#private-content-canned-policy-creating-policy-statement
        # 2. Albeit the order in custom policy is not required by CloudFront,
        #    we still use OrderedDict internally to ensure the result is stable
        #    and also matches canned policy requirement.
        #    SEE: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html
        moment = int(datetime2timestamp(date_less_than))
        condition = OrderedDict({"DateLessThan": {"AWS:EpochTime": moment}})
        if ip_address:
            if '/' not in ip_address:
                ip_address += '/32'
            condition["IpAddress"] = {"AWS:SourceIp": ip_address}
        if date_greater_than:
            moment = int(datetime2timestamp(date_greater_than))
            condition["DateGreaterThan"] = {"AWS:EpochTime": moment}
        ordered_payload = [('Resource', resource), ('Condition', condition)]
        custom_policy = {"Statement": [OrderedDict(ordered_payload)]}
        return json.dumps(custom_policy, separators=(',', ':')) 
开发者ID:skarlekar,项目名称:faces,代码行数:42,代码来源:signers.py

示例13: __init__

# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import OrderedDict [as 别名]
def __init__(self, resource):
        self._resource = resource
        self._client = self._resource.meta.client
        self._resource_model = self._resource.meta.resource_model
        self._service_model = self._client.meta.service_model
        self._resource_name = self._resource.meta.resource_model.name
        self._service_name = self._service_model.service_name
        self._service_docs_name = self._client.__class__.__name__
        self.member_map = OrderedDict()
        self.represents_service_resource = (
            self._service_name == self._resource_name) 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:base.py


注:本文中的botocore.compat.OrderedDict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。