text stringlengths 2 999k |
|---|
from peewee import *
# from app import pg_db
class Names(Model):
name = TextField()
race = TextField()
# class Meta:
# # database = pg_db
# @classmethod
def public(cls):
return (Names
.select()) |
foo = 42 |
from django import forms
from django_countries.fields import CountryField
from .models import BillingAddress, ShippingAddress
class BillingAddressForm(forms.ModelForm):
country = CountryField(blank_label='(Select country)').formfield()
same_as_shipping_address = forms.BooleanField(
... |
from pythonforandroid.recipe import BootstrapNDKRecipe
from pythonforandroid.toolchain import current_directory, shprint
import sh
class LibSDL2Recipe(BootstrapNDKRecipe):
version = "2.0.4"
url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz"
md5sum = '44fc4a023349933e7f5d7a582f7b886e'
dir_na... |
from os import path
from setuptools import setup
version = "0.3.4"
directory = path.abspath(path.dirname(__file__))
with open(path.join(directory, 'README.md'), encoding='utf-8') as file:
long_description = file.read()
setup(
name='hypercomplex',
version=version,
author='discretegames',
author_em... |
def f():
sum_, sum_of_squares = 0, 0
for i in range(1, 101):
sum_ += i
sum_of_squares += i * i
squared_sum = sum_ * sum_
return squared_sum - sum_of_squares
import ctypes
import sys
CLOCK_MONOTONIC = 1
class timespec(ctypes.Structure):
_fields_ = [
('tv_sec', ctypes.c_... |
from .models import Contract_Intervention,DPP_Intervention,ProgressItem,Progress_Quantity
from decimal import *
import random
"""
intervention_id = models.ForeignKey(Contract_Intervention, on_delete=models.SET_NULL, null=True, blank=True)
item_name = models.CharField(max_length=200, default="EW")
unit = models.CharF... |
import urllib.request
from bs4 import BeautifulSoup
def find_lyrics(song_title, song_artist):
search_query = song_title.lower() + ' ' + song_artist.lower()
# String for performing search query
search_query = "-".join(search_query.split(' '))
url = 'https://search.azlyrics.com/search.php?q=' + search_qu... |
import json
import argparse
import os
import logging
from krakenConnector import KrakenRequests
def main(args, logger):
"""
Main function of the script. Queries the current bid prices of the provided currencies and
sends the order to the kraken api, if mode prod is provided.
args (Namespace): contai... |
from typing import Optional, Type
from ray.rllib.agents.sac import SACTrainer, \
DEFAULT_CONFIG as SAC_DEFAULT_CONFIG
from ray.rllib.agents.sac.rnnsac_torch_policy import RNNSACTorchPolicy
from ray.rllib.policy.policy import Policy
from ray.rllib.utils.typing import TrainerConfigDict
... |
from transformers import BertModel
from .miscLayer import SimpleHidden
import os
import torch.nn.functional as F
import torch
import torch.nn as nn
class BERT_Embedding(nn.Module):
def __init__(self, config):
super().__init__()
self.trainable_layers = None
if 'BERT' in config:
... |
from __future__ import absolute_import
import sys
from pip._internal.cache import WheelCache
from pip._internal.cli.base_command import Command
from pip._internal.models.format_control import FormatControl
from pip._internal.operations.freeze import freeze
from pip._internal.utils.compat import stdlib_pkgs
DEV_PKGS ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Write results to this file
OUTFILE = 'runs/bro/10KB/src2-tgt1/http-par-noids-iter00200.result.csv'
# Source computers for the request
SOURCE = ['10.0.0.1', '10.0.0.3']
# Target machines for the requests (aka server)
TARGET = ['10.0.0.2']
# IDS Mode. (ATM: noids, min, max, http, ssl, ftp, icmp, mysql)
IDSMODE = 'n... |
import ctypes
import platform
(arch, type) = platform.architecture()
# 32-bit Python
if arch == "32bit":
shellcode = "$$CODE32$$"
# 64-bit Python
elif arch == "64bit":
shellcode = "$$CODE64$$"
else:
shellcode = ""
# sanity check our situation
if type != "WindowsPE" or len(shellcode) == 0:
quit()
# inject our ... |
# 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.
"""Unit tests for //compiler_gym/bin:service."""
import sys
import gym
import pytest
from absl import flags
import compiler_gym
from compiler... |
import requests
import os
import logging
from dss import Config
from dss import dynamodb as db
from dss.error import DSSForbiddenException, DSSException
from .authorize import Authorize, always_allow_admins
logger = logging.getLogger(__name__)
class FlacMixin(Authorize):
"""
Mixin class for Auth0 Authorize ... |
# coding: utf-8
from vpython import compound, color, vector, box, radians, rate
box1 = box(pos=vector(1, 0, 0), length=1, width=2, height=3, color=color.red)
box2 = box(pos=vector(5, 0, 0), length=1, width=2, height=3, color=color.blue)
bb = compound([box1, box2])
print(bb)
print(box2)
while True:
rate(30)
... |
import json
from copy import deepcopy
from typing import Dict, List, Set, Type
import stripe.api_resources
import stripe.stripe_object
import tests
from django.core.management import BaseCommand
from stripe.error import InvalidRequestError
import djstripe.models
import djstripe.settings
"""
Key used to store fake id... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
def insert(self,head,data):
p = Node(data)
if head==None:
head=p
elif head.next==None:
head.next=p
else:
... |
# -*- coding: utf-8 -*-
from fastapi.testclient import TestClient
from dimensionality_reduction import __version__, app
client = TestClient(app)
def test_read_main():
response = client.get("/version")
assert response.status_code == 200
assert response.json() == {"version": __version__}
def test_pca(ge... |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
# -*- coding: utf-8 -*-
"""
sphinxcontrib
~~~~~~~~~~~~~
This package is a namespace package that contains all extensions
distributed in the ``sphinx-contrib`` distribution.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
__import__(... |
from ruly.common import (Rule,
Operator,
Expression,
Condition,
Evaluation,
get_rule_depending_variables)
from ruly.conditions import (Equals,
Greater,
... |
"""
Empirical CDF Functions
"""
import numpy as np
from scipy.interpolate import interp1d
def _conf_set(F, alpha=.05):
r"""
Constructs a Dvoretzky-Kiefer-Wolfowitz confidence band for the eCDF.
Parameters
----------
F : array_like
The empirical distributions
alpha : float
Set a... |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
file_name = "named_tuple.py"
code = \
"""# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Softwar... |
# 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 ... |
from rest_framework.routers import DefaultRouter
from api.v1 import viewsets
app_name = "agents"
router = DefaultRouter()
router.register(
"hosts", viewsets.assets.AgentHostViewSet, basename="host")
router.register(
"services", viewsets.assets.AgentServiceViewSet, basename="service")
router.register(
... |
from django.apps import AppConfig
class DbdConfig(AppConfig):
name = 'Dashboard'
|
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import datetime
import itertools
import os
import subprocess
im... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'ios_consumer_base',
'type': 'static_library',
'depende... |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test message sending before handshake completion.
A node should never send anything other than VERSION... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the tag_linux.txt tagging file."""
import unittest
from plaso.containers import events
from plaso.lib import definitions
from plaso.parsers import bash_history
from plaso.parsers import docker
from plaso.parsers import dpkg
from plaso.parsers import selinux
... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
import datetime
from django.utils import timezone
from django.test import TestCase
from django.core.urlresolvers import reverse
from .models import Question
# Create your tests here.
def create_question(question_text, days):
"""
Creates a question with the given `question_text` and published the
given number of... |
import unittest
from eve.utils import config
from tests import BaseTest, SimpleDoc, ComplexDoc
class TestHttpDelete(BaseTest, unittest.TestCase):
def setUp(self):
response = self.client.post('/simpledoc/',
data='[{"a": "jimmy", "b": 23}, {"a": "steve", "b": 77}]',
content_type='app... |
from django.contrib import admin
from .models import Cart,CartItems
# Register your models here.
admin.site.register(CartItems)
admin.site.register(Cart)
|
# import csv
# import time
# from time import sleep
# import constant
# import helpers
# import input
# from models import Compound
# from rdkit.Chem import AllChem
# from rdkit.Chem import Draw
# import numpy as np
# def lr_schedule(epoch):
# """Learning Rate Schedule
# Learning rate is scheduled to be red... |
import os
import time
import datetime
import pathlib
import json
import requests
from datetime import date, timedelta, datetime
from newsapi import NewsApiClient
def send_post_json(url, req_data):
try:
headers = {'content-type': 'application/json'}
res = requests.post(url, req_data, headers=header... |
dataset_paths = {
# Face Datasets (In the paper: FFHQ - train, CelebAHQ - test)
'ffhq': '',
'celeba_test': '',
# Cars Dataset (In the paper: Stanford cars)
'cars_train': '',
'cars_test': '',
# Horse Dataset (In the paper: LSUN Horse)
'horse_train': '',
'horse_test': '',
# Church Dataset (In the paper: ... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/chemistry/shared_medpack_disease_strength_c.iff"
result.at... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2020 Rapptz
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 u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Pacakge功能描述
在RVIZ空间中绘制地图
aruco tag 绘制坐标系(直线)
备注编号
发布静态TF
'''
import rospy
import rospkg
from visualization_msgs.msg import Marker,InteractiveMarker
from geometry_msgs.msg import Point,TransformStamped
import copy
from tf2_ros import StaticTransformBroa... |
# We will be using the subprocess module to run commands on Kali Linux.
import subprocess
# We require regular expressions.
import re
# We want to open the CSV files generated by airmon-ng,
# and we'll use the built-in csv module.
import csv
# We want to import os because we want to check for sudo
import os
# We want ... |
from pathlib import Path
from typing import Optional, Dict, List, Type, Any, Union
import pytorch_lightning as pl
import torch
from torch import nn as nn
from torchmetrics import Metric
from schnetpack.model.base import AtomisticModel
__all__ = ["ModelOutput", "AtomisticTask"]
class ModelOutput(nn.Module):
"""... |
"""Tests for PyGeoUtils"""
import io
import pytest
from pygeoogc import WFS, WMS
from shapely.geometry import Polygon
import pygeoutils as geoutils
from pygeoutils import MatchCRS
DEF_CRS = "epsg:4326"
@pytest.fixture
def geometry_nat():
return Polygon(
[[-69.77, 45.07], [-69.31, 45.07], [-69.31, 45.45... |
# Lint as: python2, python3
# Copyright 2018 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
#
#... |
"""
Plotting 2D data
================
Often measured data is in 2D, but locations are not gridded.
Data can be vectoral, hence we want to plot direction and
amplitude of the vector. Following example use SimPEG's
analytic function (electric dipole) to generate data
at 2D plane.
"""
from SimPEG import EM, Utils
import ... |
from test_support import verbose
import pwd
import string
print 'pwd.getpwall()'
entries = pwd.getpwall()
for e in entries:
name = e[0]
uid = e[2]
if verbose:
print name, uid
print 'pwd.getpwuid()'
dbuid = pwd.getpwuid(uid)
if dbuid[0] <> name:
print 'Mismatch in pwd.getpwuid()... |
"""
This file offers the methods to automatically retrieve the graph Mycobacterium thermoresistibile.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein... |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
DistributedVirtualSwitchProductSpecOperationType = Enum(
'notifyAvailableUpgrade',
'preInstall',
'proceedWithUpgrade',
'updateBundleInfo',
... |
# Copyright 2019 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... |
from stable_baselines3.ppo_icm.policies import CnnPolicy, MlpPolicy
from stable_baselines3.ppo_icm.ppo_icm import PPO_ICM
|
from .libsteps import pylibsteps
from ctypes import c_char_p
import platform
import os
global STEPS_LIB
class STEPS():
"""
Common usage to build a simulator with STEPS:
1) simulator = STEPS(is_default=True, log_file="") # use default simulator, disable log file and show information to stdout.
2... |
# coding: utf-8
"""
SecRules
A security rule defines network access over a specified protocol between instances in two security lists, or from a set of external hosts (an IP list) to instances in a security list.<p>Security rules tie the security list, security IP list, and security application entities toget... |
import copy
import time
import numpy as np
np.set_printoptions(precision=8, suppress=True, linewidth=400, threshold=100)
import gym
class RubiksCube(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self):
super(RubiksCube, self).__init__()
self.action_space = self._action_space()
... |
"""
sentry.search.base
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
ANY = object()
EMPTY = object()
class SearchBackend(object):
__all__ = ('query', 'validate')
def __i... |
# coding: utf-8
# Copyright (c) 2016, 2020, 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... |
from django.urls import path
from .views import HomePageView, search_results, download_results
urlpatterns = [
path('search/', HomePageView.as_view(), name='home'),
path('', HomePageView.as_view(), name='home'),
path('search_results/', search_results, name='search_results'),
path('download_results/', ... |
# Copyright (c) 2013, Regents of the University of California
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list o... |
#
# Implementation of the random search algorithm
#
import sys, time
import math
import random
import csv
import hashlib
import orio.main.tuner.search.search
from orio.main.util.globals import *
#-----------------------------------------------------
class CUDACFG(orio.main.tuner.search.search.Search):
'''
Th... |
# -*- coding: utf-8 -*-
from numpy import cos, exp, log, pi, sin, sqrt
try:
from scipy.misc import factorial
except ImportError:
pass
from .go_benchmark import Benchmark
#-----------------------------------------------------------------------
# UNIVARIATE SINGLE-OBJECTIVE PROBLEMS
#-----------... |
# 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, overload
from .. import _utilities
from... |
import torch
import torch.nn.functional as F
from torch import nn
from vit_pytorch.vit import ViT
from vit_pytorch.t2t import T2TViT
from vit_pytorch.efficient import ViT as EfficientViT
from einops import rearrange, repeat
# helpers
def exists(val):
return val is not None
# classes
class DistillMixin:
def... |
# coding=utf-8
import base64
import json
import math
import os
import queue
import random
import threading
import urllib.parse
from itertools import chain, product
from urllib.parse import urlencode
from PIL import Image
from rosreestr2coord.utils import make_request, TimeoutException
from .logger import logger
Im... |
# -*- coding: utf-8 -*-
# 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, softw... |
import os
import torch
from torchvision import utils
class Visualizer():
def __init__(self,
netG,
device,
out,
num_samples=10,
num_columns=None,
batch_size=100,
range=(-1, 1)):
self.netG... |
"""
Support for viewing the camera feed from a Beward devices.
For more details about this component, please refer to
https://github.com/Limych/ha-beward
"""
import asyncio
import datetime
import logging
from asyncio import run_coroutine_threadsafe
from typing import Dict, Optional, Any
import aiohttp
import async_t... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Open Education Polito.
#
# fare is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""file_management minters."""
def dummy_pid_minter(record_uuid, data):
"""Dummy minter."""
return... |
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The main url dispatcher for this project."""
from __future__ import print_function
from django import http
from django.conf import urls
# Uncomment... |
"""Implementation of TLV8 used by MRP/HomeKit pairing process.
Note that this implementation only supports one level of value, i.e. no dicts
in dicts.
"""
# Some of the defined tags used by the pairing process
TLV_METHOD = '0'
TLV_IDENTIFIER = '1'
TLV_SALT = '2'
TLV_PUBLIC_KEY = '3'
TLV_PROOF = '4'
TLV_ENCRYPTED_DATA... |
# coding: utf-8
"""
PTV Timetable API - Version 3
The PTV Timetable API provides direct access to Public Transport Victoria’s public transport timetable data. The API returns scheduled timetable, route and stop data for all metropolitan and regional train, tram and bus services in Victoria, including Night... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Copyright (c) 2018-2021 The CSPN Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct catego... |
"""
author: Joon-Young Yang (E-mail: dreadbird06@gmail.com)
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_custom.torch_utils import shape, to_gpu, to_arr
from torch_custom.custom_layers import CustomModel, update_dict
from torch_custom.stft_helper import StftHel... |
import pandas as pd
import requests
import math
from bs4 import BeautifulSoup
class ScraperError(Exception):
pass
class eBay:
"""
Holds everything related to extracting the relevant information
from the website of interest.
"""
def __init__(self):
self.__headers = {
... |
def solve(array):
nums = [0]*8001
counted = [False]*8001
tmp = 0
limit = 0
length = len(array)
for i in range(length):
nums[array[i]] += 1
if limit < array[i]:
limit = array[i]
for i in range(length-1):
candidate = array[i] + array[i+1]
j = i+1
... |
"""Mocks for tests."""
from typing import Any
from unittest.mock import MagicMock
from devolo_home_control_api.devices.zwave import Zwave
from devolo_home_control_api.homecontrol import HomeControl
from devolo_home_control_api.properties.binary_sensor_property import (
BinarySensorProperty,
)
from devolo_home_con... |
from django.utils.translation import gettext_lazy as _
def list_enrolled_courses(logged_user):
# return Course.objects.filter(course_groups__students__student=logged_user.student)
return []
def list_by_enrolling_courses(logged_user):
# enrolled_courses = Course.objects.filter(
# course_groups__s... |
from django.conf.urls import patterns, url
from django.conf import settings
import views
urlpatterns = patterns('',
url(r'^utils/form/$', views.form, name="goscale_form_handler"),
)
if 'allauth.account' in settings.INSTALLED_APPS:
urlpatterns += patterns('',
url(r'^signup/$', views.signup, name='gosca... |
a = input()
a = a.split(" ")
a = [int(a[0]), int(a[1])]
mapW = {}
for x in range(0, int(a[1])):
b = input()
b = b.split(" ")
mapW[b[0]] = b[1]
b = input()
b = b.split(" ")
c = []
for x in b:
if x in mapW.keys():
if len(x) < len(mapW[x]):
c.append(x)
elif len(x) > len(mapW... |
import itertools
import numpy as np
from brian2.parsing.bast import brian_dtype_from_dtype
from brian2.parsing.rendering import NumpyNodeRenderer
from brian2.core.functions import DEFAULT_FUNCTIONS, timestep
from brian2.core.variables import ArrayVariable
from brian2.utils.stringtools import get_identifiers, word_sub... |
from mpi4py import MPI
import mpiunittest as unittest
class TestErrhandler(unittest.TestCase):
def testPredefined(self):
self.assertFalse(MPI.ERRHANDLER_NULL)
self.assertTrue(MPI.ERRORS_ARE_FATAL)
self.assertTrue(MPI.ERRORS_RETURN)
def testCommGetSetErrhandler(self):
for COMM... |
#
# Copyright (C) 2010-2012 Opersys 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... |
from dataclasses import dataclass, field
from typing import List, Dict
class QuaMapMode:
""" Lists all available Quaver Key modes.
Though easy to implement the rest of the keys here, we don't do that because it may not load in Quaver."""
KEYS_4: str = "Keys4"
KEYS_7: str = "Keys7"
KEYS_8: str = ... |
from django.http import HttpResponse, JsonResponse
from rest_framework.decorators import api_view, detail_route
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from rest_framework import generics
from rest_framework import permissions
from rest_framework.response import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : schedule.py
# @Author: 1980744819@qq.com
# @Date : 2019-03-20
# @Desc :
class LinearSchedule(object):
def __init__(self, schedule_timesteps, final_p, initial_p=1.0):
self.schedule_timesteps = schedule_timesteps
self.final_p = final_p
... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# presentation colors
cdarkprime = '#0E1E97'
cmediumprime = '#3246e0'
clightprime = '#e2e5fe'
cdarkcomp = '#9b7c0f'
cmediumcomp = '#f6c51c'
clightcomp = '#fef8e2'
cdarkgrey = '#303030'
cmediumgrey = '#888888'
clightgrey = '#e5e5e5'
cdarkthree = '#119... |
import os
import pickle
import random
from PIL import Image
import numpy as np
import pandas as pd
import torch
import torch.utils.data
import torchvision.transforms as transforms
PAD, UNK, EOS = 0, 1, 2
EOS_TOKS = {'.', '!'}
class RecipeDataset(torch.utils.data.Dataset):
def __init__(self, dataset, vocab, doct... |
import os
import numpy as np
import torch
from batchgenerators.utilities.file_and_folder_operations import *
from nnunet.dataset_conversion.Task500_BraTS_2021 import apply_threshold_to_folder
from nnunet.dataset_conversion.Task032_BraTS_2018 import convert_labels_back_to_BraTS_2018_2019_convention
import shutil
... |
import logging
import hashlib
import hmac
import os
import urllib
import time
from datetime import datetime, timedelta
from flask import Flask, current_app, jsonify, request, make_response, redirect
from .database import Database
from .slackApi import Slack
def oauth():
auth_code = request.args['code']
# A... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 26 20:25:21 2019
@Project : Python Memo
@File : encodeop.py
@Function : 编解码操作
@Author : yehx
@E-mail : yehxian@163.com
"""
import numpy as np
import cv2
#字节流转字符串
byte_str = b"\xe5\x8f\xb6\xe6\xb1\x87\xe8\xb4\xa4"
print(byte_str.decode("u... |
#!/usr/bin/env python
"""
Quaternion implementation for use in pymavlink
"""
from __future__ import absolute_import, division, print_function
import numpy as np
from .rotmat import Vector3, Matrix3
__author__ = "Thomas Gubler"
__copyright__ = "Copyright (C) 2014 Thomas Gubler"
__license__ = "GNU Lesser General Publ... |
from jessiql import Query
from .cursors import PageLinks
from .skiplimit import CursorLimitOperation
class QueryPage(Query):
""" A Query that will generate cursors to navigate to the next/previous pages """
SkipLimitOperation = CursorLimitOperation
def page_links(self) -> PageLinks:
""" Get link... |
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
from selenium import webdriver
# 导入WebDriverWait类
from selenium.webdriver.support.ui import WebDriverWait
# 导入定位方式
from selenium.webdriver.common.by import By
# 导入
from selenium.webdriver.support.expected_conditions import presence_of_element_located,visibility_of
if __... |
# Copyright 2013-2019 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)
from spack import *
class Unrar(MakefilePackage):
"""RAR archive extraction utility"""
homepage = "https://www... |
# Limitations under the MIT License.
# Copyright 2019 Katsuya Shimabukuro.
"""Generate Wikipedia Category to All Link Page Dictionary.
"""
import pickle
from collections import defaultdict
import gzip
import os
import re
import urllib.request as urllib
re_parentheses = re.compile("\((\d+),\d+,'?([^,']+)'?,[^\)]+\)")
r... |
import smtplib
from email.mime.text import MIMEText
# # Replace the number with your own, or consider using an argument\dict for multiple people.
# to_number = '0035799359864{}'.format(carriers['att'])
# auth = ('spithas@leandrou.com', 'spithas3116')
GOOGLE_MAIL_USERNAME = 'akamas2020@gmail.com'
GOOGLE_MAIL_PASSWORD =... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_0.models.job_pol... |
from tsp import tsp_lower_bound, tsp_upper_bound
class Kante:
distanz = None
pfad = []
def __init__(self, distanz, pfad):
self.distanz = distanz
self.pfad = pfad
def __repr__(self):
return str(self.distanz)
class Paket:
zielknoten = None
gewicht = None
own_id=None
'''immutable'''
def __init__(self, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.