@anonymous/

PoliteHappyScales

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8501815935342512","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"CiMgbW9kZWxzL3BhcnRpY2lwYW50LnB5CmZyb20gbWVzc2FnZSBpbXBvcnQgTWVzc2FnZQpmcm9tIG1lc3NhZ2VfcmVmZXJlbmNlIGltcG9ydCBNZXNzYWdlX1JlZmVyZW5jZQoKY2xhc3MgUGFydGljaXBhbnQoQmFzZSk6CiAgICBfX3RhYmxlbmFtZV9fID0gJ3BhcnRpY2lwYW50JwoKICAgIHV1aWQgPSBDb2x1bW4oVVVJRCwgcHJpbWFyeV9rZXk9VHJ1ZSwgZGVmYXVsdD11dWlkLnV1aWQ0KQogICAgY29uZmVyZW5jZSA9IENvbHVtbihVVUlELCBGb3JlaWduS2V5KCdjb25mZXJlbmNlLnV1aWQnKSwgbnVsbGFibGU9RmFsc2UpCiAgICB1c2VyID0gQ29sdW1uKFVVSUQsIEZvcmVpZ25LZXkoJ3VzZXIudXVpZCcpLCBudWxsYWJsZT1GYWxzZSkKCiAgICBkZWYgbWVzc2FnZXMoc2VsZik6CiAgICAgICAgcmV0dXJuIHNlc3Npb24ucXVlcnkoTWVzc2FnZSkuam9pbihNZXNzYWdlX1JlZmVyZW5jZSkuZmlsdGVyKAogICAgICAgICAgICBNZXNzYWdlX1JlZmVyZW5jZS51c2VyID09IHNlbGYudXNlcikuYWxsKCkKCgojIG1vZGVscy9tZXNzYWdlLnB5CmltcG9ydCB0ZXh0X21lc3NhZ2UKaW1wb3J0IHZvaWNlX21lc3NhZ2UKCmNsYXNzIE1lc3NhZ2UoQ29uY3JldGVCYXNlLCBCYXNlKToKICAgIF9fdGFibGVuYW1lX18gPSAnbWVzc2FnZScKCiAgICB1dWlkID0gQ29sdW1uKFVVSUQsIHByaW1hcnlfa2V5ID0gVHJ1ZSwgZGVmYXVsdCA9IHV1aWQudXVp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k6CiAgICBfX3RhYmxlbmFtZV9fID0gJ3RleHRfbWVzc2FnZScKCiAgICB1dWlkID0gQ29sdW1uKFVVSUQsIHByaW1hcnlfa2V5ID0gVHJ1ZSwgZGVmYXVsdCA9IHV1aWQudXVpZDQpCiAgICBhdXRob3IgPSBDb2x1bW4oVVVJRCwgbnVsbGFibGUgPSBGYWxzZSkKICAgIHJlYWRlZCA9IENvbHVtbihCT09MRUFOLCBudWxsYWJsZSA9IEZhbHNlLCBkZWZhdWx0ID0gRmFsc2UpCiAgICBkYXRlID0gIENvbHVtbihUSU1FU1RBTVAodGltZXpvbmUgPSBUcnVlKSwgbnVsbGFibGUgPSBGYWxzZSwgZGVmYXVsdCA9IGRhdGV0aW1lLmRhdGV0aW1lLnV0Y25vdykKICAgIGNvbnRlbnQgPSBDb2x1bW4oVEVYVCwgbnVsbGFibGUgPSBGYWxzZSkKICAgIGVkaXRlZCA9IENvbHVtbihCT09MRUFOLCBudWxsYWJsZSA9IEZhbHNlLCBkZWZhdWx0ID0gRmFsc2UpCgogICAgX19tYXBwZXJfYXJnc19fID0gewogICAgICAgICdwb2x5bW9ycGhpY19pZGVudGl0eSc6ICd0ZXh0X21lc3NhZ2UnLAogICAgICAgICdjb25jcmV0ZSc6IFRydWUKICAgIH0="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# models/participant.py
from message import Message
from message_reference import Message_Reference

class Participant(Base):
    __tablename__ = 'participant'

    uuid = Column(UUID, primary_key=True, default=uuid.uuid4)
    conference = Column(UUID, ForeignKey('conference.uuid'), nullable=False)
    user = Column(UUID, ForeignKey('user.uuid'), nullable=False)

    def messages(self):
        return session.query(Message).join(Message_Reference).filter(
            Message_Reference.user == self.user).all()


# models/message.py
import text_message
import voice_message

class Message(ConcreteBase, Base):
    __tablename__ = 'message'

    uuid = Column(UUID, primary_key = True, default = uuid.uuid4)
    author = Column(UUID, nullable = False)
    readed = Column(BOOLEAN, nullable = False, default = False)
    date =  Column(TIMESTAMP(timezone = True), nullable = False, default = datetime.datetime.utcnow)

    __mapper_args__ = {
        'polymorphic_identity': 'message',
        'concrete': True
    }


# models/text_message.py
from message import Message

# Traceback (most recent call last):
#   File "init.py", line 22, in <module>
#     from participant import Participant
#   File "Models\participant.py", line 11, in <module>
#     from message import Message
#   File "Models\message.py", line 13, in <module>
#     import text_message
#   File "Models\text_message.py", line 10, in <module>
#     from message import Message
# ImportError: cannot import name 'Message'
class Text_Message(Message):
    __tablename__ = 'text_message'

    uuid = Column(UUID, primary_key = True, default = uuid.uuid4)
    author = Column(UUID, nullable = False)
    readed = Column(BOOLEAN, nullable = False, default = False)
    date =  Column(TIMESTAMP(timezone = True), nullable = False, default = datetime.datetime.utcnow)
    content = Column(TEXT, nullable = False)
    edited = Column(BOOLEAN, nullable = False, default = False)

    __mapper_args__ = {
        'polymorphic_identity': 'text_message',
        'concrete': True
    }