text stringlengths 2 999k |
|---|
from fhi_git import vaccine, dead, tested_lab
from fhi_git import confirmed as confirmed_fhi
from fhi_web import tested, smittestopp, transport
from helsedir_api import hospitalized
from msis_api import confirmed as confirmed_msis
from utils import confirmed_new_day, update_readme, load_sources, write_sources
def res... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
level_created = (
"Successfully created level",
"Failed to create level"
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Based on Rémy Greinhofer (rgreinho) tutorial on subcommands in docopt
# https://github.com/rgreinho/docopt-subcommands-example
# Also based on Cyril Mathey-Doret (cmdoret) commands.py in hicstuff
# https://github.com/koszullab/hicstuff
from docopt import docopt
import sys, o... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import absolute_import, unicode_literals
import json
import os
import os.path
import subprocess
import sys
import unittest
from testing_tools.adapter.util import PATH_SEP, fix_path
from ...__main__ import T... |
#!/usr/bin/env python3
# @Time : 17-9-9 18:34
# @Author : Wavky Huang
# @Contact : master@wavky.com
# @File : mhcalendar.py
"""Calendar to manage your man-hour.
Usage:
mhcalendar (-h | --help)
mhcalendar (-V | --version)
mhcalendar (-J | --Job) <required_manhour> <daily_work_hours> <hourly_pay> <ma... |
"""wordMerge URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... |
# Copyright 2020 The TensorFlow Probability 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 applicable law o... |
"""Support for Belkin WeMo lights."""
import asyncio
from datetime import timedelta
import logging
from homeassistant import util
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ATTR_TRANSITION,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_T... |
# Copyright 2016 Canonical 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 writing, s... |
from PyQt4 import QtGui, QtCore
from Box import Box
from random import choice
class Communicate(QtCore.QObject):
signal = QtCore.pyqtSignal(str)
# Class Map
class Map(QtGui.QWidget):
magic_changed = QtCore.pyqtSignal(int)
def __init__(self, parent=None, display=None):
super(... |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import json
import logging
import os
import numpy as np
import six
from threedigrid.admin.h5py_datasource import H5py... |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
from accessify import protected
class Car:
@protected
def start_engine(self):
return 'Engine sound.'
def run(self):
return self.start_engine()
if __name__ == '__main__':
car = Car()
assert 'Engine sound.' == car.run()
car.start_engine()
|
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Notebook, Member
# Constants
UserModel = get_user_model()
# Utils
def create_user_util(**fields):
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Mortar Data
#
# 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 math
from codes.a_config._rl_parameters.off_policy.parameter_td3 import PARAMETERS_TD3, TD3ActionType, TD3ActionSelectorType
from codes.a_config._rl_parameters.on_policy.parameter_ppo import PARAMETERS_PPO
from codes.e_utils.names import *
from codes.a_config.parameters_general import PARAMETERS_GENERAL, Stocha... |
from . import Model, NSHome
from peewee import ForeignKeyField, BigIntegerField, CharField, IntegerField
class NSUser(Model):
origin = ForeignKeyField('self', null = True, backref = 'linked_users')
home = ForeignKeyField(NSHome, backref = 'users')
id_int = BigIntegerField(null = True)
id_str = CharFiel... |
#!/home/carey/Documents/Python/Django/neighborhood/virtual/bin/python3.8
# When the django-admin.py deprecation ends, remove this script.
import warnings
from django.core import management
try:
from django.utils.deprecation import RemovedInDjango40Warning
except ImportError:
raise ImportError(
'django... |
import unittest
from troposphere import Template, efs
class TestEfsTemplate(unittest.TestCase):
def test_bucket_template(self):
template = Template()
title = "Efs"
efs.FileSystem(title, template)
self.assertIn(title, template.resources)
class TestEfs(unittest.TestCase):
def ... |
import unittest
import torch
from rising.random import AbstractParameter, DiscreteParameter
class TestAbstract(unittest.TestCase):
def test_none(self):
param = DiscreteParameter([None], replacement=True)
res = param((1,))
self.assertIsNone(res)
def test_tensor_like(self):
pa... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
if not l1:
return l2
if not l2:
return l1
head = Li... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2017 Anler Hernández ... |
# Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
import logging
import subprocess
from .integration_test import IntegrationTest
logger = logging.getLogger('arvados.arv-mount')
class MountTypeTest(IntegrationTest):
@IntegrationTest.mount(argv=["--subtype=arv-mount-... |
DEFAULT_CONFIG = """
[flosculus]
; the IP address (or host name) of the remote server
; this is a global option but it's easily overriden in log section
remote_host = 127.0.0.1
; the TCP port of the remote server
; this is a global option but it's easily overriden in log section
remote_port = 24224
; Each section wi... |
import pygame as pg
display = pg.display.set_mode((900,600))
clock = pg.time.Clock()
jump = 10
step = 0
img = 0
left = [pg.image.load('images/character/l1.png'),pg.image.load('images/character/l2.png'),pg.image.load('images/character/l3.png'),pg.image.load('images/character/l4.png'),pg.image.load('images/character/l5.p... |
# A function is a block of code which only runs when it is called. In Python,
# we do not use curly brackets, we use indentation with tabs or spaces
# Create function
def sayHello(name='Sam'):
print(f'Hello {name}')
sayHello('John Doe')
sayHello()
# Return values
def getSum(num1, num2):
total = num1 + num2
... |
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condi... |
## @package convnet_benchmarks
# Module caffe2.python.convnet_benchmarks
"""
Benchmark for common convnets.
Speed on Titan X, with 10 warmup steps and 10 main steps and with different
versions of cudnn, are as follows (time reported below is per-batch time,
forward / forward+backward):
CuDNN V3 ... |
import graphene
try:
from django.apps import apps
from .errors import ValidationError
class ValidationErrorObjectType(graphene.ObjectType):
code = graphene.String()
class Query(graphene.ObjectType):
"""
This query discovers all validation errors in every Django app and builds... |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from .literals import (
TEST_CASE_SUPERUSER_EMAIL, TEST_CASE_SUPERUSER_PASSWORD, TEST_CASE_SUPERUSER_USERNAME,
TEST_CASE_GROUP_NAME, TEST_GROUP_NAME_EDITED, TEST_CASE_USER_EMAIL,
TEST_CASE_USER_PASSWORD, TEST_CASE_U... |
from flask import Flask, Response, jsonify, render_template, redirect, request
from base64 import b64decode, b64encode
from view import generate_css_bar, load_image_b64
app = Flask(__name__)
def make_svg(artist_name, song_name, img, is_now_playing, cover_image, theme):
print("make_svg")
height = 445 if cov... |
import random
import time
import requests
from bs4 import BeautifulSoup
import json
from pprint import pprint
import urllib3
from fake_useragent import UserAgent
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
ua = UserAgent()
urllib3.disable_warnings()
surface_habitab... |
from __future__ import annotations
import re
import enum
import asyncio
import warnings
from io import BytesIO
from typing import Any, List, Optional
from asyncio import TimeoutError
import PIL
import aiohttp
import discord
from PIL.Image import DecompressionBombWarning
from discord.ext import commands
from pink.e... |
# Copyright 2016 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 applica... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.11
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re
# pyt... |
from ruamel.yaml import YAML, yaml_object
from great_expectations.types import LooselyTypedDotDict
yaml = YAML()
@yaml_object(yaml)
class ClassConfig(LooselyTypedDotDict):
"""Defines information sufficient to identify a class to be (dynamically) loaded for a DataContext."""
_allowed_keys = {
"module_n... |
# 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 Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables
class AuthCon... |
import urllib.parse
from typing import TYPE_CHECKING
import tsutils
if TYPE_CHECKING:
from dadguide.models.monster_model import MonsterModel
INFO_PDX_TEMPLATE = 'http://www.puzzledragonx.com/en/monster.asp?n={}'
YT_SEARCH_TEMPLATE = 'https://www.youtube.com/results?search_query={}'
SKYOZORA_TEMPLATE = 'http://pa... |
"""
Classes for dealing with vector data.
"""
import numpy as np
from sklearn.utils.validation import check_is_fitted
from .base import n_1d_arrays, check_fit_input, least_squares, BaseGridder
from .spline import warn_weighted_exact_solution
from .utils import parse_engine
from .coordinates import get_region
try:
... |
#!/usr/bin/env python3
import os
import sys
import yaml
headers = """
groups:
- name: kill-idle
rules:
"""
kill_template = """
- alert: kill-idle-jobs-email-%s
for: %dh
expr: avg(task_gpu_percent{vc_name="%s"}) by (user_email, job_name, vc_name) == 0
labels:
type: kill_idle_job_em... |
#!/usr/bin/env python
"""Obtains all values (0 or more) associated with a keyword.
History:
2002-02-04 ROwen Allowed additional characters in undelimited strings.
Now all ascii printable characters are allowed except ,;='"`\
the first 5 are crucial; the others are excluded
... |
from setuptools import setup
setup(name='gym_snake',
version='0.1.7',
description='Gym Snake Env',
url='https://github.com/boangri/gym-snake',
author='Boris Gribovskiy',
packages=['gym_snake', 'gym_snake.envs'],
author_email='xinu@yandex.ru',
license='MIT License',
insta... |
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2021 Tianmian Tech. 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/LI... |
"""
Provides BaseProducer class to subclass from.
"""
class BaseProducer(object):
pass
|
from collections import deque
# to keep track of the blocks of maze
class Grid_Position:
def __init__(self, x, y):
self.x = x
self.y = y
# each block will have its own position and cost of steps taken
class Node:
def __init__(self, pos: Grid_Position, cost):
self.pos = pos... |
class TestPyTest:
def testOne(self):
assert True
def testTwo(self):
assert False
|
#!/usr/bin/env python
import math
from scad import *
def simple(size, level=0):
if level == 0:
ret = union()(
pyramid("top", size, center=True),
translate([-size / 2.0, -size / 2.0, -size])( pyramid("b1", size, center=True) ),
translate([size / 2.0, -size / 2.0, -size])... |
"""
forward 5
down 5
forward 8
up 3
down 8
forward 2
After following these instructions, you would have a horizontal position of 15 and a depth of 10. (Multiplying these together produces 150.)
"""
import pytest
from day02 import chain_commands, execute_command
@pytest.mark.parametrize(
"command, expected", [("f... |
import os
url = os.getenv("RPI_CLUSTER")
if not url:
raise Exception("Missing environment variable: RPI_CLUSTER")
apikey = os.getenv("RPI_APIKEY")
if not apikey:
raise Exception("Missing environment variable: RPI_APIKEY")
password = os.getenv("RPI_PASSWORD")
if not password:
raise Exception("Missing en... |
from waflib.TaskGen import feature, before_method, after_method
from waflib import Options, Context, Node, Utils, Errors, Build, TaskGen
import os
@feature('bugengine:android:aapt_resource')
def aapt_resource(self):
if 'android' in self.env.VALID_PLATFORMS:
self.manifest = self.make_bld_node('src', '', 'A... |
import warnings
from .imports import *
from .torch_imports import *
from .rnn_reg import LockedDropout,WeightDrop,EmbeddingDropout
from .model import Stepper
from .core import set_grad_enabled
import numpy as np
IS_TORCH_04 = LooseVersion(torch.__version__) >= LooseVersion('0.4')
def seq2seq_reg(output, xtra, loss, a... |
from __future__ import print_function, division
from sympy import Number
from sympy.core import Mul, Basic, sympify, Add
from sympy.core.compatibility import range
from sympy.functions import adjoint
from sympy.matrices.expressions.transpose import transpose
from sympy.strategies import (rm_id, unpack, typed, flatten,... |
# Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from posts.models import Post
import json
# Create your views here.
def index(request):
# retrieve posts and truncate its content to 123 characters
posts = Post.retrieve_truncate_posts(Post, 123)
context = {
... |
# Вторая справа цифра
num = int(input())
def second_figure(num):
if num < 10:
ans = 0
elif num >= 100:
ans = (num // 10) % 10
else:
ans = num // 10
return print(ans)
second_figure(num)
|
# -*- coding: utf-8 -*-
from . import res_company
from . import res_config_settings
from . import auth_oauth
from . import wecom_apps
|
# -*- coding: utf-8 -*-
"""
pint.unit
~~~~~~~~~
Functions and classes related to unit definitions and conversions.
:copyright: 2016 by Pint Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, ab... |
# Copyright 2022 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 applica... |
import MySQLdb
#连接数据库, 得到Connection 对象
conn = MySQLdb.connect(host='localhost', db='pa_db',
user='root', passwd='123456', charset='utf8')
#创建Curosr 对象,用来执行SQL语句
cur = conn.cursor()
#创建数据表
cur.execute('CREATE TABLE person (name VARCHAR(32), age INT, sex char(1)) \
ENGINE=InnoDB DEFAULT CH... |
# Filename: config.py
"""
BART Configuration
"""
# Standard libraries
import os
from enum import Enum
STRFTIME = "%m/%d/%Y"
VALIDATION_KEY = os.getenv('BART_VALIDATION_KEY', None)
if VALIDATION_KEY is None:
raise ImportError("cannot find the value of $BART_VALIDATION_KEY")
URL = {
'etd': 'http://api.bart.... |
from django.apps import AppConfig
class ActivityapiConfig(AppConfig):
name = 'activityAPI'
|
import chainer.functions as F
import numpy as np
import time
data = np.ndarray((10, 3, 2240, 2240), dtype=np.float32)
data.fill(333.33)
datay = np.ndarray((10, 3, 2240, 2240), dtype=np.float32)
datay.fill(333.33)
total_forward = 0
count = 0
niter = 15
n_dry = 3
for i in range(niter):
x = np.asarray(data),
gy... |
"""\
Perl generator functions for wxSlider objects
@copyright: 2002-2004 D. H. aka crazyinsomniac on sourceforge
@copyright: 2014-2016 Carsten Grohmann
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import common
import wcodegen
class PerlSliderGenerator(wcodegen.PerlWidgetCodeWriter):
... |
def info(message):
print(green('[info] {}'.format(message)))
def warn(message):
print(yellow('[warn] {}'.format(message)))
def error(message):
print(red('[error] {}'.format(message)))
def _wrap_with(code):
def inner(text, bold=False):
c = code
if bold:
c = "1;%s" % c
... |
# Copyright 2021 IBM Corp. 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 or agre... |
#! /usr/bin/env python
"""A package that implements HTTP 1.1"""
__all__ = ['grammar', 'params', 'messages', 'auth', 'client']
|
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
import tensorflow as tf
import numpy as np
import roi_pooling_op
import roi_pooling_op_grad
import tensorflow as tf
#import pdb
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAM... |
# 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, software
# d... |
print('My student_id: 70066004')
|
"""Tests optimization
"""
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression, make_classification
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LinearRegression, LogisticReg... |
class SwitchAttribute:
"""
Identifies a switch used in an assembly,class,or member.
SwitchAttribute(switchName: str,switchType: Type)
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return SwitchAttribute()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
@staticm... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-01-10 01:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("lorikeet", "0005_cart_payment_method"),
... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/016_data.preprocessing.ipynb (unless otherwise specified).
__all__ = ['ToNumpyCategory', 'OneHot', 'Nan2Value', 'TSStandardize', 'TSNormalize', 'TSClipOutliers', 'TSClip',
'TSRobustScale', 'TSDiff', 'TSLog', 'TSCyclicalPosition', 'TSLinearPosition', 'TSLogRetu... |
# Title: Cheapest Flights Withn K Stops
# Link: https://leetcode.com/problems/cheapest-flights-within-k-stops/
from collections import defaultdict, deque
from heapq import heappop, heappush
from typing import List
INF = 10**10
class Problem:
def find_cheapest_price(self, n: int, flights: List[List[int]], src: in... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
from django.apps import AppConfig
class UsersConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'users'
def ready(self):
import users.signals # noqa
|
import face_recognition
import cv2
import numpy as np
import os
import glob
import re
# Get a reference to webcam #0 (the default one)
video_capture = cv2.VideoCapture(0)
#make array of sample pictures with encodings
known_face_encodings = []
known_face_names = []
dirname = os.path.dirname(__file__)
path = os.path.jo... |
# --------------
#Importing header files
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Code starts here
data = pd.read_csv(path)
fig1 = plt.figure()
data.hist(column="Rating")
plt.title("Data Exploration of Rating Feature")
data = data[data['Rating']<=5]
fig2 = plt.figure()
data.hist(col... |
from django.core import mail
from django.urls import reverse
from oscar.core.loading import get_model
from oscar.test.factories import UserFactory
from oscar.test.testcases import WebTestCase
CommunicationEventType = get_model('communication', 'CommunicationEventType')
class TestAnAdmin(WebTestCase):
... |
import unittest
class SendbeeApi(unittest.TestCase):
def test_fake(self):
pass
|
# -*-coding:utf-8-*-
# @File : 2021/8/10 下午8:29
# @Author : Rosetta0
# @File : 6.7_Resnet.py
import torch
from torch import nn
from torch.nn import functional as F
from d2l import torch as d2l
# 实现残差块
class Residual(nn.Module):
def __init__(self, input_channels, num_channels, use_1x1conv=Fals... |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 907306213
"""
"""
random actions, total chaos
"""
board = gamma_new(5, 3, 4, 1)
assert board is... |
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.append(0)
L=len(nums)
t=0
i=0
for i in xrange(L):
if (0<nums[i]<L) and (nums[i]!=nums[nums[i]]):
t=nums[num... |
# Django settings for testapp2 project.
import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TESTAPP_PATH = os.path.realpath(os.path.dirname(__file__))
PROJECT_PATH = os.path.realpath(os.path.dirname(TESTAPP_PATH))
sys.path.insert(0, PROJECT_PATH)
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MA... |
"""General utility functions."""
import datetime as dt
import logging as lg
import sys
import unicodedata
from pathlib import Path
from . import _version
from . import settings
def citation():
"""
Print the OSMnx package's citation information.
Boeing, G. 2017. OSMnx: New Methods for Acquiring, Constru... |
from django.utils import translation
def set_language(request, language):
translation.activate(language)
request.session[translation.LANGUAGE_SESSION_KEY] = language
|
'''
Problem: given two integers represented as linked lists where each node contains a single digit and
the digits are stored in reverse order (ie 627 = 7 -> 2 -> 6), return the sum of the two numbers
Solution: solution is to step both lists at the same time and (1) sum the two digits (2) if greater
than 10, fl... |
import copy
import torch
import torch.utils.data
import torchvision
from PIL import Image
import os
from pycocotools import mask as coco_mask
# from pycocotools.coco import COCO
# from pycocotools.cocoeval import COCOeval
# import pycocotools.mask as coco_mask
from transforms import Compose
class FilterAndRemapCo... |
"""
Remarks on Internal Packages Imports:
from sfft.utils.StampGenerator import Stamp_Generator
from sfft.utils.SymmetricMatch import Symmetric_Match, Sky_Symmetric_Match
from sfft.utils.pyAstroMatic.AMConfigMaker import AMConfig_Maker
"""
from .AMConfigMaker import AMConfig_Maker
from .PYSEx import PY_SE... |
# This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
from PIL import Image
import numpy as np
import pandas as pd
import torchvision.transforms as transforms
from torch.utils.data import Dataset, DataLoader
from abc import abstractmethod
from PIL import ImageFile
I... |
# Copyright 2012-2019 The Meson development team
# 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 agree... |
from .auth import * # noqa
from .client import Client, SyncClient # noqa
from .heartbeat import * # noqa
from .predicate import * # noqa
from .server import Server # noqa
|
"""notifications
Revision ID: d575bd47d980
Revises: 40f7122e3e2b
Create Date: 2020-04-17 12:52:06.594334
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd575bd47d980'
down_revision = '40f7122e3e2b'
branch_labels = None
depends_on = None
def upgrade():
# ... |
#!/usr/bin/env python
import unittest
import socket
from framework import VppTestCase, VppTestRunner
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsRoute, \
VppMplsIpBind, VppIpMRoute, VppMRoutePath, \
MRouteItfFlags, MRouteEntryFlags, VppIpTable, VppMplsTable, \
Vpp... |
# 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 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from filecatcher.fileCatcher import _FileCatcher
from utils.vss import _VSS
class Windows2012ServerR2Files(_FileCatcher):
def __init__(self, params):
super(Windows2012ServerR2Files, self).__init__(params)
drive, p = os.path... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.