Skip to content

Commit

Permalink
Remove unnecessary imports and sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-E-Rose committed Dec 18, 2024
1 parent cbf0b48 commit e5b035d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pubmed_parser/medline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Parsers for MEDLINE XML
"""
import re
import numpy as np
import gzip
from itertools import chain

from lxml import etree
from collections import defaultdict

from pubmed_parser.utils import read_xml, stringify_children, month_or_day_formater


Expand Down
5 changes: 3 additions & 2 deletions pubmed_parser/pubmed_oa_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Parsers for PubMed XML
"""
import os
from lxml import etree
from itertools import chain
from .utils import read_xml, stringify_affiliation_rec, stringify_children

from lxml import etree
from unidecode import unidecode

from .utils import read_xml, stringify_affiliation_rec, stringify_children

def list_xml_path(path_dir):
"""
Expand Down
13 changes: 4 additions & 9 deletions pubmed_parser/pubmed_web_parser.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import sys
import re
import time
from urllib.request import urlopen

import requests
from lxml import etree
from lxml import html
from unidecode import unidecode

try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from lxml import etree, html

from .utils import stringify_children


Expand Down
12 changes: 5 additions & 7 deletions pubmed_parser/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import calendar
import collections
try:
from collections.abc import Iterable
except:
from collections import Iterable
from itertools import chain
from time import strptime
from six import string_types

from collections.abc import Iterable

from lxml import etree
from itertools import chain
from six import string_types


def remove_namespace(tree):
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ dependencies = [
"lxml",
"unidecode",
"requests",
"six",
"numpy"
"six"
]
dynamic = ["version"]

Expand Down
6 changes: 4 additions & 2 deletions tests/test_pubmed_oa_parser.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import tarfile
from io import BytesIO

import tarfile
import requests

import pubmed_parser as pp


def fetch_pubmed_xml(db_dir):
"""Fetch Pubmed OA XML package"""
url = f'https://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_package/{db_dir}.tar.gz'
Expand Down
3 changes: 2 additions & 1 deletion tests/test_pubmed_web_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pubmed_parser as pp
import random

import pubmed_parser as pp


def test_pubmed_web_parser_all_fields_content():
"""
Expand Down

0 comments on commit e5b035d

Please sign in to comment.