X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=modules%2Flibjuju%2Fjuju%2Fclient%2Fcodegen.py;fp=modules%2Flibjuju%2Fjuju%2Fclient%2Fcodegen.py;h=0000000000000000000000000000000000000000;hp=f8a792a7b6d121199c3f6780db241bccb7814ce9;hb=9d18c22a0dc9e295adda50601fc5e2f45d2c9b8a;hpb=19c5cfca317615597be6bf1051e9d2fa903adb97 diff --git a/modules/libjuju/juju/client/codegen.py b/modules/libjuju/juju/client/codegen.py deleted file mode 100644 index f8a792a..0000000 --- a/modules/libjuju/juju/client/codegen.py +++ /dev/null @@ -1,52 +0,0 @@ -from collections import defaultdict -from io import StringIO -from textwrap import indent - - -class CodeWriter(StringIO): - """ - Blob of text that, when used in the context of facade.py, ends up - holding the source code for a Python class and associated methods. - - """ - INDENT = " " - - CLASS = 0 - METHOD = 1 - - def write(self, msg, depth=0): - if depth: - prefix = self.INDENT * depth - msg = indent(msg, prefix) - - return super(CodeWriter, self).write(msg) - - def __str__(self): - return super(CodeWriter, self).getvalue() - - -class Capture(defaultdict): - """ - A collection of CodeWriter objects, together representing a Python - module. - - """ - - def __init__(self, default_factory=CodeWriter, *args, **kwargs): - super(Capture, self).__init__(default_factory, *args, **kwargs) - - def clear(self, name): - """ - Reset one of the keys in this class, if it exists. - - This is necessary, because we don't worry about de-duplicating - the schemas for each version of juju up front, and this gives - us a way to sort of de-duplicate on the fly, by resetting a - specific CodeWriter instance before we start to write a class - into it. - - """ - try: - del self[name] - except KeyError: - pass