Reinitialize the global singletons with a given API version.

    :param version: 1 or 2. If `None`, pulled from the `useProtocolApiV2`
                    advanced setting.
559110
def reset_globals(version=None, loop=None):
    
    global containers
    global instruments
    global labware
    global robot
    global reset
    global modules
    global hardware

    robot, reset, instruments, containers, labware, modules, hardware\
        = build_globals(version, loop)
36253
def get_version(model_instance, version):
    
    version_field = get_version_fieldname(model_instance)
    kwargs = {'pk': model_instance.pk, version_field: version}
    return model_instance.__class__.objects.get(**kwargs)
14911
def map_version(self, requirement, local_version):
        
        if isinstance(self._versions_map, dict):
            version = self._versions_map.get(requirement, {}).get(
                local_version, local_version)
        else:
            version = self._versions_map(requirement, local_version)
        return version
766145
def retrieve_version(self, obj, version):
        
        current_version = getattr(obj, VERSION_ID, None)

        if current_version is None:
            # No initial version
            return obj

        if str(current_version) == str(version):
            # Same version
            return obj

        # Retrieve the object from the repository
        pr = api.get_tool("portal_repository")
        # bypass permission check to AccessPreviousVersions
        result = pr._retrieve(
            obj, selector=version, preserve=(), countPurged=True)
        return result.object
1233015
def check_api_version(resource_root, min_version):
  
  if resource_root.version < min_version:
    raise Exception("API version %s is required but %s is in use."
        % (min_version, resource_root.version))
227409
String processVersion(String version) {
    if (version == null || version.trim().isEmpty() || version.equals(APPENGINE_CONFIG)) {
      throw new IllegalArgumentException(VERSION_ERROR);
    } else if (version.equals(GCLOUD_CONFIG)) {
      return null;
    }
    return version;
  }
1315566
function installVersion(version) {
    return __awaiter(this, void 0, void 0, function () {
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!INSTALL_VERSIONS_CACHE[version]) return [3 /*break*/, 2];
                    return [4 /*yield*/, INSTALL_VERSIONS_CACHE[version]];
                case 1:
                    _a.sent();
                    return [2 /*return*/, false];
                case 2:
                    INSTALL_VERSIONS_CACHE[version] = _installVersion(version);
                    return [4 /*yield*/, INSTALL_VERSIONS_CACHE[version]];
                case 3:
                    _a.sent();
                    return [2 /*return*/, true];
            }
        });
    });
}
1221147
def _init_metadata_service(self, version):
        
        metadata_cfg = self._load_config_section(CONFIG_METADATA_SECTION)
        self._token_metadata = metadata_cfg[CONFIG_TOKEN]
        proto = metadata_cfg[CONFIG_PROTOCOL]
        host = metadata_cfg[CONFIG_HOST]

        self._metadata = MetadataService(host, version)
        self._metadata.base_protocol = proto
        self._metadata.set_auth(self._token_metadata)
837920
public static final ClientVersionAlreadyExistsException clientVersionAlreadyExistsException(String clientName, String version) {
        return new ClientVersionAlreadyExistsException(Messages.i18n.format("clientVersionAlreadyExists", clientName, version)); //$NON-NLS-1$
    }
954079
def for_version(self, version_guid):
        
        return self.replace(library_key=self.library_key.for_version(version_guid))
439729
def set_cql_version(self, version):
    
    self._seqid += 1
    d = self._reqs[self._seqid] = defer.Deferred()
    self.send_set_cql_version(version)
    return d
1374004
def rerun(version="3.7.0"):
    
    from commandlib import Command

    Command(DIR.gen.joinpath("py{0}".format(version), "bin", "python"))(
        DIR.gen.joinpath("state", "examplepythoncode.py")
    ).in_dir(DIR.gen.joinpath("state")).run()
1371836
def appliance_api_version
      options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }
      response = rest_api(:get, '/rest/version', options)
      version = response_handler(response)['currentVersion']
      raise ConnectionError, "Couldn't get API version" unless version
      version = version.to_i if version.class != Integer
      version
    rescue ConnectionError
      @logger.warn "Failed to get OneView max api version. Using default (#{OneviewSDK::DEFAULT_API_VERSION})"
      OneviewSDK::DEFAULT_API_VERSION
    end
959152
def sdk_version(self, value):
        
        if value == self._defaults['ai.internal.sdkVersion'] and 'ai.internal.sdkVersion' in self._values:
            del self._values['ai.internal.sdkVersion']
        else:
            self._values['ai.internal.sdkVersion'] = value
1109192
def set_version(version):
    

    with open(FILENAME) as pythonfile:
        content = pythonfile.read()

    output = re.sub(RE_VERSION, r"\1'{}'".format(version), content)

    if content == output:
        error('failed updating {}'.format(FILENAME))

    with open(FILENAME, 'w') as pythonfile:
        pythonfile.write(output)
469078
def revert_to(self):

		'''
		
		'''

		# send patch
		response = self.resource.repo.api.http_request('PATCH', self.uri)

		# if response 204
		if response.status_code == 204:
			logger.debug('reverting to previous version of resource, %s' % self.uri)

			# refresh current resource handle
			self._current_resource.refresh()

		else:
			raise Exception('HTTP %s, could not revert to resource version, %s' % (response.status_code, self.uri))
1048621
def construct(cls, name, version=None):
        
        other = VersionedObject(None)
        other.name_ = name
        other.version_ = Version() if version is None else version
        return other