Skip to content
Commits on Source (9)
Metadata-Version: 1.1
Name: easydev
Version: 0.9.35
Version: 0.9.37
Summary: Common utilities to ease the development of Python packages
Home-page: ['http://packages.python.org/easydev/']
Author: Thomas Cokelaer
Author-email: cokelaer@ebi.ac.uk
License: new BSD
Download-URL: ['http://pypi.python.org/pypi/easydev']
Description-Content-Type: UNKNOWN
Description: easydev
##########
......@@ -28,7 +29,7 @@ Description: easydev
:contributions: Please join https://github.com/cokelaer/easydev
:source: Please use https://github.com/cokelaer/easydev
:issues: Please use https://github.com/cokelaer/easydev/issues
:Python version supported: 2.6, 2.7, 3.3, 3.4, 3.5, 3.6
:Python version supported: 2.7, 3.3, 3.4, 3.5, 3.6
The `easydev <http://pypi.python.org/pypi/easydev/>`_ package
......
......@@ -19,7 +19,7 @@ easydev
:contributions: Please join https://github.com/cokelaer/easydev
:source: Please use https://github.com/cokelaer/easydev
:issues: Please use https://github.com/cokelaer/easydev/issues
:Python version supported: 2.6, 2.7, 3.3, 3.4, 3.5, 3.6
:Python version supported: 2.7, 3.3, 3.4, 3.5, 3.6
The `easydev <http://pypi.python.org/pypi/easydev/>`_ package
......
python-easydev (0.9.37-1) UNRELEASED; urgency=medium
* Team upload.
* Fix watch file
* debhelper 11
* Activate Testsuite field
* Point Vcs fields to salsa.debian.org
* Standards-Version: 4.3.0
* Remove trailing whitespace in debian/copyright
-- Andreas Tille <tille@debian.org> Wed, 09 Jan 2019 16:45:57 +0100
python-easydev (0.9.35+dfsg-2) unstable; urgency=medium
* Correct ITP bug number in previous changelog entry
......
Source: python-easydev
Section: python
Priority: optional
Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
Uploaders: Afif Elghraoui <afif@debian.org>
Build-Depends:
debhelper (>= 9),
Section: python
Testsuite: autopkgtest-pkg-python
Priority: optional
Build-Depends: debhelper (>= 11~),
dh-python,
python-all,
python-setuptools,
python-appdirs,
python-colorama,
python-pexpect,
python-appdirs,
python3-all,
python3-setuptools,
python3-appdirs,
python3-colorama,
python3-pexpect,
python3-appdirs,
Standards-Version: 4.1.3
python3-pexpect
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/med-team/python-easydev
Vcs-Git: https://salsa.debian.org/med-team/python-easydev.git
Homepage: https://easydev-python.readthedocs.io/en/latest/
Vcs-Git: https://anonscm.debian.org/git/debian-med/python-easydev.git
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/python-easydev.git
#Testsuite: autopkgtest-pkg-python
Package: python-easydev
Architecture: all
Depends:
${python:Depends},
Depends: ${python:Depends},
${misc:Depends},
python-pkg-resources,
python-appdirs,
python-appdirs
Description: common utilities to ease the development of Python packages (Python 2)
The package easydev provides miscellaneous functions that are often used in
other Python packages. easydev should help developers in speeding up their
......@@ -40,11 +36,10 @@ Description: common utilities to ease the development of Python packages (Python
Package: python3-easydev
Architecture: all
Depends:
${python3:Depends},
Depends: ${python3:Depends},
${misc:Depends},
python3-pkg-resources,
python3-appdirs,
python3-appdirs
Description: common utilities to ease the development of Python packages (Python 3)
The package easydev provides miscellaneous functions that are often used in
other Python packages. easydev should help developers in speeding up their
......
version=4
# releases on github don't keep up with pypi, but
# pypi.debian.net seems to be down
#https://pypi.debian.net/python-easydev/python-easydev-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
https://pypi.python.org/simple/easydev .*/easydev-@ANY_VERSION@@ARCHIVE_EXT@#sha256=.*
......@@ -18,13 +18,17 @@
from __future__ import print_function
#from __future__ import absolute_import
__version__ = "0.9.34"
import pkg_resources
__version__ = "0.9.36"
try:
version = pkg_resources.require("easydev")[0].version
except:
import pkg_resources
except ImportError as err:
print(err)
print("version set to {} manually.".format(__version__))
version = __version__
else:
version = pkg_resources.require("easydev")[0].version
__version__ = version
from . import browser
from .browser import browse as onweb
......
......@@ -98,9 +98,11 @@ class ConfigExample(object):
which can be read with ConfigParser as follows:
.. code-block:: python
>>> from ConfigParser import ConfigParser
.. doctest::
>>> # Python 3 code
>>> from configparser import ConfigParser
>>> config = ConfigParser()
>>> config.read("file.ini")
[]
......@@ -133,13 +135,13 @@ class DynamicConfigParser(ConfigParser, object):
You can now also directly access to an option as follows::
>>> c.General.tag
c.General.tag
Then, you can add or remove sections (:meth:`remove_section`, :meth:`add_section`),
or option from a section :meth:`remove_option`. You can save the instance into a file
or print it::
>>> print(c)
print(c)
.. warning:: if you set options manually (e.G. self.GA.test =1 if GA is a
section and test one of its options), then the save/write does not work
......@@ -231,8 +233,9 @@ class DynamicConfigParser(ConfigParser, object):
Let us build up a standard config file:
.. code-block:: python
>>> import ConfigParser
>>> c = ConfigParser.ConfigParser()
>>> # Python 3 code
>>> from configparser import ConfigParser
>>> c = ConfigParser()
>>> c.add_section('general')
>>> c.set('general', 'step', str(1))
>>> c.set('general', 'verbose', 'True')
......
......@@ -14,77 +14,98 @@
#
##############################################################################
import logging
import colorlog
__all__ = ["Logging"]
class Logging(object):
"""logging utility.
colors = {
'DEBUG': 'cyan',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'bold_red'}
When using the logging utility, it works like a singleton.
So, once logging level is set, you cannot set it again easily.
Here is a class that allows to do that.
.. warning:: this is a bit of a hack. Maybe this is not a proper solution but
it seems to do the job.
class Logging(object):
"""logging utility.
::
>>> l = Logging("INFO")
>>> l = Logging("root", "INFO")
>>> l.info("test")
INFO:root:test
>>> l.level = "WARNING"
>>> l.info("test")
"""
# I think that we can not inherit from logging.
def __init__(self, level):
""".. rubric:: constructor
:param str level: valid levels are ["INFO", "DEBUG", "WARNING",
"CRITICAL", "ERROR"]. If set to True, level is internally set to
INFO. If set to False, level is seet internally to ERROR.
"""
self._debugLevel = None
self.debugLevel = level
self.logging = logging
self.info = logging.info
self.warning = logging.warning
self.critical = logging.critical
self.error = logging.error
self.debug = logging.debug
def __init__(self, name="root", level="WARNING"):
self.name = name
formatter = colorlog.ColoredFormatter(
"%(log_color)s%(levelname)-8s[%(name)s]: %(reset)s %(blue)s%(message)s",
datefmt=None,
reset=True,
log_colors=colors,
secondary_log_colors={},
style='%'
)
handler = colorlog.StreamHandler()
handler.setFormatter(formatter)
logger = colorlog.getLogger(self.name)
if len(logger.handlers) == 0:
logger.addHandler(handler)
self._set_level(level)
def _set_level(self, level):
valid_level = [True, False, "INFO", "DEBUG", "WARNING", "CRITICAL", "ERROR"]
if isinstance(level, bool):
if level is True:
level = "INFO"
if level is False:
level = "ERROR"
if level in valid_level:
self._debugLevel = level
else:
raise ValueError("The level of debugging must be in %s " %valid_level)
# I'm not sure this is the best solution, but basicConfig can be called
# only once and populatse root.handlers list with one instance of
# logging.StreamHandler. So, I reset it before calling basicConfig
# that effectively changes the logging behaviour
logging.root.handlers = []
logging.basicConfig(level=self._debugLevel)
assert level in ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
logging_level = getattr(colorlog.logging.logging, level)
colorlog.getLogger(self.name).setLevel(level)
def _get_level(self):
return self._debugLevel
debugLevel = property(_get_level, _set_level,
doc="Read/Write access to the debug level. Must be one of INFO, " + \
"DEBUG, WARNING, CRITICAL, ERROR")
level = property(_get_level, _set_level,
doc="alias to :attr:`~easydev.logging_tools.Logging.debugLevel` (Read-only access)")
# Used copy/deepcopy module
def __copy__(self):
print("WARNING: easydev.logging_tools.__copy__ deprecated. use copy() instead")
s = Logging(self.level)
return s
def __deepcopy__(self, memo):
s = Logging(self.level)
return s
level = colorlog.getLogger(self.name).level
if level == 10:
return "DEBUG"
elif level == 20:
return "INFO"
elif level == 30:
return "WARNING"
elif level == 40:
return "ERROR"
elif level == 50:
return "CRITICAL"
else:
return level
level = property(_get_level, _set_level)
def debug(self, msg):
colorlog.getLogger(self.name).debug(msg)
def info(self, msg):
colorlog.getLogger(self.name).info(msg)
def warning(self, msg):
colorlog.getLogger(self.name).warning(msg)
def critical(self, msg):
colorlog.getLogger(self.name).critical(msg)
def error(self, msg):
colorlog.getLogger(self.name).error(msg)
......@@ -15,7 +15,6 @@
# Documentation: http://easydev-python.readthedocs.io
#
##############################################################################
import os
......@@ -23,6 +22,7 @@ __all__ = ['get_home', 'cmd_exists']
def get_home():
"""Return path of the HOME"""
# This function should be robust
# First, let us try with expanduser
try:
......@@ -42,6 +42,7 @@ def get_home():
def cmd_exists(cmd):
"""Return true if the command do exists in the environement"""
try:
import subprocess
# for unix/max only
......
......@@ -19,7 +19,7 @@
import time
class Timer():
class Timer(object):
"""Timer working with *with* statement
::
......
......@@ -3,7 +3,6 @@
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
[global]
......@@ -24,5 +23,5 @@ attr = !skip,!notravis
upload_dir = doc/build/html/
[tool:pytest]
addopts = --durations=10 --verbose
addopts = --cov=easydev --cov-report=term-missing --durations=10 --verbose
......@@ -7,7 +7,7 @@ import glob
_MAJOR = 0
_MINOR = 9
_MICRO = 35
_MICRO = 37
version = '%d.%d.%d' % (_MAJOR, _MINOR, _MICRO)
release = '%d.%d' % (_MAJOR, _MINOR)
......@@ -66,7 +66,7 @@ setup(
"themes/cno/static/*",
"copybutton.js"]},
install_requires = ['colorama', 'pexpect'],
install_requires = ['colorama', 'pexpect', "colorlog"],
extras_require = {
'profiler': ["line_profiler_test"]
},
......
......@@ -5,7 +5,7 @@ from nose.plugins.attrib import attr
def test_isurl():
assert isurl_reachable("www.google.com") == True
assert isurl_reachable("http://www.google.com") == True
assert isurl_reachable("https://fr.yahoo.com") == False # moved
#assert isurl_reachable("https://fr.yahoo.com") == False # moved
assert isurl_reachable("wrong.co.ujj") == False
assert isurl_reachable("http://wrong.co.ujj") == False
assert isurl_reachable("http://wrong.co") == False