Beispiel #1
0
 def __init__(self):
     self.colors = Colors()
     self.color = colorama.Fore.GREEN
     self.interfaces = netifaces.interfaces()
     self.routers = netifaces.gateways()
     self.netmask = None
     self.network = None
     self.interface = None
     self.ip = None
     self.mac = None
     self.router = None
     self.country = None
     self.city = None
     self.lat = None
     self.lng = None
     self.region = None
     self.target = None
     self.ipTarget = None
     self.countryTarget = None
     self.cityTarget = None
     self.regionTarget = None
     self.latTarget = None
     self.lngTarget = None
     self.run = True
     self.ips = []
     self.macs = []
     self.os = []
     self.public = None
Beispiel #2
0
 def __init__(self):
     self.hostname = None
     self.ip = None
     self.country = None
     self.region = None
     self.city = None
     self.lat = None
     self.lng = None
     self.colors = Colors()    
Beispiel #3
0
    def __init__(self, *args, **kwargs):
        self.__items = object
        self.__ledStrips = []
        self.__lightSensor = LightSensor
        self.__motionSensor = MotionSensor

        self.__ledStripsSettings = []
        self.__motionSensorSettings = [MotionSensorSettings]
        self.__lightSensorSettings = [LightSensorSettings]

        self.__colors = Colors()
        self.loadSettings()
Beispiel #4
0
 def __init__(self, scr, context, manager):
     self.scr = scr
     self.manager = manager
     self.context = context
     self.logic = self.context.logic
     self.status = StatusWindow(self.manager.s_win, self.context)
     self.pause_win = PauseWin(self.manager.p_win, self.manager,
                               self.context)
     self.max_y, self.max_x = self.scr.getmaxyx()
     self.curs_y, self.curs_x = (self.max_y // 2 - 1, 2)
     self.color = Colors()
     self.x_index = self.curs_x // 2
     self.closed_field = '*'
     self.flag_field = '?'
     self.explode_field = 'x'
Beispiel #5
0
def get_colsidematrix(Data, Arguments, colors=Colors().palette_one):
    '''
    '''

    if "randomcolors" in [Option.lower() for Option in Arguments.Heatmap]:
        shuffle(colors)

    #Binary features are always black ("1") and white ("0")
    ColorDict = {0: "white", 1: "black", Arguments.NA: "white"}

    Features = list(chain(*Data.Features.values()))
    Variates = list(chain(*Data.Variates.values()))

    TransformedFeatures = list(chain(*Data.Transformed.Features.values()))
    TransformedVariates = list(chain(*Data.Transformed.Variates.values()))

    ColorFeatures, ColorVariates, Legend = [], [], []
    for DataType in set(Arguments.Data) - set(Arguments.UntransformedData):
        if DataType in Arguments.CategoricalData:
            for Feature in Data.Features[DataType]:
                ColorVariates.append(Variates[Features.index(Feature)])
                Legend.append(Variates[Features.index(Feature)])
                ColorFeatures.append(Feature)
        else:
            for Feature in Data.Transformed.Features[DataType]:
                ColorVariates.append(
                    TransformedVariates[TransformedFeatures.index(Feature)])
                ColorFeatures.append(Feature)

    #Uniquify the list of variates that get colors, zip it with some colors, and make a dictionary legend
    Legend = dict(zip(set(chain(*Legend)), colors[:len(set(chain(*Legend)))]))
    #Add the legend to the color dict so we can make the color matrix
    ColorDict = dict(ColorDict.items() + Legend.items())

    #Make the color matrix
    ColorMatrix = [[ColorDict[Variate] for Variate in ColorVariate]
                   for ColorVariate in ColorVariates]
    ColorFeatures = [Feature[:Feature.index(":")] for Feature in ColorFeatures]

    return ColorFeatures, ColorMatrix, Legend
Beispiel #6
0
    def __init__(self, _stdscr: curses.window) -> None:  # type: ignore
        """
        We have to do a weird thing here cuz colors can't be initialized
        without curses.initscr() being called first.
        """

        Colors()

        self.stdscr = _stdscr
        self.stdscr.keypad(True)
        self.stdscr.nodelay(True)

        curses.start_color()
        curses.use_default_colors()
        curses.noecho()
        curses.cbreak()
        curses.curs_set(False)

        self.inputManager = InputManager(self.stdscr)

        self.ensureScreenLargeEnough()
        self.initializeEntities()

        self.board = Board(self.player, self.enemies, Config.ENEMY_COUNT, self)
Beispiel #7
0
        if "x10server.HouseModule." + str(i) + ".name" in props:
            if props["x10server.HouseModule." + str(i) + ".type"] == "Lamp":
                Modules.append(
                    Mod(props["x10server.HouseModule." + str(i) + ".name"],
                        props["x10server.HouseCode"] + str(i),
                        props["x10server.HouseModule." + str(i) + ".type"]))
            else:
                Modules.append(
                    Mod(props["x10server.HouseModule." + str(i) + ".name"],
                        props["x10server.HouseCode"] + str(i),
                        props["x10server.HouseModule." + str(i) + ".type"],
                        False))
    print txt.bold(txt.green("Done"))


txt = Colors()
status = -1
ic = None

## Initialize HEYU system
sys.stdout.write(txt.warning("Initializing x10 system...\t"))
sys.stdout.flush()
proc = subprocess.Popen("sudo heyu start",
                        stdout=subprocess.PIPE,
                        stderr=subprocess.PIPE,
                        shell=True)
(out, err) = proc.communicate()

try:
    ic = Ice.initialize(sys.argv)
    adapter = ic.createObjectAdapterWithEndpoints(
                percent += 1
                #Increment out percent value.
                print("Decode progress: " + str(percent) + " of 100")
                #Print what percent we have gone through in our image.

    msg = ""
    #Make an empty string to store our decoded message.
    for value in ints:  #Iterate across my list of ints. (For each int in my list...)
        msg += chr(value)
        #Convert my int to it's character value and add it back to my message.
    return msg
    #Return my message string.


#Start the main CODE!
Colors = Colors()
#Initialize all of our colors.

userInput = input("Would you like to encode(e) or decode(d) a message?")
if (userInput == "e"):
    e_mode = input("Would you like to open(o) or create(c) a new image?")
    if (e_mode == "c"):
        image_name = input(
            "Please enter the name of the image you wish to create. Example) my_image.png"
        )
        img = ImageUtilities.createPNGImage("RGBA", 60, 30, Colors.white)
        #Make a white image

        #Encode the image alpha values.
        img = encode(img)