Skip to content

Commit

Permalink
chore: isort
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Oct 15, 2023
1 parent 47265ce commit de4c1c0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 55 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion m3u_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .m3u_parser import M3uParser, ParseConfig, SortConfig, FilterConfig
from .exceptions import *
from .m3u_parser import FilterConfig, M3uParser, ParseConfig, SortConfig

__version__ = '0.3.0'
2 changes: 1 addition & 1 deletion m3u_parser/helper.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio
import csv
import ipaddress
import logging
import re
from typing import Union
import logging
from urllib.parse import urlsplit, urlunsplit

# URLValidator
Expand Down
68 changes: 21 additions & 47 deletions m3u_parser/m3u_parser.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,38 @@
#!/usr/bin/env python3

import asyncio
import csv
import json
import random
import re
import ssl
import time
from typing import Union
from dataclasses import dataclass, field
from typing import Union

import aiohttp
import pycountry
import requests
import csv


try:
from helper import (
get_by_regex,
is_valid_url,
ndict_to_csv,
run_until_completed,
setup_logger,
schemes,
default_useragent,
)
except ModuleNotFoundError:
from .helper import (
get_by_regex,
is_valid_url,
ndict_to_csv,
run_until_completed,
setup_logger,
schemes,
default_useragent,
)


try:
from exceptions import (
UrlReadException,
NoStreamsException,
NestedKeyException,
KeyNotFoundException,
FiltersMissingException,
SavingNotSupportedException,
UnrecognizedFormatException,
NoContentToParseException,
)
except ModuleNotFoundError:
from .exceptions import (
UrlReadException,
NoStreamsException,
NestedKeyException,
KeyNotFoundException,
FiltersMissingException,
SavingNotSupportedException,
UnrecognizedFormatException,
NoContentToParseException,
)
from .exceptions import (
FiltersMissingException,
KeyNotFoundException,
NestedKeyException,
NoContentToParseException,
NoStreamsException,
SavingNotSupportedException,
UnrecognizedFormatException,
UrlReadException,
)
from .helper import (
default_useragent,
get_by_regex,
is_valid_url,
ndict_to_csv,
run_until_completed,
schemes,
setup_logger,
)

ssl.match_hostname = lambda cert, hostname: hostname == cert["subjectAltName"][0][1]

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.black]
line-length = 119
skip-string-normalization = true
target-version = ['py36']
target-version = ['py37']
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -17,4 +17,4 @@ exclude = '''
line_length = 119
multi_line_output = 3
use_parentheses = true
include_trailing_comma = true
include_trailing_comma = true
8 changes: 5 additions & 3 deletions tests/test_m3uparser.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import sys, os, pytest
import os
import sys
from pathlib import Path

import pytest

file = Path(__file__).resolve()
package_root_directory = file.parents[1]
sys.path.append(str(package_root_directory))

from m3u_parser import M3uParser, ParseConfig, SortConfig, FilterConfig

from m3u_parser import FilterConfig, M3uParser, ParseConfig, SortConfig

# Sample M3U content for testing
SAMPLE_M3U_CONTENT = """
Expand Down

0 comments on commit de4c1c0

Please sign in to comment.