Skip to content

Commit 8a9ce1a

Browse files
authored
Upgrade ruff to ^0.16.0
Signed-off-by: Wolfgang Popp <popp.wolfgang@siemens.com>
1 parent 0a3907c commit 8a9ce1a

3 files changed

Lines changed: 37 additions & 33 deletions

File tree

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ By default, authentication for the SDK is configured through the `VILOCIFY_API_T
3636
Alternatively, the token can be set programmatically:
3737
```python
3838
from vilocify import api_config
39+
3940
api_config.token = "<your token here>"
4041
```
4142

@@ -46,6 +47,7 @@ api_config.token = "<your token here>"
4647
Note that this code needs a token with "admin" role.
4748
```python
4849
from vilocify.models import Membership
50+
4951
m = Membership(username="John Doe", email="john.doe@example.com", role="user", expires_at="2025-10-30T00:00:00Z")
5052
m.create()
5153

@@ -59,10 +61,7 @@ from vilocify.models import MonitoringList, Subscription, Component, Membership
5961

6062
# Creating a new monitoring list automatically adds the authenticated user as 'owner'
6163
ml = MonitoringList(name="Example list", comment="created by the Vilocify SDK")
62-
ml.components = [
63-
Component(id="40866"),
64-
Component(id="148860")
65-
]
64+
ml.components = [Component(id="40866"), Component(id="148860")]
6665
ml.create()
6766

6867
# Add a second subscriber to the list.
@@ -83,7 +82,9 @@ from vilocify.models import MonitoringList, Notification
8382
ml = MonitoringList.where("name", "eq", "Example list").first()
8483

8584
# Find Vilocify notifications for the monitoring list since 2023
86-
notifications = Notification.where("monitoringLists.id", "any", ml.id).where("createdAt", "after", "2023-01-01T00:00:00Z")
85+
notifications = Notification.where("monitoringLists.id", "any", ml.id).where(
86+
"createdAt", "after", "2023-01-01T00:00:00Z"
87+
)
8788
for n in notifications:
8889
print(n.title)
8990
```
@@ -115,16 +116,16 @@ The [models.py](vilocify/models.py) module defines the SDK models and their rela
115116
Relationships cannot be set through the model constructor, but instead must be set using assignment. For example:
116117

117118
```python
118-
sub = Subscription(role="user") # role is an attribute
119+
sub = Subscription(role="user") # role is an attribute
119120
sub.membership = Membership(id="<a_membership_id_here>") # `.membership` is a to-one relation
120121
sub.monitoring_list = MonitoringList(id="<a_ml_id_here>") # `.monitoring_list` is a to-one relation
121122
sub.create() # Performs the API request to create the subscription
122123

123124

124-
ml = MonitoringList(name="Example list") # name is an attribute
125+
ml = MonitoringList(name="Example list") # name is an attribute
125126
ml.components = [ # components is a to-many relationship
126127
Component(id="40866"),
127-
Component(id="148860")
128+
Component(id="148860"),
128129
]
129130
ml.create() # Creates a monitoring list with the two given components
130131
```
@@ -139,22 +140,25 @@ For example
139140
ml = MonitoringList.first()
140141
ml.components = [ # Replaces all components on the monitoring list, no request is sent, yet.
141142
Component(id="1"),
142-
Component(id="2")
143+
Component(id="2"),
143144
]
144145
ml.update() # Commit the change to the Vilocify API
145146

146147

147148
ml = MonitoringList.first()
148-
ml.components.extend(Component(id="3"), Component(id="5")) # Adds component with IDs 1 and 2, and immediately sends the change to the API backend
149+
ml.components.extend(
150+
Component(id="3"), Component(id="5")
151+
) # Adds component with IDs 1 and 2, and immediately sends the change to the API backend
149152
```
150153

151154
### Proxy setup
152155
The SDK uses a `requests.Session()` to handle its HTTP requests, which picks up the proxy settings from the `https_proxy` environment variable as documented [here](https://requests.readthedocs.io/en/latest/user/advanced/#proxies).
153156
To override that behavior do the following:
154157
```python
155158
from vilocify import api_config
159+
156160
api_config.client.trust_env = False
157-
api_config.client.proxies = { "https": "https://your.proxy:8080" }
161+
api_config.client.proxies = {"https": "https://your.proxy:8080"}
158162
```
159163

160164
## Contributing

poetry.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ packages = [
2828

2929
[tool.poetry.group.dev.dependencies]
3030
pytest = "^9.0.0"
31-
ruff = "^0.15.0"
31+
ruff = "^0.16.0"
3232
mypy = "^2.0.0"
3333
types-requests = "^2.32.0.20240914"
3434
requests-mock = "^1.12.1"

0 commit comments

Comments
 (0)