Skip to content

Commit 171ea3d

Browse files
authored
Version 0.9.5 (#56)
* - Adding `ignored` context manager (Thanks to Dogeek)
1 parent c54ea34 commit 171ea3d

18 files changed

+62
-38
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ test/fake_dir
4545
*.sqlite-shm
4646
*.sqlite-wal
4747
*.ignore
48+
release.bat

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
sudo: required
2-
dist: trusty
32
language: python
43
python:
54
- "2.7"
65
- "3.4"
76
- "3.5"
87
- "3.6"
8+
- "3.7"
9+
- "3.8"
910
- "pypy"
10-
matrix:
11-
include:
12-
- python: "3.7"
13-
dist: xenial
14-
sudo: true
1511
before_install:
1612
- sudo apt-get -qq update
1713
- sudo apt-get install -y unrar

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
Version 0.9.5
5+
-------------
6+
7+
- Adding `ignored` context manager (Thanks to Dogeek)
8+
49
Version 0.9.4
510
-------------
611

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include AUTHORS.rst
3+
include CHANGES.rst

README.rst

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ Easy formatting for datetime objects. Also parsing for ISO formatted time.
336336
command="Get out of bed!")
337337
# "Wake up John, it's 09:51 AM! I don't care if it's a Saturday, Get out of bed!!"
338338
339-
reusables.datetime_from_iso('2017-03-10T12:56:55.031863')
340-
# datetime.datetime(2017, 3, 10, 12, 56, 55, 31863)
339+
reusables.datetime_from_iso('2019-03-10T12:56:55.031863')
340+
# datetime.datetime(2019, 3, 10, 12, 56, 55, 31863)
341341
342342
343343
Examples based on Mon Mar 28 13:27:11 2016
@@ -437,19 +437,3 @@ This does not claim to provide the most accurate, fastest or most 'pythonic'
437437
way to implement these useful snippets, this is simply designed for easy
438438
reference. Any contributions that would help add functionality or
439439
improve existing code is warmly welcomed!
440-
441-
.. toctree::
442-
:maxdepth: 2
443-
444-
file_operations
445-
tasker
446-
log
447-
datetime
448-
namespace
449-
web
450-
multiprocess_helpers
451-
cli
452-
wrappers
453-
numbers
454-
changelog
455-

reusables/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
from __future__ import absolute_import
88

99
from reusables.string_manipulation import *
@@ -19,6 +19,7 @@
1919
from reusables.web import *
2020
from reusables.wrappers import *
2121
from reusables.sanitizers import *
22+
from reusables.other import *
2223

2324
__author__ = "Chris Griffith"
24-
__version__ = "0.9.4"
25+
__version__ = "0.9.5"

reusables/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
""" Functions to only be in an interactive instances to ease life. """
88
from __future__ import absolute_import
99
import os

reusables/dt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
from __future__ import absolute_import
88
import datetime
99
import re
@@ -81,8 +81,8 @@ def datetime_from_iso(iso_string):
8181
8282
.. code :: python
8383
84-
reusables.datetime_from_iso('2017-03-10T12:56:55.031863')
85-
datetime.datetime(2017, 3, 10, 12, 56, 55, 31863)
84+
reusables.datetime_from_iso('2019-03-10T12:56:55.031863')
85+
datetime.datetime(2019, 3, 10, 12, 56, 55, 31863)
8686
8787
:param iso_string: string of an ISO datetime
8888
:return: DateTime object

reusables/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
"""
88
Logging helper functions and common log formats.
99
"""

reusables/namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
"""
88
Improved dictionary management. Inspired by
99
javascript style referencing, as it's one of the few things they got right.

reusables/other.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python
2+
# -*- coding: UTF-8 -*-
3+
#
4+
# Part of the Reusables package.
5+
#
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
7+
from contextlib import contextmanager
8+
9+
__all__ = ['ignored']
10+
11+
12+
@contextmanager
13+
def ignored(*exceptions):
14+
""" Ignores provided exceptions with a context manager. """
15+
try:
16+
yield
17+
except exceptions:
18+
pass

reusables/process_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
import os
88
import sys
99
import subprocess

reusables/shared_variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
from __future__ import absolute_import
88
import re as _re
99
import os as _os

reusables/string_manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
_roman_dict = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50,
88
'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}
99

reusables/tasker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
try:
88
import queue as queue
99
except ImportError:

reusables/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
from __future__ import absolute_import
88
import os
99
import logging

reusables/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Part of the Reusables package.
55
#
6-
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
6+
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
77
from __future__ import absolute_import
88
import time
99
from threading import Lock

test/test_other.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
# -*- coding: UTF-8 -*-
3+
import reusables
4+
5+
from .common_test_data import *
6+
7+
8+
class TestException(Exception):
9+
pass
10+
11+
12+
class TestOther(BaseTestClass):
13+
14+
def test_exception_ignored(self):
15+
with reusables.ignored(TestException):
16+
raise TestException()

0 commit comments

Comments
 (0)