repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/graphql/attribute/tests/queries/test_attribute_query.py
.py
import graphene import pytest from django.db.models import Q from graphene.utils.str_converters import to_camel_case from .....attribute import AttributeInputType, AttributeType from .....attribute.models import Attribute from .....product import ProductTypeKind from .....product.models import Category, Collection, Pr...
1,296
41,822
saleor
saleor/graphql/attribute/tests/queries/test_attribute_pagination.py
.py
from decimal import Decimal import graphene import pytest from .....attribute import AttributeType from .....attribute.models import Attribute, AttributeProduct, AttributeVariant from .....product import ProductTypeKind from .....product.models import ( Product, ProductChannelListing, ProductType, Pro...
262
8,469
saleor
saleor/graphql/attribute/tests/queries/test_attribute_filtering_with_channels.py
.py
from decimal import Decimal import graphene import pytest from .....attribute.models import Attribute, AttributeProduct, AttributeVariant from .....product import ProductTypeKind from .....product.models import ( Product, ProductChannelListing, ProductType, ProductVariant, ProductVariantChannelLis...
472
14,032
saleor
saleor/graphql/attribute/tests/queries/test_attribute_where.py
.py
import json import graphene import pytest from .....attribute import AttributeInputType, AttributeType from .....attribute.models import Attribute, AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from .....core.units import MeasurementUnits from .....product import ProductTypeKi...
2,159
64,891
saleor
saleor/graphql/attribute/tests/queries/test_attribute_filter.py
.py
from unittest import mock import graphene import pytest from .....attribute.models import Attribute from .....attribute.utils import associate_attribute_values_to_instance from .....product import ProductTypeKind from .....product.models import Product, ProductChannelListing, ProductType from ....tests.utils import g...
1,287
38,604
saleor
saleor/graphql/attribute/tests/type_handlers/test_reference_handler.py
.py
from collections import defaultdict import graphene from django.utils.text import slugify from text_unidecode import unidecode from ...enums import AttributeValueBulkActionEnum from ...utils.shared import AttrValuesInput from ...utils.type_handlers import AttributeInputErrors, ReferenceAttributeHandler def test_ref...
625
22,955
saleor
saleor/graphql/attribute/tests/deprecated/test_attributes.py
.py
import warnings import graphene from django.db.models import Q from .....attribute.models import Attribute from .....channel.models import Channel from .....channel.utils import DEPRECATION_WARNING_MESSAGE from .....product import ProductTypeKind from .....product.models import Category, Product, ProductType from ......
72
2,381
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_value_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.tests.model_helpers import ( get_product_attribute_values, get_product_attributes, ) from .....attribute.utils import associate_attribu...
455
13,903
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_bulk_create.py
.py
from unittest.mock import patch import graphene from .....attribute import AttributeType from .....attribute.error_codes import AttributeBulkCreateErrorCode from .....attribute.models import Attribute, AttributeValue from ....core.enums import ErrorPolicyEnum from ....tests.utils import get_graphql_content from ...en...
915
28,810
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.tests.model_helpers import ( get_product_attributes, ) from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.even...
431
12,797
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_bulk_update.py
.py
from unittest.mock import patch import graphene from .....attribute.error_codes import AttributeBulkUpdateErrorCode from .....attribute.models import Attribute from .....attribute.tests.model_helpers import ( get_product_attribute_values, get_product_attributes, ) from ....core.enums import ErrorPolicyEnum fr...
1,273
38,840
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_value_create.py
.py
import json from unittest import mock import graphene import pytest from django.core.exceptions import ValidationError from django.utils.functional import SimpleLazyObject from django.utils.text import slugify from freezegun import freeze_time from .....attribute.error_codes import AttributeErrorCode from .....attrib...
564
18,030
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_value_update.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from django.utils.text import slugify from freezegun import freeze_time from .....attribute.error_codes import AttributeErrorCode from .....attribute.tests.model_helpers import ( get_product_at...
794
25,194
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_update.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute import AttributeEntityType, AttributeInputType from .....attribute.error_codes import AttributeErrorCode from .....attribute.models import Attr...
1,423
42,029
saleor
saleor/graphql/attribute/tests/mutations/test_bulk_delete.py
.py
from unittest import mock import graphene import pytest from .....attribute.models import Attribute, AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from ....tests.utils import assert_no_permission, get_graphql_content ATTRIBUTE_BULK_DELETE_MUTATION = """ mutation attribute...
650
21,126
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_create.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from django.utils.text import slugify from freezegun import freeze_time from .....attribute import AttributeType from .....attribute.error_codes import AttributeErrorCode from .....attribute.models...
1,932
58,625
saleor
saleor/graphql/attribute/tests/mutations/test_attribute_reorder_values.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....attribute.models import AttributeValue from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsy...
379
12,181
saleor
saleor/graphql/attribute/utils/attribute_assignment.py
.py
from collections import defaultdict from typing import TYPE_CHECKING, cast import graphene from django.core.exceptions import ValidationError from django.db.models import Prefetch, Q from django.db.models.expressions import Exists, OuterRef from graphql.error import GraphQLError from ....attribute import AttributeInp...
478
17,991
saleor
saleor/graphql/attribute/utils/shared.py
.py
import datetime from collections import defaultdict from dataclasses import dataclass from typing import TYPE_CHECKING, NamedTuple import orjson from django.db.models import Model from django.db.models.expressions import Exists, OuterRef from ....account import models as account_models from ....attribute import Attri...
260
9,414
saleor
saleor/graphql/attribute/utils/type_handlers.py
.py
import abc import datetime import re from collections.abc import Sequence from typing import TYPE_CHECKING from django.core.exceptions import ValidationError from django.db.models import Q from django.utils.text import slugify from graphql.error import GraphQLError from text_unidecode import unidecode from ....attrib...
847
32,054
saleor
saleor/graphql/attribute/dataloaders/assigned_attributes.py
.py
from collections import defaultdict from collections.abc import Iterable from django.db.models import F, Window from django.db.models.functions import RowNumber from django.db.models.query import QuerySet from promise import Promise from ....attribute.models import Attribute, AttributeValue from ....attribute.models....
810
34,167
saleor
saleor/graphql/attribute/dataloaders/attributes.py
.py
from collections import defaultdict from ....attribute.models import Attribute, AttributeValue from ...core.dataloaders import DataLoader class AttributeValuesByAttributeIdLoader(DataLoader[int, list[AttributeValue]]): context_key = "attributevalues_by_attribute" def batch_load(self, keys): attribut...
50
1,752
saleor
saleor/graphql/attribute/dataloaders/reference_types.py
.py
from collections import defaultdict from collections.abc import Iterable from ....attribute.models import Attribute from ....page.models import PageType from ....product.models import ProductType from ...core.dataloaders import DataLoader from ...page.dataloaders import PageTypeByIdLoader from ...product.dataloaders i...
106
4,200
saleor
saleor/graphql/attribute/mutations/attribute_value_create.py
.py
import graphene from django.core.exceptions import ValidationError from ....attribute import AttributeInputType from ....attribute import models as models from ....attribute.error_codes import AttributeErrorCode from ....core.utils import generate_unique_slug from ....webhook.event_types import WebhookEventAsyncType f...
128
5,252
saleor
saleor/graphql/attribute/mutations/attribute_value_update.py
.py
import graphene from django.db.models import Exists, OuterRef, Q from ....attribute import models as models from ....page import models as page_models from ....page.utils import mark_pages_search_vector_as_dirty_in_batches from ....product import models as product_models from ....product.utils.search_helpers import ( ...
136
5,553
saleor
saleor/graphql/attribute/mutations/utils.py
.py
from django.db.models import Exists, OuterRef from ....attribute import models from ....page import models as page_models from ....product import models as product_models def get_product_ids_to_search_index_update_for_attribute_values( values: list[models.AttributeValue], ) -> list[int]: """Get product IDs t...
53
1,992
saleor
saleor/graphql/attribute/mutations/attribute_reorder_values.py
.py
import graphene from django.core.exceptions import ObjectDoesNotExist, ValidationError from ....attribute import models as models from ....attribute.error_codes import AttributeErrorCode from ....core.tracing import traced_atomic_transaction from ....webhook.event_types import WebhookEventAsyncType from ...core import...
117
4,577
saleor
saleor/graphql/attribute/mutations/base_reorder_attributes.py
.py
from typing import TYPE_CHECKING import graphene from django.core.exceptions import ObjectDoesNotExist, ValidationError from ....core.tracing import traced_atomic_transaction from ...core.inputs import ReorderInput from ...core.mutations import BaseMutation from ...core.utils.reordering import perform_reordering from...
171
5,537
saleor
saleor/graphql/attribute/mutations/attribute_create.py
.py
import graphene from django.core.exceptions import ValidationError from ....attribute import AttributeInputType from ....attribute import models as models from ....attribute.error_codes import AttributeErrorCode from ....webhook.event_types import WebhookEventAsyncType from ...core import ResolveInfo from ...core.cont...
195
8,058
saleor
saleor/graphql/attribute/mutations/attribute_bulk_update.py
.py
from collections import defaultdict from dataclasses import dataclass, field import graphene from django.core.exceptions import ValidationError from django.db import transaction from django.db.models import Q, prefetch_related_objects from django.utils.text import slugify from graphene.utils.str_converters import to_c...
905
34,414
saleor
saleor/graphql/attribute/mutations/__init__.py
.py
from .attribute_bulk_create import AttributeBulkCreate from .attribute_bulk_update import AttributeBulkUpdate from .attribute_create import AttributeCreate from .attribute_delete import AttributeDelete from .attribute_reorder_values import AttributeReorderValues from .attribute_update import AttributeUpdate from .attri...
28
927
saleor
saleor/graphql/attribute/mutations/attribute_bulk_create.py
.py
from collections import defaultdict from typing import cast import graphene from django.core.exceptions import ValidationError from django.utils.text import slugify from graphene.utils.str_converters import to_camel_case from text_unidecode import unidecode from ....attribute import ( ATTRIBUTE_PROPERTIES_CONFIGU...
681
25,194
saleor
saleor/graphql/attribute/mutations/permissions.py
.py
from collections.abc import Iterable from ....attribute import AttributeType from ....core.exceptions import PermissionDenied from ....permission.enums import ( BasePermissionEnum, CustomerTypePermissions, PageTypePermissions, ProductTypePermissions, ) from ...core.mutations import BaseMutation ATTRIB...
63
2,314
saleor
saleor/graphql/attribute/mutations/mixins.py
.py
from typing import cast from django.core.exceptions import ValidationError from django.utils.text import slugify from text_unidecode import unidecode from ....attribute import ( ATTRIBUTE_PROPERTIES_CONFIGURATION, AttributeEntityType, AttributeInputType, ) from ....attribute import models as models from ....
314
11,691
saleor
saleor/graphql/attribute/mutations/attribute_update.py
.py
import graphene from django.core.exceptions import ValidationError from ....attribute import models as models from ....attribute.error_codes import AttributeErrorCode from ....page.utils import mark_pages_search_vector_as_dirty_in_batches from ....product.utils.search_helpers import ( mark_products_search_vector_a...
206
8,543
saleor
saleor/graphql/attribute/mutations/attribute_delete.py
.py
import graphene from django.db import transaction from django.db.models import Exists, OuterRef from ....attribute import models as models from ....attribute.lock_objects import attribute_value_qs_select_for_update from ....page import models as page_models from ....page.utils import mark_pages_search_vector_as_dirty_...
119
4,985
saleor
saleor/graphql/attribute/mutations/attribute_value_delete.py
.py
from typing import cast import graphene from ....attribute import models as models from ....page.utils import mark_pages_search_vector_as_dirty_in_batches from ....product.utils.search_helpers import ( mark_products_search_vector_as_dirty_in_batches, ) from ....webhook.event_types import WebhookEventAsyncType fro...
90
3,819
saleor
saleor/graphql/attribute/mutations/validators.py
.py
from django.core.exceptions import ValidationError from ....attribute import models from ....attribute.error_codes import AttributeErrorCode def validate_value_is_unique(attribute: models.Attribute, value: models.AttributeValue): """Check if the attribute value is unique within the attribute it belongs to.""" ...
19
702
saleor
saleor/graphql/shipping/types.py
.py
import graphene from django.db.models import QuerySet from graphene import relay from ...core.weight import convert_weight_to_default_weight_unit from ...permission.auth_filters import AuthorizationFilters from ...permission.enums import ShippingPermissions from ...product import models as product_models from ...shipp...
436
16,226
saleor
saleor/graphql/shipping/utils.py
.py
from collections.abc import Iterable from typing import overload from django.core.exceptions import ValidationError from ...shipping import models from ..core.utils import from_global_id_or_error from .types import ShippingMethod, ShippingMethodType @overload def get_shipping_model_by_object_id( object_id: str,...
56
1,789
saleor
saleor/graphql/shipping/resolvers.py
.py
from prices import MoneyRange from ...shipping import models from ...shipping.interface import ShippingMethodData from ..core import ResolveInfo from ..core.context import ChannelQsContext, get_database_connection_name from ..translations.resolvers import resolve_translation def resolve_shipping_zones(info, channel_...
38
1,313
saleor
saleor/graphql/shipping/filters.py
.py
import django_filters from ...shipping.models import ShippingZone from ..channel.types import Channel from ..core.doc_category import DOC_CATEGORY_SHIPPING from ..core.filters import FilterInputObjectType, GlobalIDMultipleChoiceFilter from ..utils import resolve_global_ids_to_primary_keys def filter_channels(qs, _, ...
34
1,014
saleor
saleor/graphql/shipping/enums.py
.py
from typing import Final import graphene from ...graphql.core.enums import to_enum from ...shipping import PostalCodeRuleInclusionType, ShippingMethodType from ..core.doc_category import DOC_CATEGORY_SHIPPING ShippingMethodTypeEnum: Final[graphene.Enum] = to_enum( ShippingMethodType, type_name="ShippingMethodTyp...
18
603
saleor
saleor/graphql/shipping/schema.py
.py
import graphene from ...permission.enums import ShippingPermissions from ...shipping import models from ..core import ResolveInfo from ..core.connection import create_connection_slice, filter_connection_queryset from ..core.context import ChannelContext, get_database_connection_name from ..core.doc_category import DOC...
98
3,923
saleor
saleor/graphql/shipping/dataloaders.py
.py
from collections import defaultdict from django.db.models import Exists, F, OuterRef, Q from ...channel.models import Channel from ...shipping.models import ( ShippingMethod, ShippingMethodChannelListing, ShippingMethodPostalCodeRule, ShippingZone, ) from ..channel.dataloaders.by_self import ChannelBy...
247
9,077
saleor
saleor/graphql/shipping/bulk_mutations/__init__.py
.py
from .shipping_price_bulk_delete import ShippingPriceBulkDelete from .shipping_zone_bulk_delete import ShippingZoneBulkDelete __all__ = ["ShippingPriceBulkDelete", "ShippingZoneBulkDelete"]
5
191
saleor
saleor/graphql/shipping/bulk_mutations/shipping_zone_bulk_delete.py
.py
import graphene from django.conf import settings from ....permission.enums import ShippingPermissions from ....shipping import models from ....webhook.event_types import WebhookEventAsyncType from ....webhook.utils import get_webhooks_for_event from ...core import ResolveInfo from ...core.mutations import ModelBulkDel...
43
1,616
saleor
saleor/graphql/shipping/bulk_mutations/shipping_price_bulk_delete.py
.py
import graphene from django.conf import settings from ....permission.enums import ShippingPermissions from ....shipping import models from ....webhook.event_types import WebhookEventAsyncType from ....webhook.utils import get_webhooks_for_event from ...core import ResolveInfo from ...core.mutations import ModelBulkDel...
60
2,005
saleor
saleor/graphql/shipping/tests/benchmark/test_shipping_methods.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content SHIPPING_METHODS_QUERY = """ query GetShippingMethods($channel: String) { shippingZones(first: 10, channel: $channel) { edges { node { shippingMethods { id name minimumOrderWeight { ...
251
7,030
saleor
saleor/graphql/shipping/tests/benchmark/test_shipping_zones.py
.py
import pytest from ....tests.utils import get_graphql_content SHIPPING_ZONES_QUERY = """ query GetShippingZones($channel: String) { shippingZones(first: 100, channel: $channel) { edges { node { warehouses { id } } } } } """ @pytest.mark.django_db @pytest.mark.coun...
42
948
saleor
saleor/graphql/shipping/tests/queries/test_shipping_zones_filtering.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content QUERY_SHIPPING_ZONES_WITH_FILTER = """ query ShippingZones($filter: ShippingZoneFilterInput) { shippingZones(filter: $filter, first: 100) { edges { node { id na...
105
3,020
saleor
saleor/graphql/shipping/tests/queries/test_shipping_zone.py
.py
from unittest.mock import Mock import graphene from django.contrib.sites.models import Site from measurement.measures import Weight from .....channel.models import Channel from .....core.db.connection import allow_writer from .....core.units import WeightUnits from .....tests import race_condition from ....shipping.r...
268
8,407
saleor
saleor/graphql/shipping/tests/queries/test_shipping_zones.py
.py
from ....tests.utils import get_graphql_content MULTIPLE_SHIPPING_QUERY = """ query MultipleShippings($channel: String) { shippingZones(first: 100, channel: $channel) { edges { node { id name priceRange { ...
110
2,861
saleor
saleor/graphql/shipping/tests/mutations/test_delivery_options_calculate.py
.py
import datetime from decimal import Decimal from unittest import mock import graphene from django.utils import timezone from prices import Money from promise import Promise from .....checkout.delivery_context import fetch_shipping_methods_for_checkout from .....checkout.models import Checkout, CheckoutDelivery from ....
464
15,403
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_method_channel_listing_update.py
.py
import json from unittest.mock import patch import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....shipping.models import Shippi...
796
23,589
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_delete.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate_meta, generat...
106
3,047
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_update.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....tests.utils import dummy_editorjs f...
502
17,197
saleor
saleor/graphql/shipping/tests/mutations/test_bulk_delete.py
.py
from unittest import mock import graphene import pytest from .....shipping.models import ShippingMethod, ShippingZone from ....tests.utils import get_graphql_content @pytest.fixture def shipping_method_list(shipping_zone): shipping_method_1 = ShippingMethod.objects.create( shipping_zone=shipping_zone, n...
178
4,912
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_exclude_products.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate...
159
5,387
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_zone_update.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....shipping.models import ShippingMeth...
770
23,379
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_create.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....shipping.models import ShippingMeth...
553
16,827
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_price_remove_product_from_exclude.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate...
182
5,754
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_zone_create.py
.py
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....shipping.error_codes import ShippingErrorCode from .....shipping.models import ShippingZone from .....web...
354
10,757
saleor
saleor/graphql/shipping/tests/mutations/test_shipping_zone_delete.py
.py
import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import WebhookEventAsyncType from .....webhook.payloads import generate...
103
3,029
saleor
saleor/graphql/shipping/mutations/shipping_method_channel_listing_update.py
.py
from collections import defaultdict from typing import TYPE_CHECKING import graphene from django.core.exceptions import ValidationError from ....core.tracing import traced_atomic_transaction from ....permission.enums import ShippingPermissions from ....shipping.error_codes import ShippingErrorCode from ....shipping.m...
280
10,988
saleor
saleor/graphql/shipping/mutations/shipping_price_remove_product_from_exclude.py
.py
from typing import cast import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import BaseMutation from ...core.types i...
60
2,172
saleor
saleor/graphql/shipping/mutations/shipping_zone_update.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import DeprecatedModelMutation from ...core.types import NonNullL...
56
1,958
saleor
saleor/graphql/shipping/mutations/__init__.py
.py
from .shipping_method_channel_listing_update import ShippingMethodChannelListing from .shipping_price_create import ShippingPriceCreate from .shipping_price_delete import ShippingPriceDelete from .shipping_price_exclude_products import ShippingPriceExcludeProducts from .shipping_price_remove_product_from_exclude import...
24
873
saleor
saleor/graphql/shipping/mutations/shipping_zone_delete.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.mutations import ModelDeleteMutation from ...core.types import ShippingError from ...plugins.dataloaders import get_plugin_manager...
36
1,233
saleor
saleor/graphql/shipping/mutations/shipping_price_delete.py
.py
from typing import cast import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import BaseMutation from ...core.types i...
54
1,943
saleor
saleor/graphql/shipping/mutations/shipping_price_create.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.fields import JSONString from ...core.mutations import DeprecatedModelMutat...
108
3,987
saleor
saleor/graphql/shipping/mutations/shipping_zone_create.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import DeprecatedModelMutation from ...core.types import BaseInpu...
67
2,294
saleor
saleor/graphql/shipping/mutations/delivery_options_calculate.py
.py
import graphene from ....checkout.delivery_context import fetch_shipping_methods_for_checkout from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from ....webhook.event_types import WebhookEventSyncType from ...checkout import types as checkout_types from ...core.descriptions import ADDED_IN_323 f...
70
2,657
saleor
saleor/graphql/shipping/mutations/shipping_price_exclude_products.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....product import models as product_models from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.doc_category import DOC_CATEGORY_SHIPPING from ...core.mutations import BaseMutat...
73
2,532
saleor
saleor/graphql/shipping/mutations/base.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from django.db.models import Exists, OuterRef from django.db.utils import IntegrityError from ....channel import models as channel_models from ....core.tracing import traced_atomic_transaction from ....shipping impo...
450
17,561
saleor
saleor/graphql/shipping/mutations/shipping_price_update.py
.py
import graphene from ....permission.enums import ShippingPermissions from ....shipping import models from ...core import ResolveInfo from ...core.context import ChannelContext from ...core.mutations import DeprecatedModelMutation from ...core.types import ShippingError from ...plugins.dataloaders import get_plugin_man...
55
2,005
saleor
saleor/graphql/payment/types.py
.py
from typing import Any from uuid import UUID import graphene from django.db.models import Q from graphene import relay from promise import Promise from ...core.exceptions import PermissionDenied from ...graphql.core.descriptions import ( ADDED_IN_322, ADDED_IN_323, DEPRECATED_LEGACY_PAYMENTS, DEPRECAT...
941
31,027
saleor
saleor/graphql/payment/utils.py
.py
from typing import TYPE_CHECKING, Optional from django.core.exceptions import ValidationError from ...page.models import PageType from ...payment import models as payment_models if TYPE_CHECKING: from ...account.models import User from ...app.models import App def deprecated_metadata_contains_empty_key(met...
95
3,019
saleor
saleor/graphql/payment/resolvers.py
.py
from django.db.models import Q from ...app import models as app_models from ...checkout import models as checkout_models from ...order import models as order_models from ...payment import models from ...permission.enums import OrderPermissions from ..account.utils import get_user_accessible_channels from ..core.contex...
74
2,697
saleor
saleor/graphql/payment/filters.py
.py
import django_filters import graphene from django.db.models import Exists, OuterRef, Q from ...payment.models import TransactionEvent from ..core.descriptions import ( ADDED_IN_323, DEPRECATED_LEGACY_PAYMENTS_TYPE_DESCRIPTION, ) from ..core.doc_category import DOC_CATEGORY_PAYMENTS from ..core.filters import (...
170
5,560
saleor
saleor/graphql/payment/enums.py
.py
from typing import Final import graphene from ...payment import ( ChargeStatus, PaymentMethodType, StorePaymentMethod, TokenizedPaymentFlow, TransactionAction, TransactionEventType, TransactionKind, ) from ...payment.interface import ( PaymentGatewayInitializeTokenizationResult, Pa...
136
4,357
saleor
saleor/graphql/payment/schema.py
.py
import graphene from ...permission.enums import OrderPermissions, PaymentPermissions from ..core import ResolveInfo from ..core.connection import create_connection_slice, filter_connection_queryset from ..core.descriptions import ( ADDED_IN_322, ADDED_IN_323, DEPRECATED_LEGACY_PAYMENTS, ) from ..core.doc_c...
197
6,912
saleor
saleor/graphql/payment/dataloaders.py
.py
from collections import defaultdict from ...payment.models import Payment, Transaction, TransactionEvent, TransactionItem from ..core.dataloaders import DataLoader class TransactionEventByTransactionIdLoader(DataLoader[int, list[TransactionEvent]]): context_key = "transaction_event_by_transaction_id" def ba...
58
2,083
saleor
saleor/graphql/payment/sorters.py
.py
from ..core.descriptions import ADDED_IN_323 from ..core.doc_category import DOC_CATEGORY_PAYMENTS from ..core.types import BaseEnum, SortInputObjectType class TransactionSortField(BaseEnum): CREATED_AT = ["created_at", "pk"] MODIFIED_AT = ["modified_at", "pk"] class Meta: doc_category = DOC_CATE...
29
1,075
saleor
saleor/graphql/payment/tests/test_utils.py
.py
import pytest from django.core.exceptions import ValidationError from ....page.models import PageType from ....payment.error_codes import ( TransactionRequestActionErrorCode, TransactionRequestRefundForGrantedRefundErrorCode, ) from ..utils import validate_reason_reference_context def test_no_reference_type_...
193
6,563
saleor
saleor/graphql/payment/tests/test_legacy_api_deprecation.py
.py
from ...api import schema from ...core.descriptions import ( DEPRECATED_IN_3X_INPUT, DEPRECATED_LEGACY_PAYMENTS, ) from ...schema_printer import print_type DEPRECATED_FIELDS = { "Query": ["payment", "payments"], "Mutation": [ "checkoutPaymentCreate", "orderCapture", "orderRefund...
168
4,900
saleor
saleor/graphql/payment/tests/benchmark/test_payment_transactions.py
.py
import pytest from .....payment.models import Transaction from ....tests.utils import get_graphql_content PAYMENT_TRANSACTIONS_QUERY = """ query { orders(first:100) { edges { node { payments { id gateway isActive created modified token ...
79
1,591
saleor
saleor/graphql/payment/tests/queries/test_payment_capture.py
.py
import graphene from ....tests.utils import get_graphql_content QUERY_PAYMENT_CAPTURE_AMOUNT = """ query payment($id: ID!) { payment(id: $id) { id, availableCaptureAmount{ amount } } } """ def test_resolve_available_capture_amount_cannot_c...
51
1,295
saleor
saleor/graphql/payment/tests/queries/test_payment_sources.py
.py
from unittest.mock import ANY import graphene import pytest from .....payment.interface import CustomerSource, PaymentMethodInfo, TokenConfig from .....payment.utils import fetch_customer_id, store_customer_id from ....tests.utils import assert_no_permission, get_graphql_content DUMMY_GATEWAY = "mirumee.payments.dum...
155
4,290
saleor
saleor/graphql/payment/tests/queries/test_transaction.py
.py
from decimal import Decimal import graphene import pytest from django.utils import timezone from freezegun import freeze_time from .....giftcard.const import ( SALEOR_GIFT_CARD_BRAND, SALEOR_GIFT_CARD_PAYMENT_METHOD_NAME, ) from .....page.models import Page from .....payment import PaymentMethodType, Transact...
1,196
36,875
saleor
saleor/graphql/payment/tests/queries/test_payments_query.py
.py
import json from decimal import Decimal import graphene import pytest from .....order.models import Order from .....payment.models import Payment from ....tests.utils import ( assert_no_permission, get_graphql_content, get_graphql_content_from_response, ) from ...enums import PaymentChargeStatusEnum, Tran...
315
9,205
saleor
saleor/graphql/payment/tests/queries/test_payments_filter.py
.py
import graphene from .....payment.models import Payment from ....tests.utils import get_graphql_content PAYMENT_QUERY = """ query Payments($filter: PaymentFilterInput){ payments(first: 20, filter: $filter) { edges { node { id gateway capturedAmou...
169
4,962
saleor
saleor/graphql/payment/tests/queries/test_transactions.py
.py
import pytest from .....order.models import Order from ....tests.utils import assert_no_permission, get_graphql_content @pytest.fixture def transactions_in_different_channels( order_list, checkout, channel_USD, channel_JPY, channel_PLN, transaction_item_generator, ): order_list[0].channel...
243
7,092
saleor
saleor/graphql/payment/tests/queries/test_payment_refund.py
.py
import graphene from ....tests.utils import get_graphql_content QUERY_PAYMENT_REFUND_AMOUNT = """ query payment($id: ID!) { payment(id: $id) { id, availableRefundAmount{ amount } availableCaptureAmount{ amount } ...
54
1,387
saleor
saleor/graphql/payment/tests/queries/test_transactions_sorting.py
.py
from datetime import timedelta import pytest from django.utils import timezone from .....payment.models import TransactionItem from ....tests.utils import get_graphql_content from ...sorters import TransactionSortField TRANSACTIONS_SORT_QUERY = """ query Transactions($sortBy: TransactionSortingInput){ tr...
157
4,745
saleor
saleor/graphql/payment/tests/queries/test_transactions_where.py
.py
from datetime import timedelta import graphene import pytest from django.utils import timezone from .....payment import TransactionEventType from .....payment.models import TransactionEvent, TransactionItem from ....tests.utils import get_graphql_content TRANSACTIONS_QUERY = """ query Transactions($where: Transa...
1,128
34,294
saleor
saleor/graphql/payment/tests/deprecated/test_checkout_payment_create.py
.py
import graphene from .....checkout import calculations from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....payment.error_codes import PaymentErrorCode from .....payment.models import ChargeStatus, Payment from .....plugins.manager import get_plugins_manager from ....tests.utils import g...
139
4,590
saleor
saleor/graphql/payment/tests/mutations/test_transaction_request_action.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from .....checkout import CheckoutAuthorizeStatus from .....checkout.payment_utils import update_checkout_payment_statuses from .....giftcard import GiftCardEvents from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID fro...
1,659
50,759
saleor
saleor/graphql/payment/tests/mutations/test_transaction_process.py
.py
import datetime from decimal import Decimal from unittest import mock import graphene import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from .....channel import TransactionFlowStrategy from .....checkout import CheckoutAuthorizeStatus, Checkout...
2,994
98,083
saleor
saleor/graphql/payment/tests/mutations/test_transaction_update.py
.py
from decimal import Decimal from unittest.mock import patch import graphene import pytest from freezegun import freeze_time from .....checkout import CheckoutAuthorizeStatus, CheckoutChargeStatus from .....checkout.calculations import fetch_checkout_data from .....checkout.complete_checkout import create_order_from_c...
3,823
116,470