-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscore_comment_context.py
More file actions
102 lines (80 loc) · 5.42 KB
/
Copy pathscore_comment_context.py
File metadata and controls
102 lines (80 loc) · 5.42 KB
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
# coding: utf-8
"""
Flat API
The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and MuseScore files * Browsing, updating, copying, exporting the user's scores (for example in MP3, WAV or MIDI) * Managing educational resources with Flat for Education: creating & updating the organization accounts, the classes, rosters and assignments. The Flat API is built on HTTP. Our API is RESTful It has predictable resource URLs. It returns HTTP response codes to indicate errors. It also accepts and returns JSON in the HTTP body. The [schema](/swagger.yaml) of this API follows the [OpenAPI Initiative (OAI) specification](https://www.openapis.org/), you can use and work with [compatible Swagger tools](http://swagger.io/open-source-integrations/). This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). You can use your favorite HTTP/REST library for your programming language to use Flat's API. This specification and reference is [available on Github](https://github.com/FlatIO/api-reference). Getting Started and learn more: * [API Overview and introduction](https://flat.io/developers/docs/api/) * [Authentication (Personal Access Tokens or OAuth2)](https://flat.io/developers/docs/api/authentication.html) * [SDKs](https://flat.io/developers/docs/api/sdks.html) * [Rate Limits](https://flat.io/developers/docs/api/rate-limits.html) * [Changelog](https://flat.io/developers/docs/api/changelog.html)
The version of the OpenAPI document: 2.20.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class ScoreCommentContext(BaseModel):
"""
The context of the comment (for inline/contextualized comments). A context will include all the information related to the location of the comment (i.e. score parts, range of measure, time position).
""" # noqa: E501
part_uuid: StrictStr = Field(description="The unique identifier (UUID) of the score part", alias="partUuid")
staff_idx: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="(Deprecated, use `staffUuid`) The identififer of the staff", alias="staffIdx")
staff_uuid: Optional[StrictStr] = Field(default=None, description="The unique identififer (UUID) of the staff", alias="staffUuid")
measure_uuids: List[StrictStr] = Field(description="The list of measure UUIds", alias="measureUuids")
start_time_pos: Union[StrictFloat, StrictInt] = Field(alias="startTimePos")
stop_time_pos: Union[StrictFloat, StrictInt] = Field(alias="stopTimePos")
start_dpq: Union[StrictFloat, StrictInt] = Field(alias="startDpq")
stop_dpq: Union[StrictFloat, StrictInt] = Field(alias="stopDpq")
__properties: ClassVar[List[str]] = ["partUuid", "staffIdx", "staffUuid", "measureUuids", "startTimePos", "stopTimePos", "startDpq", "stopDpq"]
model_config = {
"populate_by_name": True,
"validate_assignment": True,
"protected_namespaces": (),
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of ScoreCommentContext from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ScoreCommentContext from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"partUuid": obj.get("partUuid"),
"staffIdx": obj.get("staffIdx"),
"staffUuid": obj.get("staffUuid"),
"measureUuids": obj.get("measureUuids"),
"startTimePos": obj.get("startTimePos"),
"stopTimePos": obj.get("stopTimePos"),
"startDpq": obj.get("startDpq"),
"stopDpq": obj.get("stopDpq")
})
return _obj