text stringlengths 2 999k |
|---|
"""Return the indices of the maximum values along an axis."""
from __future__ import annotations
from typing import Any, Optional
import numpy
import numpoly
from ..baseclass import PolyLike
from ..dispatch import implements
@implements(numpy.argmax)
def argmax(
a: PolyLike,
axis: Optional[int] = None,
... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wagmi.settings')
try:
from django.core.management import execute_from_command_line
except Import... |
"""Market module to interact with Serum DEX."""
from __future__ import annotations
from typing import List
from solana.account import Account
from solana.publickey import PublicKey
from solana.rpc.async_api import AsyncClient
from solana.rpc.types import RPCResponse, TxOpts
from solana.transaction import Transaction
... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
class EasingVectorKeyFrame(VectorKeyFrame, ISealable, IKeyFrame):
"""
A class that enables you to associate easing functions with a System.Windows.Media.Animation.VectorAnimationUsingKeyFrames key frame animation.
EasingVectorKeyFrame()
EasingVectorKeyFrame(value: Vector)
EasingVectorKeyFrame(va... |
from __future__ import print_function
import os
import numpy as np
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
# From Molecules
import sys
sys.path.append('../')
from extract_native_contact.extract_native_contact import ExtractNativeContact
from vae_conv_tr... |
import copy
class CleanseData():
'''
This class contains methods for cleansing the data extracted from DrugBank containing info. about cardiovascular drugs.
There are 3 main parts of the data cleansing process:
1. Remove drugs that do not interact with any entity or those that only interact with... |
# -*- 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... |
from copy import copy
import re
from collections import Iterable
class FilterListException(Exception):
pass
class NotFound(FilterListException):
pass
class InvalidList(FilterListException):
pass
class FilterList(list):
def __init__(self, *args, **kwargs):
super(FilterList, self).__init_... |
# util/langhelpers.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Routines to help with the creation, loading and introspection of
modules, cla... |
# -*- coding: utf-8 -*-
"""Converter for PomBase."""
import logging
from collections import defaultdict
from typing import Iterable
import bioversions
import click
import pandas as pd
from more_click import verbose_option
from tqdm import tqdm
import pyobo
from pyobo import Reference
from pyobo.struct import Obo, S... |
import pigpio
from pisat.comm.transceiver import Im920, SocketTransceiver
from pisat.core.cansat import CanSat
from pisat.core.nav import Context
from pisat.core.manager import ComponentManager
from pisat.core.logger import (
DataLogger, LogQueue, SystemLogger
)
from pisat.handler import (
PigpioI2CHandler, ... |
# -*- coding: utf-8 -*-
from unittest import TestCase, main
from recc.container.struct.container_status import ContainerStatus
class ContainerStatusTestCase(TestCase):
def test_default(self):
# fmt: off
self.assertEqual(ContainerStatus.Created, ContainerStatus.from_str("created"))
self.as... |
from office365.runtime.client_object import ClientObject
from office365.runtime.client_query import ClientQuery
from office365.runtime.resource_path_entity import ResourcePathEntity
class OutlookEntity(ClientObject):
"""Base Outlook entity."""
def update(self):
qry = ClientQuery.update_entry_query(se... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# 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 derivative wo... |
from roam_linker_bot import __version__
def test_version():
assert __version__ == "0.1.0"
|
import regym
from regym.rl_algorithms.agents import build_PPO_Agent
from regym.rl_loops.singleagent_loops import rl_loop
from regym.environments import parse_environment
from test_fixtures import ppo_rnd_config_dict_ma
from tqdm import tqdm
from tensorboardX import SummaryWriter
import os
import math
import copy
impo... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
"""
weasyprint.tests.test_draw.test_tables
--------------------------------------
Test how tables are drawn.
# TODO: add note on when to use
direction: rtl on body or on table.
"""
import pytest
from ...html import HTML_HANDLERS
from ..testing_utils import assert_no_logs, requires
from . import ... |
'''
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
This will just hold some common functions used for testing.
Created on Aug 15, 2014
@author: dfleck
'''
from twisted.internet import defer,reactor
from twisted.python import log
from gmu.chord.ChordNod... |
import unittest
from spaced_repetition.domain.domain_helpers import validate_param
class TestDomainHelpers(unittest.TestCase):
def test_validate_input(self):
self.assertEqual(validate_param(param='valid name',
max_length=10),
'valid name')... |
from __future__ import absolute_import
from django.views.generic import View
from sentry.models import (GroupSubscriptionReason, Organization, Project)
from sentry.utils.http import absolute_uri
from .mail import MailPreview
class DebugNewProcessingIssuesEmailView(View):
reprocessing_active = True
def get... |
import json
input_file=open('rawdata.json', 'r')
rawdata_decode=json.load(input_file)
lst=[]
output_file=open('rawdata_filtered.json', 'w')
whitelist = open("whitelist.json", "r")
whitelist_decode=json.load(whitelist)
#whitelist_stack = whitelist_decode.split()
#print whitelist_stack
for i in rawdata_decode:
pri... |
from _runtime import server, CONFIG
from fastapi import FastAPI, Request, Body, Response, status
from fastapi.responses import HTMLResponse, StreamingResponse, FileResponse
from fastapi_utils.tasks import repeat_every
import uvicorn
import rsa
import os
import sys
import hashlib
from pydantic import BaseModel, create_... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..legacy import antsIntroduction
def test_antsIntroduction_inputs():
input_map = dict(
args=dict(
argstr="%s",
),
bias_field_correction=dict(
argstr="-n 1",
),
dimension=dict(
arg... |
#!/bin/env python3
import sys
import json
import math
from difflib import SequenceMatcher
def load_file(file):
with open(file, "r") as f:
return json.load(f)
def check_title(actual, expected):
if not "title" in actual.keys():
if not "title" in expected:
return 20
return 0
... |
# --------------------------------------------------------
# Visual Detection: State-of-the-Art
# Copyright: Hanbo Zhang
# Licensed under The MIT License [see LICENSE for details]
# Written by Hanbo
# based on code from Jiasen Lu, Jianwei Yang, Ross Girshick
# --------------------------------------------------------
f... |
import numpy as np
from numpy import zeros
from pyNastran.utils.numpy_utils import integer_types
from pyNastran.op2.tables.oes_stressStrain.real.oes_objects import OES_Object
from pyNastran.f06.f06_formatting import write_floats_13e, _eigenvalue_header
class RealNonlinearRodArray(OES_Object): # 89-CRODNL, 92-CONRODN... |
from typing import List, Optional, Tuple
import awkward
import numpy
import xgboost
def calculate_diphoton_mva(
mva: Tuple[Optional[xgboost.Booster], List[str]],
diphotons: awkward.Array,
events: awkward.Array,
) -> awkward.Array:
if mva[0] is None:
return diphotons
diphoton_mva = mva[0]
... |
import os
import requests
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.files.storage import Storage as StorageBase
from django.utils.module_loading import import_string
def setting(name, default=None):
return getattr(settings, name, default)
class WebDavStora... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 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.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... |
# 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 django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
@register.inclusion_tag("home/navbar/navbar.html", takes_context=True)
def display_navbar(context):
parent = get_site_root(context)
... |
""" PhySR for 3D GS """
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils.data import Dataset
from torch.optim import lr_scheduler
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as scio
imp... |
SECRET_KEY = "thisisasecretkeyfortests.itisverysecure"
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'vinaigrette',
)
USE_I18N = True
LANGUAGES = (
('en', u'English'),
('fr', u'França... |
# __init__.py is a special Python file that allows a directory to become
# a Python package so it can be accessed using the 'import' statement.
from .init_db import InitDbCommand |
# Copyright (c) 2022 Intel 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 sqlalchemy import Table, Column, MetaData, Float
meta = MetaData()
def upgrade(migrate_engine):
conn = migrate_engine.connect()
trans = conn.begin()
try:
meta.bind = conn
task = Table('task', meta, autoload=True)
task_loss = Column('loss', Float)
task_loss.create(ta... |
# Copyright (c) 2017-present, Facebook, 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... |
#!/usr/bin/env python
"""
shgyield.py is a python module for exploring the SHG optical response of
materials. It is well suited for 2D-materials, surfaces, bulks, and
metamaterials. For a complete overview of the theory, see PRB 94, 115314 (2016).
todo:
* SHG: SOME Nv=1 INSTANCES ARE HARDCODED, NEED TO GO BACK AND CHA... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
'''
Factory object
==============
The factory can be used to automatically import any class from a module,
by specifying the module to import instead of the class instance.
The class list and available modules are automatically generated by setup.py.
Example for registering a class/module::
>>> from kivy.factor... |
# Generated by Django 2.0.3 on 2018-03-25 18:23
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('app_ifou... |
import os
import sys
from pathlib import Path
# this has to be before imports from kf_lib
lib_path = Path('..').resolve()
os.chdir(lib_path)
if lib_path not in sys.path:
sys.path.append(str(lib_path))
import pandas as pd
TIER_MAX = 10
QI_COST_PER_TIER = 5
def listr(s):
"""'x,x,x'string to list"""
retur... |
import os
import argparse
def create_val_img_folder(args):
'''
This method is responsible for separating validation images into separate sub folders
'''
dataset_dir = os.path.join(args.data_dir)
val_dir = os.path.join(dataset_dir, 'val')
img_dir = os.path.join(val_dir, 'images')
fp = ope... |
"""Root Manager object."""
import json
from collections import deque
from typing import TYPE_CHECKING, Dict, Optional, Type, Union
from .base import ItemCollection, ZWaveBase
from .const import EMPTY_PAYLOAD
from .models.instance import OZWInstance
from .options import OZWOptions
if TYPE_CHECKING:
from .base impo... |
"""TensorFlow workspace initialization. Consult the WORKSPACE on how to use it."""
# Import third party config rules.
load("//tensorflow:version_check.bzl", "check_bazel_version_at_least")
load("//third_party/gpus:cuda_configure.bzl", "cuda_configure")
load("//third_party/gpus:rocm_configure.bzl", "rocm_configure")
lo... |
from typing import Dict, Tuple
import pickle
import telegram
import redis
from lib.telegram.state import State
from lib.telegram.handlers import (
BaseUpdateHandler,
UpdateHandlerDefault,
UpdateHandlerShowGame,
UpdateHandlerDeleteGameConfirmation,
UpdateHandlerCreateGameSubmitSize,
UpdateHand... |
# Copyright 2016 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.
# Recipe module for Skia Swarming perf.
import calendar
import os
DEPS = [
'core',
'env',
'flavor',
'recipe_engine/file',
'recipe_engine/json'... |
import json
# django imports
from django.contrib.auth.decorators import permission_required
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.http import HttpResponse
from django.http import HttpResponseRedirect
... |
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Boolean, or_
from sqlalchemy.orm import relationship, sessionmaker
from tabulate import tabulate
from update_genbank_asse... |
import os
import ssl
import math
import time
import codecs
import typing
import asyncio
import logging
import itertools
import collections
from asyncio import Event, sleep
from collections import defaultdict
from functools import partial
from elasticsearch import ConnectionTimeout
from prometheus_client import Counte... |
"""Utilities for processing .test files containing test case descriptions."""
import os.path
import os
import tempfile
import posixpath
import re
from os import remove, rmdir
import shutil
from abc import abstractmethod
import pytest # type: ignore # no pytest in typeshed
from typing import List, Tuple, Set, Option... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('djangobmf_address', '0001_version_0_2_0'),
]
operations = [
migrations.RemoveField(
model_name='address',
... |
import numpy as np
import pyroomacoustics as pra
import matplotlib.pyplot as plt
from scipy.io import wavfile
from multinmf_conv_em import multinmf_conv_em_wrapper
from multinmf_recons_im import multinmf_recons_im
from utilities import partial_rir
# get the speed of sound from pyroomacoustics
c = pra.constants.get(... |
import textwrap
from typing import (
Sequence,
)
from ai.backend.client.session import api_session
from ai.backend.client.output.fields import storage_fields
from ai.backend.client.output.types import FieldSpec, PaginatedResult
from ai.backend.client.pagination import generate_paginated_results
from .base import a... |
import hashlib
import base64
import os
from django.conf import settings
from django.http import JsonResponse
def handle(request):
method = request.method
if(method == 'POST'):
data = request.read()
id_mask = create_mask(data)
return JsonResponse({'id': id_mask})
if(method == 'GET'... |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class PythonSynthDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipI... |
name = 'pylibimport'
version = '1.9.2'
description = 'Python utility for importing packages with the same name, but different version.'
url = 'https://github.com/justengel/pylibimport'
author = 'Justin Engel'
author_email = 'jtengel08@gmail.com'
|
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("XGBClassifier" , "BreastCancer" , "sqlite")
|
import sqlite3 as sql3
#function for Stretch
def get_scalar_result(conn, sql):
cursor=conn.cursor()
cursor.execute(sql)
return cursor.fetchall()
conn = sql3.connect('demo_data.sqlite3')
curs = conn.cursor()
creatq = 'create table demo (s VARCHAR, x int, y int);'
curs.execute(creatq)
insertli = ["('g', ... |
# Generated by Django 3.0.3 on 2020-03-08 21:30
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Ed Mountjoy
#
import argparse
import gzip
def main():
# Args
args = parse_args()
# Concat together
with gzip.open(args.out, 'w') as out_h:
for inf in args.in_json:
with gzip.open(inf, 'r') as in_h:
for line in in_h... |
"""The tests for the Shell command component."""
import os
import tempfile
import unittest
from unittest.mock import patch
from subprocess import SubprocessError
from homeassistant.bootstrap import _setup_component
from homeassistant.components import shell_command
from tests.common import get_test_home_assistant
c... |
from django.core.management.base import BaseCommand
from parkings.importers import PermitAreaImporter
class Command(BaseCommand):
help = 'Uses the PermitAreaImporter to create permit areas'
def handle(self, *args, **options):
PermitAreaImporter().import_permit_areas()
|
from sqlalchemy import Column, Integer, BLOB, ForeignKey, Index, String, UnicodeText, BigInteger, Boolean
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship
from rdr_server.common.enums import WithdrawalStatus, SuspensionStatus, WithdrawalReason
from rdr_server.model.base_mode... |
import math
from abc import ABC, abstractmethod
class AreaCalculator:
def __init__(self, shapes):
assert isinstance(shapes, list), "`shapes` should be of type `list`."
self.shapes = shapes
@property
def total_area(self):
total = 0
for shape in self.shapes:
tota... |
import logging
from Qt import (
QtCore,
QtWidgets
)
class _Signals(QtCore.QObject):
""" Custom signals """
signal_record = QtCore.Signal(logging.LogRecord)
record_context_request = QtCore.Signal(QtCore.QPoint, list, QtWidgets.QListWidget)
def __init__(self):
QtCore.QObject.__init__(s... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 28 19:51:54 2015
@author: Patrick Boehnke
If you use this code please cite:
Boehnke, P., Barboni, M., & Bell, E. A. (2016). Zircon U/Th Model Ages in the Presence of Melt Heterogeneity. Quaternary Geochronology, Submitted.
For comments please contact: pboehnke @ gmail ... |
COMMON_EMAIL_HANDLES = [
'company',
'contact',
'hello',
'hi',
'info',
'me',
'support',
'team',
]
|
"""Filter Attribute Unit Test Suite"""
from ifc_data_checker.path_operators import AttributeFilterPathOperator
from ifc_data_checker import config
from tests.path_operators.path_operator_test import TestPathOperator
from tests.helpers import IfcInstanceMock
from tests.helpers import MicroMock
class TestFilterAttribu... |
#
# 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
# distributed under ... |
from zlib import crc32
import requests
class Avacat:
def __init__(self, root='https://shantichat.github.io/avacats'):
self.root = root
self.info = requests.get(f'{root}/index.json').json()
def __call__(self, name, size):
assert size in self.info['sizes'], f"Size {size} not allowed, a... |
from typing import Any, List, Literal, TypedDict
from .FHIR_Coding import FHIR_Coding
from .FHIR_dateTime import FHIR_dateTime
from .FHIR_Element import FHIR_Element
from .FHIR_id import FHIR_id
from .FHIR_ImagingStudy_Instance import FHIR_ImagingStudy_Instance
from .FHIR_ImagingStudy_Performer import FHIR_ImagingStud... |
class DescontoPorCincoItens(object):
def __init__(self, proximo_desconto):
self.__proximo_desconto = proximo_desconto
def calcula(self, orcamento):
if orcamento.total_itens > 5:
return orcamento.valor * 0.01
else:
return self.__proximo_desconto.calcula(orcamento... |
from __future__ import print_function
import pyttsx3
import datetime
import smtplib
import speech_recognition as sr
import wikipedia
import webbrowser
import os
import random
from twilio.rest import Client
import pickle
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
f... |
from BucketLib.bucket import Bucket
from collections_helper.collections_spec_constants import MetaConstants
spec = {
MetaConstants.NUM_BUCKETS: 3,
MetaConstants.NUM_SCOPES_PER_BUCKET: 2,
MetaConstants.NUM_COLLECTIONS_PER_SCOPE: 2,
MetaConstants.NUM_ITEMS_PER_COLLECTION: 5000,
MetaConstants.REMOVE_D... |
# Translate alphabet based text to braille.
from . import mapAlphaToBraille, mapBrailleToAlpha
CAPITAL = chr(10272) # ⠠
NUMBER = chr(10300) # ⠼
UNRECOGNIZED = '?'
# There is no braille symbol for a generic quote (").
# There is only open quotation (“) and closed quotation (”).
# Therefore we must keep trac... |
def main():
key = '15,11,19,18,16,03,07,14,02,20,04,12,09,06,01,05,17,13,10,08'
plain_text = 'distributed anonymous'.replace(' ','')
encrypted_text = list(plain_text)
key = key.split(',')
for index, char in enumerate(plain_text):
new_index = key.index(str(index + 1).zfill(2))
# pri... |
from docxbuilder.docx.docx import *
|
from .nrmse import nrmse
from .rsquared import rsquared
from .breuschpagan import breuschpagan
from .condition_number import condition_number
from .durbin_watson import durbin_watson
from .jarque_bera import jarque_bera
from .ljungbox import ljungbox
from .mae import mae
from .mape import mape
from .mse import mse
from... |
from sklearn.cluster import KMeans
def cluster_embeddings(embeddings, sentences, num_clusters):
clustering_model = KMeans(n_clusters=num_clusters)
clustering_model.fit(embeddings)
cluster_assignment = clustering_model.labels_
clustered_sentences = [[] for i in range(num_clusters)]
for sentence_id... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
This file contains the definition of encoders used in https://arxiv.org/pdf/1705.02364.pdf
"""
import time
import numpy a... |
import os
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets import mnist
import numpy as np
save_dir = './Mnist_data'
# save_dir 에 데이터 내려받기
data_sets = mnist.read_data_sets(save_dir,
dtype=tf.uint8,
reshape=False,
... |
"""Function Introspection
Functions are first class objects
They have attributes __doc__ __annotations__
We can attach our own attributes
def my_func(a, b):
return a + b
my_func.category = 'math'
my_func.sub_category = 'arithmetic'
print(my_func.category) # math
print(my_func.sub_cate... |
#
# 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... |
from tests.unit.dataactcore.factories.domain import OfficeFactory
from tests.unit.dataactcore.factories.staging import (DetachedAwardFinancialAssistanceFactory,
PublishedAwardFinancialAssistanceFactory)
from tests.unit.dataactvalidator.utils import number_of_errors,... |
import os
import pytest
from monai.networks.nets import EfficientNetBN, resnet18
from pytorch_lightning import seed_everything, Trainer
from kaggle_brain3d.data import BrainScansDM
from kaggle_brain3d.models import LitBrainMRI, make_submission
from tests.test_data import _generate_synthetic_dataset
_PATH_HERE = os.p... |
from enum import Enum
class Cloud(Enum):
ALIBABA = 'ALIBABA'
AWS = 'AWS'
AZURE = 'AZURE'
DIGITALOCEAN = 'DIGITALOCEAN'
GCP = 'GCP'
IBM = 'IBM'
ORACLE = 'ORACLE'
|
# -*- coding: utf-8 -*-
"""
/dms/help_document/views_show.py
.. zeigt die Hilfen zu einer Web-Applikation an
Django content Management System
Hans Rauch
hans.rauch@gmx.net
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 13.09.2007 ... |
print("Hello, Github users!") |
from typing import NamedTuple, Iterable, Sequence, Tuple, Callable
from requests import request, RequestException, Response
from saga_requests.utils import get_reduce_data
from .exceptions import SagaCompensationException
class SagaContext(NamedTuple):
context_path: Iterable[str]
class SagaRequestKwargs(Named... |
## Copyright 2019 Gia-Lac TRAN, Edwin V. Bonilla, John P. Cunningham, Pietro Michiardi, and Maurizio Filippone
##
## 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... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from envs.multiagentenv import MultiAgentEnv
from envs.starcraft2.maps import get_map_params
import atexit
from operator import attrgetter
from copy import deepcopy
import numpy as np
import enum
import math
f... |
from __future__ import unicode_literals
import re
from builtins import object, zip
from bs4 import BeautifulSoup
class WebVTTTestingMixIn(object):
"""
Provide specialized test case capabilities for asserting on WebVTT content.
"""
def _extract_webvtt_captions(self, content):
return tuple(li... |
import lxml.etree as etree
from pathlib import Path
source = etree.parse("crocodile.example.xml")
xsd_doc = etree.parse("coc.creature.xsd")
# xsds_doc = etree.parse("../common/xsd/rich_text.xsd")
xsd_schema = etree.XMLSchema(xsd_doc)
xsd_schema.assert_(source)
xslt_dom = etree.parse("coc.creature.smallblock.xslt")... |
# -*- encoding: utf-8 -*-
#
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# Device configuration
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Hyper-parameters
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_size = 100
num... |
"""
Django settings for importe_33537 project.
Generated by 'django-admin startproject' using Django 2.2.2.
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.