Skip to content
Snippets Groups Projects
Unverified Commit e2b49aff authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix build

parent 88398491
No related branches found
No related tags found
No related merge requests found
Pipeline #62402 passed with stages
in 8 seconds
engines:
duplication:
enabled: true
config:
languages:
python:
fixme:
enabled: true
markdownlint:
enabled: true
pep8:
enabled: true
radon:
enabled: true
exclude_paths:
- tests/**
ratings:
paths:
- firanka/**
\ No newline at end of file
stages:
- unittest
- build
image: zoo.smok.co/build/build:latest
pages:
before_script:
- python setup.py install
- pip install --break-system-packages nose2 coverage
only:
- develop
stage: build
script:
- cd docs
- make html
- cd ..
- mv docs/_build/html public
artifacts:
paths:
- public
build_python:
stage: build
before_script:
- pip install --break-system-packages --upgrade setuptools pip twine
- python setup.py install
- pip install --break-system-packages nose2 coverage
script:
- python setup.py bdist_wheel
- mv dist/*.whl .
after_script:
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi *.whl
only:
- tags
except:
- branches
language: python
python:
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "nightly"
- "pypy3"
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
install:
- pip install -r requirements.txt
- pip install --upgrade coverage nose2 mock
script:
- python setup.py test
after_success:
- coverage xml
- ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT
...@@ -2,6 +2,7 @@ MIT License ...@@ -2,6 +2,7 @@ MIT License
Copyright (c) 2017-2018 P.W. DMS s.c. Copyright (c) 2017-2018 P.W. DMS s.c.
Copyright (c) 2018-2020 Piotr Maślanka Copyright (c) 2018-2020 Piotr Maślanka
Copyright (c) 2020-2024 SMOK sp. z o. o.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
Basic series
############
First some basics
-----------------
.. autoclass:: firanka.intervals.Interval
:members:
.. autoclass:: firanka.series.Series
:members:
.. autoclass:: firanka.series.DiscreteSeries
:members:
...@@ -24,7 +24,7 @@ class Interval(object): ...@@ -24,7 +24,7 @@ class Interval(object):
""" """
Interval of real numbers. Immutable. Interval of real numbers. Immutable.
""" """
__slots__ = ('start', 'stop', 'left_inc', 'right_inc') __slots__ = 'start', 'stop', 'left_inc', 'right_inc'
def extend_to_point(self, p): def extend_to_point(self, p):
""" """
......
from __future__ import annotations
import typing as tp
import inspect import inspect
from sortedcontainers import SortedList from sortedcontainers import SortedList
...@@ -19,6 +21,8 @@ class Series: ...@@ -19,6 +21,8 @@ class Series:
for minimum functionality for minimum functionality
""" """
__slots__ = 'domain', 'comment'
def __init__(self, domain, comment=u''): def __init__(self, domain, comment=u''):
if not isinstance(domain, Interval): if not isinstance(domain, Interval):
domain = Interval(domain) domain = Interval(domain)
...@@ -79,7 +83,7 @@ class Series: ...@@ -79,7 +83,7 @@ class Series:
return DiscreteSeries([(i, self[i]) for i in points], domain) return DiscreteSeries([(i, self[i]) for i in points], domain)
def join(self, series, fun): def join(self, series: Series, fun: tp.Callable[[...], float]) -> JoinedSeries:
""" """
Return a new series with values of fun(index, v1, v2) Return a new series with values of fun(index, v1, v2)
...@@ -91,7 +95,7 @@ class Series: ...@@ -91,7 +95,7 @@ class Series:
return JoinedSeries(self, series, fun) return JoinedSeries(self, series, fun)
def translate(self, x): def translate(self, x) -> AlteredSeries:
""" """
Translate the series by some distance Translate the series by some distance
:param x: a float :param x: a float
...@@ -105,6 +109,8 @@ class DiscreteSeries(Series): ...@@ -105,6 +109,8 @@ class DiscreteSeries(Series):
A series with lots of small rectangles interpolating something A series with lots of small rectangles interpolating something
""" """
__slots__ = 'data'
def __init__(self, data, domain=None, *args, **kwargs): def __init__(self, data, domain=None, *args, **kwargs):
data = SortedList(data) data = SortedList(data)
...@@ -121,7 +127,7 @@ class DiscreteSeries(Series): ...@@ -121,7 +127,7 @@ class DiscreteSeries(Series):
if self.domain.start < data[0][0]: if self.domain.start < data[0][0]:
raise DomainError(u'some domain space is not covered by definition!') raise DomainError(u'some domain space is not covered by definition!')
def apply(self, fun): def apply(self, fun) -> DiscreteSeries:
assert _has_arguments(fun, 2), u'fun must have at least 2 arguments' assert _has_arguments(fun, 2), u'fun must have at least 2 arguments'
return DiscreteSeries([(k, fun(k, v)) for k, v in self.data], return DiscreteSeries([(k, fun(k, v)) for k, v in self.data],
...@@ -224,6 +230,8 @@ class AlteredSeries(Series): ...@@ -224,6 +230,8 @@ class AlteredSeries(Series):
Internal use - for applyings, translations and slicing Internal use - for applyings, translations and slicing
""" """
__slots__ = 'fun', 'series', 'x'
def __init__(self, series, domain=None, fun=lambda k, v: v, x=0, *args, **kwargs): def __init__(self, series, domain=None, fun=lambda k, v: v, x=0, *args, **kwargs):
""" """
:param series: original series :param series: original series
...@@ -256,6 +264,8 @@ class JoinedSeries(Series): ...@@ -256,6 +264,8 @@ class JoinedSeries(Series):
Series stemming from performing an operation on two series Series stemming from performing an operation on two series
""" """
__slots__ = 'ser1', 'ser2', 'op'
def __init__(self, ser1, ser2, op, *args, **kwargs): def __init__(self, ser1, ser2, op, *args, **kwargs):
""":type op: callable(time: float, v1, v2: any) -> v""" """:type op: callable(time: float, v1, v2: any) -> v"""
assert _has_arguments(op, 3), u'op must have 3 arguments' assert _has_arguments(op, 3), u'op must have 3 arguments'
......
...@@ -8,6 +8,9 @@ classifiers = ...@@ -8,6 +8,9 @@ classifiers =
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy Programming Language :: Python :: Implementation :: PyPy
Operating System :: OS Independent Operating System :: OS Independent
...@@ -17,9 +20,18 @@ classifiers = ...@@ -17,9 +20,18 @@ classifiers =
Topic :: Software Development :: Libraries :: Python Modules Topic :: Software Development :: Libraries :: Python Modules
description = Calculations on real functions description = Calculations on real functions
url = https://github.com/smok-serwis/firanka url = https://github.com/smok-serwis/firanka
platforms =
posix
win32
[pycodestyle] [pycodestyle]
max-line-length=100 max-line-length=100
[bdist_wheel] [bdist_wheel]
universal=1 universal=1
[isort]
add_imports =
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment