text stringlengths 1 927k |
|---|
from sample import PayPalClient
from paypalcheckoutsdk.orders import OrdersGetRequest
from sample.CaptureIntentExamples.create_order import CreateOrder
import json
class GetOrder(PayPalClient):
"""This function can be used to retrieve an order by passing order id as argument"""
def get_order(self, or... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
PathFinder
A QGIS plugin
Find the shortest path between two points in a raster image.
-------------------
begin : 2017-09-20
... |
# 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 ... |
# Generated by Django 3.2.2 on 2021-05-29 13:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("posts", "0002_auto_20210523_0553"),
]
operations = [
migrations.AddField(
model_name="post",
name="slug",
... |
"""
Django's standard crypto functions and utilities.
"""
from __future__ import unicode_literals
import binascii
import hashlib
import hmac
import random
import struct
import time
from django.conf import settings
from django.utils import six
from django.utils.encoding import force_bytes
from django.utils.six.moves i... |
#!/usr/bin/env python
from os.path import join, realpath
import sys; sys.path.insert(0, realpath(join(__file__, "../../../")))
import logging
import time
import asyncio
import contextlib
from decimal import Decimal
from typing import Optional
import unittest
import conf
from hummingbot.core.clock import (
Clock,
... |
# @lc app=leetcode id=130 lang=python3
#
# [130] Surrounded Regions
#
# https://leetcode.com/problems/surrounded-regions/description/
#
# algorithms
# Medium (29.92%)
# Likes: 2844
# Dislikes: 795
# Total Accepted: 303.4K
# Total Submissions: 1M
# Testcase Example: '[["X","X","X","X"],["X","O","O","X"],["X","X",... |
class MultiheadAttention(Module):
__parameters__ = ["in_proj_weight", "in_proj_bias", ]
__buffers__ = []
in_proj_weight : Tensor
in_proj_bias : Tensor
training : bool
out_proj : __torch__.torch.nn.modules.linear.___torch_mangle_9395._LinearWithBias
def forward(self: __torch__.torch.nn.modules.activation._... |
"""LCM package __init__.py file
This file automatically generated by lcm-gen.
DO NOT MODIFY BY HAND!!!!
"""
from orders_t import orders_t
from info_t import info_t
from printf_t import printf_t
from sheriff_cmd_t import sheriff_cmd_t
from deputy_cmd_t import deputy_cmd_t
from sheriff import Sheriff
from sheriff_scrip... |
# Generated by Django 2.2.6 on 2019-12-19 12:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('a1test', '0009_auto_20191219_0330'),
]
operations = [
migrations.RemoveField(
model_name='exam',
name='exam_time',
... |
import os
import subprocess
can_dir = os.path.dirname(os.path.abspath(__file__))
subprocess.check_call(["make"], cwd=can_dir)
from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error
from cereal import log
from common.realtime import sec_since_boot
from selfdr... |
#!/usr/bin/env python
#coding:utf-8
# Purpose: provide class mixins
# Created: 11.12.11
# Copyright (C) 2011, Manfred Moitzi
# License: MIT License
__author__ = "mozman <mozman@gmx.at>"
class SubscriptAttributes(object):
def __getitem__(self, item):
if hasattr(self, item):
return getattr(self... |
from django.core.management.base import BaseCommand
from ssheepdog.tasks import sync
class Command(BaseCommand):
def handle(self, *args, **options):
sync.delay() |
import math
import numpy as np
import scipy.special as sc
from tests.src.utils import split_list, __print
from tests.src.rakn import rank
# .5 Binary Matrix Rank Test
def binary_matrix_rank_test(key, n, M=32, Q=32, b_print=True):
if n < 38912:
__print(b_print, '{:40} : Error. Need at least 38,912 bits. G... |
"""FAST hardware platform.
Contains the hardware interface and drivers for the FAST Pinball platform
hardware, including the FAST Core and WPC controllers as well as FAST I/O
boards.
"""
import os
from copy import deepcopy
from distutils.version import StrictVersion
from typing import Dict, Set
from mpf.platforms.fa... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017-2020, SCANOSS Ltd. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import hashlib
def parse_diff(src):
"""
Parse a commit diff.
This function parses a diff string and generat... |
import numpy as np
from numpy.random import randn
#This function is taken from Dr Fayyaz ul Amir Afsar Minhas (Github User: foxtrotmike)
def getExamples(n=100,d=2):
"""
Generates n d-dimensional normally distributed examples of each class
The mean of the positive class is [1] and for the negative c... |
POP_SIZE = 17 #pop size
NGEN = 1000000000 #generations to run
MUTATION = [0, 1, 2, 3] #randomly select one value from this list to determine the number of mutations an indiv. pass on to next gen.
ELITE = 3 #number best individuals to save at each generation
TERMINATION = 1000 #if the most fit line doesn't change for... |
import numpy
import time
import sys
import os
from argparse import ArgumentParser
import pygbe
from pygbe.util.read_data import read_fields
from pygbe.main import main
from cext_wavelength_scanning import create_diel_list, Cext_wave_scan, Cext_analytical
def read_inputs(args):
"""
Parse command-line argumen... |
from importlib import import_module
from inspect import isclass
import os
from os import walk
from os.path import abspath, basename, dirname, join
from sys import modules
from src.data_generator.extractors.base_extractor import BaseExtractor
__all__ = ('load_extractors',)
PROJ_DIR = abspath(join(dirname(abspath(__f... |
from django.contrib import admin
from .models import Hotel, Room, Reserve, Feedback
admin.site.register(Hotel)
admin.site.register(Room)
admin.site.register(Reserve)
admin.site.register(Feedback) |
def julian_is_leap(year):
return year % 4 == 0
def gregorian_is_leap(year):
return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)
def solve(year):
month = '09'
day = '13'
if year <= 1917:
is_leap_year = julian_is_leap(year)
elif year == 1918:
day = '26'
is_le... |
import unittest
from src.validator import cyanobyte_valdiate
from jsonschema.exceptions import ValidationError
class TestValidatorGeneral(unittest.TestCase):
def test_blank_file(self):
self.assertRaises(
ValidationError,
cyanobyte_valdiate,
['test/sampleData/validator/b... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... |
class Stack:
#栈的python实现
def __init__(self):
self.items = []
def push(self, item):
#append操作O(1)
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def isEmpty(self):
return self.items == []
def size(self):
return len(self.items) |
#!/usr/bin/python
# pip install lxml
import sys
import os
import json
import xml.etree.ElementTree as ET
START_BOUNDING_BOX_ID = 1
PRE_DEFINE_CATEGORIES = {}
# If necessary, pre-define category and its id
# PRE_DEFINE_CATEGORIES = {"aeroplane": 1, "bicycle": 2, "bird": 3, "boat": 4,
# "bo... |
# Copyright (C) 2019 The Raphielscape Company LLC.; Licensed under the Raphielscape Public License, Version 1.d (the "License"); you may not use this file except in compliance with the License.; Port From UniBorg to UserBot by @afdulfauzan
""" telegraph poster module. """
import os
from datetime import datetime
from... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
def create_user(**params):
return get_user_model(... |
#!/usr/bin/env python
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import division,print_function,unicode_literals
import biplist
from ds_store import DSStore... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/parallel/parallel_fill.py
# (parallel) Fill of RooDataSet frmo looong TChain/TTree
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
# @date 2014-09-23
# =========================... |
#!/usr/bin/env python
""" ViewGeoTIFF.py: PyQt image viewer widget for a QPixmap in a QGraphicsView scene with mouse zooming and panning.
"""
import os.path
try:
from PyQt5.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR
from PyQt5.QtGui import QImage, QPixmap, QPainterPath
from PyQt5.QtWidgets impor... |
import numpy as np
import math, random
# Generate a noisy multi-sin wave
def sine_2(X, signal_freq=60.):
return (np.sin(2 * np.pi * (X) / signal_freq) + np.sin(4 * np.pi * (X) / signal_freq)) / 2.0
def noisy(Y, noise_range=(-0.05, 0.05)):
noise = np.random.uniform(noise_range[0], noise_range[1], size=Y.shape... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import traceback
from pathlib import Path
from classy_vision.generic.registry_utils import import_all_modu... |
"""
Permite manipular a los cocineros de una forma sencilla
"""
from comun import Persona,siguiente_estado
from enum import Enum, unique
from threading import Thread
from random import random, randint
from time import sleep
from threading import Thread, Semaphore
class Linea_Orden:
"""
Permite que los chefs... |
"""The tests for Mobile App device actions."""
from homeassistant.components import automation, device_automation
from homeassistant.components.mobile_app import DATA_DEVICES, DOMAIN, util
from homeassistant.setup import async_setup_component
from tests.common import async_get_device_automations, patch
async def tes... |
from social_webpy.utils import get_helper, load_strategy, load_backend, psa, backends, login_redirect, strategy |
# -*- coding: utf-8 -*-
"""
Tests the 'read_fwf' function in parsers.py. This
test suite is independent of the others because the
engine is set to 'python-fwf' internally.
"""
from datetime import datetime
import numpy as np
import pytest
import pandas.compat as compat
from pandas.compat import BytesIO, StringIO
i... |
#!/bin/python3
t = int(input().strip())
for a0 in range(t):
n = int(input().strip())
i = 0
j = 1
result = 0
while j <= n:
if j % 2 == 0:
result = result + j
(i, j) = (j, i+j)
print(result) |
import pandas as pd
estados = ['acre|ac', 'alagoas|al', 'amapá|ap', 'amazonas|am', 'bahia|ba', 'ceará|ce', 'espírito santo|es', 'goiás|go', 'maranhão|ma', 'mato grosso|mt', 'mato grosso do sul|ms', 'goiás|go',
'maranhão|ma', 'minas gerais|mg', 'pará|pa', 'paraíba|pb', 'paraná|pr', 'pernambuco|pe', 'piauí|pi... |
from __future__ import print_function
from nose.tools import assert_equal
from numpy.testing import assert_almost_equal
from matplotlib.transforms import Affine2D, BlendedGenericTransform
from matplotlib.path import Path
from matplotlib.scale import LogScale
from matplotlib.testing.decorators import cleanup
import nump... |
# This is an example feature definition file
from google.protobuf.duration_pb2 import Duration
from feast import Entity, Feature, FeatureView, FileSource, ValueType, FeatureService
# Read data from parquet files. Parquet is convenient for local development mode. For
# production, you can use your favorite DWH, such ... |
# coding: utf-8
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... |
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return f"({self.x}, {self.y})"
points_a = [Point(0,0), Point(9,-2)]
points_b = [Point(-1,5), Point(3,4), Point(9,3)]
i, j = 0, 0
flag = True
xd, yd, min_dist = float('Inf'), float('Inf'), float(... |
from test.integration.base import DBTIntegrationTest, use_profile
import os
from dbt.logger import log_manager
from test.integration.base import normalize
import json
class TestStrictUndefined(DBTIntegrationTest):
@property
def schema(self):
return 'dbt_ls_047'
@staticmethod
def dir(value):... |
from setuptools import setup
from setuptools import find_packages
version = '0.32.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.26.0',
'certbot>=0.22.0',
'mock',
'PyOpenSSL',
'pyparsing>=1.5.5', # Python... |
"""
WSGI config for MyApp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTING... |
"""Auto-generated file, do not edit by hand. MA metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_MA = PhoneMetadata(id='MA', country_code=212, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[5-8]\\d{8}', possible_length=(9,)),
... |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... |
import machine, time
from machine import Pin
__version__ = '0.1.0'
__author__ = 'Roberto Sánchez'
__license__ = "Apache License 2.0. https://www.apache.org/licenses/LICENSE-2.0"
class HCSR04:
"""
Driver to use the untrasonic sensor HC-SR04.
The sensor range is between 2cm and 4m.
The timeouts receive... |
# coding: utf-8
from __future__ import unicode_literals
import re
import socket
from .common import InfoExtractor
from ..compat import (
compat_etree_fromstring,
compat_http_client,
compat_urllib_error,
compat_urllib_parse_unquote,
compat_urllib_parse_unquote_plus,
)
from ..utils import (
clea... |
from music21 import note, stream
N1 = note.Note('G3')
N1.duration.quarterLength = 1.5
N2 = note.Note('G3')
N2.duration.quarterLength = 0.5
N3 = note.Note('B3')
N3.duration.quarterLength = 0.4
N4 = note.Note('G3')
N4.duration.quarterLength = 1
N5 = note.Note('G3')
N5.duration.quarterLength = 1
N6 = note.Note('G3')
N6.d... |
# -*- coding: utf-8 -*-
import codecs
from os.path import abspath
from os.path import dirname
from os.path import join
from setuptools import find_packages
from setuptools import setup
import js_urls
def read_relative_file(filename):
"""Returns contents of the given file, whose path is supposed relative to this... |
from PySide2.QtGui import QDoubleValidator
from PySide2.QtWidgets import QGridLayout, QPushButton, QLabel, QCheckBox, QGroupBox, QLineEdit, QComboBox
from core.core import SensorController
from sensor.sensor_wrapper import SensorSettings
class SensorControls(QGroupBox):
sensor_controller: SensorController = Non... |
# 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 u... |
# coding: utf-8
"""
This module sends trace values to IRISA servers in order to be tested
"""
#import requests
#import logging
#
#send_url = "http://senslab2.irisa.fr/coap/submit"
#values = {
# "agree" : 1,
# "file": "irisa.py"
#}
#
#r = requests.post(send_url, data=values, files={'irisa.py': open('irisa.py', '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import os
import random
import subprocess
import sys
import time
def random_name():
return str(random.randint(0, 99999999))
def start_local_scheduler(plasma_store_name,
... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""
Berger Discrete ZOO
=======================================
(Generating Natural Language Adversarial Examples)
"""
import textattack
import os, sys
current_dir = os.path.dirname(os.path.realpath(__file__))
constraint_dir = os.path.normpath(
os.path.join(current_dir, os.pardir, os.pardir))
transformation_dir =... |
stabilization_threshold = 0.05
stabilization_nsamples = 5 |
import numpy as np
class FORMULAS:
@staticmethod
def vinf(eninf):
return np.sqrt(2. * eninf)
@staticmethod
def vinf_bern(eninf, enthalpy):
return np.sqrt(2.*(enthalpy*(eninf + 1.) - 1.))
@staticmethod
def vel(w_lorentz):
return np.sqrt(1. - 1. / (w_lorentz**2))
@... |
import pickle as plk
from sklearn import svm
from wsicolorfilter.filter import Filter
class SvmFilter(Filter):
"""Filter which assign each pixel to the nearest centroid of the model."""
def create_model(self):
return svm.LinearSVC()
def train_model(self, x, y):
# train model
se... |
r"""Definition of the DataLoader and associated iterators that subclass _BaseDataLoaderIter
To support these two classes, in `./_utils` we define many utility methods and
functions to be run in multiprocessing. E.g., the data loading worker loop is
in `./_utils/worker.py`.
"""
import threading
import itertools
import... |
#!/usr/bin/env python3
# Copyright (c) 2013-2018 The Hiphopcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import biplist
from ds_store import DSStore
from mac_alias import Alias
import sys
output_file = sys.a... |
from estimators import DataBase
def create_db():
db = DataBase(url='sqlite://')
db.initialize_database()
return db
db = create_db() |
from django.urls import path
from events import views
app_name = "api_events"
urlpatterns = [
path("", views.EventListView.as_view()),
path("<int:pk>/", views.EventDetailView.as_view()),
path("comment/<int:pk>/", views.EventCommentView.as_view()),
path("attachment/<int:pk>/", views.EventAttachmentView... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Particl Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_particl import ParticlTestFramework, isclose, connect_nodes_bi
class WalletRPC... |
import aiohttp
from aioresponses import aioresponses
from typing import Dict
from rki_covid_parser.const import DISTRICTS_URL, DISTRICTS_URL_RECOVERED, DISTRICTS_URL_NEW_CASES, DISTRICTS_URL_NEW_RECOVERED, DISTRICTS_URL_NEW_DEATHS, VACCINATIONS_URL
from rki_covid_parser.parser import RkiCovidParser
from rki_covid_par... |
# _vocola_main.py - NatLink support for Vocola
# -*- coding: latin-1 -*-
#
# Contains:
# - "Built-in" voice commands
# - Autoloading of changed command files
#
#
# Copyright (c) 2002-2012 by Rick Mohr.
#
# Portions Copyright (c) 2012-2013 by Hewlett-Packard Development Company, L.P.
#
# Permission is hereby gran... |
from typing import TYPE_CHECKING, List
from discordmenu.embed.view_state import ViewState
from tsutils.enums import AltEvoSort
from tsutils.query_settings import QuerySettings
from padinfo.common.config import UserConfig
from padinfo.view.common import get_monster_from_ims
from padinfo.view.components.evo_scroll_mixi... |
from typing import List, Dict
import math
import operator
from operator import add
import random as rand
import numpy as np
# import pandas as pd
# import random as rand
import copy as copy
import time as time
from logClass import log
import constants as CONST
import functions as fn
from snakeClass import snake
fr... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['ConstantTrend'] , ['BestCycle'] , ['AR'] ); |
#!/usr/bin/env python
# Remove portions of text from annotated files.
# Note: not comprehensively tested, use with caution.
import sys
try:
import argparse
except ImportError:
from os.path import basename
from sys import path as sys_path
# We are most likely on an old Python and need to use our in... |
# Lint as: python3
# Copyright 2019 Deepmind Technologies 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
# --- Do not remove these libs ---
import numpy as np # noqa
import pandas as pd # noqa
from pandas import DataFrame
from freqtrade.strategy.interface import IStrategy
# --------------------------------
# Add your lib to import he... |
from logger import logger
from perfrunner.helpers.cbmonitor import with_stats
from perfrunner.tests.view import ViewIndexTest, ViewQueryTest
class SpatialMixin(object):
def __init__(self, cluster_spec, test_config, verbose, experiment=None):
self._view_settings = test_config.spatial_settings
supe... |
import ctypes
import time
from PIL import Image
# ctypes.windll.user32.SystemParametersInfoW(20, 0, "absolute path", 0)
#get images
#get time
#get weather data
starttime = time.time()
while True:
ctypes.windll.user32.SystemParametersInfoW(20, 0, prepaired_image, 0)
time.sleep(60.0 - ((time.time() -... |
#!/usr/bin/env python
# -- coding: UTF-8
import os
import glob
import argparse
from tqdm import tqdm
from multiprocessing import Pool
from tool.data_io import safe_load, safe_store
# wav.scp <recording-id> <extended-filename>
def prepare_wav_scp(file_pattern, store_dir):
all_file_lines = []
file_path_list ... |
# coding: utf-8
"""
mParticle
mParticle Event API
OpenAPI spec version: 1.0.1
Contact: support@mparticle.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance wit... |
import unittest
import json
from server.data_anndata.anndata_adaptor import AnndataAdaptor
from server.common.data_locator import DataLocator
from server.common.app_config import AppConfig
from server.test import PROJECT_ROOT
class DataLoadAdaptorTest(unittest.TestCase):
"""
Test file loading, including defe... |
import os.path
import platform
import sys, imp, os
import ctypes
def load_library(libname, print_path=True):
# lib gets loaded from:
# pymunk/libchipmunk.so, libchipmunk.dylib or chipmunk.dll
s = platform.system()
arch, arch2 = platform.architecture()
path = os.path.dirname(os.path.abspath... |
#!/usr/bin/python
# A shell script that finds file sequences (renders, etc)
# and displays them as patterns with various options for
# judging size and progress
import argparse
import fnmatch
import glob
import itertools
import os
import re
import subprocess
import sys
class Color:
"""A class for printing forma... |
from fastapi import APIRouter
from app.controllers import trello_controller as router_trello
from app.core.config import API_PREFIX
api_router = APIRouter(prefix=API_PREFIX)
api_router.include_router(router_trello.router, tags=["trello"], prefix="/trello") |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.http import Http404
class StaffRequiredMixin(object):
@classmethod
def as_view(self, *args, **kwargs):
view = super(Staf... |
# 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 u... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.10.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
import json
from pysys.constants import FAILED
import requests
from pysys.basetest import BaseTest
"""
Environment to manage automated connect and disconnect to c8y
Tests that derive from class EnvironmentC8y use automated connect and
disconnect to Cumulocity. Additional checks are made for the status of
service mosq... |
import csv
import json
import logging
import os
import re
from tempfile import mkstemp
from urllib.parse import urlparse
from django.apps import apps
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.template.loader import get_template
from django.utils.translati... |
"""
Test Decorators
"""
from __future__ import absolute_import, division, unicode_literals
import json
import ddt
from twisted.trial.unittest import SynchronousTestCase
from mimic.rest.decorators import require_auth_token
class RequestMock(object):
"""
Mock extremely simple request object for decorator tes... |
LANGUAGE_CODE = 'en'
SECRET_KEY = 'ji2r2iGkZqJVbWDhXrgDKDR2qG#mmtvBZXPXDugA4H)KFLwLHy'
SITE_ID = 1
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = ['--nologcapture', '--with-id']
MEDIA_ROOT = '/tmp/cmsplugin-polls/media/'
STATIC_ROOT = '/tmp/cmsplugin-polls/static/'
ROOT_URLCONF = 'urls'
DATABASES = {
... |
from youtrackutils import mantis
# maps the cf type in mantis with the cf type in yt
mantis.CF_TYPES = {
0 : "string", #String
1 : "integer", #Nimeric
2 : "string", #Float
3 : "enum[1]", #Enumeration
4 : "string", #Email
5 : "enum[*]", #Checkbox
6 : "enum[1]", #List
... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"example_func": "00_core.ipynb",
"process_data": "01_cli.ipynb",
"train": "01_cli.ipynb",
"evaluate": "01_cli.ipynb",
"reproduce": "01_cli.ipynb"}
modules = ["core.py",
... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import os
import time
from django.core.exceptions import ValidationError
from django.core.files import File
from django.test import Client
from app.contexts.settings import load as load_settings
from app.models import Setting
from app.models import Theme
from webodm import settings as webodm_settings
from .classes im... |
#
# File : codeblocks.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
#
# This program 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 2 ... |
from django.contrib.auth.models import User
from library.utils import string_deterministic_hash
class SpaceThemedAvatarProvider:
@classmethod
def get_avatar_url(cls, user: User, size):
if user.username == 'admin_bot':
return '/static/icons/users/bot.svg'
icons = [
"00... |
from collections import OrderedDict
from collections.abc import Iterable, Mapping
from numbers import Real, Integral
from xml.etree import ElementTree as ET
import warnings
import numpy as np
import pandas as pd
import h5py
from uncertainties import ufloat
import openmc
import openmc.checkvalue as cv
_VERSION_VOLUME... |
import os
import glob
import torch
import torchvision.utils as vutils
import webrtcvad
from mfcc import MFCC
from utils import voice2face_encoder
from tqdm import tqdm
import sys
from parse_config import get_model
import importlib
from models.stylegan2_pytorch import ModelLoader
from configs.criteria import model_paths... |
import torch
def prepare_obs(obs, done, fstack):
assert obs.dtype == torch.uint8
assert obs.shape[2] == 1
if fstack > 1:
obs = stack_frames(obs, fstack)
done_stacked = stack_frames(done, fstack)
obs = obs * obs_mask(done_stacked)
return obs.float() / 128 - 1
def stack_frames... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.