Beispiel #1
0
    def object_from_json(cls, key, value):
        if key == 'user':
            return User.from_json(value)

        if key == 'client':
            return Client.from_json(value)

        return value
    def object_from_json(cls, key, value):
        if key == 'user':
            return User.from_json(value)

        if key == 'client':
            return Client.from_json(value)

        return value
Beispiel #3
0
    def from_info(info, metadata, client_section):
        if not info:
            return None

        return WatchSession('logging-%s' % info.get('machineIdentifier'),
                            info['ratingKey'],
                            metadata,
                            info['state'],
                            client=Client.from_section(client_section))
    def from_info(info, metadata, client_section):
        if not info:
            return None

        return WatchSession(
            'logging-%s' % info.get('machineIdentifier'),
            info['ratingKey'],
            metadata,
            info['state'],
            client=Client.from_section(client_section)
        )
Beispiel #5
0
    def from_section(section, state, metadata, client_section=None):
        """
        :type section: ?
        :type state: str

        :rtype: WatchSession or None
        """

        if not section:
            return None

        return WatchSession(section.get('sessionKey'),
                            section.get('ratingKey'),
                            metadata,
                            state,
                            user=User.from_section(section),
                            client=Client.from_section(client_section))
    def from_section(section, state, metadata, client_section=None):
        """
        :type section: ?
        :type state: str

        :rtype: WatchSession or None
        """

        if not section:
            return None

        return WatchSession(
            section.get('sessionKey'),
            section.get('ratingKey'),
            metadata, state,
            user=User.from_section(section),
            client=Client.from_section(client_section)
        )
Beispiel #7
0
from data.cont import Cont
from data.client import Client

cont = Cont(Client('Weliton Sousa', 1234566, 18))

cont.buy_credit(600)
cont.buy_credit(400)
cont.add_limit(500)
cont.buy_credit(400)
cont.pay_credit()

cont.buy_balance(300)
cont.add_balance(500)
cont.buy_balance(300)

print(cont.to_string())
print(cont.client.data())