No arguments: Get the document's license from metadata
           Argument: Set the document's license in metadata
501656
def license(self, value=None):
        
        if not (value is None):
            if (self.metadatatype == "native"):
                self.metadata['license'] = value
            else:
                self._license = value
        if (self.metadatatype == "native"):
            if 'license' in self.metadata:
                return self.metadata['license']
            else:
                return None
        else:
            return self._license
465812
def update_license(self, license_text):
    
    content = (
        '--MULTI_BOUNDARY',
        'Content-Disposition: form-data; name="license"',
        '',
        license_text,
        '--MULTI_BOUNDARY--',
        '')
    resp = self._get_resource_root().post('cm/license',
        data="\r\n".join(content),
        contenttype='multipart/form-data; boundary=MULTI_BOUNDARY')
    return ApiLicense.from_json_dict(resp, self._get_resource_root())
1345398
def initialize_metadata
      metadata_path = self.path.join(METADATA_FILE)

      self.title       = self.name
      self.description = nil
      self.license     = nil

      self.source  = self.uri
      self.website = self.source
      self.authors.clear

      if File.file?(metadata_path)
        metadata = YAML.load_file(metadata_path)

        if (title = metadata['title'])
          self.title = title
        end

        if (description = metadata['description'])
          self.description = description
        end

        if (license = metadata['license'])
          self.license = License.first_or_predefined(:name => license)
        end

        if (uri = metadata['uri'])
          self.uri ||= uri
        end

        if (source = metadata['source'])
          self.source = source
        end

        if (website = metadata['website'])
          self.website = website
        end

        case metadata['authors']
        when Hash
          metadata['authors'].each do |name,email|
            self.authors << Author.first_or_new(:name => name, :email => email)
          end
        when Array
          metadata['authors'].each do |name|
            self.authors << Author.first_or_new(:name => name)
          end
        end
      end

      return self
    end
805689
def update_license(license_id, **kwargs):
    
    updated_license = pnc_api.licenses.get_specific(id=license_id).content

    for key, value in iteritems(kwargs):
        if value:
            setattr(updated_license, key, value)

    response = utils.checked_api_call(
        pnc_api.licenses,
        'update',
        id=int(license_id),
        body=updated_license)
    if response:
        return utils.format_json(response.content)
744947
def get_license(self):
        
        if 'license' in self._my_map:
            license_text = self._my_map['license']
            return DisplayText(display_text_map=license_text)
        return DisplayText(text='',
                           language_type=types.Language().get_type_data('DEFAULT'),
                           format_type=types.Format().get_type_data('DEFAULT'),
                           script_type=types.Script().get_type_data('DEFAULT'))
77101
def set_metadata_from_collection(self, text_metadata: CtsTextMetadata):
        
        edition, work, textgroup = tuple(([text_metadata] + text_metadata.parents)[:3])

        for node in textgroup.metadata.get(RDF_NAMESPACES.CTS.groupname):
            lang = node.language
            self.metadata.add(RDF_NAMESPACES.CTS.groupname, lang=lang, value=str(node))
            self.set_creator(str(node), lang)

        for node in work.metadata.get(RDF_NAMESPACES.CTS.title):
            lang = node.language
            self.metadata.add(RDF_NAMESPACES.CTS.title, lang=lang, value=str(node))
            self.set_title(str(node), lang)

        for node in edition.metadata.get(RDF_NAMESPACES.CTS.label):
            lang = node.language
            self.metadata.add(RDF_NAMESPACES.CTS.label, lang=lang, value=str(node))
            self.set_subject(str(node), lang)

        for node in edition.metadata.get(RDF_NAMESPACES.CTS.description):
            lang = node.language
            self.metadata.add(RDF_NAMESPACES.CTS.description, lang=lang, value=str(node))
            self.set_description(str(node), lang)

        if not self.citation.is_set() and edition.citation.is_set():
            self.citation = edition.citation
119354
private ExtensionLicense getExtensionLicense(License license)
    {
        if (license.getName() == null) {
            return new ExtensionLicense("noname", null);
        }

        return createLicenseByName(license.getName());
    }
104299
def get_license_summary(license_code):
  
  try:
    abs_file = os.path.join(_ROOT, "summary.json")
    with open(abs_file, 'r') as f:
      summary_license = json.loads(f.read())[license_code]

    # prints summary
    print(Fore.YELLOW + 'SUMMARY')
    print(Style.RESET_ALL),
    print(summary_license['summary'])

    # prints source for summary
    print(Style.BRIGHT + 'Source:'),
    print(Style.RESET_ALL),
    print(Fore.BLUE + summary_license['source'])
    print(Style.RESET_ALL)

    # prints cans
    print(Fore.GREEN + 'CAN')
    print(Style.RESET_ALL),
    for rule in summary_license['can']:
      print(rule)
    print('')

    # prints cannot
    print(Fore.RED + 'CANNOT')
    print(Style.RESET_ALL),
    for rule in summary_license['cannot']:
      print(rule)
    print('')

    # prints musts
    print(Fore.BLUE + 'MUST')
    print(Style.RESET_ALL),
    for rule in summary_license['must']:
      print(rule)
    print('')

  except KeyError:
    print(Fore.RED + 'No such license. Please check again.'),
    print(Style.RESET_ALL),
271367
def get_license(self):
        

        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/license"
        )
        return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
664435
def license_object(infos)
      {
        name: infos.delete(:license),
        url: infos.delete(:license_url)
      }.delete_if { |_, value| value.blank? }
    end
120502
def build_license_file(directory, spec):
    
    name, text = '', ''

    try:
        name = spec['LICENSE']
        text = spec['X_MSI_LICENSE_TEXT']
    except KeyError:
        pass # ignore this as X_MSI_LICENSE_TEXT is optional

    if name!='' or text!='':
        file = open( os.path.join(directory.get_path(), 'License.rtf'), 'w' )
        file.write('{\\rtf')
        if text!='':
             file.write(text.replace('\n', '\\par '))
        else:
             file.write(name+'\\par\\par')
        file.write('}')
        file.close()
1268747
def set_license(self, key):
        
        data = {'LicenseKey': key}
        license_service_uri = (utils.get_subresource_path_by(self,
                               ['Oem', 'Hpe', 'Links', 'LicenseService']))
        self._conn.post(license_service_uri, data=data)
904043
def set_metadata(self, key: str, value: str):
        
        if not isinstance(key, str) or not isinstance(value, str):
            raise TypeError("'key' and 'value' of metadata MUST be strings")
        self.metadata[key] = value
1248530
def license2marc(self, key, value):
    """"""
    return {
        'a': value.get('license'),
        'b': value.get('imposing'),
        'u': value.get('url'),
        '3': value.get('material'),
    }
93902
def raw_content
      return if pseudo_license?
      unless File.exist?(path)
        raise Licensee::InvalidLicense, "'#{key}' is not a valid license key"
      end

      @raw_content ||= File.read(path, encoding: 'utf-8')
    end
129077
def _set_blob_metadata(self, ud, metadata):
        # type: (Uploader, blobxfer.models.upload.Descriptor, dict) -> None
        
        blobxfer.operations.azure.blob.set_blob_metadata(ud.entity, metadata)
        if blobxfer.util.is_not_empty(ud.entity.replica_targets):
            for ase in ud.entity.replica_targets:
                blobxfer.operations.azure.blob.set_blob_metadata(ase, metadata)
1236086
def metadata=(metadata)
      @metadata = metadata.map { |k, str| [k, str.to_s] }.to_h
    end