Gets all the license information and stores it in json format
336323
def main():
  """"""

  all_summary = {}

  for license in RESOURCES:

    req = requests.get(RESOURCES[license])

    if req.status_code == requests.codes.ok:
      summary = get_summary(req.text)
      can, cannot, must = get_rules(license)

      all_summary[license] = {
          "summary": summary,
          "source": RESOURCES[license],
          "can": can,
          "cannot": cannot,
          "must": must
      }

  with open('summary.json', 'w+') as f:
    f.write(json.dumps(all_summary, indent=4))
982414
def json_data(self):
        """"""
        return {
            "type": self.type,
            "origin_id": self.origin_id,
            "network_id": self.network_id,
            "contents": self.contents,
        }
765921
def spl_json(self):
        """"""
        _splj = {}
        _splj["type"] = self._type
        _splj["value"] = self._value
        return _splj
600172
def _get_licences():
  
  licenses = _LICENSES

  for license in licenses:
    print("{license_name} [{license_code}]".format(
          license_name=licenses[license], license_code=license))
742977
def get_license(name):
    '''
    
    '''

    filenames = os.listdir(cwd + licenses_loc)
    licenses = dict(zip(filenames, [-1] * len(filenames)))

    for l in licenses:
        licenses[l] = compute_distance(name, l)

    return min(licenses, key=(lambda k: licenses[k]))
517147
def json(self):
        """"""
        d = { 'id': self.id, 'format': self.formatclass.__name__,'label': self.label, 'mimetype': self.formatclass.mimetype,  'schema': self.formatclass.schema }
        if self.unique:
            d['unique'] = True
        if self.filename:
            d['filename'] = self.filename
        if self.extension:
            d['extension'] = self.extension
        if self.acceptarchive:
            d['acceptarchive'] = self.acceptarchive
        #d['parameters'] = {}

        #The actual parameters are included as XML, and transformed by clam.js using XSLT (parameter.xsl) to generate the forms
        parametersxml = ''
        for parameter in self.parameters:
            parametersxml += parameter.xml()
        d['parametersxml'] = '<?xml version="1.0" encoding="utf-8" ?><parameters>' + parametersxml + '</parameters>'
        d['converters'] = [ {'id':x.id, 'label':x.label} for x in self.converters ]
        d['inputsources'] = [ {'id':x.id, 'label':x.label} for x in self.inputsources ]

        return json.dumps(d)
467260
def to_json(self, include_id: bool = False):
        
        result = {
            METADATA_NAME: self.name,
            METADATA_VERSION: self.version,
        }

        if self.created:
            result['created'] = str(self.created)

        if include_id:
            result['id'] = self.id

        if self.authors:
            result[METADATA_AUTHORS] = self.authors

        if self.contact:
            result[METADATA_CONTACT] = self.contact

        if self.description:
            result[METADATA_DESCRIPTION] = self.description

        if self.copyright:
            result[METADATA_COPYRIGHT] = self.copyright

        if self.disclaimer:
            result[METADATA_DISCLAIMER] = self.disclaimer

        if self.licenses:
            result[METADATA_LICENSES] = self.licenses

        return result
672919
private function fetch_license_by_key( $license_id, $license_key ) {
            $this->_logger->entrance();

            $api = $this->get_current_or_network_user_api_scope();

            $result = $api->get( "/licenses/{$license_id}.json?license_key=" . urlencode( $license_key ) );

            return $this->is_api_result_entity( $result ) ?
                new FS_Plugin_License( $result ) :
                $result;
        }
1244870
def get_license(self):
        
        if 'license' in self.my_osid_object._my_map:
            license_text = self.my_osid_object._my_map['license']
            return DisplayText(display_text_map=license_text)
        return DisplayText(text='',
                           language_type=DEFAULT_LANGUAGE_TYPE,
                           format_type=DEFAULT_FORMAT_TYPE,
                           script_type=DEFAULT_SCRIPT_TYPE)
947479
def list_licenses(page_size=200, page_index=0, sort="", q=""):
    
    response = utils.checked_api_call(pnc_api.licenses, 'get_all', page_size=page_size, page_index=page_index, sort=sort, q=q)
    if response:
        return utils.format_json_list(response.content)
1273323
def get_repo_info(loader, sha, prov_g):
    """"""
    user_repo = loader.getFullName()
    repo_title = loader.getRepoTitle()
    contact_name = loader.getContactName()
    contact_url = loader.getContactUrl()
    commit_list = loader.getCommitList()
    licence_url = loader.getLicenceURL()

    # Add the API URI as a used entity by the activity
    if prov_g:
        prov_g.add_used_entity(loader.getRepoURI())

    prev_commit = None
    next_commit = None
    version = sha if sha else commit_list[0]
    if commit_list.index(version) < len(commit_list) - 1:
        prev_commit = commit_list[commit_list.index(version) + 1]
    if commit_list.index(version) > 0:
        next_commit = commit_list[commit_list.index(version) - 1]

    info = {
        'version': version,
        'title': repo_title,
        'contact': {
            'name': contact_name,
            'url': contact_url
        },
        'license': {
            'name': 'License',
            'url': licence_url
        }
    }

    basePath = '/api/' + user_repo + '/'
    basePath += ('commit/' + sha + '/') if sha else ''

    return prev_commit, next_commit, info, basePath
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),
1034257
def ToJson(self):
        
        jsn = super(RegisterTransaction, self).ToJson()

        asset = {
            'type': self.AssetType,
            'name': self.Name.decode('utf-8'),
            'amount': self.Amount.value,
            'precision': self.Precision if type(self.Precision) is int else self.Precision.decode('utf-8'),
            'owner': self.Owner.ToString(),
            'admin': Crypto.ToAddress(self.Admin)
        }
        jsn['asset'] = asset

        return jsn
355578
def list_licenses(service_instance=None):
    '''
    
    '''
    log.trace('Retrieving all licenses')
    licenses = salt.utils.vmware.get_licenses(service_instance)
    ret_dict = [{'key': l.licenseKey,
                 'name': l.name,
                 'description': l.labels[0].value if l.labels else None,
                 # VMware handles unlimited capacity as 0
                 'capacity': l.total if l.total > 0 else sys.maxsize,
                 'used': l.used if l.used else 0}
                 for l in licenses]
    return ret_dict
173407
def json_data(self):
        """"""
        return {
            "info_in_id": self.info_in_id,
            "info_out_id": self.info_out_id,
            "node_id": self.node_id,
            "network_id": self.network_id,
        }
350401
function () {
        var pkg = require(process.cwd() + '/package.json');
        var licenses = [];
        pkg.licenses.forEach(function (license) {
            licenses.push(license.type);
        });

        return '/*! ' + pkg.name + ' - v' + pkg.version + ' - ' + gutil.date("yyyy-mm-dd") + "\n" +
            (pkg.homepage ? "* " + pkg.homepage + "\n" : "") +
            '* Copyright (c) ' + gutil.date("yyyy") + ' ' + pkg.author.name +
            '; Licensed ' + licenses.join(', ') + ' */\n';
    }
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())