aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/moto
diff options
context:
space:
mode:
authormaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/moto
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
downloadydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/moto')
-rw-r--r--contrib/python/moto/py2/.dist-info/METADATA44
-rw-r--r--contrib/python/moto/py2/.dist-info/entry_points.txt3
-rw-r--r--contrib/python/moto/py2/.dist-info/top_level.txt1
-rw-r--r--contrib/python/moto/py2/patches/20-use-ya-resouces-for-ec2.patch22
-rw-r--r--contrib/python/moto/py3/.yandex_meta/yamaker.yaml2
-rw-r--r--contrib/python/moto/py3/patches/01-arcadia.patch71
-rw-r--r--contrib/python/moto/py3/patches/02-arcadia.patch67
-rw-r--r--contrib/python/moto/py3/patches/03-arcadia.patch15
8 files changed, 225 insertions, 0 deletions
diff --git a/contrib/python/moto/py2/.dist-info/METADATA b/contrib/python/moto/py2/.dist-info/METADATA
new file mode 100644
index 0000000000..e650f39e52
--- /dev/null
+++ b/contrib/python/moto/py2/.dist-info/METADATA
@@ -0,0 +1,44 @@
+Metadata-Version: 2.1
+Name: moto
+Version: 1.3.7
+Summary: A library that allows your python tests to easily mock out the boto library
+Home-page: https://github.com/spulec/moto
+Author: Steve Pulec
+Author-email: spulec@gmail.com
+License: Apache
+Platform: UNKNOWN
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Topic :: Software Development :: Testing
+Provides-Extra: server
+Requires-Dist: Jinja2 (>=2.7.3)
+Requires-Dist: boto (>=2.36.0)
+Requires-Dist: boto3 (>=1.6.16)
+Requires-Dist: botocore (>=1.12.13)
+Requires-Dist: cryptography (>=2.3.0)
+Requires-Dist: requests (>=2.5)
+Requires-Dist: xmltodict
+Requires-Dist: six (>1.9)
+Requires-Dist: werkzeug
+Requires-Dist: pyaml
+Requires-Dist: pytz
+Requires-Dist: python-dateutil (<3.0.0,>=2.1)
+Requires-Dist: python-jose (<3.0.0)
+Requires-Dist: mock
+Requires-Dist: docker (>=2.5.1)
+Requires-Dist: jsondiff (==1.1.1)
+Requires-Dist: aws-xray-sdk (<0.96,>=0.93)
+Requires-Dist: responses (>=0.9.0)
+Requires-Dist: backports.tempfile; python_version<'3.3'
+Provides-Extra: server
+Requires-Dist: flask; extra == 'server'
+
+UNKNOWN
+
+
diff --git a/contrib/python/moto/py2/.dist-info/entry_points.txt b/contrib/python/moto/py2/.dist-info/entry_points.txt
new file mode 100644
index 0000000000..d6d51c3812
--- /dev/null
+++ b/contrib/python/moto/py2/.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+moto_server = moto.server:main
+
diff --git a/contrib/python/moto/py2/.dist-info/top_level.txt b/contrib/python/moto/py2/.dist-info/top_level.txt
new file mode 100644
index 0000000000..0a175dad0c
--- /dev/null
+++ b/contrib/python/moto/py2/.dist-info/top_level.txt
@@ -0,0 +1 @@
+moto
diff --git a/contrib/python/moto/py2/patches/20-use-ya-resouces-for-ec2.patch b/contrib/python/moto/py2/patches/20-use-ya-resouces-for-ec2.patch
new file mode 100644
index 0000000000..927b105003
--- /dev/null
+++ b/contrib/python/moto/py2/patches/20-use-ya-resouces-for-ec2.patch
@@ -0,0 +1,22 @@
+diff --git a/contrib/python/moto/moto/ec2/models.py b/contrib/python/moto/moto/ec2/models.py
+--- a/contrib/python/moto/moto/ec2/models.py
++++ b/contrib/python/moto/moto/ec2/models.py
+@@ -120,13 +120,11 @@ from .utils import (
+ tag_filter_matches,
+ )
+
+-INSTANCE_TYPES = json.load(
+- open(resource_filename(__name__, 'resources/instance_types.json'), 'r')
+-)
+-AMIS = json.load(
+- open(os.environ.get('MOTO_AMIS_PATH') or resource_filename(
+- __name__, 'resources/amis.json'), 'r')
+-)
++# load from ya-resources
++import library.python.resource as _ya_res
++
++INSTANCE_TYPES = json.loads(_ya_res.find('resource/instance_types.json'))
++AMIS = json.loads(_ya_res.find('resource/amis.json'))
+
+
+ def utc_date_and_time():
diff --git a/contrib/python/moto/py3/.yandex_meta/yamaker.yaml b/contrib/python/moto/py3/.yandex_meta/yamaker.yaml
new file mode 100644
index 0000000000..a4e74a50a5
--- /dev/null
+++ b/contrib/python/moto/py3/.yandex_meta/yamaker.yaml
@@ -0,0 +1,2 @@
+requirements:
+ - PyYAML
diff --git a/contrib/python/moto/py3/patches/01-arcadia.patch b/contrib/python/moto/py3/patches/01-arcadia.patch
new file mode 100644
index 0000000000..4caffd314b
--- /dev/null
+++ b/contrib/python/moto/py3/patches/01-arcadia.patch
@@ -0,0 +1,71 @@
+--- contrib/python/moto/py3/moto/cognitoidp/responses.py (index)
++++ contrib/python/moto/py3/moto/cognitoidp/responses.py (working tree)
+@@ -624,10 +624,8 @@ class CognitoIdpResponse(BaseResponse):
+
+ class CognitoIdpJsonWebKeyResponse(BaseResponse):
+ def __init__(self):
+- with open(
+- os.path.join(os.path.dirname(__file__), "resources/jwks-public.json")
+- ) as f:
+- self.json_web_key = f.read()
++ import pkgutil
++ self.json_web_key = pkgutil.get_data(__package__, 'resources/jwks-public.json')
+
+ def serve_json_web_key(
+ self, request, full_url, headers
+--- contrib/python/moto/py3/moto/s3/responses.py (index)
++++ contrib/python/moto/py3/moto/s3/responses.py (working tree)
+@@ -288,6 +288,8 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
+ request.headers.get("Authorization", "")
+ )
+ region_name = region_name or DEFAULT_REGION_NAME
++ if region_name == "yandex":
++ region_name = DEFAULT_REGION_NAME
+
+ bucket_name = self.parse_bucket_name_from_url(request, full_url)
+ if not bucket_name:
+--- contrib/python/moto/py3/moto/ec2/models/amis.py (index)
++++ contrib/python/moto/py3/moto/ec2/models/amis.py (working tree)
+@@ -25,1 +25,1 @@ if "MOTO_AMIS_PATH" in environ:
+- AMIS = load_resource(__name__, "../resources/amis.json")
++ AMIS = load_resource("moto.ec2", "resources/amis.json")
+--- contrib/python/moto/py3/moto/ec2/models/instance_types.py (index)
++++ contrib/python/moto/py3/moto/ec2/models/instance_types.py (working tree)
+@@ -5,19 +5,27 @@ from os import listdir
+ from moto.utilities.utils import load_resource
+ from ..exceptions import InvalidInstanceTypeError
+
+-INSTANCE_TYPES = load_resource(__name__, "../resources/instance_types.json")
++import library.python.resource as _ya_res
++import os
++import json
++
++INSTANCE_TYPES = load_resource("moto.ec2", "resources/instance_types.json")
+ INSTANCE_FAMILIES = list(set([i.split(".")[0] for i in INSTANCE_TYPES.keys()]))
+
+-root = pathlib.Path(__file__).parent
+-offerings_path = "../resources/instance_type_offerings"
++root = pathlib.Path(__file__).parent.parent
++offerings_path = "resources/instance_type_offerings"
+ INSTANCE_TYPE_OFFERINGS = {}
+-for location_type in listdir(root / offerings_path):
+- INSTANCE_TYPE_OFFERINGS[location_type] = {}
+- for _region in listdir(root / offerings_path / location_type):
+- full_path = offerings_path + "/" + location_type + "/" + _region
+- res = load_resource(__name__, full_path)
+- for instance in res:
+- instance["LocationType"] = location_type
++for entry in _ya_res.resfs_files(prefix=str(root / offerings_path)):
++ rel_path = os.path.relpath(entry, root / offerings_path)
++ path_parts = os.path.normpath(rel_path).split(os.path.sep)
++ if len(path_parts) != 2:
++ continue
++ location_type, _region = path_parts
++ if location_type not in INSTANCE_TYPE_OFFERINGS:
++ INSTANCE_TYPE_OFFERINGS[location_type] = {}
++ res = json.loads(_ya_res.find(f"resfs/file/{entry}"))
++ for instance in res:
++ instance["LocationType"] = location_type
+ INSTANCE_TYPE_OFFERINGS[location_type][_region.replace(".json", "")] = res
+
+
diff --git a/contrib/python/moto/py3/patches/02-arcadia.patch b/contrib/python/moto/py3/patches/02-arcadia.patch
new file mode 100644
index 0000000000..49a96425a8
--- /dev/null
+++ b/contrib/python/moto/py3/patches/02-arcadia.patch
@@ -0,0 +1,67 @@
+--- contrib/python/moto/py3/moto/s3/models.py (index)
++++ contrib/python/moto/py3/moto/s3/models.py (working tree)
+@@ -339,11 +339,12 @@ class FakeKey(BaseModel):
+
+
+ class FakeMultipart(BaseModel):
+- def __init__(self, key_name, metadata, storage=None, tags=None):
++ def __init__(self, key_name, metadata, storage=None, tags=None, acl=None):
+ self.key_name = key_name
+ self.metadata = metadata
+ self.storage = storage
+ self.tags = tags
++ self.acl = acl
+ self.parts = {}
+ self.partlist = [] # ordered list of part ID's
+ rand_b64 = base64.b64encode(os.urandom(UPLOAD_ID_BYTES))
+@@ -1865,13 +1866,6 @@ class S3Backend(BaseBackend, CloudWatchMetricProvider):
+ pub_block_config.get("RestrictPublicBuckets"),
+ )
+
+- def initiate_multipart(self, bucket_name, key_name, metadata):
+- bucket = self.get_bucket(bucket_name)
+- new_multipart = FakeMultipart(key_name, metadata)
+- bucket.multiparts[new_multipart.id] = new_multipart
+-
+- return new_multipart
+-
+ def complete_multipart(self, bucket_name, multipart_id, body):
+ bucket = self.get_bucket(bucket_name)
+ multipart = bucket.multiparts[multipart_id]
+@@ -1908,9 +1902,11 @@ class S3Backend(BaseBackend, CloudWatchMetricProvider):
+ return len(bucket.multiparts[multipart_id].parts) > next_part_number_marker
+
+ def create_multipart_upload(
+- self, bucket_name, key_name, metadata, storage_type, tags
++ self, bucket_name, key_name, metadata, storage_type, tags, acl
+ ):
+- multipart = FakeMultipart(key_name, metadata, storage=storage_type, tags=tags)
++ multipart = FakeMultipart(
++ key_name, metadata, storage=storage_type, tags=tags, acl=acl
++ )
+
+ bucket = self.get_bucket(bucket_name)
+ bucket.multiparts[multipart.id] = multipart
+--- contrib/python/moto/py3/moto/s3/responses.py (index)
++++ contrib/python/moto/py3/moto/s3/responses.py (working tree)
+@@ -1946,8 +1946,11 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
+ metadata = metadata_from_headers(request.headers)
+ tagging = self._tagging_from_headers(request.headers)
+ storage_type = request.headers.get("x-amz-storage-class", "STANDARD")
++ acl = self._acl_from_headers(request.headers)
++ if acl is None:
++ acl = self.backend.get_bucket(bucket_name).acl
+ multipart_id = self.backend.create_multipart_upload(
+- bucket_name, key_name, metadata, storage_type, tagging
++ bucket_name, key_name, metadata, storage_type, tagging, acl
+ )
+
+ template = self.response_template(S3_MULTIPART_INITIATE_RESPONSE)
+@@ -1976,6 +1979,7 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
+ )
+ key.set_metadata(multipart.metadata)
+ self.backend.set_key_tags(key, multipart.tags)
++ self.backend.put_object_acl(bucket_name, key.name, multipart.acl)
+
+ template = self.response_template(S3_MULTIPART_COMPLETE_RESPONSE)
+ headers = {}
diff --git a/contrib/python/moto/py3/patches/03-arcadia.patch b/contrib/python/moto/py3/patches/03-arcadia.patch
new file mode 100644
index 0000000000..07407785ea
--- /dev/null
+++ b/contrib/python/moto/py3/patches/03-arcadia.patch
@@ -0,0 +1,15 @@
+--- contrib/python/moto/py3/moto/s3/responses.py (index)
++++ contrib/python/moto/py3/moto/s3/responses.py (working tree)
+@@ -343,7 +343,10 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
+ #
+ # Workaround - manually reverse the encoding.
+ # Keep the + encoded, ensuring that parse_qsl doesn't replace it, and parse_qsl will unquote it afterwards
+- qs = (parsed_url.query or "").replace("+", "%2B")
++ #
++ # YQ-1825: Replace was commented out as the version of `Werkzeug`
++ # that we are using is 2.0.3 (lesser than 2.1.0) and workaround is not needed
++ qs = (parsed_url.query or "") #.replace("+", "%2B")
+ querystring = parse_qs(qs, keep_blank_values=True)
+ return querystring
+
+