Skip to content

Commit

Permalink
Apply isort
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Jun 2, 2023
1 parent cba07f5 commit 593f362
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 68 deletions.
5 changes: 1 addition & 4 deletions demo/plotEDFFile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/usr/bin/env python

import numpy as np

import pyedflib


from stacklineplot import stackplot

import pyedflib

if __name__ == '__main__':
f = pyedflib.data.test_generator()
Expand Down
2 changes: 1 addition & 1 deletion demo/readEDFFile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python

import os

import numpy as np

import pyedflib


if __name__ == '__main__':
f = pyedflib.data.test_generator()
print("\nlibrary version: %s" % pyedflib.version.version)
Expand Down
2 changes: 1 addition & 1 deletion demo/stacklineplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# uses line collections (might actually be from pbrain example)
# clm

import numpy as np
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection


Expand Down
11 changes: 7 additions & 4 deletions demo/streamingEDFFile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
import pyedflib

import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
from stacklineplot import stackplot_t

import pyedflib


def animate(frame):
global offset
for i in np.arange(n):
Expand Down
2 changes: 2 additions & 0 deletions demo/writeEDFFile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Copyright (c) 2016 Holger Nahrstaedt

import os

import numpy as np
from scipy import signal

import pyedflib

# signal label/waveform amplitude f sf
Expand Down
5 changes: 3 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import re
import datetime
import jinja2.filters
import re

import jinja2.filters
import numpy as np

# FIXME: doctests need the str/repr formatting used in Numpy < 1.14.
Expand Down Expand Up @@ -64,6 +64,7 @@
#
# The short X.Y version.
import pyedflib

version = re.sub(r'\.dev0+.*$', r'.dev', pyedflib.__version__)
release = pyedflib.__version__

Expand Down
13 changes: 6 additions & 7 deletions pyedflib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
# <https://github.com/holgern/pyedflib>
# See LICENSE for license details.

from ._extensions._pyedflib import *
from .edfwriter import *
from .edfreader import *
from . import highlevel

from . import data
from numpy.testing import Tester

from pyedflib.version import version as __version__
from numpy.testing import Tester

from . import data, highlevel
from ._extensions._pyedflib import *
from .edfreader import *
from .edfwriter import *

__all__ = [s for s in dir() if not s.startswith('_')]
try:
Expand Down
8 changes: 7 additions & 1 deletion pyedflib/_extensions/_pyedflib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ __all__ = ['lib_version', 'CyEdfReader', 'set_patientcode', 'set_starttime_subse
import locale
import os
import warnings

cimport c_edf
cimport cpython

import numpy as np

cimport numpy as np
from datetime import datetime, date

from datetime import date, datetime

from cpython.version cimport PY_MAJOR_VERSION

include "edf.pxi"

open_errors = {
Expand Down
2 changes: 1 addition & 1 deletion pyedflib/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from ._readers import test_generator, get_generator_filename
from ._readers import get_generator_filename, test_generator
1 change: 1 addition & 0 deletions pyedflib/data/_readers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import numpy as np

import pyedflib


Expand Down
1 change: 1 addition & 0 deletions pyedflib/edfreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# See LICENSE for license details.

from datetime import datetime

import numpy as np

from ._extensions._pyedflib import CyEdfReader
Expand Down
33 changes: 24 additions & 9 deletions pyedflib/edfwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,33 @@
# <https://github.com/holgern/pyedflib>
# See LICENSE for license details.

import numpy as np
import sys
import warnings
from datetime import datetime, date
from ._extensions._pyedflib import FILETYPE_EDFPLUS, FILETYPE_BDFPLUS, FILETYPE_BDF, FILETYPE_EDF
from ._extensions._pyedflib import open_file_writeonly, set_physical_maximum, set_patient_additional, set_digital_maximum
from ._extensions._pyedflib import set_birthdate, set_digital_minimum, set_technician, set_recording_additional, set_patientname
from ._extensions._pyedflib import set_patientcode, set_equipment, set_admincode, set_gender, set_datarecord_duration, set_number_of_annotation_signals
from ._extensions._pyedflib import set_startdatetime, set_starttime_subsecond, set_samples_per_record, set_physical_minimum, set_label, set_physical_dimension
from ._extensions._pyedflib import set_transducer, set_prefilter, write_physical_samples, close_file, write_annotation_latin1, write_annotation_utf8
from ._extensions._pyedflib import blockwrite_physical_samples, write_errors, blockwrite_digital_samples, write_digital_short_samples, write_digital_samples, blockwrite_digital_short_samples
from datetime import date, datetime

import numpy as np

from ._extensions._pyedflib import (FILETYPE_BDF, FILETYPE_BDFPLUS,
FILETYPE_EDF, FILETYPE_EDFPLUS,
blockwrite_digital_samples,
blockwrite_digital_short_samples,
blockwrite_physical_samples, close_file,
open_file_writeonly, set_admincode,
set_birthdate, set_datarecord_duration,
set_digital_maximum, set_digital_minimum,
set_equipment, set_gender, set_label,
set_number_of_annotation_signals,
set_patient_additional, set_patientcode,
set_patientname, set_physical_dimension,
set_physical_maximum, set_physical_minimum,
set_prefilter, set_recording_additional,
set_samples_per_record, set_startdatetime,
set_starttime_subsecond, set_technician,
set_transducer, write_annotation_latin1,
write_annotation_utf8,
write_digital_samples,
write_digital_short_samples, write_errors,
write_physical_samples)

__all__ = ['EdfWriter']

Expand Down
7 changes: 5 additions & 2 deletions pyedflib/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
"""

import os
import numpy as np
import warnings
import pyedflib
from copy import deepcopy
from datetime import datetime

import numpy as np

import pyedflib

# from . import EdfWriter
# from . import EdfReader

Expand Down
1 change: 0 additions & 1 deletion pyedflib/tests/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import unittest


pdir = os.path.pardir
docs_base = os.path.abspath(os.path.join(os.path.dirname(__file__),
pdir, pdir, "doc", "source"))
Expand Down
10 changes: 6 additions & 4 deletions pyedflib/tests/test_edfreader.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Copyright (c) 2019 - 2020 Simon Kern
# Copyright (c) 2015 Holger Nahrstaedt

import os
import gc
import numpy as np
from datetime import datetime
import os
# from numpy.testing import (assert_raises, run_module_suite,
# assert_equal, assert_allclose, assert_almost_equal)
import unittest
from datetime import datetime

import numpy as np

import pyedflib
from pyedflib.edfwriter import EdfWriter
from pyedflib.edfreader import EdfReader
from pyedflib.edfwriter import EdfWriter


class TestEdfReader(unittest.TestCase):
Expand Down
10 changes: 6 additions & 4 deletions pyedflib/tests/test_edfwriter.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Copyright (c) 2019 - 2023 Simon Kern
# Copyright (c) 2015 Holger Nahrstaedt

import os
import gc
import numpy as np
import os
# from numpy.testing import (assert_raises, run_module_suite,
# assert_equal, assert_allclose, assert_almost_equal)
import unittest
from datetime import date, datetime

import numpy as np

import pyedflib
from pyedflib.edfwriter import EdfWriter, ChannelDoesNotExist, WrongInputSize
from pyedflib.edfreader import EdfReader
from datetime import datetime, date
from pyedflib.edfwriter import ChannelDoesNotExist, EdfWriter, WrongInputSize


class TestEdfWriter(unittest.TestCase):
Expand Down
14 changes: 9 additions & 5 deletions pyedflib/tests/test_highlevel.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Copyright (c) 2019 - 2020 Simon Kern
# Copyright (c) 2015 Holger Nahrstaedt

import os, sys
import shutil
import gc
import numpy as np
import os
import shutil
import sys
# from numpy.testing import (assert_raises, run_module_suite,
# assert_equal, assert_allclose, assert_almost_equal)
import unittest
from datetime import date, datetime

import numpy as np

from pyedflib import highlevel
from pyedflib.edfwriter import EdfWriter
from pyedflib.edfreader import EdfReader
from datetime import datetime, date
from pyedflib.edfwriter import EdfWriter


class TestHighLevel(unittest.TestCase):

Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python

import os
import sys
import subprocess
import setuptools
import sys
from distutils.sysconfig import get_python_inc
from functools import partial

from setuptools import setup, Extension
from distutils.sysconfig import get_python_inc
import setuptools
from setuptools import Extension, setup

try:
from Cython.Build import cythonize
Expand Down Expand Up @@ -213,6 +213,8 @@ def write_version_py(filename='pyedflib/version.py'):
]

from setuptools.command.develop import develop


class develop_build_clib(develop):
"""Ugly monkeypatching to get clib to build for development installs
See coverage comment above for why we don't just let libraries be built
Expand Down
6 changes: 3 additions & 3 deletions util/authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
# Author: Pauli Virtanen <pav@iki.fi>. This script is in the public domain.

import optparse
import re
import sys
import os
import re
import subprocess
import sys

from scipy._lib.six import PY3, u

from scipy._lib.six import u, PY3
if PY3:
stdout_b = sys.stdout.buffer
else:
Expand Down
7 changes: 3 additions & 4 deletions util/gh_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
Functions for Github API requests.
"""
import argparse
import collections
import json
import os
import re
import sys
import json
import collections
import argparse

from urllib2 import urlopen


Issue = collections.namedtuple('Issue', ('id', 'title', 'url'))


Expand Down
23 changes: 12 additions & 11 deletions util/refguide_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,27 @@
$ python refguide_check.py --check_docs optimize
"""
import sys
import os
import re
import copy
import inspect
import warnings
import doctest
import tempfile
import glob
import inspect
import io
import docutils.core
from docutils.parsers.rst import directives
import os
import re
import shutil
import glob
from doctest import NORMALIZE_WHITESPACE, ELLIPSIS, IGNORE_EXCEPTION_DETAIL
import sys
import tempfile
import warnings
from argparse import ArgumentParser
import numpy as np
from doctest import ELLIPSIS, IGNORE_EXCEPTION_DETAIL, NORMALIZE_WHITESPACE

import docutils.core
import numpy as np
from docutils.parsers.rst import directives
# sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'doc',
# 'sphinxext'))
from numpydoc.docscrape_sphinx import get_doc_object

# Remove sphinx directives that don't run without Sphinx environment
directives._directives.pop('versionadded', None)
directives._directives.pop('versionchanged', None)
Expand Down

0 comments on commit 593f362

Please sign in to comment.