Converts type dependent record content into well formed and fully qualified
        content for domain zone and returns content.
353735
def _convert_content(self, rdtype, content):
        
        if rdtype == 'TXT':
            if content[0] != '"':
                content = '"' + content
            if content[-1] != '"':
                content += '"'
        if rdtype in ('CNAME', 'MX', 'NS', 'SRV'):
            if content[-1] != '.':
                content = self._fqdn_name(content)
        return content
1316728
def to_xdr_object(self):
        """"""
        return Xdr.types.Memo(type=Xdr.const.MEMO_TEXT, text=self.text)
288306
def create_record_set(self, rs_dict):
        """"""
        record_set_md5 = get_record_set_md5(rs_dict["Name"], rs_dict["Type"])
        rs = route53.RecordSetType.from_dict(record_set_md5, rs_dict)
        rs = add_hosted_zone_id_if_missing(rs, self.hosted_zone_id)
        rs = self.add_hosted_zone_id_for_alias_target_if_missing(rs)
        return self.template.add_resource(rs)
965660
def create_record(self, rtype, name, content, ttl):
        """"""
        version = None
        ret = False

        # This isn't quite "do nothing" if the record already exists.
        # In this case, no new record will be created, but a new zone version
        # will be created and set.
        try:
            version = self._api.domain.zone.version.new(
                self._api_key, self._zone_id)
            self._api.domain.zone.record.add(self._api_key, self._zone_id, version,
                                             {'type': rtype.upper(),
                                              'name': name,
                                              'value': content,
                                              'ttl': ttl
                                              })
            self._api.domain.zone.version.set(
                self._api_key, self._zone_id, version)
            ret = True

        finally:
            if not ret and version is not None:
                self._api.domain.zone.version.delete(
                    self._api_key, self._zone_id, version)

        LOGGER.debug("create_record: %s", ret)
        return ret
696517
def process_content_type(text)
      content = {}

      field_start = text.index(';')

      content['content-type'] = text[0 ... field_start].strip

      parts = text.split(';')

      parts.each do |part|
        (name, value) = part.gsub(/\"/, '').split('=')

        content[name.strip] = value ? value.strip : value
      end

      content
    end
11142
def reformat_record(record):
    """"""
    return {
        "key": record["dynamodb"].get("Keys", None),
        "new": record["dynamodb"].get("NewImage", None),
        "old": record["dynamodb"].get("OldImage", None),

        "meta": {
            "created_at": record["dynamodb"]["ApproximateCreationDateTime"],
            "event": {
                "id": record["eventID"],
                "type": record["eventName"].lower(),
                "version": record["eventVersion"]
            },
            "sequence_number": record["dynamodb"]["SequenceNumber"],
        }
    }
1319451
def specialize(self, domain):
        
        if domain == self.domain:
            return self

        return type(self)(
            dtype=self.dtype,
            missing_value=self.missing_value,
            dataset=self._dataset.specialize(domain),
            name=self._name,
            doc=self.__doc__,
            metadata=self._metadata,
        )
1165962
function generateRecordElements(recordElements)
        {
            var elements = '';
            for(var key in recordElements){
                var recordElement = recordElements[key];
                if(recordElement.hasOwnProperty('value'))
                {
                    elements += format('<q1:{0}>{1}</q1:{0}>', key, recordElement.value);
                }
                else if(recordElement.hasOwnProperty('node'))
                {
                    elements += recordElement.node;
                }
            };

            return elements;
        }
755404
def _list_records(self, rtype=None, name=None, content=None):
        """"""
        if self.protocol == 'rpc':
            return self.rpc_helper.list_records(rtype, name, content)

        try:
            if name is not None:
                if rtype is not None:
                    query_results = [self._get(
                        '/domains/{0}/records/{1}/{2}'
                        .format(self.domain_id, self._relative_name(name), rtype))]
                else:
                    query_results = self._get('/domains/{0}/records/{1}'
                                              .format(self.domain_id, self._relative_name(name)))
            else:
                query_results = self._get(
                    '/domains/{0}/records'.format(self.domain_id))
                if rtype is not None:
                    query_results = [
                        item for item in query_results if item['rrset_type'] == rtype]
        except requests.exceptions.HTTPError as error:
            if error.response.status_code == 404:
                query_results = []
            else:
                raise

        # convert records with multiple values into single-value records
        records = []
        for query_result in query_results:
            for value in query_result['rrset_values']:
                record = {
                    'type': query_result['rrset_type'],
                    'name': self._full_name(query_result['rrset_name']),
                    'ttl': query_result['rrset_ttl'],
                    'content': value,
                    'id': query_result['rrset_name'],
                }
                # cleanup potential quoting if suitable
                self._clean_TXT_record(record)
                records.append(record)
        # filter for content, if requested
        if content is not None:
            records = [
                record for record in records if record['content'] == content]
        LOGGER.debug('list_records: %s', records)
        return records
745207
def format_content_type(repo, content_type):
    
    storage_manager = StorageManager(repo)
    model_class = load_model_class(repo, content_type)
    return [dict(model_obj)
            for model_obj in storage_manager.iterate(model_class)]
1164313
def hostedzone_from_element(zone):
    
    return HostedZone(
        name=maybe_bytes_to_unicode(zone.find("Name").text).encode("ascii").decode("idna"),
        identifier=maybe_bytes_to_unicode(zone.find("Id").text).replace(u"/hostedzone/", u""),
        rrset_count=int(zone.find("ResourceRecordSetCount").text),
        reference=maybe_bytes_to_unicode(zone.find("CallerReference").text),
    )
1277570
def parse_create(prs, conn):
    
    prs_create = prs.add_parser(
        'create', help='create record of specific zone')
    set_option(prs_create, 'domain')
    conn_options(prs_create, conn)
    prs_create.set_defaults(func=create)
918267
def _prepare_record(record, index, doc_type):
        
        if current_app.config['INDEXER_REPLACE_REFS']:
            data = copy.deepcopy(record.replace_refs())
        else:
            data = record.dumps()

        data['_created'] = pytz.utc.localize(record.created).isoformat() \
            if record.created else None
        data['_updated'] = pytz.utc.localize(record.updated).isoformat() \
            if record.updated else None

        # Allow modification of data prior to sending to Elasticsearch.
        before_record_index.send(
            current_app._get_current_object(),
            json=data,
            record=record,
            index=index,
            doc_type=doc_type,
        )

        return data
998134
def _get_zone(self, domain, domain_id):
        
        api = self.api[self.account]
        for request in api['zone']['GET']:
            url = (request.copy()).get('url', '/').replace('<id>', domain_id)
            params = request.get('params', {}).copy()
            for param in params:
                params[param] = params[param].replace('<id>', domain_id)
            response = self._get(url, query_params=params)
        dom = Provider._filter_dom(response.text, api['filter'])
        zone_file_filter = [{'name': 'textarea', 'attrs': {'name': api['zone']['file']}}]
        zone_file = Provider._filter_dom(dom, zone_file_filter).renderContents().decode('UTF-8')
        hidden = Provider._extract_hidden_data(dom)
        zone = {'data': dns.zone.from_text(zone_file, origin=domain, relativize=False),
                'hidden': hidden}
        LOGGER.info('Hetzner => Get zone for domain %s', domain)
        return zone
1198322
def transform_record(self, pid, record, links_factory=None, **kwargs):
        """"""
        result = super(JSONLDTransformerMixin, self).transform_record(
            pid, record, links_factory, **kwargs
        )
        return self.transform_jsonld(result)
554997
def domain_records(self, domain_id):
        
        json = self.request('/domains/%s/records' % domain_id, method='GET')
        status = json.get('status')
        if status == 'OK':
            records_json = json.get('records', [])
            records = [Record.from_json(record) for record in records_json]
            return records
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))
1274934
def _prepare_domain(mapping):
        """"""
        # Parse the domain-directory mapping
        try:
            domain, dir = mapping.split(':')
        except ValueError:
            print("Please provide the sources in the form of '<domain>:<directory>'")
            sys.exit(1)

        try:
            default_language = settings.TRANSLATION_DOMAINS[domain]
        except KeyError:
            print("Unknown domain {domain}, check the settings file to make sure"
                  " this domain is set in TRANSLATION_DOMAINS".format(domain=domain))
            sys.exit(1)
        # Create a temporary file to hold the `.pot` file for this domain
        handle, path = tempfile.mkstemp(prefix='zengine_i18n_', suffix='.pot')
        return (domain, {
            'default': default_language,
            'pot': path,
            'source': dir,
        })