content stringlengths 5 1.05M |
|---|
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect, render
def home(request):
if request.method == "POST":
username = request.POST['username']
password = request.POST['password']
user = authenticate(request, username=username, password=password)
... |
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.properties import NumericProperty, ListProperty, BooleanProperty
from kivy.graphics import Color, Line
from kivy.uix.image import Image
from kivy.clock import Clock
from compiler import run
import json
class Not(Wi... |
# Copyright 2005 Divmod, Inc. See LICENSE file for details
# -*- test-case-name: vertex.test.test_conncache,vertex.test.test_q2q.TCPConnection.testSendingFiles -*-
"""
Connect between two endpoints using a message-based protocol to exchange
messages lazily in response to UI events, caching the protocol as necessary.
... |
#!/usr/bin/env python
from subprocess import call
import sys
exec_list = [
"python build.py chanff chanff",
"python build.py efs efs/src",
"python build.py FreeRTOS FreeRTOS",
"python build.py lua lua",
"python build.py vcom_rtos vcom_rtos",
"python build.py vcom vcom",
"python build.py lpcusb lpcusb"]
for... |
import numpy as np
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class HistogramAction(object):
def __init__(self):
super().__init__()
# Boolean for local histogram
self.bLocalHistogram = False
... |
# 文件夹测试导入
import sys
sys.path.append("/Users/caiwei/Documents/code/EC-dev/src")
# 导入模块
import ecstorage.dataframe as ec
from pyspark import SparkContext
from pyspark.mllib.linalg.distributed import *
from pyspark.sql import SparkSession
from ecstorage.mathematics.matrix_optimization import sparse
import numpy as np
i... |
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. 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 requir... |
"""Module to compute and calibrate sm2rain."""
import numpy as np
from scipy.optimize import minimize
np.seterr(invalid='ignore')
# handle the case when numba is not available
try:
from numba import jit
_numba_available = True
except ImportError:
_numba_available = False
try:
# optionally add wrapper... |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author : MG
@Time : 2018/7/4 15:44
@File : app.py
@contact : mmmaaaggg@163.com
@desc :
"""
from flask import Flask
from app.config import config
from app.api import api
from app import db, login_manager
app = Flask(__name__)
app.debug = True
# app.config.fro... |
from django.urls import path
from .views import Login
from django.conf.urls import url
from . import views
urlpatterns = [
path('logincustomer/',Login , name='login_customer'),
url(r'^operations/',views.customers,name="customers"),
url(r'^getreadings/(?P<username>[\w.@+-]+)/$',views.getreadings,name=... |
from collections import OrderedDict
from bioprocs.utils import shell2 as shell, FileConn
from bioprocs.utils.reference import vcfIndex
from bioprocs.utils.parallel import Parallel
{% from pyppl.utils import always_list %}
infile = {{i.infile | quote}}
outfile = {{o.outfile | quote}}
sortby = {{args.sortby | quote... |
import os
import sqlite3
DB_FILEPATH = "rpg_db.sqlite3"
connection = sqlite3.connect(DB_FILEPATH)
cursor = connection.cursor()
##test queries
#Add all query results to dictionary
query = """SELECT
count(distinct charactercreator_character.character_id) as total_characters,
count(distinct charactercreator_mage.c... |
'''
Bunch of utility functions shared across the module
'''
import re
from xml.dom import minidom
from xml.etree import ElementTree as ET
def element2string(root):
'''
Converts element into an actual string (not bytes!)
why is this necessary? :sigh:
'''
dom = minidom.parseString(ET.tostring(root)... |
# import json
import json
from django.db.models import QuerySet
from apps.ticket.models import TicketCustomField
from apps.workflow.models import State
from service.base_service import BaseService
from service.common.constant_service import CONSTANT_SERVICE
from service.common.log_service import auto_log
from service... |
import numpy as np
import pickle
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
import math
import scipy.optimize
from uncertainties import ufloat
import scipy
from scipy import signal
path_IMU_data = "/home/jrlab/Desktop/Git/Svalbard_March_2019_IMU_data/look_at_data/... |
# -*- coding: utf-8 -*-
#
# Aaron Li
# 2015/06/19
"""
Class Region for regions on the spherical surface.
Used in astronomy to select/define a certian region, e.g, DS9.
"""
import sys
class Region(object):
"""
Basic region class for regions on the spherical surface,
similar definition as to DS9 regions.
... |
import pytest
import genealloy as ga
def test_make_transition_dictionary():
transition_dictionary = ga.make_transition_dictionary(
ga.aa_to_codon_extended, ga.allowed_aa_transitions
)
assert transition_dictionary["A"] == [
"GGX",
"GCX",
"GTX",
"TTR",
"CTX",... |
from django.contrib.auth import get_user_model
from django.db.utils import IntegrityError
from django.test import TestCase
from accounts.models import Account
User = get_user_model()
class AccountModelTests(TestCase):
"""
These tests should stand alone. We will see if they do as I change
different things... |
from Source.Filter.Butterworth import *
from Source.Plot.PlotFFT import plotFFT
from Source.Plot.PlotSignal import plotSignal
from Source.Plot.Spectrogram import spectrogram
from Source.Tools.FFT import findMaxFreq
# Primer experimento: Leer archivo y graficar señal, FFT, espectrograma, FFT post filtro y espectrograma... |
# -*- coding: utf-8 -*-
from nose.tools import assert_equal, assert_true
from selenium.webdriver.common.by import By
@step('I navigate to the Delivery Club Home page')
def step_impl(context):
context.home_page.navigate("https://delivery-club.ru")
assert_equal(context.home_page.get_page_title(), "u«Delivery Cl... |
__author__ = '@dominofire'
import numpy as np
import utils
from collections import Counter
from functools import reduce
from sweeper.cloud.azure import resource_config_factory as cfg_factory
from sweeper.scheduler.common import get_task_segments, SchedulePlan, ResourceSchedule, ScheduleMapping
def bin_packing(tasks... |
import socket
import threading
import time as t
import msgpack
import random
import sys
import time
PORT = 5050
SERVER = "0.0.0.0"
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!D"
FORWARD_MESSAGE = "!F"
TURN_MESSAGE = "!T"
def move_forward():
t.sleep(2)
print("moving forward")
# pass
def... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make two datasets for RV test: full 2D dataset and half-size 5D dataset.
Created: December 2021
Author: A. P. Naik
"""
import numpy as np
import sys
sys.path.append("../src")
from utils import load_dset
from constants import kpc
if __name__ == "__main__":
# loa... |
# coding: utf-8
"""
Hydrogen Integration API
The Hydrogen Integration API # noqa: E501
OpenAPI spec version: 1.3.1
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2... |
num=int(input("Enter No : "))
def fibo(a,b):
c=0
print("0","1",end=' ')
for i in range(1,num-2):
c=a+b
a=b
b=c
print(c,end=' ')
c=a+b
return c
print(fibo(0,1))
|
import config
import requests
from urllib.parse import urljoin
import io
import json
from urllib.request import pathname2url
import sys
import time
import gzip
#import ipdb; ipdb.set_trace()
class UploadException(Exception):
pass
# save response to a file so can look at it if needed
def save_response(response):
... |
c = [0, 0, 1, 0, 0, 1, 0] # len = 7
#c = [0, 0, 0, 1, 0, 0] # len = 6
i = len(c)
j = 0
jumps = 0
while j < i:
print("jumps: " + str(jumps))
if (j + 2 < i) and c[j + 2] == 0: #safe to skip ahead
j += 1
print("bonus j: " + str(j))
j += 1
print("reg j: " + str(j))
if (j < i):
ju... |
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1:
return 1
result = []
result.append(1)
result.append(2)
for i in range(2, n):
result.append(result[i - 1] + result[i - 2])
... |
# -*- coding: utf-8 -*-
#
# This class was auto-generated.
#
from onlinepayments.sdk.data_object import DataObject
from onlinepayments.sdk.domain.merchant_action import MerchantAction
from onlinepayments.sdk.domain.payment_creation_output import PaymentCreationOutput
from onlinepayments.sdk.domain.payment_response impo... |
import numpy as np
import pandas as pd
from sklearn import preprocessing
import matplotlib.pyplot as plt
np.random.seed(1234)
data=pd.read_csv("data_iris.csv").values
np.random.shuffle(data)
def Scaler(X):
scale=preprocessing.StandardScaler()
scale=scale.fit(X)
return scale ,scale.transform(X)
def inverse(... |
"""
Tests for the vSQL left shift operator ``<<``.
The test are done via the Python DB interface.
To run the tests, :mod:`pytest` is required.
"""
from conftest import *
###
### Tests
###
def test_bool_bool1(config_persons):
check_vsql(config_persons, "app.p_int_none.value << False is None")
def test_bool_bool2... |
# I would like to take advantage of this non-empty file to say 'hello' |
#!/usr/bin/env python3
import argparse
import logging
import os
import struct
import sys
from pathlib import Path
import pvporcupine
_LOGGER = logging.getLogger("wake_porcupine")
def main():
parser = argparse.ArgumentParser(prog="wake_porcupine")
parser.add_argument("keyword", help="Name of or path to keywor... |
# Generated by Django 2.0.7 on 2018-07-13 10:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogs', '0002_comment'),
]
operations = [
migrations.AddField(
model_name='comment',
name='created_at',
... |
import torch
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import gluonnlp as nlp
import numpy as np
from kobert.utils import get_tokenizer
from kobert.pytorch_kobert import get_pytorch_kobert_model
from transformers import AdamW
from... |
from django.contrib.auth.models import User
from tinymce.models import HTMLField
from django.db import models
# Create your models here.
class Pic(models.Model):
pic = models.ImageField(upload_to = "pics/",null = True)
user = models.ForeignKey(User,null=True)
pic_name = models.CharField(max_length = 30,nul... |
from django.db import models
from patient import models as pmodels
from donor import models as dmodels
class Stock(models.Model):
bloodgroup = models.CharField(max_length=10)
unit = models.PositiveIntegerField(default=0)
def __str__(self):
return self.bloodgroup
class BloodRequest(models.Model)... |
import datetime
import decimal
import itertools
import struct
import sys
try:
import lzf
except ImportError:
lzf = None
__all__ = ["loads", "dumps", "pure_python_loads", "pure_python_dumps",
"has_extension"]
if sys.version_info[0] >= 3:
from functools import reduce
_str = unicode = str
... |
from django import forms
from .models import INVESTMENT
class Investment(forms.ModelForm):
class Meta:
model = INVESTMENT
fields = ('investment_date', 'investment_time', 'investment_price', 'investment_amount')
widgets = {
'investment_date': forms.DateInput(
... |
"""
Brute-force k-nearest neighbour recommenders
intended to provide evaluation baselines.
"""
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from recommender import ItemSimilarityRecommender
class KNNRecommender(ItemSimilarityRecommender):
"""
Abstract base class for k-nn recommend... |
import aiohttp
import asyncio
async def get(url):
async with aiohttp.ClientSession() as session:
async with session.get(url, allow_redirects=False) as response:
print(response.status)
print(response.headers)
asyncio.run(get('http://ter.ps/bikinibottom'))
|
def Add(a,b):
return a+b
def Subtract(a,b):
return a-b
def Multiplication(a,b):
return a*b
def Division(a,b):
return a/b
def PrintTest():
return "Hello"
"""
a=float(input("Enter first number: "))
b=float(input("Enter second number: "))
print("Addition of ",a," and ",b," is : ",... |
#%%
#import dependencies
import os
import mxnet as mx
import numpy as np
from matplotlib import pyplot as plt
from mxnet import autograd
from mxnet import gluon
from mxnet import ndarray as nd
from mxnet.gluon import nn
#load cpu context, if using cpu mx.gpu(0)
context = mx.gpu(0)
#%%
# brine for loading anime-faces... |
__author__ = 'Daniel Puschmann'
|
from machine import Pin, PWM
import time
IN1 = PWM(Pin(22), freq = 1000)
IN2 = PWM(Pin(21), freq = 1000)
while True:
# 全速正转(脉冲宽度1023)
IN1.duty(1023)
IN2.duty(0)
time.sleep(2)
# 停止
IN1.duty(0)
IN2.duty(0)
time.sleep(1)
# 半速反转(脉冲宽度512)
IN1.duty(0)
IN2.duty(512)
time.slee... |
from .led_control import LedControl
from .steps_sequence import StepsSequencer
from .manual_actuation import ManualActuation
|
# -*- coding: utf-8 -*-
import Script_reader
import pytest
from app.classes import Mail
'''def test_return_page_numbers_and_distance():
ls = ["", "1", "",'A STUDY IN PINK', '', 'SHOOTING SCRIPT - GREEN AMENDED', '', '18/04/10', '', 'Screen snows and -A blizzard of cuts round various news reports, fast, just', 'sn... |
# Generated by Django 2.2.6 on 2019-11-11 22:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20191111_2244'),
]
operations = [
migrations.AlterField(
model_name='takes',
... |
__version__ = "0.9"
def version():
return __version__
|
# coding:utf-8
import tradingtime as tt
tt.get_trading_status('SA')
# def test_load_tradingtime_json(tt):
# print(tt)
#
#
# def test_sc(tt):
# """
# 测试上海能源交易所的品种
# :param tt:
# :return:
# """
# print(tt.get_trading_status('sc'))
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import maplesoftApp as myapp
# A simple wrapper for gunicorn to find your app.
app = myapp.app |
import asyncio
import os
from random import randint
from meross_iot.http_api import MerossHttpClient
from meross_iot.manager import MerossManager
from meross_iot.model.enums import OnlineStatus
EMAIL = os.environ.get('MEROSS_EMAIL') or "YOUR_MEROSS_CLOUD_EMAIL"
PASSWORD = os.environ.get('MEROSS_PASSWORD') or "YOUR_ME... |
# Copyright 2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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 requi... |
__author__ = 'tinglev@kth.se'
import os
import unittest
import root_path
from modules.steps.find_docker_stack_files import FindDockerStackFiles
class TestFindDockerStackFiles(unittest.TestCase):
def test_walk_repository(self):
root = root_path.PROJECT_ROOT
step = FindDockerStackFiles()
st... |
import pandas as pd
def sents_chars_expected():
return pd.Series(data=["ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"abcdefghijklmnopqrstuvwxyz",
"",
"",
"",
"",
"",
... |
import requests
import json
import models.request as xacml_request
from utils import ClassEncoder
def delegate(subject, action, resource, delegate_addr, own_url):
request = xacml_request.Request(subject, action, resource, own_url)
xacml_json = json.dumps(request, cls=ClassEncoder)
try:
r = request... |
import os
import os.path
import queue
import sys
import threading
import urllib.parse as urlparse
from bs4 import BeautifulSoup
def make_printable(text):
"""
Strips out all non-printable characters from the text, including:
- 0x00 - 0x20, excluding CR, LF and tab
- 0x7F
"""
buffer = []
f... |
import os
from pathlib import Path
import pytest
from annofabcli.annotation.copy_annotation import CopyTargetByInputData, CopyTargetByTask, parse_copy_target
# プロジェクトトップに移動する
os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/../")
data_dir = Path("./tests/data/annotation")
out_dir = Path("./tests/out/annotati... |
from Logic.LogicCondition import LogicCondition
from Logic.LogicGemOffer import LogicGemOffer
from Logic.Data.DataManager import Writer
from Logic.Data.DataManager import Reader
class LogicRankRewardConfig:
def decode(self: Reader):
self.readVint()
self.readVint()
|
# coding: utf-8
"""
Fates List
Current API: v2 beta 3 Default API: v2 API Docs: https://apidocs.fateslist.xyz Enum Reference: https://apidocs.fateslist.xyz/structures/enums.autogen # noqa: E501
OpenAPI spec version: 0.3.0
Generated by: h... |
#!/usr/bin/env python2
from getpass import getpass
from flexlm_app import User, db
user = User()
user_name = raw_input('Enter a user name [admin]:')
if user_name == '':
user_name = 'admin'
user.username = user_name
password1 = getpass('Enter password:')
password2 = getpass('Renter password:')
while password1 !... |
"""main.py"""
main()
|
import datetime
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from konfera.models.abstract import KonferaModel
from konfera.models.room import Room
class ... |
from enum import Enum
class ScrapeMaterial(Enum):
"""
An audio material used for a scrape event.
"""
plywood = 0
ceramic = 1
pvc = 2
rough_wood = 3
acrylic = 4
sanded_acrylic = 5
vinyl = 6
poplar_wood = 7
bass_wood = 8
polycarbonate = 9
polyethylene = 10
sa... |
# -*- coding: utf-8 -*-
print ("Welcome to Python");
print ("Welcome to Computer Science");
print ("Programming is fun");
|
import sys
import os
import pickle
import argparse
import scipy.io as sio
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import numpy as np
import cv2
import math
from torch.autograd import Variable
from data import FACEroot, BaseTransform, FACE
impo... |
#!/usr/bin/env python3
'''
Small leighweight wrapper around libtorrent for
blob distribution
'''
#import asyncio
import click
import logging
import sys
import time
import build
# SystemError: Parent module '' not loaded, cannot perform relative import
#from . import (
# build
#)
#from pathlib import Path... |
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
# pylint: disable=line-too-long
import uuid
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
n1 = cluster.add_instance('n1', main_configs=['configs/remote_servers.xml'])
n2 = cluster.add_instanc... |
# GRID SEARCH
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import GridSearchCV
knn_estimator = KNeighborsClassifier()
parameters = {
'n_neighbors':[2,3,4,5,6,7,8],
'algorithm':['ball_tree', 'kd_tree', 'brute']
}
stratified... |
#sadly my computer is terrible so I cant run the data proccessing component so you must print out what the size of
# ylabels array and put that in damount at line 115 sorry!
import pickle
import matplotlib
matplotlib.use("tkagg")
import binvox_rw
import numpy as np
import tensorflow as tf
sess = tf.Session... |
import json
import os
S3_BUCKET = os.environ["BUCKET_NAME"]
async def write_to_s3(new_file: dict, file_name: str, client) -> None:
key = f"{file_name}.json"
await client.put_object(
Bucket=S3_BUCKET,
Key=key,
Body=json.dumps(new_file),
ContentType="application/json",
... |
from checkov.serverless.checks.function import * # noqa
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
r"""Python wrapper for `Latent Dirichlet Allocation (LDA) <https://en.wikipedia.org/wiki/Latent_Dirichlet_allocation>`_
from `MALLET, t... |
import tensorflow as tf
import numpy as np
from math import cos, sin, pi
import argparse
from tensorflow.python.framework import ops
import lme_custom_ops
import pyconrad as pyc
pyc.setup_pyconrad()
class reco_helper:
@staticmethod
def trajectory(number_of_projections, circle):
rays = np.zeros([number_... |
from django.contrib.auth.models import AbstractUser
from django.db import models
class CustomUser(AbstractUser):
USER_TYPE_CHOICES = (
('client', 'client'),
('photographer', 'photographer'),
)
user_type = models.CharField(max_length=50, choices=USER_TYPE_CHOICES)
email = models.EmailF... |
#!/usr/bin/env python
import json
import os
import sys
from colugo.py.node import Node
class PublisherExample(Node):
def __init__(self, name):
Node.__init__(self, name)
self.publisher = self.add_publisher("json.pub.topic")
self.repeater = self.add_repeater(1000, self.callback)
self... |
import threading
class ThreadSafeCache:
def __init__(self):
self.lock = threading.Lock()
self.cache = {}
def get(self, key, func):
with self.lock:
entry = self.cache.setdefault(key, {
"done": False,
"value": None,
"exception"... |
import base64
from django.contrib.auth import authenticate
def basic_auth(request):
header = "HTTP_AUTHORIZATION"
if header in request.META:
auth = request.META[header].split()
if len(auth) == 2:
if auth[0].lower() == "basic":
uname, passwd = base64.b64decode(auth[1... |
from enum import Enum
from dsp_lab import *
class Process(Enum):
DSP_OPEN_FILE = 0
DSP_SAVE_FILE = 1
DSP_PLOT_TIME_DOMAIN = 2
DSP_PLOT_FREQUENCY_DOMAIN = 3
DSP_FILTER = 4
DSP_ROOT_MEAN_SQUARE_ERROR = 5
def banner():
"""
Banner initial
"""
print("------------------------------... |
from flask import Flask, Blueprint, request, current_app
from flask_login import login_user
from notifications import Notifications, db
from user import User
import json, requests
from datetime import datetime
user_api = Blueprint('user_api', __name__)
@user_api.route("/signup", methods=["POST"])
def signup():
da... |
import signal
import contextlib
@contextlib.contextmanager
def signals_to_exception(signals=(signal.SIGINT, signal.SIGTERM)):
"""Context manager that makes sure that converts system signals to exceptions.
This allows e.g. for a graceful exit after receiving SIGTERM (e.g. through
`kill` on UNIX systems).
... |
# Copyright: 2006 Marien Zwart <marienz@gentoo.org>
# License: BSD/GPL2
from pkgcore import plugins
from pkgcore.scripts import pplugincache
from pkgcore.test.scripts.helpers import ArgParseMixin
from snakeoil.test import TestCase
class CommandlineTest(TestCase, ArgParseMixin):
_argparser = pplugincache.argpars... |
import os
import requests
from bs4 import BeautifulSoup
base_url = 'https://developers.weixin.qq.com'
url = 'https://developers.weixin.qq.com/miniprogram/dev/devtools/devtools.html'
html = requests.get(url)
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, 'lxml')
sidebar = soup.select('.sidebar')[0]
a = si... |
import spikeextractors as se
import os
from pathlib import Path
from ..tools import _run_command_and_print_output, _spikeSortByProperty, _call_command_split
import time
def ironclust(recording, # Recording object
prm_template_name=None, # Name of the template file
by_property=None,
... |
import os
import logging
from logging.handlers import RotatingFileHandler
# Set access.log logging handler, level and format
def set_access_log(app):
logger = logging.getLogger('werkzeug')
accesslog_handler = RotatingFileHandler(
os.path.join(app.config['LOGGING_FOLDER'], 'api_feira_livre-access.log')... |
from xmuda.models.quan_trainer_lmsc import RecNetLMSC
from xmuda.models.quan_trainer import RecNet
from xmuda.models.quan_trainer_seg import RecNetSeg
from xmuda.data.semantic_kitti.semantic_kitti_quan import SemanticKITTISCN
from torch.utils.data.dataloader import DataLoader
import pickle
from xmuda.data.semantic_kitt... |
from torchpack.mtpack.utils.config import Config, configs
configs.train.compression.memory.momentum_masking = True
|
# Copyright 2011 Piston Cloud Computing, 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
#
# Unle... |
"""
A Python module for radar simulation
----------
RadarSimPy - A Radar Simulator Built with Python
Copyright (C) 2018 - 2020 Zhengyu Peng
E-mail: zpeng.me@gmail.com
Website: https://zpeng.me
` `
-:. -#:
-//:. -###:
-////:. ... |
from unittest import TestCase
import unittest
import migemo
class TestMigemo(TestCase):
def test_parse_query(self):
self.assertEqual(['abc'], migemo.Migemo.parse_query('abc'))
self.assertEqual(['a', 'Bc'], migemo.Migemo.parse_query('aBc'))
self.assertEqual(['AB', 'c'], migemo.Migemo.parse_... |
"""Auxiliary functions for statistics."""
import scipy.stats
from functools import lru_cache
from math import sqrt
@lru_cache(maxsize=10)
def confidence_level(nsigma):
r"""Return the confidence level corresponding to a number of sigmas,
i.e. the probability contained in the normal distribution between $-n\sig... |
#
# Standard variables for the models
#
import pybamm
import numpy as np
# Electrolyte concentration
c_e_n = pybamm.Variable(
"Negative electrolyte concentration",
domain="negative electrode",
auxiliary_domains={"secondary": "current collector"},
bounds=(0, np.inf),
)
c_e_s = pybamm.Variable(
"Sepa... |
#!/usr/bin/python3
"""
Contains the class BaseGeometry and subclass Rectangle
"""
Rectangle = __import__('9-rectangle').Rectangle
class Square(Rectangle):
"""A representation of a square"""
def __init__(self, size):
"""instantiation of the square"""
self.integer_validator("size", size)
... |
import pyaes
import os
import hashlib
def szyfruj(nazwa_pliku_do_zaszyfrowania, klucz):
file_in = open(nazwa_pliku_do_zaszyfrowania, 'rb')
klucz = hashlib.sha256(klucz).digest()[:32]
file_out = open('tmp.txt', 'wb+')
mode = pyaes.AESModeOfOperationCTR(klucz)
pyaes.encrypt_stream(mode, file_in, fil... |
from django.test import TestCase
from django.forms.models import model_to_dict
from nose.tools import eq_, ok_
from services_areas.serializers import ServiceAreaSerializer
from services_areas.test.factories import ServiceAreaFactory
class TestCreateUserSerializer(TestCase):
def setUp(self):
self.service... |
# @Author: Justin C Presley
# @Author-Email: justincpresley@gmail.com
# @Project: NDN Storage
# @Source-Code: https://github.com/justincpresley/ndn-python-storage
# @Pip-Library: https://pypi.org/project/ndn-storage
# Change Notice! This file oringinates from another repository.
# Please look at CHANGES... |
import unittest
import numpy
import pyaccel
import trackcpp
import models
class TestTwiss(unittest.TestCase):
def setUp(self):
self.accelerator = models.create_accelerator()
self.accelerator.cavity_on = True
self.accelerator.radiation_on = False
twiss, *_ = pyaccel.optics.calc_tw... |
# -*- coding: utf-8 -*-
""" Helper functions for fetching and loading catalog"""
import importlib
import json
import logging
import sys
from pathlib import Path
from urllib.parse import ParseResult, urlparse, urlunparse
import pandas as pd
import requests
logger = logging.getLogger('intake-esm')
handle = logging.Stre... |
from convlab2.util.analysis_tool.analyzer import Analyzer
from convlab2.nlu.jointBERT.multiwoz import BERTNLU
from convlab2.nlu.svm.multiwoz import SVMNLU
from convlab2.dst.rule.multiwoz import RuleDST
from convlab2.policy.rule.multiwoz import RulePolicy
from convlab2.nlg.template.multiwoz import TemplateNLG
from convl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.