content
stringlengths
5
1.05M
# Copyright (c) 2018-2019 Simons Observatory. # Full license can be found in the top level "LICENSE" file. """Test toast data export. """ import os import numpy as np from unittest import TestCase from ._helpers import create_outdir from sotodlib.sim_hardware import get_example from sotodlib.sim_hardware import s...
from distutils.core import setup setup( name='ModeDetection', version='0.1', packages=['networks' ], url='', license='', author='Simon Kleine', author_email='', description='', install_requires=[ 'numpy==1.15.4', 'torch==1.0.0', 'torchvision==0.2.1', ...
import argparse import sys import torch from helen.version import __version__ from helen.modules.python.TextColor import TextColor from helen.modules.python.PolishInterface import polish_genome from helen.modules.python.CallConsensusInterface import call_consensus from helen.modules.python.StitchInterface import perfor...
import requests import argparse TRANSLATION_SERVER = 'http://localhost:8080/translate' def send_request(args): text = open(args.src_file, 'r').read() response = requests.post(TRANSLATION_SERVER, data={ 'text': text, 'src': args.src, 'tgt': args.tgt}) open(args.output, 'w').wr...
#!/usr/bin/env python # Copyright (C) 2012 Israel Herraiz Tabernero # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, co...
from django.db import models # Create your models here. class UploadDocument(models.Model): file = models.FileField(blank=False, null=False, upload_to="document/") def __str__(self): return self.file.name
import os import os.path as path import sys import hashlib import logging __all__ = [ 'FileHandlers', 'DirectoryIterator', 'Global' ] class FileHandlers: def on_file(self, file): return def on_dir_enter(self, file): return def on_dir_leave(self, file): return class DirectoryIt...
from dagster import execute_pipeline, pipeline, solid @solid def get_name(_): return "dagster" @solid def hello(context, name: str): context.log.info("Hello, {name}!".format(name=name)) @pipeline def hello_pipeline(): hello(get_name()) if __name__ == "__main__": execute_pipeline(hello_pipeline) ...
#Copyright 2014 University Corporation for Atmospheric Research (UCAR) # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required b...
import bisect import http import logging import ujson from collections import defaultdict, namedtuple from .constants import _CONTENT_ENC, _COLON, _WILDCARD, _ENC, _SLASH from .request import Request from .response import Response from .router import Router logger = logging.getLogger(__name__) class App(Router): ...
''' Created by auto_sdk on 2020.10.15 ''' from dingtalk.api.base import RestApi class OapiMpdevBuildCreateRequest(RestApi): def __init__(self,url=None): RestApi.__init__(self,url) self.enable_tabbar = None self.main_page = None self.miniapp_id = None self.package_key = None self.package_md5 = None self.p...
from datetime import timedelta from django.test import Client from django.urls import reverse from django.utils import timezone from rest_framework import status from rest_framework.test import APITestCase from db.models.user import User from db.serializers.user_serializer import UserSerializer client = Client() cl...
from __future__ import annotations import asyncio import logging import subprocess from asyncio.transports import BaseTransport from contextlib import AbstractContextManager from typing import Any, List, Optional, cast from .process import Process from .protocol import HaruProtocol __all__ = ("Communicator", "PIPE",...
import os import time import tempfile import unittest import json import uuid import threading from subprocess import Popen import psutil import requests import kafka import pandas as pd MINDSDB_HOST = os.getenv("MINDSDB_HOST") MINDSDB_URL = f"http://{MINDSDB_HOST}:47334" HTTP_API_ROOT = f"{MINDSDB_URL}/api" INTEG...
"""Define Django routing.""" import os from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path, re_path, reverse_lazy from django.views.generic.base import RedirectView from drf_yasg import openapi from drf_yasg.views import ge...
from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin as DefaultUserAdmin from user import models from user import forms class UserAdmin(DefaultUserAdmin): """ The class for enabling the django admin interface to interact with the c...
#!/usr/bin/env python3 # /******************************************************************************* # Copyright Intel Corporation. # This software and the related documents are Intel copyrighted materials, and your use of them # is governed by the express license under which they were provided to you (License). #...
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import pickle import unittest import torch from common_testing import TestCaseMixin, get_tests_dir f...
''' IQ test ''' n = int(input()) numbers = list(map(int, input().split(' '))) even = 0 odd = 0 first_eve = -1 first_odd = -1 for i in range(n): if numbers[i] % 2 == 0: even += 1 if first_eve == -1: first_eve = i else: odd += 1 if first_odd == -1: first_odd...
from widgetastic.ouia import OUIAGenericView from widgetastic.ouia import OUIAGenericWidget from widgetastic.widget.table import Table from widgetastic.xpath import quote from widgetastic_patternfly4.alert import BaseAlert from widgetastic_patternfly4.breadcrumb import BaseBreadCrumb from widgetastic_patternfly4.butto...
__all__ = [ "resnet18_fpn", "resnet34_fpn", "resnet50_fpn", "resnet101_fpn", "resnet152_fpn", "resnext50_32x4d_fpn", "resnext101_32x8d_fpn", "wide_resnet50_2_fpn", "wide_resnet101_2_fpn", ] from icevision.models.torchvision.keypoint_rcnn.backbones.resnet_fpn_utils import ( patch...
from django.http import Http404 from django.views.generic import ListView, DetailView from django.shortcuts import render, get_object_or_404 from .models import Product class ProductFeaturedListView(ListView): template_name = "products/list.html" def get_queryset(self, *args, **kwargs): request = s...
import requests import pygal from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS import sys f_name = sys.argv[1] f = open(f_name, "r") d = eval(f.read()) del d['JavaScript'] del d['None'] # Line my_style = LS('#336699', base_style = LCS) copy_write = 'Created By Xiaoqiang Wang 2018.6\n' + 'A Naive ...
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from openapi_server.models.base_model_ import Model import re from openapi_server import util import re # noqa: E501 class Note(Model): """NOTE: This class is au...
import os import signal import subprocess from abc import ABCMeta, abstractmethod from .consts import (COMPILERS, COMPILE_OK, COMPILE_ERROR, MAX_ERROR_MSG_LENGTH, ACCEPTED, WRONG_ANSWER, TASK_STATUS, TASK_ALL_NORMAL) class Judge(metaclass=ABCMeta): """ This class implements the Python AP...
#!/usr/bin/env python3 import random import psweep as ps def func(pset): return {"result": random.random() * pset["a"] * pset["b"]} if __name__ == "__main__": params = ps.pgrid( ps.plist("a", [1, 2, 3]), ps.plist("b", [8, 9]), ) # First run. df = ps.run_local(func, params) ...
#!/usr/bin/env python from CO2Meter.CO2Meter import * from datetime import date, datetime import time import csv import codecs import os.path as osp FILENAME = "test.csv" ENCODING = 'utf-8' LOGDIR = "logs" Meter = CO2Meter("/dev/co2") while True: start_day = date.today() fn = osp.join(LOGDIR, 'co2_{}.csv'....
# Copyright (c) 2018-2020, Michael P. Howard # Copyright (c) 2021, Auburn University # This file is part of the azplugins project, released under the Modified BSD License. import numpy as np import hoomd from hoomd import _hoomd from . import _azplugins class quiescent(object): r""" Quiescent fluid profile ...
class TransactionType: "V": "CARTAO DE DEBITO A VISTA (REDESHOP/MAESTRO)" "C": "CDC" "T": "TRISHOP" "S": "CONSTRUCARD" "P": "PRE-DATADO" "F": "PAGAMENTO DE FATURA"
import numpy as np def save_pointcloud(filename, points, point_colors=None): """ save a 3d point cloud in PLY format points should be given as an array (or list) of 3d positions point_colors can be given if desired, as an array (or list) of RGB tuples the PLY files can be viewed e.g. using meshla...
from webserver.main import main main()
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2014-2017 Yuhei Otsubo Released under the MIT license http://opensource.org/licenses/mit-license.php """ import sys #コマンドラインオプション解析用 import argparse #正規表現を使用 import re import time import lib.PDFFile import lib.PDFObj #コマンドラインオプション pars...
print(bool(0 + 0j)) # -- B7 print(bool(0.011 + 0j)) # -- B8 print(bool(0-0.00001j)) # -- B9
from unpyc3 import decompile, dec_module import io import os import sys import zipfile from shutil import copyfile SLASH = "\\" PATH_DIR = input("Enter the path of the sims 4 [C:\Program Files\The Sims 4\] : ") PATH_DIR = PATH_DIR or 'C:\Program Files\The Sims 4' + SLASH FILES_IN_ZIP = ("base","core","simulation") if...
from django.views.generic import ListView from .models import Blogpost from .filters import BlogpostFilter class BlogpostListView(ListView): model = Blogpost template_name = 'blog/actualites.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context[...
# coding=utf-8 from netaddr import IPNetwork from exceptions import AlreadyLinked, LastNetInterfaceAchieved, ErrorSetCidr, ErrorSetGateway from ext.serialization import JsonSerializableObject MAX_NET_INTERFACES_ID = 254 def _get_free_net_id(net_object): net_interface_ids = [net_interface.id for net_interface i...
from .vis import vtkRenWin, qtVtkWindow, visMixin, ampActor del vis
import pathlib import aioreloader from aiohttp import web from .vertebral import Vertebral from core.models.mongodb import MongoModel from .middlewares import vertebral_middelware from aiohttp_session import setup from aiohttp_session.cookie_storage import EncryptedCookieStorage BASE_DIR = pathlib.Path(__file__)....
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.9.7) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x33\x7f\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x80\x0...
from __future__ import annotations from typing import TYPE_CHECKING from py_rete.common import Token from py_rete.alpha import AlphaMemory from py_rete.beta import BetaMemory if TYPE_CHECKING: # pragma: no cover from typing import Optional from typing import List from typing import Dict from typing i...
# -*- coding: utf-8 -*- import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',\ level=logging.INFO) from sklearn.feature_extraction.text import CountVectorizer from gensim.models import Word2Vec from data_cleaning import CleanData import pandas as pd from sklearn.feature_extraction....
import os import joblib import argparse import time import pandas as pd import numpy as np from ddt.utility import FeatureGenerator import errno import json from collections import OrderedDict MODELS_DIR = os.path.join("models/files") # Get the model types def get_model_name(ext): name_dict = { "rf": "Ra...
from itertools import combinations from typing import Iterable from utils import is_palindrome def numbers_products_palindromes(numbers: Iterable[int]) -> Iterable[int]: numbers_products = (number * other_number for number, other_number in combinations(numbers, ...
def mas_larga (lista): resultado = [] for listas in range (len(lista)): if len(str(lista[0])) > len(str(lista[1])) and len(str(lista[0])) > len(str(lista[2])): resultado.append(lista[0]) elif len(str(lista[1])) > len(str(lista[0])) and len(str(lista[1])) > len(str(lista[2])): ...
# Model # maximize # sum(x) # subject to # sum(a) >= sum(A*x) # x, a, A binary # x = can manufacture the product i # a = station ij has capability a # A = product i has requirement A import gurobipy as gp from gurobipy import GRB, LinExpr from aps.assets.input import SHOPFLOOR2 as SHOPFLOOR,...
from __future__ import absolute_import, division, print_function import fable.cout from six.moves import zip file_names_disable_warnings = set("""\ add_reals.f add_real_integer.f logical_a_or_b.f add_dp_integer.f real_array_sum.f """.splitlines()) file_names_join_stdout_stderr = set("""\ stop_bare.f stop_integer.f st...
from .models import Person, Bill, Organization, Event, Post from datetime import date, timedelta, datetime import itertools from operator import attrgetter import urllib from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Rss201rev2Feed from django.core.urlresolvers import reverse ...
""" Runs a single plugin against multiple path specs from an Elasticsearch query """ import os from yapsy.IPlugin import IPlugin class FaAction(IPlugin): def __init__(self): self.display_name = 'Action' self.category = 'misc' self.popularity = 0 self.cache = False self.fa...
from enums import * import random class Accountant: def __init__(self): self.q_table = [[0,0,0,0,0],[0,0,0,0,0]] def get_next_action(self, state): if self.q_table[FORWARD][state] > self.q_table[BACKWARD][state]: return FORWARD elif self.q_table[BACKWARD][state] < self.q_table[FORWARD][state]: return BAC...
# -*- coding: utf-8 -*- """QGIS Unit tests for the attribute table model. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later vers...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-07-22 07:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('interactive', '0040_achievement_display'), ] operations = [ migrations.AddF...
import urllib2 import time import json import os import shutil class Model(object): @staticmethod def resolve_redirects(url): try: return urllib2.urlopen(url), urllib2.urlopen(url).getcode() except urllib2.HTTPError as e: if e.code == 429: time.sleep(20)...
"""This module contains the general information for IpBlocking ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class IpBlockingConsts: pass class IpBlocking(ManagedObject): """This is IpBlocking class.""" consts ...
import utils as utils import numpy as np class BeloteDealer: def __init__(self, np_random): ''' Initialize a Belote-decouverte dealer class ''' self.deck = utils.init_8_deck() self.np_random = np_random self.shuffle() def shuffle(self): ''' Shuffle the deck ...
# Copyright (c) 2021 Visiosto oy # Licensed under the MIT License _VERSION_SUFFIX = "-dev" __version__ = "{}{}".format( ".".join([str(n) for n in (0, 3, 2)]), _VERSION_SUFFIX ) if __name__ == "__main__": print(__version__)
import unittest from cranberry import linter class TestLinter(unittest.TestCase): source_file = "test_data.txt" test_append_linter = linter.Linter(source_file, True) test_linter = linter.Linter(source_file, False) def test_create_song_list(self): expected_output_appended = ['test1 audio\n', 'test2 spaces audio\n...
""" Log onto the Raspberry Pi as pi/t0adst00l workon piwars # this sets up the Python virtualenv cd work-in-progress/piwars-2018 python -mpiwars.ducks # this runs the module ducks in the piwars package S1 - PAN: 5079/3888/1079 S2 - TILT: 2192/1408/969 S3 - BARREL: 4869/4869/969 S4 - TRIGGER:5303/5303/1246 """ import...
from engine.core.SquadEntity import SquadEntity from engine.core.SourceEntity import SourceEntity from typing import Collection, List from numpy.lib.utils import source import pandas as pd class FeatureEntity: def __init__(self) -> None: self.description = None self.feature = None self.jour...
import sys from math import pi import larch from larch import Group, ValidateLarchPlugin from larch_plugins.xray import (R_ELECTRON_CM, AVOGADRO, PLANCK_HC, xrayDB, chemparse) MODNAME = '_xray' MODDOC = ''' Functions for accessing and using data from X-ray Databases and Tables. Many ...
# Authors: Veeresh Taranalli <veeresht@gmail.com> # License: BSD 3-Clause """ Interleavers and De-interleavers """ from numpy import array, arange, zeros from numpy.random import mtrand __all__ = ['RandInterlv'] class _Interleaver: def interlv(self, in_array): """ Interleave input array using the spe...
import pandas as pd import os import numpy as np def read_file(path): f = open(path,'r') txt = f.read() lines = txt.split('\n') lines = lines[2:10] data = [x.split(':') for x in lines] out = dict() out['shortname'] = path.split('/')[-2] for d in data: out[d[0]] = [d[1]] return out roots = ['1/1A0','1/1B0'...
# Copyright (c) 2021 Graphcore Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
#!/bin/env python def is_perm(a,b): if len(a) != len(b): return False sorted_a = ''.join(sorted(a)) sorted_b = ''.join(sorted(b)) if sorted_a == sorted_b: return True else: return False
# -*- coding: utf-8 -*- """ Created on Thu Jun 2 14:51:27 2016 @author: DanielleTump Note: This script is not run in full, but is ran by parts of it, depending on the ensemble needed and the files used. """ import csv #to read from/write to csv files from math import ceil #to round floats to the highest integer ...
from netCDF4 import Dataset import numpy as np #------------------------------------------------------------------------------- def average_variational_strains(): gridSizes = [2562, 10242, 40962, 163842] operatorMethods = ["wachspress","pwl","weakwachs"] for operatorMethod in operatorMethods: ...
# Inserindo valores na lista comidas = ['Cebola', 'Tomate', 'Cenoura', 'Ovo', 'Queijo'] comidas.append('Presunto') print(comidas)
from app import db from datetime import datetime from gr.dao.BaseDao import BaseDao from gr.model.manyToMany.AtividadeEstagio import AtividadeEstagio class AtividadeEstagioDao(BaseDao): def get_by_id(self, atividade, atividadeid): return db.session.query(self.model).filter_by(atividade_id=atividadeid, ...
#!/usr/bin/python # encoding: utf-8 ''' scripts.load_bia_proteome -- shortdesc scripts.load_bia_proteome is a description It defines classes_and_methods @author: Ezequiel Sosa @copyright: 2015 BIA. All rights reserved. @license: license @contact: user_email ''' import logging import os import sys from ar...
# -*- coding: utf-8 -*- """ Created on Thu Sep 6 16:59:31 2018 @author: jduran2 """ import os import pandas as pd import matplotlib.pyplot as plt # Choose directory and file name os.chdir(r'C:\Users\jduran2\Dropbox (ORNL)\UTK\SCGSR\LAMS Data\Probe Maps') file = 'AU09_Map2_dict.xlsx' # Read data from excel file u...
from setuptools import setup, find_packages from os.path import exists import versioneer setup(name='trendfit', version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), description=('Trend analysis and fitting for (atmospheric) time series'), url='https://github.com/girpas-ulg/tr...
# -*- coding: utf-8 -*- """ Created on Wed Mar 13 15:11:11 2019 @author: UO270318 """ import numpy as np import matplotlib.pyplot as plt from scipy import integrate #integrales x=np.linspace(-1,1,5) #de -1 a 1 con 5 puntos equidistantes f= lambda x:np.cos(x) y=f(x) ## METODO QUE DEVUELVE LAS MATRICES B Y N def M...
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.views.generic import RedirectView urlpatterns = patterns('dfss.demo.views', url(r'^resumes/$', 'resumes', name='resumes'), url(r'^resume/(?P<epoc_time>[0-9]+)/$', 'get_resume', name='resume'), ...
from argdeco import main import logging logging.basicConfig() log = logging.getLogger() @main def main(): log.debug("debug") log.info("info") log.warning("warning") log.error("error") main(verbosity=True)
#!/usr/bin/env python3 from sys import argv from nltk.tokenize import word_tokenize, sent_tokenize def main(args): """ Parses a file to a format good for word embedding classification. """ with open(args[1]) as inf, open(args[2], 'w') as outf: for line in inf: outstr = '' title...
import asyncio import click from clu import JSONActor, command_parser @command_parser.command() @click.argument('NAME', type=str) def say_hello(command, name): command.write('i', text=f'Hi {name}!') command.finish() class HelloActor(JSONActor): def __init__(self): super().__init__(name='hello_acto...
import binascii data = ''' D9 51 44 5C 65 D5 3D 7D C8 67 BC 68 C8 68 6F 3F C8 64 3F 30 48 41 72 3F 75 C8 67 F4 68 48 B9 6E 7C C8 7F 3C 74 5C 74 3C 74 3C 5C 3C 74 3C 5C 77 48 FE E8 67 C8 49 48 48 48 48 48 48 48 48 48 48 71 43 00 00 00 00 00 00 ''' data = data.replace(' ', '') data = data.replace('\n', '') data = l...
def test_is_generator_alias(): from nose.util import is_generator, isgenerator
#!/usr/bin/env python # coding=utf-8 import RPi.GPIO as GPIO import time #MQTT import paho.mqtt.client as paho import paho.mqtt.publish as publish HOST_NAME = "cgfm.jp" button = 3 GPIO.setmode(GPIO.BOARD) GPIO.setup(button, GPIO.IN) """ ボタン情報をサーバーに送信する """ def publish_mqtt( msg ): try: publish.single( "me...
import math import numpy as np import torch from laia.meters import Meter class RunningAverageMeter(Meter): """Computes the running average and standard deviation of a set of values. Some examples: >>> RunningAverageMeter().add(5).value (5.0, 0.0) >>> RunningAverageMeter().add(5).add(-5).valu...
# -*- coding: utf-8 -*- """ Created on Sun Jan 24 20:31:02 2021 @author: Administrator """ from keras.models import Sequential from keras.layers import Dense, Activation, Flatten, Dropout, MaxPooling1D, Conv1D, Concatenate from tensorflow.compat.v1.keras.layers import CuDNNLSTM as LSTM from keras.layers import Conv2D...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
''' Obviously, these test modules must import your packaged module to test it. You can do this a few ways: Expect the package to be installed in site-packages. Use a simple (but explicit) path modification to resolve the package properly. I highly recommend the latter. Requiring a developer to run setup.py develop ...
from dagster import repository def get_airline_demo_pipelines(): from airline_demo.pipelines import ( airline_demo_ingest_pipeline, airline_demo_warehouse_pipeline, ) return [ airline_demo_ingest_pipeline, airline_demo_warehouse_pipeline, ] def define_internal_dagit_...
from sklearn.cluster import DBSCAN import math def custom_metric(q, p, space_eps, time_eps): dist = 0 for i in range(2): dist += (q[i] - p[i])**2 spatial_dist = math.sqrt(dist) time_dist = math.sqrt((q[2]-p[2])**2) if time_dist/time_eps <= 1 and spatial_dist/space_eps <= 1 and p[3] != q[3...
from django.contrib import admin # Register your models here. from .models import Icon, Color, Property, Event, Note, File, Alert class IconAdmin(admin.ModelAdmin): pass admin.site.register(Icon, IconAdmin) class ColorAdmin(admin.ModelAdmin): pass admin.site.register(Color, ColorAdmin) class PropertyAdmin(admin.M...
# coding: utf-8 from flask.ext.restful import Resource class Test(Resource): def get(self): return 'Welcome to adleida restful API service!'
import psutil from rich import box from rich.panel import Panel from rich.text import Text from textual.widget import Widget from .braille_stream import BrailleStream class Battery(Widget): def on_mount(self): self.bat_stream = BrailleStream(40, 3, 0.0, 100.0) self.panel = Panel( "",...
# Generated by Django 2.2.6 on 2019-10-30 02:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("mercury", "0001_initial")] operations = [ migrations.AlterField( model_name="simulateddata", name="acceleration_x", f...
from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from location.models import City class PublicHoliday(models.Model): created = models.DateTimeField( auto_now_add=True ) updated = models.DateTimeField( auto_now=True ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Dict, NamedTuple, Optional from cdp_backend.pipeline.ingestion_models import ( Body, Person, Seat, ) ############################################################################### class ContentURIs(NamedTuple): video_uri: Optional[str...
from klausen import NamedParameters from pathlib import Path import json DEFAULT = Path(__file__, "..").resolve() / "data" / "default_parameters.json" EXTRA = Path(__file__, "..").resolve() / "data" / "extra_parameters.json" def load_parameters(obj): if isinstance(obj, (str, Path)): assert Path(obj).exis...
from rest_framework import permissions class IsReporter(permissions.BasePermission): """ Permission allowing reporters to access their own reports """ def has_object_permission(self, request, view, obj): return obj.reporter == request.user.IITGUser
from functions import roll class SQUARE: def get_name(self): return self.name def get_style(self): return self.style def __init__(self, name, style): self.style = style self.name = name class GOTO(SQUARE): def get_value(self,player): if(player == "m"): ...
#%% import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.decomposition import PCA pd.set_option('display.max_columns', None) #%% csv = pd.read_csv('data/datatran2018.csv', sep=';', encoding='latin-1') csv.head() #%% print('linhas, colunas: ' + str(csv.shape)) #%% ...
from gaffer import * import os import requests import json class Gaffer: def __init__(self, url=None): if url == None: url = os.getenv("GAFFER") if url == None: url = "https://localhost:8080" self.url = url self.session = requests.Session() def use_cert...
#!/usr/bin/python import sys import unittest import os import inspect import re from optparse import OptionParser # # Fix up import path if running directly # if __name__ == '__main__': filename = os.path.abspath(inspect.getfile(inspect.currentframe())) thispath = os.path.dirname(filename) normpath = os....
# -*- coding: utf-8 -*- """ Resources below '/<api_base>/token' """ import os import logging from flask import request from flask_restful import Resource from flask_jwt_extended import jwt_refresh_token_required, create_access_token, create_refresh_token, get_jwt_identity from http import HTTPStatus from .. import se...
"""Miscellaneous commands for computing extra metadata (specifically, days late and status) about trials. Called during the import process. """ from datetime import date from dateutil.relativedelta import relativedelta from django.apps import apps from django.utils.dateparse import parse_date GRACE_PERIOD = 30 de...
from django.contrib.auth.models import User from mozilla_django_oidc.auth import OIDCAuthenticationBackend def resolve_names(full_name: str): names = full_name.split(" ") if len(names) < 2: return None, None last_name = names.pop() first_name = " ".join(names) return first_name, last_name ...
import click from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor from ocrd_ocropy.segment import OcropySegment @click.command() @ocrd_cli_options def ocrd_ocropy_segment(*args, **kwargs): return ocrd_cli_wrap_processor(OcropySegment, *args, **kwargs)