orchid-python-api 5.25.2__py3-none-any.whl → 5.25.4__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.
Files changed (57) hide show
  1. orchid_python_api/examples/search_data_frames.py +1 -1
  2. {orchid_python_api-5.25.2.dist-info → orchid_python_api-5.25.4.dist-info}/METADATA +4 -3
  3. orchid_python_api-5.25.4.dist-info/RECORD +38 -0
  4. {orchid_python_api-5.25.2.dist-info → orchid_python_api-5.25.4.dist-info}/WHEEL +1 -1
  5. ReleaseNotes.md +0 -708
  6. copy_orchid_examples.py +0 -88
  7. copy_orchid_low_level_examples.py +0 -93
  8. copy_orchid_manual_examples.py +0 -93
  9. copy_orchid_tutorials.py +0 -88
  10. orchid/VERSION +0 -1
  11. orchid/__init__.py +0 -42
  12. orchid/__version__.py +0 -18
  13. orchid/base.py +0 -31
  14. orchid/base_time_series_adapter.py +0 -91
  15. orchid/configuration.py +0 -162
  16. orchid/convert.py +0 -44
  17. orchid/core.py +0 -149
  18. orchid/dom_project_object.py +0 -28
  19. orchid/dot_net.py +0 -68
  20. orchid/dot_net_disposable.py +0 -64
  21. orchid/dot_net_dom_access.py +0 -241
  22. orchid/measurement.py +0 -35
  23. orchid/native_data_frame_adapter.py +0 -247
  24. orchid/native_fiber_data.py +0 -73
  25. orchid/native_fiber_data_set_info.py +0 -28
  26. orchid/native_monitor_adapter.py +0 -67
  27. orchid/native_project_user_data_adapter.py +0 -137
  28. orchid/native_stage_adapter.py +0 -631
  29. orchid/native_stage_part_adapter.py +0 -50
  30. orchid/native_subsurface_point.py +0 -70
  31. orchid/native_time_series_adapter.py +0 -54
  32. orchid/native_trajectory_adapter.py +0 -246
  33. orchid/native_treatment_calculations.py +0 -158
  34. orchid/native_treatment_curve_adapter.py +0 -60
  35. orchid/native_well_adapter.py +0 -134
  36. orchid/net_date_time.py +0 -328
  37. orchid/net_enumerable.py +0 -72
  38. orchid/net_fracture_diagnostics_factory.py +0 -55
  39. orchid/net_quantity.py +0 -620
  40. orchid/net_stage_qc.py +0 -62
  41. orchid/physical_quantity.py +0 -37
  42. orchid/project.py +0 -182
  43. orchid/project_store.py +0 -269
  44. orchid/reference_origins.py +0 -34
  45. orchid/script_adapter_context.py +0 -81
  46. orchid/searchable_data_frames.py +0 -44
  47. orchid/searchable_project_objects.py +0 -190
  48. orchid/searchable_stage_parts.py +0 -73
  49. orchid/searchable_stages.py +0 -29
  50. orchid/unit_system.py +0 -173
  51. orchid/utils.py +0 -14
  52. orchid/validation.py +0 -52
  53. orchid/version.py +0 -37
  54. orchid_python_api-5.25.2.dist-info/LICENSE +0 -176
  55. orchid_python_api-5.25.2.dist-info/RECORD +0 -88
  56. {orchid_python_api-5.25.2.dist-info → orchid_python_api-5.25.4.dist-info}/entry_points.txt +0 -0
  57. /LICENSE → /orchid_python_api-5.25.4.dist-info/licenses/LICENSE +0 -0
@@ -1,134 +0,0 @@
1
- # Copyright (c) 2017-2025 KAPPA
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # This file is part of Orchid and related technologies.
16
- #
17
-
18
- from collections import namedtuple
19
- from typing import Iterable
20
-
21
- import option
22
- import toolz.curried as toolz
23
-
24
- import orchid.base
25
- from orchid import (
26
- dot_net_dom_access as dna,
27
- dot_net_disposable as dnd,
28
- dom_project_object as dpo,
29
- searchable_stages as oss,
30
- measurement as om,
31
- native_stage_adapter as nsa,
32
- native_subsurface_point as nsp,
33
- native_trajectory_adapter as nta,
34
- net_quantity as onq,
35
- reference_origins as origins,
36
- )
37
-
38
- # noinspection PyUnresolvedReferences
39
- from Orchid.FractureDiagnostics import IStage, IWell
40
- # noinspection PyUnresolvedReferences
41
- import UnitsNet
42
- # noinspection PyUnresolvedReferences
43
- from System import Array, UInt32
44
-
45
- WellHeadLocation = namedtuple('WellHeadLocation',
46
- ['easting', 'northing', 'depth'])
47
-
48
-
49
- def replace_no_uwi_with_text(uwi):
50
- return uwi if uwi else 'No UWI'
51
-
52
-
53
- class NativeWellAdapter(dpo.DomProjectObject):
54
- """Adapts a native IWell to python."""
55
-
56
- def __init__(self, net_well: IWell):
57
- """
58
- Constructs an instance adapting a .NET IWell.
59
-
60
- Args:
61
- net_well: The .NET well to be adapted.
62
- """
63
- super().__init__(net_well, orchid.base.constantly(net_well.Project))
64
-
65
- trajectory = dna.transformed_dom_property('trajectory', 'The trajectory of the adapted .NET well.',
66
- nta.NativeTrajectoryAdapterIdentified)
67
- uwi = dna.transformed_dom_property('uwi', 'The UWI of the adapted .', replace_no_uwi_with_text)
68
-
69
- # The formation property **does not** check when a `None` value is passed from Orchid.
70
- # Although it is possible, it is very unlikely to occur from IWell.Formation.
71
- formation = dna.dom_property('formation', 'The production formation the well is landed')
72
-
73
- @property
74
- def ground_level_elevation_above_sea_level(self) -> om.Quantity:
75
- return onq.as_measurement(self.expect_project_units.LENGTH,
76
- option.maybe(self.dom_object.GroundLevelElevationAboveSeaLevel))
77
-
78
- @property
79
- def kelly_bushing_height_above_ground_level(self) -> om.Quantity:
80
- return onq.as_measurement(self.expect_project_units.LENGTH,
81
- option.maybe(self.dom_object.KellyBushingHeightAboveGroundLevel))
82
-
83
- @property
84
- def wellhead_location(self):
85
- dom_whl = self.dom_object.WellHeadLocation
86
- result = toolz.pipe(dom_whl,
87
- toolz.map(option.maybe),
88
- toolz.map(onq.as_measurement(self.expect_project_units.LENGTH)),
89
- list, )
90
- return WellHeadLocation(*result)
91
-
92
- def stages(self) -> oss.SearchableStages:
93
- """
94
- Return a `spo.SearchableProjectObjects` instance of all the stages for this project.
95
-
96
- Returns:
97
- An `spo.SearchableProjectObjects` for all the stages of this project.
98
- """
99
- return oss.SearchableStages(nsa.NativeStageAdapter, self.dom_object.Stages.Items)
100
-
101
- def locations_for_md_kb_values(self,
102
- md_kb_values: Iterable[om.Quantity],
103
- well_reference_frame_xy: origins.WellReferenceFrameXy,
104
- depth_origin: origins.DepthDatum) -> Iterable[nsp.SubsurfacePoint]:
105
- sample_at = Array[UnitsNet.Length](toolz.map(onq.as_net_quantity(self.expect_project_units.LENGTH),
106
- md_kb_values))
107
- result = toolz.pipe(
108
- self.dom_object.GetLocationsForMdKbValues(sample_at, well_reference_frame_xy.value, depth_origin.value),
109
- toolz.map(nsp.make_subsurface_point(self.expect_project_units.LENGTH)),
110
- list,
111
- )
112
- return result
113
-
114
- def add_stages(self, create_stage_dtos: Iterable[nsa.CreateStageDto]):
115
- created_stages = [csd.create_stage(self) for csd in create_stage_dtos]
116
-
117
- with dnd.disposable(self.dom_object.ToMutable()) as mutable_well:
118
- native_created_stages = self._create_net_stages(created_stages)
119
- mutable_well.AddStages(native_created_stages)
120
-
121
- @staticmethod
122
- def _create_net_stages(created_stages):
123
- """
124
- Create a .NET `Array<IStage>`.
125
-
126
- This method primarily exists so that I can mock the call in unit tests.
127
-
128
- Args:
129
- created_stages: The `NativeStageAdapter` iterable over the created stages to add.
130
-
131
- Returns:
132
- The newly created .NET `Array<IStage>` instance.
133
- """
134
- return Array[IStage]([created_stage.dom_object for created_stage in created_stages])
orchid/net_date_time.py DELETED
@@ -1,328 +0,0 @@
1
- #
2
- # This file is part of Orchid and related technologies.
3
- #
4
- # Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
5
- #
6
- # LEGAL NOTICE:
7
- # Orchid contains trade secrets and otherwise confidential information
8
- # owned by KAPPA. Access to and use of this information is
9
- # strictly limited and controlled by the Company. This file may not be copied,
10
- # distributed, or otherwise disclosed outside of the Company's facilities
11
- # except under appropriate precautions to maintain the confidentiality hereof,
12
- # and may not be used in any way not expressly authorized by the Company.
13
- #
14
-
15
- """
16
- Functions to convert between .NET `DateTime` and similar instances and Python `pendulum` instances.
17
- """
18
-
19
-
20
- import datetime as dt
21
- import enum
22
- import functools
23
- from typing import Tuple, Union
24
-
25
- import dateutil.tz as duz
26
- import pendulum as pdt
27
-
28
- from orchid import base
29
-
30
- # noinspection PyUnresolvedReferences,PyPackageRequirements
31
- from System import (DateTime, DateTimeKind, DateTimeOffset, TimeSpan)
32
-
33
-
34
- # Encapsulate the use of pendulum and DateTime.
35
- UTC = pdt.UTC
36
- NET_NAT = DateTime.MinValue
37
- NAT = pdt.DateTime.min
38
-
39
-
40
- class TimePointTimeZoneKind(enum.Enum):
41
- """Models the kind of time point.
42
-
43
- This class eases conversions to the .NET `DateTime` class by providing Python with similar capabilities as
44
- the .NET `Enum`. (See
45
- [DateTimeKind](https://docs.microsoft.com/en-us/dotnet/api/system.datetimekind?view=net-5.0) for details).
46
- """
47
- UTC = DateTimeKind.Utc # Time zone is UTC
48
- LOCAL = DateTimeKind.Local # Time zone is specified to be local
49
- UNSPECIFIED = DateTimeKind.Unspecified # Time zone is unspecified
50
-
51
-
52
- class NetDateTimeError(ValueError):
53
- """
54
- Raised when an error occurs accessing the .NET `TimeZoneInfo` of a .NET `DateTime` instance.
55
- """
56
- pass
57
-
58
-
59
- class NetDateTimeLocalDateTimeKindError(NetDateTimeError):
60
- """
61
- Raised when the `DateTime.Kind` property of a .NET `DateTime` instance is `DateTimeKind.Local`.
62
- """
63
- def __init__(self, net_time_point: Union[DateTime, DateTimeOffset]):
64
- """
65
- Construct an instance from a .NET DateTime point in time.
66
-
67
- Args:
68
- net_time_point: A .NET DateTime representing a specific point in time.
69
- """
70
- super().__init__(self, '.NET DateTimeKind cannot be Local.', net_time_point.ToString("O"))
71
-
72
-
73
- class NetDateTimeUnspecifiedDateTimeKindError(NetDateTimeError):
74
- """
75
- Raised when the `DateTimeKind` property of a .NET `DateTime` instance is not recognized.
76
- """
77
- ERROR_PREFACE = '.NET DateTimeKind is unexpectedly Unspecified.'
78
-
79
- ERROR_SUFFIX = """
80
- Although .NET DateTime.Kind should not be Unspecified, it may be
81
- safe to ignore this error by catching the exception.
82
-
83
- However, because it unexpected, **please** report the issue to
84
- Reveal Energy Services.
85
- """
86
-
87
- def __init__(self, net_time_point: Union[DateTime, DateTimeOffset]):
88
- """
89
- Construct an instance from a .NET DateTime point in time.
90
-
91
- Args:
92
- net_time_point: A .NET DateTime representing a specific point in time.
93
- """
94
- super().__init__(self, NetDateTimeUnspecifiedDateTimeKindError.ERROR_PREFACE,
95
- net_time_point.ToString("O"), NetDateTimeUnspecifiedDateTimeKindError.ERROR_SUFFIX)
96
-
97
-
98
- class NetDateTimeNoTzInfoError(NetDateTimeError):
99
- """
100
- Raised when the `DateTimeKind` property of a .NET `DateTime` instance is
101
- `DateTimeKind.Unspecified`.
102
- """
103
- def __init__(self, time_point):
104
- """
105
- Construct an instance from a Python point in time.
106
-
107
- Args:
108
- time_point: A `pdt.DateTime` representing a specific point in time.
109
- """
110
- super().__init__(self, f'The Python time point must specify the time zone.', time_point.isoformat())
111
-
112
-
113
- class NetDateTimeOffsetNonZeroOffsetError(NetDateTimeError):
114
- """
115
- Raised when the `Offset` property of a .NET `DateTimeOffset` is non-zero.
116
- """
117
- def __init__(self, net_date_time_offset):
118
- """
119
- Construct an instance from a .NET `DateTimeOffset`.
120
-
121
- Args:
122
- net_date_time_offset: A .NET `DateTimeOffset` representing a specific point in time.
123
- """
124
- super().__init__(self,
125
- f'The `Offset` of the .NET `DateTimeOffset`, {net_date_time_offset.ToString("o")},'
126
- ' cannot be non-zero.')
127
-
128
-
129
- @functools.singledispatch
130
- def as_date_time(net_time_point: object) -> pdt.DateTime:
131
- raise NotImplementedError
132
-
133
-
134
- @as_date_time.register(type(None))
135
- def _(net_time_point) -> pdt.DateTime:
136
- """
137
- Convert a .NET `DateTime` instance to a `pdt.DateTime` instance.
138
-
139
- Args:
140
- net_time_point: A point in time of type .NET `DateTime`.
141
-
142
- Returns:
143
- The `pdt.DateTime` equivalent to the `to_test`.
144
-
145
- If `net_time_point` is `DateTime.MaxValue`, returns `pdt.DateTime.max`. If `net_time_point` is
146
- `DateTime.MinValue`, returns `DATETIME_NAT`.
147
- """
148
- return NAT
149
-
150
-
151
- @as_date_time.register
152
- def _(net_time_point: DateTime) -> pdt.DateTime:
153
- """
154
- Convert a .NET `DateTime` instance to a `pdt.DateTime` instance.
155
-
156
- Args:
157
- net_time_point: A point in time of type .NET `DateTime`.
158
-
159
- Returns:
160
- The `pdt.DateTime` equivalent to the `to_test`.
161
-
162
- If `net_time_point` is `DateTime.MaxValue`, returns `pdt.DateTime.max`. If `net_time_point` is
163
- `DateTime.MinValue`, returns `DATETIME_NAT`.
164
- """
165
- if net_time_point == DateTime.MaxValue:
166
- return pdt.DateTime.max
167
-
168
- if net_time_point == DateTime.MinValue:
169
- return NAT
170
-
171
- if net_time_point.Kind == DateTimeKind.Utc:
172
- return _net_time_point_to_datetime(base.constantly(pdt.UTC), net_time_point)
173
-
174
- if net_time_point.Kind == DateTimeKind.Unspecified:
175
- raise NetDateTimeUnspecifiedDateTimeKindError(net_time_point)
176
-
177
- if net_time_point.Kind == DateTimeKind.Local:
178
- raise NetDateTimeLocalDateTimeKindError(net_time_point)
179
-
180
- raise ValueError(f'Unknown .NET DateTime.Kind, {net_time_point.Kind}.')
181
-
182
-
183
- @as_date_time.register
184
- def _(net_time_point: DateTimeOffset) -> pdt.DateTime:
185
- """
186
- Convert a .NET `DateTimeOffset` instance to a `pdt.DateTime` instance.
187
-
188
- Args:
189
- net_time_point: A point in time of type .NET `DateTimeOffset`.
190
-
191
- Returns:
192
- The `pdt.DateTime` equivalent to the `net_time_point`.
193
- """
194
- if net_time_point == DateTimeOffset.MaxValue:
195
- return pdt.DateTime.max
196
-
197
- if net_time_point == DateTimeOffset.MinValue:
198
- return NAT
199
-
200
- def net_date_time_offset_to_timezone(ntp):
201
- integral_offset = int(ntp.Offset.TotalSeconds)
202
- if integral_offset == 0:
203
- return pdt.UTC
204
-
205
- return pdt.timezone(integral_offset)
206
-
207
- return _net_time_point_to_datetime(net_date_time_offset_to_timezone, net_time_point)
208
-
209
-
210
- def as_net_date_time(time_point: pdt.DateTime) -> DateTime:
211
- """
212
- Convert a `pdt.DateTime` instance to a .NET `DateTime` instance.
213
-
214
- Args:
215
- time_point: The `pdt.DateTime` instance to covert.
216
-
217
- Returns:
218
- The equivalent .NET `DateTime` instance.
219
-
220
- If `time_point` is `pdt.DateTime.max`, return `DateTime.MaxValue`. If `time_point` is
221
- `DATETIME_NAT`, return `DateTime.MinValue`.
222
- """
223
- if time_point == pdt.DateTime.max:
224
- return DateTime.MaxValue
225
-
226
- if time_point == NAT:
227
- return DateTime.MinValue
228
-
229
- if not time_point.tzinfo == pdt.UTC:
230
- raise NetDateTimeNoTzInfoError(time_point)
231
-
232
- carry_seconds, milliseconds = microseconds_to_milliseconds_with_carry(time_point.microsecond)
233
- result = DateTime(time_point.year, time_point.month, time_point.day,
234
- time_point.hour, time_point.minute, time_point.second + carry_seconds,
235
- milliseconds, DateTimeKind.Utc)
236
- return result
237
-
238
-
239
- def as_net_date_time_offset(time_point: pdt.DateTime) -> DateTimeOffset:
240
- """
241
- Convert a `pdt.DateTime` instance to a .NET `DateTimeOffset` instance.
242
-
243
- Args:
244
- time_point: The `pdt.DateTime` instance to covert.
245
-
246
- Returns:
247
- The equivalent .NET `DateTimeOffset` instance.
248
-
249
- If `time_point` is `pdt.DateTime.max`, return `DateTime.MaxValue`. If `time_point` is
250
- `DATETIME_NAT`, return `DateTime.MinValue`.
251
- """
252
- if time_point == pdt.DateTime.max:
253
- return DateTimeOffset.MaxValue
254
-
255
- if time_point == NAT:
256
- return DateTimeOffset.MinValue
257
-
258
- date_time = as_net_date_time(time_point)
259
- result = DateTimeOffset(date_time)
260
- return result
261
-
262
-
263
- def as_net_time_span(to_convert: pdt.Duration):
264
- """
265
- Convert a `pdt.Duration` instance to a .NET `TimeSpan`.
266
-
267
- Args:
268
- to_convert: The `pdt.Duration` instance to convert.
269
-
270
- Returns:
271
- The .NET `TimeSpan` equivalent to `to_convert`.
272
- """
273
- return TimeSpan(round(to_convert.total_seconds() * TimeSpan.TicksPerSecond))
274
-
275
-
276
- def as_duration(to_convert: TimeSpan) -> pdt.Duration:
277
- """
278
- Convert a .NET `TimeSpan` to a python `pdt.Duration`
279
-
280
- Args:
281
- to_convert: The .NET `TimeSpan` to convert.
282
-
283
- Returns:
284
- The `pdt.Duration` equivalent to `to_convert`.
285
-
286
- """
287
- return pdt.duration(seconds=to_convert.TotalSeconds)
288
-
289
-
290
- def as_time_delta(net_time_span: TimeSpan):
291
- """
292
- Convert a .NET `TimeSpan` to a Python `dt.timedelta`.
293
-
294
- Args:
295
- net_time_span: The .NET `TimeSpan` to convert.
296
-
297
- Returns:
298
- The equivalent dt.time_delta value.
299
-
300
- """
301
- return dt.timedelta(seconds=net_time_span.TotalSeconds)
302
-
303
-
304
- def microseconds_to_milliseconds_with_carry(to_convert: int) -> Tuple[int, int]:
305
- """
306
- Convert microseconds to an integral number of milliseconds with a number of seconds to carry.
307
-
308
- Args:
309
- to_convert: The microseconds to convert.
310
-
311
- Returns:
312
- A tuple of the form, (number of seconds to "carry", number of the integral milliseconds).
313
- """
314
-
315
- raw_milliseconds = round(to_convert / 1000)
316
- return divmod(raw_milliseconds, 1000)
317
-
318
-
319
- def is_utc(time_point):
320
- return (time_point.tzinfo == pdt.UTC or
321
- time_point.tzinfo == dt.timezone.utc or
322
- time_point.tzinfo == duz.UTC)
323
-
324
-
325
- def _net_time_point_to_datetime(time_zone_func, net_time_point):
326
- return pdt.datetime(net_time_point.Year, net_time_point.Month, net_time_point.Day,
327
- net_time_point.Hour, net_time_point.Minute, net_time_point.Second,
328
- net_time_point.Millisecond * 1000, tz=time_zone_func(net_time_point))
orchid/net_enumerable.py DELETED
@@ -1,72 +0,0 @@
1
- #
2
- # This file is part of Orchid and related technologies.
3
- #
4
- # Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
5
- #
6
- # LEGAL NOTICE:
7
- # Orchid contains trade secrets and otherwise confidential information
8
- # owned by KAPPA. Access to and use of this information is
9
- # strictly limited and controlled by the Company. This file may not be copied,
10
- # distributed, or otherwise disclosed outside of the Company's facilities
11
- # except under appropriate precautions to maintain the confidentiality hereof,
12
- # and may not be used in any way not expressly authorized by the Company.
13
- #
14
-
15
- """Defines conversions involving .NET IEnumerable instances."""
16
-
17
- from functools import singledispatch
18
- from typing import List
19
-
20
- # noinspection PyUnresolvedReferences
21
- import orchid # Only to call `pythonnet.load('netfx')`
22
-
23
- from pythonnet import load
24
- load('coreclr')
25
-
26
- # noinspection PyUnresolvedReferences,PyPackageRequirements
27
- import clr
28
- # noinspection PyUnresolvedReferences
29
- clr.AddReference('System.Collections')
30
- # noinspection PyUnresolvedReferences
31
- clr.AddReference('DynamicData')
32
-
33
- # noinspection PyUnresolvedReferences,PyPackageRequirements
34
- from System.Collections import IEnumerable
35
- # noinspection PyUnresolvedReferences,PyPackageRequirements
36
- from DynamicData import (IObservableCache, IObservableList)
37
-
38
-
39
- @singledispatch
40
- def as_list(net_object) -> List:
41
- raise NotImplementedError
42
-
43
-
44
- @as_list.register(IEnumerable)
45
- def as_list_from_enumerable(net_object) -> List:
46
- """
47
- Convert a .NET `IEnumerable` to a Python `list`.
48
-
49
- Args:
50
- net_object: An .NET instance implementing the `IEnumerable` (and `IEnumerable<T>`) interfaces.
51
-
52
- Returns:
53
- The Python `list` containing the same items as the source .NET `IEnumerable`.
54
-
55
- """
56
- return [i for i in net_object]
57
-
58
-
59
- @as_list.register(IObservableCache)
60
- @as_list.register(IObservableList)
61
- def as_list_from_dynamic_data(net_object) -> List:
62
- """
63
- Convert a .NET `IEnumerable` to a Python `list`.
64
-
65
- Args:
66
- net_object: An .NET instance implementing the `IEnumerable` (and `IEnumerable<T>`) interfaces.
67
-
68
- Returns:
69
- The Python `list` containing the same items as the source .NET `IEnumerable`.
70
-
71
- """
72
- return [i for i in net_object.Items]
@@ -1,55 +0,0 @@
1
- #
2
- # This file is part of Orchid and related technologies.
3
- #
4
- # Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
5
- #
6
- # LEGAL NOTICE:
7
- # Orchid contains trade secrets and otherwise confidential information
8
- # owned by KAPPA. Access to and use of this information is
9
- # strictly limited and controlled by the Company. This file may not be copied,
10
- # distributed, or otherwise disclosed outside of the Company's facilities
11
- # except under appropriate precautions to maintain the confidentiality hereof,
12
- # and may not be used in any way not expressly authorized by the Company.
13
- #
14
-
15
-
16
- import functools
17
-
18
- import pendulum
19
-
20
- from orchid import net_date_time as ndt
21
-
22
- # noinspection PyUnresolvedReferences
23
- from Orchid.FractureDiagnostics import IFractureDiagnosticsFactory
24
- # noinspection PyUnresolvedReferences
25
- from Orchid.FractureDiagnostics.Factories import FractureDiagnosticsFactory
26
- # noinspection PyUnresolvedReferences
27
- from Orchid.FractureDiagnostics.Factories.ReferenceCounting import NullReferenceCounterFactory
28
-
29
-
30
- @functools.lru_cache
31
- def create() -> IFractureDiagnosticsFactory:
32
- """
33
- Return an instance of the fracture diagnostics factory used by .NET to construct DOM instances.
34
-
35
- >>> start = pendulum.parse('2022-02-23T15:53:23Z')
36
- >>> stop = pendulum.parse('2022-02-24T05:54:11Z')
37
- >>> net_start = ndt.as_net_date_time(start)
38
- >>> net_stop = ndt.as_net_date_time(stop)
39
- >>> factory = create()
40
- >>> date_time_offset_range = factory.CreateDateTimeOffsetRange(net_start, net_stop)
41
- >>> date_time_offset_range.Start.__implementation__.ToString('o')
42
- '2022-02-23T15:53:23.0000000+00:00'
43
- >>> date_time_offset_range.Stop.__implementation__.ToString('o')
44
- '2022-02-24T05:54:11.0000000+00:00'
45
-
46
- Returns:
47
- An instance of the fracture diagnostics factory.
48
- """
49
- # TODO: We will need a "real" reference counter factory to support deleting DOM instances
50
- return FractureDiagnosticsFactory.Create(NullReferenceCounterFactory())
51
-
52
-
53
- if __name__ == '__main__':
54
- import doctest
55
- doctest.testmod()