text stringlengths 1 927k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayOpenPublicMenuModifyModel import AlipayOpenPublicMenuModifyModel
class AlipayOpenPublicMenuModifyRequest(object):
def __i... |
# -*- coding: utf-8 -*-
#
# Copyright 2012 James Thornton (http://jamesthornton.com)
# BSD License (see LICENSE for details)
#
"""
Low-level module for connecting to the Rexster REST server and
returning a Response object.
"""
import httplib2
import bulbs
from bulbs.base import Response
from .utils import json, get_l... |
# flake8: noqa
from cereal import car
from selfdrive.car import dbc_dict
from common.params import Params
Ecu = car.CarParams.Ecu
# Steer torque limits
class CarControllerParams:
params = Params()
STEER_MAX = int(params.get('SteerMaxAdj')) # 409 is the max, 255 is stock
STEER_DELTA_UP = int(params.get('SteerD... |
# -*- coding: utf-8 -*-
from manim import *
class SinhPoisson(Scene):
def construct(self):
spe = MathTex(r"-\Delta", " \Psi", "=", "2 \sinh(-\\beta \Psi)")
self.play(Write(spe[:2]))
self.play(Write(spe[2]))
self.play(Write(spe[3]))
# self.play(FadeOut(spe[0]))
# spe... |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import sys
import requests
import urllib.parse
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
__author__ = 'Florian Wilhelm'
__copyright__ = 'Blue Yonder'
__... |
"""
Contains reusable utility code for the SMARTSexplore application.
"""
import subprocess
import logging
def run_process(cmd, timeout=None, stdout=None, stderr=None, reraise_exceptions=False, **kwargs):
"""
Helper function that wraps subprocess.run with some additional
exception handling that is useful... |
import unittest
from day3 import *
class TestDay3Part1(unittest.TestCase):
def test_solve_part_1(self):
self.assertEqual(solve_part_1(), 862)
def test_solve_part_2(self):
self.assertEqual(solve_part_2(), 1577) |
import PIL.Image
from tkinter import *
from tkinter import filedialog
import PIL.ImageTk
import os
import sys
from glob import glob
import csv
from shutil import copyfile
class GradingTool(Frame):
def chg_image(self):
self.image = PIL.ImageTk.PhotoImage(self.im)
self.label.config(image=self.image, ... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
# Time: O(n)
# Space: O(h)
# 1145
# Two players play a turn based game on a binary tree.ย We are givenย the root of this binary tree,
# and the number of nodes nย in the tree.ย n is odd, andย each node has a distinct value from 1 to n.
#
# Initially, the first player names a value x with 1 <= x <= n, and the second play... |
'''
lab8
'''
#3.1
def count_words(input_str):
return len(input_str.split())
#3.2
demo_str = 'Hello World!'
print(count_words(demo_str))
#3.3
def find_min_num(input_list):
min_item = input_list[0]
for num in input_list:
if type(num) is not str:
if min_item>= ... |
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
def loglog(sums2,interval=None,type=None,plot=False,smoothing=None):
if type is None:
y = [np.log(item) for item in sums2]
x = [1/(vel+1) for vel in interval]
slope, yInt, _,_,_ = stats.linregress(x,y)
elif ty... |
import time
import psycopg2
from behave import step, then
@step('I create a logical replication slot {slot_name} on {pg_name:w} with the {plugin:w} plugin')
def create_logical_replication_slot(context, slot_name, pg_name, plugin):
try:
output = context.pctl.query(pg_name, ("SELECT pg_create_logical_repli... |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.AZURE)
driver = cls(subscription_id="subscription-id", key_file="/path/to/azure_cert.pem") |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
from .layer import Layer
from ..activation import Activation
from .convolution_1d import Convolution1D
import numpy as np
class MaxPool1D(Layer):
"""
Convolve input but only feed forward the maximum activation
"""
def __init__(self, input_size=0, n_filters=0, pool_size=1, stride_length=1, flatten_ou... |
import pytest
import itertools
import quimb as qu
import quimb.tensor as qtn
class TestPEPSConstruct:
@pytest.mark.parametrize('Lx', [3, 4, 5])
@pytest.mark.parametrize('Ly', [3, 4, 5])
def test_basic_rand(self, Lx, Ly):
psi = qtn.PEPS.rand(Lx, Ly, bond_dim=4)
assert psi.max_bond() == 4... |
import cassava
def test_not_providing_conf_persists_defaults_changes_ok():
"""
Initially the header_row config item in the class variable DEFAULTS is
None. If no conf kwarg is passed to the constructor, then it uses
DEFAULTS (directly, not a copy) as its configuration dict. In this case,
if we ch... |
# -*- coding: utf-8 -*-
from base64 import b64encode, b64decode
from datetime import datetime, timedelta
import os
import stat
import yaml
__virtualname__ = 'metalk8s_kubeconfig'
def __virtual__():
return __virtualname__
def _validateKubeConfig(filename,
expected_ca_data,
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2020 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software cons... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest import GaiaTestCase
from gaiatest.apps.marketplace.app import Marketplace
fro... |
import logging
import time
from django.conf import settings
from log_request_id import (
LOG_REQUESTS_SETTING,
REQUEST_ID_RESPONSE_HEADER_SETTING,
local,
)
from log_request_id.middleware import RequestIDMiddleware
from .logfmt import quote_logvalue
from sfdo_template_helpers.addresses import get_remote_ip
... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... |
# =================================================================
#
# Work of the U.S. Department of Defense, Defense Digital Service.
# Released as open source under the MIT License. See LICENSE file.
#
# =================================================================
import uuid
from slugify import slugify
fro... |
"""Communicate with the Polar virtual machine: load rules, make queries, etc."""
from datetime import datetime, timedelta
import os
from pathlib import Path
import sys
from typing import List, Union
from .exceptions import (
PolarRuntimeError,
InlineQueryFailedError,
ParserError,
PolarFileExtensionErr... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import autograd
from mxnet.gluon import nn
# from IPython import embed
class FCOSTargetGenerator(nn.Block):
"""Generate FCOS targets"""
def __init__(self, ... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... |
# %% Imports
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier, GradientBoostingClassifier
from sklearn.metrics import r2_score, roc_curve, roc_auc_scor... |
#!/usr/bin/python3
import os
if __name__ == '__main__':
# This will make sure that the octaverc user startup file will contain
# a line to set the graphics toolkit to gnuplut. It might add multiple
# lines, but this shouldn't hurt.
startup_path = os.path.expanduser('~/.octaverc')
option = 'grap... |
"""
Documentation testing
Inspired by:
https://github.com/cprogrammer1994/ModernGL/blob/master/tests/test_documentation.py
by Szabolcs Dombi
This version is simplified:
* Only test if the attribute or method is present in the class. Function parameters are not inspected.
* Include ignore pattern in the implemented se... |
#
# 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 us... |
# proxy module
from traitsui.context_value import * |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Notifico is my personal open source MIT replacement to the
now-defunct http://cia.vc service with my own little spin on things.
"""
from setuptools import setup, find_packages
def get_version():
"""
Load and return the current Notifico version.
"""
loca... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The Prog-o-meter.py program is for tracking progress during a #100DaysofCode challenge (or any other #100DaysofX challenge).
The program gives a graphic overview of ones progress through the challenge, by showing a bar containing 100 fields, showing completed days as c... |
import id_list
#from cex import *
def dupeChecker():
dupes = 0
for id in range(len(id_list.id_list)):
id = id_list.id_list[id]
matching = [s for s in id_list.id_list if id in s]
if len(matching) > 1:
dupes = dupes+1
print(matching)
print(len(matching)... |
# Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
import os
import time
import click
from . import procs
class Interpreter:
def __init__(self, ctx, verbose):
self.ctx = ctx
self.verbose = verbose
self.lines = []
self.in_comment = False
def feed(self, line):
if len(self.lines) > 0:
# End of multi-line comment
if self.lines[0].startswith('#==') and... |
from __future__ import print_function, division
import numpy as np
import librosa
from tqdm import tqdm
import math
import tensorflow as tf
import soundfile as sf
n_fft = 2048
win_length = 1200
hop_length = int(win_length/4)
max_audio_length = 108000
# decoder output width r
r = 2
def reshape_frames(signal, forward... |
#!/usr/bin/env python
import rospy
import pygame
import Adafruit_I2C
from duckietown_msgs.msg import Twist2DStamped, BoolStamped, StopLineReading
from std_msgs.msg import String, Int32, Int16
from sensor_msgs.msg import Joy
from Adafruit_PWM_Servo_Driver import PWM
from Adafruit_MotorHAT import Adafruit_MotorHAT
impor... |
from typing import Optional
import discord as dc
import os
from discord.ext.commands.core import command
import requests
import json
from CowsAndBulls import CowsAndBulls
import Anagram as ana
import feedparser
import random
import discord
from discord.ext import commands
from dotenv import load_dotenv
from Crossword i... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Copyright (c) 2021-present 404kuso
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
th... |
import json
import base64
import logging
from PIL import Image
from io import BytesIO
from hashlib import sha256
from .config import SALT
def validate_fields(dictionary: dict, struct: dict) -> dict:
"""
Takes a dictionary and an architecture and checks if the types and structure are valid.
Corrects the ... |
# coding: utf-8
from datetime import datetime
import json
from urllib.parse import urlencode
import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "Lerum Vatten och Avlopp"
DESCRIPTION = "Source for Lerum Vatten och Avlopp waste collection."
URL = "https://vatjanst.ler... |
# Generated by Django 2.1.5 on 2020-03-10 17:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_rebel', '0002_auto_20190114_0443'),
]
operations = [
migrations.AddField(
model_name='mail',
name='has_accept... |
"""Tests for Closed-Form matting and foreground/background solver."""
import unittest
import cv2
import numpy as np
import closed_form_matting
class TestMatting(unittest.TestCase):
def test_solution_close_to_original_implementation(self):
image = cv2.imread('testdata/source.png', cv2.IMREAD_COLOR) / 255.... |
# Copyright 2018 The Cirq Developers
#
# 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# Copyright 2016-2020 Blue Marble Analytics 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 ag... |
# ##### BEGIN MIT LICENSE BLOCK #####
#
# MIT License
#
# Copyright (c) 2020 Steven Garcia
#
# 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 ... |
import re
def replace_float_notation(string):
"""
Replace unity float notation for languages like
French or German that use comma instead of dot.
This convert the json sent by Unity to a valid one.
Ex: "test": 1,2, "key": 2 -> "test": 1.2, "key": 2
:param string: (str) The incorrect json strin... |
# Generated by Django 3.0.9 on 2020-08-10 10:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lcore', '0005_remove_article_image_file'),
]
operations = [
migrations.AlterField(
model_name='article',
name='extra... |
from tws_futures import __settings__ as project
from tws_futures.helpers._input_types import INPUT_TYPES
from tws_futures.helpers.validators import VALIDATION_MAP
from tws_futures.helpers import utils
from tws_futures.helpers.logger_setup import get_logger
from tws_futures.helpers.parsers import parse_user_args
from tw... |
"""Leanpub Multi Action is used to interact with the Leanpub.com API in GitHub Actions."""
# Gather version information from project packaging
try:
from importlib import metadata
except ImportError:
# Python version < 3.8
import importlib_metadata as metadata
__version__ = metadata.version(__name__) |
import time
from JumpScale.clients.racktivity.energyswitch.proxy import connection
from JumpScale.clients.racktivity.energyswitch.common import convert
from JumpScale.clients.racktivity.energyswitch.common.GUIDTable import Value
from JumpScale.clients.racktivity.energyswitch.modelfactory.modelfactory import ModelFacto... |
"""Get a user-customised google search meme!"""
# Plugin By - XlayerCharon[XCB]
# TG ~>>//@CharonCB21
# Ported for OUB by @AshSTR
import asyncio
import os
from PIL import Image, ImageDraw, ImageFont
from wget import download
from userbot import CMD_HELP
from userbot.events import register
@register(outgoing=True, p... |
import unittest
import numpy as np
from pandas.testing import assert_frame_equal
from dataclasses import dataclass
from typing import Callable
from mcc import (
parser,
IndexedCashflows,
DateIndex,
Model,
TermStructuresModel,
ObservableBool,
KonstFloat,
LinearRate,
FixedAfter,
S... |
# -*- coding: utf-8 -*
import datetime
try:
from configparser import ConfigParser
COPA = ConfigParser()
fc = open("tests/pyrfc.cfg", "r")
COPA.read_file(fc)
except ImportError as ex:
from configparser import config_parser
COPA = config_parser()
COPA.read_file("tests/pyrfc.cfg")
# Numer... |
import numpy as np
import os
import ntpath
import time
from . import util
from . import html
from PIL import Image
from torchvision import transforms
def imresize(image, size, interp=Image.BICUBIC):
return transforms.Resize(size=size, interpolation=interp)(image)
# save image to the disk
def save_images(webpag... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""quantulum unit and entity loading functions."""
# Standard library
import os
import json
from collections import defaultdict
# Dependencies
import inflect
# Quantulum
from . import classes as c
TOPDIR = os.path.dirname(__file__) or "."
PLURALS = inflect.engine()
... |
rad = float(input("Enter the radius to find the area of the circle:"))
area_of_circle = 3.14*(rad*rad)
print("Area of circle is {0}".format(area_of_circle)) |
import os
class Preprocessor:
"""
Class used to preprocess Docker.in files
"""
@staticmethod
def preprocess(inputFilePath):
"""
Preprocess given input file
@param inputFilePath Path to the input dockerfile
"""
result = ""
# Dockerfile directory
... |
# -*- coding: utf-8 -*-
"""This is a generated class and is not intended for modification!
TODO: Point to Github contribution instructions
"""
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.sms.mt.send.SMSData import SMSData
class SMSMultiBinaryReques... |
# -*- coding: utf-8 -*-
import urllib
from django.utils import translation
import pytest
from mock import Mock
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo import LOG
from olympia.amo.tests import addon_factory, days_ago, TestCase, user_factory
from olympia.amo.tests.test_... |
# -*- coding: utf-8 -*-
import os
import aiofiles
import ujson
from . import Utils
from dateutil.parser import parse
import datetime
from .customException import GrailExcept
# Non fatal error type
error = 'error'
ok = 'ok'
async def getOrWriteNumber(sequence, group, model = 'user'):
userUID = 1
groupUID = 1
... |
# coding=utf-8
"""
The Landinge Page actions API endpoint
Documentation: https://mailchimp.com/developer/reference/landing-pages/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class LandingPageAction(BaseApi):
"""
Manage your Landing Pages, including publishing and unpub... |
conf = {
'xtype': 'melee',
'x1.dmg': 114 / 100.0,
'x1.sp': 200,
'x1.startup': 17 / 60.0,
'x1.recovery': 46 / 60.0,
'x1.hit': 1,
'x2.dmg': 122 / 100.0,
'x2.sp': 240,
'x2.startup': 0,
'x2.recovery': 61 / 60.0,
'x2.hit': 1,
'x3.dmg': 204 / 100.0,
'x3.sp': 360,
'x3... |
r"""
Tiling Solver
Tiling a n-dimensional polyomino with n-dimensional polyominoes.
This module defines two classes:
- :class:`sage.combinat.tiling.Polyomino` class, to represent polyominoes
in arbitrary dimension. The goal of this class is to return all the
rotated, reflected and/or translated copies of a polyo... |
class CountN:
def __init__(self, count):
self.count = count
self.current = 1
return None
def __iter__(self):
self.current = 0
return self
def __next__(self):
self.current += 1
if self.current > self.count:
raise StopIteration
else:
return self.current
if __name__ ==... |
import json
import numpy as np
import math
import numbers
def is_nan(x):
return (x is np.nan or x != x)
def convert_simple_numpy_type(obj):
if isinstance(obj, (np.int_, np.intc, np.intp, np.int8,
np.int16, np.int32, np.int64, np.uint8,
np.uint16, np.uint32, np.uint64)):
return int(obj... |
import logging
from awxkit.api.mixins import DSAdapter, HasCreate, HasCopy
from awxkit.api.pages import (
Credential,
Organization,
)
from awxkit.api.resources import resources
from awxkit.utils import random_title, PseudoNamespace, filter_by_class
from . import base
from . import page
log = logging.getLogg... |
'''basic tests'''
import json
import os
import warnings
import pytest
import socotra_marketplace_helpers as helpers
from socotra_marketplace_helpers.jwt import sign
def test_disclaimer():
'''ack limited support'''
yes = input('Write YES to acknowledge this is BETA quality software: ')
assert yes == 'YES'... |
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from orchestra.admin import AtLeastOneRequiredInlineFormSet, ExtendedModelAdmin
from orchestra.admin.actions import SendEmail
from orchestra.admin.utils import insertattr, change_url
from orchestra.contrib... |
# Copyright (c) 2015-2017 Blizzard Entertainment
#
# 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, merge, ... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from apps.sponsor.models import Sponsor, SponsorRelation, SponsorRelationTranslation, SponsorTranslation
class SponsorTranslationInlineAdmin(admin.StackedInline):
ver... |
# Copyright Nova Code (http://www.novacode.nl)
# See LICENSE file for full licensing details.
import json
import logging
import unittest
from datetime import datetime, date, timezone, timedelta
from tests.utils import readfile
from formiodata.builder import Builder
from formiodata.form import Form
from formiodata.co... |
#######################################################
#
# TAKFreeServer.py
# Original author: naman108
# This code is Open Source, made available under the EPL 2.0 license.
# https://www.eclipse.org/legal/eplfaq.php
# credit to Harshini73 for base code
#
#######################################################
import... |
import click
import json
import re
import warnings
from metaflow import current, decorators, parameters, JSONType
from metaflow.metaflow_config import from_conf
from metaflow.package import MetaflowPackage
from metaflow.plugins import BatchDecorator
from .argo_workflow import ArgoWorkflow, dns_name
from metaflow.excep... |
# coding: utf-8
"""
่ฐๅบฆ่งๅ๏ผๅฐ model/rule.py ไธญ็่งๅ่ฝฌๆขไธบ็ฎๆณ้่ฆ็ๆฐๆฎ
"""
from model.rule import rules, levels
class Rule(object):
def __init__(self):
super(Rule, self).__init__()
# print('rules: %s' % str(rules))
self.order_level = {}
for item in rules['order_level']:
self.order_lev... |
#!/usr/bin/env python
import os
import requests
import json
import datetime
import shutil
from bs4 import BeautifulSoup
here = os.path.dirname(os.path.abspath(__file__))
hospital_id = os.path.basename(here)
url ='https://my.clevelandclinic.org/patients/billing-insurance/patient-price-lists'
today = datetime.datetim... |
#!/usr/bin/env python
#
# Simple wrapper for Python logging module. Adds information about location
# emitting the debug information (file, line, function) and timestamp.
#
# Copyright (C) 2010, 2011 Senko Rasic <senko.rasic@dobarkod.hr>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
#... |
# coding=utf-8
from __future__ import unicode_literals
from api_x.zyt.biz import cheque
from api_x.zyt.biz.models import ChequeType
def draw_cheque(channel, from_id, amount, order_id=None, valid_seconds=1800, cheque_type=ChequeType.INSTANT,
info='', client_notify_url=''):
return cheque.draw_chequ... |
def func():
value = "not-none"
if value is not None:
<selection>pass</selection><caret>
else:
print("None")
print(value)
return True |
from datetime import datetime
from random import random
from imgurpython import ImgurClient
from config import *
import discord
import requests
from discord.ext import commands
import nekos
import sys
imgur = ImgurClient(imgurC, ImgurL)
class NekosCog(commands.Cog):
def __init__(self, bot):
self.bot = ... |
"""
pyndl.preprocess
----------------
*pyndl.preprocess* provides functions in order to preprocess data and create
event files from it.
"""
import collections
import gzip
import multiprocessing
import os
import random
import re
import sys
import time
def bandsample(population, sample_size=50000, *, cutoff=5, seed=N... |
from __future__ import absolute_import, division, unicode_literals
import param as _param
from . import layout # noqa
from . import links # noqa
from . import pane # noqa
from . import param # noqa
from . import pipeline # noqa
from . import widgets # noqa
from .config import config, panel_extension as extension # n... |
"""
Helper functions for testing.
"""
import inspect
import os
import string
from matplotlib.testing.compare import compare_images
from ..exceptions import GMTImageComparisonFailure
def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_images"):
"""
Decorator for test cases that generat... |
def weekday_name(day_of_week):
"""Return name of weekday.
>>> weekday_name(1)
'Sunday'
>>> weekday_name(7)
'Saturday'
For days not between 1 and 7, return None
>>> weekday_name(9)
>>> weekday_name(0)
"""
days = ['Sunday', 'Monda... |
from __future__ import print_function
from reppy.cache import DefaultObjectPolicy, ReraiseExceptionPolicy
'''Tests about our caching utilities.'''
import unittest
import mock
import sys
from reppy import cache
from reppy import logger
from reppy.robots import AllowNone
import reppy.exceptions
from ..util import r... |
#!/usr/bin/env python
from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,4,0,False, False],[traindat,testdat,4,0,False,False]]
def kernel_comm_word_string (fm_trai... |
import json
import time
from indy.ledger import build_nym_request, build_schema_request, \
build_acceptance_mechanism_request, build_txn_author_agreement_request, \
build_get_txn_author_agreement_request, append_txn_author_agreement_acceptance_to_request
from indy.payment import build_get_payment_sources_reque... |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 applic... |
import sys
import time
from ctypes import windll, wintypes, create_unicode_buffer, byref
def file1(n):
for i in range(n):
try:
with open(r'U:\bin\RunRoot\Debug64\dbxsdk\dbxsdkrereg.wixout:aaaa','r') as f:
a = f.read()
pass
except:pass
CreateFileW = wi... |
#!/usr/bin/env micropython
"""
Unittests for async MQTT client
MIT license
(C) Konstantin Belyalov 2018
"""
import utime
import logging
import unittest
import uasyncio
import uselect
import uerrno
import tinymqtt
from tinymqtt import MQTTClient
# Exception to be raised by MockSocketConnect()
ConnectException = OSErr... |
from abc import ABC, abstractmethod
from typing import Union, Sized, List, Tuple
from copy import deepcopy
import torch
from torch import nn as nn
from ..nn.linear import DenseLinear
from ..nn.conv2d import DenseConv2d
from .utils import collect_leaf_modules, is_parameterized
class BaseModel(nn.Module, ABC):
de... |
# Generated by Django 2.2.14 on 2020-07-06 11:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("traffic_control", "0013_additional_sign_device_type"),
]
operations = [
migrations.AlterField(
model_name="additionalsignreal",... |
#!/usr/bin/env python3
# The arrow library is used to handle datetimes
import arrow
# The request library is used to fetch content through HTTP
import requests
# Numpy and PIL are used to process the image
import numpy as np
from PIL import Image
def _get_masks(session=None):
Minus = np.array([[[255, 255, 255],[... |
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning... |
import unittest
import os
import pyopenms
class TestMSSpectrumAndRichSpectrum(unittest.TestCase):
def setUp(self):
dirname = os.path.dirname(os.path.abspath(__file__))
def testMSSpectrum(self):
spec = pyopenms.MSSpectrum()
p = pyopenms.Peak1D()
p.setMZ(500.0)
p.setIn... |
#!/usr/bin/python3
import os
import sys
import json
import logging
import pytz
import configparser
from hashlib import md5
from datetime import datetime
from flask_restful import Resource, Api
from flask import Flask, request, jsonify, stream_with_context, Response, make_response
# only used if we're runing the app n... |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of database model for contrail config daemons
"""
from exceptions import NoIdError
from vnc_api.gen.resource_client import *
from utils import obj_type_to_vnc_class
class DBBase(object):
# This is the base c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.