Exemplo n.º 1
0
def getServices():
    data2 = []
    for i, clientes in enumerate(data):
        c2 = []
        for c in range(clientes):
            c2.append(int(numpy.random.normal(20, 2.4)))
        servicio = Services()
        servicio.save_servicio(c2)
        # print(servicio.tiempo_llegada, servicio.tiempo_servicio)
    return servicio
Exemplo n.º 2
0
 def __addUI(self):
     '''
     Interface for the "add" function
     @param:
         - None
     @return:
         - None
     '''
     com = self.__readComplexNumber()
     if com != ComplexNumber(None, None):
         addObj = Services()
         addObj.add(self.numberList, self.historyStack, com)
Exemplo n.º 3
0
 def __undoUI(self):
     '''
     Interface for the "undo" function
     @param:
         - None
     @return:
         - None
     '''
     undoObj = Services()
     try:
         undoObj.undo(self.numberList, self.historyStack)
     except:
         return
Exemplo n.º 4
0
    def __filterUI(self):
        '''
        Interface for the "filter" function
        @param:
            - None
        @return:
            - None
        '''
        #indices should be (startPos, endPos)
        indices = self.__readIndex()

        if tuple != None:
            filterObj = Services()
            filterObj.filter(self.numberList, self.historyStack, indices[0], indices[1])
Exemplo n.º 5
0
 def estudianteDesdeApi(self, cedula, inputsFields, photoLabel):
     if (cedula != ""):
         respuestaServicio = Services(cedula).get_datos()
         #manejo de service fail
         print('aqui', respuestaServicio)
         if respuestaServicio['ok'] != False:
             if "Cedula" in respuestaServicio:
                 print(respuestaServicio)
                 inputsFields[0].set(respuestaServicio['Nombres'])
                 inputsFields[1].set(
                     f"{respuestaServicio['Apellido1']} {respuestaServicio['Apellido2']}"
                 )
                 inputsFields[2].set(respuestaServicio['IdSexo'])
                 print(respuestaServicio["foto"])
                 self._imgfile = respuestaServicio["foto"]
                 raw_data = urllib.request.urlopen(self._imgfile).read()
                 img = Image.open(io.BytesIO(raw_data))
                 photo = ImageTk.PhotoImage(img)
                 photoLabel.config(image=photo)
                 photoLabel.photo = photo
                 print(photo)
                 #image = ImageTk.PhotoImage(im)
             # else:
             #     messagebox.showinfo(title='Informacion', message='Cedula no encontrada')
         else:
             messagebox.showinfo(
                 title='Informacion',
                 message='Ha ocurrido un error, intente otra cedula.')
     else:
         messagebox.showinfo(title='Informacion',
                             message='Cedula no valida.')
Exemplo n.º 6
0
 def save_service(self, object):
     service_done = Services(self.oil.get_state(),
                             self.oil_filter.get_state(),
                             self.air_filter.get_state(),
                             self.fbf.get_state(), self.rbf.get_state(),
                             self.kilometers.get_edit_text(),
                             self.text.get_edit_text())
     self.bike_selected.add_service(service_done)
     save_bike()
     game.update_place(Main())
Exemplo n.º 7
0
 def getInput(self):
     '''
     '''
     x = input("Please insert the commands, separated by a comma: \n")
     i = 0
     l = len(x)
     ServiceObj = Services()
     while i < l:
         if x[i] == 'a':
             command = self.__getAdd(x[i:])
             if command:
                 real = int(command[1])
                 imag = int(command[2])
                 ServiceObj.add(self.numberList, self.historyStack, ComplexNumber(real, imag))
             i += 8
             
         elif x[i] == 'l':
             command = self.__getList(x[i:])
             if command:
                 self.__printComplexNumberList()
             i += 4
             
         elif x[i] == 'f':
             command = self.__getFilter(x[i:])
             if command:
                 startPos = int(command[1])
                 endPos = int(command[2])
                 if startPos < endPos:
                     ServiceObj.filter(self.numberList, self.historyStack, startPos, endPos)
             i += 11
             
         elif x[i] == 'u':
             command = self.__getUndo(x[i:])
             if command:
                 ServiceObj.undo(self.numberList, self.historyStack)
             i += 4
             
         elif x[i] == 'x':
             return -1
         i += 1
Exemplo n.º 8
0
from Services import Services

# @app.route('/data', methods=['PUT'])
# @app.route('/data/<name>', methods=['PUT'])
# @app.route('/robots', methods=['GET', 'POST', 'DELETE'])
# @app.route('/published_robots', methods=['GET', 'POST'])
# @app.route('/query', methods=['PUT'])
# @app.route('/api/query', methods=['PUT'])
# @app.route('/users', methods=['GET'])
# @app.route('/login', methods=['POST'])
# @app.route('/register', methods=['POST'])

app = Flask(__name__)
api = Api(app)
services = Services()
print("ok")


def _read_data_from_csv(filename):
    df = pd.read_csv(filename, names=["question", "answer"])
    return df


def _generate_data(request):
    data = []
    urls = []
    for f in request.files.getlist('file'):
        # f.save(secure_filename(f.filename))
        f.save(f.filename)
        if (f.filename.startswith('url')):
Exemplo n.º 9
0
from Services import Services

items = {}
totalCost = 0
continueShopping = ''

while True:
    item = input("What do you want to buy?")
    price = Services().userNumber("What is the price of the " + item + "?")
    amountOfItems = Services().userNumber("How many " + item +
                                          "'s do you want to purchase?")
    continueShopping = Services().decision(
        "Continue shopping? Type 'yes' or 'no'.")
    cart = Services().addItems(price, amountOfItems)
    items[item] = cart
    if continueShopping != "yes":
        break
    else:
        totalCost = Services().calculatePrice(items)
        print("The total so far is:", totalCost)

totalCost = Services().calculatePrice(items)
print("The total for all items is", totalCost)
Exemplo n.º 10
0
            def transform_data(chat_file):
                parsedData = []
                lines = chat_file.readlines(500)
                lines=pd.Series(lines)
                if ('[' in lines[0]) or ('[' in lines[1]):
                    device = 'ios'
                else:
                    device = "android"
                chat_file.readline()
                messageBuffer = []
                date, time, author = None, None, None
                while True:
                    line = chat_file.readline()
                    if not line:
                        break
                    if device == "ios":
                        line = line.strip()
                        if Services.startsWithDateAndTimeios(line):
                            if len(messageBuffer) > 0:
                                parsedData.append([date, time, author, ' '.join(messageBuffer)])
                            messageBuffer.clear()
                            date, time, author, message = Services.getDataPointios(line)
                            messageBuffer.append(message)
                        else:
                            if Services.startsWithDateAndTimeios(line):
                                if len(messageBuffer) > 0:
                                    parsedData.append([date, time, author, ' '.join(messageBuffer)])
                                messageBuffer.clear()
                                date, time, author, message = Services.getDataPointios(line)
                                messageBuffer.append(message)
                            else:
                                messageBuffer.append(line)
                    else:
                        line = line.strip()
                        if Services.startsWithDateAndTimeAndroid(line):
                            if len(messageBuffer) > 0:
                                parsedData.append([date, time, author, ' '.join(messageBuffer)])
                            messageBuffer.clear()
                            date, time, author, message = Services.getDataPointAndroid(line)
                            messageBuffer.append(message)
                        else:
                            messageBuffer.append(line)

                if device == 'android':
                    df = pd.DataFrame(parsedData, columns=['Date', 'Time', 'Author', 'Message'])
                    df["Date"] = pd.to_datetime(df["Date"])
                    df = df.dropna()
                    df["emoji"] = df["Message"].apply(Services.split_count)
                    URLPATTERN = r'(https?://\S+)'
                    df['urlcount'] = df.Message.apply(lambda x: re.findall(URLPATTERN, x)).str.len()
                else:
                    df = pd.DataFrame(parsedData, columns=['Date', 'Time', 'Author', 'Message'])
                    df = df.dropna()
                    df['Date'] = df['Date'].str.replace(r'^([\s\S]*)\[', '', regex=True)
                    df["Date"] = df["Date"].apply(Services.dateconv)
                    df["Date"] = pd.to_datetime(df["Date"], format='%Y-%m-%d')
                    df["emoji"] = df["Message"].apply(Services.split_count)
                    URLPATTERN = r'(https?://\S+)'
                    df['urlcount'] = df.Message.apply(lambda x: re.findall(URLPATTERN, x)).str.len()

                df["emoji"] = df["emoji"].apply(lambda x: "".join(sorted(set(x))))

                if export_language=="ITA":
                    df = df[df["Author"].str.contains(" ha aggiunto ") == False]
                    df = df[df["Author"].str.contains(" ha abbandonato") == False]
                    media_messages = df[df['Message'].str.contains(" omessa") == True].append(
                        df[df['Message'].str.contains(" omesso") == True]).append(
                        df[df['Message'].str.contains(" esclusa") == True]).append(
                        df[df['Message'].str.contains(" non incluso") == True]).shape[0]
                    media_messages_df = df[df['Message'].str.contains(" omessa") == True].append(
                        df[df['Message'].str.contains(" omesso") == True]).append(
                        df[df['Message'].str.contains(" esclusa") == True]).append(
                        df[df['Message'].str.contains(" non incluso") == True])
                    df = df[df["Message"].str.contains("I messaggi in questo gruppo sono protetti con la crittografia end-to-end.") == False]

                else:
                    df = df[df["Author"].str.contains("added") == False]
                    df = df[df["Author"].str.contains("left") == False]
                    media_messages = df[df['Message'].str.contains(" omitted") == True].shape[0]
                    media_messages_df = df[df['Message'].str.contains(" omitted") == True]
                    df = df[df["Message"].str.contains("Messages to this group are now secured with end-to-end encryption.") == False]


                total_messages = df.shape[0]
                emojis = sum(df['emoji'].str.len())
                links = np.sum(df.urlcount)

                messages_df = df.drop(media_messages_df.index)
                messages_df['Letter_Count'] = messages_df['Message'].apply(lambda s: len(s))
                messages_df['Word_Count'] = messages_df['Message'].apply(lambda s: len(s.split(' ')))

                l = messages_df.Author.unique()
                Members = pd.DataFrame(l, columns=['Author'])
                Members=Members.append({"Author" : "All"}, ignore_index=True)
                Members["new"] = range(1,len(Members)+1)
                Members['new'].replace((len(Members)+1),0,inplace=True)
                Members.loc[Members["Author"]=="All", "new"] = 0
                Members=Members.sort_values("new").reset_index(drop='True').drop('new', axis=1)
                l = Members.Author.unique()

                return l, Members, messages_df, media_messages_df, total_messages, media_messages, emojis, links, device
Exemplo n.º 11
0
    signal.signal(signal.SIGUSR1, rotate_logs)
    signal.signal(signal.SIGHUP, rotate_logs)

    logger.info("Starting...")
    logger.info("prefix path is '{}'".format(prefix))
    logger.info("suffix path is '{}'".format(suffix))

    server = Server(prefix, suffix)
    logger.info("Configuring...")
    try:
        load_conf(prefix, suffix, args.config_file)
    except ConfParseError as e:
        logger.critical(e)
        exit(1)

    services = Services(conf_filters)
    try:
        logger.info("Starting services...")
        services.start_all()
    except Exception as e:
        logger.error(
            "Could not start all the services: {0}; exiting".format(e))
        services.stop_all()
        exit(1)

    stopCond = Condition()
    reporterThread = Thread(target=server.report_stats,
                            args=(services, conf_stats_report, stopCond))
    logger.info("launching Reporter thread...")
    reporterThread.start()
Exemplo n.º 12
0
 def moo():
     Services()
Exemplo n.º 13
0
parser.add_option("-a",
                  "--address",
                  action="store",
                  dest="address",
                  default=default_ip,
                  help="Cette option correpond à l'adresse IP du serveur.")
parser.add_option(
    "-p",
    "--port",
    action="store",
    dest="port",
    default=1337,
    type=int,
    help=
    "Cette option permet de choisir un port pour le serveur. Par défaut, 1337 est utilisé."
)
opts = parser.parse_args(sys.argv[1:])[0]
if opts.address == default_ip:
    print(
        "\nPour choisir manuellement une adresse IP (localhost par exemple), référez vous à l'aide avec -h\nToutefois, vous pouvez normalement vous contenter de copier l'adresse ci-bas et de la donner à votre client."
    )
    print(
        "-----------------------------------------------------------------------------------------------\n"
    )
"""
Le début du programme principal.
"""
services = Services(ServerSocket(opts.address, opts.port))
while True:
    services.fournir()
Exemplo n.º 14
0
logfile_prefix = None
## -- If logprefix is null, output is to console otherwise into todays log file
#logfile_prefix = config.get('local', 'logfile_prefix')

level_name = 'info'
logger = tools.initLogging(logfile_prefix, level_name, 'toothd')

logger.info('## --------------------------------- ##')
logger.info('## ---- Running Toothd Daemon  ---- ##')
logger.info('## --------------------------------- ##')

logger.info("Node Ip Address: " + tools.getIp())
logger.info("Node Hostname: " + tools.getHostname())

advert = Advert(logger)
advert.Start()

services = Services(logger)
services.Start()

while True:

    i = raw_input()
    if i == 'q':

        advert.Stop()
        services.Stop()

        logger.info("Bye...")
        sys.exit()
Exemplo n.º 15
0
 def addServices(self, services):
     if not isinstance(services, list):
         raise AttributeError("addServices given null attributes")
     self.services = Services(services)
Exemplo n.º 16
0
from Services import Services
from flask import Flask, jsonify, render_template

app = Flask(__name__)

data = Services()


@app.route('/')
@app.route('/home')
@app.route('/index')
@app.route('/index.html')
def index():
    return render_template('index.html')


@app.route("/api/v1.0/medals")
def get_all_medals():
    return jsonify(data.get_medals())


@app.route("/search")
def go_to_search():
    return render_template('index_olympicsSportsFilter.html')


@app.route("/api/v1.0/country/<country_name>")
def get_country_info_by_name(country_name):
    return jsonify(data.get_country_info_by_name(country_name))

Exemplo n.º 17
0
    st.markdown("---")

    st.markdown("Made with ❤️ by [![Stefano Cantù]\
                        (https://img.shields.io/badge/Author-%40StefanoCant%C3%B9-blue)]\
                        (https://github.com/settings/profile)")



else:
    line = chat_file.readline()
    line = line.strip()
    chat_language = None
    export_language = None
    device = None
    export_language = Services.detect_export_language(chat_file, export_language)
    chat_language = Services.detect_chat_language(chat_file, chat_language)

    if (Services.startsWithDateAndTimeAndroid(line) == False) and (Services.startsWithDateAndTimeios(line) == False):
        st.subheader("Warning: The file provided is not correct!⚠️")
        st.write(
            "Please follow the instructions below to extract your Whatsapp chat export from the app.")

        st.markdown("---")

        st.markdown('**How to export chat text file? (Not Available on Whatsapp Web)**')
        st.markdown('Follow the steps 👇:')
        st.markdown('1) Open the individual or group chat.')
        st.markdown('2) Tap options > More > Export chat.')
        st.markdown('3) Choose export without media.')
        st.markdown('4) Unzip the file and you are all set to go 😃.')