Skip to content

Commit

Permalink
Merge branch 'master' into fix_tests_to_run_from_anywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
samer-hamood authored Jan 28, 2025
2 parents db44245 + f37c2f1 commit 7211934
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 238 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- python-version: "3.11"
use_pandas: 1
Expand All @@ -26,7 +26,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- run: poetry install
- run: |
if ! poetry install; then
poetry lock
poetry install
fi
- name: Pylint
run: poetry run pylint functional
- name: black
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-added-large-files
Expand All @@ -23,6 +23,6 @@ repos:
pass_filenames: false

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
rev: v0.6.0
hooks:
- id: ruff
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Release 1.6

- Fixed tests failing (to find test files) when running from the IDE or the terminal when not in the right directory
- Upgraded pre-commit hooks (pre-commit-hooks to `v5.0.0` and ruff-pre-commit to `v0.6.0`)
- Added [run-test.sh](run-tests.sh) script that runs all checks on code
- Added support for Python 3.12 and 3.13 by upgrading Pylint and disabling/fixing Pylint errors
- Corrected and improved language consistency in [readme](README.md) and `CHANGELOG.md`

## Release 1.5
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
For every release, the following process is used.

### Before Release
1. From the project directory, run `./run-tests.sh` to insure unit tests pass (on python 2 and 3),
1. From the project directory, run [./run-tests.sh](run-tests.sh) to insure unit tests pass (on python 2 and 3),
and that pylint succeeds
2. Push commit which is the candidate release to Github master
3. Wait for tests to pass on [TravisCI](https://travis-ci.org/EntilZha/PyFunctional)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ In order to be merged, all pull requests must:

## Supported Python Versions

- `PyFunctional` 1.6 is tested against Python 3.12 and Python 3.13.
- `PyFunctional` 1.5 is tested against Python 3.8 to 3.11. PyPy3 is not tested, but bug fixed on best effort basis.
- `PyFunctional` 1.4 supports and is tested against Python 3.6, Python 3.7, and PyPy3
- `PyFunctional` 1.4 and above do not support python 2.7
Expand Down
12 changes: 12 additions & 0 deletions functional/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ReusableFile(Generic[_FileConv_co]):
lazy.
"""

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-instance-attributes
def __init__(
self,
Expand Down Expand Up @@ -84,6 +86,8 @@ def read(self):
class CompressedFile(ReusableFile):
magic_bytes: bytes | None = None

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-instance-attributes
def __init__(
self,
Expand Down Expand Up @@ -115,6 +119,8 @@ def is_compressed(cls, data):
class GZFile(CompressedFile):
magic_bytes: bytes = b"\x1f\x8b\x08"

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-instance-attributes
def __init__(
self,
Expand Down Expand Up @@ -170,6 +176,8 @@ def read(self):
class BZ2File(CompressedFile):
magic_bytes: bytes = b"\x42\x5a\x68"

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-instance-attributes
def __init__(
self,
Expand Down Expand Up @@ -220,6 +228,8 @@ class XZFile(CompressedFile):
magic_bytes: bytes = b"\xfd\x37\x7a\x58\x5a\x00"

# pylint: disable=too-many-instance-attributes
# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def __init__(
self,
path,
Expand Down Expand Up @@ -294,6 +304,8 @@ def get_read_function(filename: str, disable_compression: bool):
return ReusableFile


# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def universal_write_open(
path: str,
mode: str,
Expand Down
11 changes: 10 additions & 1 deletion functional/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
from collections.abc import Iterable

# pylint: disable=deprecated-class
from typing import Callable, Any, Iterator, NoReturn, Hashable
from typing import Callable, Any, NoReturn
from collections.abc import Iterator, Hashable
from _typeshed import SupportsRichComparison
from _typeshed import SupportsRichComparisonT
from typing_extensions import TypeGuard
Expand Down Expand Up @@ -71,6 +72,8 @@ class Sequence(Generic[_T_co]):
functional transformations and reductions in a data pipeline style
"""

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def __init__(
self,
sequence: Iterable[_T_co],
Expand Down Expand Up @@ -442,6 +445,8 @@ def cartesian(
) -> Sequence[tuple[_T_co, _T1, _T2, _T3, _T4]]:
...

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
@overload
def cartesian(
self,
Expand All @@ -454,6 +459,8 @@ def cartesian(
) -> Sequence[tuple[_T_co, _T1, _T2, _T3, _T4, _T5]]:
...

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
@overload
def cartesian(
self,
Expand Down Expand Up @@ -1757,6 +1764,8 @@ def dict(self, default=None): # pyright: ignore[reportInconsistentOverload]
return self.to_dict(default=default) # type: ignore

# pylint: disable=too-many-locals
# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def to_file(
self,
path: str,
Expand Down
8 changes: 6 additions & 2 deletions functional/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import builtins

from itertools import chain
from typing import Any, Iterable, Iterator, SupportsIndex
from typing import TypeVar, overload
from typing import Any, SupportsIndex, TypeVar, overload
from collections.abc import Iterable, Iterator
import typing

from functional.execution import ExecutionEngine, ParallelExecutionEngine
Expand Down Expand Up @@ -134,6 +134,8 @@ def _parse_args(
no_wrap=_no_wrap,
)

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def open(
self,
path: str,
Expand Down Expand Up @@ -233,6 +235,8 @@ def csv(
csv_input = csvapi.reader(input_file, dialect=dialect, **fmt_params)
return self(csv_input).cache(delete_lineage=True)

# pylint: disable=unknown-option-value
# pylint: disable=too-many-positional-arguments
def csv_dict_reader(
self,
csv_file: str | Iterator[str],
Expand Down
2 changes: 1 addition & 1 deletion functional/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def grouped_impl(size, sequence):
batch = islice(iterator, size)
yield list(chain((next(batch),), batch))
except StopIteration:
return
pass


def grouped_t(size):
Expand Down
Loading

0 comments on commit 7211934

Please sign in to comment.