示例#1
0
    def add_bins(self, const_vars, const_values):
        """
        Create a binary constraint matrix for NOT SIMULTANEOUS constraint

        :param list const_vars: the variables to be constrained
        :param list const_values: the values to be constrained
        :param dic const_values: list of values [key: index, value: variable value]
        """
        # TODO what if two bi_const have the same constrainting variable
        # The first value in the tuple takes the rows, and the second takes the columns
        self.const_graph.add_edge(self.const_graph.get_vertex(const_vars[0]),
                                  self.const_graph.get_vertex(const_vars[1]))

        if tuple(const_vars) in self.biconst.keys():
            print("duplicate binary constraint, killed")
            system.exit()
        else:
            const_matrix = self.biconst[tuple(const_vars)] = numpy.ones(
                shape=(len(self.values), len(self.values)), dtype=int)
            for i in range(len(self.values)):  # modify the constraint matrix
                for j in range(len(self.values)):
                    if (self.values[i], self.values[j]) == (
                            const_values[0], const_values[1]
                    ):  # or (self.values[i], self.values[j]) == (const_values[1], const_values[0]):
                        const_matrix[i, j] = 0

        self.consolidate_matrix()
示例#2
0
    def add_biconst(self, const_vars, equal):  # constraint type
        """
        Create a binary constraint matrix

        :param list const_vars: the variables to be constrained
        :param int equal: constraint type: 1 = binary equals, 0 = binary not equals
        """
        # TODO what if two bi_const have the same constrainting variable
        # The first value in the tuple takes the rows, and the second takes the columns
        self.const_graph.add_edge(self.const_graph.get_vertex(const_vars[0]),
                                  self.const_graph.get_vertex(const_vars[1]))

        if tuple(const_vars) in self.biconst.keys():
            print("duplicate binary constraint, killed")
            system.exit()
        else:
            if equal:
                const_matrix = self.biconst[tuple(const_vars)] = numpy.zeros(
                    shape=(len(self.values), len(self.values)), dtype=int)
            else:
                const_matrix = self.biconst[tuple(const_vars)] = numpy.ones(
                    shape=(len(self.values), len(self.values)), dtype=int)

            for i in range(len(self.values)):  # modify the constraint matrix
                for j in range(len(self.values)):

                    if self.values[i] == self.values[
                            j]:  # if the values are the same value, they should be constrained
                        const_matrix[i,
                                     j] = equal  # 0 for not equal, 1 for equal

        self.consolidate_matrix()
示例#3
0
    def set_rtcost_for_value(self, value, cost):
        """
        The function also checks if the value is in the value list of this csp. If not, it will terminate the run
        Note that this function does not validate if all value has been assigned a value, to do so, call validate_rtcost
        :param value:
        :param cost:
        """
        if value not in self.values:
            print("Invalid value in value cost: " + value + "; Killed")
            system.exit()

        self.rtcost[value] = cost
示例#4
0
def ORFfinder(location, GFFindex):
    exists_in_orf = []
    for index, orf in GFFindex.iterrows():
        in_orf = location in range(orf.start, orf.end)
        exists_in_orf.append(in_orf)

    if any(exists_in_orf) == True:
        in_orf = True
    elif any(exists_in_orf) == False:
        in_orf = False
    else:
        in_orf = False
        system.exit("""
                    Something went wrong during the processing of this GFF.
                    Please check or re-generate the GFF file and try again.
                    """)

    return in_orf
示例#5
0
def triggCameraUSB(webcam, ang):

    check, frame = webcam.read()
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    img = []
    p0 = 200
    roi = [0,720,p0,p0+720]
    img = frame[roi[0]:roi[1], roi[2]:roi[3], :]

    h, w = img.shape[:2]
    cnt = (h/2,w/2)
    img = rotateImage(img, ang, cnt)

    if img is None:
        print('Error opening image!')
        exit = True
        system.exit()

    return check, img
示例#6
0
def data_retrieval(table='saude', term='dengue', limit=10):
    basicConfig(format='%(levelname)s %(message)s', level=INFO)
    sql_opt = serialize_sql_opt(table, term, limit)
    USER = environ.get('DB_USER', 'YOUR_USER_NAME')
    PASSWORD = environ.get('DB_PASSWORD', 'YOUR_PASSWORD')
    if not USER or not PASSWORD:
        error('no USER or PASSWORD for connection found')
        sys.exit(1)

    HOST = environ.get('DB_HOST', 'HOST_NAME')
    DATABASE = environ.get('DB_NAME', 'DATABASE_NAME')
    if not HOST or not DATABASE:
        error('no HOST or DATABASE for connection found')
        sys.exit(1)

    info('Connecting to database...')
    conn = psycopg2.connect(database=DATABASE, user=USER, password=PASSWORD,
                            host=HOST)
    cur = conn.cursor()

    sql = ("SELECT json "             # complete json
           "FROM {table} "            # view or table
           "WHERE lower(text) "       # tweet text
           "like '%{term}%' "         # term in the tweet like dengue
           "limit {limit};")          # limit number of tweets
    sql = sql.format(table=sql_opt['table'],
                     term=sql_opt['term'],
                     limit=sql_opt['limit']
                     )
    info('Executing SQL command...')
    cur.execute(sql)
    info('Fetching and writing data...')
    file_opt = {
                    'filename': sql_opt['term'] + '_tweets_json',
               }
    fetch_and_save_data_to_file(cur, file_opt, sql_opt)
    cur.close()
    conn.close()
示例#7
0
def ulang():
    print(
        ">=====================================================================<"
    )
    print(
        ">                            PROGRAM ADMIN                            <"
    )
    print(
        ">                             HAPPY FRESH                             <"
    )
    print(
        ">                   🚩Pucang Sawit, Surakarta, Jawa Tengah🚩         <"
    )
    print(
        ">                           +6281230526092                            <"
    )
    print(
        ">=====================================================================<"
    )
    print("daftar menu : ")
    print("Enter 1. Tambah Daftar Daging")
    print("Enter 2. Tambah Daftar Buah")
    print("Enter 3. Tambah Daftar Sayur")
    print("Enter 4. Daftar Daging")
    print("Enter 5. Daftar Buah")
    print("Enter 6. Daftar Sayur")
    print("Enter 7. To exit")
    x = input("Input nomer yang ingin diinginkan(dalam angka) : ")
    if x == "1":
        namafile = 'daging.csv'
        kodemenu = int(input("Masukkan Kode Menu : "))
        namamenu = input("Masukkan Nama Menu: ")
        hargamenu = int(input("Harga Menu: "))

        csvheader = ['Kode', 'Menu', 'Harga']
        with open(namafile, 'a', newline='\n') as filecsv:

            dictmenu = {'Kode': kodemenu, 'Menu': namamenu, 'Harga': hargamenu}

            writer = csv.DictWriter(filecsv, fieldnames=csvheader)

            if os.stat(namafile).st_size == 0:
                writer.writeheader()
            else:
                None

                writer.writerow(dictmenu)

    elif x == "2":
        namafile = 'buah.csv'
        kodemenu = int(input("Masukkan Kode Menu : "))
        namamenu = input("Masukkan Nama Menu: ")
        hargamenu = int(input("Harga Menu: "))

        csvheader = ['Kode', 'Menu', 'Harga']

        with open(namafile, 'a', newline='\n') as filecsv:

            dictmenu = {'Kode': kodemenu, 'Menu': namamenu, 'Harga': hargamenu}

            writer = csv.DictWriter(filecsv, fieldnames=csvheader)

            if os.stat(namafile).st_size == 0:
                writer.writeheader()
            else:
                None

                writer.writerow(dictmenu)

    elif x == "3":
        namafile = 'sayur.csv'
        kodemenu = int(input("Masukkan Kode Menu : "))
        namamenu = input("Masukkan Nama Menu: ")
        hargamenu = int(input("Harga Menu: "))

        csvheader = ['Kode', 'Menu', 'Harga']

        with open(namafile, 'a', newline='\n') as filecsv:

            dictmenu = {'Kode': kodemenu, 'Menu': namamenu, 'Harga': hargamenu}

            writer = csv.DictWriter(filecsv, fieldnames=csvheader)

            if os.stat(namafile).st_size == 0:
                writer.writeheader()
            else:
                None

                writer.writerow(dictmenu)

    elif x == "4":
        namafile = 'daging.csv'
        with open(namafile) as filecsv:
            readCSV = csv.reader(filecsv, delimiter=',')
            line_count = 0

            for row in readCSV:
                if line_count == 0:
                    print(f"Nama Kolom: \n{row}")
                    line_count += 1

                else:
                    line_count += 1
                    print(row)
                    jmldata = int(line_count - 1)
            print("Jumlah Produk: ", jmldata)

    elif x == "5":
        namafile = 'buah.csv'
        with open(namafile) as filecsv:
            readCSV = csv.reader(filecsv, delimiter=',')
            line_count = 0

            for row in readCSV:
                if line_count == 0:
                    print(f"Nama Kolom: \n{row}")
                    line_count += 1

                else:
                    line_count += 1
                    print(row)
                    jmldata = int(line_count - 1)
            print("Jumlah Produk: ", jmldata)

    elif x == "6":
        namafile = 'sayur.csv'
        with open(namafile) as filecsv:
            readCSV = csv.reader(filecsv, delimiter=',')
            line_count = 0

            for row in readCSV:
                if line_count == 0:
                    print(f"Nama Kolom: \n{row}")
                    line_count += 1

                else:
                    line_count += 1
                    print(row)
                    jmldata = int(line_count - 1)
            print("Jumlah Produk: ", jmldata)

    elif x == "7":
        print("Terima kasih, Semangat!")

    else:
        print("Please enter a valid choice from 1-7")

    loop = input(
        "Apakah Anda ingin memakai lagi Program Happy Fresh? (pilih y/t): ")

    if loop == "y":
        ulang()  #gen isoh neng menu awal/menu admin
    elif loop == "t":
        print("------Terima kasih atas kunjungannya------")
        system.exit()
示例#8
0
                timeout = args.timeout

            seed = 0
            if (type(args.seed) == int) and args.seed > -1: seed = args.seed

            num = 1
            if (type(args.num) == int) and (num > 0): num = args.num

            properlyFormatted = True
            for char in args.chars:
                if char != '0':
                    test = CHARS.find(char)
                    if (test == -1):
                        properlyFormatted = False
            if properlyFormatted:
                if (len(args.chars) == 16):
                    template = setupAddress(args.chars)
                    if seed > 32**len(template[0]): print CHARS_FLAG_ERROR_MSG
                    else:
                        scan(seed, num, timeout, template)
                else:
                    print '[0] ' + CHARS_FLAG_ERROR_MSG
            else:
                print '[1] ' + CHARS_FLAG_ERROR_MSG
        else:
            print '[2] ' + CHARS_FLAG_ERROR_MSG

    except KeyboardInterrupt:
        print 'Interrupted by user'
        system.exit(0)
示例#9
0
def customer():
    while True:

        ulang = "y"

        totalharga = 0
        listnamabelanjaan = []
        listhargabelanjaan = []
        print(">===========================================<")
        print(">                                           <")
        print(">    SELAMAT DATANG DI TOKO HAPPY FRESH!    <")
        print("> 🚩Pucang Sawit, Surakarta, Jawa Tengah🚩 <")
        print(">              +6281230526092               <")
        print(">                                           <")
        print(">       Dapatkan kemudahan berbelanja       <")
        print(">         hanya di TOKO HAPPY FRESH         <")
        print(">               • 100% FRESH •              <")
        print(">             • 100% HIGIENIS •             <")
        print(">            • 100% TERJANGKAU •            <")
        print(">                                           <")
        print(">      ❗Pengirimiman Khusus Area Solo❗      <")
        print(">          MENERIMA COD DAN TRANSFER        <")
        print(">                                           <")
        print(">          ❗❗❗ HAPPY SHOPPING ❗❗❗          <")
        print(">              GRAB YOURS FAST              <")
        print(">                                           <")
        print("> ========================================= <")
        print()

        while ulang == 'y':
            print("Produk-produk yang kami tawarkan : ")
            print("1.Daging Sapi\n2.Buah\n3.Sayur ")
            jp = input("Input nomer jenis belanjaan Anda(dalam angka) : ")
            if jp == "1":
                listDaging = []

                listDaging.append("1. Tenderloin (1 kg) \t= 170000")
                listDaging.append("2. Sirloin (1 kg) \t= 150000")
                listDaging.append("3. Rib eye (1 kg) \t= 140000")
                listDaging.append("4. Brisket (1 kg) \t= 120000")
                listDaging.extend([
                    "5. Oxtail (1 kg) \t= 130000"
                ])  # Menambahkan beberapa data ke bagian akhir
                for isi in listDaging:
                    print(isi)
                option = int(input("Jenis daging apa yang ingin Anda beli?: "))
                if option == 1:
                    qnty = float(input("Masukkan jumlah daging (per kg): "))
                    total = qnty * 170000
                    listnamabelanjaan.append("Tenderloin")
                    listhargabelanjaan.append(qnty)
                elif option == 2:
                    qnty = float(input("Masukkan jumlah daging (per kg): "))
                    total = qnty * 150000
                    listnamabelanjaan.append("Sirloin")
                    listhargabelanjaan.append(qnty)
                elif option == 3:
                    qnty = float(input("Masukkan jumlah daging (per kg): "))
                    total = qnty * 140000
                    listnamabelanjaan.append("Rib eye")
                    listhargabelanjaan.append(qnty)
                elif option == 4:
                    qnty = float(input("Masukkan jumlah daging (per kg): "))
                    total = qnty * 120000
                    listnamabelanjaan.append("Brisket")
                    listhargabelanjaan.append(qnty)
                elif option == 5:
                    qnty = float(input("Masukkan jumlah daging (per kg): "))
                    total = qnty * 130000
                    listnamabelanjaan.append("Oxtail")
                    listhargabelanjaan.append(qnty)
                else:
                    print("Opsi tidak ditemukan")
                    break
            elif jp == "2":
                listBuah = []

                listBuah.append("1. Mangga (1kg) \t = 30000")
                listBuah.append("2. Jeruk (1kg) \t\t = 20000")
                listBuah.append("3. Apel (1kg) \t\t = 50000")
                listBuah.append("4. Pir (1kg) \t\t = 25000")
                listBuah.extend([
                    "5. Buah naga (1kg) \t = 30000"
                ])  # Menambahkan beberapa data ke bagian akhir
                for isi in listBuah:
                    print(isi)
                option = int(input("Jenis buah apa yang ingin Anda beli?: "))

                if option == 1:
                    qnty = float(input("Masukkan jumlah buah (dalam kg): "))
                    total = qnty * 30000
                    listnamabelanjaan.append("Mangga")
                    listhargabelanjaan.append(qnty)
                elif option == 2:
                    qnty = float(input("Masukkan jumlah buah (dalam kg): "))
                    total = qnty * 20000
                    listnamabelanjaan.append("Jeruk")
                    listhargabelanjaan.append(qnty)
                elif option == 3:
                    qnty = float(input("Masukkan jumlah buah (dalam kg): "))
                    total = qnty * 50000
                    listnamabelanjaan.append("Apel")
                    listhargabelanjaan.append(qnty)
                elif option == 4:
                    qnty = float(input("Masukkan jumlah buah (dalam kg): "))
                    total = qnty * 25000
                    listnamabelanjaan.append("Pir")
                    listhargabelanjaan.append(qnty)
                elif option == 5:
                    qnty = float(input("Masukkan jumlah buah (dalam kg): "))
                    total = qnty * 30000
                    listnamabelanjaan.append("Buah naga")
                    listhargabelanjaan.append(qnty)
                else:
                    print("Opsi tidak ditemukan")

            elif jp == "3":
                listSayur = []

                listSayur.append("1. Brokoli (1kg) \t\t = 40000")
                listSayur.append("2. Wortel (1kg) \t\t = 20000")
                listSayur.append("3. Kentang (1kg) \t\t = 25000")
                listSayur.append("4. Cabai (1kg) \t\t\t = 25000")
                listSayur.extend([
                    "5. Kembang kol \t\t\t = 35000"
                ])  # Menambahkan beberapa data ke bagian akhir
                for isi in listSayur:
                    print(isi)

                option = int(input("Jenis sayur apa yang ingin Anda beli?: "))

                if option == 1:
                    qnty = float(input("Masukkan jumlah sayur (dalam kg)\t: "))
                    total = qnty * 40000
                    listnamabelanjaan.append("Brokoli")
                    listhargabelanjaan.append(qnty)
                elif option == 2:
                    qnty = float(input("Masukkan jumlah sayur (dalam kg)\t: "))
                    total = qnty * 20000
                    listnamabelanjaan.append("Wortel")
                    listhargabelanjaan.append(qnty)
                elif option == 3:
                    qnty = float(input("Masukkan jumlah sayur (dalam kg)\t: "))
                    total = qnty * 25000
                    listnamabelanjaan.append("Kentang")
                    listhargabelanjaan.append(qnty)
                elif option == 4:
                    qnty = float(input("Masukkan jumlah sayur (dalam kg)\t: "))
                    total = qnty * 25000
                    listnamabelanjaan.append("Cabai")
                    listhargabelanjaan.append(qnty)
                elif option == 5:
                    qnty = float(input("Masukkan jumlah sayur (dalam kg)\t: "))
                    total = qnty * 35000
                    listnamabelanjaan.append("Kembang kol")
                    listhargabelanjaan.append(qnty)
                else:
                    print("Opsi tidak ditemukan")
                    break
            else:
                system('cls')
                print("-Tidak terdeteksi-")
            totalharga += total
            ulang = input(
                "Apakah Anda ingin menambah keranjang belanjaan? (pilih y/t): "
            )

            if ulang == "y":
                system('cls')
                True
            elif ulang == "t":
                print(
                    ">===============================================================<"
                )
                print(
                    ">                                                               <"
                )
                print(
                    ">                       RINCIAN PEMBELIAN                       <"
                )
                print(
                    ">                          HAPPY FRESH                          <"
                )
                print(
                    ">---------------------------------------------------------------<"
                )
                print(
                    ">        • 100% FRESH • 100% HIGIENIS 100% TERJANGKAU •         <"
                )
                print(
                    ">            🚩Pucang Sawit, Surakarta, Jawa Tengah🚩          <"
                )
                print(
                    ">                    WA/NO.TELP +6281230526092                  <"
                )
                print(
                    ">                                                               <"
                )
                print(
                    ">===============================================================<"
                )
                x = 0
                for x in range(len(listhargabelanjaan)):
                    print("|", x + 1, "\t", str(listnamabelanjaan[x]),
                          "\t\t\t", str(listhargabelanjaan[x]), "KG|")
                print("Total belanjaan Anda :", totalharga)

                nama = input("Nama: ")
                No_handphone = input("No Handphone: ")
                Alamat_lengkap = input("Alamat Lengkap: ")
                alamat = [
                    'Banjarsari', 'Serengan', 'Laweyan', 'Pasar Kliwon',
                    'Jebres'
                ]
                print("Daftar Kecamatan: ")
                for i in range(5):
                    print(i + 1, alamat[i])
                option = input(
                    "Nama kecamatan : "
                )  #Masukan nama kecamatan menggunakan kaidah KBBI
                if option == "Banjarsari":
                    system('cls')
                    ongkir = 4000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break
                elif option == "Serengan":
                    system('cls')
                    ongkir = 3000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break
                elif option == "Laweyan":
                    system('cls')
                    ongkir = 5000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break
                elif option == "Pasar Kliwon":
                    system('cls')
                    ongkir = 3000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break
                elif option == "Jebres":
                    system('cls')
                    ongkir = 3000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break
                else:
                    system('cls')
                    ongkir = 10000
                    totalpembayaran = ongkir + totalharga
                    print("Nama \t\t: ", nama)
                    print("No Handphone \t: ", No_handphone)
                    print("Alamat Lengkap \t: ", Alamat_lengkap)
                    print("Total belanjaan Anda :", totalharga)
                    print("Ongkir               :", ongkir)
                    print("                      -------------+")
                    print("Total Pembayaran     :", totalpembayaran)
                    break

        print(">===========================================<")
        print(">                                           <")
        print(">          PILIH METODE PEMBAYARAN          <")
        print(">                                           <")
        print(">===========================================<")

        print("Metode pembayaran \t\t: COD/Transfer")
        MP = input("Input metode pembayaran \t:")  #Masukan metode pembayaran
        if MP == "Transfer":
            print(
                "Mohon transfer ke rek. BRI 3011 0102 5427 532 a.n Fitria Dwi Assifa"
            )
        elif MP == "COD":
            print("Admin akan mengirim pesan konfirmasi melalui Whatsapp/SMS ")
        else:
            print("system error")

        namafile = nama
        count = 0
        with open(namafile, "w+") as f:
            f.write(
                ">===============================================================<"
                + "\n")
            f.write(
                ">                                                               <"
                + "\n")
            f.write(
                ">                       RINCIAN PEMBELIAN                       <"
                + "\n")
            f.write(
                ">                          HAPPY FRESH                          <"
                + "\n")
            f.write(
                ">---------------------------------------------------------------<"
                + "\n")
            f.write("                   Bought By: " + nama + "\n")
            f.write("    No Hp: " + No_handphone + "    Alamat:" +
                    Alamat_lengkap + "\n\n")
            f.write("No \t\t Produk \t\t     Quantity \n")
        for x in range(len(listhargabelanjaan)):
            with open(namafile, "a") as f:
                count = count + 1
                f.write(
                    str(count) + ". \t\t" + str(listnamabelanjaan[x]) +
                    "\t\t\t  " + str(listhargabelanjaan[x]) + "\n\n")
        with open(namafile, "a") as f:
            f.write("Total belanjaan Anda :" + str(totalharga) + "\n")
            f.write("Ongkir               :" + str(ongkir) + "\n")
            f.write("                      -------------+" + "\n")
            f.write("Total Pembayaran     :" + str(totalpembayaran) + "\n")

        ulang = input(
            "Apakah Anda ingin menggunakan program ini lagi? (pilih y/t): ")
        if ulang == "y":
            system('cls')
            True
        elif ulang == "t":
            system.exit()
示例#10
0
文件: ci.py 项目: yf2410/polar
# signature config
printLineSeparator("signature config start")
signatureFile = "momeng.keystore"
signatureConfig = "signing.properties"

if path.exists(path.join(vcbrowserDir, signatureFile)):
    printVar("signature", "signature file exist in vcbrowser.")
else:
    if "signatureDir" in os.environ:
        signatureDir = os.environ["signatureDir"]
    else:
        signatureDir = path.dirname(path.dirname(sourceDir))
        if not path.exists(signatureDir):
            printVar("signatureDir", "signatureDir not exist")
            system.exit(1)
    printVar("signatureDir", signatureDir)
    copyfile(signatureDir, vcbrowserDir, signatureFile)
if path.exists(path.join(vcbrowserDir, signatureConfig)):
    printVar("signature", "signatureConfig file exist.")
else:
    copyfile(signatureDir, vcbrowserDir, signatureConfig)

printLineSeparator("signature config end")

# build apk
printLineSeparator("build apk start")
os.system('gradle clean assembleDebug assembleRelease')
printLineSeparator("build apk end")
printLineSeparator("after build start")
# copy file from source to destination
示例#11
0
system('cls')  #clears the terminal window4
plc = pyads.Connection(AMS_NET_ID,
                       PLC_PORT)  #Creates the PLC connection object#

while True:
    try:
        plc.open()  #Start connection to the PLC
        break
    except ValueError:
        print("Error opening PLC connection")
        break

#<Here would probably want to execute scripts in a test folder>
testAxis = mf.testClass(plc, AXIS_ID)
testAxis.axisOn()

if testAxis.waitForOn() == False:
    plc.close()
    print("Axis failed to enable. Press enter key to exit")
    input()
    system.exit()

#pointMoves(testAxis,20)
testAxis.moveToHighLimit(10)
time.sleep(1)
testAxis.moveToLowLimit(10)
time.sleep(1)
testAxis.moveToLowLimit(-20)
plc.close()
示例#12
0
print "Total de contribuídores: ", len(dicUsers.keys())
#Verificar usuários com o email cadastrado
dicUsersValid={}
for user in dicUsers.keys():
    if dicUsers[user]["email"]!=None:
        dicUsersValid.update({user:dicUsers[user]})

print "Total de usuários com email: ", len(dicUsersValid.keys())
#Verificar usuários do Brasil 
try:
    arq = file('states.json')
    states=json.load(arq)
    arq.close() 
except IOError:
    print "Saindo..."
    system.exit(0)
            
dicUsersValidFinal={}
for user in dicUsersValid.keys():
    if dicUsersValid[user]["location"]!=None and isBrazil(dicUsersValid[user]["location"]):
        dicUsersValidFinal.update({user:dicUsersValid[user]})

print "Total de usuários localizados no Brasil: ", len(dicUsersValidFinal.keys())
#Salva em .csv              
listSorted=[]
for user in dicUsersValidFinal.keys():
    listSorted.append((user,dicUsersValidFinal[user]["totalContribuitions"]))

listSorted=sorted(listSorted, key=itemgetter(1), reverse=True)
dicUsers= dicUsersValidFinal
expReposCsv(listSorted)
示例#13
0
 def byebye(self):
         self.fala('Até mais.')
         system.exit(0)