Skip to content

Commit 38fd0cf

Browse files
committed
refactor: move osw.model.static to opensemantic
1 parent 954dddb commit 38fd0cf

File tree

15 files changed

+21
-417
lines changed

15 files changed

+21
-417
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ package_dir =
4949
# For more information, check out https://semver.org/.
5050
install_requires =
5151
oold
52+
opensemantic
5253
pydantic>=1.10.17
5354
datamodel-code-generator>=0.25
5455
mwclient>=0.11.0
@@ -69,7 +70,6 @@ install_requires =
6970
asyncio
7071
tqdm
7172
pybars3-wheel
72-
backports.strenum; python_version<"3.11"
7373

7474
[options.packages.find]
7575
where = src

src/osw/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from warnings import warn
88

99
import yaml
10+
from opensemantic import OswBaseModel
1011
from pydantic.v1 import PrivateAttr
1112

1213
from osw.defaults import paths as default_paths
13-
from osw.model.static import OswBaseModel
1414

1515
if TYPE_CHECKING:
1616
PossibleFilePath = Path

src/osw/controller/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from typing import Optional, Union
22

3+
from opensemantic import OswBaseModel
34
from sqlalchemy import URL, create_engine
45
from sqlalchemy import text as sql_text
56
from sqlalchemy.engine import Engine
67

78
import osw.model.entity as model
89
from osw.auth import CredentialManager
910
from osw.core import OSW
10-
from osw.model.static import OswBaseModel
1111

1212

1313
class DatabaseController(model.Database):

src/osw/controller/page_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
from typing import Optional, Union
77
from warnings import warn
88

9+
from opensemantic import OswBaseModel
910
from pydantic.v1 import FilePath
1011
from typing_extensions import Dict, List
1112

1213
import osw.model.page_package as model
1314
from osw.auth import CredentialManager
1415
from osw.model import page_package as package
1516
from osw.model.page_package import NAMESPACE_CONST_TO_NAMESPACE_MAPPING
16-
from osw.model.static import OswBaseModel
1717
from osw.utils.regex import RegExPatternExtended
1818
from osw.wtsite import WtPage, WtSite
1919

src/osw/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
set_resolver,
2828
)
2929
from oold.utils.codegen import OOLDJsonSchemaParser
30+
from opensemantic import OswBaseModel
3031
from pydantic import PydanticDeprecatedSince20
3132
from pydantic.v1 import BaseModel, Field, PrivateAttr, create_model, validator
3233
from pyld import jsonld
3334

3435
import osw.model.entity as model
3536
from osw.defaults import params as default_params
36-
from osw.model.static import OswBaseModel
3737
from osw.utils.oold import (
3838
AggregateGeneratedSchemasParam,
3939
AggregateGeneratedSchemasParamMode,
@@ -587,7 +587,7 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
587587
--input {schema_path} \
588588
--input-file-type jsonschema \
589589
--output {temp_model_path} \
590-
--base-class osw.model.static.OswBaseModel \
590+
--base-class opensemantic.OswBaseModel \
591591
--use-default \
592592
--use-unique-items-as-set \
593593
--enum-field-as-literal all \
@@ -614,7 +614,7 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
614614
input_=pathlib.Path(schema_path),
615615
input_file_type="jsonschema",
616616
output=pathlib.Path(temp_model_path),
617-
base_class="osw.model.static.OswBaseModel",
617+
base_class="opensemantic.OswBaseModel",
618618
# use_default=True,
619619
apply_default_values_for_required_fields=True,
620620
use_unique_items_as_set=True,
@@ -647,7 +647,7 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
647647
# parser = OOLDJsonSchemaParserFixedRefs(
648648
# source=pathlib.Path(schema_path),
649649

650-
# base_class="osw.model.static.OswBaseModel",
650+
# base_class="opensemantic.OswBaseModel",
651651
# data_model_type=data_model_types.data_model,
652652
# data_model_root_type=data_model_types.root_model,
653653
# data_model_field_type=data_model_types.field_model,
@@ -720,8 +720,8 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
720720
header = (
721721
"from uuid import uuid4\n"
722722
"from typing import Type, TypeVar\n"
723-
"from osw.model.static import OswBaseModel, Ontology\n"
724-
# "from osw.model.static import *\n"
723+
"from opensemantic import OswBaseModel\n"
724+
# "from opensemantic import *\n"
725725
"\n"
726726
)
727727

src/osw/data/mining.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
#
77
# from pydantic import validator
88
#
9-
# from osw.model.static import OswBaseModel
9+
# from opensemantic import OswBaseModel
1010
# from osw.utils.strings import *

src/osw/defaults.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
from pathlib import Path
55
from typing import List, Union
66

7-
from pydantic.v1 import PrivateAttr, validator
8-
9-
from osw.model.static import BaseModel
7+
from pydantic.v1 import BaseModel, PrivateAttr, validator
108

119
PACKAGE_ROOT_PATH = Path(__file__).parents[2]
1210
SRC_PATH = PACKAGE_ROOT_PATH / "src"

src/osw/express.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from warnings import warn
1313

1414
import requests
15+
from opensemantic import OswBaseModel
1516
from pydantic.v1 import validator
1617
from typing_extensions import (
1718
IO,
@@ -30,7 +31,6 @@
3031
from osw.core import OSW, OVERWRITE_CLASS_OPTIONS, OverwriteOptions
3132
from osw.defaults import params as default_params
3233
from osw.defaults import paths as default_paths
33-
from osw.model.static import OswBaseModel
3434
from osw.utils.wiki import namespace_from_full_title, title_from_full_title
3535
from osw.wtsite import WtSite
3636

src/osw/model/entity.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
from typing import Any, List, Optional, Set, Union
99
from uuid import UUID
1010

11+
from opensemantic import OswBaseModel
1112
from pydantic.v1 import Field, constr
1213

13-
from osw.model.static import OswBaseModel
14-
1514

1615
class Level(str, Enum):
1716
public = "public"
@@ -22,7 +21,7 @@ class Level(str, Enum):
2221
from typing import Type, TypeVar
2322
from uuid import uuid4
2423

25-
from osw.model.static import Ontology, OswBaseModel
24+
from opensemantic import OswBaseModel
2625

2726

2827
class ReadAccess(OswBaseModel):
@@ -677,10 +676,9 @@ class Config:
677676
from typing import Any, List, Optional, Set, Union
678677
from uuid import UUID
679678

679+
from opensemantic import OswBaseModel
680680
from pydantic.v1 import Field, constr
681681

682-
from osw.model.static import OswBaseModel
683-
684682
Entity.update_forward_refs()
685683
ObjectStatement.update_forward_refs()
686684
DataStatement.update_forward_refs()

0 commit comments

Comments
 (0)