Python library to extend functional operations in the spirit of functional programming in scala. Provides support for missing operations and chain style functional calls.
dependabot[bot] on pip
EntilZha on master
Bump urllib3 from 1.26.2 to 1.2… (compare)
dependabot[bot] on pip
Bump urllib3 from 1.26.2 to 1.2… (compare)
EntilZha on master
Update DNS (compare)
class LazyFile(object):
# pylint: disable=too-few-public-methods,too-many-instance-attributes
def __init__(self, path, delimiter=None, mode='r', buffering=-1, encoding=None,
errors=None, newline=None):
# pylint: disable=too-many-arguments
self.path = path
self.delimiter = delimiter
self.mode = mode
self.buffering = buffering
self.encoding = encoding
self.errors = errors
self.newline = newline
self.file = None
def __iter__(self):
if self.file is not None:
self.file.close()
self.file = builtins.open(self.path, mode=self.mode, buffering=self.buffering,
encoding=self.encoding, errors=self.errors, newline=self.newline)
return self.file
class LazyFile(object):
# pylint: disable=too-few-public-methods,too-many-instance-attributes
def __init__(self, path, delimiter=None, mode='r', buffering=-1, encoding=None,
errors=None, newline=None):
# pylint: disable=too-many-arguments
self.path = path
self.delimiter = delimiter
self.mode = mode
self.buffering = buffering
self.encoding = encoding
self.errors = errors
self.newline = newline
self.file = None
def __iter__(self):
with builtins.open(self.path,
mode=self.mode,
buffering=self.buffering,
encoding=self.encoding,
errors=self.errors,
newline=self.newline) as file_content:
for line in file_content:
yield line
0.4.0
I found an issue where because the wheel distribution depends on the build environment (aka, running on python 2 including enum34 breaking python3 OR running on python3 not including enum34 and breaking python2) I needed to make a hotfix release in 0.4.1
enum-compat
either)
Small suggestions:
__str__
show only part of the sequence, as in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...]
. Would be even greater if this only evaluated this part, as this would make it usable with infinite generators.*__repr__
show what it really is; maybe <Sequence: [1, 2, 3, 4...]>
or not evaluate at all and show <Sequence wrapping list>
, <Sequence wrapping generator>
, <Sequence wrapping File>
seq.count
as a wrapper for itertools.count
? I'm not sure how far down the "replace seq(thing()) with seq.thing()" path you want to go, that may be an overkill.*(seq(itertools.count())
just killed my computer :P)
__repr__
to do the same thing is for ipython notebook
__str__
and __repr__
could behave differently depending on type of underlying sequence?
Planning on releasing 0.7.0
next week, primary features that will be shipping is the parallel execution engine and file compression support. The main website and docs are now at www.pyfunctional.org and docs.pyfunctional.org respectively (readthedocs can't change scalafunctional.readthedocs.org to pyfunctional.readthedocs.org so this was an easy solution).
The release following this one will most likely be 1.0
, so open to thoughts on what should go in. So far, would like to revamp the readme docs, the webpage at www.pyfunctional.org (currently a clone of the readme), the actual docs, clarify package description, revisit linq, revisit underscore, revisit supporting more than just sqlite, and/or look into adding an option/support to stream things (rather than force open iterables). All this is on top of my head so there could be more
_
operator or pattern matching (that would be really hard to do I think, been looking at existing libraries). Open to suggestions