cognite-neat 1.0.26__py3-none-any.whl → 1.0.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cognite/neat/_config.py +1 -0
- cognite/neat/_data_model/models/dms/_limits.py +4 -0
- cognite/neat/_session/_cdf.py +36 -0
- cognite/neat/_session/_html/_render.py +8 -3
- cognite/neat/_session/_html/static/__init__.py +3 -0
- cognite/neat/_session/_html/static/statistics.css +163 -0
- cognite/neat/_session/_html/static/statistics.js +108 -0
- cognite/neat/_session/_html/templates/__init__.py +1 -0
- cognite/neat/_session/_html/templates/statistics.html +26 -0
- cognite/neat/_session/_session.py +4 -0
- cognite/neat/_utils/_reader.py +7 -7
- cognite/neat/_version.py +1 -1
- {cognite_neat-1.0.26.dist-info → cognite_neat-1.0.27.dist-info}/METADATA +1 -1
- {cognite_neat-1.0.26.dist-info → cognite_neat-1.0.27.dist-info}/RECORD +15 -11
- {cognite_neat-1.0.26.dist-info → cognite_neat-1.0.27.dist-info}/WHEEL +0 -0
cognite/neat/_config.py
CHANGED
|
@@ -105,6 +105,7 @@ class AlphaFlagConfig(ConfigModel):
|
|
|
105
105
|
default=False,
|
|
106
106
|
description="If enabled, Neat will run experimental validators that are still in alpha stage.",
|
|
107
107
|
)
|
|
108
|
+
enable_cdf_analysis: bool = Field(default=False, description="If enabled, neat.cdf endpoint will be available.")
|
|
108
109
|
|
|
109
110
|
def __setattr__(self, key: str, value: Any) -> None:
|
|
110
111
|
"""Set attribute value or raise AttributeError."""
|
|
@@ -9,6 +9,7 @@ class SpaceLimit(BaseModel):
|
|
|
9
9
|
"""Limits for spaces."""
|
|
10
10
|
|
|
11
11
|
limit: int = 100
|
|
12
|
+
count: int = 0
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ListablePropertyLimits(BaseModel):
|
|
@@ -51,6 +52,7 @@ class ContainerLimits(BaseModel):
|
|
|
51
52
|
"""Limits for containers."""
|
|
52
53
|
|
|
53
54
|
limit: int = 1_000
|
|
55
|
+
count: int = 0
|
|
54
56
|
properties: ContainerPropertyLimits = Field(default_factory=ContainerPropertyLimits)
|
|
55
57
|
|
|
56
58
|
|
|
@@ -58,6 +60,7 @@ class ViewLimits(BaseModel):
|
|
|
58
60
|
"""Limits for views."""
|
|
59
61
|
|
|
60
62
|
limit: int = 2_000
|
|
63
|
+
count: int = 0
|
|
61
64
|
versions: int = 100
|
|
62
65
|
properties: int = 300
|
|
63
66
|
implements: int = 10
|
|
@@ -68,6 +71,7 @@ class DataModelLimits(BaseModel):
|
|
|
68
71
|
"""Limits for data models."""
|
|
69
72
|
|
|
70
73
|
limit: int = 500
|
|
74
|
+
count: int = 0
|
|
71
75
|
versions: int = Field(100, description="Limit of versions per data model.")
|
|
72
76
|
views: int = Field(100, description="Limit of views per data model.")
|
|
73
77
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# /Users/nikola/repos/neat/cognite/neat/_session/_cdf.py
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
from cognite.neat._client import NeatClient
|
|
5
|
+
from cognite.neat._config import NeatConfig
|
|
6
|
+
from cognite.neat._store._store import NeatStore
|
|
7
|
+
|
|
8
|
+
from ._html._render import render
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CDF:
|
|
12
|
+
"""Read from a data source into NeatSession graph store."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, store: NeatStore, client: NeatClient, config: NeatConfig) -> None:
|
|
15
|
+
self._store = store
|
|
16
|
+
self._client = client
|
|
17
|
+
self._config = config
|
|
18
|
+
|
|
19
|
+
def _repr_html_(self) -> str:
|
|
20
|
+
"""Generate HTML representation of CDF schema statistics."""
|
|
21
|
+
unique_id = str(uuid.uuid4())[:8]
|
|
22
|
+
|
|
23
|
+
return render(
|
|
24
|
+
"statistics",
|
|
25
|
+
{
|
|
26
|
+
"unique_id": unique_id,
|
|
27
|
+
"spaces_current": self._store.cdf_limits.spaces.count,
|
|
28
|
+
"spaces_limit": self._store.cdf_limits.spaces.limit,
|
|
29
|
+
"containers_current": self._store.cdf_limits.containers.count,
|
|
30
|
+
"containers_limit": self._store.cdf_limits.containers.limit,
|
|
31
|
+
"views_current": self._store.cdf_limits.views.count,
|
|
32
|
+
"views_limit": self._store.cdf_limits.views.limit,
|
|
33
|
+
"data_models_current": self._store.cdf_limits.data_models.count,
|
|
34
|
+
"data_models_limit": self._store.cdf_limits.data_models.limit,
|
|
35
|
+
},
|
|
36
|
+
)
|
|
@@ -4,13 +4,13 @@ from . import static, templates
|
|
|
4
4
|
|
|
5
5
|
ENCODING = "utf-8"
|
|
6
6
|
|
|
7
|
-
Template: TypeAlias = Literal["issues", "deployment"]
|
|
7
|
+
Template: TypeAlias = Literal["issues", "deployment", "statistics"]
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def render(template_name: Literal["issues", "deployment"], variables: dict[str, Any]) -> str:
|
|
10
|
+
def render(template_name: Literal["issues", "deployment", "statistics"], variables: dict[str, Any]) -> str:
|
|
11
11
|
"""Generate HTML content from a template and variables."""
|
|
12
12
|
|
|
13
|
-
if template_name not in ["issues", "deployment"]:
|
|
13
|
+
if template_name not in ["issues", "deployment", "statistics"]:
|
|
14
14
|
raise ValueError(f"Unknown template name: {template_name}")
|
|
15
15
|
|
|
16
16
|
variables["SHARED_CSS"] = static.shared_style.read_text(encoding=ENCODING)
|
|
@@ -25,6 +25,11 @@ def render(template_name: Literal["issues", "deployment"], variables: dict[str,
|
|
|
25
25
|
variables["SCRIPTS"] = static.deployment_scripts.read_text(encoding=ENCODING)
|
|
26
26
|
variables["SPECIFIC_CSS"] = static.deployment_style.read_text(encoding=ENCODING)
|
|
27
27
|
|
|
28
|
+
elif template_name == "statistics":
|
|
29
|
+
template = templates.statistics.read_text(encoding=ENCODING)
|
|
30
|
+
variables["SCRIPTS"] = static.statistics_scripts.read_text(encoding=ENCODING)
|
|
31
|
+
variables["SPECIFIC_CSS"] = static.statistics_style.read_text(encoding=ENCODING)
|
|
32
|
+
|
|
28
33
|
for key, value in variables.items():
|
|
29
34
|
template = template.replace(f"{{{{{key}}}}}", str(value))
|
|
30
35
|
return template
|
|
@@ -6,3 +6,6 @@ issues_scripts = Path(__file__).parent / "issues.js"
|
|
|
6
6
|
|
|
7
7
|
deployment_style = Path(__file__).parent / "deployment.css"
|
|
8
8
|
deployment_scripts = Path(__file__).parent / "deployment.js"
|
|
9
|
+
|
|
10
|
+
statistics_style = Path(__file__).parent / "statistics.css"
|
|
11
|
+
statistics_scripts = Path(__file__).parent / "statistics.js"
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
.statistics-container {
|
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
3
|
+
padding: 20px;
|
|
4
|
+
background: var(--bg-secondary);
|
|
5
|
+
border-radius: 8px;
|
|
6
|
+
color: var(--text-primary);
|
|
7
|
+
transition: all 0.3s ease;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.statistics-header {
|
|
11
|
+
margin-bottom: 24px;
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.statistics-title {
|
|
16
|
+
margin: 0 0 8px 0;
|
|
17
|
+
font-size: 24px;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
color: var(--text-primary);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.statistics-subtitle {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
color: var(--text-secondary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.theme-toggle {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
padding: 8px 12px;
|
|
33
|
+
background: var(--bg-primary);
|
|
34
|
+
border: 2px solid var(--border-color);
|
|
35
|
+
border-radius: 6px;
|
|
36
|
+
color: var(--text-primary);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 6px;
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
transition: all 0.2s;
|
|
44
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.theme-toggle:hover {
|
|
48
|
+
background: var(--hover-bg);
|
|
49
|
+
border-color: var(--text-secondary);
|
|
50
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.theme-toggle:active {
|
|
54
|
+
transform: scale(0.98);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.statistics-grid {
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
60
|
+
gap: 16px;
|
|
61
|
+
margin-bottom: 20px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.stat-card {
|
|
65
|
+
background: var(--bg-primary);
|
|
66
|
+
padding: 16px;
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
69
|
+
border: 1px solid var(--border-light);
|
|
70
|
+
transition: all 0.3s ease;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.stat-label {
|
|
74
|
+
margin: 0 0 12px 0;
|
|
75
|
+
font-size: 14px;
|
|
76
|
+
color: var(--text-secondary);
|
|
77
|
+
text-transform: uppercase;
|
|
78
|
+
letter-spacing: 0.5px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.stat-value {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: baseline;
|
|
85
|
+
margin-bottom: 12px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.stat-current {
|
|
89
|
+
font-size: 28px;
|
|
90
|
+
font-weight: bold;
|
|
91
|
+
color: var(--text-primary);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.stat-limit {
|
|
95
|
+
color: var(--text-muted);
|
|
96
|
+
margin-left: 8px;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.stat-progress-bg {
|
|
101
|
+
background: var(--border-light);
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
height: 8px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
margin-bottom: 8px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.stat-progress-bar {
|
|
109
|
+
height: 100%;
|
|
110
|
+
transition: width 0.3s ease, background 0.3s ease;
|
|
111
|
+
background: #10b981;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stat-usage {
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
font-weight: 500;
|
|
117
|
+
color: #10b981;
|
|
118
|
+
transition: color 0.3s ease;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.statistics-additional {
|
|
122
|
+
background: var(--bg-primary);
|
|
123
|
+
padding: 16px;
|
|
124
|
+
border-radius: 6px;
|
|
125
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
126
|
+
border: 1px solid var(--border-light);
|
|
127
|
+
transition: all 0.3s ease;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.additional-title {
|
|
131
|
+
margin: 0 0 12px 0;
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
color: var(--text-secondary);
|
|
134
|
+
text-transform: uppercase;
|
|
135
|
+
letter-spacing: 0.5px;
|
|
136
|
+
font-weight: 600;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.additional-content {
|
|
140
|
+
display: grid;
|
|
141
|
+
grid-template-columns: 1fr 1fr;
|
|
142
|
+
gap: 12px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.component-item {
|
|
146
|
+
color: var(--text-primary);
|
|
147
|
+
transition: color 0.3s ease;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.component-item strong {
|
|
151
|
+
color: var(--text-primary);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.component-value {
|
|
155
|
+
color: #0066cc;
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
margin-left: 8px;
|
|
158
|
+
transition: color 0.3s ease;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.dark-mode .component-value {
|
|
162
|
+
color: #60a5fa;
|
|
163
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
function initializeStatistics(uniqueId) {
|
|
2
|
+
/**
|
|
3
|
+
* Initialize stat cards with data from attributes and apply colors.
|
|
4
|
+
* Supports light/dark mode with color schema from shared CSS.
|
|
5
|
+
* Uses uniqueId to support multiple instances on the same page.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
function getColor(percentage) {
|
|
9
|
+
if (percentage < 50) return '#10b981'; // green
|
|
10
|
+
if (percentage < 80) return '#f59e0b'; // amber
|
|
11
|
+
return '#ef4444'; // red
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function renderCards() {
|
|
15
|
+
const container = document.getElementById('statisticsContainer-' + uniqueId);
|
|
16
|
+
if (!container) return;
|
|
17
|
+
|
|
18
|
+
const cards = container.querySelectorAll('.stat-card');
|
|
19
|
+
|
|
20
|
+
cards.forEach(card => {
|
|
21
|
+
// Skip if already rendered
|
|
22
|
+
if (card.querySelector('.stat-label')) return;
|
|
23
|
+
|
|
24
|
+
const current = parseInt(card.dataset.current);
|
|
25
|
+
const limit = parseInt(card.dataset.limit);
|
|
26
|
+
const label = card.dataset.label;
|
|
27
|
+
const percentage = (current / limit * 100) || 0;
|
|
28
|
+
const color = getColor(percentage);
|
|
29
|
+
|
|
30
|
+
// Build card HTML
|
|
31
|
+
card.innerHTML = `
|
|
32
|
+
<h3 class="stat-label">${label}</h3>
|
|
33
|
+
<div class="stat-value">
|
|
34
|
+
<span class="stat-current">${current}</span>
|
|
35
|
+
<span class="stat-limit">/ ${limit}</span>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="stat-progress-bg">
|
|
38
|
+
<div class="stat-progress-bar" style="background: ${color}; width: ${Math.min(percentage, 100)}%;"></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="stat-usage" style="color: ${color};">${percentage.toFixed(1)}% used</div>
|
|
41
|
+
`;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function setupThemeToggle() {
|
|
46
|
+
const container = document.getElementById('statisticsContainer-' + uniqueId);
|
|
47
|
+
if (!container) return;
|
|
48
|
+
|
|
49
|
+
// Check if theme toggle already exists
|
|
50
|
+
if (container.querySelector('.theme-toggle')) return;
|
|
51
|
+
|
|
52
|
+
// Create theme toggle button
|
|
53
|
+
const header = container.querySelector('.statistics-header');
|
|
54
|
+
if (!header) return;
|
|
55
|
+
|
|
56
|
+
const themeToggle = document.createElement('button');
|
|
57
|
+
themeToggle.className = 'theme-toggle';
|
|
58
|
+
themeToggle.id = 'themeToggleStats-' + uniqueId;
|
|
59
|
+
themeToggle.innerHTML = '<span id="themeIcon-' + uniqueId + '">🌙</span><span id="themeText-' + uniqueId + '">Dark</span>';
|
|
60
|
+
|
|
61
|
+
header.appendChild(themeToggle);
|
|
62
|
+
|
|
63
|
+
// Load saved theme preference
|
|
64
|
+
const storageKey = 'neat-statistics-theme-' + uniqueId;
|
|
65
|
+
const savedTheme = localStorage.getItem(storageKey) || 'light';
|
|
66
|
+
|
|
67
|
+
// Toggle theme on button click
|
|
68
|
+
themeToggle.addEventListener('click', () => {
|
|
69
|
+
const isDarkMode = container.classList.contains('dark-mode');
|
|
70
|
+
const newTheme = isDarkMode ? 'light' : 'dark';
|
|
71
|
+
applyTheme(newTheme);
|
|
72
|
+
localStorage.setItem(storageKey, newTheme);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function applyTheme(theme) {
|
|
76
|
+
const isDark = theme === 'dark';
|
|
77
|
+
const themeIcon = document.querySelector('#themeIcon-' + uniqueId);
|
|
78
|
+
const themeText = document.querySelector('#themeText-' + uniqueId);
|
|
79
|
+
|
|
80
|
+
if (isDark) {
|
|
81
|
+
container.classList.add('dark-mode');
|
|
82
|
+
if (themeIcon) themeIcon.textContent = '☀️';
|
|
83
|
+
if (themeText) themeText.textContent = 'Light';
|
|
84
|
+
} else {
|
|
85
|
+
container.classList.remove('dark-mode');
|
|
86
|
+
if (themeIcon) themeIcon.textContent = '🌙';
|
|
87
|
+
if (themeText) themeText.textContent = 'Dark';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Apply initial theme
|
|
92
|
+
applyTheme(savedTheme);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Render cards and setup theme toggle
|
|
96
|
+
renderCards();
|
|
97
|
+
setupThemeToggle();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Call immediately with uniqueId for Jupyter notebooks
|
|
101
|
+
initializeStatistics(uniqueId);
|
|
102
|
+
|
|
103
|
+
// Also try on DOMContentLoaded for regular HTML pages
|
|
104
|
+
if (document.readyState === 'loading') {
|
|
105
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
106
|
+
initializeStatistics(uniqueId);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
{{SHARED_CSS}}
|
|
3
|
+
{{SPECIFIC_CSS}}
|
|
4
|
+
</style>
|
|
5
|
+
|
|
6
|
+
<div class="statistics-container" id="statisticsContainer-{{unique_id}}">
|
|
7
|
+
<div class="statistics-header">
|
|
8
|
+
<h2 class="statistics-title">CDF DMS Statistics</h2>
|
|
9
|
+
<p class="statistics-subtitle">Project usage and limits overview</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="statistics-grid">
|
|
13
|
+
<div class="stat-card" data-current="{{spaces_current}}" data-limit="{{spaces_limit}}" data-label="Spaces"></div>
|
|
14
|
+
<div class="stat-card" data-current="{{containers_current}}" data-limit="{{containers_limit}}" data-label="Containers"></div>
|
|
15
|
+
<div class="stat-card" data-current="{{views_current}}" data-limit="{{views_limit}}" data-label="Views"></div>
|
|
16
|
+
<div class="stat-card" data-current="{{data_models_current}}" data-limit="{{data_models_limit}}" data-label="Data Models"></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
(function() {
|
|
23
|
+
const uniqueId = '{{unique_id}}';
|
|
24
|
+
{{SCRIPTS}}
|
|
25
|
+
})();
|
|
26
|
+
</script>
|
|
@@ -10,6 +10,7 @@ from cognite.neat._state_machine import EmptyState, PhysicalState
|
|
|
10
10
|
from cognite.neat._store import NeatStore
|
|
11
11
|
from cognite.neat._utils.http_client import ParametersRequest, SuccessResponse
|
|
12
12
|
|
|
13
|
+
from ._cdf import CDF
|
|
13
14
|
from ._issues import Issues
|
|
14
15
|
from ._physical import PhysicalDataModel
|
|
15
16
|
from ._result import Result
|
|
@@ -51,6 +52,9 @@ class NeatSession:
|
|
|
51
52
|
self.issues = Issues(self._store)
|
|
52
53
|
self.result = Result(self._store)
|
|
53
54
|
|
|
55
|
+
if self._config.alpha.enable_cdf_analysis:
|
|
56
|
+
self.cdf = CDF(self._store, self._client, self._config)
|
|
57
|
+
|
|
54
58
|
collector = Collector()
|
|
55
59
|
if collector.can_collect:
|
|
56
60
|
collector.collect("initSession", {"mode": self._config.modeling.mode})
|
cognite/neat/_utils/_reader.py
CHANGED
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
from typing import IO, Any, TextIO
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import httpx
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class NeatReader(ABC):
|
|
@@ -124,24 +124,24 @@ class HttpFileReader(NeatReader):
|
|
|
124
124
|
return self.path
|
|
125
125
|
|
|
126
126
|
def read_text(self) -> str:
|
|
127
|
-
response =
|
|
127
|
+
response = httpx.get(self._url)
|
|
128
128
|
response.raise_for_status()
|
|
129
129
|
return response.text
|
|
130
130
|
|
|
131
131
|
def read_bytes(self) -> bytes:
|
|
132
|
-
response =
|
|
132
|
+
response = httpx.get(self._url)
|
|
133
133
|
response.raise_for_status()
|
|
134
134
|
return response.content
|
|
135
135
|
|
|
136
136
|
def size(self) -> int:
|
|
137
|
-
response =
|
|
137
|
+
response = httpx.head(self._url)
|
|
138
138
|
response.raise_for_status()
|
|
139
139
|
return int(response.headers["Content-Length"])
|
|
140
140
|
|
|
141
141
|
def iterate(self, chunk_size: int) -> Iterable[str]:
|
|
142
|
-
with
|
|
142
|
+
with httpx.stream("GET", self._url) as response:
|
|
143
143
|
response.raise_for_status()
|
|
144
|
-
for chunk in response.
|
|
144
|
+
for chunk in response.iter_bytes(chunk_size):
|
|
145
145
|
yield chunk.decode("utf-8")
|
|
146
146
|
|
|
147
147
|
def __enter__(self) -> IO:
|
|
@@ -151,7 +151,7 @@ class HttpFileReader(NeatReader):
|
|
|
151
151
|
return self._url
|
|
152
152
|
|
|
153
153
|
def exists(self) -> bool:
|
|
154
|
-
response =
|
|
154
|
+
response = httpx.head(self._url)
|
|
155
155
|
return 200 <= response.status_code < 400
|
|
156
156
|
|
|
157
157
|
def materialize_path(self) -> Path:
|
cognite/neat/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.27"
|
|
2
2
|
__engine__ = "^2.0.4"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.27
|
|
4
4
|
Summary: Knowledge graph transformation
|
|
5
5
|
Author: Nikola Vasiljevic, Anders Albert
|
|
6
6
|
Author-email: Nikola Vasiljevic <nikola.vasiljevic@cognite.com>, Anders Albert <anders.albert@cognite.com>
|
|
@@ -15,7 +15,7 @@ cognite/neat/_client/init/main.py,sha256=D-9bsor07T84iFnTZLnhIFA1Xey9zsooHaDhXVe
|
|
|
15
15
|
cognite/neat/_client/spaces_api.py,sha256=yb26ju3sKbVgiduMEbN4LDGan6vsC3z_JaW3p4FUdr0,2929
|
|
16
16
|
cognite/neat/_client/statistics_api.py,sha256=5meeh0v5mxC2SMB7xGdOwMh4KkaX3DtpUjbGEPhNBJo,913
|
|
17
17
|
cognite/neat/_client/views_api.py,sha256=YMaw7IaxU4gmixpd_t1u9JK9BHfNerf5DMNinGPCAa0,3692
|
|
18
|
-
cognite/neat/_config.py,sha256=
|
|
18
|
+
cognite/neat/_config.py,sha256=RVVV6qTkFlS88lJKShIcz9pcCV4OlCxFW8dUbSi50-4,10003
|
|
19
19
|
cognite/neat/_data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
cognite/neat/_data_model/_analysis.py,sha256=dN-udKm_5oD3217O4B_QIps2Hx4v50-Pu2fR0bQNQg0,23504
|
|
21
21
|
cognite/neat/_data_model/_constants.py,sha256=E2axzdYjsIy7lTHsjW91wsv6r-pUwko8g6K8C_oRnxk,1707
|
|
@@ -61,7 +61,7 @@ cognite/neat/_data_model/models/dms/_data_model.py,sha256=tq_JGNN-1JxG46bhBhunZi
|
|
|
61
61
|
cognite/neat/_data_model/models/dms/_data_types.py,sha256=FMt_d5aJD-o3s9VQWyyCVlHk7D_p3RlSNXBP1OACPs4,6424
|
|
62
62
|
cognite/neat/_data_model/models/dms/_http.py,sha256=YIRRowqkphFAYkx3foTeLyPMe9fNnmzhUCBDXe0u9Kk,926
|
|
63
63
|
cognite/neat/_data_model/models/dms/_indexes.py,sha256=ZtXe8ABuRcsAwRIZ9FCanS3uwZHpkOAhvDvjSXtx_Fs,900
|
|
64
|
-
cognite/neat/_data_model/models/dms/_limits.py,sha256
|
|
64
|
+
cognite/neat/_data_model/models/dms/_limits.py,sha256=-vwRutprJ7rPXLleSxCh_satR9AqRAvEMig5wSVBEXg,3596
|
|
65
65
|
cognite/neat/_data_model/models/dms/_references.py,sha256=Mx_nxfvOrvAx7nvebhhbFw6eRm3nHqeFW5P5AqADUlM,3890
|
|
66
66
|
cognite/neat/_data_model/models/dms/_schema.py,sha256=2JFLcm52smzPdtZ69Lf02UbYAD8I_hpRbI7ZAzdxJJs,641
|
|
67
67
|
cognite/neat/_data_model/models/dms/_space.py,sha256=mj6gID4vcAGsHNtgfXm4_4FMOQbUOkMd3HaYEdy07XM,1895
|
|
@@ -88,17 +88,21 @@ cognite/neat/_data_model/validation/dms/_views.py,sha256=pRdnj5ZBnHNnbLKleXGbipt
|
|
|
88
88
|
cognite/neat/_exceptions.py,sha256=mO19TEecZYDNqSvzuc6JmCLFQ70eniT1-Gb0AEbgbzE,2090
|
|
89
89
|
cognite/neat/_issues.py,sha256=wH1mnkrpBsHUkQMGUHFLUIQWQlfJ_qMfdF7q0d9wNhY,1871
|
|
90
90
|
cognite/neat/_session/__init__.py,sha256=owqW5Mml2DSZx1AvPvwNRTBngfhBNrQ6EH-7CKL7Jp0,61
|
|
91
|
+
cognite/neat/_session/_cdf.py,sha256=Ps49pc2tKriImpDkcIABnCgrfoX-L3QGmnXK8ceJ1Lc,1365
|
|
91
92
|
cognite/neat/_session/_html/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
|
-
cognite/neat/_session/_html/_render.py,sha256=
|
|
93
|
-
cognite/neat/_session/_html/static/__init__.py,sha256=
|
|
93
|
+
cognite/neat/_session/_html/_render.py,sha256=ksauN5-lW9GFakPILfaql3CGXpVMwIuvaY8XaEjhFnE,1520
|
|
94
|
+
cognite/neat/_session/_html/static/__init__.py,sha256=VLqgkeITPLrR_WAbVkc_BtGOaHCHbreTHewkoCdgPgQ,427
|
|
94
95
|
cognite/neat/_session/_html/static/deployment.css,sha256=wug_K8-h281UTrUJE2l4EbLSjZCO56yZBbP9iUwaYew,7823
|
|
95
96
|
cognite/neat/_session/_html/static/deployment.js,sha256=mOVNWLgDAOdNUGFFJmI527pmMYHOAFFrpthFpO0w0-o,6969
|
|
96
97
|
cognite/neat/_session/_html/static/issues.css,sha256=Egvqo2cnY8FKTtZp_v3rTWcIgb1vTJvToNCJJovWm70,3824
|
|
97
98
|
cognite/neat/_session/_html/static/issues.js,sha256=NHx_iAsZTvpZjOoFsxFU_sxqjF4-F4EdHRmoc2DjpIE,6348
|
|
98
99
|
cognite/neat/_session/_html/static/shared.css,sha256=uUm5fqK1zrMBWCuAWdUoBRaAj9AO611hUxuGvxMzbzc,4190
|
|
99
|
-
cognite/neat/_session/_html/
|
|
100
|
+
cognite/neat/_session/_html/static/statistics.css,sha256=slVBqYfyX_kRw0jei07Okc3k0p7vjtv2pZ0wMoBXO8g,3174
|
|
101
|
+
cognite/neat/_session/_html/static/statistics.js,sha256=oJUcdZWRaMObuYh3I5mziHyC02va79t3j991LCIhbhY,4132
|
|
102
|
+
cognite/neat/_session/_html/templates/__init__.py,sha256=UrIzxTgHfe67CB0Q9nxi38gLpVxTkhoUYTdcjLw_zYk,183
|
|
100
103
|
cognite/neat/_session/_html/templates/deployment.html,sha256=aLDXMbF3pcSqnCpUYVGmIWfqU2jyYUUTaGfpSHRLzdU,3715
|
|
101
104
|
cognite/neat/_session/_html/templates/issues.html,sha256=zjhkJcPK0hMp_ZKJ9RCf88tuZxQyTYRPxzpqx33Nkt0,1661
|
|
105
|
+
cognite/neat/_session/_html/templates/statistics.html,sha256=C-ghoT8xzBehAJLOonNzCB418LW-FA60MaZBHlW1D5c,968
|
|
102
106
|
cognite/neat/_session/_issues.py,sha256=E8UQeSJURg2dm4MF1pfD9dp-heSRT7pgQZgKlD1-FGs,2723
|
|
103
107
|
cognite/neat/_session/_physical.py,sha256=e3i9xuLa4bMOa-mJxbf4AyLZ2UnPOPh05P-E7E0lRHY,12449
|
|
104
108
|
cognite/neat/_session/_result/__init__.py,sha256=8A0BKgsqnjxkiHUlCpHBNl3mrFWtyjaWYnh0jssE6QU,50
|
|
@@ -108,7 +112,7 @@ cognite/neat/_session/_result/_deployment/_physical/_changes.py,sha256=CmFWxAMtV
|
|
|
108
112
|
cognite/neat/_session/_result/_deployment/_physical/_statistics.py,sha256=aOXZTSOGmVggERB4mKaqQEUx40vrxiN9ZkwjKU1555A,6324
|
|
109
113
|
cognite/neat/_session/_result/_deployment/_physical/serializer.py,sha256=BbCUb7_C75enMimGgTPg-ZW1QGcRhPDf5dNwpWdM790,1272
|
|
110
114
|
cognite/neat/_session/_result/_result.py,sha256=OnjIJQSnIzYr-IE50rq7z3CVO0LpVE8tAaZN7XPjlKw,1188
|
|
111
|
-
cognite/neat/_session/_session.py,sha256=
|
|
115
|
+
cognite/neat/_session/_session.py,sha256=hv7PgS34jrVqLpyXk7PNmmlwZQ8lG4eCMNTKKrS5AL0,3871
|
|
112
116
|
cognite/neat/_session/_usage_analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
113
117
|
cognite/neat/_session/_usage_analytics/_collector.py,sha256=8yVfzt8KFfZ-ldkVjDWazuQbs45Q3r6vWKcZEwU8i18,4734
|
|
114
118
|
cognite/neat/_session/_usage_analytics/_constants.py,sha256=-tVdYrCTMKfuMlbO7AlzC29Nug41ug6uuX9DFuihpJg,561
|
|
@@ -121,7 +125,7 @@ cognite/neat/_store/__init__.py,sha256=TvM9CcFbtOSrxydPAuJi6Bv_iiGard1Mxfx42ZFoT
|
|
|
121
125
|
cognite/neat/_store/_provenance.py,sha256=1zzRDWjR9twZu2jVyIG3UdYdIXtQKJ7uF8a0hV7LEuA,3368
|
|
122
126
|
cognite/neat/_store/_store.py,sha256=jtJPBQ8PBG0UlgzSJJpzOIRkC2Np3fHNtV4omRC6H5A,9629
|
|
123
127
|
cognite/neat/_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
124
|
-
cognite/neat/_utils/_reader.py,sha256=
|
|
128
|
+
cognite/neat/_utils/_reader.py,sha256=pBAwGK_UMd-mGnAP3cXXj3SrORocR3lFKxn-WaVjqsY,5367
|
|
125
129
|
cognite/neat/_utils/auxiliary.py,sha256=YQMpqCxccex_slmLYrR5icVX9aeLbD793ou7IrbNTFs,1654
|
|
126
130
|
cognite/neat/_utils/collection.py,sha256=BIwRrFbUXNPvHhEVujLHgVoDJXzdPEMScrbSBhyCibk,446
|
|
127
131
|
cognite/neat/_utils/http_client/__init__.py,sha256=qaCLLLhi7H3b_cmbknX0S66KILT7JSKX1YSgZjNdd1U,786
|
|
@@ -323,9 +327,9 @@ cognite/neat/_v0/session/_template.py,sha256=BNcvrW5y7LWzRM1XFxZkfR1Nc7e8UgjBClH
|
|
|
323
327
|
cognite/neat/_v0/session/_to.py,sha256=AnsRSDDdfFyYwSgi0Z-904X7WdLtPfLlR0x1xsu_jAo,19447
|
|
324
328
|
cognite/neat/_v0/session/_wizard.py,sha256=baPJgXAAF3d1bn4nbIzon1gWfJOeS5T43UXRDJEnD3c,1490
|
|
325
329
|
cognite/neat/_v0/session/exceptions.py,sha256=jv52D-SjxGfgqaHR8vnpzo0SOJETIuwbyffSWAxSDJw,3495
|
|
326
|
-
cognite/neat/_version.py,sha256=
|
|
330
|
+
cognite/neat/_version.py,sha256=vAAE44lerdUbMFmvek-cvXJNv0YOmSmko3S7C3YPS_E,45
|
|
327
331
|
cognite/neat/legacy.py,sha256=eI2ecxOV8ilGHyLZlN54ve_abtoK34oXognkFv3yvF0,219
|
|
328
332
|
cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
329
|
-
cognite_neat-1.0.
|
|
330
|
-
cognite_neat-1.0.
|
|
331
|
-
cognite_neat-1.0.
|
|
333
|
+
cognite_neat-1.0.27.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
|
|
334
|
+
cognite_neat-1.0.27.dist-info/METADATA,sha256=e7WEaTh_fktSuUadCnDGjDIVPZ8Wtr7LxCNPQwT96I8,6689
|
|
335
|
+
cognite_neat-1.0.27.dist-info/RECORD,,
|
|
File without changes
|