Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[v.Meta.identifier for k, v in meta.sub_resources.items()
if k not in meta.attributes.keys()]
for k in okeys:
v = getattr(classobj, k)
if (v is None) and (k == 'error_code'):
v = 'error_code'
if (v is None) or (isinstance(v, list) and (0 == len(v))):
raise Exception('Docstring creation error for {}.{} == {}'
.format(classobj, k, v))
if isinstance(v, list) and (0 < len(v)):
sub0 = v[0]
items.append((k, 'list[{}]'.format(get_type_name(sub0))))
if isinstance(sub0, BaseResource):
docstring_class(type(sub0), sub0)
else:
items.append((k, get_type_name(v)))
if isinstance(v, BaseResource):
docstring_class(type(v), v)
items = sorted(items, key=lambda item: item[0])
print('-' * 50)
print('from')
print('-' * 50)
needle = template_needle.format(classname=classtype.__name__)
print(needle)
print('-' * 50)
print('to')
def __init__(self, **kwargs):
super(AccountStatementResult, self).__init__(**kwargs)
self.more_available = kwargs.get('moreAvailable')
self.account_statement = [AccountStatement(**i) for i in kwargs.get('accountStatement')]
class CurrencyRate(BaseResource):
def __init__(self, **kwargs):
super(CurrencyRate, self).__init__(**kwargs)
self.currency_code = kwargs.get('currencyCode')
self.rate = kwargs.get('rate')
class TransferFunds(BaseResource):
def __init__(self, **kwargs):
super(TransferFunds, self).__init__(**kwargs)
self.transaction_id = kwargs.get('transactionId')
from .baseresource import BaseResource
class EventType(object):
"""
:type id: unicode
:type name: unicode
"""
def __init__(self, id, name):
self.id = id
self.name = name
class EventTypeResult(BaseResource):
"""
:type event_type: EventType
:type market_count: int
"""
def __init__(self, **kwargs):
super(EventTypeResult, self).__init__(**kwargs)
self.market_count = kwargs.get('marketCount')
self.event_type = EventType(**kwargs.get('eventType'))
class Competition(object):
"""
:type id: unicode
:type name: unicode
"""
def __init__(self, lastUpdated, updateSequence, updateType, eventTime=None):
self.last_updated = BaseResource.strip_datetime(lastUpdated)
self.update_sequence = updateSequence
self.update_type = updateType
self.event_time = eventTime
from .baseresource import BaseResource
class AccountFunds(BaseResource):
def __init__(self, **kwargs):
super(AccountFunds, self).__init__(**kwargs)
self.available_to_bet_balance = kwargs.get('availableToBetBalance')
self.discount_rate = kwargs.get('discountRate')
self.exposure = kwargs.get('exposure')
self.exposure_limit = kwargs.get('exposureLimit')
self.points_balance = kwargs.get('pointsBalance')
self.retained_commission = kwargs.get('retainedCommission')
self.wallet = kwargs.get('wallet')
class AccountDetails(BaseResource):
def __init__(self, **kwargs):
super(AccountDetails, self).__init__(**kwargs)
self.placed_date = BaseResource.strip_datetime(placedDate)
self.regulator_code = regulatorCode
self.selection_id = selectionId
self.side = side
self.size_cancelled = sizeCancelled
self.size_lapsed = sizeLapsed
self.size_matched = sizeMatched
self.size_remaining = sizeRemaining
self.size_voided = sizeVoided
self.status = status
self.customer_strategy_ref = customerStrategyRef
self.customer_order_ref = customerOrderRef
self.price_size = PriceSize(**priceSize)
class CurrentOrders(BaseResource):
"""
:type more_available: bool
:type orders: list[CurrentOrder]
"""
def __init__(self, **kwargs):
self.streaming_unique_id = kwargs.pop('streaming_unique_id', None)
self.streaming_update = kwargs.pop('streaming_update', None)
self.publish_time = kwargs.pop('publish_time', None)
super(CurrentOrders, self).__init__(**kwargs)
self.more_available = kwargs.get('moreAvailable')
self.orders = [CurrentOrder(**i) for i in kwargs.get('currentOrders')]
class ItemDescription(object):
"""
def __init__(self, **kwargs):
self.selection_id = kwargs.get('selectionId')
self.runner_name = kwargs.get('runnerName')
self.sort_priority = kwargs.get('sortPriority')
self.handicap = kwargs.get('handicap')
self.metadata = kwargs.get('metadata')
def __str__(self):
return 'RunnerCatalogue: %s' % self.selection_id
def __repr__(self):
return ''
class MarketCatalogue(BaseResource):
"""
:type competition: Competition
:type description: MarketCatalogueDescription
:type event: Event
:type event_type: EventType
:type market_id: unicode
:type market_name: unicode
:type market_start_time: datetime.datetime
:type runners: list[RunnerCatalogue]
:type total_matched: float
"""
def __init__(self, **kwargs):
super(MarketCatalogue, self).__init__(**kwargs)
self.market_id = kwargs.get('marketId')
self.market_name = kwargs.get('marketName')
self.price_reduced = kwargs.get("priceReduced")
self.price_requested = kwargs.get("priceRequested")
self.profit = kwargs.get("profit")
self.commission = kwargs.get("commission")
self.selection_id = kwargs.get("selectionId")
self.settled_date = BaseResource.strip_datetime(kwargs.get("settledDate"))
self.side = kwargs.get("side")
self.size_settled = kwargs.get("sizeSettled")
self.size_cancelled = kwargs.get("sizeCancelled")
self.customer_strategy_ref = kwargs.get("customerStrategyRef")
self.customer_order_ref = kwargs.get("customerOrderRef")
self.item_description = ItemDescription(**kwargs.get("itemDescription")
) if 'itemDescription' in kwargs else None
class ClearedOrders(BaseResource):
"""
:type more_available: bool
:type orders: list[ClearedOrder]
"""
def __init__(self, **kwargs):
super(ClearedOrders, self).__init__(**kwargs)
self.more_available = kwargs.get('moreAvailable')
self.orders = [ClearedOrder(**i) for i in kwargs.get('clearedOrders')]
class ProfitAndLosses(object):
"""
:type if_lose: float
:type if_place: float
:type if_win: float
from .baseresource import BaseResource
class LoginResource(BaseResource):
def __init__(self, **kwargs):
super(LoginResource, self).__init__(**kwargs)
self.session_token = kwargs.get('sessionToken')
self.login_status = kwargs.get('loginStatus')
class KeepAliveResource(BaseResource):
def __init__(self, **kwargs):
super(KeepAliveResource, self).__init__(**kwargs)
self.product = kwargs.get('sessionToken')
self.status = kwargs.get('status')
self.token = kwargs.get('token')
self.error = kwargs.get('error')
self.venue = venue
class EventResult(BaseResource):
"""
:type event: Event
:type market_count: int
"""
def __init__(self, **kwargs):
super(EventResult, self).__init__(**kwargs)
self.market_count = kwargs.get('marketCount')
self.event = Event(**kwargs.get('event'))
class MarketTypeResult(BaseResource):
"""
:type market_count: int
:type market_type: unicode
"""
def __init__(self, **kwargs):
super(MarketTypeResult, self).__init__(**kwargs)
self.market_count = kwargs.get('marketCount')
self.market_type = kwargs.get('marketType')
class CountryResult(BaseResource):
"""
:type country_code: unicode
:type market_count: int
"""