Example #1
0
    def __init__(self,
                 gen_indices=hkcustomlib.gen_indices,
                 gen_threads=hkcustomlib.gen_threads,
                 gen_posts=hkcustomlib.gen_posts,
                 edit_file=hkcustomlib.edit_file):

        super(Callbacks, self).__init__()
        hkutils.set_dict_items(self, locals())
Example #2
0
    def __init__(self,
                 postdb=hkutils.NOT_SET,
                 config=hkutils.NOT_SET,
                 output=sys.stdout,
                 callbacks=hkutils.NOT_SET,
                 shell_banner='',
                 save_on_ctrl_d=None):

        super(Options, self).__init__()
        hkutils.set_dict_items(self, locals())
Example #3
0
    def __init__(
        self,
        shortsubject=False,
        shorttags=False,
        html_title="Heap index",
        html_h1="Heap index",
        cssfiles=[],
        files_to_copy=[],
        js_files=[],
        favicon="",
    ):

        super(GeneratorOptions, self).__init__()
        hkutils.set_dict_items(self, locals())
Example #4
0
    def test_set_dict_items_1(self):

        class A:
            pass
        a = A()
        d = {'self': 0, 'something': 1, 'notset': hkutils.NOT_SET}
        hkutils.set_dict_items(a, d)
        self.assertEquals(a.something, 1)

        def f():
            a.self
        self.assertRaises(AttributeError, f)

        def f():
            a.notset
        self.assertRaises(AttributeError, f)
Example #5
0
    def __init__(self,
                 type,
                 command=None,
                 post=None,
                 postset=None):

        """Initializes an object.

        **Arguments:**

        - `type` (str) -- See the data attributes of |Event|.
        - `command` (str) -- See the data attributes of |Event|.
        - `post` (|Post|) -- See the data attributes of |Event|.
        - `postset` (|PostSet|) -- See the data attributes of |Event|.
        """

        super(Event, self).__init__()
        hkutils.set_dict_items(self, locals())
Example #6
0
    def test_set_dict_items_1(self):

        """Tests :func:`hkutils.set_dict_items`."""

        class A:
            # Class has no __init__ method # pylint: disable=W0232
            pass
        a = A()
        d = {'self': 0, 'something': 1, 'notset': hkutils.NOT_SET}
        hkutils.set_dict_items(a, d)
        self.assertEqual(a.something, 1)

        def f():
            # Statement seems to have no effect # pylint: disable=W0104
            a.self
        self.assertRaises(AttributeError, f)

        def f():
            # Function already defined # pylint: disable=E0102
            # Statement seems to have no effect # pylint: disable=W0104
            a.notset
        self.assertRaises(AttributeError, f)
Example #7
0
 def __init__(self, x1=NOT_SET, x2=NOT_SET, x3=0, x4=0):
     super(A, self).__init__()
     hkutils.set_dict_items(self, locals())