# Path: shapy/framework/executor.py
# def run(command, **kwargs):
# def get_command(name, **kwargs):
#     def __init__(self, **kwargs):
#     def __setitem__(self, key, item):
#     def __getitem__(self, key):
#     def cmd(self):
#     def get(self):
#     def get_context(self):
#     def get_interface(self):
#     def execute(self):
# class Executable(object):
# 
# Path: shapy/framework/utils.py
# def validate_ip(addr):
# def validate_full_ip(ip):
# def align(l, alignto=4):
# def convert_handle(handle):
# def get_if_index(if_name):
# def nl_us2ticks(delay):
# def nl_ticks2us(ticks):
# def convert_to_bytes(rate):
#     def register(cls, interpreter, content_types):
#     def select(cls, selector):
# class InterpreterMixin(object):


import logging
from shapy.framework import executor, utils
    
    def __del__(self):
        del Interface.interfaces[self.name]
    
    def __init__(self, name):
        self.name = name
        self.if_index = utils.get_if_index(self.name)
    
    def __str__(self):
        return self.name
    
    def add(self, root_qdisc):
        self.root = root_qdisc
        self.root.interface = self
        return self.root
        
    def add_ingress(self, ingress_qdisc):
        self.ingress = ingress_qdisc
        self.ingress.interface = self
        return self.ingress
        
    def set_shaping(self):
        #assert self.root, "Interface must contain at least a root qdisc."
        if hasattr(self, 'ingress'):
            self.ingress.execute()
            for ch in self.ingress.children:
                ch.execute()
        if hasattr(self, 'root'):
            self.__traverse_tree(self.root)
    

# Path: shapy/framework/executor.py
# def run(command, **kwargs):
# def get_command(name, **kwargs):
#     def __init__(self, **kwargs):
#     def __setitem__(self, key, item):
#     def __getitem__(self, key):
#     def cmd(self):
#     def get(self):
#     def get_context(self):
#     def get_interface(self):
#     def execute(self):
# class Executable(object):
# 
# Path: shapy/framework/utils.py
# def validate_ip(addr):
# def validate_full_ip(ip):
# def align(l, alignto=4):
# def convert_handle(handle):
# def get_if_index(if_name):
# def nl_us2ticks(delay):
# def nl_ticks2us(ticks):
# def convert_to_bytes(rate):
#     def register(cls, interpreter, content_types):
#     def select(cls, selector):
# class InterpreterMixin(object):


# Path: shapy/framework/interface.py
import logging
from shapy.framework import executor, utils

    
    def __del__(self):
        del Interface.interfaces[self.name]
    
    def __init__(self, name):
        self.name = name
        self.if_index = utils.get_if_index(self.name)
    
    def __str__(self):
        return self.name
    
    def add(self, root_qdisc):
        self.root = root_qdisc
        self.root.interface = self
        return self.root
        
    def add_ingress(self, ingress_qdisc):
        self.ingress = ingress_qdisc
        self.ingress.interface = self
        return self.ingress
        
    def set_shaping(self):
        #assert self.root, "Interface must contain at least a root qdisc."
        if hasattr(self, 'ingress'):
            self.ingress.execute()
            for ch in self.ingress.children:
                ch.execute()
        if hasattr(self, 'root'):
            self.__traverse_tree(self.root)
    

    def teardown(self):