content
stringlengths
5
1.05M
from .utilities import git_status_check, git_commit, relabel_rs, add_rs_msg import shutil import click import os @click.command("gnote") @click.argument("label") @click.option("-m", "--msg", required=True, help="msg to add to exp") def cli(label, msg): """creates a new mutation from existing experim...
import sys import os import re import unittest try: from unittest.mock import patch except ImportError: from mock import patch try: from StringIO import StringIO except ImportError: from io import StringIO import cantools def remove_date_time(string): return re.sub(r'.* This file was generated....
import math import numpy as np import matplotlib matplotlib.use('SVG') import matplotlib.pyplot as plt fig, ax = plt.subplots() x1 = 2. x = np.linspace(0, x1, 100) ax.plot(x, np.exp(x), linewidth=2, label = '$x(t)$') N = 4 h = x1 / N sx = np.linspace(0, x1, N + 1) sy = [(1 + h)**n for n in range(N + 1)] ax.plot...
import logging import os import settings import data_manager from policy_learner import PolicyLearner if __name__ == '__main__': stock_code = '005930' # ์‚ผ์„ฑ์ „์ž model_ver = '20210526202014' # ๋กœ๊ทธ ๊ธฐ๋ก log_dir = os.path.join(settings.BASE_DIR, 'logs/%s' % stock_code) if not os.path.isdir(log_dir): ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-07-03 17:09 from __future__ import unicode_literals from django.db import migrations import waldur_core.core.fields class Migration(migrations.Migration): dependencies = [ ('openstack_tenant', '0033_unique_instance_backend_id'), ] ope...
#!/usr/bin/env python # coding=utf-8 import argparse import os import os.path as op from Buzznauts.models.baseline.alexnet import load_alexnet from Buzznauts.utils import set_seed, set_device from Buzznauts.analysis.baseline import get_activations_and_save from Buzznauts.analysis.baseline import do_PCA_and_save def ...
import pytest from deepdiff import DeepDiff from stift.parser import Parser, ParserError, ParseTypes class TestParser: def test_simple(self): s = r"""b("a",s[0])""" parsed = Parser(fmtstr=False).parse(s) expected = [ [ { "type": ParseTypes.f...
# -*- coding: utf-8 -*- import wx.lib.scrolledpanel import util import rmodel import os import numpy from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wxagg import \ NavigationToolbar2WxAgg as ToolBar from matplotlib.figure import Figure import rt...
str2score = { "a" : 1, "b" : 3, "c" : 3, "d" : 2, "e" : 1, "f" : 4, "g" : 2, "h" : 4, "i" : 1, "j" : 8, "k" : 5, "l" : 1, "m" : 3, "n" : 1, "o" : 1, "p" : 3, "q" : 10, "r" : 1, "s" : 1, "t" : 1, "u" : 1, "v" : 4, "w" : 4, "x...
from collections import defaultdict class Graph: def __init__(self): self.graph = defaultdict(list)#Create empty dictionary def insertEdge(self, v1, v2): self.graph[v1].append(v2)#Add v2 to list of v1 self.graph[v2].append(v1)#Add v1 to list of v2 def printGraph(self): ...
# Copyright 2020 Google LLC # # 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, ...
#!/usr/bin/env python #coding:utf-8 # Author : tuxpy # Email : q8886888@qq.com.com # Last modified : 2015-09-08 14:04:23 # Filename : websocket.py # Description : from __future__ import unicode_literals, print_function import base64 import struct import hashlib from gale.escape import utf8 from g...
"""Defines all views related to rooms.""" from flask import jsonify from flask import session from flask_login import current_user from flask_socketio import Namespace, emit, join_room from sqlalchemy import sql from sqlalchemy.orm.exc import NoResultFound from authentication.models import User from base.views import ...
from matplotlib.dates import date2num, num2date from matplotlib.colors import ListedColormap from matplotlib import dates as mdates from matplotlib import pyplot as plt from matplotlib.patches import Patch from matplotlib import ticker from functions.adjust_cases_functions import prepare_cases from functions.general_u...
from discord.ext import commands import globvars from mafia.util import check_if_is_host class Start(commands.Cog): """Contains commands related to starting the game """ def __init__(self, bot): self.bot = bot @commands.command( name='start' ) @commands.check(check_if_is_hos...
# ---------------------------------LogN Solution------------------------- def logbase2(n): m = 0 while n > 1: n >>= 1 m += 1 return m def CountBits(n): m = logbase2(n) if n == 0: return 0 def nextMSB(n, m): temp = 1 << m while n < temp: te...
from __future__ import absolute_import, division, print_function, unicode_literals from typing import List, Tuple, Dict import collections import json import logging import math import os import sys from io import open import torch import torch.nn as nn from torch.nn import CrossEntropyLoss from torch.nn.parameter imp...
import socket import select import time import logging import string class controller(object): def __init__(self,ipaddr): self.ipaddr=ipaddr self.reply_message=None print "init controller" self.connect() def connect(self): netAddr=(self.ipaddr, 4001) self...
'''demux.py a simple c-o band demultiplexer ''' import meep as mp import meep.adjoint as mpa import numpy as np from autograd import numpy as npa from autograd import tensor_jacobian_product, grad from matplotlib import pyplot as plt import nlopt import argparse mp.quiet() # ---------------------------------------- #...
from functools import wraps import hmac import hashlib import time import warnings import logging import requests logger = logging.getLogger(__name__) class BitstampError(Exception): pass class TransRange(object): """ Enum like object used in transaction method to specify time range from which to g...
""" Adaptfilt ========= Adaptive filtering module for Python. For more information please visit https://github.com/Wramberg/adaptfilt or https://pypi.python.org/pypi/adaptfilt """ __version__ = '0.2' __author__ = "Jesper Wramberg & Mathias Tausen" __license__ = "MIT" # Ensure user has numpy try: import numpy excep...
import scipy.io.wavfile; #Preprocessing the data #We have all the wavFiles to numpy arrays for us to #preprocess on multiple computers while we trained #on the much faster computer at the time def convertNumpyToWavFile(filename, rate, data): wavfile.write(filename, rate, data);
# Copyright (c) 2015-2020 by the parties listed in the AUTHORS file. # All rights reserved. Use of this source code is governed by # a BSD-style license that can be found in the LICENSE file. import sys import numbers from collections.abc import MutableMapping, Sequence, Mapping import numpy as np class DetDataV...
# -*- coding: utf-8 -*- # !/usr/bin/env python # @Time : 2021/8/2 11:52 # @Author : NoWords # @FileName: validators.py from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ def validate_even(value): """ ๅถๆ•ฐ้ชŒ่ฏๅ™จ :param value: :return: """ ...
from jsonpickle import encode as json_encode from requests import post as http_post, get as http_get from Client.Logger import logger class Shipper(object): """ Responsible for sending hardware_objects_lib.Computer objects to the centralized server which handles these data. """ def __init__(self, host, port, ti...
#!/usr/bin/env python # @Copyright 2007 Kristjan Haule ''' Classes to handle reading/writing of case.indmf* files. ''' import operator, os, re from copy import deepcopy from scipy import * from numpy import array, log import wienfile from utils import L2str, L2num qsplit_doc = ''' Qsplit Description ------ ----...
""" Implements distance functions for clustering """ import math from typing import Dict, List import requests from blaze.config.environment import EnvironmentConfig from blaze.evaluator.simulator import Simulator from blaze.logger import logger as log from .types import DistanceFunc def linear_distance(a: float, ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-01-20 15:34 from __future__ import unicode_literals from django.db import migrations, models from django.db.models import F def draft_title(apps, schema_editor): Page = apps.get_model('wagtailcore', 'Page') Page.objects.all().update(draft_title=F(...
import json import os import subprocess as sp from batch.client import Job from .batch_helper import short_str_build_job from .build_state import \ Failure, Mergeable, Unknown, NoImage, Building, Buildable, Merged, \ build_state_from_json from .ci_logging import log from .constants import BUILD_JOB_TYPE, VERS...
from os.path import isfile from time import time import joblib import numpy as np import pandas as pd from sklearn.feature_selection import VarianceThreshold from sklearn.model_selection import StratifiedKFold from sklearn.metrics import roc_auc_score from tqdm.auto import tqdm from src.fair_random_forest import Fair...
#!/usr/bin/env python """ Kyle McChesney Ruffus pipeline for all things tophat """ # ruffus imports from ruffus import * import ruffus.cmdline as cmdline # custom functions from tophat_extras import TophatExtras # system imports import subprocess, logging, os, re, time # :) so i never have to touch excel import p...
__title__ = "playground" __author__ = "murlux" __copyright__ = "Copyright 2019, " + __author__ __credits__ = (__author__, ) __license__ = "MIT" __email__ = "murlux@protonmail.com" from enum import Enum """ This file is used to define state constants for the systems operation. """ class State(Enum): """ Bot a...
import os import sys import pytest from pipsi import Repo, find_scripts @pytest.fixture def repo(home, bin): return Repo(str(home), str(bin)) @pytest.mark.parametrize('package, glob', [ ('grin', 'grin*'), ('pipsi', 'pipsi*'), ]) def test_simple_install(repo, home, bin, package, glob): assert not hom...
from unittest import TestCase from moneyed import Money from pytest import raises from billing.total import Total, TotalSerializer, TotalIncludingZeroSerializer class TotalTest(TestCase): def test_unique_currency(self): with raises(ValueError): Total([Money(0, 'USD'), Money(0, 'USD')]) ...
import json, os, parse, re, requests, util import urllib.parse def parseinfo(text): items = parse.parse(text) infos = [i for i in items if i[0] == 'template' and i[1].startswith('Infobox')] if len(infos) == 0: return None, None _, name, data = infos[0] name = re.sub('^Infobox ', '', name) return name, data ...
import awkward import numpy import numba import hgg.selections.selection_utils as utils import hgg.selections.object_selections as object_selections import hgg.selections.lepton_selections as lepton_selections import hgg.selections.tau_selections as tau_selections import hgg.selections.photon_selections as photon_sele...
''' Created on 14 Sep 2011 @author: samgeen ''' import EventHandler as Events from OpenGL.GLUT import * # TODO: Can we have circular imports? How does that work? Works fine in C++! # We really need this in case we have more than one camera. # Plus firing everything through the event handler is tiring #from Camera imp...
import os import socket import time from colorama import Fore, Back, Style def argument(arg): switcher = { 1: "-A -sC -sV -vvv -oN Output/nmap", #Os scanning,Version detection,scripts,traceroute 2: "-O -V -oN Output/nmap", #OS Detection ,Version scanning 3: "-F --open -Pn -oN Output/nmap",...
class Solution: def average(self, salary) -> float: salary.sort() average = 0 for i in range(1, len(salary)-1): average += salary[i] return float(average/(len(salary)-2))
# Simple and powerful tagging for Python objects. # # Author: Peter Odding <peter@peterodding.com> # Last Change: March 11, 2018 # URL: https://github.com/xolox/python-gentag """Simple and powerful tagging for Python objects.""" # Standard library modules. import collections import re # External dependencies. from h...
class MediaAluno: notas = [] def add_notas(self, nota): self.notas.append(nota) def calcula_notas(self): soma = 0 for x in self.notas: soma += x media = (soma / len(self.notas)) return media # def soma(self): # return sum(self.notas) if __name...
#!/bin/env python ################################################################### # Genie - XR - XE - Cli - Yang ################################################################### import time import logging # Needed for aetest script from ats import aetest from ats.utils.objects import R from ats.datastructures....
import http import logging import sys import time from collections import abc from copy import copy from os import getpid import click TRACE_LOG_LEVEL = 5 class ColourizedFormatter(logging.Formatter): """ A custom log formatter class that: * Outputs the LOG_LEVEL with an appropriate color. * If a l...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import common import time from common import TestDriver from common import IntegrationTest from decorators import NotAndroid from decorators import ChromeVer...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Created by Ross on 19-1-19 def check(array: list, middle): c = 0 for i in range(middle, len(array)): if array[i] != array[middle]: break c += 1 for i in range(middle, -1, -1): if array[i] != array[middle]: break ...
from unittest import TestCase from django.http.request import MediaType from simple_django_api.request import Request as HttpRequest class MediaTypeTests(TestCase): def test_empty(self): for empty_media_type in (None, ''): with self.subTest(media_type=empty_media_type): media_...
from .main import run
from os.path import abspath from os.path import dirname with open('{}/version.txt'.format(dirname(__file__))) as version_file: __version__ = version_file.read().strip()
import time, numpy, pytest from rpxdock import Timer def test_timer(): with Timer() as timer: time.sleep(0.02) timer.checkpoint('foo') time.sleep(0.06) timer.checkpoint('bar') time.sleep(0.04) timer.checkpoint('baz') times = timer.report_dict() assert numpy.allclose(times[...
import sys import argparse import logging import textwrap from pathlib import Path import contextlib from tqdm.auto import tqdm import ase.io import torch from nequip.utils import Config from nequip.data import AtomicData, Collater, dataset_from_config from nequip.train import Trainer from nequip.scripts.deploy impo...
#!/usr/bin/python3 import datetime import inquirer import requests import re import csv import os import json repositories = [ "beagle", "beagle-web-react", "beagle-web-core", "beagle-web-angular", "charlescd", "charlescd-docs", "horusec", "horusec-engine-docs", "ritchie-cli", "...
# Generated by Django 3.2.4 on 2021-06-18 13:58 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shop', '0008_historicalproduct'), ] operations = [ migrations.AlterField( model_name='coupon', ...
import sys, os, copy, time, random # global_list is all possible guesses # answer_list is all possible solutions mode = input("Are you playing Unlimited? ") if mode[0].lower() == "y": answer_file = "all_words.txt" all_file = "all_words.txt" else: answer_file = "answers.txt" all_file = "all_words.txt" ...
from django.urls import path from .views import TodoListView, TodoDetailView, TodoCreateView app_name = 'todos' urlpatterns = [ path('', TodoListView.as_view(), name='todo_list'), path('<int:pk>/', TodoDetailView.as_view(), name='todo_detail'), path('novo/', TodoCreateView.as_view(), name='todo_new'), ]
# Copyright 2016 Google Inc. 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 law or a...
""" Copyright 2016 Udey Rishi 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, software dist...
# Create a mesh, compute the normals and set them active, and # plot the active vectors. # import pyvista mesh = pyvista.Cube() mesh_w_normals = mesh.compute_normals() mesh_w_normals.active_vectors_name = 'Normals' arrows = mesh_w_normals.arrows arrows.plot(show_scalar_bar=False)
from __future__ import absolute_import # Add search patterns and config options for the things that are used in MultiQC_bcbio def multiqc_bcbio_config(): from multiqc import config """ Set up MultiQC config defaults for this package """ bcbio_search_patterns = { 'bcbio/metrics': {'fn': '*_bcbio.txt...
# Copyright (C) 2020 NumS Development Team. # # 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 ...
from os import path from json_database import JsonConfigXDG, JsonStorageXDG from ovos_utils.log import LOG from ovos_utils.messagebus import Message from ovos_utils.json_helper import merge_dict from ovos_skills_manager import SkillEntry from ovos_skills_manager.appstores import AbstractAppstore from ovos_skills_man...
from torch.utils.data import Dataset import pandas as pd from ast import literal_eval from os import path import numpy as np from newsrec.config import model_name import importlib import torch try: config = getattr(importlib.import_module('newsrec.config'), f"{model_name}Config") except AttributeError: print(f...
# -*- coding: utf-8 -*- import json import functools from TM1py.Objects import Chore, ChoreTask from TM1py.Services.ObjectService import ObjectService def deactivate_activate(func): """ Higher Order function to handle activation and deactivation of chores before updating them :param func: :return:...
from django.core.management.base import BaseCommand, CommandError from gwasdb.hdf5 import get_hit_count, load_permutation_thresholds from gwasdb.models import Study from aragwas import settings import os class Command(BaseCommand): help = 'Fetch number of SNPs passing filtering, adapt bonferroni thresholds and ad...
""" Simple training loop; Boilerplate that could apply to any arbitrary neural network, so nothing in this file really has anything to do with GPT specifically. """ import math import logging import os from tqdm import tqdm import numpy as np import torch import torch.optim as optim from torch.optim.lr_scheduler imp...
# Copyright 2019 Nokia # # 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, softwa...
import datetime from time import timezone from django.db import models # Create your models here. from issue.models import IssueModel class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def was_published_recently(...
# Copyright 2015 PerfKitBenchmarker Authors. 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 appli...
# -*- coding: utf-8 -*- from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit() def test_it_worked(self): self.brow...
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-05-24 03:45 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import mooringlicensing.components.proposals.models class Migration(migrations.Migration): dependencies = [ ('moorin...
from py_tests_common import * def TypeofOperatorDeclaration_Test0(): c_program_text= """ type T= typeof(0); """ tests_lib.build_program( c_program_text ) def TypeofOperatorDeclaration_Test1(): c_program_text= """ type T= typeof( 55 * 88 ); """ tests_lib.build_program( c_program_text ) def TypeofOperatorD...
# -*- coding: utf-8 -*- """Get image links of the book's cover.""" import logging from .dev import cache from .dev.webquery import query as wquery LOGGER = logging.getLogger(__name__) UA = 'isbnlib (gzip)' SERVICE_URL = ('https://www.googleapis.com/books/v1/volumes?q=isbn:{isbn}' '&fields=items/volum...
from pytz import timezone from django.test import TestCase from django.urls import reverse, resolve from django.contrib.auth.models import User from ..models import SSHProfile, Task, TaskResult class TaskViewTestCase(TestCase): ''' A base test case of Task view ''' def setUp(self): # Setup a t...
from math import * # This import statement allows for all other functions like log(x), sin(x), etc. import numpy as np import math import matplotlib.pyplot as plt class Visualizer: def __init__(self, f_x, f_y): # List of all colors self.color_list = ['#e22b2b', '#e88e10', '#eae600', '#88ea00', ...
#!/usr/bin/env python """ CREATED AT: 2021/12/6 Des: https://leetcode.com/problems/rotate-list/ https://leetcode.com/explore/learn/card/linked-list/213/conclusion/1295/ GITHUB: https://github.com/Jiezhi/myleetcode Difficulty: Medium Tag: ListNode See: """ from typing import Optional from src.list_node import Lis...
from .backends import JWTAuthentication as auth from rest_framework import generics, status from rest_framework.generics import RetrieveUpdateAPIView, ListAPIView from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView fr...
from cli_args_system.args import Args from cli_args_system.flags_content import FlagsContent
# Copyright 2016 Quora, 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...
import unittest from unittest import TestCase from unittest.mock import patch, Mock import mysql.connector from matflow.database.DatabaseTable import DatabaseTable from matflow.exceptionpackage import MatFlowException # TODO too complicated for first use of unittests. Come back to this after writing tests for other ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from .quicktime_hold import QuickTimeHold from .quicktime_mash import QuickTimeMash
# -*- coding: utf-8 -*- import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from .fields import features_modal from .fields import fields from .info_modal import info_modal from app.custom_widgets import custom_button store = [ # JSON string of Parameter...
# -*- coding: utf-8 -*- from model.contact import Contact import random def test_delete_random(app, db, check_ui): if len(db.get_contact_list()) == 0: app.contact.create(Contact(firstname="Nikto")) oldcontacts = db.get_contact_list() contact = random.choice(oldcontacts) app.contact.delete_by_...
from playwright.sync_api import sync_playwright import socket #Stage 2 from ipwhois.net import Net from ipwhois.asn import IPASN from pprint import pprint import ssl, socket class Solution: def __init__(self, url): #1.a self.user_given_url = url self.is_https = None sel...
# Copyright 2019 Contributors to Hyperledger Sawtooth # # 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 ...
class QuestionStructure(object): '''The QuestionStructure Will be imported from the Questions package and used to model the question Structure ''' def __init__(self, q_text, answer, options): self.q_text = q_text self.answer = answer self.options = options def check_answer(...
#!/usr/bin/env python ''' octoDNS Versions ''' from __future__ import absolute_import, division, print_function, \ unicode_literals from octodns.cmds.args import ArgumentParser from octodns.manager import Manager def main(): parser = ArgumentParser(description=__doc__.split('\n')[1]) parser.add_argumen...
import boto3 import os import json from datetime import datetime import logging import json ''' AWS Lambda Function to get all data. Requests come from Amazon API Gateway. ''' logger = logging.getLogger() logger.setLevel(logging.INFO) def get_data(id): dynamodb = boto3.resource('dynamodb') table = dynamodb....
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apach...
from django.shortcuts import render from rbac.models import Menu from system.models import SystemSetup def customerView(request): if request.method == 'GET': ret = Menu.getMenuByRequestUrl(url=request.path_info) ret.update(SystemSetup.getSystemSetupLastData()) return render(request, 'adm/...
# import unittest # import os # from testfixtures import tempdir, compare, TempDirectory # from tests.context import categorize # Pair = categorize.ArchivePair # import json # class test_archive_pair(unittest.TestCase): # """ # Ensure that when something needs to be stored it can be gotten and set # """ ...
# coding: utf-8 from datetime import datetime, timedelta from .._base import to_base64 from .base import TestCase from .base import create_server, sqlalchemy_provider, cache_provider from .base import db, Client, User, Grant class TestDefaultProvider(TestCase): def create_server(self): create_server(self...
from sqlalchemy import ( Boolean, Column, ForeignKey, Integer, Text, Unicode, UniqueConstraint, ) from sqlalchemy.orm import relationship from nbexchange.models import Base from nbexchange.models.actions import Action class Assignment(Base): """The Assigments known for each course ...
# Copyright (c) 2022 Keith Carrara <legocommanderwill@gmail.com> & Edward Kopp <edward@edwardkopp.com> # Licensed under the MIT License. the LICENSE file in repository root for information. from abc import abstractmethod from kivy import Config from kivy.app import App from kivy.core.window import Window from...
import os import random import math import json import numpy as np import pandas as pd from scipy import stats from scipy import sparse from scipy.stats import poisson from scipy.optimize import nnls from fdr import qvalues from sklearn.linear_model import ElasticNet from sklearn.linear_model import Lasso from sklearn....
# coding: utf8 import clinica.pipelines.engine as cpe class T1VolumeParcellation(cpe.Pipeline): """T1VolumeParcellation - Computation of mean GM concentration for a set of regions. Returns: A clinica pipeline object containing the T1VolumeParcellation pipeline. """ def check_custom_dependen...
import os import unittest from tempfile import TemporaryDirectory import numpy as np from l5kit.visualization import write_video class TestVideoVisualizationHelpers(unittest.TestCase): def test_write_video(self) -> None: # Just a smoke test images = (np.random.rand(5, 512, 512, 3) * 255).astype(...
"""This module contains implementations of 'array list' data structure""" from typing import TypeVar, Generic, List, Callable Item = TypeVar('Item') class ArrayList(Generic[Item]): def __init__(self, size: int, realloc_coeff: int, potential_formula: Callable[[int, int], int]): if size < 0: r...
""" pip install selenium """ import os from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.common.actio...
import time import numpy as np class Learner(object): ''' Define interface of methods that must be implemented by all inhereting classes. ''' def __init__(self, discount_factor=1, learning_rate=1): self._values = {} self._prev_values = {} self._discount_factor = discount_factor...
MOD = 1_000_000_007 L = [0, 2, 8] n = int(input()) for i in range(3, n+1): L.append((L[-1]*3 + 2)%MOD) print(L[n]%MOD)
### mb-soil-moisture.py v1.2 ### Show soil moisture on micro:bit display using resistive and capacitive sensors ### Tested with BBC micro:bit v1.5 and MicroPython v1.9.2-34-gd64154c73 ### on a Cytron Edu:bit ### MIT License ### Copyright (c) 2021 Kevin J. Walters ### Permission is hereby granted, free of charge, to...