Upgrade to the latest NRML version
547673
def upgrade_file(path, multipoint):
    """"""
    node0 = nrml.read(path, chatty=False)[0]
    shutil.copy(path, path + '.bak')  # make a backup of the original file
    tag = striptag(node0.tag)
    gml = True
    if tag == 'vulnerabilityModel':
        vf_dict, cat_dict = get_vulnerability_functions_04(path)
        # below I am converting into a NRML 0.5 vulnerabilityModel
        node0 = Node(
            'vulnerabilityModel', cat_dict,
            nodes=[obj_to_node(val) for val in vf_dict.values()])
        gml = False
    elif tag == 'fragilityModel':
        node0 = read_nrml.convert_fragility_model_04(
            nrml.read(path)[0], path)
        gml = False
    elif tag == 'sourceModel':
        node0 = nrml.read(path)[0]
        dic = groupby(node0.nodes, operator.itemgetter('tectonicRegion'))
        node0.nodes = [Node('sourceGroup',
                            dict(tectonicRegion=trt, name="group %s" % i),
                            nodes=srcs)
                       for i, (trt, srcs) in enumerate(dic.items(), 1)]
        if multipoint:
            sourceconverter.update_source_model(node0, path + '.bak')
    with open(path, 'wb') as f:
        nrml.write([node0], f, gml=gml)
382845
def upgrade_api(request, client, version):
    """"""

    min_ver, max_ver = api_versions._get_server_version_range(client)
    if min_ver <= api_versions.APIVersion(version) <= max_ver:
        client = _nova.novaclient(request, version)
    return client
428028
private function _upgrade3 ()
    {
	    $craft    = \Craft::$app;
	    $elements = $craft->elements;

	    // 1. Store the old data
	    echo '    > Start map data upgrade' . PHP_EOL;

	    $rows = (new Query())
		    ->select([
		    	'ownerId',
			    'ownerSiteId',
			    'fieldId',
			    'lat',
			    'lng',
			    'zoom',
			    'address',
			    'parts',
		    ])
		    ->from(Map::TableName)
		    ->all();

	    // 2. Re-create the table
	    $this->dropTable(Map::TableName);
	    (new Install())->safeUp();

	    // 3. Store the old data as new
	    foreach ($rows as $row)
	    {
		    echo '    > Upgrade map value ' . $row['address'] . PHP_EOL;

		    $map = new MapElement($row);

		    if (!$map->zoom)
		    	$map->zoom = 15;

		    $elements->saveElement($map, false);
	    }

	    // 4. Update field settings
	    echo '    > Upgrade map field type upgrade' . PHP_EOL;

	    $rows = (new Query())
		    ->select(['id', 'settings', 'handle'])
		    ->from(Table::FIELDS)
		    ->where(['type' => MapField::class])
		    ->all();

	    foreach ($rows as $row)
	    {
		    echo '    > Upgrade map field ' . $row['handle'] . PHP_EOL;

		    $id          = $row['id'];
		    $oldSettings = Json::decodeIfJson($row['settings']);

		    $newSettings = [
			    'lat'     => $oldSettings['lat'],
			    'lng'     => $oldSettings['lng'],
			    'zoom'    => $oldSettings['zoom'] ?? 15,
			    'country' => strtoupper($oldSettings['countryRestriction']),
			    'hideMap' => $oldSettings['hideMap'],
		    ];

		    $this->db->createCommand()
				->update(
					Table::FIELDS,
					[ 'settings' => Json::encode($newSettings) ],
					compact('id')
				)
				->execute();
	    }

	    $this->updatePluginSettings();
    }
618142
public function Upgrade172to181()
    {
        $this->_batch->addTask('Db_CreateNewTables');
        $this->_batch->addTask('Db_AddPatches', 59);

        $this->_batch->addTask('Echo', $this->_('Make sure to read the changelog as it contains important instructions'));
        $this->_batch->addTask('Echo', $this->_('Check the Code compatibility report for any issues with project specific code!'));

        return true;
    }
1360493
def update(data_dir):
    """"""
    try:
        license_updated = update_license_file(data_dir)
    except URLError:
        click.secho('Error: unable to fetch newest license.', fg='red')
        exit(1)
    except (IOError, OSError):
        click.secho('Error: unable to move license to data directory.',
                    fg='red')
        exit(1)

    if license_updated:
        click.echo('License updated.')
    else:
        click.echo('Your license is already up-to-date.')
54210
def bin_upgrade(self):
        
        packages = self.args[1:]
        options = [
            "-u",
            "--upgradepkg"
        ]
        flag = ""
        flags = [
            "--dry-run",
            "--install-new",
            "--reinstall",
            "--verbose"
        ]
        if len(self.args) > 1 and self.args[0] in options:
            if self.args[1] in flags:
                flag = self.args[1]
                packages = self.args[2:]
            PackageManager(packages).upgrade(flag)
        else:
            usage("")
343458
def upgrade():
    """"""
    op.create_table(
        'pidrelations_pidrelation',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('parent_id', sa.Integer(), nullable=False),
        sa.Column('child_id', sa.Integer(), nullable=False),
        sa.Column('relation_type', sa.SmallInteger(), nullable=False),
        sa.Column('index', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['child_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_child_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'
        ),
        sa.ForeignKeyConstraint(
            ['parent_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_parent_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'),
        sa.PrimaryKeyConstraint(
            'parent_id', 'child_id', name=op.f('pk_pidrelations_pidrelation')
        )
    )
248860
def upgrade(self, only):
        """"""
        repositories = self.meta.repositories
        if only:
            repositories = only
        for repo in repositories:
            changelogs = "{0}{1}{2}".format(self.log_path, repo,
                                            "/ChangeLog.txt")
            if os.path.isfile(changelogs):
                os.remove(changelogs)
            if os.path.isdir(self.lib_path + "{0}_repo/".format(repo)):
                for f in (os.listdir(self.lib_path + "{0}_repo/".format(
                        repo))):
                    files = "{0}{1}_repo/{2}".format(self.lib_path, repo, f)
                    if os.path.isfile(files):
                        os.remove(files)
                    elif os.path.isdir(files):
                        shutil.rmtree(files)
        Update().repository(only)
339461
public function Upgrade143to150()
    {
        $this->_batch->addTask('Db_AddPatches', 42);
        $this->_batch->addTask('Db_AddPatches', 43);

        $this->_batch->addTask('Db_CreateNewTables');

        $this->_batch->addTask('Echo', $this->_('Syncing surveys for all sources'));

        //Now sync the db sources to allow limesurvey source to add a field to the tokentable
        $model = new \MUtil_Model_TableModel('gems__sources');
        $data  = $model->load(false);

        foreach ($data as $row) {
            $this->_batch->addTask('Tracker_SourceSyncSurveys', $row['gso_id_source']);
        }

        return true;
    }
249503
def upgrade():
    """"""
    op.create_table(
        'oauth2server_client',
        sa.Column('name', sa.String(length=40), nullable=True),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column(
            'website',
            sqlalchemy_utils.types.url.URLType(),
            nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('client_id', sa.String(length=255), nullable=False),
        sa.Column('client_secret', sa.String(length=255), nullable=False),
        sa.Column(
            'is_confidential',
            sa.Boolean(name='is_confidential'),
            nullable=True),
        sa.Column(
            'is_internal',
            sa.Boolean(name='is_internal'),
            nullable=True),
        sa.Column('_redirect_uris', sa.Text(), nullable=True),
        sa.Column('_default_scopes', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(['user_id'], [u'accounts_user.id'], ),
        sa.PrimaryKeyConstraint('client_id')
    )
    op.create_index(
        op.f('ix_oauth2server_client_client_secret'),
        'oauth2server_client',
        ['client_secret'],
        unique=True
    )
    op.create_table(
        'oauth2server_token',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('client_id', sa.String(length=255), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('token_type', sa.String(length=255), nullable=True),
        sa.Column(
            'access_token',
            sqlalchemy_utils.EncryptedType(),
            nullable=True),
        sa.Column(
            'refresh_token',
            sqlalchemy_utils.EncryptedType(),
            nullable=True),
        sa.Column('expires', sa.DateTime(), nullable=True),
        sa.Column('_scopes', sa.Text(), nullable=True),
        sa.Column(
            'is_personal',
            sa.Boolean(name='is_personal'),
            nullable=True),
        sa.Column(
            'is_internal',
            sa.Boolean(name='is_internal'),
            nullable=True),
        sa.ForeignKeyConstraint(
            ['client_id'], [u'oauth2server_client.client_id'], ),
        sa.ForeignKeyConstraint(
            ['user_id'], [u'accounts_user.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        'ix_oauth2server_token_access_token',
        'oauth2server_token',
        ['access_token'],
        unique=True,
        mysql_length=255)
    op.create_index(
        'ix_oauth2server_token_refresh_token',
        'oauth2server_token',
        ['refresh_token'],
        unique=True,
        mysql_length=255)
862053
function softwareUpdate() {
  this._controller = null;
  this._wizard = null;

  this._aus = Cc["@mozilla.org/updates/update-service;1"].
              getService(Ci.nsIApplicationUpdateService);
  this._ums = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
  this._vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
             getService(Ci.nsIVersionComparator);
}
1164831
def _upgrade_snpeff_data(galaxy_dir, args, remotes):
    
    snpeff_version = effects.snpeff_version(args)
    if not snpeff_version:
        return
    for dbkey, ref_file in genome.get_builds(galaxy_dir):
        resource_file = os.path.join(os.path.dirname(ref_file), "%s-resources.yaml" % dbkey)
        if os.path.exists(resource_file):
            with open(resource_file) as in_handle:
                resources = yaml.safe_load(in_handle)
            snpeff_db, snpeff_base_dir = effects.get_db({"genome_resources": resources,
                                                         "reference": {"fasta": {"base": ref_file}}})
            if snpeff_db:
                snpeff_db_dir = os.path.join(snpeff_base_dir, snpeff_db)
                if os.path.exists(snpeff_db_dir) and _is_old_database(snpeff_db_dir, args):
                    shutil.rmtree(snpeff_db_dir)
                if not os.path.exists(snpeff_db_dir):
                    print("Installing snpEff database %s in %s" % (snpeff_db, snpeff_base_dir))
                    dl_url = remotes["snpeff_dl_url"].format(
                        snpeff_ver=snpeff_version.replace(".", "_"),
                        genome=snpeff_db)
                    dl_file = os.path.basename(dl_url)
                    with utils.chdir(snpeff_base_dir):
                        subprocess.check_call(["wget", "--no-check-certificate", "-c", "-O", dl_file, dl_url])
                        subprocess.check_call(["unzip", dl_file])
                        os.remove(dl_file)
                    dl_dir = os.path.join(snpeff_base_dir, "data", snpeff_db)
                    shutil.move(dl_dir, snpeff_db_dir)
                    os.rmdir(os.path.join(snpeff_base_dir, "data"))
                if args.cwl:
                    create.directory_tarball(snpeff_db_dir)
1193756
public function Upgrade171to172()
    {
        $this->_batch->addTask('Db_CreateNewTables');
        $this->_batch->addTask('Db_AddPatches', 58);

        $this->_batch->addTask('Echo', $this->_('Make sure to read the changelog as it contains important instructions'));
        $this->_batch->addTask('Echo', $this->_('Check the Code compatibility report for any issues with project specific code!'));

        return true;
    }
937416
def set_fw_upgrade(uri, tpm_override_flag = true)
      new_action = { 'Action' => 'InstallFromURI', 'FirmwareURI' => uri, 'TPMOverrideFlag' => tpm_override_flag }
      response = rest_post('/redfish/v1/Managers/1/UpdateService/', body: new_action)
      response_handler(response)
      true
    end
370957
def run_outdated(cls, options):
        """"""
        latest_versions = sorted(
            cls.find_packages_latest_versions(cls.options),
            key=lambda p: p[0].project_name.lower())

        for dist, latest_version, typ in latest_versions:
            if latest_version > dist.parsed_version:
                if options.all:
                    pass
                elif options.pinned:
                    if cls.can_be_updated(dist, latest_version):
                        continue
                elif not options.pinned:
                    if not cls.can_be_updated(dist, latest_version):
                        continue
                    elif options.update:
                        print(dist.project_name if options.brief else
                              'Updating %s to Latest: %s [%s]' %
                              (cls.output_package(dist), latest_version, typ))
                        main(['install', '--upgrade'] + ([
                            '--user'
                        ] if ENABLE_USER_SITE else []) + [dist.key])
                        continue

                print(dist.project_name if options.brief else
                      '%s - Latest: %s [%s]' %
                      (cls.output_package(dist), latest_version, typ))
1069191
function updateDepsTo (arg, cb) {
  asyncMap(arg._others, function (o, cb) {
    updateOtherVersionDeps(o, arg, cb)
  }, cb)
}
342813
def upgrade():
    """"""
    current_date = datetime.utcnow()

    # Add 'created' and 'updated' columns to RemoteAccount
    _add_created_updated_columns('oauthclient_remoteaccount', current_date)

    # Add 'created' and 'updated' columns to RemoteToken
    _add_created_updated_columns('oauthclient_remotetoken', current_date)

    # Add 'created' and 'updated' columns to UserIdentity
    _add_created_updated_columns('oauthclient_useridentity', current_date)