Skip to content

Commit

Permalink
Merge pull request p12tic#94 from p12tic/fix-warnings
Browse files Browse the repository at this point in the history
Fix new pylint warnings
  • Loading branch information
p12tic committed Feb 2, 2021
2 parents 82704d2 + d8b0472 commit ff72a71
Show file tree
Hide file tree
Showing 32 changed files with 73 additions and 43 deletions.
3 changes: 2 additions & 1 deletion build_link_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
# filename -> title mapping to a xml file.

import fnmatch
import re
import os
import re

from link_map import LinkMap


Expand Down
3 changes: 2 additions & 1 deletion commands/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

import fnmatch
import io
import re
import os
import re
import shutil
import urllib.parse

from lxml import etree


Expand Down
3 changes: 2 additions & 1 deletion commands/preprocess_cssless.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import logging
import os
import warnings
from premailer import Premailer

import cssutils
from lxml import etree
from lxml.etree import strip_elements
from premailer import Premailer


def preprocess_html_merge_cssless(src_path, dst_path):
Expand Down
5 changes: 3 additions & 2 deletions ddg_parse_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import re
from copy import deepcopy

import lxml.etree as e


Expand All @@ -34,8 +35,8 @@ def get_content_el(root_el):
/div[@id="content"]
/div[@id="bodyContent"]
/div[@class="mw-content-ltr"]''')[0]
except Exception:
raise DdgException("Could not find content element")
except Exception as e:
raise DdgException("Could not find content element") from e


VERSION_C89 = 0
Expand Down
2 changes: 2 additions & 0 deletions devhelp2qch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@


import argparse

from lxml import etree

from index_transform.devhelp_qch import convert_devhelp_to_qch


Expand Down
2 changes: 1 addition & 1 deletion export.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
'''

import argparse
import json
import urllib.parse
import urllib.request
import json


def retrieve_page_names(root, ns_index):
Expand Down
3 changes: 2 additions & 1 deletion fix_devhelp-links.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
'''

import sys

import lxml.etree as e
from link_map import LinkMap

from link_map import LinkMap

if len(sys.argv) != 3:
print('''Please provide the following 2 argument:
Expand Down
1 change: 1 addition & 0 deletions gadgets/replace_tests_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import re
import sys


def get_html_files(root):
files = []
for dir, dirnames, filenames in os.walk(root):
Expand Down
1 change: 1 addition & 0 deletions gadgets/standard_revisions_tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'''

import unittest

from selenium import webdriver
from selenium.webdriver.support.ui import Select

Expand Down
10 changes: 5 additions & 5 deletions gadgets/sync_tests_mwiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
# command line.
os.environ['PYWIKIBOT2_NO_USER_CONFIG']='1'

import pywikibot
import pywikibot.config2
import pywikibot.pagegenerators
import pywikibot.data.api

import argparse
import itertools
import shutil
import sys
import urllib

import pywikibot
import pywikibot.config2
import pywikibot.data.api
import pywikibot.pagegenerators

SYNC_DIRECTION_UPLOAD = 1
SYNC_DIRECTION_DOWNLOAD = 2

Expand Down
8 changes: 4 additions & 4 deletions images/math-atan2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.

import math
import os
import pprint

import matplotlib.cm as cm
import matplotlib.colors as colors
import matplotlib.pyplot as plt

import os
import numpy as np
import math
import pprint

font = {'family' : 'DejaVu Sans',
'weight' : 'normal',
Expand Down
5 changes: 3 additions & 2 deletions images/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.

import matplotlib.pyplot as plt
import os
from numpy import *
from bisect import *

import matplotlib.pyplot as plt
from numpy import *

#
# DATA - array of items describing data to plot
# Each item consists of the following parts
Expand Down
1 change: 1 addition & 0 deletions index2autolinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import argparse
import json

from index_transform.autolinker import Index2AutolinkerGroups
from index_transform.autolinker import Index2AutolinkerLinks

Expand Down
1 change: 1 addition & 0 deletions index2browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

import argparse

from index_transform.browser import Index2Browser


Expand Down
10 changes: 6 additions & 4 deletions index2ddg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
import argparse
import fnmatch
import os
import sys
import re
import sys

import lxml.etree as e
from lxml import html

from index_transform.common import IndexTransform
from build_link_map import build_link_map
from ddg_parse_html import get_declarations, get_short_description, DdgException
from ddg_parse_html import DdgException
from ddg_parse_html import get_declarations
from ddg_parse_html import get_short_description
from index_transform.common import IndexTransform

# Entry types
# a class or struct
Expand Down Expand Up @@ -129,7 +131,7 @@ class Index2DuckDuckGoList(IndexTransform):

def __init__(self, ident_map):
self.ident_map = ident_map
super(Index2DuckDuckGoList, self).__init__(ignore_typedefs=True)
super().__init__(ignore_typedefs=True)

def process_item_hook(self, el, full_name, full_link):

Expand Down
1 change: 1 addition & 0 deletions index2devhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

import argparse

from index_transform.devhelp import transform_devhelp


Expand Down
4 changes: 3 additions & 1 deletion index2doxygen-tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
'''

import argparse

from lxml import etree
from link_map import LinkMap

from index_transform.doxygen_tag import Index2DoxygenTag
from index_transform.doxygen_tag import Item
from index_transform.doxygen_tag import print_map
from link_map import LinkMap


def main():
Expand Down
1 change: 1 addition & 0 deletions index2highlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

import argparse

from index_transform.highlight import Index2Highlight


Expand Down
1 change: 1 addition & 0 deletions index2search.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

import argparse

from index_transform.search import Index2Search


Expand Down
2 changes: 1 addition & 1 deletion index_transform/autolinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def process_item_hook(self, el, full_name, full_link):
class Index2AutolinkerLinks(IndexTransform):

def __init__(self):
super(Index2AutolinkerLinks, self).__init__()
super().__init__()
self.links = []
self.curr_group = None

Expand Down
1 change: 0 additions & 1 deletion index_transform/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import lxml.etree as e


'''
This is a python script for various transformations of the index.
Expand Down
1 change: 1 addition & 0 deletions index_transform/devhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

from lxml import etree

from index_transform.common import IndexTransform


Expand Down
1 change: 1 addition & 0 deletions index_transform/doxygen_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'''

from functools import total_ordering

from index_transform.common import IndexTransform
from xml_utils import xml_escape

Expand Down
5 changes: 3 additions & 2 deletions misc/fontforge-gen.python
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
# along with this program. If not, see http://www.gnu.org/licenses/.


import fontforge
import os
import psMat
import sys

import fontforge
import psMat

inputFont = sys.argv[1]
outputFont = os.path.splitext(inputFont)[0] + "Condensed80.otf"

Expand Down
1 change: 1 addition & 0 deletions preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import concurrent.futures
import os
import shutil

from commands import preprocess


Expand Down
1 change: 1 addition & 0 deletions preprocess_qch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import concurrent.futures
import os
import shutil

from commands import preprocess_cssless


Expand Down
4 changes: 2 additions & 2 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pylint
flake8
pylint==2.6.0
flake8==3.8.4
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
premailer
lxml
premailer==3.7.0
lxml==4.5.2
1 change: 1 addition & 0 deletions tests/test_devhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import os
import unittest

from index_transform.devhelp import transform_devhelp


Expand Down
2 changes: 2 additions & 0 deletions tests/test_devhelp_qch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import os
import unittest

from lxml import etree

from index_transform.devhelp_qch import convert_devhelp_to_qch


Expand Down
12 changes: 7 additions & 5 deletions tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.

import contextlib
import io
import os
import sys
import contextlib
import unittest
import unittest.mock

from lxml import etree

from commands.preprocess import build_rename_map
from commands.preprocess import convert_loader_name
from commands.preprocess import has_class
from commands.preprocess import is_external_link
from commands.preprocess import is_ranges_placeholder
from commands.preprocess import remove_noprint
from commands.preprocess import remove_see_also
from commands.preprocess import remove_google_analytics
from commands.preprocess import remove_ads
from commands.preprocess import remove_fileinfo
from commands.preprocess import remove_google_analytics
from commands.preprocess import remove_noprint
from commands.preprocess import remove_see_also
from commands.preprocess import remove_unused_external
from commands.preprocess import rename_files
from commands.preprocess import transform_ranges_placeholder
from commands.preprocess import trasform_relative_link
from commands.preprocess import rename_files


class DummyFile(object):
Expand Down
16 changes: 9 additions & 7 deletions tests/test_preprocess_cssless.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@

import os
import unittest

from lxml import etree
from commands.preprocess_cssless import preprocess_html_merge_cssless
from commands.preprocess_cssless import silence_cssutils_warnings
from commands.preprocess_cssless import convert_span_tables_to_tr_td
from commands.preprocess_cssless import convert_inline_block_elements_to_table
from commands.preprocess_cssless import convert_zero_td_width_to_nonzero

from commands.preprocess_cssless import apply_font_size
from commands.preprocess_cssless import convert_font_size_property_to_pt
from commands.preprocess_cssless \
import convert_table_border_top_to_tr_background
from commands.preprocess_cssless import convert_inline_block_elements_to_table
from commands.preprocess_cssless import convert_span_tables_to_tr_td
from commands.preprocess_cssless import \
convert_table_border_top_to_tr_background
from commands.preprocess_cssless import convert_zero_td_width_to_nonzero
from commands.preprocess_cssless import preprocess_html_merge_cssless
from commands.preprocess_cssless import silence_cssutils_warnings


class TestPreprocessHtmlMergeCss(unittest.TestCase):
Expand Down

0 comments on commit ff72a71

Please sign in to comment.