Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reordering of import statements in the entire phys2bids project #195

Merged
merged 4 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions phys2bids/interfaces/txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"""

import logging
from collections import Counter
from operator import itemgetter

import numpy as np

from phys2bids.physio_obj import BlueprintInput
from operator import itemgetter
from collections import Counter

eurunuela marked this conversation as resolved.
Show resolved Hide resolved

LGR = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions phys2bids/phys2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"""

import os
import logging
import datetime

import logging
from copy import deepcopy
from numpy import savetxt
from pathlib import Path

from numpy import savetxt

from phys2bids import utils, viz, _version
from phys2bids.cli.run import _get_parser
from phys2bids.physio_obj import BlueprintOutput
Expand Down
3 changes: 1 addition & 2 deletions phys2bids/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from urllib.request import urlretrieve

import pytest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest is not part of the standard library and should be separate into a third-part imports section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point still stands! pytest is not part of the stdlib and should be moved to a third-party library import section.

from urllib.request import urlretrieve


def fetch_file(osf_id, path, filename):
Expand Down
5 changes: 3 additions & 2 deletions phys2bids/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import json
import math
import os
from pkg_resources import resource_filename
import re
import subprocess

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

pkg_resources is part of the standard library and should be bundled with the standard imports. It mostly is here, but we just need to get rid of this extra blank line!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also still stands! pkg_resources shouldn't be separated from standard library imports.

from phys2bids.phys2bids import phys2bids
from pkg_resources import resource_filename

from phys2bids._version import get_versions
from phys2bids.phys2bids import phys2bids


def check_string(str_container, str_to_find, str_expected, is_num=True):
Expand Down
6 changes: 4 additions & 2 deletions phys2bids/tests/test_phys2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
Tests phys2bids.py
"""

import os
import json
from phys2bids import phys2bids
import os

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Same as the last one; no blank line between the import and from X import Y

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above! pkg_resources needs to be part of the standard library imports

from pkg_resources import resource_filename

from phys2bids import phys2bids


def test_print_summary(tmpdir):
test_filename = 'input.txt'
Expand Down
4 changes: 3 additions & 1 deletion phys2bids/tests/test_physio_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
Tests physio_obj.py
"""

from pytest import raises
eurunuela marked this conversation as resolved.
Show resolved Hide resolved

import numpy as np

from phys2bids import physio_obj as po
from pytest import raises


# Tests is_valid
Expand Down
1 change: 0 additions & 1 deletion phys2bids/tests/test_txt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import math
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import math
import math

Need the blank line; pytest is third-party.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this blank line. pytest is third-party!


import pytest
from pytest import raises

Expand Down
3 changes: 1 addition & 2 deletions phys2bids/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-

import json
import logging
import os
import sys
import logging

from pathlib import Path

LGR = logging.getLogger(__name__)
Expand Down