openepd 7.8.0__py3-none-any.whl → 7.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openepd/__version__.py +1 -1
- openepd/model/common.py +9 -0
- openepd/model/org.py +30 -2
- {openepd-7.8.0.dist-info → openepd-7.9.0.dist-info}/METADATA +1 -1
- {openepd-7.8.0.dist-info → openepd-7.9.0.dist-info}/RECORD +7 -7
- {openepd-7.8.0.dist-info → openepd-7.9.0.dist-info}/LICENSE +0 -0
- {openepd-7.8.0.dist-info → openepd-7.9.0.dist-info}/WHEEL +0 -0
openepd/__version__.py
CHANGED
openepd/model/common.py
CHANGED
@@ -21,6 +21,15 @@ import pydantic_core
|
|
21
21
|
|
22
22
|
from openepd.model.base import BaseOpenEpdSchema
|
23
23
|
|
24
|
+
DATA_URL_REGEX = r"^data:([-\w]+\/[-+\w.]+)?(;?\w+=[-\w]+)*(;base64)?,.*$"
|
25
|
+
"""
|
26
|
+
Regular expression pattern for matching Data URLs.
|
27
|
+
|
28
|
+
A Data URL is a URI scheme that allows you to embed small data items inline
|
29
|
+
in web pages as if they were external resources.
|
30
|
+
The pattern matches the following format: data:[<media-type>][;base64],<data>
|
31
|
+
"""
|
32
|
+
|
24
33
|
|
25
34
|
class Amount(BaseOpenEpdSchema):
|
26
35
|
"""A value-and-unit pairing for amounts that do not have an uncertainty."""
|
openepd/model/org.py
CHANGED
@@ -13,16 +13,26 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
|
-
|
16
|
+
import math
|
17
|
+
import re
|
18
|
+
from typing import Any, Final, Optional
|
17
19
|
|
18
20
|
from openlocationcode import openlocationcode
|
19
21
|
import pydantic
|
20
22
|
from pydantic import ConfigDict
|
21
23
|
|
22
24
|
from openepd.model.base import BaseOpenEpdSchema
|
23
|
-
from openepd.model.common import Location, WithAltIdsMixin, WithAttachmentsMixin
|
25
|
+
from openepd.model.common import DATA_URL_REGEX, Location, WithAltIdsMixin, WithAttachmentsMixin
|
24
26
|
from openepd.model.validation.common import ReferenceStr
|
25
27
|
|
28
|
+
ORG_LOGO_MAX_LENGTH: Final[int] = math.ceil(32 * 1024 * 4 / 3)
|
29
|
+
"""
|
30
|
+
Maximum length of Org.logo field.
|
31
|
+
|
32
|
+
Logo file size must be less than 32KB. Base64 encoding overhead (approximately 33%) requires
|
33
|
+
limiting the encoded string length to 4/3 of the file size limit.
|
34
|
+
"""
|
35
|
+
|
26
36
|
|
27
37
|
class OrgRef(BaseOpenEpdSchema):
|
28
38
|
"""Represents Organisation with minimal data."""
|
@@ -121,6 +131,24 @@ class Org(WithAttachmentsMixin, WithAltIdsMixin, OrgRef):
|
|
121
131
|
default=None,
|
122
132
|
description="Location of a place of business, preferably the corporate headquarters.",
|
123
133
|
)
|
134
|
+
logo: pydantic.AnyUrl | None = pydantic.Field(
|
135
|
+
default=None,
|
136
|
+
description=(
|
137
|
+
"URL pointer to, or dataURL, for a square logo for the company, preferably 300x300 pixels."
|
138
|
+
"A logo of the type used on social media platforms such as LinkedIn is recommended."
|
139
|
+
),
|
140
|
+
examples=["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA", "https://example.com/logo.png"],
|
141
|
+
)
|
142
|
+
|
143
|
+
@pydantic.field_validator("logo")
|
144
|
+
def _validate_logo(cls, v: pydantic.AnyUrl | None) -> pydantic.AnyUrl | None:
|
145
|
+
if v and len(v) > ORG_LOGO_MAX_LENGTH:
|
146
|
+
msg = f"Logo URL must not exceed {ORG_LOGO_MAX_LENGTH} characters"
|
147
|
+
raise ValueError(msg)
|
148
|
+
if v and v.scheme == "data" and not re.compile(DATA_URL_REGEX).match(str(v)):
|
149
|
+
msg = "Invalid data URL format"
|
150
|
+
raise ValueError(msg)
|
151
|
+
return v
|
124
152
|
|
125
153
|
|
126
154
|
class PlantRef(BaseOpenEpdSchema):
|
@@ -1,5 +1,5 @@
|
|
1
1
|
openepd/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
|
2
|
-
openepd/__version__.py,sha256=
|
2
|
+
openepd/__version__.py,sha256=xseAZdp78WQweRvIrAvEz2aklRo4lfHf3OIGYTXz70A,638
|
3
3
|
openepd/api/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
|
4
4
|
openepd/api/average_dataset/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
|
5
5
|
openepd/api/average_dataset/generic_estimate_sync_api.py,sha256=mjTT8eGtfj6Fgp-wcs0cCWA7DJo1KL_iQ75rgKkaY3c,8037
|
@@ -43,7 +43,7 @@ openepd/m49/utils.py,sha256=0UvdtC9gtvRA5WT_hJDIuQR0RSrnx-S34wwwBRM_tsM,7807
|
|
43
43
|
openepd/model/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dvvtd4,620
|
44
44
|
openepd/model/base.py,sha256=4D8BaSoNeY8RZfjkmJOSyfg0B34dKzM76lZbQT9AIXg,13622
|
45
45
|
openepd/model/category.py,sha256=iyzzAsiVwW4zJ61oYsm9Sy-sEBA71-aMFXcJP1Y-dPI,1734
|
46
|
-
openepd/model/common.py,sha256=
|
46
|
+
openepd/model/common.py,sha256=a4FFM5moxEyOTAQuf0eZTbWb3vz2deGh37j1nLg3f0k,15002
|
47
47
|
openepd/model/declaration.py,sha256=n55PqeIsBGT4UGHjGyb92txuoPB_S0eZ3lcmUAuS4NQ,14843
|
48
48
|
openepd/model/epd.py,sha256=FL8g-dKb4SaCF_xIrtVx21tmNoofARaxN-yp6_Vv_bY,12748
|
49
49
|
openepd/model/factory.py,sha256=UWSGpfCr3GiMTP4rzBkwqxzbXB6GKZ_5Okb1Dqa_4aA,2701
|
@@ -51,7 +51,7 @@ openepd/model/generic_estimate.py,sha256=_R18Uz-hvxtSBl53D0_OkwVCWvoa2nIDjBdec6v
|
|
51
51
|
openepd/model/geography.py,sha256=Jx7NIDdk_sIvwyh-7YxnIjAwIHW2HCQK7UtFGM2xKtw,42095
|
52
52
|
openepd/model/industry_epd.py,sha256=Cqn01IUNSZqRkyU05TwtOLXDKlg0YnGzqvKL8A__zbI,4061
|
53
53
|
openepd/model/lcia.py,sha256=6o6GNwLaQaWyYAXCnHl2aAgDa12_v7DwpME5BfVMezk,32780
|
54
|
-
openepd/model/org.py,sha256=
|
54
|
+
openepd/model/org.py,sha256=ij_GEFEShRh-k4o29gSowiaJbCuyNqWu61YL3BNq0FM,9369
|
55
55
|
openepd/model/pcr.py,sha256=cu3EakCAjBCkcb_AaLXB-xEjY0mlG-wJe74zGc5tdS0,5637
|
56
56
|
openepd/model/specs/README.md,sha256=UGhSiFJ9hOxT1mZl-5ZrhkOrPKf1W_gcu5CI9hzV7LU,2430
|
57
57
|
openepd/model/specs/__init__.py,sha256=RMLxvwD-_N5qaU0U2o5LxMKmP_W0_yssl72uTTC2tJg,3904
|
@@ -154,7 +154,7 @@ openepd/utils/mapping/__init__.py,sha256=9THJcV3LT7JDBOMz1px-QFf_sdJ0LOqJ5dmA9Dv
|
|
154
154
|
openepd/utils/mapping/common.py,sha256=hxfN-WW2WLwE_agQzf_mhvz6OHq5WWlr24uZ1S81k4Y,8426
|
155
155
|
openepd/utils/mapping/geography.py,sha256=1_-dvLk11Hqn-K58yUI5pQ5X5gsnJPFlFT7JK2Rdoeg,2396
|
156
156
|
openepd/utils/markdown.py,sha256=RQmudPhb4QU1I4-S-VV2WFbzzq2Po09kbpjjKbwkA9E,1830
|
157
|
-
openepd-7.
|
158
|
-
openepd-7.
|
159
|
-
openepd-7.
|
160
|
-
openepd-7.
|
157
|
+
openepd-7.9.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
158
|
+
openepd-7.9.0.dist-info/METADATA,sha256=D8Gws6Rt5kgaiTC5ak0ti0H75NZW6qs__u0Lo0GpNSg,9810
|
159
|
+
openepd-7.9.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
160
|
+
openepd-7.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|