Revize 2f227a6c
Přidáno uživatelem Tomáš Ballák před více než 3 roky(ů)
modules/crawler/Utilities/helpers.py | ||
---|---|---|
1 |
from typing import Dict |
|
2 |
|
|
1 | 3 |
SKIP = "SKIP" |
2 | 4 |
UNKNOWN = "UNKNOWN!" |
3 | 5 |
|
... | ... | |
5 | 7 |
def should_skip(device) -> bool: |
6 | 8 |
return device['x'] == SKIP or device['y'] == SKIP or device[ |
7 | 9 |
'x'] == UNKNOWN or device['y'] == UNKNOWN |
10 |
|
|
11 |
|
|
12 |
def detect_change(first: Dict[str, str], second: Dict[str, str], compareKeys: [str]) -> bool: |
|
13 |
"""Detects change between two dictonaries |
|
14 |
|
|
15 |
Args: |
|
16 |
first (Dict[str, str]): First dictionary |
|
17 |
second (Dict[str, str]): Second dictionary |
|
18 |
compareKeys ([type]): Keys to handle comparison |
|
19 |
|
|
20 |
Returns: |
|
21 |
bool: Is there a change ? |
|
22 |
""" |
|
23 |
for key in compareKeys: |
|
24 |
if key not in second or key not in first: |
|
25 |
return True |
|
26 |
if first[key] != second[key]: |
|
27 |
return True |
|
28 |
return False |
Také k dispozici: Unified diff
Feature Re #8156 show all datasets