text stringlengths 2 999k |
|---|
import datetime
import os
import re
import sys
from random import randint
from rdkit import Chem
from rdkit.Chem import AllChem
import openbabel
import subprocess
def get_id_string(out):
"""
Regex function for finding proasis strucid
"""
try:
strucidstr = re.search(r"strucid='.....'", out)
... |
import os
import sys
import hmac
import hashlib
import time
import datetime
import base64
class Totp:
def __init__(self, interval, digits, iamuser, path):
self.interval = interval
self.digits = digits
self.iamuser = iamuser
self.path = path
def get_remaintime(self):
... |
"""
IRN API v1
Allows users to extract, create, update and configure IRN data. # noqa: E501
The version of the OpenAPI document: 1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from fds.sdk.IRNConfiguration.model_utils import ( # noqa: F401
... |
import chex
import jax
import jax.numpy as np
import numpy as onp
import objax
import pytest
from rbig_jax.transforms.conv import Conv1x1Householder
seed = 123
rng = onp.random.RandomState(123)
generator = objax.random.Generator(123)
@pytest.mark.parametrize("n_channels", [1, 3, 12])
@pytest.mark.parametrize("hw", ... |
# 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... |
# Copyright 2012 Locaweb.
# 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 appl... |
from cmd import Cmd
from core import sudoku
class SudokuPrompt(Cmd):
def preloop(self):
self.rowList = []
def do_man(self, inp):
print("List of commands:")
print("- addLine: Insert the 9 values for the next line seprated by comma, in case of empty value insert zero")
print("- pri... |
# 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
fro... |
import string
import sys
class Calculator:
def __init__(self):
self.variables = {}
self.answer = None
self.take_input()
def take_input(self):
while True:
if self.answer is not None:
print(self.answer)
self.answer = None
... |
import os
import nibabel as nib
import numpy as np
import pandas as pd
import pytest
from nibabel.tmpdirs import InTemporaryDirectory
# Set backend to avoid DISPLAY problems
from nilearn.plotting import _set_mpl_backend
from nilearn.glm.first_level.design_matrix import make_first_level_design_matrix
from nilearn.rep... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
# 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... |
import math
import torch
from ganslate.nn.losses import cyclegan_losses
class HX4CycleGANBalancedLosses(cyclegan_losses.CycleGANLosses):
""" Modified to make Cycle-consitency account for only
FDG-PET images (in domain A) and HX4-PET images (in domain B),
and ignore CT components """
def __init__(sel... |
from restclients.sws.v5.curriculum import get_curricula_by_department
from restclients.sws.v5.curriculum import get_curricula_by_term
|
import importlib
import os
import queue
import sys
import threading
import time
app_path = os.path.dirname((os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
sys.path.append(os.path.split(app_path)[0])
import settings
from thirtybirds3 import thirtybirds
from thirtybirds3.adapters.actuators import robote... |
billing = {
'first' : 'Allyson',
'last' : 'Robertson',
# Use a Gmail address to append the tweet ID to the receipt email
# after the plus sign.
# See: https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html
'email' : 'my.gmail.here+pp{}@gmail.com',
# You may want to set up a virtual card wi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Collection of tests for :mod:`orion.core.cli.info`."""
import itertools
import pytest
from orion.core.cli.info import (
format_algorithm, format_commandline, format_config, format_dict, format_info, format_list,
format_metadata, format_refers, format_space, for... |
# -*- coding: utf-8 -*-
# Configuration file for generating sources for the format documentation from the YAML specification files
import os
# -- Input options for the specification files to be used -----------------------
# Directory where the YAML files for the namespace to be documented are located
spec_input_spe... |
from geojson_rewind import rewind
from geomet import wkt
import decimal
import statistics
def wkt_rewind(x, digits=None):
"""
reverse WKT winding order
:param x: [str] WKT string
:param digits: [int] number of digits after decimal to use for the return string.
by default, we use the mean num... |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 19 14:39:50 2014
@author: Imane
"""
from sklearn.cluster import MeanShift,
def meanshiftt(data):
bandwidth = estimate_bandwidth(data, quantile=0.2, n_samples=10)
ms = MeanShift(bandwidth=bandwidth, bin_seeding=True)
ms.fit(data)
idx = ms.pred... |
from __future__ import unicode_literals
import os
import sys
import datetime
import logging
import subprocess
import eeUtil
import requests
from bs4 import BeautifulSoup
import urllib.request
import time
import json
import re
# url for fire weather data
SOURCE_URL = 'https://portal.nccs.nasa.gov/datashare/GlobalFWI/v... |
# coding=utf-8
# coding=utf-8
# 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
... |
'''account forms'''
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from accounts.models import Profile, UserActions, LoginInfo
from accounts.utils import change_email
from accounts.utils import mig... |
# Copyright 2021 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... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
return addTwoNumbers(l1, l2, 0, None, None)
def addTwoNumbers(l1: ListNode... |
for a in range(0, 6):
print('Oi')
print('END')
for a in range(0, 3):
print(a)
print('end')
for a in range(0, 7, -2):
print(a)
print('end')
for a in range(0, 7, 2):
print(a)
print('end')
n = int(input('Digite um número: '))
for a in range(0, n+1):
print(a)
print('Fim')
i = int(input('Inicio: '))
f ... |
from pycroft.lib import user as UserHelper
from tests import FactoryDataTestBase, UserFactory
class UserEditsTestCase(FactoryDataTestBase):
def create_factories(self):
super().create_factories()
self.user = UserFactory()
def test_correct_new_name(self):
new_name = "A new name"
... |
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from dechorate import constants
from dechorate.dataset import DechorateDataset, SyntheticDataset
from dechorate.utils.file_utils import save_to_pickle, load_from_pickle, save_to_matlab
from dechorate.utils.dsp_utils import normalize, envelope
dat... |
#coding:utf-8
'''
功能描述: 此模块用于数据整合, 被views模块调用.
Created on 2011-4-28
@author: Zay
'''
import time, pprint, datetime
import ztq_core
import urllib
try:
import json
except: import simplejson as json
def get_sys_log(sindex=None, eindex=None):
log_queue = ztq_core.get_system_log_queue()
for l... |
from CPconfig import configuration
from importlib import import_module
# A proper implementation of the event selection will at least
# define the following:
# - categoryNames (list of names of categories)
# - eventCategory (category data producer)
# - isInCategory (category definition, from category data)
# the lis... |
from functools import partial
from inspect import signature
from itertools import product
from itertools import chain
from itertools import permutations
import numpy as np
import scipy.sparse as sp
import pytest
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinar... |
import torch
import torch.nn as nn
import os
from . import utils as solver_utils
from utils.utils import to_cuda, mean_accuracy, accuracy
from torch import optim
from math import ceil as ceil
from config.config import cfg
class BaseSolver:
def __init__(self, net, dpn, dataloader, bn_domain_map={}, resume=None, **... |
import networkx as nx
class DepthFirstSearch:
def __init__(self,G,i_m,f_m):
self.G = G
self.i_m= i_m
self.f_m =f_m
def findPaths(self,n):
"""
finds all correct paths of length n in the graph
this function returns all paths of length n that begin... |
import copy as _copy
import operator
from collections.abc import Iterable, Iterator, Sized
from collections import defaultdict, deque
from functools import reduce
import warnings
import numpy as np
import scipy.sparse
from numpy.lib.mixins import NDArrayOperatorsMixin
import numba
from .common import dot, matmul
fro... |
import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as plt
from keras.optimizers import Adam, SGD
from tqdm import tqdm
import random
from metrics import dice_coef, dice_coef_loss
img_width = 128
img_height = 128
img_channels = 1
path_to_data = './data/datasets-promise12'
path_to_save = './r... |
import json
from typing import List, Dict, Optional, Union
import logging
import numpy as np
from .numpy_encoder import NumpyEncoder
from adserver.base import AlibiDetectModel, ModelResponse
from alibi_detect.utils.saving import load_detector, Data
def _append_drift_metrcs(metrics, drift, name):
metric_found = dr... |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following... |
import logging
import re
from datetime import datetime
from time import sleep
from .exceptions import DailyUploadLimitReachedException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.remote.we... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "arm_gazebo"
PROJECT_SPACE_DIR = "/hom... |
from operator import itemgetter
class Delimiter:
# constructor
def __init__(self,database):
self.database = database
self.target = None
self.safe_list = None
# elimination of attributes with low correlation with the target attribute
def eliminate(self,target,safe_list=... |
# To run the job:
# pyats run job BGP_check_job.py --testbed-file <testbed_file.yaml>
# Description: This job file checks that all BGP neighbors are in Established state
import os
# All run() must be inside a main function
def main(runtime):
# Find the location of the script in relation to the job file
bgp_tes... |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
'''Testing module for `python_toolbox.misc_tools`.'''
|
import pandas as pd
from matplotlib import pyplot as plt
import os
import sys
import seaborn as sns
import json
import argparse
from dotmap import DotMap
import numpy as np
# ================================================================
# SETTINGS
# ================================================================
... |
from rest_framework import routers
from django.urls import path, include
from . import views
router = routers.DefaultRouter()
urlpatterns = [
path('', views.TranscribeViewSet.as_view(), name='transcribe'),
]
|
#!/usr/bin/env python
# Copyright (c) 2013, Eduard Broecker
# 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 ... |
"Utility functions to help deal with tensors"
from .imports.torch import *
from .core import *
AffineMatrix = Tensor
BoolOrTensor = Union[bool,Tensor]
FloatOrTensor = Union[float,Tensor]
IntOrTensor = Union[int,Tensor]
ItemsList = Collection[Union[Tensor,ItemBase,'ItemsList',float,int]]
LambdaFunc = Callable[[Tensor],... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
class ContactForm(Base):
na... |
import adal
from settings import settings
from office365.graph_client import GraphClient
def get_token():
"""Acquire token via client credential flow (ADAL Python library is utilized)"""
authority_url = 'https://login.microsoftonline.com/{0}'.format(settings['tenant'])
auth_ctx = adal.AuthenticationConte... |
tair2name = {}
tair2fullname = {}
with open('gene_aliases_20140331.txt', 'r') as infh:
for buf in infh:
if buf[0:10] == 'locus_name':
continue
tair_id, tair_name, tair_fullname = buf.replace('\n', '').replace('#', '').replace('"', '').replace('\'', '').split('\t')
... |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
"""
Copyright (c) 2018-2019 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain... |
import pybullet as p
import time
import pybullet_data
import math as m
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0,0,-10)
planeId = p.loadURDF("../plane/plane.urdf")
robotStartPos = [0,0,0.1]
robotStartOrientation = p.getQuaternionFromEuler([0,0,0])
robotId =... |
# 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 Union
from .. import utilities, tables
class GetSiteResult:
... |
import tables as tb
from scipy.sparse import csr_matrix
import numpy as np
import cPickle
import datetime
from conf import *
article_ids = cPickle.load(open("../data/article_ids.p"))
vocab = {int(x):i for i,x in enumerate(article_ids)}
print "loaded articles"
f = open('../data/links_unique.p', 'r')
links = cPickle.l... |
# -*- coding: utf-8 -*-
"""The GraphQL Schema."""
import datetime as dt
import graphene as gql
from graphene.types.datetime import DateTime
class About(gql.ObjectType):
first_name = gql.String()
last_name = gql.String()
birthday = DateTime()
full_name = gql.String()
age = gql.Int()
def res... |
# dataset settings
dataset_type = 'CocoPanopticDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='LoadPanopticAnnotations',
with_bbox=True,
wit... |
import numpy as np
from kmeans import Kmeans
class ImageQuantizer:
def __init__(self, b):
self.b = b
def quantize(self, img):
b = self.b
C, R, D = img.shape
self.img = img
X = np.reshape(img, (C * R, D))
model = Kmeans(k=pow(2, b))
model.f... |
"""
Precompute ngram counts of captions, to accelerate cider computation during training time.
"""
import os
import json
import argparse
from six.moves import cPickle
import captioning.utils.misc as utils
from collections import defaultdict
import sys
sys.path.append("cider")
from pyciderevalcap.ciderD.ciderD_scorer ... |
#!/usr/bin/env python
import numpy
import kernel_tuner
from scipy import misc
#from matplotlib import pyplot
#image = misc.imread("../test_small.jpg", "r")
image = misc.imread("../test_small.jpg", mode='RGB')
misc.imshow(image)
print (image.shape)
exit()
kernel_names = []
""" pipeline overview
-- fastnois... |
import tensorflow as tf
from elasticdl.python.elasticdl.callbacks import LearningRateScheduler
from elasticdl_preprocessing.layers import SparseEmbedding
from elasticdl_preprocessing.layers.concatenate_with_offset import (
ConcatenateWithOffset,
)
from elasticdl_preprocessing.layers.discretization import Discretiz... |
#!D:\Python\Transformer-mast\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.7'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$',... |
import multiprocessing
import time
import pytest
from jina import Client, Document, Executor, Flow, requests
class SlowExecutor(Executor):
@requests
def foo(self, *args, **kwargs):
time.sleep(0.2)
def _test_error(flow_kwargs, add_kwargs, error_port=None):
f = Flow(**flow_kwargs).add(**add_kwar... |
# Copyright [2018-2020] Peter Krenesky
#
# 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... |
import datetime
from argparse import ArgumentParser, Namespace, ArgumentTypeError
import torch
from pytorch_lightning import Trainer, loggers, seed_everything
from pytorch_lightning.callbacks import (
ModelCheckpoint, EarlyStopping)
from pytorch_lightning.callbacks import LearningRateMonitor
from src.pl_model impo... |
import numpy as np
def smallest_multiple_of_n_geq_m(n: int, m: int) -> int:
## n = 3
## m = 25 - 9 = 16
## 16 + ((3 - (16 % 3)) % 3)
return m + ((n - (m % n)) % n)
class PrimeListSieve:
def __init__(self):
self._primes: list[int] = [2, 3, 5, 7]
self.end_segment: int = 1
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Things that don't belong anywhere else
"""
import hashlib
import json
import os
import sys
import math
from shutil import copyfile
from collections import OrderedDict, defaultdict
from numbers import Number
import operator
import numpy as np
... |
# -*- coding: utf-8 -*-
import scrapy
import re
from rkpass.items import RkpassItem
# 软件设计师上午题
class RkpassspiderSpider(scrapy.Spider):
name = 'rkpassSpider'
allowed_domains = ['www.rkpass.cn']
start_urls = []
paperId_list = ['618', '592', '553', '519', '485', '463', '420', '378', '359', '305', '304',... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... |
PENDING_CHOICE = 10
APPROVED_CHOICE = 20
REJECTED_CHOICE = 30
CANCELLED_CHOICE = 40
REFUNDED_CHOICE = 50
CHARGED_BACK_CHOICE = 60
PAYMENT_STATUS_CHOICES = (
(PENDING_CHOICE, 'Pendiente'),
(APPROVED_CHOICE, 'Pagado'),
(REJECTED_CHOICE, 'Rechazado'),
(CANCELLED_CHOICE, 'Cancelado'),
(REFUNDED_CHOICE, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('users', '0013_auto_20170111_1450'),
]
operations = [
migrations.AlterField(
mod... |
how_many_snakes = 1
snake_string = r"""
Welcome to Python3!
____
/ . .\\
\ ---<
\ /
__________/ /
-=:___________/
<3, Juno
"""
print(snake_string * how_many_snakes)
|
"""The main module for Crocpad++.
Contains the application class MainWindow which should only be instantiated once.
"""
import random
from pathlib import Path
from PyQt5.QtCore import QEvent, QObject, Qt
from PyQt5.QtGui import QFont, QFontDatabase, QIcon
from PyQt5.QtMultimedia import QSound
from PyQt5.QtWidgets im... |
#!/usr/bin/env python3
import random
from torch.utils.tensorboard import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils import data
from morse import ALPHABET, generate_sample
from itertools import groupby
num_tags = len(ALPHABET)
# 0: ... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Bui... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
from abc import abstractmethod
from typing import Dict
class Backend:
"""Interface for backend"""
@abstr... |
from django.shortcuts import render
from django.conf import settings
from django.http import HttpResponse
from .artist_tree import ArtistTree
from .feat_artists import FeaturedArtists
COLLECT_FEATURED_PERFORMERS = '1'
COLLECT_APPEARS_ON = '2'
COLLECT_APPEARS_ON_PERFORMERS = '3'
def index(request):
if request.m... |
#!/usr/bin/env python
"""Helper functions for working with interfaces"""
__author__ = 'Seman Said, Michael Meisinger'
from pyon.ion.resregistry_standalone import ResourceRegistryStandalone
from yaml import load as yaml_load
from yaml.constructor import ConstructorError
def get_object_definition_from_datastore(sysn... |
'''
Author: Robert Post
These functions run a standard DQN experiment accross multiple games or flavors of games for transfer learning experiments.
'''
import sys
import copy
import os
import cPickle
import time
import logging
import random
import numpy as np
import cv2
import argparse
import theano
import sys
impo... |
import os
import dotenv
import logging
import time
import textwrap
import argparse
import stat
import glob
import pathlib
import datetime
import shutil
import subprocess
from irods.session import iRODSSession
from irods.meta import iRODSMeta
RESOURCE_ID_GLOB = "????????????????????????????????"
EXCLUDED = ["bags", "te... |
# Copyright 2014 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.
# pylint: disable=protected-access
import datetime
import functools
import os
import inspect
import types
import warnings
def Cache(obj):
"""Decorator fo... |
import os
def get_dirs():
cwd = os.path.dirname(os.path.realpath(__file__))
local_savedir = cwd
local_datadir = cwd
local_wandbdir = cwd
return local_savedir, local_datadir, local_wandbdir
def configure_logging(config, name, model):
if config['wandb_on']:
import wandb
wandb... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... |
"""
Sphinx plugins for web API docs.
"""
import inspect
import logging
import re
import sys
try:
import json
except ImportError:
import simplejson as json
from django.contrib.auth.models import User
from django.http import HttpRequest
from django.template.defaultfilters import title
from djblets.util.http imp... |
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import base64
from slixmpp.util import bytes
from slixmpp.xmlstream import StanzaBase
class Success(StanzaBase):
"""
"""
name = 'suc... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NAP.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportErro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Given a binary search tree with non-negative values, find the minimum
absolute difference between values of any two nodes.
"""
import sys
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def t... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v2/proto/resources/managed_placement_view.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.proto... |
import torch
from torch import nn as nn
from torch.nn.functional import binary_cross_entropy_with_logits, cross_entropy
from bases.nn.conv2d import DenseConv2d
from bases.nn.linear import DenseLinear
from bases.nn.models.base_model import BaseModel
from bases.nn.sequential import DenseSequential
from .utils import is_... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from gmrf_utils import gradient_hessian
from torchvision.datasets import MNIST
from torch.utils.data import DataLoader
from torchvision import models, transforms
from mnist_model import Net
def inv_cov_fft(alpha, beta, gamma, H, W):
A = torch.zeros... |
from django.contrib import admin
from create_lesson_plan.models import *
admin.site.register(lesson)
admin.site.register(lesson_plan)
admin.site.register(Engage_Urls)
admin.site.register(Explain_Urls)
admin.site.register(Evaluate_Urls)
admin.site.register(MCQ)
admin.site.register(FITB)
admin.site.register(Engage_Image... |
# Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source ... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/RPC2',)
with SimpleXMLRPCServer(('0.0.0.0', 12345), requestHandler=RequestHandler) as server:
server.register_introspection_functions()
server... |
# Copyright 2013 Intel 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 requir... |
from fastapi import FastAPI
import uvicorn
import csv
import numpy as np
import pytest
app = FastAPI()
kwh_price = []
grid_fees = []
unit_price = []
hs_splitter = []
zp_cde = []
cty = []
strt = []
def tariff_gen(postal_code, city, street, house_number,ykc ):
file = open('location_prices.csv', encoding="utf-8")
... |
# Copyright 2018 ZTE Corporation.
#
# 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 ... |
from rest_framework import serializers as serializer
from djoser import serializers
from . import models
class UserSerializer(serializer.ModelSerializer):
class Meta(object):
model = models.User
fields = ('username', 'full_name', 'email', 'is_admin', 'is_staff', 'is_superuser', 'birth_date', 'tech... |
import os
import re
DUPLICATE_SAMPLES = "DuplicateSamples"
NON_EXISTING_SAMPLE = "NonExistingSample"
# MongoDB field names
FIELD_ROOT_SAMPLE_ID = "Root Sample ID"
FIELD_RNA_ID = "RNA ID"
FIELD_RESULT = "Result"
FIELD_COORDINATE = "coordinate"
FIELD_SOURCE = "source"
FIELD_LAB_ID = "Lab ID"
FIELD_PLATE_BARCODE = "plat... |
# Copyright (c) 2021, sd and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class TeamDetails(Document):
pass
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.