Creates an history model instance.
760515
def update(
        self,
        filename=None,
        batch_id=None,
        prev_batch_id=None,
        producer=None,
        count=None,
    ):
        
        # TODO: refactor model enforce unique batch_id
        # TODO: refactor model to not allow NULLs
        if not filename:
            raise BatchHistoryError("Invalid filename. Got None")
        if not batch_id:
            raise BatchHistoryError("Invalid batch_id. Got None")
        if not prev_batch_id:
            raise BatchHistoryError("Invalid prev_batch_id. Got None")
        if not producer:
            raise BatchHistoryError("Invalid producer. Got None")
        if self.exists(batch_id=batch_id):
            raise IntegrityError("Duplicate batch_id")
        try:
            obj = self.model.objects.get(batch_id=batch_id)
        except self.model.DoesNotExist:
            obj = self.model(
                filename=filename,
                batch_id=batch_id,
                prev_batch_id=prev_batch_id,
                producer=producer,
                total=count,
            )
            obj.transaction_file.name = filename
            obj.save()
        return obj
1125641
protected function createMigrationHistoryTable()
    {
        $tableName = $this->db->schema->getRawTableName($this->migrationTable);

        $this->db->createCommand()->createTable($this->migrationTable, [
            'version' => 'varchar(180) NOT NULL PRIMARY KEY',
            'apply_time' => 'integer',
        ])->execute();
        $this->db->createCommand()->insert($this->migrationTable, [
            'version' => self::BASE_MIGRATION,
            'apply_time' => time(),
        ])->execute();
    }
606425
def create_delete_model(record):
    """"""
    data = cloudwatch.get_historical_base_info(record)

    group_id = cloudwatch.filter_request_parameters('groupId', record)
    # vpc_id = cloudwatch.filter_request_parameters('vpcId', record)
    # group_name = cloudwatch.filter_request_parameters('groupName', record)

    arn = get_arn(group_id, cloudwatch.get_region(record), record['account'])

    LOG.debug(f'[-] Deleting Dynamodb Records. Hash Key: {arn}')

    # Tombstone these records so that the deletion event time can be accurately tracked.
    data.update({'configuration': {}})

    items = list(CurrentSecurityGroupModel.query(arn, limit=1))

    if items:
        model_dict = items[0].__dict__['attribute_values'].copy()
        model_dict.update(data)
        model = CurrentSecurityGroupModel(**model_dict)
        model.save()
        return model

    return None
1134395
def history_view(self, request, object_id, extra_context=None):
        from django.template.response import TemplateResponse
        from django.contrib.admin.options import get_content_type_for_model
        from django.contrib.admin.utils import unquote
        from django.core.exceptions import PermissionDenied
        from django.utils.text import capfirst
        from django.utils.encoding import force_text
        from django.utils.translation import ugettext as _

        ""
        from django.contrib.admin.models import LogEntry
        # First check if the user can see this history.
        model = self.model
        obj = self.get_object(request, unquote(object_id))
        if obj is None:
            return self._get_obj_does_not_exist_redirect(request, model._meta, object_id)

        if not self.has_change_permission(request, obj):
            raise PermissionDenied

        # Then get the history for this object.
        opts = model._meta
        app_label = opts.app_label
        action_list = LogEntry.objects.filter(
            object_id=unquote(object_id),
            content_type=get_content_type_for_model(model)
        ).select_related().order_by('-action_time')[:self.max_history_length]

        context = dict(
            self.admin_site.each_context(request),
            title=_('Change history: %s') % force_text(obj),
            action_list=action_list,
            module_name=capfirst(force_text(opts.verbose_name_plural)),
            object=obj,
            opts=opts,
            preserved_filters=self.get_preserved_filters(request),
        )
        context.update(extra_context or {})

        request.current_app = self.admin_site.name

        return TemplateResponse(request, self.object_history_template or [
            "admin/%s/%s/object_history.html" % (app_label, opts.model_name),
            "admin/%s/object_history.html" % app_label,
            "admin/object_history.html"
        ], context)
904361
def record(self, ch_node):
        '''
        
        '''
        rec = self.serialize_node(ch_node)
        self.history.append(rec)
430722
public function historyText(ModelHistory $history): string
    {
        $action = '';
        switch ($history->action) {
            case ModelHistory::ACTION_CREATE:
                $action = __d('model_history', 'created');
                break;
            case ModelHistory::ACTION_UPDATE:
                $action = __d('model_history', 'updated');
                break;
            case ModelHistory::ACTION_DELETE:
                $action = __d('model_history', 'deleted');
                break;
            case ModelHistory::ACTION_COMMENT:
                $action = __d('model_history', 'commented');
                break;
            default:
        }
        if (empty($history->user_id)) {
            $username = 'Anonymous';
        } else {
            $userNameFields = TableRegistry::get($history->model)->getUserNameFields(true);
            $firstname = $history->user->{$userNameFields['firstname']};
            $lastname = $history->user->{$userNameFields['lastname']};
            $username = $firstname . ' ' . $lastname;
        }

        return ucfirst($action) . ' ' . __d('model_history', 'by') . ' ' . $username;
    }
726990
def _update_history(self):
        """"""
        ipa_utils.update_history_log(
            self.history_log,
            description=self.description,
            test_log=self.log_file
        )
602541
protected static function bootHistoryTracker()
    {
        self::created(function ($model) {
            $model->saveHistory();
        });

        self::updated(function ($model) {
            $model->saveHistory();
        });

        self::deleted(function ($model) {
            if (method_exists($model, 'bootSoftDeletes')) {
                $model->saveHistory();
            }
        });
    }
798247
def set_history_file(self, path):
        """"""
        if path:
            self.history = prompt_toolkit.history.FileHistory(fixpath(path))
        else:
            self.history = prompt_toolkit.history.InMemoryHistory()
1193045
def write_to_history(**kwargs):
        
        from hyperstream import HyperStream
        hs = HyperStream(loglevel=logging.CRITICAL, file_logger=False, console_logger=False, mqtt_logger=None)
        if hs.current_session:
            hs.current_session.write_to_history(**kwargs)
85195
def history_view(self, request, object_id, extra_context=None):
        ""
        from django.contrib.admin.models import LogEntry
        # First check if the user can see this history.
        model = self.model
        obj = get_object_or_404(self.get_queryset(request),
                                pk=unquote(object_id))
        if not self.has_change_permission(request, obj):
            raise PermissionDenied

        # Then get the history for this object.
        opts = model._meta
        app_label = opts.app_label
        action_list = LogEntry.objects.filter(
            object_id=unquote(str(obj.identity)),
            # this is the change for our override;
            content_type=get_content_type_for_model(model)
        ).select_related().order_by('action_time')
        ctx = self.admin_site.each_context(request)

        context = dict(ctx,
                       title=('Change history: %s') % force_text(obj),
                       action_list=action_list,
                       module_name=capfirst(
                           force_text(opts.verbose_name_plural)),
                       object=obj,
                       opts=opts,
                       preserved_filters=self.get_preserved_filters(request),
                       )
        context.update(extra_context or {})
        return TemplateResponse(request, self.object_history_template or [
            "admin/%s/%s/object_history.html" % (app_label, opts.model_name),
            "admin/%s/object_history.html" % app_label,
            "admin/object_history.html"
        ], context)
337327
def history(config, revision_range, **kwargs):
    
    with alembic_lock(
        config.registry["sqlalchemy.engine"], config.alembic_config()
    ) as alembic_config:
        alembic.command.history(alembic_config, revision_range, **kwargs)
217503
def set_historylog(self, historylog):
        """"""
        historylog.add_history(self.shell.history_filename)
        self.shell.append_to_history.connect(historylog.append_to_history)
127082
function (to, createHistoryEntry, triggerRoute, force, callback) {
                return this.history.navigate(to, createHistoryEntry, triggerRoute, force, callback);
            }
1348826
def update_history(self, it, j=0, M=None, **kwargs):
        
        # Create a new entry in the history for new variables (if they don't exist)
        if not np.any([k in self.history[j] for k in kwargs]):
            for k in kwargs:
                if M is None or M == 0:
                    self.history[j][k] = [[]]
                else:
                    self.history[j][k] = [[] for m in range(M)]
        """
        # Check that the variables have been updated once per iteration
        elif np.any([[len(h)!=it+self.offset for h in self.history[j][k]] for k in kwargs.keys()]):
            for k in kwargs.keys():
                for n,h in enumerate(self.history[j][k]):
                    if len(h) != it+self.offset:
                        err_str = "At iteration {0}, {1}[{2}] already has {3} entries"
                        raise Exception(err_str.format(it, k, n, len(h)-self.offset))
        """
        # Add the variables to the history
        for k,v in kwargs.items():
            if M is None or M == 0:
                self._store_variable(j, k, 0, v)
            else:
                for m in range(M):
                    self._store_variable(j, k, m, v[m])
228876
def create(self, data):
				
		q = self.history.insert_one(data).inserted_id
		logging.debug(self.history.find_one({"_id":q}))
1210974
protected History prepareHistory() throws IOException {
        File file = new File(System.getProperty("user.home"), HISTORYFILE);
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException ignored) {
                // can't create the file, so no history for you
            }
        }
        return file.canWrite() ? new FileHistory(file) : null;
    }