Code Monkey home page Code Monkey logo

grizzled-python's Introduction

bmc

Just some quick details:

Other links are in my GitHub profile.

grizzled-python's People

Contributors

bmc avatar cr33dog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grizzled-python's Issues

Test package directories missing __init__.py files

The following test directories are missing __init__.py files:

  • grizzled-python/test/misc
  • grizzled-python/test/net
  • grizzled-python/test/net/ftp

This causes the tests contained within to be omitted from a nose test run:

$ nosetests -v
test.collections.TestLRUDict.TestLRUDict.test1 ... ok
test.collections.TestLRUDict.TestLRUDict.testBig ... ok
test.config.TestConfiguration.TestParser.testBadSubstitution ... ok
test.config.TestConfiguration.TestParser.testInclude ... ok
test.config.TestConfiguration.TestParser.testOrdering ... ok
test.config.TestConfiguration.TestParser.testSubstitute1 ... ok
test.config.TestConfiguration.TestParser.testSubstitute2 ... ok
test.file.Test.TestFilePackage.testRecursivelyRemove ... ok
test.file.Test.TestFilePackage.testTouch ... ok
test.file.Test.TestFilePackage.testUnlinkQuietly ... ok
test.file.TestEglob.TestEglob.testPyFiles ... ok
test.file.TestEglob.TestEglob.testReadMes ... ok
test.file.TestEglob.TestEglob.testTextFiles ... ok
test.file.TestEglob.TestEglob.testTopLevelFiles ... ok
test.io.TestPushback.TestPushback.testPushback ... ok
test.system.Test.TestSys.test_class_for_name ... ok
test.system.Test.TestSys.test_current_version ... ok
test.system.Test.TestSys.test_version_conversions('2.5.1', 33882608) ... ok
test.system.Test.TestSys.test_version_conversions('1.5', 17105136) ... ok
test.system.Test.TestSys.test_version_conversions('2.6', 33947888) ... ok
test.system.Test.TestSys.test_version_conversions('2.4.3', 33817584) ... ok
test.text.TestStr2Bool.TestStr2Bool.testBadStrings ... ok
test.text.TestStr2Bool.TestStr2Bool.testGoodStrings ... ok
test.TestProxy.TestProxyPackage.test_forward_all ... ok
test.TestProxy.TestProxyPackage.test_forward_all_but_name ... ok
test.TestProxy.TestProxyPackage.test_forward_all_but_name_mode ... ok

----------------------------------------------------------------------
Ran 26 tests in 0.080s

OK

Notably, the test/net/ftp/TestFTPListParse.py test is currently failing, related to an unresolved reference to the Enum type referenced in #5

======================================================================
ERROR: Failure: NameError (name 'Enum' is not defined)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/local/google/home/mmcdonald/grizzled-python/test/net/ftp/TestFTPListParse.py", line 13, in <module>
    from grizzled.net.ftp.parse import *
  File "/usr/local/google/home/mmcdonald/grizzled-python/grizzled/net/ftp/parse.py", line 70, in <module>
    MTIME_TYPE = Enum('UNKNOWN', 'LOCAL', 'REMOTE_MINUTE', 'REMOTE_DAY')
NameError: name 'Enum' is not defined

enum34 compatibility

I've installed grizzled-python 1.0.7 in python 2.7 to parse ftp directory listings (net/ftp/parse.py module). It pulls in also 'enum34' as a dependency but the 'Enum'-related code in parse.py looks like it's written against the older 'enum' and not the 'enum34' package. At least when I try to import 'parse_ftp_list_line', python also throws some exceptions.

I think the problem is that the enum34 "functional API" requires the first argument to be the name of the enumeration and the second argument the source of enumeration members as a sequence of names:

https://docs.python.org/3/library/enum.html#functional-api

Here's the patch that I applied, which seems to work for me:

--- ./grizzled/net/ftp/parse.py_orig    2016-11-01 12:10:47.795948217 +0000
+++ ./grizzled/net/ftp/parse.py 2016-11-01 12:19:08.766882529 +0000
@@ -48,6 +48,7 @@
 import time
 import calendar
 from ftplib import error_perm
+from enum import Enum

 # ---------------------------------------------------------------------------
 # Exports
@@ -67,7 +68,7 @@
 MONTHS = ('jan', 'feb', 'mar', 'apr', 'may', 'jun',
           'jul', 'aug', 'sep', 'oct', 'nov', 'dec')

-MTIME_TYPE = Enum('UNKNOWN', 'LOCAL', 'REMOTE_MINUTE', 'REMOTE_DAY')
+MTIME_TYPE = Enum('MTIME_TYPE', ['UNKNOWN', 'LOCAL', 'REMOTE_MINUTE', 'REMOTE_DAY'])
 """
 ``MTIME_TYPE`` identifies how a modification time ought to be interpreted
 (assuming the caller cares).
@@ -78,7 +79,7 @@
     - ``UNKNOWN``: Time's locale is unknown.
 """

-ID_TYPE = Enum('UNKNOWN', 'FULL')
+ID_TYPE = Enum('ID_TYPE', ['UNKNOWN', 'FULL'])
 """
 ``ID_TYPE`` identifies how a file's identifier should be interpreted.

grizzled.os.daemonize docstring

The docstring for grizzled.os.daemonize (http://github.com/bmc/grizzled/blob/master/grizzled/os.py#L239) says to use

from grizzled.os import daemon

but I got an import error:

Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from grizzled.os import daemon
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name daemon

Is it supposed to be

from grizzled.os import daemonize

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.