Git Product home page Git Product logo

coil's Issues

coil.struct.string() does not handle an empty struct properly

What steps will reproduce the problem?
When converting a coil struct to text via the internal string method, and
the struct has an empty dictionary in it, the output misses a new line.

What is the expected output? 
key: {}
key2: value

What do you see instead?
key: {}key2: value

Index: coil/coil/struct.py
===================================================================
--- coil/coil/struct.py (revision 297206)
+++ coil/coil/struct.py (working copy)
@@ -457,7 +457,7 @@
                 if child:
                     result = "%s{\n%s\n%s}\n" % (result, child, prefix)
                 else:
-                    result += "{}"
+                    result += "{}\n"
             else:
                 result = "%s%s\n" % (result, stritem(val))

Original issue reported on code.google.com by [email protected] on 30 Jul 2009 at 5:42

Code review request: has_key('dotted.key')

Branch name:
trunk

Purpose of code changes on this branch:
Add support for full paths in struct.has_key()

When reviewing my code changes, please focus on:
Performance takes a hit on calls to has_key() for first-level keys that are not 
in the struct, but it seems like the cleanest way without adding a flattened 
list of keys or reimplementing struct.get

After the review, I'll merge this branch into:
/trunk


Original issue reported on code.google.com by [email protected] on 18 Feb 2012 at 8:06

Attachments:

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.