jupyter-analysis-tools 1.4.1__py3-none-any.whl → 1.4.3__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.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # __init__.py
3
3
 
4
- __version__ = "1.4.1"
4
+ __version__ = "1.4.3"
5
5
 
6
6
  from .binning import reBin
7
7
  from .git import checkRepo, isNBstripoutActivated, isNBstripoutInstalled, isRepo
@@ -106,16 +106,32 @@ def addEnvScriptsToPATH():
106
106
  os.environ["PATH"] = sep.join(environPATH)
107
107
 
108
108
 
109
- def networkdriveMapping(cmdOutput: str = None):
109
+ def networkdriveMapping(cmdOutput: str = None, resolveNames: bool = True):
110
110
  """Returns a dict of mapping drive letters to network paths (on Windows)."""
111
111
  if isWindows():
112
112
  if cmdOutput is None:
113
113
  proc = subprocess.run(["net", "use"], capture_output=True, text=True, encoding="cp850")
114
114
  cmdOutput = proc.stdout
115
+
116
+ def resolveFQDN(uncPath):
117
+ if not resolveNames:
118
+ return uncPath
119
+ parts = uncPath.split("\\")
120
+ idx = [i for i, part in enumerate(parts) if len(part)][0]
121
+ proc = subprocess.run(
122
+ ["nslookup", parts[idx]], capture_output=True, text=True, encoding="cp850"
123
+ )
124
+ res = [line.split() for line in proc.stdout.splitlines() if line.startswith("Name:")]
125
+ if len(res) and len(res[0]) == 2:
126
+ parts[idx] = res[0][1]
127
+ return "\\".join(parts)
128
+
115
129
  rows = [line.split() for line in cmdOutput.splitlines() if "Windows Network" in line]
116
- rows = dict(
117
- [row[1:3] for row in rows if row[1].endswith(":") and row[2].startswith("\\\\")]
118
- )
130
+ rows = {
131
+ row[1]: resolveFQDN(row[2])
132
+ for row in rows
133
+ if row[1].endswith(":") and row[2].startswith(r"\\")
134
+ }
119
135
  return rows
120
136
  else: # Linux (tested) or macOS (untested)
121
137
  if cmdOutput is None:
@@ -143,17 +159,17 @@ def networkdriveMapping(cmdOutput: str = None):
143
159
  return {}
144
160
 
145
161
 
146
- def makeNetworkdriveAbsolute(filepath, cmdOutput: str = None):
162
+ def makeNetworkdriveAbsolute(filepath, cmdOutput: str = None, resolveNames: bool = True):
147
163
  """Replaces the drive letter of the given path by the respective network path, if possible."""
148
164
  if filepath.drive.startswith(r"\\"):
149
- return # it's a UNC path already
165
+ return filepath # it's a UNC path already
150
166
  if isWindows():
151
- drivemap = networkdriveMapping(cmdOutput=cmdOutput)
167
+ drivemap = networkdriveMapping(cmdOutput=cmdOutput, resolveNames=resolveNames)
152
168
  prefix = drivemap.get(filepath.drive, None)
153
169
  if prefix is not None:
154
170
  filepath = Path(prefix).joinpath(*filepath.parts[1:])
155
171
  else: # Linux or macOS
156
- drivemap = networkdriveMapping(cmdOutput=cmdOutput)
172
+ drivemap = networkdriveMapping(cmdOutput=cmdOutput, resolveNames=resolveNames)
157
173
  # search for the mountpoint, starting with the longest, most specific, first
158
174
  for mp, target in sorted(drivemap.items(), key=lambda tup: len(tup[0]), reverse=True):
159
175
  if filepath.is_relative_to(mp):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jupyter-analysis-tools
3
- Version: 1.4.1
3
+ Version: 1.4.3
4
4
  Summary: Yet another Python library with helpers and utilities for data analysis and processing.
5
5
  Author-email: Ingo Breßler <ingo.bressler@bam.de>, "Brian R. Pauw" <brian.pauw@bam.de>
6
6
  License-Expression: MIT
@@ -35,10 +35,10 @@ Requires-Dist: matplotlib
35
35
  Requires-Dist: ipywidgets
36
36
  Dynamic: license-file
37
37
 
38
- # Jupyter Analysis Tools (v1.4.1)
38
+ # Jupyter Analysis Tools (v1.4.3)
39
39
 
40
40
  [![PyPI Package latest release](https://img.shields.io/pypi/v/jupyter-analysis-tools.svg)](https://pypi.org/project/jupyter-analysis-tools)
41
- [![Commits since latest release](https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.4.1.svg)](https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.4.1...main)
41
+ [![Commits since latest release](https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.4.3.svg)](https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.4.3...main)
42
42
  [![License](https://img.shields.io/pypi/l/jupyter-analysis-tools.svg)](https://en.wikipedia.org/wiki/MIT_license)
43
43
  [![Supported versions](https://img.shields.io/pypi/pyversions/jupyter-analysis-tools.svg)](https://pypi.org/project/jupyter-analysis-tools)
44
44
  [![PyPI Wheel](https://img.shields.io/pypi/wheel/jupyter-analysis-tools.svg)](https://pypi.org/project/jupyter-analysis-tools#files)
@@ -97,6 +97,18 @@ are installed:
97
97
 
98
98
  # CHANGELOG
99
99
 
100
+ ## v1.4.3 (2025-08-01)
101
+
102
+ ### Bug fixes
103
+
104
+ * **utils**: makeNetworkdriveAbsolute() should return input path if no changes needed ([`2ec96d7`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/2ec96d7066a3473c6d27a6e6d01c640f6c142346))
105
+
106
+ ## v1.4.2 (2025-08-01)
107
+
108
+ ### Bug fixes
109
+
110
+ * **utils**: makeNetworkdriveAbsolute() with FQDN resolution ([`f4591fb`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f4591fb46dcfeafbb1f63c4323efbb8aea302a92))
111
+
100
112
  ## v1.4.1 (2025-08-01)
101
113
 
102
114
  ### Bug fixes
@@ -1,4 +1,4 @@
1
- jupyter_analysis_tools/__init__.py,sha256=fGYDi_Ue_6eMLG_hi9FqEOgckxlhFnXQB98ELyhaecM,398
1
+ jupyter_analysis_tools/__init__.py,sha256=ZWwqIRGKVRxOwNMzr6UyicWL5Y9elQGg373dGP1Mq08,398
2
2
  jupyter_analysis_tools/analysis.py,sha256=AiAvUO648f0PYXqLfal1kDH926neasE5c1RYFu9wtYg,1768
3
3
  jupyter_analysis_tools/binning.py,sha256=d6eXRC3IOnnJIF25OfEASyWedT71EX2nF7jAgGJ9suQ,14536
4
4
  jupyter_analysis_tools/datalocations.py,sha256=BakfiZOMcBwp-_DAn7l57lGWZmZGNnk0j73V75nLBUA,4322
@@ -6,11 +6,11 @@ jupyter_analysis_tools/distrib.py,sha256=uyh2jXDdXR6dfd36CAoE5_psoFF0bfA6l1wletP
6
6
  jupyter_analysis_tools/git.py,sha256=mqSk5nnAFrmk1_2KFuKVrDWOkRbGbAQOq2N1DfxhNpg,2216
7
7
  jupyter_analysis_tools/plotting.py,sha256=X5Orrwiof-9MuYMKDJEXIlIt0K6bQT6ktFFjXKIVApI,1962
8
8
  jupyter_analysis_tools/readdata.py,sha256=kHbGh7sp3lbpxuHASmCUVZsfH45JCIxMzgSnbq-Pgoo,6883
9
- jupyter_analysis_tools/utils.py,sha256=JcfIv50cAm9MIu9jSptxP3abJwz9XnKsdbKsuJNMQrQ,8078
9
+ jupyter_analysis_tools/utils.py,sha256=c8q2-0v7wEjJ_3w5YTZdjFSf-RP1gPUpMJpv5KUyilU,8800
10
10
  jupyter_analysis_tools/widgets.py,sha256=rA8qPvY9nS1OtykZwXtCTG29K-N_MYFVb5Aj8yK40_s,2996
11
- jupyter_analysis_tools-1.4.1.dist-info/licenses/AUTHORS.rst,sha256=-twUESsY0XqFQ0MIC0ylKhglNwL8lyHmGXriM3RF-2s,93
12
- jupyter_analysis_tools-1.4.1.dist-info/licenses/LICENSE,sha256=jRVl3hmCq0Qv1wifm-EelEKhFWecdoWdhcxSte4a1_c,1125
13
- jupyter_analysis_tools-1.4.1.dist-info/METADATA,sha256=9Xvhoeern3vZcI5icffe0TAddl_cKyW4MqVW9-yTBmg,44248
14
- jupyter_analysis_tools-1.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- jupyter_analysis_tools-1.4.1.dist-info/top_level.txt,sha256=ei_0x-BF85FLoJ_h67ySwDFowtqus_gI4_0GR466PEU,23
16
- jupyter_analysis_tools-1.4.1.dist-info/RECORD,,
11
+ jupyter_analysis_tools-1.4.3.dist-info/licenses/AUTHORS.rst,sha256=-twUESsY0XqFQ0MIC0ylKhglNwL8lyHmGXriM3RF-2s,93
12
+ jupyter_analysis_tools-1.4.3.dist-info/licenses/LICENSE,sha256=jRVl3hmCq0Qv1wifm-EelEKhFWecdoWdhcxSte4a1_c,1125
13
+ jupyter_analysis_tools-1.4.3.dist-info/METADATA,sha256=mwfPFJK0SJL_HGSfjiLbtWfMclgyQufodabdsqhKgu0,44709
14
+ jupyter_analysis_tools-1.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ jupyter_analysis_tools-1.4.3.dist-info/top_level.txt,sha256=ei_0x-BF85FLoJ_h67ySwDFowtqus_gI4_0GR466PEU,23
16
+ jupyter_analysis_tools-1.4.3.dist-info/RECORD,,