no instances allowed
194257
public static void writeNanopub(Nanopub nanopub, OutputStream out, RDFFormat format)
			throws RDFHandlerException {
		RDFWriter writer = Rio.createWriter(format, new OutputStreamWriter(out, Charset.forName("UTF-8")));
		writer.startRDF();
		String s = nanopub.getUri().toString();
		writer.handleNamespace("this", s);
		writer.handleNamespace("sub", s + RdfUtils.postAcChar);
		if (!(RdfUtils.bnodeChar + "").matches("[A-Za-z0-9\\-_]")) {
			writer.handleNamespace("node", s + RdfUtils.postAcChar + RdfUtils.bnodeChar);
		}
		writer.handleNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
		writer.handleNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
		writer.handleNamespace("rdfg", "http://www.w3.org/2004/03/trix/rdfg-1/");
		writer.handleNamespace("xsd", "http://www.w3.org/2001/XMLSchema#");
		writer.handleNamespace("owl", "http://www.w3.org/2002/07/owl#");
		writer.handleNamespace("dct", "http://purl.org/dc/terms/");
		writer.handleNamespace("dce", "http://purl.org/dc/elements/1.1/");
		writer.handleNamespace("pav", "http://swan.mindinformatics.org/ontologies/1.2/pav/");
		writer.handleNamespace("np", "http://www.nanopub.org/nschema#");
		for (Statement st : NanopubUtils.getStatements(nanopub)) {
			writer.handleStatement(st);
		}
		writer.endRDF();
	}
535827
private static void createInstance() throws Exception {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "createInstance", null);

        try {
            Class cls = Class.forName(JsConstants.JS_ADMIN_FACTORY_CLASS);
            _instance = (JsAdminFactory) cls.newInstance();
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".<clinit>", JsConstants.PROBE_10);
            SibTr.error(tc, "EXCP_DURING_INIT_SIEG0001", e);
            // TODO: HIGH: Is this the correct error?
            throw e;
        }

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "createInstance");
    }
287452
def db_aws_delete_instance(self, instance_id):
        '''  '''
        interactive = False
        if instance_id is None:
            interactive = True

        instances = self.db_services.get_db_instances()
        instance_list = [dbinst.id for dbinst in instances]

        if interactive:
            valid = False
            if len(instances) == 0:
                print("There are no instances you can delete currently.  Use "
                      "`db aws_create_instance` to make one.")
                return
            print "Here are the available instances you can delete:"
            for inst in instances:
                print "\t ", inst.id, "(", inst.status, ")"
            while not valid:
                instance_id = raw_input('Enter the instance identity you would '
                                        'like to delete: ')
                res = self.db_services.validate_instance_id(instance_id)
                if res is True:
                    valid = True
                else:
                    print(res + " Try again, instance name not valid.  Check " \
                        "for typos.")
                if instance_id in instance_list:
                    valid = True
                else:
                    valid = False
                    print("Try again, instance not present in this account.  "
                          "Try again checking for typos.")
        else:
            res = self.db_services.validate_instance_id(instance_id)
            if res is not True:
                print("*** Error, instance name either not valid.  Try again "
                     "checking for typos.")
                return
            if instance_id not in instance_list:
                print("*** Error, This instance not present in this account.  "
                     "Try again checking for typos.  Run `db aws_list_instances` to "
                     "see valid list.")
                return

        user_input = raw_input(
            "Deleting an instance will erase all your data associated with the "
            "database in that instance.  Really quit? y or n:"
        )
        if user_input == 'y':
            res = self.db_services.delete_db_instance(instance_id)
            if res:
                print("AWS RDS database instance %s deleted.  Run `db " \
                    "aws_list_instances` for current status." % instance_id)
            else:
                print("*** Error deleting database instance %s.  " \
                    "It maybe because it is still being created, deleted, or is " \
                    "being backed up.  Run `db aws_list_instances` for current " \
                    "status." % instance_id)
        else:
            return
687100
def start_instances(self, instance_ids=None):
        
        params = {}
        if instance_ids:
            self.build_list_params(params, instance_ids, 'InstanceId')
        return self.get_list('StartInstances', params,
                             [('item', Instance)], verb='POST')
1292615
def p_instance_or(self, p):
        ''
        instancelist = []
        for instance_name, instance_ports, instance_array in p[3]:
            instancelist.append(Instance(p[1], instance_name, instance_ports,
                                         p[2], instance_array, lineno=p.lineno(1)))
        p[0] = InstanceList(p[1], p[2], tuple(
            instancelist), lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
898155
def stop_instance(self, instance):
        
        params = {'state': 'stopped'}
        url = '/instances/{}'.format(instance)
        self.patch_proto(url, params=params)
267279
def remove_examples_all():
    
    d = examples_all_dir()
    if d.exists():
        log.debug('remove %s', d)
        d.rmtree()
    else:
        log.debug('nothing to remove: %s', d)
1182798
def global_instance(cls, cmdline_args, allow_override=False):
        
        orig_value = cls._instance
        assert (orig_value is None) or allow_override
        new_value = None
        try:
            new_value = CmdlineParser(cmdline_args)
            cls._instance = new_value
            yield new_value
        finally:
            assert cls._instance is new_value
            cls._instance = orig_value
1005818
def list_instances(self, filter=None):
        
        gce = self._connect()

        try:
            request = gce.instances().list(
                project=self._project_id, filter=filter, zone=self._zone)
            response = self._execute_request(request)
            self._check_response(response)
        except (HttpError, CloudProviderError) as e:
            raise InstanceError("could not retrieve all instances on the "
                                "cloud: ``" % e)

        if response and 'items' in response:
            return response['items']
        else:
            return list()
1335700
def control(self, instances, action):
        
        if not isinstance(instances, list) and\
           not isinstance(instances, tuple):
            instances = [instances]
        actions = {'start': {'operation': "StartInstances",
                             'response_data_key': "StartingInstances",
                             'InstanceIds': instances},
                   'stop': {'operation': "StopInstances",
                            'response_data_key': "StoppingInstances",
                            'InstanceIds': instances},
                   'reboot': {'operation': "RebootInstances",
                              'response_data_key': "return",
                              'InstanceIds': instances},
                   'terminate': {'operation': "TerminateInstances",
                                 'response_data_key': "TerminatingInstances",
                                 'InstanceIds': instances},
                   'protect': {'operation': "ModifyInstanceAttribute",
                               'response_data_key': "return",
                               'Attribute': 'disableApiTermination',
                               'Value': 'true'},
                   'unprotect': {'operation': "ModifyInstanceAttribute",
                                 'response_data_key': "return",
                                 'Attribute': 'disableApiTermination',
                                 'Value': 'false'}}
        if (action in ('protect', 'unprotect')):
            for instance in instances:
                self.call(InstanceId=instance, **actions[action])
            return "true"
        else:
            return self.call(**actions[action])
822654
def stop_instance(self, instance_id):
        
        if not instance_id:
            log.info("Instance to stop has no instance id")
            return

        gce = self._connect()

        try:
            request = gce.instances().delete(project=self._project_id,
                                        instance=instance_id, zone=self._zone)
            response = self._execute_request(request)
            self._check_response(response)
        except HttpError as e:
            # If the instance does not exist, we get a 404
            if e.resp.status == 404:
                raise InstanceNotFoundError(
                    "Instance `{instance_id}` was not found"
                    .format(instance_id=instance_id))
            else:
                raise InstanceError(
                    "Could not stop instance `{instance_id}`: `{e}`"
                    .format(instance_id=instance_id, e=e))
        except CloudProviderError as e:
            raise InstanceError(
                "Could not stop instance `{instance_id}`: `{e}`"
                .format(instance_id=instance_id, e=e))
304380
def validate_instance(instance):
    """"""
    excludes = settings.AUTOMATED_LOGGING['exclude']['model']

    for excluded in excludes:
        if (excluded in [instance._meta.app_label.lower(),
                         instance.__class__.__name__.lower()] or
                instance.__module__.lower().startswith(excluded)):
            return False

    return True
1287269
def stop(instance_id, force=False, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    log.info('Stopping instance %s', instance_id)

    params = {
        'action': 'StopInstances',
        'zone': _get_specified_zone(provider=get_configured_provider()),
        'instances.1': instance_id,
        'force': int(force),
    }
    result = query(params)

    return result
931346
function unfreezeAll() {
  _freezeAllEvents = false;
  _freezeAllExceptions = {};
  //unfreeze all instances
  const keys = Object.keys(_frozenEventInstances);
  for (let i = 0; i < keys.length; i++) {
    const instance = _frozenEventInstances[keys[i]];
    if (!instance) {
      continue;
    }
    instance.unfreeze();
  }
  _frozenEventInstances = {};
}
398825
def instances(cls):
        
        l = [i for i in cls.allinstances() if isinstance(i, cls)]
        return l
783696
public static boolean allowInstance(Settings settings, Object object) {

        Preconditions.checkNotNull(object, "Can not check runtime permissions on a null instance!");

        if (object instanceof Method) {
            return allowMethod(settings, (Method) object);
        }

        return allowClass(settings, object.getClass());
    }
1339095
@Override
	public InstanceExample nextInstance() {
		InstanceExample prevInstance = this.lastInstanceRead;
		if (prevInstance != null) {
			this.numInstancesRead++;
		}
		try {
			String line;
			do {
				line = this.fileReader.readLine();
				if (line == null) {
					break;
				}
				line = line.trim();
			} while (line.isEmpty() || line.charAt(0) == '%'
					|| line.charAt(0) == '@');

			if (line != null) {
				StringTokenizer token = new StringTokenizer(line,
						splitCharOption.getValue());

				double[] value = new double[this.numAttributes];
				int i;
				for (i = 0; i < this.numTokens && token.hasMoreTokens(); i++) {
					value[i] = Double.valueOf(token.nextToken());
				}
				if (i < this.numTokens || token.hasMoreTokens()) {
					throw new RuntimeException(
							"Next Instance has an wrong cardinality!");
				}
				this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value));
				this.lastInstanceRead.getData().setDataset(this.dataset);
				this.hitEndOfFile = false;
			} else {
				this.lastInstanceRead = null;
				this.hitEndOfFile = true;
			}
		} catch (IOException ioe) {
			throw new RuntimeException("Read next Instance failed.", ioe);
		}
		return prevInstance;
	}