File: simple_star_wars_dataclass_arguments.py

package info (click to toggle)
python-datamodel-code-generator 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,052 kB
  • sloc: python: 29,621; makefile: 15
file content (161 lines) | stat: -rw-r--r-- 4,820 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# generated by datamodel-codegen:
#   filename:  simple-star-wars.graphql
#   timestamp: 2019-07-26T00:00:00+00:00

from __future__ import annotations

from dataclasses import dataclass
from typing import List, Literal, Optional

from typing_extensions import TypeAlias

Boolean: TypeAlias = bool
"""
The `Boolean` scalar type represents `true` or `false`.
"""


ID: TypeAlias = str
"""
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
"""


Int: TypeAlias = int
"""
The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
"""


String: TypeAlias = str
"""
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
"""


@dataclass(order=True, slots=True)
class Film:
    characters: List[Person]
    characters_ids: List[ID]
    director: String
    episode_id: Int
    id: ID
    opening_crawl: String
    planets: List[Planet]
    planets_ids: List[ID]
    release_date: String
    species: List[Species]
    species_ids: List[ID]
    starships: List[Starship]
    starships_ids: List[ID]
    title: String
    vehicles: List[Vehicle]
    vehicles_ids: List[ID]
    producer: Optional[String] = None
    typename__: Optional[Literal['Film']] = 'Film'


@dataclass(order=True, slots=True)
class Person:
    films: List[Film]
    films_ids: List[ID]
    id: ID
    name: String
    species: List[Species]
    species_ids: List[ID]
    starships: List[Starship]
    starships_ids: List[ID]
    vehicles: List[Vehicle]
    vehicles_ids: List[ID]
    birth_year: Optional[String] = None
    eye_color: Optional[String] = None
    gender: Optional[String] = None
    hair_color: Optional[String] = None
    height: Optional[Int] = None
    homeworld: Optional[Planet] = None
    homeworld_id: Optional[ID] = None
    mass: Optional[Int] = None
    skin_color: Optional[String] = None
    typename__: Optional[Literal['Person']] = 'Person'


@dataclass(order=True, slots=True)
class Planet:
    films: List[Film]
    films_ids: List[ID]
    id: ID
    name: String
    residents: List[Person]
    residents_ids: List[ID]
    climate: Optional[String] = None
    diameter: Optional[String] = None
    gravity: Optional[String] = None
    orbital_period: Optional[String] = None
    population: Optional[String] = None
    rotation_period: Optional[String] = None
    surface_water: Optional[String] = None
    terrain: Optional[String] = None
    typename__: Optional[Literal['Planet']] = 'Planet'


@dataclass(order=True, slots=True)
class Species:
    films: List[Film]
    films_ids: List[ID]
    id: ID
    name: String
    people: List[Person]
    people_ids: List[ID]
    average_height: Optional[String] = None
    average_lifespan: Optional[String] = None
    classification: Optional[String] = None
    designation: Optional[String] = None
    eye_colors: Optional[String] = None
    hair_colors: Optional[String] = None
    language: Optional[String] = None
    skin_colors: Optional[String] = None
    typename__: Optional[Literal['Species']] = 'Species'


@dataclass(order=True, slots=True)
class Starship:
    films: List[Film]
    films_ids: List[ID]
    id: ID
    name: String
    pilots: List[Person]
    pilots_ids: List[ID]
    MGLT: Optional[String] = None
    cargo_capacity: Optional[String] = None
    consumables: Optional[String] = None
    cost_in_credits: Optional[String] = None
    crew: Optional[String] = None
    hyperdrive_rating: Optional[String] = None
    length: Optional[String] = None
    manufacturer: Optional[String] = None
    max_atmosphering_speed: Optional[String] = None
    model: Optional[String] = None
    passengers: Optional[String] = None
    starship_class: Optional[String] = None
    typename__: Optional[Literal['Starship']] = 'Starship'


@dataclass(order=True, slots=True)
class Vehicle:
    films: List[Film]
    films_ids: List[ID]
    id: ID
    name: String
    pilots: List[Person]
    pilots_ids: List[ID]
    cargo_capacity: Optional[String] = None
    consumables: Optional[String] = None
    cost_in_credits: Optional[String] = None
    crew: Optional[String] = None
    length: Optional[String] = None
    manufacturer: Optional[String] = None
    max_atmosphering_speed: Optional[String] = None
    model: Optional[String] = None
    passengers: Optional[String] = None
    vehicle_class: Optional[String] = None
    typename__: Optional[Literal['Vehicle']] = 'Vehicle'