Skip to content

Commit d97cb1d

Browse files
authored
Merge pull request #93 from rsb-23/linting/1-add-pre-commit
Adding pre-commit with linters and formatters
2 parents 61df3c7 + e77c15d commit d97cb1d

29 files changed

+29713
-29408
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text eol=lf

.github/workflows/pre-commit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5.1.1
13+
with:
14+
python-version: 3.9
15+
cache: 'pip'
16+
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install pre-commit
21+
22+
- name: Run pre-commit
23+
env:
24+
SKIP: pylint,mypy,no-commit-to-branch
25+
run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/PyCQA/isort
3+
rev: 5.13.2
4+
hooks:
5+
- id: isort
6+
7+
- repo: https://github.com/psf/black
8+
rev: 24.10.0
9+
hooks:
10+
- id: black
11+
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v5.0.0
14+
hooks:
15+
- id: check-yaml
16+
- id: check-toml
17+
- id: end-of-file-fixer
18+
- id: no-commit-to-branch
19+
args: [-b, main, -b, master]
20+
21+
- repo: https://github.com/PyCQA/flake8
22+
rev: 7.1.1
23+
hooks:
24+
- id: flake8
25+
additional_dependencies: [flake8-pyproject]

CHANGELOG.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ To install, use _easy_install_, or download the archive and untar, run
304304
_dateutil 1.1_ or later is required.
305305
Python 2.4 is also required.
306306

307-
* Tolerate invalid UNTIL values for recurring events
308-
* Minor improvements to logging and tracebacks
309-
* Fix serialization of zero-delta durations
310-
* Treat different tzinfo classes that represent UTC as equal
311-
* Added ORG behavior to vCard handling, native value for ORG is now a list.
307+
* Tolerate invalid UNTIL values for recurring events
308+
* Minor improvements to logging and tracebacks
309+
* Fix serialization of zero-delta durations
310+
* Treat different tzinfo classes that represent UTC as equal
311+
* Added ORG behavior to vCard handling, native value for ORG is now a list.
312312

313313
vobject 0.4.8 released (SVN revision 180)
314314
--
@@ -452,6 +452,7 @@ vobject 0.2.3 released (SVN revision 104)
452452
To install, untar the archive, run `python setup.py install`.
453453
_dateutil 0.9_ or later is required.
454454
Python 2.4 is also required.
455+
455456
*
456457
* Added VERSION line back into native iCalendar objects
457458
* Added a first stab at a vcard module, parsing of vCard 3.0 files now
@@ -518,8 +519,7 @@ _dateutil_ is required.
518519
* You'll need to apply this patch to be able to read certain VTIMEZONEs
519520
exported by Apple iCal, or if you happen to be in Europe!
520521

521-
522-
patch -R $PYTHONLIB/site-packages/dateutil/tz.py dateutil-0.5-tzoffset-bug.patch
522+
patch -R $PYTHONLIB/site-packages/dateutil/tz.py dateutil-0.5-tzoffset-bug.patch
523523

524524
* Fixed printing of non-ascii unicode.
525525
* Fixed bug preventing content lines with empty contents from parsing.
@@ -534,8 +534,7 @@ To install, untar the archive, run `python setup.py install`.
534534
* You'll need to apply this patch to be able to read certain VTIMEZONEs
535535
exported by Apple iCal, or if you happen to be in Europe!
536536

537-
538-
patch -R $PYTHONLIB/site-packages/dateutil/tz.py dateutil-0.5-tzoffset-bug.patch
537+
patch -R $PYTHONLIB/site-packages/dateutil/tz.py dateutil-0.5-tzoffset-bug.patch
539538

540539
* Various bug fixes involving recurrence.
541540
* TRIGGER and VALARM behaviors set up.

CONTRIBUTING.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ Welcome, and thanks for considering contributing to vObject!
66
**_This document is an incomplete draft_**
77

88
Contributions can take many forms, from coding major features, through
9-
triaging issues, writing documentation, assisting users, etc, etc. You
9+
triaging issues, writing documentation, assisting users, etc, etc. You
1010
can, of course, just dive right in, but it's generally a good idea to
1111
open an issue (if the contribution addresses a problem) or a discussion
12-
to discuss your plans first. This avoids duplicate effort, and builds
12+
to discuss your plans first. This avoids duplicate effort, and builds
1313
the community of contributors.
1414

1515
In all interactions, contributors should be polite, kind, and respectful
16-
of others. Remember that not everyone lives in the same country, speaks
16+
of others. Remember that not everyone lives in the same country, speaks
1717
English as their native language, or has the same level of experience and
1818
confidence.
1919

2020
Python Code
2121
-----------
2222
vObject is licensed under the Apache 2.0 License, and any code or
23-
documentation can only be accepted under those terms. You do _not_ need
23+
documentation can only be accepted under those terms. You do _not_ need
2424
a formal statement of origin, and are not required to sign over your
2525
copyright.
2626

@@ -33,5 +33,13 @@ taken to not use features that are unavailable in the older supported
3333
releases.
3434

3535
With the possible exception of major releases, all contributions must
36-
maintain the existing API's syntax and semantics.
36+
maintain the existing API's syntax and semantics.
3737

38+
Dev Setup
39+
-
40+
41+
1. Enable pre-commit hook and run manually.
42+
```
43+
pre-commit install
44+
git add . && pre-commit run
45+
```

README.md

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# VObject
2+
23
[![PyPI version](https://badge.fury.io/py/vobject.svg)](https://pypi.python.org/pypi/vobject)
34
[![PyPI downloads](https://img.shields.io/pypi/dm/vobject.svg)](https://pypi.python.org/pypi/vobject)
45
[![Build](https://github.com/py-vobject/vobject/actions/workflows/test.yml/badge.svg)](https://github.com/py-vobject/vobject/actions/workflows/test.yml)
@@ -15,33 +16,36 @@ The [Calendar Server](http://calendarserver.org/) team has added VAVAILABILITY
1516
support to VObject's iCalendar parsing.
1617

1718
There are two series of releases:
18-
* Versions 0.9.x continue to support Python 2.7. This branch is maintained
19-
only for backward compatibility, and does not get new features.
20-
* Versions 1.x support only Python 3.8 or later, and is the focus of
21-
ongoing feature development.
19+
20+
* Versions 0.9.x continue to support Python 2.7. This branch is maintained only for backward compatibility, and does not
21+
get new features.
22+
* Versions 1.x support only Python 3.8 or later, and is the focus of ongoing feature development.
2223

2324
Please report bugs and issues directly on [GitHub](https://github.com/py-vobject/vobject/issues).
2425

2526
VObject is licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0).
2627

2728
Useful scripts included with VObject:
2829

29-
* [ics_diff](https://github.com/py-vobject/vobject/blob/master/vobject/ics_diff.py): order is irrelevant in iCalendar files, return a diff of meaningful changes between icalendar files
30-
* [change_tz](https://github.com/py-vobject/vobject/blob/master/vobject/change_tz.py): Take an iCalendar file with events in the wrong timezone, change all events or just UTC events into one of the timezones **pytz** supports. Requires [pytz](https://pypi.python.org/pypi/pytz/).
30+
* [ics_diff](https://github.com/py-vobject/vobject/blob/master/vobject/ics_diff.py): order is irrelevant in iCalendar
31+
files, return a diff of meaningful changes between icalendar files
32+
* [change_tz](https://github.com/py-vobject/vobject/blob/master/vobject/change_tz.py): Take an iCalendar file with
33+
events in the wrong timezone, change all events or just UTC events into one of the timezones **pytz** supports.
34+
Requires [pytz](https://pypi.python.org/pypi/pytz/).
3135

3236
# History
33-
VObject was originally developed in concert with the Open Source Application
34-
Foundation's _Chandler_ project by Jeffrey Harris. Maintenance was later
35-
passed to [Sameen Karim](https://github.com/skarim) and
37+
38+
VObject was originally developed in concert with the Open Source Application Foundation's _Chandler_ project by
39+
Jeffrey Harris. Maintenance was later passed to [Sameen Karim](https://github.com/skarim) and
3640
[Will Percival](https://github.com/wpercy) at [Eventable](https://github.com/eventable).
37-
After several years of inactivity, the project was revived under a dedicated
38-
GitHub organization, with new volunteers.
41+
After several years of inactivity, the project was revived under a dedicated GitHub organization, with new volunteers.
3942

40-
**Please note**: the original repository at [eventable/vobject](https://github.com/eventable/vobject/)
41-
is _unmaintained_. This project forked the latest code from that repository, after
42-
attempts to revive the existing project with new maintainers were unsuccessful.
43+
**Please note**: the original repository at [eventable/vobject](https://github.com/eventable/vobject/) is
44+
_unmaintained_. This project forked the latest code from that repository, after attempts to revive the existing project
45+
with new maintainers were unsuccessful.
4346

44-
Many thanks to [all the contributors](https://github.com/py-vobject/vobject/blob/master/ACKNOWLEDGEMENTS.txt) for their dedication and support.
47+
Many thanks to [all the contributors](https://github.com/py-vobject/vobject/blob/master/ACKNOWLEDGEMENTS.txt) for their
48+
dedication and support.
4549

4650
# Installation
4751

@@ -51,15 +55,14 @@ To install with [pip](https://pypi.python.org/pypi/pip), run:
5155
pip install vobject
5256
```
5357

54-
5558
Or download the package and run:
5659

5760
```
5861
python setup.py install
5962
```
6063

61-
VObject requires Python 2.7 or higher, along with the [dateutil](https://pypi.python.org/pypi/python-dateutil/) and [six](https://pypi.python.org/pypi/six) packages.
62-
64+
VObject requires Python 2.7 or higher, along with the [dateutil](https://pypi.python.org/pypi/python-dateutil/)
65+
and [six](https://pypi.python.org/pypi/six) packages.
6366

6467
# Running tests
6568

@@ -69,16 +72,14 @@ To run all tests, use:
6972
python tests.py
7073
```
7174

72-
7375
# Usage
7476

7577
## iCalendar
7678

7779
#### Creating iCalendar objects
7880

79-
VObject has a basic datastructure for working with iCalendar-like
80-
syntaxes. Additionally, it defines specialized behaviors for many of
81-
the commonly used iCalendar objects.
81+
VObject has a basic datastructure for working with iCalendar-like syntaxes. Additionally, it defines specialized
82+
behaviors for many of the commonly used iCalendar objects.
8283

8384
To create an object that already has a behavior defined, run:
8485

@@ -113,12 +114,10 @@ children:
113114
SUMMARY: This is a note
114115
```
115116

116-
Note that summary is a little different from vevent, it's a
117-
ContentLine, not a Component. It can't have children, and it has a
118-
special value attribute.
117+
Note that summary is a little different from vevent, it's a ContentLine, not a Component. It can't have children, and it
118+
has a special value attribute.
119119

120-
ContentLines can also have parameters. They can be accessed with
121-
regular attribute names with _param appended:
120+
ContentLines can also have parameters. They can be accessed with regular attribute names with _param appended:
122121

123122
```
124123
>>> cal.vevent.summary.x_random_param = 'Random parameter'
@@ -132,9 +131,8 @@ regular attribute names with _param appended:
132131

133132
There are a few things to note about this example
134133

135-
* The underscore in x_random is converted to a dash (dashes are
136-
legal in iCalendar, underscores legal in Python)
137-
* X-RANDOM's value is a list.
134+
* The underscore in x_random is converted to a dash (dashes are legal in iCalendar, underscores legal in Python)
135+
* X-RANDOM's value is a list.
138136

139137
If you want to access the full list of parameters, not just the first,
140138
use <paramname>_paramlist:
@@ -147,7 +145,8 @@ use <paramname>_paramlist:
147145
<SUMMARY{'X-RANDOM': ['Random parameter', 'Other param']}This is a note>
148146
```
149147

150-
Similar to parameters, If you want to access more than just the first child of a Component, you can access the full list of children of a given name by appending _list to the attribute name:
148+
Similar to parameters, If you want to access more than just the first child of a Component, you can access the full list
149+
of children of a given name by appending _list to the attribute name:
151150

152151
```
153152
>>> cal.add('vevent').add('summary').value = "Second VEVENT"
@@ -202,12 +201,11 @@ END:VCALENDAR
202201
```
203202

204203
Observe that serializing adds missing required lines like version and
205-
prodid. A random UID would be generated, too, if one didn't exist.
204+
prodid. A random UID would be generated, too, if one didn't exist.
206205

207206
If dtstart's tzinfo had been something other than UTC, an appropriate
208207
vtimezone would be created for it.
209208

210-
211209
#### Parsing iCalendar objects
212210

213211
To parse one top level component from an existing iCalendar stream or
@@ -228,7 +226,6 @@ datetime.datetime(2006, 2, 16, 0, 0, tzinfo=tzutc())
228226

229227
More examples can be found in source code doctests.
230228

231-
232229
## vCards
233230

234231
#### Creating vCard objects
@@ -307,7 +304,9 @@ u'Harris'
307304
<EMAIL{'TYPE': ['INTERNET']}jeffery@example.org>]
308305
```
309306

310-
Just like with iCalendar example above readComponents will yield a generator from a stream or string containing multiple vCards objects.
307+
Just like with iCalendar example above readComponents will yield a generator from a stream or string containing multiple
308+
vCards objects.
309+
311310
```
312311
>>> vobject.readComponents(vCardStream).next().email.value
313312
'jeffrey@osafoundation.org'

ROADMAP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ Immediate tasks, starting early 2024
55

66
- [ ] Apply all open good PRs
77
- Add unit test coverage where missing
8-
- Add comments to _eventable_ repo, so people can see they're being
8+
- Add comments to _eventable_ repo, so people can see they're being
99
fixed in the _py-vobject_ project
1010
- [ ] Do a pass through the open issues at _eventable_
1111
- Fix anything easy
1212
- Copy the issue over to _py-vobject_ for bigger items that can't be
1313
fixed right away
1414
- [ ] Renumber _master_ for 1.0.x
15-
- And rename to `main` while we're here?
15+
- And rename to `main` while we're here?
1616
- [ ] Set up GitHub issue triage, etc
1717
- Group members and permissions
1818
- Labels

programmers-guide/source/conf.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@
88
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
99

1010
import datetime
11+
1112
import vobject
1213

13-
project = 'Python vObject'
14-
copyright = f'© {datetime.datetime.now().year}, David Arnold'
15-
author = 'David Arnold'
14+
project = "Python vObject"
15+
copyright = f"© {datetime.datetime.now().year}, David Arnold"
16+
author = "David Arnold"
1617
release = vobject.VERSION
1718

1819
# -- General configuration ---------------------------------------------------
1920
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2021

2122
extensions = []
2223

23-
templates_path = ['_templates']
24+
templates_path = ["_templates"]
2425
exclude_patterns = []
2526

2627

27-
2828
# -- Options for HTML output -------------------------------------------------
2929
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3030

31-
html_theme = 'alabaster'
31+
html_theme = "alabaster"
3232

3333
html_theme_options = {
34-
'github_user': 'py-vobject',
35-
'github_repo': 'vobject',
36-
'github_type': 'star',
37-
'github_button': 'true',
38-
'github_count': 'true',
34+
"github_user": "py-vobject",
35+
"github_repo": "vobject",
36+
"github_type": "star",
37+
"github_button": "true",
38+
"github_count": "true",
3939
}
4040

41-
html_static_path = ['_static']
41+
html_static_path = ["_static"]

0 commit comments

Comments
 (0)