Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: third_party/boto/boto/mws/response.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/boto/boto/mws/exception.py ('k') | third_party/boto/boto/opsworks/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/mws/response.py
===================================================================
--- third_party/boto/boto/mws/response.py (revision 33376)
+++ third_party/boto/boto/mws/response.py (working copy)
@@ -1,23 +1,21 @@
-# Copyright (c) 2012 Andy Davidoff http://www.disruptek.com/
+# Copyright (c) 2012-2014 Andy Davidoff http://www.disruptek.com/
#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish, dis-
-# tribute, sublicense, and/or sell copies of the Software, and to permit
-# persons to whom the Software is furnished to do so, subject to the fol-
-# lowing conditions:
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, dis- tribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the fol- lowing conditions:
#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
-# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from decimal import Decimal
@@ -62,10 +60,10 @@
setattr(self._parent, self._name, self._clone)
def start(self, *args, **kw):
- raise NotImplemented
+ raise NotImplementedError
def end(self, *args, **kw):
- raise NotImplemented
+ raise NotImplementedError
def teardown(self, *args, **kw):
setattr(self._parent, self._name, self._value)
@@ -133,16 +131,42 @@
super(MemberList, self).teardown(*args, **kw)
-def ResponseFactory(action, force=None):
- result = force or globals().get(action + 'Result', ResponseElement)
+class ResponseFactory(object):
+ def __init__(self, scopes=None):
+ self.scopes = [] if scopes is None else scopes
- class MWSResponse(Response):
- _name = action + 'Response'
+ def element_factory(self, name, parent):
+ class DynamicElement(parent):
+ _name = name
+ setattr(DynamicElement, '__name__', str(name))
+ return DynamicElement
- setattr(MWSResponse, action + 'Result', Element(result))
- return MWSResponse
+ def search_scopes(self, key):
+ for scope in self.scopes:
+ if hasattr(scope, key):
+ return getattr(scope, key)
+ if hasattr(scope, '__getitem__'):
+ if key in scope:
+ return scope[key]
+ def find_element(self, action, suffix, parent):
+ element = self.search_scopes(action + suffix)
+ if element is not None:
+ return element
+ if action.endswith('ByNextToken'):
+ element = self.search_scopes(action[:-len('ByNextToken')] + suffix)
+ if element is not None:
+ return self.element_factory(action + suffix, element)
+ return self.element_factory(action + suffix, parent)
+ def __call__(self, action, connection=None):
+ response = self.find_element(action, 'Response', Response)
+ if not hasattr(response, action + 'Result'):
+ result = self.find_element(action, 'Result', ResponseElement)
+ setattr(response, action + 'Result', Element(result))
+ return response(connection=connection)
+
+
def strip_namespace(func):
def wrapper(self, name, *args, **kw):
if self._namespace is not None:
@@ -191,8 +215,6 @@
name = self.__class__.__name__
if name.startswith('JIT_'):
name = '^{0}^'.format(self._name or '')
- elif name == 'MWSResponse':
- name = '^{0}^'.format(self._name or name)
return '{0}{1!r}({2})'.format(
name, self.copy(), ', '.join(map(render, attrs)))
@@ -262,10 +284,6 @@
FeedSubmissionInfo = ElementList(FeedSubmissionInfo)
-class GetFeedSubmissionListByNextTokenResult(GetFeedSubmissionListResult):
- pass
-
-
class GetFeedSubmissionCountResult(ResponseElement):
pass
@@ -290,10 +308,6 @@
ReportRequestInfo = ElementList()
-class GetReportRequestListByNextTokenResult(GetReportRequestListResult):
- pass
-
-
class CancelReportRequestsResult(RequestReportResult):
pass
@@ -302,10 +316,6 @@
ReportInfo = ElementList()
-class GetReportListByNextTokenResult(GetReportListResult):
- pass
-
-
class ManageReportScheduleResult(ResponseElement):
ReportSchedule = Element()
@@ -314,10 +324,6 @@
pass
-class GetReportScheduleListByNextTokenResult(GetReportScheduleListResult):
- pass
-
-
class UpdateReportAcknowledgementsResult(GetReportListResult):
pass
@@ -331,18 +337,10 @@
ShipmentData = MemberList(ShipFromAddress=Element())
-class ListInboundShipmentsByNextTokenResult(ListInboundShipmentsResult):
- pass
-
-
class ListInboundShipmentItemsResult(ResponseElement):
ItemData = MemberList()
-class ListInboundShipmentItemsByNextTokenResult(ListInboundShipmentItemsResult):
- pass
-
-
class ListInventorySupplyResult(ResponseElement):
InventorySupplyList = MemberList(
EarliestAvailability=Element(),
@@ -353,10 +351,6 @@
)
-class ListInventorySupplyByNextTokenResult(ListInventorySupplyResult):
- pass
-
-
class ComplexAmount(ResponseElement):
_amount = 'Value'
@@ -472,10 +466,6 @@
FulfillmentOrders = MemberList(FulfillmentOrder)
-class ListAllFulfillmentOrdersByNextTokenResult(ListAllFulfillmentOrdersResult):
- pass
-
-
class GetPackageTrackingDetailsResult(ResponseElement):
ShipToAddress = Element()
TrackingEvents = MemberList(EventAddress=Element())
@@ -541,6 +531,11 @@
Price = Element(Price)
+class Offer(ResponseElement):
+ BuyingPrice = Element(Price)
+ RegularPrice = Element(ComplexMoney)
+
+
class Product(ResponseElement):
_namespace = 'ns2'
Identifiers = Element(MarketplaceASIN=Element(),
@@ -558,6 +553,9 @@
LowestOfferListings = Element(
LowestOfferListing=ElementList(LowestOfferListing),
)
+ Offers = Element(
+ Offer=ElementList(Offer),
+ )
class ListMatchingProductsResult(ResponseElement):
@@ -601,6 +599,14 @@
pass
+class GetMyPriceForSKUResponse(ProductsBulkOperationResponse):
+ pass
+
+
+class GetMyPriceForASINResponse(ProductsBulkOperationResponse):
+ pass
+
+
class ProductCategory(ResponseElement):
def __init__(self, *args, **kw):
@@ -609,7 +615,7 @@
class GetProductCategoriesResult(ResponseElement):
- Self = Element(ProductCategory)
+ Self = ElementList(ProductCategory)
class GetProductCategoriesForSKUResult(GetProductCategoriesResult):
@@ -636,10 +642,6 @@
Orders = Element(Order=ElementList(Order))
-class ListOrdersByNextTokenResult(ListOrdersResult):
- pass
-
-
class GetOrderResult(ListOrdersResult):
pass
@@ -667,5 +669,118 @@
ListMarketplaces = Element(Marketplace=ElementList())
-class ListMarketplaceParticipationsByNextTokenResult(ListMarketplaceParticipationsResult):
+class ListRecommendationsResult(ResponseElement):
+ ListingQualityRecommendations = MemberList(ItemIdentifier=Element())
+
+
+class Customer(ResponseElement):
+ PrimaryContactInfo = Element()
+ ShippingAddressList = Element(ShippingAddress=ElementList())
+ AssociatedMarketplaces = Element(MarketplaceDomain=ElementList())
+
+
+class ListCustomersResult(ResponseElement):
+ CustomerList = Element(Customer=ElementList(Customer))
+
+
+class GetCustomersForCustomerIdResult(ListCustomersResult):
pass
+
+
+class CartItem(ResponseElement):
+ CurrentPrice = Element(ComplexMoney)
+ SalePrice = Element(ComplexMoney)
+
+
+class Cart(ResponseElement):
+ ActiveCartItemList = Element(CartItem=ElementList(CartItem))
+ SavedCartItemList = Element(CartItem=ElementList(CartItem))
+
+
+class ListCartsResult(ResponseElement):
+ CartList = Element(Cart=ElementList(Cart))
+
+
+class GetCartsResult(ListCartsResult):
+ pass
+
+
+class Destination(ResponseElement):
+ AttributeList = MemberList()
+
+
+class ListRegisteredDestinationsResult(ResponseElement):
+ DestinationList = MemberList(Destination)
+
+
+class Subscription(ResponseElement):
+ Destination = Element(Destination)
+
+
+class GetSubscriptionResult(ResponseElement):
+ Subscription = Element(Subscription)
+
+
+class ListSubscriptionsResult(ResponseElement):
+ SubscriptionList = MemberList(Subscription)
+
+
+class OrderReferenceDetails(ResponseElement):
+ Buyer = Element()
+ OrderTotal = Element(ComplexMoney)
+ Destination = Element(PhysicalDestination=Element())
+ SellerOrderAttributes = Element()
+ OrderReferenceStatus = Element()
+ Constraints = ElementList()
+
+
+class SetOrderReferenceDetailsResult(ResponseElement):
+ OrderReferenceDetails = Element(OrderReferenceDetails)
+
+
+class GetOrderReferenceDetailsResult(SetOrderReferenceDetailsResult):
+ pass
+
+
+class AuthorizationDetails(ResponseElement):
+ AuthorizationAmount = Element(ComplexMoney)
+ CapturedAmount = Element(ComplexMoney)
+ AuthorizationFee = Element(ComplexMoney)
+ AuthorizationStatus = Element()
+
+
+class AuthorizeResult(ResponseElement):
+ AuthorizationDetails = Element(AuthorizationDetails)
+
+
+class GetAuthorizationDetailsResult(AuthorizeResult):
+ pass
+
+
+class CaptureDetails(ResponseElement):
+ CaptureAmount = Element(ComplexMoney)
+ RefundedAmount = Element(ComplexMoney)
+ CaptureFee = Element(ComplexMoney)
+ CaptureStatus = Element()
+
+
+class CaptureResult(ResponseElement):
+ CaptureDetails = Element(CaptureDetails)
+
+
+class GetCaptureDetailsResult(CaptureResult):
+ pass
+
+
+class RefundDetails(ResponseElement):
+ RefundAmount = Element(ComplexMoney)
+ FeeRefunded = Element(ComplexMoney)
+ RefundStatus = Element()
+
+
+class RefundResult(ResponseElement):
+ RefundDetails = Element(RefundDetails)
+
+
+class GetRefundDetails(RefundResult):
+ pass
« no previous file with comments | « third_party/boto/boto/mws/exception.py ('k') | third_party/boto/boto/opsworks/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698