bluecellulab 2.3.5__py3-none-any.whl → 2.3.6__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.

Potentially problematic release.


This version of bluecellulab might be problematic. Click here for more details.

bluecellulab/importer.py CHANGED
@@ -21,7 +21,7 @@ from types import ModuleType
21
21
  import neuron
22
22
 
23
23
  from bluecellulab.exceptions import BluecellulabError
24
- from bluecellulab.utils import run_once
24
+ from bluecellulab.utils import CaptureOutput, run_once
25
25
 
26
26
 
27
27
  logger = logging.getLogger(__name__)
@@ -63,7 +63,9 @@ def import_neurodamus(neuron: ModuleType) -> None:
63
63
 
64
64
  for hoc_file in hoc_files:
65
65
  hoc_file_path = str(resources.files("bluecellulab") / f"hoc/{hoc_file}")
66
- neuron.h.load_file(hoc_file_path)
66
+ with CaptureOutput() as stdoud:
67
+ neuron.h.load_file(hoc_file_path)
68
+ logger.debug(f"Loaded {hoc_file}. stdout from the hoc: {stdoud}")
67
69
 
68
70
 
69
71
  def print_header(neuron: ModuleType, mod_lib_path: str) -> None:
bluecellulab/tools.py CHANGED
@@ -15,14 +15,12 @@
15
15
 
16
16
 
17
17
  from __future__ import annotations
18
- import io
19
18
  import json
20
19
  import math
21
20
  import multiprocessing
22
21
  import multiprocessing.pool
23
22
  import os
24
23
  from pathlib import Path
25
- import sys
26
24
  from typing import Any, Optional, Tuple
27
25
  import logging
28
26
 
@@ -32,6 +30,7 @@ import numpy as np
32
30
  import bluecellulab
33
31
  from bluecellulab.circuit.circuit_access import EmodelProperties
34
32
  from bluecellulab.exceptions import UnsteadyCellError
33
+ from bluecellulab.utils import CaptureOutput
35
34
 
36
35
  logger = logging.getLogger(__name__)
37
36
 
@@ -652,21 +651,9 @@ class NumpyEncoder(json.JSONEncoder):
652
651
  return json.JSONEncoder.default(self, obj)
653
652
 
654
653
 
655
- class get_stdout(list):
656
- def __enter__(self):
657
- self.orig_stdout = sys.stdout
658
- sys.stdout = self.stringio = io.StringIO()
659
- return self
660
-
661
- def __exit__(self, *args):
662
- self.extend(self.stringio.getvalue().splitlines())
663
- del self.stringio
664
- sys.stdout = self.orig_stdout
665
-
666
-
667
654
  def check_empty_topology() -> bool:
668
655
  """Return true if NEURON simulator topology command is empty."""
669
- with get_stdout() as stdout:
656
+ with CaptureOutput() as stdout:
670
657
  neuron.h.topology()
671
658
 
672
659
  return stdout == ['', '']
bluecellulab/utils.py CHANGED
@@ -1,4 +1,6 @@
1
1
  """Utility functions."""
2
+ import contextlib
3
+ import io
2
4
 
3
5
 
4
6
  def run_once(func):
@@ -9,3 +11,15 @@ def run_once(func):
9
11
  return func(*args, **kwargs)
10
12
  wrapper.has_run = False
11
13
  return wrapper
14
+
15
+
16
+ class CaptureOutput(list):
17
+ def __enter__(self):
18
+ self._stringio = io.StringIO()
19
+ self._redirect_stdout = contextlib.redirect_stdout(self._stringio)
20
+ self._redirect_stdout.__enter__()
21
+ return self
22
+
23
+ def __exit__(self, exc_type, exc_val, exc_tb):
24
+ self._redirect_stdout.__exit__(exc_type, exc_val, exc_tb)
25
+ self.extend(self._stringio.getvalue().splitlines())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.3.5
3
+ Version: 2.3.6
4
4
  Summary: The Pythonic Blue Brain simulator access
5
5
  Home-page: https://github.com/BlueBrain/BlueCelluLab
6
6
  Author: Blue Brain Project, EPFL
@@ -3,16 +3,16 @@ bluecellulab/connection.py,sha256=volV2YKtmqAF7MOEJar5ldF1ARAo7k2vF9MB1NXybUY,46
3
3
  bluecellulab/dendrogram.py,sha256=w0vvv0Q169DolTX1j9dAZIvHIl4H258gAjQ1xQaNiGk,6427
4
4
  bluecellulab/exceptions.py,sha256=KIxF7s_7gPVJ07TiQ-Z1D8de7ylV74gNMhzl0339CVM,2379
5
5
  bluecellulab/graph.py,sha256=ODiQy4xjRVxtNITXeXpYnqHas0wR7gZ_aXuDAF7jMq4,3419
6
- bluecellulab/importer.py,sha256=iww5NkA0yaScFAQYx_jwE8ZsKRI9bXi0cNrJApXSwrg,2861
6
+ bluecellulab/importer.py,sha256=l5nvD0y41-AheqoDNBGAX5qFTCG6_UFlLmqyFbUo77E,2998
7
7
  bluecellulab/neuron_interpreter.py,sha256=hXig_u3T6JmEHbkV8ZblEZtX0kY80ate4VpRtANNFrM,2185
8
8
  bluecellulab/plotwindow.py,sha256=UVHzml-BB83m5Qr-YGkjR9kB-vSW8mM0Owh2j95yIaU,2721
9
9
  bluecellulab/psection.py,sha256=EgAS8IS9DcYv2xOkNISgfg_CfRc0nDfRFjvgQhyi9eY,6328
10
10
  bluecellulab/psegment.py,sha256=rBryDYHC_uDK9itfXXrFZ0DL9F6WgRICL0j5EHN56QM,3125
11
11
  bluecellulab/rngsettings.py,sha256=SLvkgM8K26Z-zTTN__CnFl_KjIJNuF4n_jzviyei5P4,3986
12
12
  bluecellulab/ssim.py,sha256=_MyUObeKIHhuT4cbB1uSD7izpZZHNRACiPlO9R1TNa8,33552
13
- bluecellulab/tools.py,sha256=s4NTE0DzK8z8oAy1BF1C2f19nBx-qBPuArz7e7hUTnw,24231
13
+ bluecellulab/tools.py,sha256=z8jU4XO5tWMHwxr2IRo5BG0wnGCfCZPsEKz9L6gkwfc,23943
14
14
  bluecellulab/type_aliases.py,sha256=EMrunY-pIgZrsmetpAM8lA7tr0TFEzFoU5SX9sBuiOk,312
15
- bluecellulab/utils.py,sha256=GKZkRYI2LY08tsIkG95MGn7EfmV4pBrIAqfRQCW14fs,300
15
+ bluecellulab/utils.py,sha256=xF-qXb1uCH6_EmchSH6aQxhFI4P8SD08z-t_AZz3lF0,736
16
16
  bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
17
17
  bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
18
18
  bluecellulab/cell/core.py,sha256=UtPjq_SYX8wOehQe7GqkbPxDWG1vIIJQ5-e3T_g29YU,31480
@@ -57,9 +57,9 @@ bluecellulab/stimulus/factory.py,sha256=AOby3Sp2g8BJsRccz3afazfCyysyWIgLtcliWlye
57
57
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
58
58
  bluecellulab/synapse/synapse_factory.py,sha256=ZBRpjvIRyHc4hBfBvtLukLf7E2PjHhzwqGt9O4MBOTk,6862
59
59
  bluecellulab/synapse/synapse_types.py,sha256=wWVBfvPYF6g3dSoaXsjJ6QI929yWYrTh_OmauS5Y-Uk,17027
60
- bluecellulab-2.3.5.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
61
- bluecellulab-2.3.5.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
62
- bluecellulab-2.3.5.dist-info/METADATA,sha256=BwAc9W74yb-OgsbeNtsax9-0Z_oa21dCtda7nGOAOUc,6907
63
- bluecellulab-2.3.5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
64
- bluecellulab-2.3.5.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
65
- bluecellulab-2.3.5.dist-info/RECORD,,
60
+ bluecellulab-2.3.6.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
61
+ bluecellulab-2.3.6.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
62
+ bluecellulab-2.3.6.dist-info/METADATA,sha256=sceGz_1cnk0708w26E4YdIx8t1APJltWN45xjmBakD8,6907
63
+ bluecellulab-2.3.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
64
+ bluecellulab-2.3.6.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
65
+ bluecellulab-2.3.6.dist-info/RECORD,,