content
stringlengths
5
1.05M
# Generated by Django 2.2.11 on 2021-09-17 10:14 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('facility', '0274_auto_20210910_1647'), ] operations = [ migrations.AlterField( model_name='dailyr...
#!/usr/bin/python import sys import string import re import subprocess length=0 src=str(sys.argv[1]) target = re.sub(".*builtins-", "", src) target = re.sub("\.ll$", "", target) target = re.sub("\.c$", "", target) target = re.sub("-", "_", target) try: as_out=subprocess.Popen([ "llvm-as", "-", "-o", "-"], stdo...
from .pyaabb import AABB
expected_output = { 'global_mdns_gateway': { 'active_query_timer': 'Enabled', 'active_query_timer_minutes': 30, 'active_query_timer_mode': 'default', 'active_response_timer': '20 Seconds', 'any_query_forward': 'Disabled', 'airprint_helper': 'Disabled', ...
import os import pandas as pd import sklearn from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.linear_model import LinearRegression from sklearn.preprocessing import OneHotEncoder, LabelEncoder, OrdinalEncoder, StandardScaler from sklearn.impute import SimpleImputer from sklearn.pipeline import...
# 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 # distributed under t...
""" Tests of the knowledge base schema for prokaryotes :Author: Yin Hoon Chew <yinhoon.chew@mssm.edu> :Date: 2018-09-18 :Copyright: 2018, Karr Lab :License: MIT """ from wc_kb import core, eukaryote from wc_utils.util import chem import Bio.Alphabet import Bio.Seq import Bio.SeqIO import Bio.SeqUtils import mendeleev...
import os from collections import OrderedDict, defaultdict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.optim import AdamW from meta_neural_network_architectures import VGGActivationNormNetwork, \ VGGActivationNormNetworkWithAttention fro...
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from scipy.optimize import brentq from . import amino_acid_properties class protein: """ Does basic calculations on protein, enzymes and polypeptides. Calculations include e.g. the isoelectric point similar to the "ExPASy Compute pI/Mw ...
## -*- coding: utf-8 -*- ## ## Jonathan Salwan - 2014-05-17 - ROPgadget tool ## ## http://twitter.com/JonathanSalwan ## http://shell-storm.org/project/ROPgadget/ ## import re import codecs from capstone import CS_MODE_32 from struct import pack class Options: def __init__(self, options, binary, gadgets...
# # # ================================================================= # ================================================================= """ IBM PowerVC Storage utilities for retrieving and parsing HMC (K2) response data for topology resources. """ import time from nova.openstack.common import log as logging from ...
from discord.ext import commands, tasks from discord.ext.commands import CommandNotFound, MissingPermissions from utilities.Drive import Drive class Events(commands.Cog): def __init__(self, bot): self.bot = bot self.color = int('f03c3c', 16) self.drive_object = Drive() print('Auth...
""" Dirty wrapping of the Mrtrix3 command necessary but not available in Nipype Commands are wrapped using python function and the Function variant interface of nipype TO DO : use the Mrtrix3Base or CommandLine class of Nipype to perform a cleaner wrap """ import nipype.pipeline.engine as pe from nipype.interfaces.ut...
from django.template import Template, Context from requests_toolbelt.utils import dump def render_with_context(template, context): template = Template(template) context = Context(context) return template.render(context) def parse_dump_result(fun, obj): prefixes = dump.PrefixSettings('', '') try: ...
''' @author: Kittl ''' def exportStorageTypes(dpf, exportProfile, tables, colHeads): # Get the index in the list of worksheets if exportProfile is 2: cmpStr = "StorageType" elif exportProfile is 3: cmpStr = "" idxWs = [idx for idx,val in enumerate(tables[exportProfile-1]) if val == ...
# main.py from flask import Flask from flask import request from flask import jsonify import hashlib import inspect app = Flask(__name__) def lineno(): """Returns the current line number in our program.""" return inspect.currentframe().f_back.f_lineno _usage = '<h1>Welcome to a URLShortener demo </h1>' \ ...
import boto3 import hashlib import sys import argparse import uuid def parse_arguments(): parser = argparse.ArgumentParser( description="calculate the streaming md5 sum for s3 objects" ) parser.add_argument("-b", "--bucketName", required=True, help="s3 bucket") parser.add_argument( "-o...
"""Module contenant les fonctions de l'interface graphique du projet monstercat_media_player""" import tkinter as tk import tkinter.ttk as ttk from PIL import ImageTk, Image class App(tk.Frame): """Classe principale de l'interface graphique""" def __init__(self, master:tk.Tk, sorties, monstercat_media_player)...
""" Example showing a 3D scene with a 2D overlay. The idea is to render both scenes, but clear the depth before rendering the overlay, so that it's always on top. """ import numpy as np from wgpu.gui.auto import WgpuCanvas, run import pygfx as gfx # Create a canvas and renderer canvas = WgpuCanvas(size=(500, 300))...
from setuptools import setup with open('requirements.txt', 'r') as f: requirements = [line.strip() for line in f] discription = "qwgc is a quantum walk graph classifier \ for classification for Graph data." setup( name="qwgc", version="0.0.3", description="Graph classifier based on quan...
# fib(n) = fib(n - 1) + fib(n - 2) # 0 1 1 2 3 5 8 13 21... def fibonacci(n): if n == 0: return n last = 0 next = 1 for _ in range(1, n): last, next = next, last + next return next if __name__ == "__main__": for i in range(0, 10): print("fibonacci: ", fibonacci(i))
from django.utils.translation import ugettext_lazy as _ import horizon from openstack_dashboard.dashboards.stella import dashboard class ConfigPanel(horizon.Panel): name = _("Configuration") slug = "SLAConfigPanel" dashboard.StellaDashboard.register(ConfigPanel)
# -*- coding: utf-8 -*- ##--------------------------------------# ## Kvasir Scheduler functions ## ## (c) 2010-2014 Cisco Systems, Inc. ## (c) 2015 Kurt Grutzmacher ## ## Scheduler functions for long running processes ## ## Author: Kurt Grutzmacher <grutz@jingojango.net> ##--------------------------------------# impo...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('warehouse', '0011_auto_20141223_0744'), ] operations = [ migrations.AlterModelOptions( name='importjob', ...
from ..utils import validate_response class DocumentRevealing(): """Manage revealing related profile calls.""" def __init__(self, api): """Init.""" self.client = api def post(self, text): """ Retrieve revealing. Args: text: <string> ...
# Modulo polls.py v1 # ///---- Imports ----/// import re import os import logging from discord import Embed from discord.ext.commands import Cog, group # from discord.ext.commands import has_permissions, MissingPermissions # Database from libs.database import Database as DB # ///---- Log ----/// log = logging.getLo...
"""Test for the memoryone strategies.""" import random import axelrod from test_player import TestPlayer class TestWinStayLostShift(TestPlayer): name = "Win-Stay Lose-Shift" player = axelrod.WinStayLoseShift def test_strategy(self): """Starts by cooperating""" P1 = self.player() ...
#!/usr/bin/env python3 # coding: UTF-8 import time import sys import csv from PIL import Image, ImageDraw,ImageFont from rgbmatrix import RGBMatrix, RGBMatrixOptions # 使用するLEDのパラメーター(この辺はgithubのサンプルのコピペです) options = RGBMatrixOptions() options.rows = 32 options.chain_length = 4 options.brightness = 80 op...
print("简易记账本(三月)") March=[] for date in range(31): March.append([]) while True: day=int(input("请问输入几号的开销?结束请输入0:")) if day==0: break else: print("请输入每一笔开销,结束请输入0:") n=1 while True: each = float(input("第"+str(n)+"笔:")) if each == 0: ...
#!/usr/bin/python3 import shamir_server import client_handler import settings #If the node is listed as an auth node then start the auth server #Otherwise start the client node program if settings.ID == 'auth': shamir_server.run() else: client_handler.run()
#from .pomdp.basics.state import State #from .pomdp.basics.observation import Observation
#!/usr/bin/env python # encoding: utf-8 """ Advent of Code 2019 - Day 14 - Challenge 2 https://adventofcode.com/2019/day/14 Solution: 2267486 PEP 8 compliant """ __author__ = "Filippo Corradino" __email__ = "filippo.corradino@gmail.com" from day14_1 import main as cost def cost_function(n_target): return cost...
# Copyright 2021 Tianmian Tech. 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 la...
"""The signal processor for Review Board search.""" from __future__ import unicode_literals import threading from functools import partial from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.db.models.signals import post_delete, post_save, m2m_changed from dj...
import os import shutil from subprocess import call, Popen, PIPE import logging from lib.typecheck import * from .. import util from ..sample import Sample from . import is_event cur_dir = os.path.dirname(__file__) root_dir = os.path.join(cur_dir, "..", "..") lib_dir = os.path.join(root_dir, "lib") agent_jar = os...
from deephyper.nas.preprocessing.preprocessing import minmaxstdscaler, stdscaler
from fastapi import Depends, APIRouter, Response from fastapi.responses import JSONResponse from dependency_injector.wiring import Provide, inject from http import HTTPStatus from pydantic.networks import HttpUrl from application.container import ApplicationContainer from application.service.device import DeviceServi...
import sys from collections import defaultdict def evolve_sequence(s0, inserts, steps): # just count the pairs at each iteration counts = defaultdict(lambda: 0) # edge cases for later edges = (s0[0], s0[-1]) for i in range(len(s0)-1): counts[s0[i:i+2]] += 1 for _ in range(steps): ...
from kivy.properties import StringProperty from kivymd.theming import ThemableBehavior from kivymd.uix.boxlayout import MDBoxLayout from kivymd.uix.screen import MDScreen class FortnightlyRootScreen(MDScreen): pass class FortnightlyListItem(ThemableBehavior, MDBoxLayout): title = StringProperty() secon...
from scipy.integrate import odeint from lmfit import minimize, Parameters import numpy as np from ..loss_common import msse, rmsse, wrap_reduce from ...data import cols as DataCol import pandas as pd import optuna from xlrd import XLRDError msse = wrap_reduce(msse) rmsse = wrap_reduce(rmsse) def dpsird(y, t, n, beta,...
#!/usr/bin/python # Copyright 2014 Steven Watanabe # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild import sys t = BoostBuild.Tester(pass_toolset=False, pass_d0=False) t.write("file.jam", """ ...
import _tkinter import tkinter as tk from tkinter import ttk from DataPoint import DataPoint from RGB import RGB import random import time from SortingAlgorithms.SortingAlgorithms import * class Screen(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) # Dataset ...
import pytest import six import tensorflow as tf from tensorflow.keras.mixed_precision import experimental as mixed_precision from models import simplenet_tf def tf_context(func): @six.wraps(func) def wrapped(*args, **kwargs): # Run tests only on the gpu as grouped convs are not supported on cpu ...
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import pyte...
"""Added constraints for col status in user Revision ID: fb92d381ab6a Revises: 180046a31cb3 Create Date: 2019-11-02 23:15:43.686061 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'fb92d381ab6a' down_revision = '180046a31cb3' branch_labels = None depends_on = N...
# -*- coding: utf-8 -*- import logging import json import requests import pkg_resources from django import forms from sentry.plugins.bases import NotificationPlugin TOKEN_ENDPOINT = "https://qyapi.weixin.qq.com/cgi-bin/gettoken" NOTIFICATION_ENDPOINT = "https://qyapi.weixin.qq.com/cgi-bin/message/send" MESSAGE_TEMPLA...
# BEGIN_COPYRIGHT # # Copyright 2009-2021 CRS4. # # 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 ...
import tensorflow as tf from utils import bbox_utils def decode_predictions( y_pred, input_size, nms_max_output_size=400, confidence_threshold=0.01, iou_threshold=0.45, num_predictions=10 ): # decode bounding boxes predictions df_boxes = y_pred[..., -8:-4] variances = y_pred[..., -...
from utils import * from darknet import Darknet import cv2 from DroneVision import DroneVision from Mambo import Mambo import threading import time import shutil from subprocess import check_output, CalledProcessError import signal # set this to true if you want to fly for the demo testFlying = False class UserVisi...
import tornado.ioloop import tornado.web import tornado.websocket import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web from tornado.web import StaticFileHandler from tornado.web import Application, RequestHandler from tornado.options import define, options import socket import torna...
""" SoftLayer.tests.managers.object_storage_tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ import SoftLayer from SoftLayer import fixtures from SoftLayer import testing class ObjectStorageTests(testing.TestCase): def set_up(self): self.ob...
#! /usr/bin/env python # # Copyright (C) Hideto Mori DESCRIPTION = "QUEEN (a Python module to universally program, QUinE, and Edit Nucleotide sequences)" DISTNAME = 'python-queen' MAINTAINER = 'Hideto Mori' MAINTAINER_EMAIL = 'hidto7592@gmail.com' URL = 'https://github.com/yachielab/QUE...
from typing import Dict # The rest of the codebase uses storoshis everywhere. # Only use these units for user facing interfaces. units: Dict[str, int] = { "stor": 10 ** 12, # 1 stor (STOR) is 1,000,000,000,000 storoshi (1 trillion) "storoshi": 1, "colouredcoin": 10 ** 3, # 1 coloured coin is 1000 coloure...
""" Day X - Y """ import utils if __name__ == '__main__': lines = utils.read_strings_from_lines("in/day_13.txt") departure = int(lines[0]) numbers = [int(x) for x in lines[1].split(",") if x != "x"] print(numbers) real_departures = [] for number in numbers: times = departure // n...
#!/usr/bin/env python3 # -*- Coding: UTF-8 -*- # # -*- System: Linux -*- # # -*- Usage: *.py -*- # # Owner: Jacob B. Sanders # Source: code.cloud-technology.io # License: BSD 2-Clause License """ Six-Digit Random Number Generator """ import asyncio from . import * class Interface(Request): """ ......
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 19:26:07 2017 @author: raimundoabrillopez This file reads the export csv from typeform and transforms it in a file with the same structure we use to generate calendars. You need to have your temporada-alimentos-report.csv in the raw folder. Write...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: widevine_pssh_data.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflectio...
import asyncio from collections import deque __all__ = ["SendCtrl"] class SendCtrl: """ """ __slots__ = "_flowing", "_waiters", "_sending" def __init__(self): self._flowing = True self._waiters = deque() self._sending = False def qlen(self): return len(self._wai...
def predict_boxes_near(heatmap,T,threshold=0.85): #bounding box usually large in size threshold = threshold*np.amax(heatmap) t_area = T.shape[0]*T.shape[1] def explore(i,j,cnt): if heatmap[i][j]<threshold or cnt>100: return [[],[]] heatmap[i][j]=0 coords = [[i],[j]] if i>=1: res1 = explore(i-1,j,cnt...
# tests grabbed from: # https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-if-else.R # and # https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-case-when.R import pytest import pandas import numpy as np from datar.core.backends.pandas import Series from datar import f from datar.base im...
#!/usr/bin/env python3 import sys assert sys.version_info[:2] >= (3,0), "This is Python 3 code" def generate(): import hashlib print("""\ # DO NOT EDIT DIRECTLY! Autogenerated by agenttestgen.py # # To regenerate, run # python3 agenttestgen.py > agenttestdata.py # # agenttestgen.py depends on the testcr...
# -*- coding: utf-8 -*- """ """ from chronos.cluster import ClusterCatalog, Cluster CATALOG = "CantatGaudin2020" CLUSTER = "IC_2602" def test_cluster_catalog(): # catalog cc = ClusterCatalog(catalog_name=CATALOG, verbose=False) df = cc.query_catalog(return_members=False) assert len(df) > 0 df_me...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from . import _ortmodule_utils as _utils, _ortmodule_io as _io from ._or...
# -*- coding: utf-8 -*- """q1.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1oYCd94tF34ZvCbTrcYwOoeVidp_WppBw """ import numpy as np from math import * import random from bayes_opt import BayesianOptimization a = 30 b = 20 len = 606#6060 wi = ...
# -*- coding: utf-8 -*- from __future__ import division, unicode_literals import io import re import sys import glob from .messages import * statusStyle = { 'accepted' : 'a', 'retracted' : 'a', 'rejected' : 'r', 'objection' : 'fo', 'deferred' : 'd', 'invalid' : 'oi', 'outofscope': 'oi', }; def prin...
import logging import numpy as np import pandas as pd from typing import Optional from timeit import default_timer as timer logger = logging.getLogger(__name__) class DefaultWriter: """ Default writer to be used by the agents. Can be used in the fit() method of the agents, so that training data can ...
from django.forms import ChoiceField, ModelChoiceField, RadioSelect from django.contrib.admin import site, ModelAdmin, StackedInline from django.contrib.auth import admin, forms, models from .models import Affiliation, FinprintUser, Team class UserCreationForm(forms.UserCreationForm): affiliation = ModelChoiceFie...
__author__ = "Jerry Overton" __copyright__ = "Copyright (C) 2022 appliedAIstudio LLC" __version__ = "0.0.1" # needed to read the ai server host and port environment variables import os # needed to read the laundry schedule from a file import json # the Highcliff ai_actions we are going to implement from highcliff_sd...
from flask import Flask from flask_wtf.csrf import CSRFProtect app = Flask(__name__) csrf = CSRFProtect(app) @app.route("/") def pagina_inicial(): return "Pipeline-DevOps-video" if __name__ == '__main__': app.run(debug=True)
# coding: utf-8 import requests from bs4 import BeautifulSoup import re import json import os from xml.etree import ElementTree import time import io import pandas as pd import math from gotoeat_map.module import getLatLng, checkRemovedMerchant def main(): merchantFilePath = os.path.dirname( os.path.abspa...
# Django settings for qatrack project. import django.conf.global_settings as DEFAULT_SETTINGS import os #----------------------------------------------------------------------------- # Debug settings - remember to set both DEBUG & TEMPLATE_DEBUG to false when # deploying (either here or in local_settings.py) DEBUG = ...
################ # Dependencies # ################ # Sci import pandas as pd import numpy as np from scipy import stats # General import math import os import string import pickle # Workflow from sklearn.model_selection import GridSearchCV from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline...
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
#!/usr/bin/python """ Description: The DUT CA stands between the Test Manager and WICED, converting CAPI commands from TCP/IP link to WICED console commands through the serial link. """ import serial import io import getopt import sys import time import glob import os import select import termios import fcntl import ...
import pyhomogenize as pyh from ._consts import _bounds, _fmt class PreProcessing: def __init__( self, ds=None, var_name=None, freq="year", time_range=None, crop_time_axis=True, check_time_axis=True, **kwargs, ): if ds is None: ...
from dataclasses import dataclass from .InvoiceOperationList import InvoiceOperationList from .BasicOnlineInvoiceRequest import BasicOnlineInvoiceRequest @dataclass class ManageInvoiceRequest(BasicOnlineInvoiceRequest): """Request type of the POST /manageInvoice REST operation :param exchange_token: The deco...
""" Asserts for system tests. These are meant to be run by the sys_test.py script. """ import unittest import apsw import os class SysTest(unittest.TestCase): testPath = os.path.join(os.path.dirname(__file__), "__test__") dbPath = os.path.join(testPath, "systest.db") axPacket = b'\x9a\x92\x86\xa8\xa4\x98...
from math import sqrt import torch def gaussian_radius(det_size, min_overlap=0.7): # Inherit from CenterTrack height, width = det_size a1 = 1 b1 = (height + width) c1 = width * height * (1 - min_overlap) / (1 + min_overlap) sq1 = sqrt(b1 ** 2 - 4 * a1 * c1) r1 = (b1 + sq1) / 2 a2...
BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBB BBBBBBB XXXXX XXXX X XXXXXX XXXXXX XXXXXXXX BBBBBBBB
""" Tools to create programs-related data for use in bok choy tests. """ from common.test.acceptance.fixtures.config import ConfigModelFixture class ProgramsConfigMixin: """Mixin providing a method used to configure the programs feature.""" def set_programs_api_configuration(self, is_enabled=False): ...
""" TODO: is newline on windows different for python? TODO: dry-run? use logging for printing TODO: treat PART as a custom command http://click.pocoo.org/6/commands/#custom-multi-commands ? """ import logging import logging.config import click from bamp.config import add_config, get_root_path from bamp.engine imp...
# benchmark reads and writes, with and without compression. # tests all four supported file formats. from numpy.random.mtrand import uniform import netCDF4 from timeit import Timer import os, sys # create an n1dim by n2dim by n3dim random array. n1dim = 30 n2dim = 15 n3dim = 73 n4dim = 144 ntrials = 10 sys.stdout.writ...
from django.db.models.base import Model from django.db.models.deletion import CASCADE from django.db.models.fields import CharField, DateTimeField, PositiveIntegerField, TextField, BooleanField from django.db.models.fields.related import ForeignKey from django.contrib.contenttypes.models import ContentType from django....
import pytest import pizdyuk.pzd_errors as errors from pizdyuk.market.core import MarketObjectBase, Action def test_market_object_base(): object_base = MarketObjectBase() with pytest.raises(Exception) as e: object_base.update() assert isinstance(e, errors.PzdNotImplementedError) with pyte...
from django.contrib import admin from myApp import models from aip import AipFace from .views import get_en_name # Register your models here. class DetailGradeSubInline(admin.TabularInline): model = models.UserInformation extra = 0 @admin.register(models.IdentityInformation) class IdentityAdmin(admin.ModelA...
# https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ # # Given a singly linked list where elements are sorted in ascending order, # convert it to a height balanced BST. # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # sel...
import unittest from pgdrive import PGDriveEnv class TestObsActionSpace(unittest.TestCase): def setUp(self): self.env = PGDriveEnv() def test_obs_space(self): obs = self.env.reset() assert self.env.observation_space.contains(obs), (self.env.observation_space, obs.shape) obs, ...
from unittest.mock import patch import google.api_core.exceptions from octue.cloud.pub_sub.service import Service from octue.cloud.pub_sub.topic import Topic from octue.resources.service_backends import GCPPubSubBackend from tests.base import BaseTestCase class TestTopic(BaseTestCase): service = Service(backend...
from django.views import View from django.shortcuts import render, redirect from json import load from django.conf import settings from datetime import datetime with open(settings.NEWS_JSON_PATH, 'r') as f: posts = load(f) class CreateNews(View): def get(self, request): return render(request, "news/cr...
def ln(t = 1): #função que quando executada mostrará uma linha conforme o valor recebido em t. Criada como teste de uso de funções, para diminuir o número de comandos print na tela e para poupar trabalho de reescrever a função print novamente(preguiça que chama :p ) if t == 0: print('=' * 30) elif...
import os import numpy as np from PIL import Image from sklearn.metrics import confusion_matrix # name_list = ['19: Hat', '18: Hair', '17: Glove', '16: Sunglasses', '15: UpperClothes', '14: Dress', '13: Coat', '12: Socks', '11: Pants', # '10: Torso-skin', '9: Scarf', '8: Skirt', '7: Face', '6: Left-arm', ...
# -*- coding: utf-8 -*- # File generated according to Generator/ClassesRef/Simulation/ParamExplorerInterval.csv # WARNING! All changes made in this file will be lost! """Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Simulation/ParamExplorerInterval """ from os import linesep f...
""" How about writing a queue that holds the last 5 items? Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first. A real-world example of queue can be a single-lane one-way road, where the vehicle enters first, exits first. More real-world examples can be seen as queu...
# Copyright 2019 Hathor Labs # # 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, s...
from rest_framework import permissions class UpdateOwnProifle(permissions.BasePermission): """"Allow user update his own profile""" def has_object_permission(self, request, view, obj): """Check user is trying to update his own profile""" if request.method in permissions.SAFE_METHODS: ...
from django.test import TestCase from modeltree.tree import ModelTree from .models import TargetProxy class ProxyModelTestCase(TestCase): def setUp(self): self.tree = ModelTree(model='proxy.Root') def test_without_model(self): f = TargetProxy._meta.pk qs = self.tree.query_string_for_...
"""Feature elimination methods.""" from xfeat.base import SelectorMixin from xfeat.types import XDataFrame from xfeat.utils import analyze_columns, cudf_is_available try: import cudf # NOQA except ImportError: cudf = None class DuplicatedFeatureEliminator(SelectorMixin): """Remove duplicated features."...
"""短信第三方接口""" import random import requests from qcloudsms_py import SmsSingleSender from wsc_django.apps.settings import ( TENCENT_SMS_APPID, TENCENT_SMS_APPKEY, YUNPIAN_SYSTEM_APIKEY, ) # 短信签名 yunpian_sms_common_sign = "【志浩web开发】" tencent_sms_common_sign = "【志浩web开发】" class YunPianSms: """云片短信"""...
import json class Config: def __init__(self, json_path=None): self.reddit_client_id = '' self.reddit_client_secret = '' self.reddit_user_agent = '' self.reddit_username = '' self.reddit_password = '' self.reddit_commentsPerCheck = 100 self.bot_footer = '' ...
from exterminate.Utilities import builtins _range = range def alt_range(start, stop, step=1): return _range(start-2, stop+2, max(1, int(step/2))) builtins.range = alt_range