Assert that ``did`` can be used as a PID for creating a new object with
    MNStorage.create() or MNStorage.update().
198408
def is_valid_pid_for_create(did):
    """"""
    if not d1_gmn.app.did.is_valid_pid_for_create(did):
        raise d1_common.types.exceptions.IdentifierNotUnique(
            0,
            'Identifier is already in use as {}. did="{}"'.format(
                d1_gmn.app.did.classify_identifier(did), did
            ),
            identifier=did,
        )
676548
def create_new(cls, oldvalue, *args):
    ""
    if oldvalue is not None:
        raise AlreadyExistsException('%r already exists' % (oldvalue,))
    return cls.create_instance(*args)
1168508
function create(options, callback) {
  var t = new TestObject(options);
  t.save(null, { success: callback });
}
910576
def create_or_update(options) #:nodoc:
                                  #      puts 'create_or_update'
      ret = true
      run_callbacks :save do
        result = new_record? ? create(options) : update(options)
#        puts 'save_callbacks result=' + result.inspect
        ret = result
      end
      ret
    end
1064450
@Override
    public boolean objectExists(String pid) throws StorageDeviceException {
        boolean registered = objectExistsInRegistry(pid);
        boolean exists = false;
        if (!registered && m_checkableStore) {
            try {
                exists = ((ICheckable)m_permanentStore).objectExists(pid);
            } catch (LowlevelStorageException e) {
                throw new StorageDeviceException(e.getMessage(), e);
            }
        }
        if (exists && !registered) {
            logger.warn("{} was not in the registry, but appears to be in store." +
                        " Registry db may be in inconsistent state.", pid);
        }
        return registered || exists;
    }
352345
def create(pid_type, pid_value, status, object_type, object_uuid):
    """"""
    from .models import PersistentIdentifier

    if bool(object_type) ^ bool(object_uuid):
        raise click.BadParameter('Speficy both or any of --type and --uuid.')

    new_pid = PersistentIdentifier.create(
        pid_type,
        pid_value,
        status=status,
        object_type=object_type,
        object_uuid=object_uuid,
    )
    db.session.commit()
    click.echo(
        '{0.pid_type} {0.pid_value} {0.pid_provider}'.format(new_pid)
    )
200690
def save(self, idempotency_key=None):
        """"""
        updated_params = self.serialize(None)
        headers = populate_headers(idempotency_key)

        if not updated_params:
            util.logger.debug("Trying to save already saved object %r", self)
            return defer.succeed(self)

        d = self.request('post', self.instance_url(), updated_params, headers)
        return d.addCallback(self.refresh_from).addCallback(lambda _: self)
72347
def checkAndCreate(self, key, payload):
        
        if key not in self:
            self[key] = payload
        return self[key]['id']
1159904
def update_or_create(cls, org, provider, exists):
        
        instance, created = cls.objects.update_or_create(
            org=org,
            provider=provider,
            defaults={'exists': exists},
        )

        return instance, created
1245867
def on_created(self, event):
        
        logger.debug("file created: %s", event.src_path)
        if not event.is_directory:
            self.update_file(event.src_path)
1334275
function create(con, p, cb) {
  var data = 'created by zk-mkdir-p'; // just want a dir, so store something
  var flags = 0; // none
  con.a_create(p, data, flags, function(rc, error, zkPath) {
    // already exists, cool.
    if(rc == ZooKeeper.ZNODEEXISTS) {
      return cb();
    }
    if(rc != 0) {
      return cb(new Error('Zookeeper Error: code='+rc+'   '+error));
    }
    // sucessfully created!
    return cb();
  });
}
108297
def create(cls, object_version, key, value):
        """"""
        assert len(key) < 256
        assert len(value) < 256
        with db.session.begin_nested():
            obj = cls(version_id=as_object_version_id(object_version),
                      key=key,
                      value=value)
            db.session.add(obj)
        return obj
326971
def modified_created(instance):
    
    if 'modified' in instance and 'created' in instance and \
            instance['modified'] < instance['created']:
        msg = "'modified' (%s) must be later or equal to 'created' (%s)"
        return JSONError(msg % (instance['modified'], instance['created']),
                         instance['id'])
1248715
def create_or_update(cls, bucket, key, value):
        """"""
        obj = cls.get(bucket, key)
        if obj:
            obj.value = value
            db.session.merge(obj)
        else:
            obj = cls.create(bucket, key, value)
        return obj
295070
def do_create(self, line):
        
        pid, sciobj_path = self._split_args(line, 2, 0)
        self._command_processor.science_object_create(pid, sciobj_path)
        self._print_info_if_verbose(
            'Added create operation for identifier "{}" to write queue'.format(pid)
        )
478929
async def create_object(model, **data):
    
    # NOTE! Here are internals involved:
    #
    # - obj._data
    # - obj._get_pk_value()
    # - obj._set_pk_value()
    # - obj._prepare_instance()
    #
    warnings.warn("create_object() is deprecated, Manager.create() "
                  "should be used instead",
                  DeprecationWarning)

    obj = model(**data)

    pk = await insert(model.insert(**dict(obj.__data__)))

    if obj._pk is None:
        obj._pk = pk
    return obj
1134094
def update(cls, **kwargs):
        '''
        
        '''
        q = cls._get_instance(**{'id': kwargs['id']})
        if q:
            for k, v in kwargs.items():
                setattr(q, k, v)
            _action_and_commit(q, session.add)
        else:
            cls.get_or_create(**kwargs)