Example #1
0
 def get_hooks(self, project_id: int) -> List[GitlabProjectHook]:
     try:
         response = self.api.hooks.list(project_id)
         return get_list(response, GitlabProjectHook)
     except AuthError as e:
         logger.exception("Erreur d'accès à la ressource")
         return []
Example #2
0
 def get_repos(self) -> List[GitlabProject]:
     response = self.api.projects.list()
    # print(response.headers)
     repos = get_list(response, GitlabProject)
     next_page = response.headers['X-Next-Page']
     sys.stdout.write("Fetching all Gitlab repos (1/{})".format(response.headers['X-Total-Pages']))
     sys.stdout.flush()
     while response.headers['X-Page'] != response.headers['X-Total-Pages']:
         response = self.api.projects.list(params={'page':next_page})
         next_page = response.headers['X-Next-Page']
         sys.stdout.write("\rFetching all Gitlab repos ({}/{})".format(response.headers['X-Page'],
                                                                       response.headers['X-Total-Pages']))
         sys.stdout.flush()
         repos += get_list(response, GitlabProject)
     print()
     return repos
Example #3
0
def peru():
    if not g.user:

        return redirect("/home")
    country = 'PE'
    name = 'Peru'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #4
0
def arctic_ocean():

    if not g.user:

        return redirect("/home")
    country = 'GL'  # No real country code for arctic - uses greenland since thats the likely launching place
    name = 'Arctic Ocean'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #5
0
def mexico():

    if not g.user:

        return redirect("/home")
    country = 'MX'
    name = 'Mexico (Pacific Ocean)'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #6
0
def mediterranean():

    if not g.user:

        return redirect("/home")
    country = 'EG'  #uses egypt
    name = 'Mediterranean Sea'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #7
0
def india_srilanka():

    if not g.user:

        return redirect("/home")
    country = 'IN'
    name = 'India & Sri Lanka'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #8
0
def nw_africa_morocco():

    if not g.user:

        return redirect("/home")
    country = 'MA'
    name = 'NW Africa / Morocco'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #9
0
def caribbean():

    if not g.user:

        return redirect("/home")
    country = 'BS'  #uses Bahamas
    name = 'Caribbean'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #10
0
def canada():

    if not g.user:

        return redirect("/home")
    country = 'US'  #api is a canadian travel api and so doesnt have canadian advisories since that is their home country
    name = 'Canada'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #11
0
def black_sea():

    if not g.user:

        return redirect("/home")
    country = 'TR'  #uses Turkey
    name = 'Black Sea'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #12
0
def australia_newzealand():

    if not g.user:

        return redirect("/home")
    country = 'AU'
    name = 'Australia & New Zealand'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #13
0
def trinitobago():

    if not g.user:

        return redirect("/home")
    country = 'TT'
    name = 'Trinidad & Tobago'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #14
0
def skorea_japan():

    if not g.user:

        return redirect("/home")
    country = 'JP'
    name = 'South Korea & Japan'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #15
0
def north_atlantic():

    if not g.user:

        return redirect("/home")
    country = 'US'
    name = 'US East Coast (N. Atlantic Ocean)'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #16
0
def north_sea():

    if not g.user:

        return redirect("/home")
    country = 'GB'  #uses england but could use norway
    name = 'North Sea'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #17
0
def caspian_sea():

    if not g.user:

        return redirect("/home")
    country = 'IR'  #uses Iran
    name = 'Caspian Sea'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #18
0
def gulf_of_mexico():

    if not g.user:

        return redirect("/home")
    country = 'US'
    name = 'Gulf of Mexico'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #19
0
def ghana():

    if not g.user:

        return redirect("/home")
    country = 'GH'
    jobs = (Job.query.filter(Job.location == "Ghana").all())
    name = 'Ghana'
    advisory = get_advisory(country)

    listofrates = get_list(name)
    data = zip(TITLES, listofrates)

    jobs = get_jobs(name)

    return render_template('/country.html',
                           jobs=jobs,
                           name=name,
                           listofrates=listofrates,
                           data=data,
                           advisory=advisory)
Example #20
0
from sklearn import model_selection, utils, metrics
from torch.utils.tensorboard import SummaryWriter
import torch
import torch.nn as nn
import os
import numpy as np

# local files
import helpers
import models

TRAIN_PATH = "./data/train"
VAL_TRAIN_RATIO = 0.25
images = helpers.get_list(TRAIN_PATH)

# split features and targets
x = images
y = [helpers.label2num(i.split(".")[0]) for i in images]

# shuffle datafrom sklearn import model_selection, utils, metrics

x, y = utils.shuffle(x, y)

# split into training and validation set
x_train, x_val, y_train, y_val = model_selection.train_test_split(
    x,
    y,
    test_size=VAL_TRAIN_RATIO,
)
print("Training set length:", len(x_train))
print("Validation set length:", len(x_val))
Example #21
0
 def list_repo(self)->List[GiteaRepo]:
     response = self.api.user.repos()
     return get_list(response, GiteaRepo)