Skip to content

Commit fe2c056

Browse files
authored
Merge pull request #213 from poissoncorp/RDBC-800
RDBC-800 Investigate failing tests on python >= 3.8 due to invalid code format
2 parents 207b249 + 70b1393 commit fe2c056

File tree

16 files changed

+102
-77
lines changed

16 files changed

+102
-77
lines changed

.git-blame.ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# run updated 'black' formatter on 3.8 Python
3+
4237c1a5f3a1e434c61e86419bea9901f90c6426

.github/workflows/RavenClient.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
python-version: [ '3.7', '3.8', '3.9' , '3.10']
32+
python-version: [ '3.7', '3.8', '3.10' ,'3.11', '3.12']
3333
serverVersion: [ "5.2", "5.4", "6.0" ]
3434
fail-fast: false
3535

@@ -82,9 +82,11 @@ jobs:
8282
run: mkdir RavenDB/Server/certs && cp certs/server.pfx RavenDB/Server/certs/
8383

8484
- name: Install black linter
85+
if: ${{ matrix.python-version != '3.7' }}
8586
run: pip install black
8687

8788
- name: Check code format
89+
if: ${{ matrix.python-version != '3.7' }}
8890
run: black --check .
8991

9092
- name: Run tests

ravendb/data/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def to_json(self):
104104
if self.wait_for_non_stale_results_timeout is not None:
105105
data["WaitForNonStaleResultsTimeout"] = Utils.timedelta_to_str(self.wait_for_non_stale_results_timeout)
106106
if self.allow_multiple_index_entries_for_same_document_to_result_transformer:
107-
data[
108-
"AllowMultipleIndexEntriesForSameDocumentToResultTransformer"
109-
] = self.allow_multiple_index_entries_for_same_document_to_result_transformer
107+
data["AllowMultipleIndexEntriesForSameDocumentToResultTransformer"] = (
108+
self.allow_multiple_index_entries_for_same_document_to_result_transformer
109+
)
110110
if self.show_timings:
111111
data["ShowTimings"] = self.show_timings
112112
if self.skip_duplicate_checking:

ravendb/documents/conventions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def __init__(self):
6565
self._find_identity_property = lambda q: q.__name__ == "key"
6666
self._find_python_class: Optional[Callable[[str, Dict], str]] = None
6767
self._find_collection_name: Callable[[Type], str] = self.default_get_collection_name
68-
self._find_python_class_name: Callable[
69-
[Type], str
70-
] = lambda object_type: f"{object_type.__module__}.{object_type.__name__}"
68+
self._find_python_class_name: Callable[[Type], str] = (
69+
lambda object_type: f"{object_type.__module__}.{object_type.__name__}"
70+
)
7171
self._transform_class_collection_name_to_document_id_prefix = (
7272
lambda collection_name: self.default_transform_collection_name_to_document_id_prefix(collection_name)
7373
)

ravendb/documents/indexes/definitions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ def to_json(self) -> dict:
248248
"State": self.state,
249249
"LockMode": self.lock_mode,
250250
"AdditionalSources": self.additional_sources,
251-
"AdditionalAssemblies": [x.to_json() for x in self.additional_assemblies]
252-
if self.additional_assemblies
253-
else None,
251+
"AdditionalAssemblies": (
252+
[x.to_json() for x in self.additional_assemblies] if self.additional_assemblies else None
253+
),
254254
"Maps": self.maps,
255255
"Fields": {key: value.to_json() for key, value in self.fields.items()},
256256
"Reduce": self.reduce,

ravendb/documents/operations/backups/settings.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@ def __init__(
227227
def from_json(cls, json_dict: Dict[str, Any]) -> AzureSettings:
228228
return cls(
229229
json_dict["Disabled"],
230-
GetBackupConfigurationScript.from_json(json_dict["GetBackupConfigurationScript"])
231-
if json_dict["GetBackupConfigurationScript"]
232-
else None,
230+
(
231+
GetBackupConfigurationScript.from_json(json_dict["GetBackupConfigurationScript"])
232+
if json_dict["GetBackupConfigurationScript"]
233+
else None
234+
),
233235
json_dict["StorageContainer"],
234236
json_dict["RemoteFolderName"],
235237
json_dict["AccountName"],
@@ -240,9 +242,9 @@ def from_json(cls, json_dict: Dict[str, Any]) -> AzureSettings:
240242
def to_json(self) -> Dict[str, Any]:
241243
return {
242244
"Disabled": self.disabled,
243-
"GetBackupConfigurationScript": self.get_backup_configuration_script.to_json()
244-
if self.get_backup_configuration_script
245-
else None,
245+
"GetBackupConfigurationScript": (
246+
self.get_backup_configuration_script.to_json() if self.get_backup_configuration_script else None
247+
),
246248
"StorageContainer": self.storage_container,
247249
"RemoteFolderName": self.remote_folder_name,
248250
"AccountName": self.account_name,
@@ -275,9 +277,11 @@ def __init__(
275277
def from_json(cls, json_dict: Dict[str, Any]) -> FtpSettings:
276278
return cls(
277279
json_dict["Disabled"],
278-
GetBackupConfigurationScript.from_json(json_dict["GetBackupConfigurationScript"])
279-
if json_dict["GetBackupConfigurationScript"]
280-
else None,
280+
(
281+
GetBackupConfigurationScript.from_json(json_dict["GetBackupConfigurationScript"])
282+
if json_dict["GetBackupConfigurationScript"]
283+
else None
284+
),
281285
json_dict["Url"],
282286
json_dict["Port"] if "Port" in json_dict else None,
283287
json_dict["UserName"],
@@ -289,9 +293,9 @@ def from_json(cls, json_dict: Dict[str, Any]) -> FtpSettings:
289293
def to_json(self) -> Dict[str, Any]:
290294
return {
291295
"Disabled": self.disabled,
292-
"GetBackupConfigurationScript": self.get_backup_configuration_script.to_json()
293-
if self.get_backup_configuration_script
294-
else None,
296+
"GetBackupConfigurationScript": (
297+
self.get_backup_configuration_script.to_json() if self.get_backup_configuration_script else None
298+
),
295299
"Url": self.url,
296300
"Port": self.port,
297301
"UserName": self.user_name,
@@ -419,26 +423,30 @@ def from_json(cls, json_dict: Dict[str, Any]) -> BackupConfiguration:
419423
return cls(
420424
BackupType(json_dict["BackupType"]),
421425
SnapshotSettings.from_json(json_dict["SnapshotSettings"]) if json_dict["SnapshotSettings"] else None,
422-
BackupEncryptionSettings.from_json(json_dict["BackupEncryptionSettings"])
423-
if json_dict["BackupEncryptionSettings"]
424-
else None,
426+
(
427+
BackupEncryptionSettings.from_json(json_dict["BackupEncryptionSettings"])
428+
if json_dict["BackupEncryptionSettings"]
429+
else None
430+
),
425431
LocalSettings.from_json(json_dict["LocalSettings"]) if json_dict["LocalSettings"] else None,
426432
S3Settings.from_json(json_dict["S3Settings"]) if json_dict["S3Settings"] else None,
427433
GlacierSettings.from_json(json_dict["GlacierSettings"]) if json_dict["GlacierSettings"] else None,
428434
AzureSettings.from_json(json_dict["AzureSettings"]) if json_dict["AzureSettings"] else None,
429435
FtpSettings.from_json(json_dict["FtpSettings"]) if json_dict["FtpSettings"] else None,
430-
GoogleCloudSettings.from_json(json_dict["GoogleCloudSettings"])
431-
if json_dict["GoogleCloudSettings"]
432-
else None,
436+
(
437+
GoogleCloudSettings.from_json(json_dict["GoogleCloudSettings"])
438+
if json_dict["GoogleCloudSettings"]
439+
else None
440+
),
433441
)
434442

435443
def to_json(self) -> Dict[str, Any]:
436444
return {
437445
"BackupType": self.backup_type.value if self.backup_type else None,
438446
"SnapshotSettings": self.snapshot_settings.to_json() if self.snapshot_settings else None,
439-
"BackupEncryptionSettings": self.backup_encryption_settings.to_json()
440-
if self.backup_encryption_settings
441-
else None,
447+
"BackupEncryptionSettings": (
448+
self.backup_encryption_settings.to_json() if self.backup_encryption_settings else None
449+
),
442450
"LocalSettings": self.local_settings.to_json() if self.local_settings else None,
443451
"S3Settings": self.s3_settings.to_json() if self.s3_settings else None,
444452
"GlacierSettings": self.glacier_settings.to_json() if self.glacier_settings else None,

ravendb/documents/operations/configuration/definitions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ def to_json(self) -> dict:
4444
"Etag": self.etag,
4545
"Disabled": self.disabled,
4646
"MaxNumberOfRequestsPerSession": self.max_number_of_requests_per_session,
47-
"ReadBalanceBehavior": self.read_balance_behavior.value
48-
if self.read_balance_behavior
49-
else ReadBalanceBehavior.NONE,
50-
"LoadBalanceBehavior": self.load_balance_behavior.value
51-
if self.load_balance_behavior
52-
else LoadBalanceBehavior.NONE,
47+
"ReadBalanceBehavior": (
48+
self.read_balance_behavior.value if self.read_balance_behavior else ReadBalanceBehavior.NONE
49+
),
50+
"LoadBalanceBehavior": (
51+
self.load_balance_behavior.value if self.load_balance_behavior else LoadBalanceBehavior.NONE
52+
),
5353
"LoadBalancerContextSeed": self.load_balancer_context_seed,
5454
}
5555

ravendb/documents/operations/revisions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ def __init__(
7171
def to_json(self) -> Dict[str, Any]:
7272
return {
7373
"Default": self.default_config.to_json() if self.default_config else None,
74-
"Collections": {key: value.to_json() for key, value in self.collections.items()}
75-
if self.collections
76-
else None,
74+
"Collections": (
75+
{key: value.to_json() for key, value in self.collections.items()} if self.collections else None
76+
),
7777
}
7878

7979
@classmethod

ravendb/documents/session/document_session_operations/in_memory_document_session_operations.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ def __init__(self):
148148
self.__documents_by_entity_hashable: Dict[object, DocumentInfo] = dict()
149149
self.__documents_by_entity_unhashable: RefEqEntityHolder[RefEq, DocumentInfo] = RefEqEntityHolder()
150150
self.__on_before_store_documents_by_entity_hashable: Dict[object, DocumentInfo] = dict()
151-
self.__on_before_store_documents_by_entity_unhashable: RefEqEntityHolder[
152-
RefEq, DocumentInfo
153-
] = RefEqEntityHolder()
151+
self.__on_before_store_documents_by_entity_unhashable: RefEqEntityHolder[RefEq, DocumentInfo] = (
152+
RefEqEntityHolder()
153+
)
154154
self.__prepare_entities_puts: bool = False
155155

156156
def __repr__(self):
@@ -458,9 +458,9 @@ def __init__(self, store: "DocumentStore", key: uuid.UUID, options: SessionOptio
458458
self._documents_by_id = DocumentsByIdHolder()
459459
self._included_documents_by_id = CaseInsensitiveDict()
460460
self.include_revisions_by_change_vector = CaseInsensitiveDict()
461-
self.include_revisions_by_date_time_before: Optional[
462-
Dict[str, Dict[datetime.datetime, DocumentInfo]]
463-
] = CaseInsensitiveDict()
461+
self.include_revisions_by_date_time_before: Optional[Dict[str, Dict[datetime.datetime, DocumentInfo]]] = (
462+
CaseInsensitiveDict()
463+
)
464464
self._documents_by_entity: DocumentsByEntityHolder = DocumentsByEntityHolder()
465465

466466
self._counters_by_doc_id: Dict[str, List[Dict[str, int]]] = CaseInsensitiveDict()

ravendb/documents/subscriptions/worker.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ def __init__(
124124
def from_json(cls, json_dict: Dict) -> SubscriptionConnectionServerMessage:
125125
return cls(
126126
SubscriptionConnectionServerMessage.MessageType(json_dict["Type"]),
127-
SubscriptionConnectionServerMessage.ConnectionStatus(json_dict["Status"])
128-
if "Status" in json_dict
129-
else None,
127+
(
128+
SubscriptionConnectionServerMessage.ConnectionStatus(json_dict["Status"])
129+
if "Status" in json_dict
130+
else None
131+
),
130132
json_dict["Data"] if "Data" in json_dict else None,
131133
json_dict["Includes"] if "Includes" in json_dict else None,
132134
json_dict["CounterIncludes"] if "CounterIncludes" in json_dict else None,

0 commit comments

Comments
 (0)