GithubHelp home page GithubHelp logo

brownie's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

brownie's Issues

defaultdict

Any interest in an implementation of collections.defaultdict?

Lazy proxies

>>> now = LazyProxy(datetime.utcnow)
>>> now.second
1
>>> now.second
2

Useful for APIs that expect an object and not a callable, but you need the object to behave more like a callable. A CachedLazyProxy could also be implemented that calls the callable only the first time, if there's a use case for that.

"AttrDict" or "DictyObject"?

Hi, what I've often seen (particularly in web frameworks and web templating languages are objects that behave like dicts.

I've got an implementation of said pattern myself, and would be happy to add it to brownie if you think it's something useful. Let me know and I'll craft up a patch and submit a pull request.

Using LFUCache without specifying maxsize does not work

If you create an LFUCache without specifying a maxsize, setitem passes a -inf down into Counter.most_common which eventually blows up in heapq.nlargest

Here's the exception traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/stephen/dev/taipan/categories/lib/python2.6/site-packages/brownie/caching.py", line 116, in __setitem__
    for key, _ in self.usage_counter.most_common(len(self) - self.maxsize):
  File "/Users/stephen/dev/taipan/categories/lib/python2.6/site-packages/brownie/datastructures/mappings.py", line 779, in most_common
    return nlargest(n, self.iteritems(), key=itemgetter(1))
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/heapq.py", line 370, in nlargest
    result = _nlargest(n, it)
OverflowError: cannot convert float infinity to integer

I haven't checked whether this is specific to LFUCache or effects the other caches as well.

Progressbar support

We need support for progress bars, however if they are added they should support the following:

  • (Un)known sizes
  • Per update text updates or hints
  • Update size (kB/s)
  • ETA support

If the initial implementation doesn't support all of this it should be extend able enough to add support for these features.

The ability to change the design would be nice although I'm not sure that this is would be necessary.

DataTransferSpeedWidget test fails

Hello, I've got the following failure wen running runtests.py -- is it an expected issue?

Code/brownie » python runtests.py
[100%] 495 of 495 ETA:  00:00:00

brownie.tests.terminal.progress.TestDataTransferSpeedWidget.update
────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
  File "/home/bobry/Code/brownie/brownie/tests/terminal/progress.py", line 342, in update
    Assert(speed) > 45.0
AssertionError: 43.52 <= 45.0

Failures: 1/495 (1512 assertions)

import_string

Something like werkzeug.import_string would be nice to have.

make_proxy_class().method should allow simple modification of proxied and args

At the moment it is quite easy to intercept any call to a special method, however due to the fact that they cannot all be treated equally in order to make use of the API the user has to handle the special cases in the handler when obtaining a result.

The API needs to be changed in a way that maintains the current simplicity but simply allows you to "do the right thing".

Dictionary inheritance tree and type checks

Due to the way the dictionaries are implemented at the moment type checks do not yield the results one might expect e.g. ImmutableOrderedMultiDict is not a subclass of OrderedMultiDict nor is OrderedMultiDict a subclass of MultiDict.

This should be fixable at least in 2.6 and onwards.

timeout decorator/context manager

try:
    with timeout(5):
        return subprocess.Popen(...).communicate(...)
except TimeoutError:
    return None

I have working code for this if you're interested (just needs to be turned into a context manager and optionally a decorator).

Context locals

Yea, I keep thinking of things that are in Werkzeug that are neat :D while I don't want to depend on the whole of Werkzeug for something non-WSGI.

Would be useful to have thread and process safe stacks á la Werkzeug, for example in Attest to count assertions "per run()" and in the future I might need to keep a context-local "configuration" for e.g. whether to evaluate function calls or not.

(Hm, I wonder if it would mess with your using Attest if Attest used Brownie?)

"compose" doe not work, if first function does not take any parameter

Consider this snippet:

def foo():
    print "Hello"

def bar():
    print "World!"

If you now use compose with these two functions, it won't work:

compose(foo, bar)()

With this error message:

World!
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (4, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Dokumente und Einstellungen\nelson\Eigene Dateien\ in ()

C:\Programme\Python27\lib\site-packages\brownie\functional.pyc in (*a, *
*kws)
     28     elif len(functions) == 1:
     29         return functions[0]
---> 30     return reduce(lambda f, g: lambda *a, **kws: f(g(*a, **kws)), functi
ons)
     31
     32

TypeError: foo() takes no arguments (1 given)

If you spend foo a parameter, it works:

def foo(param):
    print "Hello"

So of course compose is not really meant to be used for functions without any parameter, but it could be documented anyway I think :-)

OrderedSet

A set() that preserves order but otherwise acts like a normal set: drops duplicates, supports intersection/union etc.

Drop 2.5 support?

it seems that most production deployments are either 2.4 -- CentOS 5, or 2.6 -- CentOS 6 or Debian Stable.

Why?

  1. Abstract Base Classes from collections -- without them, we're forced to subclass dict and enjoy all the subtleties in both brownie.caching and brownie.datastructures.*
  2. Less compatibility-code: Counter, itools.* to name a few

What do you think?

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.