content
stringlengths
5
1.05M
# Direct CAD entry for Mitutoyo calipers via USB HID emulation. # Assuming a Serpente board, with `req`, `clock`, `data` and `ready` connected to # D0, D1, D2 and D3, respectively. import time import board import digitalio import mitutoyo import usb_hid from adafruit_hid.keyboard import Keyboard from adafruit_hid.key...
# calculate the z-score for each individual by two type isoform's junction reads # 20170522 filter the min reads counts: 25% sample's reads counts >= 1 # added postfix # 20170626 change the filter method # 20170705 change the filter method to left in out # individual sum count must > 5 # rema...
'''Defines blueprints and routes for the app''' from flask import Blueprint from flask_restful import Api, Resource from .views.users import Signup BLUE = Blueprint('api', __name__, url_prefix="/api/v1") API = Api(BLUE) API.add_resource(Signup, '/auth/signup')
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, s, d = map(int, input().split()) for i in range(n): xi, yi = map(int, input().split()) if xi < s and yi > d: print("Yes") exit() print("No") if __name__ == "__main__": ma...
import komand from .schema import ListAlertsInput, ListAlertsOutput # Custom imports below class ListAlerts(komand.Action): def __init__(self): super(self.__class__, self).__init__( name='list_alerts', description='List Carbon BlackLi alerts with given parameters', ...
#!/usr/bin/python # coding=utf-8 ################################################################################ from mock import Mock from mock import patch from test import CollectorTestCase from test import get_collector_config from test import unittest from urllib2 import HTTPError from diamond.collector import ...
# coding: utf-8 import click from datetime import datetime import re import shortuuid from werkzeug.security import generate_password_hash from app import db from app import get_db_cursor from grid_id import GridId from institution import Institution from package import Package from permission import Permission from p...
import difflib from bs4 import BeautifulSoup from selenium import webdriver from time import sleep import itertools import requests import re import sqlite3 import jellyfish conn = sqlite3.connect('bazadanych.db') c = conn.cursor() def forbet_teams(): driver = webdriver.Firefox() driver.get...
filas = int(input("Ingrese el número de filas de la matriz: ")) columnas = int(input("Ingrese el número de columnas de la matriz: ")) matriz = [] for m in range(filas): matriz.append([]) for n in range(columnas): matriz[m].append(int(input(f"Ingrese el valor de la columna {n} de la fil...
import glob import os from setuptools import setup, find_packages here = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(here, "README.md")) as f: long_description = f.read() setup( name="spire-pipeline", version="1.2.0", description="Run software pipelines using doit", lon...
from sensors.range_finder import UltrasonicRangeFinder from multiprocessing import Queue, Value import threading import logging import unittest from util.definitions import GPIO_ULTRASONIC_ECHO, GPIO_ULTRASONIC_TRIGGER # In order to execute this test, an ultrasonic range finder has to be connected to th...
from django.shortcuts import render from moviesapp.models import Movies from moviesapp.forms import MoviesForm def index(request): return render(request, 'moviesapp/index.html') def moviesList(request): moviesList=Movies.objects.all() movies_dict={'movies':moviesList} return render(request, 'moviesapp...
from django.apps import AppConfig class DelayConfig(AppConfig): name = "channels.delay" label = "channels.delay" verbose_name = "Channels Delay"
from .twitter import TwitterReviews from .imdb import IMDBReviews from .ny_times import NYTimesReviews __all__ = ['TwitterReviews', 'IMDBReviews', 'NYTimesReviews']
# -*- coding: utf-8 -*- """ This tokenizer has been copied from the ``tokenize.py`` standard library tokenizer. The reason was simple: The standard library tokenizer fails if the indentation is not right. The fast parser of jedi however requires "wrong" indentation. Basically this is a stripped down version of the sta...
import thredo def func(x, y): return x + y def main(): t = thredo.spawn(func, 2, 3) print("Result:", t.join()) thredo.run(main)
# -*- coding: utf-8 -*- # # Copyright 2020-2021 -Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in co...
""" The ``planning`` package contains the planning steps for initial and rolling wave planning. It creates a ``PlanningCreator`` and calls the methods to set the Gurobi variables and constraints. It runs the planner afterwards and saves the plans. The implementations of the ``PlanningCreator`` (initial and rolling wav...
''' /vg/station-specific fixes. ''' from .base import Matcher,MapFix,RenameProperty,DeclareDependencies,ChangeType from byond.basetypes import BYONDString, BYONDValue, Atom, PropertyFlags from byond.directions import * DeclareDependencies('vgstation',['ss13']) ATMOSBASE = '/obj/machinery/atmospherics' @MapFix('vgsta...
import pytest from bearboto3.iam import ( InstanceProfileExistsWaiter, UserExistsWaiter, RoleExistsWaiter, PolicyExistsWaiter, ) from beartype import beartype from beartype.roar import ( BeartypeCallHintPepParamException, BeartypeCallHintPepReturnException, BeartypeDecorHintPep484585Exceptio...
__author__ = 'hunter'
# # PySNMP MIB module Nortel-Magellan-Passport-HdlcTransparentMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-HdlcTransparentMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:17:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by use...
from bs4 import BeautifulSoup, Tag import os from abc import ABC, abstractmethod from typing import List, Dict, NoReturn class Csskrt(ABC): def __init__(self, filename: str, tag_styles: Dict): f = open(filename) # should be able to handle dirs (for later) todo f_data = f.read() self.file...
import tensorflow as tf import tensorflow_hub as hub import numpy as np from nboost.plugins.models.rerank.base import RerankModelPlugin from nboost import defaults from typing import List, Tuple class USERerankModelPlugin(RerankModelPlugin): def __init__(self, **kwargs): super().__init__(**kwargs) ...
from yolov3.config.defaults import get_default_config
#!/usr/bin/env python """ztc.vm.memory tests""" import unittest from ztc.vm.memory import Memory class Test(unittest.TestCase): def test_get_active(self): m = Memory() assert isinstance(m.active, long) if __name__ == "__main__": #import sys;sys.argv = ['', 'Test.testName'] unittest.ma...
import cv2 import argparse from datetime import datetime import sys def do_capture(args): print("Capturing", args.url) capture=cv2.VideoCapture(args.url) i = 0 while True: if args.nframes is not None and i >= args.nframes: print("Done") break i += 1 fram...
#!/usr/local/bin/python #========================================================================== # Ingest a given scripps dataset into the corresponding databases. # To be invoked by the overall scripps_ingest.py using subprocess, # destination data directory and temporary working directory are defined in # proper...
################################################################################ # # qooxdoo - the new era of web development # # http://qooxdoo.org # # Copyright: # 2006-2009 1&1 Internet AG, Germany, http://www.1und1.de # # License: # MIT: https://opensource.org/licenses/MIT # See the LICENSE file in the...
#!/usr/bin/env python3 import sys import functools def parse_tile(s): lines = s.split('\n') tile_id = int(lines[0].strip(':').split()[1]) return tile_id, list(map(list, lines[1:])) def read_tiles(): blocks = sys.stdin.read().strip().split("\n\n") return {tile_id: tile for tile_id, tile in map(...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import config import time module = 'separable_adapter' # specific module type for universal model: series_adapter, parallel_adapter, separable_adapter trainMode = 'universal' from sync_batchnorm import SynchronizedBatchNorm3d ''' Inp...
""" @author: Arpit Somani """ #Import the required modules import numpy #Creating the platform, where we play the game. board= numpy.array([['_','_','_'],['_','_','_'],['_','_','_']]) #We have 2 symbols , as its a 2 player game p1s= 'X' p2s= 'O' #Checking for empty place in rows def check_row...
# segmented sieve from __future__ import annotations import math def sieve(n: int) -> tuple: """ >>> sieve(2 **3) (2, 3, 5, 7) >>> sieve(3 ** 3) (2, 3, 5, 7, 11, 13, 17, 19, 23) >>> sieve(4) (2, 3) """ in_prime = [] start = 2 end = int(math.sqrt(n)) temp = [True] * ...
# Generated by Django 3.0.5 on 2020-04-23 10:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('payment', '0001_initial'), ] operations = [ migrations.AddField( model_name='payment', name='payment_type', ...
import torch import torch.nn as nn import torch.functional as F import torch.optim as optim from random import randint import argparse from datetime import datetime import os import numpy as np from time import time from collections import defaultdict from gnn_cnn_model.deepwalks import * from gnn_cnn_model.model impo...
#!/usr/bin/env python """ Compute the DSigma profiles for different lenses """ import os import pickle from astropy.table import Table from jianbing import scatter from jianbing import wlensing TOPN_DIR = '/tigress/sh19/work/topn' # Lensing data using medium photo-z quality cut s16a_lensing = os.path.join(TOPN_DIR...
""" File name: __init__.py Author: Lukas Müller Python Version: 3.6 """ from .lfsr import LFSR from .fsr_function import FSRFunction from .nlfsr import NLFSR from .tools import logical_and, logical_xor name = "pyfsr" version = "1.0"
from unittest import TestCase from hamcrest import assert_that, is_ from util.string_util import replace_not_alphanumeric, normalize, remove_multi_spaces, create_filename, replace_numeric, \ contains_numeric class TestStringUtils(TestCase): def test_remove_multi_spaces(self): assert_that(remove_mul...
from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from django.urls import include from django.views.generic import TemplateView import django_cas_ng.views urlpatterns = [ path("admin/", admin.site.urls), path( "ope...
from flask import Flask, g, render_template, flash, redirect, url_for, abort, send_file, request, jsonify from flask_bcrypt import check_password_hash from flask_login import LoginManager, login_user, logout_user, login_required, current_user from flask_admin import Admin, AdminIndexView, BaseView, expose from flask_a...
''' Recursion We're going to take a break from our tour of data structures in order to look at the concept of recursion. Recursion is going to be a useful tool for solving some of the problems we'll be tackling later on, and this is a good place to introduce it and get some practice using it with the data structures we...
"""Tests for the fixes of CNRM-CM6-1.""" import os import iris import numpy as np import pytest from netCDF4 import Dataset from esmvalcore.cmor._fixes.cmip6.cnrm_cm6_1 import Cl, Clcalipso, Cli, Clw from esmvalcore.cmor.fix import Fix from esmvalcore.cmor.table import get_var_info @pytest.fixture def cl_file(tmp_p...
#!/usr/bin/env python # -*- coding utf-8 -*- # # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Author: Markus Ritschel # eMail: kontakt@markusritschel.de # Date: 03/04/2019 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # from __future__ import division, print_function, absolute_import from mpi_icelab_routines.arduino import read_ardui...
from .code_actions import actions_manager from .code_actions import CodeActionOrCommand from .core.logging import debug from .core.protocol import Diagnostic from .core.protocol import Request from .core.registry import LspTextCommand from .core.registry import windows from .core.sessions import SessionBufferProtocol f...
from django import forms #from pagedown.widgets import PagedownWidget from apps.saas.models import Offer class OfferForm(forms.ModelForm): #content= forms.CharField(widget=PagedownWidget(show_preview=False)) #publish= forms.DateField(widget=forms.SelectDateWidget) class Meta: model = Offer fields= [ "tipo_...
from pathlib import Path, PurePath import re import json import copy import logging from sc2_tournament_analysis.defaults import standard_player_match from sc2_tournament_analysis.handle_replay import handle_replay def recursive_parse( *, sub_dir=None, data_function, player_match=None, identifier_...
# Interpretable cnn for big five personality traits using audio data # # Parameters initalization # NUM_FRAMES = 208 # No of Frames for summary spectrogram. NUM_BANDS = 64 # No of frequency bands for mel-spectrogram. # Model hyperparameters. INIT_STDDEV = 0.01 # Standard deviation used to initialize weights. LEARNI...
fichier = open("/run/media/Thytu/TOSHIBA EXT/PoC/Smartshark/DS/test_ds_DDOS.csv", "r") pos = 13 #pos to flatten def flat_line(line, target): index = 0 pos = 0 for l in line: print(l, end="") pos += 1 if (l == ','): index += 1 if index == target: brea...
class Attachment: def __init__( self, id, filename, size, url, proxy_url, **kwargs ): self.id = id self.filename = filename self.size = size self.url = url self.proxy_url = proxy_url if 'height' in kwargs....
from pathlib import Path from tempfile import NamedTemporaryFile import numpy as np import pandas as pd import pytest from etna.datasets import generate_ar_df @pytest.fixture def base_pipeline_yaml_path(): tmp = NamedTemporaryFile("w") tmp.write( """ _target_: etna.pipeline.Pipeline ...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: message.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 imp...
########################################################################## # MediPy - Copyright (C) Universite de Strasbourg # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for de...
# # # # # # # # # # # # # # # # # # # # Pi Radio # # By # # Jackson # # Hoggard # # (c)2018 # # # # # # # # # # # # # # # # # # # # import os, argparse, random from colorama import Fore, Back, Style from multiprocessing import Process parser = argparse.ArgumentParser(pr...
import struct, base64 import numpy as np mdmr_dtypes = { 0: 's', 1: 'I', 2: 'q', 3: 'f', 4: 'd'} # output of test_encode b64data = """TURNUjAwMDECAAAABAAAAKUAAAAAAAAABAAAADcAAAAAAAAAAAAAAAAAAAB47j1cctzBv2t9kdCWc8G/fSJPkq6ZwL/PSe8bX3u+v6TC2EKQg7q/6iEa3UHstL8YQznRrkKqv4NuL2mM1oG/GEM50a5Cqj96Nqs+V1vBPxR5knTN5M8/yol2FVJ+...
from app import app from config import MONGO_URI, client from flask import session, request, jsonify import pymongo import requests import json from datetime import datetime # 連進MongoDB db = client['aiboxdb'] @app.route('/api/android/getRemind', methods=['GET']) def android_get_remind(): '''取得沒有user_nickname(未登入)...
from pathlib import Path from typing import Tuple, Callable, Union ReadPaths = Union[Tuple[Path], Tuple[Path, Path]] def _make_paired_paths( dir_path: Path, paired: bool, mkstr: Callable[[int], str] ) -> ReadPaths: path1 = dir_path/mkstr(1) return (path1, dir_path/mkstr(2)) if paired ...
import json from lib import action class VaultWriteAction(action.VaultBaseAction): def run(self, path, values): return self.vault.write(path, **json.loads(values))
import numpy as np import operator def TI_Forward_Neighborhood(D, p, Eps): """ .""" seeds = [] forwardThreshold = p.dist + Eps # You have to declare the list to traverse. # First is the index with element "p" # Items are selected from start to item "p" # And finally it turns around in...
import time import os from coala_utils.decorators import enforce_signature from coalib.output.printers.LogPrinter import LogPrinterMixin from coalib.misc.CachingUtilities import ( pickle_load, pickle_dump, delete_files) class FileCache: """ This object is a file cache that helps in collecting only the ch...
from flask import Flask from flask import render_template, url_for, request import datetime from person import Person from my_lib import get_week from parser_price import Parser_price from head_hunter_vacancies import HeadHunter_vacancies from bd_apartment import Appartment_BD from sqlalchemy import create_engine fro...
#from __future__ import absolute_import from celery import shared_task #from celery.contrib import rdb #DEBUG @shared_task def myflqTaskRequest(analysisID): from django.conf import settings from myflq.models import Analysis,AnalysisResults from django.core.files import File import subprocess,time,tempf...
import json from importlib import resources import requests import explorer from explorer import configs from explorer.enums.fields_enum import FieldsEnum as fields from explorer.utils.parsing import ResponseParser as parser class BlockchainExplorer: def __new__(cls, api_key: str, net: str, prefix: str): ...
import feedparser import justext import requests import sys from database import Database from bs4 import BeautifulSoup import re import mistune from unidecode import unidecode def get_text_from_reuters(link): response = requests.get(link) resText = response.content.decode("UTF-8", 'ignore') soup = Beautif...
from typing import Dict, Type from .setting import Setting class SettingRegistry: def __init__(self): self._registry: Dict[Type, Type[Setting]] = {} def register_setting(self, type_hint: Type, setting_cls: Type[Setting]): self._registry[type_hint] = setting_cls def get_setting_class_for...
import boto3 from botocore.exceptions import ClientError from .config import s3, bucket_name import logging log = logging.getLogger("my-logger") def generate_presigned_url(s3_client, client_method, method_parameters, expires_in): """ Generating a presigned Amazon S3 URL that can be used to perform an action...
#!/usr/bin/env pytest-3 # -*- coding: utf-8 -*- # # This file is part of the minifold project. # https://github.com/nokia/minifold __author__ = "Marc-Olivier Buob" __maintainer__ = "Marc-Olivier Buob" __email__ = "marc-olivier.buob@nokia-bell-labs.com" __copyright__ = "Copyright (C) 2018, Nokia" __license__ ...
import numpy as np import matplotlib.pyplot as plt #Für jeden Wert in der Liste neuen e-Wert errechnen def e_function(my_list): return [np.exp(val) for val in my_list] #Funktion plotten def plot_func(x, y, farbe, windowName): plt.figure(windowName) plt.plot(x, y, color=farbe) plt.title("My Image") ...
from recon.core.module import BaseModule import re class Module(BaseModule): meta = { 'name': 'Shodan Hostname Enumerator', 'author': 'Tim Tomes (@LaNMaSteR53)', 'description': 'Harvests hosts from the Shodan API by using the \'hostname\' search operator. Updates the \'hosts\' table with t...
from .imports import * def bn_drop_lin(inp, n_out, bn=True, p=0., actn=None): out = inp if bn: out = BatchNormalization()(out) if p>0: out = Dropout(p)(out) use_bias = False if bn else True out = Dense(n_out, activation=actn, use_bias=use_bias)(out) return out
# -*- coding: utf-8 -*- highestNumber = -1 highestNumberPosition = -1 for i in range(100): number = int(input()) if number > highestNumber: highestNumber = number highestNumberPosition = i + 1 print(highestNumber) print(highestNumberPosition)
import requests, re def fbvid(url): req=requests.get(url) if req.status_code == 200: try: return {"status":True,"url":re.search('hd_src:"(.+?)"', req.text)[1]} except TypeError: return {"status":False,"msg":"private_video"} else: return {"status":False,"msg":...
import pandas as pd import numpy as np import datetime import numba import time import os def cummul(array): temp = 1 ret = [] for element in array: temp *= element ret.append(temp) return np.array(ret) def listdirs(folder): return [ d for d in (os.path.join(folder, d1) fo...
text = input("entrez une chaine de caracteres : ") isPalindromic = text[0] == text[len(text) - 1] i, j = 0, len(text)- 1 while i < j and isPalindromic: isPalindromic = text[i] == text[j] i, j = i + 1, j - 1 print(isPalindromic)
from kivy.app import App from kivy.lang import Builder from kivy.uix.boxlayout import BoxLayout from kivy.clock import Clock from kivy.app import App from kivy.lang import Builder from kivy.uix.label import Label from kivy.properties import ListProperty from kivy.uix.behaviors import ButtonBehavior import urllib.requ...
#!/bin/python3 import json import os import sys import io import time from specimen import specimen from growlab_v1_http_client import growlab_v1_http_client from readingsbuilder import readingsbuilder from pathbuilder import pathbuilder if __name__ == "__main__": print("Starting growlab") config = {} t...
#!/usr/bin/env python # encoding: utf-8 class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ r = 0 hd...
import atexit from pathlib import Path from typing import Dict, Union from .template import BaseTemplate from .exceptions import NotFoundError class MemoryEngine(object): _data: Dict _path: Path _template: BaseTemplate def __init__(self, path: Union[Path, str], template: BaseTemplate, auto_load=True...
#!/usr/bin/python #Libraries import RPi.GPIO as GPIO import time #GPIO Mode (BOARD / BCM) GPIO.setmode(GPIO.BCM) #set GPIO Pins GPIO_TRIGGER = 18 GPIO_ECHO = 24 GPIO_IR = 6 #set GPIO direction (IN / OUT) GPIO.setup(GPIO_TRIGGER, GPIO.OUT) GPIO.setup(GPIO_ECHO, GPIO.IN) GPIO.setup(GPIO_IR, GPIO.IN, pull_up_down=GPI...
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from projects.tokens import token_generator from rest_framework import permissions class HasAPIAccess(permissions.BasePermission): """ """ message = _('Invalid or missing API Key.') def has_permission(self, request, view): ...
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
#!/usr/bin/env python import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # A script to test the mask filter. # replaces a circle with a color # Image pipeline reader = vtk.vtkPNMReader() reader.ReleaseDataFlagOff() reader.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/earth.ppm") reade...
""" Testing area package """ from shapes.square.area import area_square from shapes.square.perimeter import perimeter_square import pytest def test_square_area(): """ testing function area_square """ length = 2 A = area_square(length) assert pytest.approx(A) == 4.0 def test_square_perimeter...
from dataset import FontData, make_tfrecodes gspath='gs://your-bucket-name/' def make1(): d = FontData() make_tfrecodes(d, gspath, 512, 64, 8, train=True) make_tfrecodes(d, gspath, 512, 64, 8, train=False) if __name__ == "__main__": make1()
import zipfile import pytest from git_taxbreak.modules.writer import Writer @pytest.fixture def patch_zip_file(monkeypatch): class ZipFileMock(zipfile.ZipFile): def __init__(self, *args, **kwargs): self.output = args[0] self.content = [] def __enter__(self): r...
import sys import shutil from pathlib import Path import logging from pcv import DEFAULTS_PATH, CALLER_PATH, SOURCE, STATIC, DIST """ Initializes a pcv project in the current folder. Run from command line: python -m pcv.start This will create the following directory tree in the current folder: ....
import numpy as np import PatternToNumber def computing_frequencies(text, k): m = 4**k frequency_array = np.zeros(shape = (1, m), dtype = int) for i in range(len(text) - k + 1): pattern = text[i:i+k] j = PatternToNumber.pattern_to_number(pattern) frequency_array[0 , j] = frequency_array[0, j] + 1 return...
# Copyright(C) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Dict, List import numpy as np import xarray as xr from .base_jags_impl import BaseJagsImplementation class RobustRegression(BaseJagsImplementation): def __init__(self, **attrs: Dict) -> None: self.attrs = attrs ...
import discord import os from keep_alive import keep_alive client = discord.Client() @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) @client.event async def on_message(message): if message.author == client.user: return if str(message.author) in ["robbb...
""" Command line utility for repository """ import fire from repo_utils import get_repository_path import os import importlib # This will make available all definitions found under the same package that this file is found. # This allows making a command line out of any package with the repo_utils template by putting s...
from random import choice from typing import Union from datetime import datetime from discord import User, Member, Embed from discord.ext import commands from bot.main import NewCommand class Hug(commands.Cog): def __init__(self, client): self.client = client def randomise(self, users:list): ...
from django.core.urlresolvers import reverse from django.test import TestCase from django.utils import timezone from transductor.models import EnergyTransductor, TransductorModel class EnergyTransductorViewsTestCase(TestCase): def setUp(self): t_model = TransductorModel() t_model.name = "TR 4020" ...
''' Created on March 30, 2018 @author: Alejandro Molina ''' import numpy as np from spn.algorithms.StructureLearning import get_next_operation, learn_structure from spn.algorithms.Validity import is_valid from spn.algorithms.splitting.Clustering import get_split_rows_KMeans, get_split_rows_TSNE from spn.algorithms.s...
__version__ = "0.0.1" from ._widget import LiveIDS from .video_ui import initui
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('eventlog', '0037_auto_20180911_1252'), ] operations = [ migrations.RemoveField( model_name='celerytaskprogress',...
import pytest from kaneda.backends import BaseBackend class DummyBackend(BaseBackend): reported_data = {} def report(self, name, metric, value, tags, id_=None): payload = self._get_payload(name, value, tags) payload['metric'] = metric self.reported_data[name] = payload @pytest.fixt...
#!/usr/bin/env python """ Copy one netCDF file to another with compression and sensible chunking Adapted from nc3tonc4 https://github.com/Unidata/netcdf4-python/blob/master/utils/nc3tonc4 """ from netCDF4 import Dataset import numpy as np import numpy.ma as ma import os import sys import math import op...
#!/usr/bin/python3 __author__ = 'yangdd' ''' example 034 ''' def hello_world(): print('Hello World') def three_hello(): for i in range(3): hello_world() if __name__ == '__main__': three_hello()
from xml.etree import ElementTree import csocha from . import board, moves class GameState: def __init__(self, c: str, t: int, b: board.Board, undep: list): self.color = c self.opponent = "BLUE" if c == "RED" else "RED" self.turn = t self.board = b self.undeployed = undep ...
from fastapi import FastAPI TAREFAS = [ {"id": 1, "titulo": "Cristiano"}, {"id": 2, "titulo": "Araujo"} ] app = FastAPI() @app.get('/tarefas') def listar(): return TAREFAS
import string from model_mommy import mommy from datetime import datetime from django_rq import job from django.contrib.auth.models import User from django.utils import timezone from dateutil.parser import parse as extract_date from django.conf import settings from survey.models import * from survey.utils.decorators im...