text stringlengths 2 999k |
|---|
# coding: utf-8
"""
OANDA v20 REST API
The full OANDA v20 REST API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more. To authenticate use the string 'Bearer ' followed by the token which can be obtained at https://www.oanda.com/demo-account/tpa/perso... |
"""Support for LED lights that can be controlled using PWM."""
import logging
from pwmled import Color
from pwmled.driver.gpio import GpioDriver
from pwmled.driver.pca9685 import Pca9685Driver
from pwmled.led import SimpleLed
from pwmled.led.rgb import RgbLed
from pwmled.led.rgbw import RgbwLed
import voluptuous as vo... |
# Generated by Django 2.2 on 2019-06-04 06:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('talk_proposals', '0003_audiencechoice'),
]
operations = [
migrations.AddField(
model_name='talkpr... |
def l (): print("="*30)
class User:
def __init__(self, nome_completo, aniversario):
self.nome = nome_completo
self.aniversario = aniversario
nome_pieces = nome_completo.split(' ')
self.primeiro_nome = nome_pieces[0]
self.sobrenome = nome_pieces[-1]
l() ... |
from dataclasses import dataclass
from datetime import datetime
from kinopoisk_unofficial.contract.response import Response
from kinopoisk_unofficial.model.dictonary.review_type import ReviewType
@dataclass(frozen=True)
class ReviewDetailsResponse(Response):
review_id: int
review_type: ReviewType
review_... |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="mesh3d.colorbar.title", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jackeroo
# @Time : 2019/11/10
# @File : Result.py
# @Contact : jackeroo@qq.com
# @Software : PyCharm
# @Desc : 结果返回数据结构定义类
from typing import TypeVar
from app.enums.ResultEnum import ResultEnum
T = TypeVar('T')
class Result:
def __i... |
import os
import json
testdir = os.path.dirname(os.path.abspath(__file__))
class MockPost(object):
def __init__(self, filename):
self.filename = filename
def __call__(self, url, payload):
return self
def json(self):
filepath = os.path.join(testdir, 'data', self.filename)
... |
'''
Web scraping tool to randomly pick dates based
on the price and location
'''
from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
def get_url(url: str) -> None:
try:
with closing(get(url, stream=True)) as resp:
... |
import unittest
from q1404 import Solution
class Test(unittest.TestCase):
def q1404(self):
s = Solution()
self.assertEqual(0, s.numSteps('1'))
self.assertTrue(5 == s.numSteps('1111'))
t = Test()
t.q1404()
|
from extutils.locales import LocaleInfo
from extutils.dt import localtime
from models import Model, ModelDefaultValueExt
from models.field import DateTimeField, ObjectIDField, TextField
class RemoteControlEntryModel(Model):
UserOid = ObjectIDField("uid", default=ModelDefaultValueExt.Required, stores_uid=True)
... |
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-5, 5, 500)
triangle = signal.sawtooth(2 * np.pi * 1/5 * (x + 5), 0.5) - 1
plt.plot(x, triangle)
plt.show()
def triangle2(length, amplitude):
section = length // 4
x = np.linspace(0, amplitude, section+1)
mx = -x
... |
import sys, os, inspect
newpath = os.path.dirname(inspect.getfile(inspect.currentframe())) # script directory
newpath = "/".join(newpath.split("/")[:-1])
if not newpath in sys.path:
sys.path.append(newpath)
from xyzMath import Vec
from math import sqrt
def hcp(i, j, k, r=1.0):
return r * Vec(2.0 * i + (j % 2) +... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import gzip
import json
import os
import numpy as np
import tensorflow as tf
from polyaxon import Modes
from polyaxon.datasets.converters import ImagesToTFExampleConverter, PNGNumpyImageReader
from polyaxon.datasets.utils import... |
from django.apps import AppConfig
class ProfilesConfig(AppConfig):
name = 'profiles'
def ready(self):
from .signals import create_profile, update_song_plays
|
import json
import pytest
from model_mommy import mommy
from rest_framework import status
from unittest.mock import Mock
from usaspending_api.awards.models import (
TransactionNormalized,
TransactionFABS,
TransactionFPDS,
Subaward,
BrokerSubaward,
)
from usaspending_api.awards.v2.lookups.lookups i... |
# Copyright (C) 2021 Satoshi Konno. 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... |
import torch
import pdb
class Net(torch.nn.Module):
def __init__(self):
super().__init__()
mult_chan = 32
depth = 4
starting_chan = 200
intermediate_chan = 100
final_chan = 17
self.spec_conv = SubNet2Conv(starting_chan,intermediate_chan) #First Spectral Chann... |
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.xmlstream import ElementBase, ET
class UserGaming(ElementBase):
name = 'gaming'
namespace = 'urn:xmpp:gamin... |
from collections import defaultdict, OrderedDict, deque
import copy
import numpy as np
import pandas as pd
import scipy.stats
from scipy.linalg import LinAlgError
import scipy.sparse
# TODO use balanced accuracy!
from sklearn.multiclass import OneVsRestClassifier
from sklearn.utils import check_array
from sklearn.u... |
from django.urls import path
from courses.views import CourseView, ExamCourseViseView
urlpatterns = [
path('get_all/', CourseView.as_view()),
path('exams/', ExamCourseViseView.as_view()),
]
|
# Generated by Django 2.2.13 on 2020-09-14 12:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workflow', '0027_auto_20200428_0711'),
]
operations = [
migrations.AddField(
model_name='organization',
name='house... |
# Generated by Django 2.1.9 on 2019-06-19 19:59
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
# Tai Sakuma <tai.sakuma@gmail.com>
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.loop.splitfuncs import create_files_start_length_list
from alphatwirl.loop.splitfuncs import _full_path
from alphatwirl.loop.splitfuncs import _files_start_length_list
##_______... |
from rest_framework import serializers
from diplomas.tasks import regenerate_diplomas
from users.models import User
class UserUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = [
'first_name',
'last_name',
'first_name_en',
... |
# Copyright (c) 2019 Horizon Robotics. 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 applicab... |
#!/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 argparse
import os
import torch
from classy_vision.generic.util import is_pos_int
def add_generic_args(parser... |
"""
WSGI config for leave_33574 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_S... |
import matplotlib.pyplot as plt
import numpy as np
def main():
"""Plots AP scores from the native eval script and prints top 5 checkpoints
for each metric
"""
# Output from native eval
results_file = '/home/cecilia/leo_projects/bishe2019/3D-Detection/avod/data/outputs/pyramid_cars_with_aug_tr... |
# Copyright (c) 2020 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Name: _extd_ast_expr
# Purpose: Extensions of AST subclasses used in expressions
#
# Author: Michael Amrhein (michael@adrhinum.de)
#
# Copyright: (c) 2018 ff. Michael Amrhein
# License: This pr... |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: direct.distributed.ClockDelta
from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase ... |
import argparse
import logging
import sys
from .bot import RandoBot
def main():
parser = argparse.ArgumentParser(
description='RandoBot, because OoTR seeds weren\'t scary enough already.',
)
parser.add_argument('ootr_api_key', type=str, help='ootrandomizer.com API key')
parser.add_argument('c... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket 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 applica... |
""" Generate conformations using RDKit. """
import os
# noinspection PyUnresolvedReferences
from rdkit import Chem
# noinspection PyUnresolvedReferences
from rdkit.Chem import AllChem, rdMolTransforms
# noinspection PyPackageRequirements
from tap import Tap
from typing import List
from conformation.distanc... |
from django.conf.urls.defaults import *
# for voting
from voting.views import vote_on_object
from bookmarks.models import Bookmark
urlpatterns = patterns('',
url(r'^$', 'bookmarks.views.bookmarks', name="all_bookmarks"),
url(r'^your_bookmarks/$', 'bookmarks.views.your_bookmarks', name="your_bookmarks"),
u... |
from abc import ABC, abstractmethod
from ray.rllib.policy.policy import Policy
class HeuristicPolicy(Policy, ABC):
"""Abstract class for policies that do not learn."""
@abstractmethod
def compute_actions(self, *args, **kwargs):
pass
def learn_on_batch(self, samples):
pass
def ge... |
from freesia import Freesia, set_up_session, get_session, Response
from freesia.session import SimpleCookieSession
app = Freesia()
@app.route("/")
async def hello(request):
s = await get_session(request)
if "count" not in s:
s["count"] = 1
return Response(text="Hello, stranger!")
else:
... |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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 o... |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ListEnterpriseProjectResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_... |
t = int(input())
while t:
P = input()
s = 1
for i in range(0, len(P), 2):
if P[i]==P[i+1]:
s = 0
break
else:
s = 1
if (s==0):
print("no")
else:
print("yes")
t = t-1 |
# -*- coding: utf-8 -*- #
# Copyright 2015 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... |
# Copyright (c) 2021 Food-X Technologies
#
# This file is part of foodx_devops_tools.
#
# You should have received a copy of the MIT License along with
# foodx_devops_tools. If not, see <https://opensource.org/licenses/MIT>.
"""Azure ARM template parameter generation."""
import copy
import json
import logging
imp... |
from .amqp import AMQPMessage, amqp_decoder
from .constants import OffsetType
from .consumer import Consumer
from .producer import Producer, RawMessage
__all__ = [
"AMQPMessage",
"amqp_decoder",
"Consumer",
"RawMessage",
"Producer",
"OffsetType",
]
|
import random
import numpy as np
import torch
from collections import namedtuple, deque
import copy
class ReplayBuffer:
"""Fixed-size buffer to store experience tuples."""
def __init__(self, buffer_size, device, seed=42):
"""Initialize a ReplayBuffer object.
Keywords:
buffer_... |
import pathlib
import sys
import itertools
import numpy as np
def parse(puzzle_input):
"""Parse input"""
lines = [str(line) for line in puzzle_input.split('\n')]
points = [ tuple([ tuple([el for el in point.split(',')]) for point in line.split(' -> ')]) for line in lines]
return points
def part1(data... |
from brownie import *
from brownie.network.contract import InterfaceContainer
import json
import time;
import copy
from scripts.utils import *
import scripts.contractInteraction.config as conf
def swapTokens(amount, minReturn, swapNetworkAddress, sourceTokenAddress, destTokenAddress):
abiFile = open('./scripts/c... |
s = input()
sz = len(s)
a = ""
for x in range(sz):
if x%2 == 0:
a += s[x]
print(a) |
# coding=utf-8
"""
Interface to the "airports.db" package data file.
"""
import logging
import os
import sqlite3
import sys
import threading
import typing
import pkg_resources
LOGGER = logging.getLogger('elib.wx')
LOGGER.debug('reading airports.db')
DB_PATH = os.path.join(os.path.dirname(__file__), 'templates', 'ai... |
from ctypes import *
import sys, os, re, glob
from base64 import b64decode
from ConfigParser import RawConfigParser
import sqlite3
import json
import shutil
from itertools import product
from pyasn1.codec.der import decoder
from struct import unpack
from binascii import hexlify, unhexlify
from hashlib import sha1
impo... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... |
import pickle
import json
import numpy as np
__locations = None
__data_columns = None
__model = None
def get_estimated_price(location, sqft, bhk, bath):
try:
loc_index = __data_columns.index(location.lower())
except:
loc_index = -1
x = np.zeros(len(__data_columns))
x[... |
# Copyright 2017 The TensorFlow 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... |
"""
start_servers.py
<Purpose>
A simple script to start the three cloud-side Uptane servers:
the Director (including its per-vehicle repositories)
the Image Repository
the Timeserver
To run the demo services, run the following from the main uptane
directory (which contains, for example, setup.py).
... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.variant
from spack.directives import conflicts, depends_on, variant
from spack.package import PackageBase
c... |
import torch
from torch import nn
__author__ = "Daniel-Tobias Rademaker"
####################################################
# Single GNN-layer #
####################################################
class GNN_layer(nn.Module):
def __init__( # pylint: disable=too-many-arguments
... |
from collections import OrderedDict
class ConnectedDevice(object):
_instance = None
devices = {}
groups = OrderedDict()
groups['MX']=[]
groups['SRX']=[]
groups['QFX']=[]
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(ConnectedDevice, cls)._... |
# Copyright 2018 D-Wave Systems 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... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
def increment_last_byte(byte_string):
s = bytearray(byte_string)
s[-1] = s[-1] + 1
return bytes(s)
def to_bytes(maybe_bytestring):
"""
Encode string to bytes.
Convenience function to do a simple encode('utf-8') if the input is not
already bytes. Returns the data unmodified if the input is... |
import datetime
import inspect
import logging
import operator
import sys
import uuid
from collections import OrderedDict
from decimal import Decimal
from django.core import validators
from django.db import models
from rest_framework import serializers
from rest_framework.settings import api_settings as rest_framework_... |
from datetime import timedelta as td
from unittest.mock import Mock
from django.core import mail
from django.utils.timezone import now
from hc.accounts.management.commands.senddeletionnotices import Command
from hc.accounts.models import Member
from hc.api.models import Check, Ping
from hc.test import BaseTestCase
c... |
import datetime
from concurrent.futures.thread import ThreadPoolExecutor
from pathlib import Path
from types import SimpleNamespace
from typing import Optional, Union, Dict
import aiohttp
import pytz
from d4dj_utils.master.asset_manager import AssetManager
from discord.ext import commands
from discord.ext.commands imp... |
# Generated by Django 3.1.7 on 2021-04-02 10:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('venues', '0012_auto_20210402_1040'),
]
operations = [
migrations.AlterField(
model_name='venue',
name='image',
... |
#/usr/bin/env python
import QtTesting
import QtTestingImage
object1 = 'pqClientMainWindow/MainControlsToolbar/actionOpenData'
QtTesting.playCommand(object1, 'activate', '')
object2 = 'pqClientMainWindow/FileOpenDialog'
QtTesting.playCommand(object2, 'filesSelected', '$PARAVIEW_DATA_ROOT/Testing/Data/SPCTH/Dave_Kareli... |
import numpy as np
import uuid
import warnings
import vaex
from .dataframe import DataFrameRemote
from .executor import Executor
def create_df(name, info, executor):
_dtypes = {name: vaex.encoding.dtype_encoding.decode(None, dtype) for name, dtype in info['dtypes'].items()}
df = DataFrameRemote(name=name,
... |
# -*- coding: utf-8 -*-
r"""
ClusterSeed
A *cluster seed* is a pair `(B,\mathbf{x})` with `B` being a *skew-symmetrizable* `(n+m \times n)` *-matrix*
and with `\mathbf{x}` being an `n`-tuple of *independent elements* in the field of rational functions in `n` variables.
For the compendium on the cluster algebra and qu... |
import binascii
import os
def generate_key():
return binascii.hexlify(os.urandom(20)).decode()
|
import pretrainedmodels
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
class PolyNet(nn.Module):
def __init__(self, parameters):
super().__init__()
self.pretrained = parameters['pretrained']
... |
# 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 may ... |
import turtle
def s(n, l):
if n == 0:
# turtle.fd(l / 2)
# turtle.left(120)
# turtle.fd(l / 2)
# turtle.left(120)
# turtle.fd(l / 2)
# turtle.left(120)
return
else:
turtle.fd(l/2)
turtle.left(120)
s(n-1, l/2)
turtle.fd(l /... |
# libaries
import pygame
import random
# Constants
WIDTH = 600
HEIGHT = 400
FPS = 30
# player speed
SPEEDY = 7
SPEEDX = 7
# Colors in RGB
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
CYAN = (0, 255, 255)
PURPLE = (255, 0, 255)
YELLOW = (2... |
# author: gorquan <gorquanwu@gmail.com>
# date: 2019.7.21
import requests
import random
from urllib.parse import urlparse
from bs4 import BeautifulSoup
import ast
from message import Message
import json
import html
import urllib.parse
from urllib.parse import parse_qs
class SharedMessage(Message):
def __init__(se... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("HFShowerLib")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi")
process.load("Geometry.CMSCommonData.cmsExtendedGeometryHFLibraryXML_cfi")
process.load("Geometry.TrackerNumbering... |
"""
This file offers the methods to automatically retrieve the graph data.
The graph is automatically retrieved from the NetworkRepository repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021-02-06 ... |
import inspect
import os
import sys
is_py2 = (sys.version_info[0] == 2)
is_py3 = (sys.version_info[0] == 3)
is_py33 = (sys.version_info[0] == 3 and sys.version_info[1] == 3)
is_win32 = os.name == "nt"
# win/nix compatible devnull
try:
from subprocess import DEVNULL
def devnull():
return DEVNULL
excep... |
from mock import DEFAULT, Mock, patch
from unittest import TestCase
from django.core.management.base import CommandError
from django.core.management import call_command
from six import StringIO
from django_elasticsearch_dsl import Index
from django_elasticsearch_dsl.management.commands.search_index import Command
fro... |
import pytest
import glob
import pandas as pd
import numpy as np
import os
import sys
sys.path.append("..")
from clusters.algs import Ligand, HierarchicalClustering, PartitionClustering,Silhouette_Coefficient, ClusterNode, getEuclidean, Rand_Index
import matplotlib.pyplot as plt
import time
import numpy as np
import ... |
# Copyright (c) 2017 Sony 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 applicabl... |
# -*- coding: utf-8 -*-
"""
Wrapper class for the Amazon Polly TTS
"""
from boto3 import Session
from botocore.exceptions import BotoCoreError, ClientError
from contextlib import closing
import pygame
class TTS(object):
"""Module for generate text to speech files."""
# TTS params
region = 'us-east-1'
... |
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, 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 Licens... |
# coding: utf8
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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
#
# Un... |
# -*- coding: utf-8 -*-
"""
pygments.formatters._mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter mapping definitions. This file is generated by itself. Everytime
you change something on a builtin formatter definition, run this script from
the formatters folder to update it.
Do not alter the FOR... |
# write tests for parsers
from seqparser import (
FastaParser,
FastqParser)
import os
currentdir = os.getcwd() #GitHub/project1/
def test_freebie_parser_1():
"""
This one is a freebie
DO NOT MODIFY THIS FUNCTION
"""
assert True
def test_freebie_parser_2():
"""
This to... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
# Copyright 2005-2008 by Frank Kauff & Cymon J. Cox. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
# Bug reports welcome: fkauff@biologie.uni-kl.de or on Biopython's bugzilla.
... |
import os
import numpy as np
from torch.utils.data import Dataset
from PIL import Image
np.random.seed(0)
from torchvision import transforms # noqa
from wsi.data.annotation import Annotation # noqa
class GridImageDataset(Dataset):
"""
Data producer that generate a square grid, e.g. 3x3, of patches and t... |
#!/usr/bin/env python
from __future__ import print_function
"""
lex_test.py: Tests for lex.py
"""
import re
import unittest
from core.lexer import LineLexer
from core import test_lib
from osh import lex
from osh import match
from osh import parse_lib
from osh.meta import ast, Id, Kind, LookupKind, types
lex_mode_e ... |
"""Redis outbound transport."""
from typing import Union
import aioredis
import msgpack
from ....core.profile import Profile
from .base import BaseOutboundQueue, OutboundQueueConfigurationError, OutboundQueueError
class RedisOutboundQueue(BaseOutboundQueue):
"""Redis outbound transport class."""
config_ke... |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
#
"""
Occupancy models consider when occupants arrive or depart a space
(or building) as well as how many occupants are present at a particular time.
Models
======
Queueing
--------
.. automodule:: occupant.occupancy.queueing
""" |
# 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 may ... |
# coding: utf-8
"""Configurations for py.test runner"""
import pytest
from ctrlibrary.core import settings
from ctrlibrary.threatresponse import token
from ctrlibrary.relay_api.base import RelayApiToken, RelayApi
def pytest_collection_modifyitems():
if not settings.configured:
settings.configure()
re... |
from . import views
urlpatterns = views.CategoryCRUDL().as_urlpatterns()
urlpatterns += views.CategoryImageCRUDL().as_urlpatterns()
|
# Write a program to check whether a number is an even multiple of 3
# for more info on this quiz, go to this url: http://www.programmr.com/even-multiple-3
def even_multiple_of_3(number):
if number % 3 == 0 and number % 2 == 0:
return True
else:
return False
if __name__ == "__main__":
pr... |
"""Initilization procedure for `Objective` modules."""
import inspect
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
__all__ = []
for py in [
f[:-3] for f in os.listdir(path)
if f.endswith('.py') and f != '__init__.py'
]:
mod = __import__('.'.join([__name__, py]), fromlist=... |
import logging
from flask import Blueprint, Markup
from flask import (request, render_template, send_file, redirect, url_for,
flash, abort)
from flask_menu import register_menu
from .. import api
from ._navbar import show_items, activate_items
from ._utils import (call, create_csv, mark_pair_viewe... |
from django.apps import AppConfig
try:
from watson import search
except:
import watson as search
__author__ = 'Jake'
class EventsConfig(AppConfig):
name = 'events'
verbose_name = "Events Module"
def ready(self):
Event = self.get_model('Event')
CCReport = self.get_model('CCReport... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.