MCPcopy
hub / github.com/sqlalchemy/alembic / _rev_path

Method _rev_path

alembic/script/base.py:774–799  ·  view source on GitHub ↗
(
        self,
        path: Union[str, os.PathLike[str]],
        rev_id: str,
        message: Optional[str],
        create_date: datetime.datetime,
    )

Source from the content-addressed store, hash-verified

772 return script
773
774 def _rev_path(
775 self,
776 path: Union[str, os.PathLike[str]],
777 rev_id: str,
778 message: Optional[str],
779 create_date: datetime.datetime,
780 ) -> Path:
781 epoch = int(create_date.timestamp())
782 slug = "_".join(_slug_re.findall(message or "")).lower()
783 if len(slug) > self.truncate_slug_length:
784 slug = slug[: self.truncate_slug_length].rsplit("_", 1)[0] + "_"
785 filename = "%s.py" % (
786 self.file_template
787 % {
788 "rev": rev_id,
789 "slug": slug,
790 "epoch": epoch,
791 "year": create_date.year,
792 "month": create_date.month,
793 "day": create_date.day,
794 "hour": create_date.hour,
795 "minute": create_date.minute,
796 "second": create_date.second,
797 }
798 )
799 return Path(path) / filename
800
801
802class Script(revision.Revision):

Callers 3

generate_revisionMethod · 0.95
test_argsMethod · 0.95
test_epochMethod · 0.95

Calls

no outgoing calls

Tested by 2

test_argsMethod · 0.76
test_epochMethod · 0.76