Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
The fuzzyparsers library provides a small collection of functions to sanitize free form user input. For the moment its chief value is the flexible date parser. The library strives to be locale smart in parsing dates.
The library has two main parsers. The first is a prefix parser which compares a string to a list of strings and returns the unique element of the list which matches the prefix. An exception is thrown if the match is not unique.
>>> from fuzzyparsers import fuzzy_match
>>> fuzzy_match(['aab','bba','abc'],'aa')
'aab'
>>> fuzzy_match(['aab','bba','abc'],'a') # two strings starting with 'a'.
Traceback (most recent call last):
...
ValueError: ambiguous match for 'a'
The second parser parses dates in various formats and returns a datetime.date object. Accepted formats include::
jan 12, 2003
jan 5
2004-3-5
+34 -- 34 days in the future (relative to todays date)
-4 -- 4 days in the past (relative to todays date)
For instance:
>>> from fuzzyparsers import parse_date
>>> parse_date('nov 30 2012') # my youngest son's birthday
datetime.date(2012, 11, 30)
The library allows setting a default date to fill in specified components of a date (e.g. the year). By default, a date with-out a year to will give the current year.
>>> from fuzzyparsers import DateParser
>>> import datetime
>>> DateParser(today=datetime.date(2013, 3, 1)).parse_date('feb 3')
datetime.date(2013, 2, 3)
We'd like to support the following features:
Fuzzyparsers is written by Joel B. Mohler and distributed under the terms of the MIT license.
Use the following commands to run the extensive doc-tests::
py.test fuzzyparsers --doctest-module
python -m doctest README.txt
To install fuzzyparsers, do the normal python thing (probably as root)::
python setup.py install
or::
pip install fuzzyparsers
FAQs
A collection of free-form input parsers (with special focus on dates)
We found that fuzzyparsers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.