{"id":346041,"date":"2023-02-28T09:04:04","date_gmt":"2023-02-28T09:04:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346041"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346041","title":{"rendered":"<span>Python: \u043a\u043b\u0430\u0441\u0441 Factory, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c!<\/p>\n<blockquote>\n<p>\u041c\u044b \u0432\u0441\u0435 \u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 <\/p>\n<p>\u0427\u0435\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438 \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c, <\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0441\u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c, \u0441\u043b\u0430\u0432\u0430 \u0431\u043e\u0433\u0443, \u0423 \u043d\u0430\u0441 \u043d\u0435\u043c\u0443\u0434\u0440\u0435\u043d\u043e \u0431\u043b\u0435\u0441\u043d\u0443\u0442\u044c&#8230;.<\/p>\n<p>\u0410.\u0421. \u041f\u0443\u0448\u043a\u0438\u043d.<\/p>\n<\/blockquote>\n<p>\u042f\u0437\u044b\u043a Python \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438 \u041e\u041e\u041f \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Java, Object Pascal. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043d\u0435 \u0445\u043e\u043b\u0438\u0432\u0430\u0440\u0430 \u0440\u0430\u0434\u0438, \u044f \u0445\u043e\u0447\u0443 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447 CI\/CD \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u043c\u0438 Mercurial:<\/p>\n<pre><code class=\"python\">repo_types = ('git', 'hg') class Repository:     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439     \"\"\"     def __init__(self, name: str, directory: str, repo_type = None):         if repo_type is None:             repo_type = 'hg'         if repo_type not in repo_types:             raise Exception(\"Repository type not supported\") ...     def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"     pass        def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     pass     ...<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Git. \u0427\u0430\u0441\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043b\u0430 \u043d\u0430 Git, \u0447\u0430\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0432 Mercurial. \u041f\u0440\u0438\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c &#171;\u0435\u0449\u0435 \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434&#187;. <\/p>\n<p>\u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434:<\/p>\n<pre><code class=\"python\">    def __init__( self, name: str, directory: str, repo_type = None):         if repo_type is None:             repo_type = 'git'         if repo_type not in repo_types:             raise Exception(\"Repository type not supported\")         self.repo_type = repo_type         ...     def merge(self, branch_name: str, merge_revision: str):         \"\"\"         \u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0435\u0432\u0438\u0437\u0438\u0439         - branch_name: \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438 - \u043a\u0443\u0434\u0430 \u0432\u043b\u0438\u0432\u0430\u0442\u044c         - merge_revision: \u0420\u0435\u0432\u0438\u0437\u0438\u044f - \u0447\u0442\u043e \u0432\u043b\u0438\u0432\u0430\u0442\u044c         \"\"\"         if self.repo_type == 'hg':             ...         else:             ...<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Repository, \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Mercurial \u0438 Git. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 UnitTest&#8217;\u0430 &#8212; TestRepository_HG \u0438 TestRepository_Git, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u043b\u0438 \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 Repository. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0438, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 Git.<\/p>\n<p>\u041d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u2014  \u043e\u043d \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u043e\u043b\u0433\u043e\u043c. \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u041a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Repository, \u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u044b \u0432\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0435\u0433\u043e, \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439?&#187;<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434 \u2013 \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d Factory. \u0414\u043b\u044f Java, \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">public abstract class BaseRepository {     public abstract void clone(String branchName);     public abstract void commit(String message);     ... }  public class HgRepository extends BaseRepository {     @Override     public void clone(String branchName) {...}     @Override     public void commit(String message) {...}     ... }  public class GitRepository extends BaseRepository {     @Override     public void clone(String branchName) {...}     @Override     public void commit(String message) {...}     ... }  public enum RepositoryType {HG, GIT};  public class Repository {     public static BaseRepository createRepository(RepositoryType type) throws Exception {       BaseRepository repository;       switch (type) {           case HG:               repository = new HgRepository();               break;           case GIT:               repository = new GitRepository();               break;           default:               throw new Exception(\"Repository type not supported \");       }       return repository;     } }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0439\u043b\u0430: \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Mercurial, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f Git \u0438 \u043a\u043b\u0430\u0441\u0441 \u0444\u0430\u0431\u0440\u0438\u043a\u0430.<\/p>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0432 Python \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \ud83d\ude42<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/714\/7b7\/16d\/7147b716d6589621a726ca9e9f62a99e.jpg\" width=\"777\" height=\"1500\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/714\/7b7\/16d\/7147b716d6589621a726ca9e9f62a99e.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"python\">import os from abc import abstractmethod  class Repository:     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439     \"\"\"     __repo_type_class__: dict = {         \"hg\": \"RepositoryHg.RepositoryHg\",         \"git\": \"RepositoryGit.RepositoryGit\"     }      @staticmethod     def __get_class__(name: str):         \"\"\"         \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438         \"\"\"         parts = name.split('.')         module = \".\".join(parts[:-1])         m = __import__( module )         for comp in parts[1:]:             m = getattr(m, comp)         return m      def __new__(cls, name: str, directory: str, repo_type = None):         \"\"\"         \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430         \"\"\"         class_name = cls.__repo_type_class__.get(repo_type)         if class_name is None:             raise Exception(\"Repository type not supported\")         repo_class = Repository.__get_class__(class_name)         instance = super().__new__(repo_class)         return instance      def __init__(self, name: str, directory: str, repo_type = None):         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430         \"\"\"         self.name = name         self.directory = directory         self.repo_type = repo_type      @abstractmethod     def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"      @abstractmethod     def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     ...<\/code><\/pre>\n<pre><code class=\"python\">from amtRepository import Repository  class RepositoryHg(Repository):     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c Mercurial     \"\"\"      def __init__(self, name: str, directory: str, repo_type = 'hg'):         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Hg         \"\"\"         super().__init__(name, directory, 'hg')         ...      def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"     ...      def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     ...<\/code><\/pre>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 RepositoryGit \u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d.<\/p>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432 Python, \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b \u0441\u0432\u043e\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u041e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u044b \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u044f \u0438 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c: \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435?<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/718952\/\"> https:\/\/habr.com\/ru\/post\/718952\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c!<\/p>\n<blockquote>\n<p>\u041c\u044b \u0432\u0441\u0435 \u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 <\/p>\n<p>\u0427\u0435\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438 \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c, <\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0441\u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c, \u0441\u043b\u0430\u0432\u0430 \u0431\u043e\u0433\u0443, \u0423 \u043d\u0430\u0441 \u043d\u0435\u043c\u0443\u0434\u0440\u0435\u043d\u043e \u0431\u043b\u0435\u0441\u043d\u0443\u0442\u044c&#8230;.<\/p>\n<p>\u0410.\u0421. \u041f\u0443\u0448\u043a\u0438\u043d.<\/p>\n<\/blockquote>\n<p>\u042f\u0437\u044b\u043a Python \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044f\u0437\u044b\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438 \u041e\u041e\u041f \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Java, Object Pascal. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043d\u0435 \u0445\u043e\u043b\u0438\u0432\u0430\u0440\u0430 \u0440\u0430\u0434\u0438, \u044f \u0445\u043e\u0447\u0443 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447 CI\/CD \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u043c\u0438 Mercurial:<\/p>\n<pre><code class=\"python\">repo_types = ('git', 'hg') class Repository:     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439     \"\"\"     def __init__(self, name: str, directory: str, repo_type = None):         if repo_type is None:             repo_type = 'hg'         if repo_type not in repo_types:             raise Exception(\"Repository type not supported\") ...     def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"     pass        def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     pass     ...<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Git. \u0427\u0430\u0441\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043b\u0430 \u043d\u0430 Git, \u0447\u0430\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0432 Mercurial. \u041f\u0440\u0438\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c &#171;\u0435\u0449\u0435 \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434&#187;. <\/p>\n<p>\u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434:<\/p>\n<pre><code class=\"python\">    def __init__( self, name: str, directory: str, repo_type = None):         if repo_type is None:             repo_type = 'git'         if repo_type not in repo_types:             raise Exception(\"Repository type not supported\")         self.repo_type = repo_type         ...     def merge(self, branch_name: str, merge_revision: str):         \"\"\"         \u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0440\u0435\u0432\u0438\u0437\u0438\u0439         - branch_name: \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438 - \u043a\u0443\u0434\u0430 \u0432\u043b\u0438\u0432\u0430\u0442\u044c         - merge_revision: \u0420\u0435\u0432\u0438\u0437\u0438\u044f - \u0447\u0442\u043e \u0432\u043b\u0438\u0432\u0430\u0442\u044c         \"\"\"         if self.repo_type == 'hg':             ...         else:             ...<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Repository, \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Mercurial \u0438 Git. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 UnitTest&#8217;\u0430 &#8212; TestRepository_HG \u0438 TestRepository_Git, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u043b\u0438 \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 Repository. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0438, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 Git.<\/p>\n<p>\u041d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u2014  \u043e\u043d \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u043e\u043b\u0433\u043e\u043c. \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u041a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Repository, \u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u044b \u0432\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0435\u0433\u043e, \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439?&#187;<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434 \u2013 \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d Factory. \u0414\u043b\u044f Java, \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">public abstract class BaseRepository {     public abstract void clone(String branchName);     public abstract void commit(String message);     ... }  public class HgRepository extends BaseRepository {     @Override     public void clone(String branchName) {...}     @Override     public void commit(String message) {...}     ... }  public class GitRepository extends BaseRepository {     @Override     public void clone(String branchName) {...}     @Override     public void commit(String message) {...}     ... }  public enum RepositoryType {HG, GIT};  public class Repository {     public static BaseRepository createRepository(RepositoryType type) throws Exception {       BaseRepository repository;       switch (type) {           case HG:               repository = new HgRepository();               break;           case GIT:               repository = new GitRepository();               break;           default:               throw new Exception(\"Repository type not supported \");       }       return repository;     } }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0439\u043b\u0430: \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Mercurial, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f Git \u0438 \u043a\u043b\u0430\u0441\u0441 \u0444\u0430\u0431\u0440\u0438\u043a\u0430.<\/p>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0432 Python \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \ud83d\ude42<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<pre><code class=\"python\">import os from abc import abstractmethod  class Repository:     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439     \"\"\"     __repo_type_class__: dict = {         \"hg\": \"RepositoryHg.RepositoryHg\",         \"git\": \"RepositoryGit.RepositoryGit\"     }      @staticmethod     def __get_class__(name: str):         \"\"\"         \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438         \"\"\"         parts = name.split('.')         module = \".\".join(parts[:-1])         m = __import__( module )         for comp in parts[1:]:             m = getattr(m, comp)         return m      def __new__(cls, name: str, directory: str, repo_type = None):         \"\"\"         \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430         \"\"\"         class_name = cls.__repo_type_class__.get(repo_type)         if class_name is None:             raise Exception(\"Repository type not supported\")         repo_class = Repository.__get_class__(class_name)         instance = super().__new__(repo_class)         return instance      def __init__(self, name: str, directory: str, repo_type = None):         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430         \"\"\"         self.name = name         self.directory = directory         self.repo_type = repo_type      @abstractmethod     def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"      @abstractmethod     def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     ...<\/code><\/pre>\n<pre><code class=\"python\">from amtRepository import Repository  class RepositoryHg(Repository):     \"\"\"     \u041a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c Mercurial     \"\"\"      def __init__(self, name: str, directory: str, repo_type = 'hg'):         \"\"\"         \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Hg         \"\"\"         super().__init__(name, directory, 'hg')         ...      def clone(self, branch_name: str = \"\"):     \"\"\"     \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439     \"\"\"     ...      def commit(self, message: str):     \"\"\"     \u0424\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438     \"\"\"     ...<\/code><\/pre>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 RepositoryGit \u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d.<\/p>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432 Python, \u043c\u0435\u043d\u044f \u0443\u0434\u0438\u0432\u0438\u043b \u0441\u0432\u043e\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u041e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u044b \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u044f \u0438 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c: \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435?<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/718952\/\"> https:\/\/habr.com\/ru\/post\/718952\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-346041","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346041"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346041\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}