コード例 #1
0
ファイル: Control.py プロジェクト: Musinux/LinCloud
class Control:
    def __init__(self):
        print "Control __init__"
        self.Access = Access()
        self.Graph = Graph()
        self.Player = Player()
        #self.Xml = Xml()
        self.Access.classAddresses(self.Graph,self.Player,self)
        self.Graph.classAddresses(self.Access,self.Player,self)
        self.Player.classAddresses(self.Graph,self.Access,self)
        #self.Xml.classAddresses(self.Graph,self.Access,self.Player,self)
        self.Access.start()
        self.Graph.getCode()
コード例 #2
0
    def _constructors(self):
        # If no copy constructor defined, the class is not copyable,
        # which is ensured by Clang's semantic checking
        # TODO: public copy assignment operator
        copy_ctor_args_sig = "(const %s &)" % self.full_name
        copy_ctor_args_sig_no_const = "(%s &)" % self.full_name
        has_public_copy_ctor = False

        for ctor in self.root.findall("Constructor[@context='%s']" %
                                      self.node.attrib["id"]):
            access = Access.access_type(ctor)

            if (ctor.attrib["demangled"].endswith(copy_ctor_args_sig)
                    or ctor.attrib["demangled"].endswith(
                        copy_ctor_args_sig_no_const)):
                # It is meaningless to copy an object whose class defines a proctected
                # copy constructor in the API code we are dealing with
                if access == Access.PUBLIC:
                    has_public_copy_ctor = True

            if access != Access.PRIVATE:
                if not self.blacklist.method(ctor.attrib["demangled"]):
                    self._constructor(ctor)

                    if access == Access.PROTECTED:
                        self.has_protected_ctor = True
                else:
                    Session.ignored_methods.add(ctor.attrib["demangled"])

        if len(self.ctors) == 0:
            self.no_accessible_canonical_ctors = True

        self.has_public_copy_ctor = has_public_copy_ctor
コード例 #3
0
    def _fields(self):
        for fnode in self.root.findall("Field[@context='%s']" %
                                       self.node.attrib["id"]):
            access_type = Access.access_type(fnode)

            if access_type == Access.PRIVATE:
                continue

            if access_type == Access.PROTECTED and not self.allows_subclassing(
            ):
                continue

            name = fnode.attrib["name"]

            # union
            if not name:
                continue

            if self.blacklist.field(self.full_name, name):
                full_name = self.full_name + "::" + name
                Session.ignored_fields.add(full_name)
                continue

            t = Types.get_type_by_id(fnode.attrib["type"], self.root)
            f = Argument.Argument(t, name)
            self.fields.append(f)

            if access_type == Access.PROTECTED:
                self.protected_nonvirtual_members.add(
                    "using %s::%s;" % (self.full_name, f.raw_name))
コード例 #4
0
ファイル: Class.py プロジェクト: vanxining/pbpp
    def _constructors(self):
        # If no copy constructor defined, the class is not copyable,
        # which is ensured by Clang's semantic checking
        # TODO: public copy assignment operator
        copy_ctor_args_sig = "(const %s &)" % self.full_name
        copy_ctor_args_sig_no_const = "(%s &)" % self.full_name
        has_public_copy_ctor = False

        for ctor in self.root.findall("Constructor[@context='%s']" % self.node.attrib["id"]):
            access = Access.access_type(ctor)

            if (ctor.attrib["demangled"].endswith(copy_ctor_args_sig) or
                ctor.attrib["demangled"].endswith(copy_ctor_args_sig_no_const)):
                # It is meaningless to copy an object whose class defines a proctected
                # copy constructor in the API code we are dealing with
                if access == Access.PUBLIC:
                    has_public_copy_ctor = True

            if access != Access.PRIVATE:
                if not self.blacklist.method(ctor.attrib["demangled"]):
                    self._constructor(ctor)

                    if access == Access.PROTECTED:
                        self.has_protected_ctor = True
                else:
                    Session.ignored_methods.add(ctor.attrib["demangled"])

        if len(self.ctors) == 0:
            self.no_accessible_canonical_ctors = True

        self.has_public_copy_ctor = has_public_copy_ctor
コード例 #5
0
ファイル: Enum.py プロジェクト: vanxining/pbpp
    def process(self, root, file_id, context, allows_protected, namer):
        count0 = len(self.values)
        se_count0 = len(self.scoped_enums)

        q = ".//Enumeration[@file='%s'][@context='%s']" % (file_id, context)

        for enum in root.findall(q):
            access = Access.access_type(enum)
            if access == Access.PRIVATE:
                continue

            if access == Access.PROTECTED and not allows_protected:
                continue

            ns_prefix = Util.context_of(enum, root)
            if ns_prefix:
                ns_prefix += "::"

            if enum.attrib.get("scoped") == "1":
                se = ScopedEnum(enum.attrib["name"], ns_prefix + enum.attrib["name"])

                for v in enum.findall("EnumValue"):
                    name = v.attrib["name"]
                    cppv = "%s::%s" % (se.full_name, name)
                    se.values[namer.to_python(name)] = cppv

                self.scoped_enums[se.name] = se
            else:
                for v in enum.findall("EnumValue"):
                    name = v.attrib["name"]
                    self.values[namer.to_python(name)] = ns_prefix + name

        return len(self.values) > count0 or len(self.scoped_enums) > se_count0
コード例 #6
0
ファイル: Class.py プロジェクト: vanxining/pbpp
    def _fields(self):
        for fnode in self.root.findall("Field[@context='%s']" % self.node.attrib["id"]):
            access_type = Access.access_type(fnode)

            if access_type == Access.PRIVATE:
                continue

            if access_type == Access.PROTECTED and not self.allows_subclassing():
                continue

            name = fnode.attrib["name"]

            # union
            if not name:
                continue

            if self.blacklist.field(self.full_name, name):
                full_name = self.full_name + "::" + name
                Session.ignored_fields.add(full_name)
                continue

            t = Types.get_type_by_id(fnode.attrib["type"], self.root)
            f = Argument.Argument(t, name)
            self.fields.append(f)

            if access_type == Access.PROTECTED:
                self.protected_nonvirtual_members.add("using %s::%s;" % (
                    self.full_name, f.raw_name
                ))
コード例 #7
0
ファイル: Enum.py プロジェクト: vanxining/pbpp
    def process(self, root, file_id, context, allows_protected, namer):
        count0 = len(self.values)
        se_count0 = len(self.scoped_enums)

        q = ".//Enumeration[@file='%s'][@context='%s']" % (file_id, context)

        for enum in root.findall(q):
            access = Access.access_type(enum)
            if access == Access.PRIVATE:
                continue

            if access == Access.PROTECTED and not allows_protected:
                continue

            ns_prefix = Util.context_of(enum, root)
            if ns_prefix:
                ns_prefix += "::"

            if enum.attrib.get("scoped") == "1":
                se = ScopedEnum(enum.attrib["name"],
                                ns_prefix + enum.attrib["name"])

                for v in enum.findall("EnumValue"):
                    name = v.attrib["name"]
                    cppv = "%s::%s" % (se.full_name, name)
                    se.values[namer.to_python(name)] = cppv

                self.scoped_enums[se.name] = se
            else:
                for v in enum.findall("EnumValue"):
                    name = v.attrib["name"]
                    self.values[namer.to_python(name)] = ns_prefix + name

        return len(self.values) > count0 or len(self.scoped_enums) > se_count0
コード例 #8
0
    def __init__(self, root, node, free_function):
        self.name = node.attrib["name"]
        self.raw_sig = node.attrib["demangled"]

        self.free_function = free_function
        if not free_function:
            self.access = Access.access_type(node)
            self.virtual = node.attrib.get("virtual") == "1"
            self.final = node.attrib.get("final") == "1"
            self.pure_virtual = node.attrib.get("pure_virtual") == "1"
            self.static = node.attrib.get("static") == "1"

        self.args = TupleAndKeywords.TupleAndKeywords()
        for arg_node in node.findall("Argument"):
            self.args.add_parameter(Argument.from_xml(root, arg_node))

        self.returns = Types.get_type_by_id(node.attrib["returns"], root)
コード例 #9
0
ファイル: MethodJar.py プロジェクト: vanxining/pbpp
    def __init__(self, root, node, free_function):
        self.name = node.attrib["name"]
        self.raw_sig = node.attrib["demangled"]

        self.free_function = free_function
        if not free_function:
            self.access = Access.access_type(node)
            self.virtual = node.attrib.get("virtual") == "1"
            self.final = node.attrib.get("final") == "1"
            self.pure_virtual = node.attrib.get("pure_virtual") == "1"
            self.static = node.attrib.get("static") == "1"

        self.args = TupleAndKeywords.TupleAndKeywords()
        for arg_node in node.findall("Argument"):
            self.args.add_parameter(Argument.from_xml(root, arg_node))

        self.returns = Types.get_type_by_id(node.attrib["returns"], root)
コード例 #10
0
ファイル: MethodJar.py プロジェクト: vanxining/pbpp
    def _filter(root, mnode, allows_subclassing, blacklist):
        # always collect pure virtual functions
        if mnode.attrib.get("pure_virtual") == "1":
            return False

        if blacklist.method(mnode.attrib["demangled"]):
            Session.ignored_methods.add(mnode.attrib["demangled"])
            return True

        if MethodJar._filter_by_return_type(mnode, blacklist, root, Session.ignored_methods):
            return True

        maccess = Access.access_type(mnode)
        if not allows_subclassing and maccess != Access.PUBLIC:
            return True

        # private non-pure-virtuals will be handled later
        if maccess != Access.PRIVATE or mnode.attrib.get("virtual", None) == "1":
            return False

        # filter all the other
        return True
コード例 #11
0
    def _do_process_classes(self, context_id):
        for decl_type in ("Class", "Struct"):
            xpath = ".//%s[@file='%s'][@context='%s']" % (
                decl_type, self.current_file_id(), context_id
            )

            for cls_node in self.root.findall(xpath):
                full_name = cls_node.attrib["demangled"]

                if self.blacklist.klass(full_name):
                    Session.ignored_classes.add(full_name)
                    continue

                if full_name in self.blacklist.dummy_classes:
                    Session.dummy_classes.add(full_name)
                    continue

                if Access.access_type(cls_node) == Access.PRIVATE:
                    continue

                if cls_node.attrib.get("incomplete", None) == "1":
                    continue

                # TODO: anonymous class
                # typedef struct { int a; } A;
                if cls_node.attrib.get("name", "") == "":
                    continue

                logging.info("---------------------------------------------")
                logging.info(">>> %s <<<" % full_name)
                logging.info("---------------------------------------------")

                cls = Class.Class(self.root, cls_node, self)
                self.register_class(cls)

                # Inner (nested) classes
                self._do_process_classes(cls_node.attrib["id"])

                self.modified = True
コード例 #12
0
    def _do_process_classes(self, context_id):
        for decl_type in ("Class", "Struct"):
            xpath = ".//%s[@file='%s'][@context='%s']" % (
                decl_type, self.current_file_id(), context_id
            )

            for cls_node in self.root.findall(xpath):
                full_name = cls_node.attrib["demangled"]

                if self.blacklist.klass(full_name):
                    Session.ignored_classes.add(full_name)
                    continue

                if full_name in self.blacklist.dummy_classes:
                    Session.dummy_classes.add(full_name)
                    continue

                if Access.access_type(cls_node) == Access.PRIVATE:
                    continue

                if cls_node.attrib.get("incomplete", None) == "1":
                    continue

                # TODO: anonymous class
                # typedef struct { int a; } A;
                if cls_node.attrib.get("name", "") == "":
                    continue

                logging.info("---------------------------------------------")
                logging.info(">>> %s <<<" % full_name)
                logging.info("---------------------------------------------")

                cls = Class.Class(self.root, cls_node, self)
                self.register_class(cls)

                # Inner (nested) classes
                self._do_process_classes(cls_node.attrib["id"])

                self.modified = True
コード例 #13
0
    def _filter(root, mnode, allows_subclassing, blacklist):
        # always collect pure virtual functions
        if mnode.attrib.get("pure_virtual") == "1":
            return False

        if blacklist.method(mnode.attrib["demangled"]):
            Session.ignored_methods.add(mnode.attrib["demangled"])
            return True

        if MethodJar._filter_by_return_type(mnode, blacklist, root,
                                            Session.ignored_methods):
            return True

        maccess = Access.access_type(mnode)
        if not allows_subclassing and maccess != Access.PUBLIC:
            return True

        # private non-pure-virtuals will be handled later
        if maccess != Access.PRIVATE or mnode.attrib.get("virtual",
                                                         None) == "1":
            return False

        # filter all the other
        return True
コード例 #14
0
ファイル: Server.py プロジェクト: carlotte/AppleCore
}

class TokenManager(object):
    def GET(self):
        hostname = socket.getfqdn(socket.gethostname())
        hostaddress = socket.gethostbyname(myname)
        if web.ctx.ip == hostaddress:
            return token_access.get_access_token()
        else:
            Msg = ("TokenAccess from Outside[GET/%s]" % web.ctx.ip)
            Recorder.Warning.Record(Msg, 1)
            return "Apple: Token manager on working, access from inside."
    def POST(self):
        Msg = ("TokenAccess with Post[POST/%s]" % web.ctx.ip)
        Recorder.Warning.Record(Msg, 1)

class OtherAccessManager(object):
    def GET(self):
        Msg = ("Unknown Access[GET/%s]" % web.ctx.ip)
        Recorder.Warning.Record(Msg, 3)
    def POST(self):
        Msg = ("Unknown Access[POST/%s]" % web.ctx.ip)
        Recorder.Warning.Record(Msg, 3)
        
token_access = Access.Access();

if __name__ == '__main__':
    token_access.get_access_token();
    app = web.application(urls, globals(), True)
    app.run()
コード例 #15
0
 def _destructor(self):
     dtor = self.root.find("Destructor[@context='%s']" %
                           self.node.attrib["id"])
     if dtor is not None:
         self.dtor_access_type = Access.access_type(dtor)
コード例 #16
0
    def __init__(self, app):
        super(Window, self).__init__(
            title="Trails",
            default_width=450,
            default_height=300,
            application=app,
        )

        menubar = Gtk.MenuBar()
        menubar.props.hexpand = True

        fmi = Gtk.MenuItem.new_with_label("File")

        menu = Gtk.Menu()
        emi = Gtk.MenuItem.new_with_label("Exit")
        emi.connect("activate", self.quit_app)
        ami = Gtk.MenuItem.new_with_label("About")
        ami.connect("activate", self.about)
        menu.append(emi)

        fmi.set_submenu(menu)

        menubar.add(fmi)
        menubar.add(ami)

        self.user_entry = Gtk.Entry(margin_right=64,
                                    halign=1,
                                    max_length=18,
                                    width_chars=17)

        self.pass_entry = Gtk.Entry(
            margin_right=64,
            halign=1,
            max_length=18,
            width_chars=17,
            visibility=False,
        )

        user_label = Gtk.Label(
            label="Username:"******"Password:"******"Login",
                                  hexpand=True,
                                  halign=3,
                                  margin_bottom=64)
        self.login_b.connect("clicked", self.login)

        self.create_acc_b = Gtk.Button(label="Create Account",
                                       hexpand=True,
                                       halign=3,
                                       margin_bottom=64)
        self.create_acc_b.connect("clicked", self.create_acc)

        self.login_grid = Gtk.Grid(
            halign=3,
            column_spacing=16,
        )

        self.login_grid.attach(self.login_b, 0, 0, 1, 1)
        self.login_grid.attach(self.create_acc_b, 1, 0, 1, 1)

        self.grid2.attach(user_label, 0, 0, 1, 1)
        self.grid2.attach(pass_label, 0, 1, 1, 1)
        self.grid2.attach(self.user_entry, 1, 0, 1, 1)
        self.grid2.attach(self.pass_entry, 1, 1, 1, 1)

        self.grid = Gtk.Grid(row_spacing=64, column_homogeneous=True)
        self.grid.attach(menubar, 0, 0, 1, 1)
        self.grid.attach(self.grid2, 0, 1, 1, 1)
        self.grid.attach(self.login_grid, 0, 2, 1, 1)

        self.add(self.grid)
コード例 #17
0
sys.path.append("./sched/")
import AuthSys
import KeepAlive
import MobsUpdate
import Regen
import MissionClock
import Security
sys.path.append("./mods/")
import SpamFilter
import Basic
import Mobster
import Missions
import LegalAffairs

logger = Logger.Logger()
access = Access.Access(logger)
event = Event.Event(access)
scheduler = Scheduler.Scheduler()

# bot network info
#		Title	Network			Port	NICK	USER		NICKSERV		[AJOIN]
rizon = Utility.Network("rizon", "irc.rizon.net", 6697)
ajoin = [
    "#mobsters", "#nova"
]  #First channel in Array will be the active game channel, 2nd channel is the OPs channel

#Two bots are required. First bot will be the main game bot, while the second one is the missions bot
bots = [[rizon, Utility.Identity("mobsters", "mobster", None, ajoin)],
        [rizon, Utility.Identity("DonVito", "dv", None, ajoin)]]

eng = Engine.Engine(event, bots, scheduler,
コード例 #18
0
ファイル: main.py プロジェクト: loadingpt/pyGtk_app_trails
    def __init__(self, app):
        super(Window, self).__init__(title="Trails",
                                    default_width=450,
                                    default_height=300,
                                    application=app,
                                    )

        menubar = Gtk.MenuBar()
        menubar.props.hexpand = True

        fmi = Gtk.MenuItem.new_with_label("File")

        menu = Gtk.Menu()
        emi = Gtk.MenuItem.new_with_label("Exit")
        emi.connect("activate", self.quit_app)
        ami = Gtk.MenuItem.new_with_label("About")
        ami.connect("activate", self.about)
        menu.append(emi)

        fmi.set_submenu(menu)

        menubar.add(fmi)
        menubar.add(ami)

        self.user_entry = Gtk.Entry(margin_right=64,
                            halign=1,
                            max_length=18,
                            width_chars=17
                            )

        self.pass_entry = Gtk.Entry(margin_right=64,
                            halign=1,
                            max_length=18,
                            width_chars=17,
                            visibility=False,
                            )

        user_label = Gtk.Label(label="Username:"******"Password:"******"text.txt")
        trail_rows = trail.get_trails()

        r = 0
        for i in trail_rows:
            c = 0
            for n in trail_rows[i]:
                self.trails_table.attach(Gtk.Label(label=trail_rows[i][n]), c, r, 1, 1)
                c += 1
            r += 1

        self.login_b = Gtk.Button(label="Login", hexpand=True, halign=3, margin_bottom=64)
        self.login_b.connect("clicked", self.login)

        self.create_acc_b = Gtk.Button(label="Create Account", hexpand=True, halign=3, margin_bottom=64)
        self.create_acc_b.connect("clicked", self.create_acc)

        self.login_grid = Gtk.Grid(halign=3,
                                column_spacing=16,
                                )

        self.login_grid.attach(self.login_b, 0, 0, 1, 1)
        self.login_grid.attach(self.create_acc_b, 1, 0, 1, 1)

        self.grid2.attach(user_label, 0, 0, 1, 1)
        self.grid2.attach(pass_label, 0, 1, 1, 1)
        self.grid2.attach(self.user_entry, 1, 0, 1, 1)
        self.grid2.attach(self.pass_entry, 1, 1, 1, 1)

        self.grid = Gtk.Grid(row_spacing=64, column_homogeneous=True)
        self.grid.attach(menubar, 0, 0, 1, 1)
        self.grid.attach(self.grid2, 0, 1, 1, 1)
        self.grid.attach(self.login_grid, 0, 2, 1, 1)

        self.log = Access.Access("access.txt")
        self.tid = None
        self.add(self.grid)
コード例 #19
0
ファイル: Class.py プロジェクト: vanxining/pbpp
 def _destructor(self):
     dtor = self.root.find("Destructor[@context='%s']" % self.node.attrib["id"])
     if dtor is not None:
         self.dtor_access_type = Access.access_type(dtor)