content
stringlengths
5
1.05M
import numpy as np import cv2 rect= np.ones((600,800, 3), dtype = np.uint8)*255 cv2.rectangle(rect, (0, int(600/2)), (int(800/2),599), (0,0,255), 18) cv2. imshow("image" ,rect) cv2.waitKey() cv2.destroyAllwindows() cv2.rectangle(rect,(int (800/2),0), (799, int (600/2)), (0,255,0), -1) cv2.imshow("image", rect) cv2.wa...
import Pokemon as pok import GeneticAlgorithm as gen import Species as sp import unittest class TestDamageMult(unittest.TestCase): """ Test the damage multiplier function from the Pokemon library """ def test_super_duper_effective(self): """ Test that attacking with 4x effectiveness wi...
""" Participant =========== Complement to a Neptune participant, scoped to a classroom. """ import logging import re import unicodedata from model import SqlModel, SqlField as Field import mysql_connection class Participant(SqlModel): table = 'participant' py_table_definition = { 'table_name': tabl...
#!/usr/bin/env python # # License: BSD # https://raw.githubusercontent.com/stonier/py_trees/devel/LICENSE # ############################################################################## # Documentation ############################################################################## """ .. argparse:: :module: py_tr...
import functools import logging import traceback import prosperpy LOGGER = logging.getLogger(__name__) def fatal(func): @functools.wraps(func) async def wrapper(*args, **kwargs): try: return await func(*args, **kwargs) except Exception as ex: LOGGER.fatal("Error '%s' ...
from django.contrib import admin from .models import (Dish, Payments, Order, Delivery, OrderItem) admin.site.register(Dish) admin.site.register(Payments) admin.site.register(Order) admin.site.register(Delivery) admin.site.register(OrderItem)
import requests def get_api_json(target_url, api_id, api_secret): """make get request to Socrata Chicago Data Portal API Parameters ---------- target_url : str a validly formed URL string api_id : str API key id for HTTP basic auth api_secret : str API secret passcode ...
# # PySNMP MIB module EXPRESSGS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXPRESSGS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:07:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
import UserManager import PostManager from UserManager import getUser from sports.XMLOddsParser import parseXMLOdds from models import TipForm, PostForm from random import randint from Utils import random_list_element from sports.sportsPopulator import simulate_sports_results import ChatManager users = ["A...
#!/usr/bin/env python3 # Record mouse and keyboard actions and reproduce them identically at will # # Copyright (C) 2019 Mairo Rufus <github@rmpr.xyz> # # 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 Found...
import random game_list=['stone','paper','scissor'] computer = 0 user = 0 c=0 p=0 while(True): user=input("Enter Stone , Paper , scissor or Quit") computer=random.choice(game_list) if(user=="Quit"): break elif(user==computer): print('Tie') elif(user=='stone')...
import cv2 import numpy as np ''' 特徵點檢測 ''' ''' As usual, we have to create an ORB object with the function, cv2.ORB() or using feature2d common interface. It has a number of optional parameters. Most useful ones are nFeatures which denotes maximum number of features to be retained (by default 500), scoreType whic...
import os import logging import socket import struct logger = logging.getLogger(__name__) extra = {} def get_extra(): if len(extra) == 0: acquire_outside_env() return extra def acquire_outside_env(): extra['options'] = {} if not os.environ.has_key('TUPLENET_RUNDIR'): extra['options'][...
# # Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms. # """ Helper methods for tests, and test configuration information. """ import importlib as _importlib import unittest as _unittest drivers_to_load = [ 'ps2000', 'ps2000a', 'ps3000', 'ps3000a', 'ps4000', 'ps4000a', 'ps...
from __future__ import print_function from __future__ import absolute_import from __future__ import division import compas import compas_rhino import compas_rbe from compas.utilities import XFunc from compas_rbe.datastructures import Assembly from compas_rbe.rhino import AssemblyArtist from compas_rbe.rhino import ...
import math import os import numpy as np from pathlib import Path from data_functions import * from random_forest import * # printing modifiers PRINT_BOLD_COLOR = "\033[1m" PRINT_DISABLE_COLOR = "\033[0m" def clear_file(file_name): """Clear the contents of a file""" # clear any previous content in the f...
#!/usr/bin/python3 """ Rewrites specfiles to fix the %licsens """ import argparse import sys from pathlib import Path from subprocess import run from ..common.helpers import detect_softwarename from .helpers import detect_specfile, get_source_filename, get_current_version, VERSION_MATCH from ..librariesio.get_latest_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 6 23:48:23 2021 first plot: Example PyLCP library from https://python-laser-cooling-physics.readthedocs.io/en/latest/examples/MOTs/00_F0_to_F1_1D_MOT_forces.html Plots spatial depenence. second plot: plots velocity force components, formula from...
import sys input_name = "ex.input.txt" if "real" in sys.argv: input_name = "input.txt" lines = [line.strip() for line in open(input_name, "r")] positions = None for line in lines: digits = list(line) if positions is None: positions = [{} for x in range(len(digits))] for i, digit in enumerat...
n = int(input('Digite qualquer número inteiro: ')) for tab in range (1, 11): print(f'{n} x {tab:2} = {n*tab}')
from numpy import zeros, pi, sin from netCDF4 import Dataset def cdfcurl(u_file, u_var, v_file, v_var, mesh_mask_file, **kwargs): """ Note: stolen from Julian Mak at https://github.com/julianmak/NEMO-related. Compute the curl on something F-points from U and V variables EDIT: unlike cdfcurl.f90 I did...
from typing import Any from torch.utils.data import Dataset from transformers import BatchEncoding class PaperDataset(Dataset): def __init__(self, abstracts: BatchEncoding, titles: BatchEncoding): # Convert dictionary to T5 input format self.input_ids = abstracts.input_ids self.attention_...
from stdnet import odm class Element(odm.StdModel): name = odm.SymbolField() class CompositeElement(odm.StdModel): weight = odm.FloatField() class Composite(odm.StdModel): name = odm.SymbolField() elements = odm.ManyToManyField(Element, through=CompositeElement, ...
# -*- coding: utf-8 -*- """ SPDX-FileCopyrightText: Deutsches Zentrum für Luft und Raumfahrt SPDX-FileCopyrightText: Patrik Schönfeldt SPDX-License-Identifier: MIT """ from ._heat_layers import HeatLayers from ._heat_exchanger import HeatExchanger from ._layered_heat_pump import LayeredHeatPump from ._multi_layer_st...
""" byceps.util.export ~~~~~~~~~~~~~~~~~~ Data export as CSV. :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from __future__ import annotations import csv import io from typing import Iterator, Sequence def serialize_dicts_to_csv( field_names: Sequence[str...
#coding=utf-8 import unittest from Render import Renderer memo1 = ''' [Metadata] date: 2015-03-07 title: 你很重要,打比赛已经不行了。我得去造个轮子 [Tags] categories: python, angularjs, love difficulty: 5 [Description] 我觉得我已经没有什么潜力可挖了。突然感到有些腻烦。 对于我来说,并不可以谈生活。因为我见到过巫师的水晶球,我向里面看了一眼。 从此不能自拔。 [Process] # DO NOT EDIT THE THINGS BELOW UNL...
#! /usr/bin/env python from enum import Enum class ObjectIdentifierType(Enum): F20_20_B=1, 'Small Black Alu. Profile' F20_20_G=2, 'Small Grey Alu. Profile' S40_40_B=3, 'Large Black Alu. Profile' S40_40_G=4, 'Large Grey Alu. Profile' M20_100=5, 'Bolt' M20=6, 'Small Nut' M30=7, 'Large Nut' R20=8,...
import sys import argparse from io import StringIO from data import * class TAWRITER: def __init__(self, graph, bound=None): self.graph = graph self.bound = bound def threshold_guard(self, threshold, links): welldefined = " && ".join(map(lambda x: "out{0} < 2".format(x), links)) ...
from solc import install_solc install_solc('v0.4.19')
from utils import ( Time, typedef ) from constants import TIME_FORMAT import copy class Person(object): """ A base class for all people """ def __init__(self, name, languages, gender): """ Initialize the Person object :param name: A string representing the name ...
from django.conf import settings from rest_framework.routers import DefaultRouter, SimpleRouter from krankit.users.api.views import UserViewSet from krankit.blog.api.views import PostViewSet if settings.DEBUG: router = DefaultRouter() else: router = SimpleRouter() router.register("users", UserViewSet) router...
from src.utils import get_title, get_crystal class TestUtils: JEDI = "Jedi" SITH = "Sith" OBSIDIAN = "Obsidian" GEM = "Dragite gem" single_type = { "type": JEDI, "crystal": OBSIDIAN, } array_type = {"type": [JEDI, SITH], "crystal": [OBSIDIAN, GEM]} def test_get_string...
# -*- coding: utf-8 -*- """ Python implementation of TD Learning (Experimental) for discrete-finite MDPa Naoto Yoshida """ class TDLearning(object): def __init__(self, lr=0.05, discount_rate=0.95, initial_v_value=0.0, maximum_state_id=10000): ...
#!/usr/bin/env python3 """ Tools for working with virtual machines. This module provides tools to set up and control virtual machines. The API is structured to allow allocation of machines from a 'pool' of available machines, like this: machines = vmtools.pool().request_machines( [ {"name": "n...
# -*- coding: utf-8 -*- # # Copyright 2011 Manuel Francisco Naranjo <manuel at aircable dot net> # # 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/LI...
from .make_environment import MakeEnvironment from .explorer import Explorer
import torch from torch import nn from collections.abc import Iterable from survae.utils import context_size from survae.distributions import Distribution, ConditionalDistribution from survae.transforms import Transform, ConditionalTransform class ConditionalFlow(ConditionalDistribution): """ Base class for C...
import dash from dash_html_components import Br, Div from dash_table import DataTable from dash_table.Format import Format, Group, Prefix, Scheme, Symbol app = dash.Dash(__name__) columns_1 = [ dict(id='a', name='Symbol', type='numeric', format=Format(symbol=Symbol.yes)), # skip-id-check dict(id='a', name='Sy...
import numpy as np class CrossEntropyLoss: def forward_pass(self, predicted, labels): predicted = np.clip(predicted, 1e-10, 1 - 1e-10) # probabilities for all classes predicted_probabilities = predicted[range(len(predicted)), labels] # probabilities of classes equal to labels log_likelih...
def minsteps0(n): if n > 1: r = 1 + minsteps0(n - 1) if n % 2 == 0: r = min(r, 1 + minsteps0(n // 2)) if n % 3 == 0: r = min(r, 1 + minsteps0(n // 3)) return r else: return 0 # print(minsteps0(1)) # print(minsteps0(2)) # print(minsteps0(3)) # prin...
import pymysql, re def connect(): db = pymysql.connect(host="212.64.15.***", port=3306, user="hadoop",password="hadoop", database="py_tech", charset="utf8" ) return db def show_database(db): with db.cursor() as cursor: cursor.execute('show databases;') data = cursor.fetchall() pr...
N, D = map(int, input().split()) ppl = list(map(int, input().split())) for i in range(D): n = int(input()) F = sum(ppl[:n]) S = sum(ppl[n:]) if F >= S: print(F) ppl = ppl[n:] elif F < S: print(S) ppl = ppl[:n]
from Robinhood import Robinhood rb = Robinhood() rb.login_prompt() watchlist = rb.watchlist() symbols = ' '.join([instrument['symbol'] for instrument in watchlist]) print(symbols) with open("watchlist.txt", "w") as text_file: text_file.write("{0}".format(symbols))
/home/runner/.cache/pip/pool/f3/14/8b/236ff11256ad4f4f630d50ee6b7ebddd65e49babd614f4011e12ece3c6
# Authors: Stephane Gaiffas <stephane.gaiffas@gmail.com> # License: BSD 3 clause """ Plot iterations of AMFClassifier ================================ In this examples we illustrate the evolution of the decision function produced by :obj:`AMFClassifier` along iterations (repeated calls to ``partial_fit``). """ import ...
from struct import pack from bgapi.base_command import command from bgapi.utils import address_to_bytes from bgapi.types import (MessageType, MessageClass) def get_bt_address(): MSG_TYPE = MessageType.COMMAND_RESPONSE.value MSG_CLASS = MessageClass.SYSTEM.value MSG_ID = 0x03 payload = b'' return ...
from django.db import models # Create your models here. class Article(models.Model): title = models.CharField(max_length=150, verbose_name="Titulo") content = models.TextField(verbose_name="Contenido") image = models.ImageField(default='null',verbose_name="Imagen", upload_to = "articles") public = mod...
import torch from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.module import Module from . import mx_correlation_cuda class MxCorrelationFunction(Function): @staticmethod def forward(ctx, input1, input2, ...
# Threading example import time, thread import csv import sys import urllib, json googleKey = '' def parse_csv( field_name, input_csv_file, output_csv_file ): with open( input_csv_file ) as csv_file: with open( output_csv_file, 'wb' ) as out_csv_file: reader = csv.DictReader(csv_file) ...
from django.core.exceptions import ValidationError from django.forms import UUIDField import six from django.utils.module_loading import import_string from django.utils.translation import ugettext_lazy as _ from django_smalluuid import settings class ShortUUIDField(UUIDField): default_error_messages = { ...
def mergesort(arr): if len(arr) <= 1: return arr left = arr[:len(arr)/2] right = arr[len(arr)/2:] ret = [] if len(left) == 1 and len(right) == 1: if left[0] < right[0]: ret.append(left[0]) ret.append(right[0]) else: ret.append(right[0]) ret.append(left[0]) return ret if(len(left) != 0): ...
import re if __name__ == '__main__': n = int(input()) s = [input() for _ in range(n)] t = int(input()) for _ in range(t): ss = input() Regex = '\\b' + ss + '\\b' total = 0 for i in s: words = re.findall(Regex, i) total += len(words) p...
# Copyright (c) 2015 Mirantis, 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 writin...
from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import MinLengthValidator as Min from django.contrib.postgres.fields import ArrayField from datetime import date class Course(models.Model): name = models.CharField(max_length=50) description = models.C...
#!/usr/bin/env python2 import sys import numpy as np import matplotlib.pyplot as plt observed = np.array([int(line) for line in sys.stdin]) x = np.arange(1, len(observed) + 1) plt.plot(x, observed, 'r', linewidth=2) plt.plot(x, x, 'k') plt.legend(['HyperLogLog', 'true count']) plt.show()
# -*- coding: utf-8 -*- """ taiga_ncurses.ui.widgets ~~~~~~~~~~~~~~~~~~~~~~~~ """ from . import ( generic, auth, projects, backlog, milestones, issues, wiki )
# Copyright (c) Open-MMLab. All rights reserved. from .collate import collate from .data_container import DataContainer from .data_parallel import MMDataParallel from .distributed import MMDistributedDataParallel from .scatter_gather import scatter, scatter_kwargs from .utils import is_parallel_module __all__ = [ ...
# Copyright 2020 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 agreed to...
from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QMainWindow, QTableWidget, QTableWidgetItem, QDesktopWidget, QWidget from PyQt5.uic import loadUi from src.Comunication.View.MailView import MailView from src.Movements.Controllers.MovementManager import MovementManager from src.Movements.View.LoanView import ...
port="COM3" # if ('virtual' in globals() and virtual): virtualArduino = Runtime.start("virtualArduino", "VirtualArduino") virtualArduino.connect(port) ard = Runtime.createAndStart("Arduino","Arduino") ard.connect(port) # i2cmux = Runtime.createAndStart("i2cMux","I2cMux") # From version 1.0.2316 use attach inste...
import unittest from random import randint from bit_manipulation.int32_to_ipv4 import int32_to_ip class Int32ToIpv4TestCase(unittest.TestCase): def test_fixed_tests(self): self.assertEqual(int32_to_ip(2154959208), "128.114.17.104") self.assertEqual(int32_to_ip(0), "0.0.0.0") self.assertEq...
from cc3d import CompuCellSetup from ReactionDiffusion_2DSteppables import ReactionDiffusion_2DSteppable CompuCellSetup.register_steppable(steppable=ReactionDiffusion_2DSteppable(frequency=1)) CompuCellSetup.run()
import torch import numpy as np import cv2 class MixUp: def __init__(self): self.distribution = torch.distributions.beta.Beta(torch.tensor([1.2]), torch.tensor([1.2])) def augment(self, gt, ip): batch_size = gt.size(0) idx = torch.randperm(ba...
# Custom operators # 25 nov 2018 # AR, AQ, Abdullah def star_op (firstop, secondop): return ( firstop * 2) + secondop def squiggle_op (firstop,secondop): return firstop**3 + secondop**2 def multidot (op1,op2): return (op1*4)//op2 print ("8 starop 2 == ", star_op (8,2)) # == 18 print ("3 squiggle 2...
# Generated by Django 2.0.8 on 2019-06-18 09:59 from django.db import migrations import wagtail.core.blocks import wagtail.core.fields import wagtail.images.blocks class Migration(migrations.Migration): dependencies = [ ('app_challenges_sections_units', '0018_auto_20190618_0947'), ] operations ...
def wave_bases(mother,k,scale,param): """ This is translation of wave_bases.m by Torrence and Gilbert P. Compo The folloing is the original README % WAVE_BASES 1D Wavelet functions Morlet, Paul, or DOG % % [DAUGHTER,FOURIER_FACTOR,COI,DOFMIN] = ... % wave_bases(MOTHER,K,SCALE,PARAM); % % Com...
from chia.components.evaluators.evaluator import Evaluator class AccuracyEvaluator(Evaluator): def __init__(self, kb): self.correct_count = 0 self.sample_count = 0 def reset(self): self.correct_count = 0 self.sample_count = 0 def update(self, samples, gt_resource_id, pred...
# Imports import numpy as np import pandas as pd import seaborn as sns import pickle import matplotlib.pyplot as plt # Use Seaborn data data = sns.load_dataset("tips") data = data[["total_bill", "tip"]] # Look at data layout print(data.head()) # Statistical Analysis print(data.describe()) # Visual Check of Data ...
# Generated by Django 2.1.3 on 2018-11-17 04:51 import datachimp.utils.generate_uid from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ...
"""UI module of Colorium's Asset Management Tool. This module creates the UI using Colorium's CUI module.""" import maya.cmds as cmds import colorium.ui as ui import colorium.asset_type_definition as asset_type_definition import colorium.scene_name_parser as scene_name_parser import colorium.command as command import ...
""" Example JupyterHub configuration file with LTI 1.3 settings. """ import os # Set port and IP c.JupyterHub.ip = "0.0.0.0" c.JupyterHub.port = 8000 # Custom base url c.JupyterHub.base_url = "/" # Set log level c.Application.log_level = "DEBUG" # Add an admin user for testing the admin page c.Authenticator.admin_...
from JABWrapper.parsers.parser_if import Parser from JABWrapper.jab_types import AccessibleContextInfo, AccessibleHypertextInfo, JavaObject, MAX_HYPERLINKS from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper class AccessibleHypertextParser(Parser): def __init__(self, aci: AccessibleContextInfo) -> None: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import conf.issue_quality_re_patterns as patterns import conf.issue_quality_keywords as keywords import re from BeautifulSoup import BeautifulSoup from markdown import markdown from GithubMarkdown import GithubMarkdown from IssueComment import IssueComment import codecs im...
#To make python 2 and python 3 compatible code from __future__ import absolute_import import json #Returns rectangle boundaries in the CV2 format (topLeftX, topLeftY, bottomRightX, bottomRightY) given by a processing service class AnnotationParser: def getCV2RectanglesFromProcessingService1(self, response): ...
from vnpy.app.cta_strategy import ( CtaTemplate, StopOrder, TickData, BarData, TradeData, OrderData, BarGenerator, ArrayManager, ) from datetime import datetime from vnpy.trader.object import ContractData, SpreadData, Direction, Offset from vnpy.trader.utility import get_folder_path impo...
from datetime import date from . import GenericCalendarTest from ..africa import ( Algeria, Angola, Benin, IvoryCoast, Kenya, Madagascar, Nigeria, SaoTomeAndPrincipe, SouthAfrica, ) from ..core import MON, FRI from ..exceptions import CalendarError class AlgeriaTest(GenericCalendar...
"""Python module for accessing SkyQ box and EPG, and sending commands.""" import importlib import json import logging import math import socket import time from collections import OrderedDict from datetime import datetime, timedelta from http import HTTPStatus from operator import attrgetter import pycountry import re...
def test_geneirc(): a = 2 b = 2 assert a!= b
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function from django import forms class AuthorizeRequestTokenForm(forms.Form): oauth_token = forms.CharField(widget=forms.HiddenInput) authorize_access = forms.BooleanField(required=False)
import contextlib import csv import datetime as dt import math import os import subprocess import cv2 import keras import keras.backend as kbe import keras.callbacks as kcb import keras.layers as kl import keras.models as km import keras.utils as kutils import matplotlib.pyplot as plt import numpy as np import sklearn...
from predicthq import Client # Please copy paste your access token here # or read our Quickstart documentation if you don't have a token yet # https://docs.predicthq.com/guides/quickstart/ EVENT_ENDPOINT_COLUMNS = ['id', 'title', 'description', 'start', 'end', 'duration', 'labels', 'category', 'timezone', 'cou...
#Escape Characters txt = "eu sou no vosso \"Prof\" de python" print (txt)
import time import plugin_sdk class HelloWorld(plugin_sdk.Plugin): def __init__(self): super(HelloWorld, self).__init__(version="0.0.1-alpha") def config(self): pass def command(self, name): if name == "Hello": return "World" def get_help(self, name): re...
import tensorflow as tf from utils import Utils import numpy as np import dnnlib.tflib as tflib from dnnlib.tflib.ops.upfirdn_2d import upsample_2d, downsample_2d, upsample_conv_2d, conv_downsample_2d from dnnlib.tflib.ops.fused_bias_act import fused_bias_act from dnnlib import EasyDict import math from tensorflow.ker...
# coding=utf-8 # Copyright 2020 The ML Fairness Gym Authors. # # 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 applicab...
import math, itertools def divisorsCount(num): n = math.floor(math.sqrt(num)) res = sum(2 for i in range(1, n + 1) if num % i == 0) if n ** 2 == num: res -= 1 return res tri = 0 for i in itertools.count(1): tri += i if divisorsCount(tri) > 500: print(tri) break
''' Shortest Path in a Weighted Directed Graph Using Dynamic Programming. Solution uses vectorization compared to the solution given in the lecture notes. ''' import numpy as np from numpy import inf node_weights = [] destination_node = 99 starting_node = 13 num_nodes = 100 Q = inf*np.ones((num_nodes, num_nodes)) ...
from rest_framework import serializers from users.models import User from tickets.models import Ticket, Category, Comment # Serializers define the API representation. class UserSerializer(serializers.Serializer): id = serializers.IntegerField() email = serializers.EmailField() is_staff = serializers.Boolea...
""" No need to change anything here! If all goes well, this should work after you modify the Add class in miniflow.py. """ from miniflow_05 import * x, y, z = Input(), Input(), Input() f = Add(x, y, z) feed_dict = {x: 4, y: 5, z: 10} graph = topological_sort(feed_dict) output = forward_pass(f, graph) # should ou...
""" ioos_pkg_skeleton is not a real package, just a set of best practices examples. """ from .core import compute_anomaly, compute_climatology, xconvolve __all__ = ["compute_climatology", "compute_anomaly", "xconvolve"] try: from ._version import __version__ except ImportError: __version__ = "unknown"
from django.test import TestCase from quips.quips import anonymize class AnonymizeTest(TestCase): def assertWordIsShuffledTypically(self, word, shuffled): """Assert a word is shuffled, preserving first and last characters.""" self.assertNotEqual(word, shuffled) self.assertEqual(word[0], s...
import numpy as np import cv2 import traceback import busface.model.faceDetector as fd import urllib.request from busface.util import logger, APP_CONFIG, get_model_path import dlib DESIRED_SIZE = int(APP_CONFIG['sample.output_size']) SCALE_RATIO = float(APP_CONFIG['sample.scale_ratio']) model_path = get_model_path("...
#! python3 '''THE COMMANDLINE TOOL HERE''' import os import sys from PyPDF2 import PdfFileReader import exifread import docx import pprint # from file_metadata.generic_file import GenericFile #https://github.com/atdsaa/file-metadata with few modifications to utilities.py from file_metadata.generic_file import Gener...
import pandas as pd from .constants import target_col_name from .discretize import DiscretizationStrategy from .preprocess import PreprocessStrategy from .nc_window import NWStrategy class EngineData: def __init__(self, data: pd.DataFrame, preprocess_strategy: PreprocessStrategy, ...
from keras import optimizers from keras.preprocessing.image import ImageDataGenerator import datetime from keras.callbacks import ModelCheckpoint from keras.callbacks import TensorBoard from keras.callbacks import EarlyStopping from keras.callbacks import LearningRateScheduler import tensorflow as tf class EfficientNe...
from API.misc import * from API.WindFlo import simplified_gaussian_wake turb_coords = np.asarray([[1270.5, 2194.5, 346.5, 1732.5, 2425.5, 346.5, 2194.5, 2425.5, 115.5, 346.5, 808.5, 1039.5, 577.5, 1501.5, 1732.5, 1963.5, 1732.5, 2194.5, 2425.5, 346.5, 577....
import pyglet import mc.globals as G from pyglet.gl import * class Hotbar: file='textures/gui/widgets.png' tex = None batch = None vlist = None def __init__(self, winwidth, winheight): self.x, self.y = (winwidth//2)-181, 30 self.tex = pyglet.graphics.TextureGroup(G.RESOURCE_LOADER....
from lib.util import Util from lib.wallet import Wallet from lib.tangle import Tangle import json utils = Util() class Node: def __init__(self, seed, *args): self.seed = seed self.wallet = Wallet(utils.hash(str(self.seed))) self.neighbours = set() #### # self.DAG = {} ...
"""This class implements the %df magic command""" help_text = """ The %df magic command has the following syntax: > %df [filename] It writes the result of the last query executed in the notebook into an external CSV formatted file. The purpose of this magic command is to allow users to export query data from thei...
#!/usr/bin/env python3 # Copyright(c) 2014-2019 Daniel Kraft # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Utility routines for auxpow that are needed specifically by the regtests. # This is mostly about actually *solving* an ...