content
stringlengths
5
1.05M
#!/usr/bin/env python import time import heapq import numpy as np class PriorityQueue: def __init__(self): self.elements = [] def empty(self): return len(self.elements) == 0 def put(self, item, priority): heapq.heappush(self.elements, (priority, item)) def get(self): ...
import Tkinter from pyfirmata import Arduino, SERVO import tkSimpleDialog from Tkinter import IntVar, Button, StringVar, Entry from time import sleep import sqlite3 as lite class App: def __init__(self, port, pin1, pin2, pin3, pin4, pin5): # Setting up Arduino self.arduino = Arduino(port) ...
###################### # ANALYSIS QUESTIONS # ###################### # Set the given parameters to obtain the specified policies through # value iteration. def question2(): answerDiscount = 0.9 answerNoise = 0.01 return answerDiscount, answerNoise def question3a(): answerDiscount = 0.5 answerNois...
from app.models.user import UserModel from app.extension import db from app.winldap.ldap import list_all_users from app.application import application from .celery import task_server @task_server.task() def load_users(): from app.winldap.ldap import list_all_users app = application('development') with ap...
#!/usr/bin/python3 # coding: utf-8 from __future__ import unicode_literals """ ERTIM - INALCO : TECHNIQUES WEB (REST API) ------------------------------------------- This module treats HTTP Methods for clients resource API. :copyright: © 2020 by Elvis. :license: Creative Commons, see L...
# runner.py import yfinance as yf import plotly.graph_objects as go import plotly.figure_factory as ff import math from datetime import datetime # Define the ticker and time range ticker = 'so' time_range = 30 ticker = ticker.upper() # Get Yahoo Finance data yahoo_data = yf.Ticker(ticker) # Create a dataframe of Yah...
from .local import IDDS_MESSAGING_PASSWORD TEST_CONFIG = {"connection":{'host':'0.0.0.0','port':61613},"queue":"A.B.C.D"} IDDS_PRODUCTION_CONFIG = {"queue":'/queue/Consumer.prodsys.atlas.idds', "connection":{'host':'atlas-mb.cern.ch','port':61013 ,'username':'atlasidds','password':IDDS_MESSAG...
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-15 22:41 ## Automaticky vytvořený program, který v prázdné databázi vytvoří tabulky ## pro hlasování. ## Byl vytvořen programem "python manage.py makemigrations". ## Víc viz soubor models.py from __future__ import unicode_literals from django.db import ...
from ._integration_test_case import IntegrationTestCase class AuthServicesTestCase(IntegrationTestCase): def test_login_client(self): from accelbyte_py_sdk.core import get_client_auth from accelbyte_py_sdk.services.auth import login_client # arrange client_auth, error = get_clien...
# -*- coding: utf-8 -*- # /tests/test_nbody.py ''' ---------------------------------------------------------------------------- tests for mpc_nbody Nov 2020 Mike Alexandersen & Matthew Payne & Matthew Holman The tests are organized as follows (i) Tests of ParseElements (ii) Tests of NbodySim (iii) Tests of output pa...
import os.path import testsidegself.command TEMPLATE_HEAD = """\ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head profile="http://selenium-ide.o...
# Copyright 2013 Cloudbase Solutions Srl # # 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 l...
import re import logging from core import utils logger = logging.getLogger(__name__) class Ping_to_CSV: def run(self, target, paths, keep=True): logger.info("Starting Ping to CSV transformer for files %s" % paths) new_paths = [] for path in paths: csv = [("ts,target,id,lat\n"...
""" Unit tests for image operations """ import functools import logging import os import unittest import astropy.units as u import numpy from astropy.coordinates import SkyCoord from rascil.data_models.polarisation import PolarisationFrame from rascil.processing_components import create_image, fft_image, create_w_t...
from functools import reduce from operator import mul, add source_data = 'day16/input.txt' with open(source_data, 'r') as f: input = [x.replace('\n', '') for x in f.readlines()] # Convert to int so we can do bit operations input_string = bin(int(input[0], 16)).replace('0b', '').zfill(len(input[0]) * 4) version...
import logging import threading import time import mouse from flowd.metrics import BaseCollector class MouseUsedCollector(BaseCollector): """ Mouse used --- Seconds per minute """ metric_name = "Mouse Used (seconds)" TIMEOUT_NOT_USED_SEC = 3 def __init__(self) -> None: sel...
#!/usr/bin/env python addr = 'FE80:0000:0000:0000:0101:A3EF:EE1E:1719' ipv6 = addr.split(':') print ipv6
from __future__ import absolute_import, unicode_literals from django.template import engines from django.test import SimpleTestCase class KitReviewTagsTests(SimpleTestCase): def _load_template(self, tpl): return engines["django"].from_string(tpl) def test_rating_css_class(self): tpl = "{% lo...
from .core import ProkaryoteModelGenerator from .initalize_model import InitalizeModel from .metabolism import MetabolismSubmodelGenerator from .transcription import TranscriptionSubmodelGenerator from .rna_degradation import RnaDegradationSubmodelGenerator from .translation import TranslationSubmodelGenerator from .pr...
# -*- coding: utf-8 -*- # Copyright (c) 2015 Spotify AB from __future__ import absolute_import, division, print_function import os import pytest from six import iteritems from ramlfications import loader from ramlfications.errors import LoadRAMLError from .base import EXAMPLES def dict_equal(dict1, dict2): fo...
from metaerg.data_model import Genome, FeatureType from metaerg import context from metaerg import bioparsers def _run_programs(genome:Genome, result_files): """Executes the helper programs to complete the analysis""" fasta_file = genome, context.spawn_file('masked', genome.id) bioparsers.write_genome_to_f...
from sqlalchemy.orm import relationship from db import db import datetime from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Comments(db.Model,Base): id = db.Column(db.Integer, primary_key = True) publishedOn = db.Column(db.DateTime(),nullable =False, default=datetime.date...
"""Main module.""" from .mail import send_mail # noqa
""" Unit and regression test for the kinoml package. """ # Import package, test suite, and other packages as needed import kinoml # pylint: disable=unused-import import sys def test_kinoml_imported(): """ Sample test, will always pass so long as import statement worked """ assert "kinoml" in sys.mod...
import numpy as np __all__ = ['myprint'] def myprint(): a = np.array([1, 2, 3, 4]) print(a[0]) return a[0]
# MIT License # # Copyright (c) 2019 Morning Project Samurai (MPS) # # 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, cop...
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmseg.models.decode_heads import FCNHead, OCRHead from .utils import to_cuda def test_ocr_head(): inputs = [torch.randn(1, 8, 23, 23)] ocr_head = OCRHead( in_channels=8, channels=4, num_classes=19, ocr_channels=8) fcn_head = FCNHe...
#!/usr/bin/python # Copyright 2012 William Yu # wyu@ateneo.edu # # This file is part of POX. # # POX 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 3 of the License, or # (at your option) any l...
import numpy as np from numpy import array from skimage import morphology import matplotlib.pyplot as plt import copy from sklearn.cluster import KMeans from skimage import measure from PIL import Image, ImageDraw def seperate_roi(imgs_to_process, bottom_left, top_right, id, out_path, lung_mask): print("Seperating ...
# coding:utf-8 from bourbaki.introspection.prettyprint import fmt_pyobj obj = { "foo": "bar", "baz": [1, 2, (3, 4, {5, 6})], "wut": dict(), "wat": frozenset([("wat", 123)]), } s = """dict( foo='bar', baz=[ 1, 2, ( 3, 4, { ...
from __future__ import absolute_import from setuptools import setup setup()
__author__ = 'Chirag' '''changing graph scale (for readability)''' import matplotlib.pyplot as plt mySamples = [] myLinear = [] myQuadratic = [] myCubic = [] myExponential = [] for i in range(30): mySamples.append(i) myLinear.append(i) myQuadratic.append(i**2) myCubic.append(i**3) myExponential.append(1.5**i) #...
import numpy as np import tensorflow as tf import sys from deeplab_resnet import model as deeplab101 from util.processing_tools import * class RMI_model(object): def __init__(self, img, caption, class_num ,batch_size, num_steps,mode,vocab_size, vf_h = 40, ...
import os import copy import torch class DistMNISTProblem: """An object that manages the various datastructures for a distributed optimization problem on the MNIST classification problem. In addition, it computes, stores, and writes out relevant metrics. Author: Javier Yu, javieryu@stanford.edu, Jul...
########################################################################## # If not stated otherwise in this file or this component's Licenses.txt # file the following copyright and licenses apply: # # Copyright 2021 RDK Management # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use th...
from django.contrib import admin from .models import (Calibration_Update, RawDataModel, AdjustedDataModel, HeightDifferenceModel, RangeParameters, ) # Register your models here. @admin.register(RangeParameters) cl...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: value.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _mes...
# Generated by Django 3.2.7 on 2021-09-12 06:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('kutub', '0004_auto_20210912_0555'), ] operations = [ migrations.AddField( model_name='manuscript', name='collation',...
from osrsmath.skills.mining.motherload_mine import Miner, base_xp, PROSPECTOR import matplotlib.patches as mpatches import matplotlib.pyplot as plt from pprint import pprint import itertools def get_optimal_kit(paydirt_xp): experience = {} for item1, item2, item3, item4 in itertools.permutations(PROSPECTOR):...
#!/usr/bin/env python3 #**************************************************************************************************************************************************** # Copyright (c) 2014 Freescale Semiconductor, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without #...
#!/usr/bin/env python """ """ # Script information for the file. __author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)" __version__ = "" __date__ = "" __copyright__ = "Copyright (c) 2009 Hendrix Demers" __license__ = "" # Standard library modules. # Third party modules. from nose.plugins.skip import SkipTest ...
#! /usr/bin/env python ####################################### # A python script to read in a text file # of rainfall data for summer and winter # within the UK and display as a plot. # Author: Pete Bunting # Email: pete.bunting@aber.ac.uk # Date: 28/08/2007 # Version: 1.0 ####################################### impo...
from unittest import TestCase from twist_controller import Controller import numpy as np PKG = 'twist_controller' class TestTwistController(TestCase): def setUp(self): v_mass = 1736.35 decel_limit = -5.0 wheel_radius = 0.2413 wheel_base = 2.8498 steer_ratio = 14.8 ...
''' Checking for errors in objects Author: Ankit Khambhati <akhambhati@gmail.com> Last Updated: 2018/11/07 ''' import inspect import os def check_dims(arr, nd): ''' Check if numpy array has specific number of dimensions Parameters ---------- arr: numpy.ndarray Input array for d...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime import wagtail.wagtailimages.blocks import wagtail.wagtailcore.fields import wagtail.wagtailcore.blocks class Migration(migrations.Migration): dependencies = [ ('home', '0011_auto_201...
#!/usr/bin/env python3 import argparse import datetime import os.path import sqlite3 def save(connection): query = ''' REPLACE INTO uptime (day, time) VALUES ( date('now'), coalesce((SELECT time FROM uptime WHERE day=date('now')), 0) + ? ) ''' with connection: ...
from getpass import getpass from jinja2.environment import Environment from jinja2 import FileSystemLoader, StrictUndefined from my_funcs import yaml_loader import pyeapi import yaml # Set environment and set Jinja2 template file env = Environment(undefined=StrictUndefined) env.loader = FileSystemLoader('.') template_...
from flask import Flask, session, request, render_template, url_for, redirect from flask_session import Session from config import Config from forms import LoginForm from exts import db, redis_client from models import User from utils import mark_data, get_data, login_required, get_avatar, random_dice, random_card, md5...
"""requires a config file with a sqlalchemy database engine""" import pandas as pd import panel as pn from config import db pn.extension() pd.options.display.float_format = '{:,.2f}'.format query = """ SELECT Assignments.Client_Name, Assignments.Director, Assignments.Manager, Time.Hours, Time.Bi...
import time import asyncio import websockets import re import traceback from uao import register_uao register_uao() try: from . import DataType from . import Config from . import Util from . import i18n from . import Log from . import Screens from . import Command from . import Excepti...
from auxi import * import pdb class GMM(object): def __init__(self,sample,z): print 'This is GMM algorithm' self.x = sample self.m,self.n = np.shape(sample) self.y = np.random.randint(0,3,size=(1,self.n)) #alpha = np.random.randint(1,8,size=(1,3)) #self.alpha = alpha...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
#!/usr/bin/env python """Windows Sandboxing library based on AppContainers. See https://docs.microsoft.com/en-us/windows/win32/secauthz/appcontainer-for-legacy-applications- for details about AppContainers. This module works only on Windows >= 8. """ import contextlib import ctypes # pylint:disable=g-importing-membe...
from __future__ import absolute_import, print_function from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream from kafka import KafkaProducer from kafka.errors import KafkaError import json import datetime # Consumer key and secret consumer_key="YOUR_CONSUMER_KEY" CON...
import random a = comGuess = random.randint(0,100) #a and comGuess is initialised with a random number between 0 and 100 while True: #loop will run until encountered with the break statement(user enters the right answer) userGuess = int(input("Enter your guessed no. b/w 0-100:")) #user input for guessing the number...
# Generated by Django 2.1.5 on 2019-07-31 23:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('poet', '0003_auto_20190731_1912'), ] operations = [ migrations.AlterModelOptions( name='progressoutcome', options={'ordering...
from livewires import games,color import pygame, math, os, time enemy_list = open("hidden\\enemy.txt","r").readlines() turret_list = open("hidden\\turret.txt","r").readlines() os.environ['SDL_VIDEO_CENTERED'] = '1' games.init(screen_width = 800, screen_height = 600, fps = 50) class Wait(games.Sprite): def __ini...
#!/usr/bin/env Python # -*- coding: utf-8 -*- ''' ===================================================================================== Copyright (c) 2016 Université de Lorraine & Luleå tekniska universitet Author: Luca Di Stasio <luca.distasio@gmail.com> <luca.distasio@ingpec.eu> This program...
from keras.utils import np_utils from keras import datasets from sklearn import preprocessing from keras import backend def mnist_data(): (X_train, y_train), (X_test, y_test) = datasets.mnist.load_data() Y_train = np_utils.to_categorical(y_train) Y_test = np_utils.to_categorical(y_test) L, W, H = X_...
''' There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and fights, together with starting city src and the destination dst, your task is to find the cheapest price from src to dst with up to k stops. If there is no such route, output -1. ...
# Copyright (C) 2020 FireEye, Inc. All Rights Reserved. import os import shlex import ntpath import hashlib import capstone as cs import speakeasy.winenv.arch as _arch import speakeasy.windows.common as w32common from speakeasy.profiler import Run from speakeasy.windows.winemu import WindowsEmulator import speakeasy...
# Copyright 2015 Yelp Inc. # # 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 agreed to in writing, so...
#!/bin/env python3 # This class will add a virtual edge to the KG decorated with the Jaccard index value on it. # relevant issue is #611 # will need to figure out DSL syntax to ensure that such edges will be added to the correct source target nodes # Need to decide if this will be done *only* on the local KG, or if the...
import random from dice import * def main(): #Sets the min and max to 1 and 6 min = 1 max = 6 roll_again = 'yes' or 'y' or 'Yes' or 'Y' or 'no' or 'n' or 'No' or 'N' #Asks for guess and requires it to be an integer user_guess = raw_input("What is your guess: ") #Requires number to be betwee...
from typing import TYPE_CHECKING, Any, List, Set, Dict, Optional from itertools import chain from .exceptions import ( TableExtractionError, NoElementFoundError, MultipleElementsFoundError, InvalidTableError, InvalidTableHeaderError, ) if TYPE_CHECKING: from .filtering import ElementList ...
# coding: utf-8 import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) import torch import torch.nn as nn import torch.backends.cudnn as cudnn from torch.autograd import Variable import numpy as np import cv2 import colorsys if torch.cud...
#! python3 """ Solve random board generated on nine.websudoku.com See board_solver.py -> for details on the SudokuPuzzle object See strategies.py -> for details on non-recursive solving strategies See main.py -> for examples of the solver working in Pythoon """ import requests from bs4 import BeautifulSoup f...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('main', '0053_cloudplatform'), ] operations = [ migrations.AlterField( model_name='role', name='role_...
""" Unit tests for meta/networks/parallel.py. """ import torch import torch.nn as nn from meta.networks.utils import Parallel INPUT_SIZE = 10 OUTPUT_SIZE = 8 NUM_LAYERS = 5 BATCH_SIZE = 6 def test_new_dim(): """ Test that outputs from Parallel are correctly computed and stacked when `new_dim=True`. ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # CODE NAME HERE # CODE DESCRIPTION HERE Created on 2019-09-16 at 13:22 @author: cook """ import os from collections import OrderedDict from apero import core from apero import lang from apero.core import constants from apero.io import drs_path from apero.io import ...
import sys sys.path.insert(0, '.') import unittest import PCM_Error class TestCompareC(unittest.TestCase): def setUp(self): self.delta = 0.000001 def test_CC1(self): errTw = PCM_Error.PCM_ErrorC('Testing/compareC/C01.out', 'P01.out', 'TWat') errTp = PCM_Error.PCM_ErrorC('Testing/com...
from lamp import Lamp #Estamos importando una clase def run(): lamp = Lamp(is_turned_on=True) #inicializar una clase while True: command = str(input(''' ¿Que deseas hacer? [p]render [a]pagar [s]alir ''')) if command == 'p': lamp.turn_on(...
import copy import os import logging from collections import OrderedDict from random import randint from cv2 import randn from detectron2.data.build import build_batch_data_loader, get_detection_dataset_dicts from detectron2.data.common import DatasetFromList, MapDataset from detectron2.data.dataset_mapper import Data...
""" Simple project scheduling tool Using data from a CSV, create a dead-simple Gantt chart """ __version__ = '0.5.6' from .gantt import *
"""Test Interaction class.""" import numpy as np import pytest from phono3py import Phono3py from phono3py.phonon3.interaction import Interaction itr_RTA_Si = [ 4.522052e-08, 4.896362e-08, 4.614211e-08, 4.744361e-08, 4.832248e-08, 4.698535e-08, 4.597876e-08, 4.645423e-08, 4.659572e...
first = int(input(' Please little Locust, insert the first number:')) second = int(input('Now, typing the second number: ')) third = int(input('right! now insert the last one Please')) bigger = int() lower = int() if first > second and third : bigger = first else: first < second and third lower = first ...
TAGS_ALLOWED_CHARACTERS = 'a-z0-9+#-.' MAX_TAGS = 10 MIN_TAGS = 1
# ************************************************************ # Copyright (c) 2020, Kyle Williams - All Rights Reserved. # You may use, distribute and modify this code under the # terms of the BSD-3 license. You should have received a copy # of the BSD-3 license with this file. # If not, visit: https://opensource.org/...
#!/usr/bin/env python3 # https://www.bamsoftware.com/hacks/zipbomb/ # David Fifield <david@bamsoftware.com> # Public domain import binascii import bz2 import getopt import struct import sys import zipfile CHOSEN_BYTE = ord(b"a") # homage to 42.zip # CRC-32 precomputation using matrices in GF(2). Similar to crc32...
"""Utility or convienence functions. ---- Copyright 2019 Data Driven Empathy LLC 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 u...
from ROAR_Gym.envs.roar_env import ROAREnv from ROAR_Gym.envs.roar_pid_env import ROARPIDEnv
#first attempt at a Python wrapper for the Bookshare API, found at #http://developer.bookshare.org #Tested on Python2.7x32 running on Window 7 x64. #written by Alex Hall, mehgcap@gmail.com. #Forked and updated by Blake Oliver <oliver22213@me.com> #You may use, modify,redistribute, and so on. #If you use this wrap...
"""Mockup domain code.""" import numpy as np def rosenbrock(x, y, a, b): return (a - x)**2 + b * (y - x**2)**2 def f(r, u, v): return rosenbrock((r - 0.5) + u - 5, 1 + 3 * (v - 0.6), a=1, b=3), r params = np.loadtxt('mockup.in') r = np.arange(0, 1, 0.1) result = f(r, params[0], params[1]) print(result) np...
import config import shutil import requests import os api_key = config.dowjones_apikey # Job ID is the last part of the extraction / snapshot ID. job_id = config.dowjones_snapshotid host = "https://api.dowjones.com/alpha/extractions/documents/" extraction_id = "dj-synhub-extraction-{}-{}".format(api_key, job_id) targe...
#### # # The MIT License (MIT) # # Copyright 2019, 2020 Eric Bach <eric.bach@aalto.fi> # # 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 ...
import pandas import numpy as np import matplotlib.pyplot as plt import csv import scipy.signal filename = ('ExerciseClassifier.csv') names = ['xacc', 'yacc', 'zacc'] data = pandas.read_csv(filename, names=names) ##print(data.shape) ##plt.plot(data) readdata = csv.read...
import xarray as xr import atmPy.clouds.ceilometry as _ceilometry import pandas as _pd import numpy as np # def read_ceilometer_nc(fname): # ds = xr.open_dataset(fname) # ceil = _ceilometry.Ceilometer() # ceil.backscatter = _ceilometry.Backscatter(ds.backscatter.to_pandas()) # return ceil def read_ceil...
from couchapy import CouchDB, CouchError from datetime import datetime from queue import Queue, Empty import threading import signal import uuid from pprint import pprint class Logger(): """ Threaded logging to couchdb database """ __allowed_keys = ['config', 'db_conn'] __SLEEP_TIME_...
from .base import Platform, TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR, MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR import OpenGL __all__ = ['PygletPlatform'] class PygletPlatform(Platform): """Renders on-screen using a 1x1 hidden Pyglet window for getting an OpenGL context. """ def __init__(self, viewpo...
##Wigner 3 J symbol using Racah Formula #Craig Benko 2014.04.30 from pylab import * import math as m def Wigner3J(j1, j2, j3, m1, m2, m3): if 2*j1 != floor(2*j1) or 2*j2 != floor(2*j2) or 2*j3 != floor(2*j3) or 2*m1 != floor(2*m1) or 2*m2 != floor(2*m2) or 2*m3 != floor(2*m3): # print('All arguments must b...
#!/usr/bin/envn python3 # -+-coding: utf-8 -+- #---------------------------------------- # Created by fboers at 19.09.18 #---------------------------------------- # Update #---------------------------------------- import wx from pubsub import pub from jumeg.gui.wxlib.jumeg_gui_wxlib_logger import JuMEG_w...
class LogicWrapper: """ A class to wrap around the traci built in type of Logic This class will include some convenience functions for increasing the durations of phases, etc """ def __init__(self, logic, lanes): self.logic = logic self.lanes = lanes def getId(self): ...
import torch import torch.nn as nn from .py_utils import TopPool, BottomPool, LeftPool, RightPool from .py_utils.utils import convolution, residual, corner_pool from .py_utils.losses import CornerNet_Loss from .py_utils.modules import hg_module, hg, hg_net def make_pool_layer(dim): return nn.Sequential() def ma...
''' https://github.com/zhanlaoban/EDA_NLP_for_Chinese ''' import os import jieba import synonyms import random from random import shuffle class EdaChinese(object): def __init__(self, num_aug): self.stop_words = list() with open(os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.path...
""" """ from src.probability.bayes_theorem import BayesTheorem class TestBayesTheorem: def test_calculate(self): instance = BayesTheorem( probability_hypothesis=1 / 21, probability_evidence_given_hypothesis=0.4, probability_not_hypothesis=20 / 21, probabili...
import sys from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, rffi from rpython.rlib.rarithmetic import LONG_BIT, r_uint from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.debug import ll_assert, fatalerror WORD = LONG_BIT // 8 NULL = llmemory.NULL WORD_POWER_2 = {32: 2, 64: 3}[LO...
# ============================================================================= # Script for helper function to use the EAST model with OpenCV # Template from PyImageSearch # ============================================================================= # Importing libraries import numpy as np # define the two last ...
#!/usr/bin/env python """List installed distributions with some of their metadata in json format. This currently assumes pkg_resources is installed. TODO: use importlib.metadata and fallback on pkg_resources if not available. This script must be python 2 compatible. This may one day become a native pip feature (http...
from typing import Dict from bs4 import BeautifulSoup def parse(case_soup: BeautifulSoup, case_id: str) -> Dict: case_data = {} case_data["odyssey id"] = case_id return case_data
#!/usr/bin/env python3 """Computes optimal mechanisms and dual solutions for the multi-goods monopolist problem. The classes in this script allow to compute and visualize \ optimal solutions to the multi-goods monopolist problem. Example usage: types = np.array([[0,0],[1,1]]) probabilities = np.array([1/2,1/2])...