コード例 #1
0
ファイル: ctcp.py プロジェクト: networld-to/ircbot
def checkCTCP(soc, user, command):
    if ( command == ':\x01VERSION\x01' ):
        sendCommandPRIVMSG(soc, user, 'VERSION :ircbot:v0.1.0:linux')
    elif ( command == ':\x01USERINFO\x01' ):
        sendCommandPRIVMSG(soc, user, 'USERINFO :I\'m a python bot written from scratch.')
    elif ( command == ':\x01TIME\x01' ):
        sendCommandPRIVMSG(soc, user, 'TIME :' + helper.getTime() )
コード例 #2
0
ファイル: ctcp.py プロジェクト: dcavalcante/ircbot
def checkCTCP(soc, user, command):
    if (command == ':\x01VERSION\x01'):
        sendCommandPRIVMSG(soc, user, 'VERSION :ircbot:v0.1.0:linux')
    elif (command == ':\x01USERINFO\x01'):
        sendCommandPRIVMSG(
            soc, user, 'USERINFO :I\'m a python bot written from scratch.')
    elif (command == ':\x01TIME\x01'):
        sendCommandPRIVMSG(soc, user, 'TIME :' + helper.getTime())
コード例 #3
0
def cli(ctx, arrivals, departures, date, delta, airline):
    """
        Retrieve flights for a certain airport or between two airports which arrived/departed on the mentioned date
        within a given time interval.
    """
    if ctx.invoked_subcommand is None:
        date_from, date_to = getTime(date, delta)
        src = get_airport(departures) if departures != None else None
        dest = get_airport(arrivals) if arrivals != None else None
        header3 = ["From Time", "To Time"]
        print_table([[date_from, date_to]], header3)
        header2 = [
            "ICAO", "IATA", "Name of Airport", "City", "State", "Country"
        ]
        if src != None and dest == None:
            flights = get_flights(False, src[0][0], date_from, date_to)
            print_table(src, header2)
            click.echo(
                f"\nListing all departure flights from airport {src[0][2]}")
        elif src == None and dest != None:
            flights = get_flights(True, dest[0][0], date_from, date_to)
            print_table(dest, header2)
            click.echo(
                f"\nListing all arrival flights to airport {dest[0][2]}")
        elif src != None and dest != None:
            flights = get_flights(False, src[0][0], date_from, date_to)
            flights = get_filter(flights, dest[0][0], dest[0][1])
            print_table(src, header2)
            print_table(dest, header2)
            click.echo(
                f"\nListing all flights from airport {src[0][2]} to airport {dest[0][2]}"
            )
        else:
            click.echo("At least one arrival or departure airport required")
            sys.exit("Aborting!!!")
        if airline:
            flights = get_airlines(flights, airline)
            click.echo(f"via airline {airline}")

        header = [
            "Flight Number", "Airline", "Status", "Scheduled Time(UTC)",
            "Scheduled Time(Local)", "Terminal", "Airport", "ICAO", "IATA"
        ]
        print_table(flights, header)
コード例 #4
0
def init():
    if not os.path.exists('pic'):
        os.makedirs('pic')


if __name__ == '__main__':
    init()

    # Generate a cert-cert graph
    df = pd.read_csv('accusation.txt', delimiter=' ', header=None)
    df.columns = ['u', 'v', 'type', 'time']

    # G = nx.DiGraph()
    begin = (int)(min(df.time))
    finish = (int)(max(df.time))

    for i in xrange(begin, finish + 1, capture_time):
        H = nx.DiGraph()

        # Retrieve graph per minute
        data = df[np.logical_and(df['time'] > i, df['time'] < (i + capture_time))]

        if data.empty is not True:
            for _, row in data.iterrows():
                H.add_edge(row['u'], row['v'])

            day1, time1 = helper.getTime(i)
            day2, time2 = helper.getTime(i + capture_time)
            filename = '{}_{}_{}'.format(day1, time1, time2)
            saveGraph(H, filename)
コード例 #5
0
import time
from datetime import datetime

from helper import getTime, inputDetails
from tracker import checkPrice, sendEmail

print("~ Amazon UK Price Tracker ~")
data_dict = inputDetails()
iters = 0  # counts the number of price checks done
while True:
    iters += 1
    print("\nCheck #", iters, "on:", datetime.today())
    # check if the price has dropped
    try:
        checkPrice(data_dict)
    except Exception as e:
        if e != "SystemExit":
            print("\nSorry! Price tracking attempt failed.")
            exit()

    # print the frequency of price checks
    print("Price will be checked every " + getTime(data_dict["often"]))
    print("Interrupt keyboard to stop. (Ctrl+Z / Ctrl+C)")
    time.sleep(data_dict["often"])