content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
import pytest
import numpy.testing as npt
from xbout.load import _auto_open_mfboutdataset
class TestAccuracyAgainstOldCollect:
@pytest.mark.skip
def test_single_file(self):
from boutdata import collect
var = 'n'
expected = collect(var, path='./tests/data/dump_files/single',
... | python |
import numpy as np
import logging
logger = logging.getLogger(__name__)
def create_model(args, initial_mean_value, overal_maxlen, vocab):
import keras.backend as K
from keras.layers.embeddings import Embedding
from keras.models import Sequential, Model
from keras.layers.core import Dense, Dropout, Activation
fr... | python |
from plugins import * # Importing all the plugins from plugins/ folder
from settings_base import BaseSettings # Importing base settings
class BotSettings(BaseSettings):
# See README.md for details!
USERS = (
("user", "ТУТ ТОКЕН ПОЛЬЗОВАТЕЛЯ",),
)
# Default settings for plugins
DEFAULTS[... | python |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
from abc import ABC
from settings import config
from peewee import SqliteDatabase, MySQLDatabase, Model
class SqliteFKDatabase(SqliteDatabase, ABC):
def initialize_connection(self, conn):
self.execute_sql('PRAGMA foreign_keys=ON;')
db = MySQLDatabase(host=... | python |
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | python |
from astroquery import alfa
# Test Case: A Seyfert 1 galaxy
RA = '0h8m05.63s'
DEC = '14d50m23.3s'
def test_alfa_catalog():
cat = alfa.get_catalog()
def test_alfa_spectrum():
sp = alfa.get_spectrum(ra=RA, dec=DEC, counterpart=True)
if __name__ == '__main__':
test_alfa_catalog()
test_alfa_spectrum()
... | python |
from PyQt5.QtWidgets import QMainWindow,QMessageBox
from PyQt5.QtGui import QImage,QPixmap
from istanbul_city_surveillance_cameras_Gui_python import Ui_MainWindow
from src.camera_list import selected_camera
from src.yolov4_pred import YOLOv4
import os
import time
import cv2
class istanbul_city_surveillance_cameras(QM... | python |
# Copyright 2018 The trfl Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | python |
#!/usr/bin/env python
import os
from pathlib import Path
import flash
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
datadir = Path("/kaggle/input")
from flash.core.utilities.imports import _ICEVISION_AVAILABLE
from flash.image.data import IMG_EXTENSIONS, NP_EXTENSIONS, i... | python |
# -*- coding: utf-8 -*-
'''
Das eigentliche starten der app wird über run erledigt
'''
__author__ = "R. Bauer"
__copyright__ = "MedPhyDO - Machbarkeitsstudien des Instituts für Medizinische Strahlenphysik und Strahlenschutz am Klinikum Dortmund im Rahmen von Bachelor und Masterarbeiten an der TU-Dortmund / FH-Dortmu... | python |
import open3d as o3d
import numpy as np
import random
import copy
from aux import *
import aux.aux_ekf as a_ekf
from aux.aux_octree import *
from aux.qhull_2d import *
from aux.min_bounding_rect import *
from aux.aux_voxel_grid import *
import matplotlib.pyplot as plt
import pickle
from timeit import default_timer as ... | python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains definitions for tags in Artella
"""
from __future__ import print_function, division, absolute_import
__author__ = "Tomas Poveda"
__license__ = "MIT"
__maintainer__ = "Tomas Poveda"
__email__ = "tpovedatd@gmail.com"
import ast
import string
imp... | python |
#!/bin/env python
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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 r... | python |
import argparse
from transcribeUtils import *
from webvttUtils import *
import requests
from videoUtils import *
from audioUtils import *
# Get the command line arguments and parse them
parser = argparse.ArgumentParser(
prog="testWebVTT.py",
description="Process a video found in the input file, proc... | python |
from basis.setting import PERIODS
from basis.assistant import getID
import progressbar
ALL_PERIODS = []
for i in range(len(PERIODS)-1):
ALL_PERIODS.append({"from":{"hour":PERIODS[i][0],"minute":PERIODS[i][1]},"to":{"hour":PERIODS[i+1][0],"minute":PERIODS[i+1][1]}})
def getperiodsIndex(all_periods):
time_dics ... | python |
import logging
logging.basicConfig()
logger = logging.getLogger('led_detection')
logger.setLevel(logging.DEBUG)
from .api import *
from .unit_tests import *
from .algorithms import *
| python |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
def transform(logdata):
headers = logdata['httpRequest']['headers']
if len(headers) > 0:
logdata['httpRequest']['header'] = {}
for header in headers:
key = header['name'].lower().re... | python |
from django.contrib import admin
from app.models import UserProfileInfo
admin.site.register(UserProfileInfo)
| python |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Tag'
db.create_table(u'tagging_tag', (
(u'id'... | python |
#! /usr/bin/env python
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... | python |
import re
from isic_archive.models.dataset_helpers import matchFilenameRegex
def assertMatch(originalFilename, csvFilename):
"""Assert that the filename in the CSV matches the original filename."""
regex = matchFilenameRegex(csvFilename)
assert re.match(regex, originalFilename) is not None
def assertNo... | python |
# ------------------------------------------------------------------------------
# pose.pytorch
# Copyright (c) 2018-present Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# -----------------------------------------------------------------... | python |
from django.urls import path
from .views import (
FollowAPIView,
FollowersListAPIView,
FollowingListAPIView,
UserListAPIView,
UserProfileAPIView,
UserRetrieveUpdateDeleteAPIView,
UserRegisterAPIView,
UserLoginAPIView, confirm_email,
password_reset_request, password_reset_... | python |
import ast
import sys
from pyflakes import checker
from pyflakes.test.harness import TestCase, skipIf
class TypeableVisitorTests(TestCase):
"""
Tests of L{_TypeableVisitor}
"""
@staticmethod
def _run_visitor(s):
"""
Run L{_TypeableVisitor} on the parsed source and return the visi... | python |
from dotenv import load_dotenv
import os
load_dotenv()
client = os.getenv("CLIENT_ID")
secret = os.getenv("CLIENT_SECRET")
def printenvironment():
print(f'The client id is: {client}.')
print(f'The secret id is: {secret}.')
if __name__ == "__main__":
printenvironment() | python |
import re
from fsrtools.simulation_tools._manager_utils import integer_filter
def product_combination_generator(iterate_dict):
total_length = 1
length_dict = {}
combination_list = []
if len(iterate_dict.keys()):
for key in iterate_dict.keys():
length_dict[key] = len(iterate_dict[ke... | python |
############### usha/ssd_distplot_seaborn.ipynb
import csv
import os.path
my_path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', '..'))
path = os.path.join(my_path, 'documents/Leadss.csv')
fpath = os.path.join(my_path, 'static/images/distplot')
import pandas as pd
import numpy as np
import seaborn ... | python |
{
"includes": [
"../common.gypi"
],
"targets": [
{
"target_name": "libgdal_jpeg_frmt",
"type": "static_library",
"sources": [
"../gdal/frmts/jpeg/jpgdataset.cpp",
"../gdal/frmts/jpeg/libjpeg/jcapimin.c",
"../gdal/frmts/jpeg/libjpeg/jcapistd.c",
"../gdal/frmts/jpeg/libjpeg/jccoefct.c",
... | python |
import datetime
import numpy as np
import cv2
import pickle
import face_recognition
# -------------------------------------------------------------------
# Parameters
# -------------------------------------------------------------------
CONF_THRESHOLD = 0.5
NMS_THRESHOLD = 0.4
IMG_WIDTH = 416
IMG_HEIGHT = 416
# Defa... | python |
#!/usr/bin/python3
# encoding: utf-8
"""
@author: m1n9yu3
@license: (C) Copyright 2021-2023, Node Supply Chain Manager Corporation Limited.
@file: web_server.py
@time: 2021/4/27 13:41
@desc:
"""
from flask import *
from huluxiaThirdflood_api import get_random_imageurl
import conf
app = Flask(__name__)
@app.route('... | python |
import UDPComms
import numpy as np
import time
from pupper.Config import Configuration
from src.State import BehaviorState, State, ArmState
from src.Command import Command
from src.Utilities import deadband, clipped_first_order_filter
class JoystickInterface:
def __init__(
self, config: Configuration, ud... | python |
import cv2
from je_open_cv import template_detection
image_data_array = template_detection.find_object("../test.png", "../test_template.png", detect_threshold=0.9, draw_image=True)
print(image_data_array)
if image_data_array[0] is True:
height = image_data_array[1][2] - image_data_array[1][0]
width = image_... | python |
from __future__ import division
from itertools import izip, count
import matplotlib.pyplot as plt
from numpy import linspace, loadtxt, ones, convolve
import numpy as np
import pandas as pd
import collections
from random import randint
from matplotlib import style
style.use('fivethirtyeight')
#tab csv
data = loadtxt("d... | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import mock
import pytest
from h.interfaces import IGroupService
from h.services.annotation_json_presentation import AnnotationJSONPresentationService
from h.services.annotation_json_presentation import annotation_json_presentation_service_factory
@py... | python |
from flask import Flask
from flask_restful import Resource, Api
from flask_cors import CORS
from api.db_utils import *
from api.Culprit_api import *
app = Flask(__name__) #create Flask instance
CORS(app)
api = Api(app) #api router
api.add_resource(CaseSetup,'/case-setup')
api.add_resource(Session, '/key')
api.add_r... | python |
from ._sw import Controller
| python |
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import json
try:
from urllib import parse as urlparse
except ImportError:
import urlparse
from operator import itemgetter
import yaml
from flask import jsonify, request, Blueprint
from builtin... | python |
import yaml
import rclpy
import std_msgs.msg as std
import geometry_msgs.msg as geom
from msg_printer.std_yaml import YamlHeader
class YamlAccel(yaml.YAMLObject):
yaml_tag = u"!Accel"
def __init__(self, a: geom.Accel):
self._dict = {
"linear": YamlVector3(a.linear).dict,
"an... | python |
import os
import sys
import time
import argparse
from naoqi import ALProxy
import robot_behavior_pb2
from os.path import dirname
from os.path import abspath
def register_motions(name,parameterServerAddress,motions):
behaviorModule = robot_behavior_pb2.RobotBehaviorModule()
behaviorModule.name = name
for... | python |
#!/usr/bin/env python
domain_name = os.environ['DOMAIN_NAME']
admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS']
admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT']
admin_username = os.environ['ADMIN_USERNAME']
admin_password = os.environ['ADMIN_PASSWORD']
#########################... | python |
from django.db import models
import json
# Create your models here.
class weather(models.Model):
'''
溫度、最高溫、最低溫、露點溫度、相對濕度、最小相對濕度、降雨量、最大十分鐘降雨量、最大六十分鐘降雨量
'''
date = models.DateTimeField()
temperature = models.FloatField()
relativeHumidity = models.FloatField()
rainfall = models.FloatField()
... | python |
class Solution:
#c1 is always opening type
def counter_part(self, c1: str, c2:str)->bool:
if c1 == '(' and c2 == ')':
return True
if c1 == '{' and c2 == '}':
return True
if c1 == '[' and c2 == ']':
return True
return False
def isVal... | python |
from __future__ import unicode_literals
__VERSION__ = '0.1.1'
| python |
import os
###############################################################################
def create_dir(path):
if not os.path.isdir(path):
os.makedirs(path)
###############################################################################
# SAVE A DICTIONARY
dict_ = {}
import json
with open(os.pa... | python |
# KicadModTree 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 Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# KicadModTree is distributed in the hope that it will be useful,
# bu... | python |
import sys
from antlr4 import *
import graphGenerator
from MyVisitor import MyVisitor
from PythonLexer import PythonLexer
from PythonParser import PythonParser
import os
def testefunc(graph, code, function):
file = open("testfile.txt", "w")
file.write(code)
file.close()
input=FileStream("testfile.txt... | python |
#!/usr/bin/python3
# Modifies the assembly output of compilation for control_mem_dtlb_store
# to provide necessary pattern for successful TLB/store attack on gem5
# See parse_tlb_logs.py for more details
# generated with gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
# command: gcc src/control_mem_dtlb_store -S -o ... | python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | python |
#-*- encoding: utf-8 -*-
import redis
r=redis.Redis(host='localhost',db=0)
p=r.pubsub()
p.subscribe('test')
for message in p.listen():
print(message) | python |
# Holds permission data for a private race room
def get_permission_info(server, race_private_info):
permission_info = PermissionInfo()
for admin_name in race_private_info.admin_names:
for role in server.roles:
if role.name.lower() == admin_name.lower():
permission_info.admi... | python |
"""
loader module provides actual implementation of the file savers.
.. warning:: This is an internal implementation. API may change without
notice in the future, so you should use
:class:`word_embedding_loader.word_embedding.WordEmbedding`
"""
__all__ = ["glove", "word2vec_bin", "word2vec_t... | python |
# Stimulator class
# Imports
#from StimulationSignal import StimulationSignal
import crccheck.checksum
import numpy as np
import serial
import time
import struct
# channel_stim: list of active channels
# freq: main stimulation frequency in Hz (NOTE: this overrides ts1)
# ts1: main stimulati... | python |
class Order(object):
def __init__(self, name, address, comments):
self.name = name
self.address = address
self.comments = comments
| python |
"""Helper functions for all Solar Forecast Arbiter /sites/* endpoints.
"""
import time
from flask import current_app as app
from requests.exceptions import ChunkedEncodingError, ConnectionError
from sentry_sdk import capture_exception
from sfa_dash import oauth_request_session
from sfa_dash.api_interface.util impor... | python |
from django.urls import path
from app.pages.views import (
display_customers_data_page,
display_customer_by_id_page,
display_home_page,
)
urlpatterns = [
path('', display_home_page),
path('customers/', display_customers_data_page, name="customers"),
path('customers_by_id/',
display_cu... | python |
import pytest
from orders.models import Order
pytestmark = [pytest.mark.django_db]
def test_tinkoff_bank_is_called_by_default(call_purchase, tinkoff_bank, tinkoff_credit):
call_purchase()
tinkoff_bank.assert_called_once()
tinkoff_credit.assert_not_called()
def test_tinkoff_bank(call_purchase, tinkoff... | python |
"""
This file contains the core methods for the Batch-command- and
Batch-code-processors respectively. In short, these are two different
ways to build a game world using a normal text-editor without having
to do so 'on the fly' in-game. They also serve as an automatic backup
so you can quickly recreate a world also aft... | python |
from typing import Optional, Union
from .set_config import _get_config
class _Engine(object):
"""Indicates the database engine that is currently in use."""
ENGINE = 0
MYSQL = 1
SQLITE = 3
_created = False # Indicates whether the connection to the database has been created.
@classm... | python |
import argparse
import confluent.client as cli
import sys
import time
c = cli.Command()
nodes = []
ap = argparse.ArgumentParser(description='Snake identify light through nodes')
ap.add_argument('noderange', help='Noderange to iterate through')
ap.add_argument('-d', '--duration', type=float, help='How long to have each ... | python |
# Generated by Django 3.1.7 on 2021-03-12 13:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0010_genre_desc'),
]
operations = [
migrations.AlterField(
model_name='genre',
name='desc',
fiel... | python |
import os
import sys
from pathlib import Path
from typing import List
import nox
nox.options.sessions = ["lint", "test-dist"]
PYTHON_ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
RUNNING_CI = "TRAVIS" in os.environ or "GITHUB_ACTIONS" in os.environ
@nox.session(python=["3.6"], reuse_venv=True)
def lint(sessi... | python |
import pandas as pd
#given a word, search all cases and find caseNames which contain the word
#return as a dataframe
def search_scdb_cases_by_name(word,all_scdb_case_data):
return all_scdb_case_data[all_scdb_case_data['caseName'].str.contains(word,na=False)]
#try to convert case names from SCDB 'caseName' field t... | python |
# MIT License
#
# Copyright (c) 2020 University of Oxford
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | python |
"""
[summary]
[extended_summary]
"""
# region [Imports]
# * Standard Library Imports ---------------------------------------------------------------------------->
import os
import traceback
from datetime import datetime
from typing import Tuple
import re
# * Third Party Imports --------------------------------------... | python |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | python |
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYING file.
import os
def test_simple(qidoc_action):
world_proj = qidoc_action.add_test_project("world")
build_dir = os.path.join(world_proj.path, "build... | python |
from io import BytesIO
from .utils import Tools, Status, Network
from .config import highQuality
from .config import RESOURCES_BASE_PATH
from PIL import Image, ImageDraw, ImageFilter, ImageFont
class User():
def __init__(self, nickname, favorability, days, hitokoto):
self._userNickname = nickname
... | python |
import time
import argparse
import numpy as np
import matplotlib.pyplot as plt
import torch
import torchvision
import torchvision.transforms as transforms
import n3ml.model
import n3ml.encoder
import n3ml.optimizer
np.set_printoptions(threshold=np.inf, linewidth=np.nan)
class Plot:
def __init__(self):
... | python |
import numpy as np
from c4.tables import rev_segments, all_segments
PLAYER1 = 1
PLAYER2 = 2
DRAW = 0
COMPUTE = -1
class WrongMoveError(Exception):
pass
class Board(object):
def __init__(self, pos=None, stm=PLAYER1, end=COMPUTE, cols=7, rows=6):
if pos is None:
pos = np.zeros((cols, ro... | python |
from math import sqrt
__author__ = "Samvid Mistry"
import time
from MAnimations.MAnimate import MAnimate
from PySide.QtGui import QApplication, QPainterPath
from PySide.QtCore import QPoint, QPointF
class MCircularReveal(MAnimate):
"""
Can be used to perform circular reveal or circular hide animation
on... | python |
import tensorflow as tf
import numpy as np
import sys, os
import getopt
import random
import datetime
import traceback
import pandas as pd
import cfr.cfr_net as cfr
from cfr.util import *
''' Define parameter flags '''
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('loss', 'l2', """Which loss function to use (l... | python |
from compecon.tools import Options_Container, qzordered
import numpy as np
import pandas as pd
from compecon.tools import jacobian, hessian, gridmake, indices
__author__ = 'Randall'
class LQlabels(Options_Container):
""" Container for labels of the LQmodel variables
Attributes:
s labels for contin... | python |
h1, m1, h2, m2 = map(int, input().split())
minutos = m2 - m1
horas = h2 - h1
if horas <= 0:
horas += 24
if minutos < 0:
horas -= 1
minutos = 60 + minutos
print("O JOGO DUROU {} HORA(S) E {} MINUTO(S)".format(horas, minutos))
| python |
# grad.py
"""
Created on Fri May 25 19:10:00 2018
@author: Wentao Huang
"""
from torch.autograd import Function
class Grad(Function):
r"""Records operation history and defines formulas for differentiating ops.
Each function object is meant to be used only once (in the forward pass).
Attributes:
... | python |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Wang Zhiyi
@file: logger.py
@time: 6/20/2021
@version: 1.0
"""
import os
from pyspark.ml.pipeline import PipelineModel
from spark_manager import get_spark_session
_spark_session = get_spark_session()
_spark_context = _spark_session.sparkContext
def loa... | python |
import tensorflow as tf
import numpy as np
from PIL import Image
import os
def maybe_download(directory, filename, url):
print('Try to dwnloaded', url)
if not tf.gfile.Exists(directory):
tf.gfile.MakeDirs(directory)
filepath = os.path.join(directory, filename)
if not tf.gfile.Exists(filepath):
filepath... | python |
# -*- coding: utf-8 -*-
import scrapy
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class SprintSpider(scrapy.Spider):
name = "sprint"
allowed_domains = ["sprint.com"]
start_urls = (
'https://www.sprint.com/locations/',
)
def parse_hour... | python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 John J. Rofrano <rofrano@gmail.com>
# 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
#
# https://www.apache.org/licenses/L... | python |
#!/usr/bin/python
'''
Created on Apr 19, 2016
@author: Rohan Achar
'''
import sys
import argparse
from spacetime.store_server import FrameServer
import cmd
import shlex
from flask import request
from threading import Thread as Parallel
class SpacetimeConsole(cmd.Cmd):
prompt = 'Spacetime> '
"""Command consol... | python |
import dydra
##
# Represents a Dydra.com RDF repository.
#
# @see http://docs.dydra.com/sdk/python
class Repository(dydra.Resource):
"""Represents a Dydra.com RDF repository."""
##
# (Attribute) The repository name.
name = None
##
# @param name A valid repository name.
def __init__(self, name, **kwargs... | python |
import cv2
import numpy as np
src = cv2.imread('data/src/lena.jpg')
mask = np.zeros_like(src)
print(mask.shape)
# (225, 400, 3)
print(mask.dtype)
# uint8
cv2.rectangle(mask, (50, 50), (100, 200), (255, 255, 255), thickness=-1)
cv2.circle(mask, (200, 100), 50, (255, 255, 255), thickness=-1)
cv2.fillConvexPoly(mask,... | python |
"""Base test class for DNS authenticators."""
import configobj
import josepy as jose
import mock
import six
from acme import challenges
from certbot import achallenges
from certbot.compat import filesystem
from certbot.tests import acme_util
from certbot.tests import util as test_util
DOMAIN = 'example.com'
KEY = jo... | python |
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from torch import optim
from torch.utils.data import DataLoader
import torch
from dataloader import *
from model import *
from metric import *
import soundfile as sf
from semetrics import *
test_clean = "data/test_clean/"
test_noisy = "data/test_noisy/"
data_augment =... | python |
#!venv/bin/python3
import logging
from logging.handlers import RotatingFileHandler
import sync_mongo
from sync_mongo import SyncMongo
__level = logging.DEBUG
logger = logging.getLogger(__name__)
uri = "repl1/localhost:27017,localhost:27018,localhost:27019"
def setup_logging():
FORMAT='%(asctime)s %(levelname)s:... | python |
"""
Bilby
=====
Bilby: a user-friendly Bayesian inference library.
The aim of bilby is to provide a user-friendly interface to perform parameter
estimation. It is primarily designed and built for inference of compact
binary coalescence events in interferometric data, but it can also be used for
more general problems.... | python |
from discord import Color, Embed, Member, Object
from discord.ext import commands
from discord.ext.commands import Context as CommandContext
PREMIUM_RULESBOT = 488367350274326528
ACTIVE_PATREON = 488774886043680769
class PremiumCog(object):
def __init__(self, bot: commands.Bot):
self.bot: commands.Bot = ... | python |
"""Downloads the Forge MDK"""
import os
import zipfile
import shutil
import requests
from globals import *
import logger
import modfile
def download():
"""Downloads and extracts MDK"""
prefix = 'https://files.minecraftforge.net/maven/net/minecraftforge/forge/'
version = modfile.get('minecraft') + '-' ... | python |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import api.models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='app',
name='id',
field=models.SlugF... | python |
'''
Date: 2021-08-12 12:24:42
LastEditors: Liuliang
LastEditTime: 2021-08-12 18:28:35
Description:
'''
from typing import Optional
class Node():
def __init__(self, data) -> None:
self.data = data
self._next = None
# class LinkList():
# def __init__(self) -> None:
# self._head = None
... | python |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | python |
class Solution:
"""
@param arr: an array of integers
@return: the length of the shortest possible subsequence of integers that are unordered
"""
def shortestUnorderedArray(self, arr):
# write your code here
inc = dec = True
for i in range(len(arr) - 1):
if arr[i] ... | python |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 Niko Sandschneider
"""Module implementing Signals for communicating with the GUI."""
from functools import wraps
import logging
from PyQt5.QtCore import QObject, pyqtSignal
class Signals(QObject):
"""Class for signal communication between worker classes and G... | python |
from django.contrib import admin
from main.models import StudentRegisterationForm
from django.http import HttpResponse
import csv
def show_email(obj):
email = obj.email
return '<a href="mailto:%s" target="_blank">%s</a>' % (email, email)
show_email.allow_tags = True
show_email.short_description = 'Email'
de... | python |
############################################################################
# Copyright ESIEE Paris (2018) #
# #
# Contributor(s) : Benjamin Perret #
# ... | python |
from collections import defaultdict, namedtuple
from numba import njit, jitclass
from numba import types
import numba
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
from matplotlib.ticker import (AutoMinorLocator, MultipleLocator)
import argparse
parser = argparse.ArgumentParse... | python |
"""
Quickly load ROOT symbols without triggering PyROOT's finalSetup().
The main principle is that appropriate dictionaries first need to be loaded.
"""
from __future__ import absolute_import
import ROOT
from .. import log; log = log[__name__]
from .module_facade import Facade
__all__ = []
root_module = ROOT.modul... | python |
from contextlib import contextmanager
from flask_login import UserMixin
import markdown
from markdown.extensions.toc import TocExtension
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarati... | python |
__author__ = 'DafniAntotsiou'
import numpy as np
from gym import spaces
# universal prefix for the different networks
def get_il_prefix():
return 'il_'
def get_semi_prefix():
return 'semi_'
# add auxiliary actions to env observation space for semi network
def semi_ob_space(env, semi_size):
if semi_si... | python |
#
# Copyright (c) 2018 Intel 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 required by applicable law or agreed to... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.