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 []
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
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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))
def list_repo(self)->List[GiteaRepo]: response = self.api.user.repos() return get_list(response, GiteaRepo)