Skip to content

Commit

Permalink
Version 0.9.5 (#56)
Browse files Browse the repository at this point in the history
* - Adding `ignored` context manager (Thanks to Dogeek)
  • Loading branch information
cdgriffith authored Dec 18, 2019
1 parent c54ea34 commit 171ea3d
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ test/fake_dir
*.sqlite-shm
*.sqlite-wal
*.ignore
release.bat
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
sudo: required
dist: trusty
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "pypy"
matrix:
include:
- python: "3.7"
dist: xenial
sudo: true
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y unrar
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 0.9.5
-------------

- Adding `ignored` context manager (Thanks to Dogeek)

Version 0.9.4
-------------

Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include LICENSE
include AUTHORS.rst
include CHANGES.rst
20 changes: 2 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ Easy formatting for datetime objects. Also parsing for ISO formatted time.
command="Get out of bed!")
# "Wake up John, it's 09:51 AM! I don't care if it's a Saturday, Get out of bed!!"
reusables.datetime_from_iso('2017-03-10T12:56:55.031863')
# datetime.datetime(2017, 3, 10, 12, 56, 55, 31863)
reusables.datetime_from_iso('2019-03-10T12:56:55.031863')
# datetime.datetime(2019, 3, 10, 12, 56, 55, 31863)
Examples based on Mon Mar 28 13:27:11 2016
Expand Down Expand Up @@ -437,19 +437,3 @@ This does not claim to provide the most accurate, fastest or most 'pythonic'
way to implement these useful snippets, this is simply designed for easy
reference. Any contributions that would help add functionality or
improve existing code is warmly welcomed!

.. toctree::
:maxdepth: 2

file_operations
tasker
log
datetime
namespace
web
multiprocess_helpers
cli
wrappers
numbers
changelog

5 changes: 3 additions & 2 deletions reusables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from __future__ import absolute_import

from reusables.string_manipulation import *
Expand All @@ -19,6 +19,7 @@
from reusables.web import *
from reusables.wrappers import *
from reusables.sanitizers import *
from reusables.other import *

__author__ = "Chris Griffith"
__version__ = "0.9.4"
__version__ = "0.9.5"
2 changes: 1 addition & 1 deletion reusables/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
""" Functions to only be in an interactive instances to ease life. """
from __future__ import absolute_import
import os
Expand Down
6 changes: 3 additions & 3 deletions reusables/dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from __future__ import absolute_import
import datetime
import re
Expand Down Expand Up @@ -81,8 +81,8 @@ def datetime_from_iso(iso_string):
.. code :: python
reusables.datetime_from_iso('2017-03-10T12:56:55.031863')
datetime.datetime(2017, 3, 10, 12, 56, 55, 31863)
reusables.datetime_from_iso('2019-03-10T12:56:55.031863')
datetime.datetime(2019, 3, 10, 12, 56, 55, 31863)
:param iso_string: string of an ISO datetime
:return: DateTime object
Expand Down
2 changes: 1 addition & 1 deletion reusables/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
"""
Logging helper functions and common log formats.
"""
Expand Down
2 changes: 1 addition & 1 deletion reusables/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
"""
Improved dictionary management. Inspired by
javascript style referencing, as it's one of the few things they got right.
Expand Down
18 changes: 18 additions & 0 deletions reusables/other.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from contextlib import contextmanager

__all__ = ['ignored']


@contextmanager
def ignored(*exceptions):
""" Ignores provided exceptions with a context manager. """
try:
yield
except exceptions:
pass
2 changes: 1 addition & 1 deletion reusables/process_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
import os
import sys
import subprocess
Expand Down
2 changes: 1 addition & 1 deletion reusables/shared_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from __future__ import absolute_import
import re as _re
import os as _os
Expand Down
2 changes: 1 addition & 1 deletion reusables/string_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
_roman_dict = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50,
'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}

Expand Down
2 changes: 1 addition & 1 deletion reusables/tasker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
try:
import queue as queue
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion reusables/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from __future__ import absolute_import
import os
import logging
Expand Down
2 changes: 1 addition & 1 deletion reusables/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2017 - Chris Griffith - MIT License
# Copyright (c) 2014-2019 - Chris Griffith - MIT License
from __future__ import absolute_import
import time
from threading import Lock
Expand Down
16 changes: 16 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import reusables

from .common_test_data import *


class TestException(Exception):
pass


class TestOther(BaseTestClass):

def test_exception_ignored(self):
with reusables.ignored(TestException):
raise TestException()

0 comments on commit 171ea3d

Please sign in to comment.