text stringlengths 2 999k |
|---|
# PointNet++ Layers
# Author: Charles R. Qi
# Date: November 2017
import os
import sys
import numpy as np
import tensorflow as tf
from tf_ops.tf_interpolate import three_nn, three_interpolate
from tf_ops.tf_grouping import query_ball_point, group_point, knn_point
from tf_ops.tf_sampling import farthest_point_sample, g... |
from setuptools import setup
import sys
import os
import re
PACKAGENAME = 'parm'
packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
PACKAGENAME)
# Obtain the package version
versionFile = os.path.join(packageDir, 'version.py')
with open(versionFile, 'r') as f:
s ... |
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nucleus_... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name = 'hello-viewset')
router.register('profile', views.UserProfileViewSet)
router.register('feed', views.UserProf... |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Field(object):
def __init__(self, api_name):
"""
Creates an instance of Field with the given p... |
# Make sure web2py reloads modules
from gluon.custom_import import track_changes
track_changes(True)
# Make sure to add our module path to the syspath for this app so that modules are loaded properly
import os
import sys
def get_app_folders():
# Will return calculated folders we will need
# see return statem... |
#!/usr/bin/env python
"""
This module defines Entry classes for containing experimental data.
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Jun 27,... |
import os
import json
import datetime
import jsonschema
from api.base.exceptions import InvalidModelValueError
here = os.path.split(os.path.abspath(__file__))[0]
def from_json(fname):
with open(os.path.join(here, fname)) as f:
return json.load(f)
def validate_user_json(value, json_schema):
try:
... |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... |
# Python imports.
import Queue
# Other imports.
from simple_rl.utils import make_mdp
from simple_rl.planning.ValueIterationClass import ValueIteration
import hierarchy_helpers
class HierarchicalValueIteration(ValueIteration):
def __init__(self, mdp, rew_func_list, trans_func_list, sa_stack, aa_stack, name="hiera... |
import torch
import torch.nn as nn
import torchvision.models as models
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
super(EncoderCNN, self).__init__()
resnet = models.resnet50(pretrained=True)
for param in resnet.parameters():
param.requires_grad_(False)
... |
from datetime import datetime
def log_msg(log_level, stage, msg):
vdate = datetime.now()
print("[{}][{}][{}] {}".format(log_level.upper(), vdate.isoformat(), stage, msg))
def is_not_empty (var):
if (isinstance(var, bool)):
return var
elif (isinstance(var, int)):
return False
empty_... |
"""
File I/O
'w' -> Write-Only Mode
'r' -> Read-Only Mode
'r+' -> Read and Write Mode
'a' -> Append Mode
"""
#
#
# print("*****____ How to Write to a File ____*****")
# my_list = [1, 2, 3]
#
# my_file = open("firstwritefile.txt", "w")
#
# for item in my_list:
# my_file.write(str(item))
#
# my_file.close()
print("*... |
"""lisa: a bioinformatics software
epigenome analysis to rank TFs from gene set
"""
import os
from glob import glob
from setuptools import setup, find_packages, Extension
from numpy.distutils.misc_util import get_numpy_include_dirs
def get_extension():
""" get extension for computing regulatory potential from bigw... |
import cv2
from matplotlib import pyplot as plt
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
cas = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml')
smile_cas = cv2.CascadeClassifier('haarcascade_smile.xml')
glasses = cv2.imread('glass.png', -1)
cigar = cv... |
from typing import Sequence
import numpy as np
import h5py
from easistrain.EDD.io import (
create_info_group,
peak_dataset_data,
save_fit_data,
)
from easistrain.EDD.utils import fit_detector_data, run_from_cli
def fitEDD(
fileRead: str,
fileSave: str,
sample: str,
dataset: str,
scanNu... |
"""
Contains unit tests to ensure that the transformation of bounding box
coordinates from one image to another after scaling is correct.
"""
import numpy as np
from breakdb.io.image import transform_coords, compute_resize_transform
class TestTransformCoords:
"""
Test suite for :function: 'transform_coords'.... |
import datetime
import hashlib
import json
from flask import Flask, jsonify, request
import requests
from uuid import uuid4
from urllib.parse import urlparse
# Blockchain definition
class Blockchain:
def __init__(self):
self.chain = []
self.transactions = []
self.create_block(proof = 1, p... |
"""
Django settings for busman project.
Generated by 'django-admin startproject' using Django 1.11.14.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... |
"""Copied almost verbatim from https://github.com/dmlc/xgboost/blob/a5c852660b1056204aa2e0cbfcd5b4ecfbf31adf/tests/python/test_with_sklearn.py
in order to ensure 1:1 coverage, with minimal modifications.
Some tests were disabled due to not being applicable for a
distributed setting.""" # noqa: E501
# Copyright 2021 b... |
"""
SparseNet for ImageNet-1K, implemented in PyTorch.
Original paper: 'Sparsely Aggregated Convolutional Networks,' https://arxiv.org/abs/1801.05895.
"""
__all__ = ['SparseNet', 'sparsenet121', 'sparsenet161', 'sparsenet169', 'sparsenet201', 'sparsenet264']
import os
import math
import torch
import torch.nn ... |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Particl Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_aphory import AphoryTestFramework
from test_framework.messages impo... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# 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... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'AddDeploy.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, Qt... |
#!/usr/bin/env python2
"""
Script to modify output from SplitsTree because I don't think any
software exists to read the network format properly.
This version classifies strains into increase, decrease, and same.
Requirements:
- Choose "simple" method of laying out the labels
- Keep hi... |
# Definitions of theano.scalar ops that have their python implementation taken
# from SciPy. As SciPy is not always available, we treat them separately.
import numpy as np
import os
import theano
from theano.gradient import grad_not_implemented
from theano.scalar.basic import (
UnaryScalarOp,
BinaryScalarOp,
... |
from __future__ import unicode_literals
import base64
import boto3
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import traceback
import zipfile
from builtins import str
from werkzeug.wrappers import Response
# This file may be copied into a projec... |
from os.path import isdir
import re
def filterLines(lines, regex):
'''Filters each line of the given line iterator using the given regular
expression string. For each match, a tuple containing the text matching
each capture group from the regular expression is yielded.
'''
matcher = re.compile(regex)
for line in... |
#!/usr/bin/env python2
# ****************************************************************************
# Copyright 2018 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... |
# Copyright (c) 2010-2022 openpyxl
from openpyxl.styles.named_styles import NamedStyleList
import pytest
import datetime
from io import BytesIO
from lxml.etree import iterparse, fromstring
from openpyxl.xml.constants import SHEET_MAIN_NS
from openpyxl.utils.indexed_list import IndexedList
from openpyxl.packaging.re... |
from django import forms
from .models import Profile, Project, Rating
class ProjectForm(forms.ModelForm):
class Meta:
model = Project
exclude = ['poster','postername', 'pub_date']
class RatingForm(forms.ModelForm):
class Meta:
model = Rating
exclude = ['average','project','postername','pub_date'... |
# Для заданих n та a обчислити суму s = 1 + 2²a + ... + n²aⁿ⁻¹ = ∑(i=1, n) i²aⁱ⁻¹.
if __name__ == "__main__":
n, a = map(int, input("n, a = ").split()) # ввід n, a
s = sum(i ** 2 * a ** (i - 1) for i in range(1, n + 1)) # до s в циклі додаємо i²aⁱ⁻¹ від 1 до n
print(f"\n{n = }, {a = }\n{s = }")
|
from rest_framework.serializers import (
ModelSerializer,
HyperlinkedIdentityField,
SerializerMethodField,
ValidationError,
ModelSerializer
)
from accounts.api.serializers import UserDetailSerializer
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import get_... |
# coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest # NOQA
from roundtrip import dedent, round_trip_dump, round_trip_load
# http://yaml.org/type/int.html is where underscores in integers are defined
class TestBinHexOct:
def test_calculate(self):
... |
#
# PySNMP MIB module HPOV-SNMPSEC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPOV-SNMPSEC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:42:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
"""Purify a 2-marginal by the unitary decomposition technique
0. Decompose tpdm into it's three components of the unitary group
1. set 2D(0) to be fixed by the trace
2. set 2D(1) to be fixed by a valid opdm contracted from the real one
3. reconstruct total tpdm
5. diagonalize and find exposed operators
6. decompose ex... |
# :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import os
import pkgutil
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
raise ImportError('Could not import json or simplejson')
import jsonschem... |
from tests.unit.twiml import TwilioTest
from twilio.twiml.messaging_response import MessagingResponse, Body, Media
class TestResponse(TwilioTest):
def test_empty_response(self):
r = MessagingResponse()
assert self.strip(r) == \
'<?xml version="1.0" encoding="UTF-8"?><Response />'
... |
import boto3
# Retrieve the list of existing buckets
s3 = boto3.client('s3')
response = s3.list_buckets()
# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
print(f' {bucket["Name"]}') |
import funcy
import functools
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import shap
from copy import deepcopy
font = {
"size": 30
}
matplotlib.rc("font", **font)
def plot_results_2x2(summaries, save_fpath, fformat="pdf", dpi=300):
fig = plt... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If exte... |
# Copyright 2016 Splunk, 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 in writing,... |
'''
Reading input data.
@author: anze.vavpetic@ijs.si
'''
import rdflib
import json
import hashlib
import os
import _pickle as cPickle
from .settings import logger, HEDWIG, GENERIC_NAMESPACE
from .example import Example
def rdf(paths, def_format='n3'):
'''
Loads the ontology into an rdf gr... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "tbh-bc-reports-34179.botics.co"
site_params = {
"name": "TBH BC Reports",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.upda... |
from .finder.core import FinderFactory
from .parser import DoxygenParserFactory
from .renderer import DoxygenToRstRendererFactory
from .renderer.base import RenderContext
from .renderer.filter import FilterFactory
from .renderer.target import TargetHandlerFactory
from .renderer.mask import MaskFactory, NullMaskFactory... |
import sys
# Global Variable
baseVarName = "globalVariable_SHYDNUTN_"
# Variable Functions
def var_name(x):
name = ""
if(x >= 0 and x < 10):
name = baseVarName+"00"+str(x)
elif(x >= 10 and x < 100):
name = baseVarName+"0"+str(x)
elif(x >= 100):
name = baseVarName+str(x)
return name
def getNumberO... |
STOP_MARKER_FILE = "storage-sync-shutdown-trigger"
|
import os
import numpy as np
import glob
import cv2, json
import argparse
from sklearn.utils import shuffle
from keras.optimizers import SGD, Adam
from keras.models import Sequential
from keras.layers import Dropout, Dense
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.preprocessing import image
... |
import discord
import random
from Utilities.Log import Log
from Utilities.Time import Time
from Utilities.Files import File
from Utilities.ImageFormats import ImageFormats
from Utilities.Functions import get_file_name, get_file_extension, is_url, is_string_formated, is_position
from Componentes.Usuario import Usuario
f... |
import os
import shutil
import tempfile
import contextlib
import unittest
import pytest
import argparse
import sys
import torch
import __main__
import random
import inspect
import functools
from numbers import Number
from torch._six import string_classes
from collections import OrderedDict
from torchvision import io
... |
from segmentation_models_pytorch.base import (ClassificationHead,
SegmentationHead,
SegmentationModel)
from segmentation_models_pytorch.base import initialization as init
from segmentation_models_pytorch.encoders import get_enco... |
def wrap_mystery(n):
|
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... |
import os
from utils import read_file_contents_list, convert_flat_2_3d, get_logger
import nibabel as nib
import numpy as np
import pickle
logger = get_logger('DataFolder')
class DataFolder:
def __init__(self, in_folder, data_file_list=None):
self._in_folder = in_folder
self._file_list = []
... |
def event(instance, **data):
instance.handle(data)
|
#!/usr/bin/env python
# coding: utf-8
# # 0. Computational and Inferential thinking
#
# 详见[Computational and Inferential thinking](https://inferentialthinking.com/chapters/intro.html)
|
#!/Users/zhiyang/anaconda3/bin/python3
####!/usr/local/bin/python3
"""
Skip nanosecond precision in measuring the current time;
hence, I am not using the Python intepreter available at
the following path, which is based on Python 3.7.4.
/usr/local/bin/python3
"""
###!/Library/Frameworks/Python.framework/Vers... |
#! /usr/bin/python
import json
import re
def iter_get(client):
"""
return an iterator over all results from GETing the client and any subsequent pages.
"""
items = []
while items or client:
if not items:
resp = client.get()
items = resp.json()
if not isin... |
#!/usr/bin/env python
"""Tests for the method of removing small hopping terms."""
import pytest
@pytest.mark.parametrize("t1", [0.6 + 0.5j, 0.0 + 1j, 2])
@pytest.mark.parametrize("t2", [0.2j, 1.5])
@pytest.mark.parametrize("onsite", [(1.2, -0.6), (3.5, 2)])
@pytest.mark.parametrize("cutoff", [-1, 0.4, 1, 3, 10])
def... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2021- Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... |
"""
All things to do with navigation.
"""
|
from data import Database, sentence
from data import Sentence
from data import Bots
class Category():
def __init__(self, bot, data=None):
if bot is not None:
self.bot = bot._id
self.sentences = []
self.sentence_ids = []
self.patterns = []
self.data = data
... |
#
# peepdf is a tool to analyse and modify PDF files
# http://peepdf.eternal-todo.com
# By Jose Miguel Esparza <jesparza AT eternal-todo.com>
#
# Copyright (C) 2011-2017 Jose Miguel Esparza
#
# This file is part of peepdf.
#
# peepdf is free software: you can redistribute it and/or modify
# ... |
import numpy as np
import torch
import torch.autograd as autograd
import torch.nn.functional as F
from typing import Optional, Union, Tuple, List
from deeprob.torch.base import ProbabilisticModel
from deeprob.torch.constraints import ScaleClipper
from deeprob.spn.layers.dgcspn import SpatialGaussianLayer, SpatialProd... |
import numpy as np
from wzk import get_first_non_empty, fill_with_air_left, safe_add_small2big, initialize_image_array
def create_rectangles(*, n, size_limits=(1, 10), n_voxels=(64, 64),
special_dim=None):
"""
Create a series of randomly placed and randomly sized rectangles.
The bot... |
import unittest
import math
import numpy as np
import pitch
class TestGetFrqFromStr(unittest.TestCase):
def test_getfrq_a4(self):
self.assertEqual(440.0, pitch.getFrqFromStr("A4"))
def test_getfrq_a5(self):
self.assertEqual(880.0, pitch.getFrqFromStr("A5"))
def test_get... |
from django import forms
from policies.models import Policy
from groups.models import Group
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class FileNameForm(forms.Form):
file_name = forms.CharField(label='File name', max_length=200)
class UploadFileForm(forms... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Left and right inversions in a table
# christoph durr - 2016-2018
# snip{
def _merge_sort(tab, tmp, rank, left, right, lo, hi):
if hi <= lo + 1: # interval is empty or singleton
return # nothing to do
mid = lo + (hi - lo) /... |
# Create Target Array in the Given Order
# Given two arrays of integers nums and index. Your task is to create target array under the following rules:
#
# Initially target array is empty.
# From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
# Repeat the previous st... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from cc... |
import boto3
import time
import json
import logging as log
import cfnresponse
log.getLogger().setLevel(log.INFO)
physical_id = 'TheOnlyCustomResource'
ec2 = boto3.resource('ec2', region_name='ca-central-1')
client = boto3.client('ec2', region_name='ca-central-1')
dynamodb = boto3.resource('dynamodb', region_name='ca... |
import os
import pendulum
import pytest
import sys
import tempfile
from datetime import datetime, timedelta
from time import sleep, time
from unittest.mock import MagicMock
import prefect
from prefect.client import Secret
from prefect.core.edge import Edge
from prefect.core.task import Task
from prefect.engine import... |
print('====== DESAFIO 48 ======')
s = 0
for c in range(1, 501):
value = c*3
if value % 2 == 0:
print(c,'x 3 % 2 = PAR')
else:
print(c,'x 3 % 2 = IMPAR') |
import numpy as np
from ._points_utils import points_in_box
def select(layer, event):
"""Select points.
Clicking on a point will select that point. If holding shift while clicking
that point will be added to or removed from the existing selection
depending on whether it is selected or not.
Clic... |
# ClearML - Example of tensorboard with tensorflow (without any actual training)
#
import os
from tempfile import gettempdir
import tensorflow as tf
import numpy as np
from PIL import Image
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
task... |
from chatterbot import ChatBot
# Create a new instance of a ChatBot
bot = ChatBot("Terminal",
storage_adapter="chatterbot.adapters.storage.JsonDatabaseAdapter",
logic_adapters=[
"chatterbot.adapters.logic.MathematicalEvaluation",
"chatterbot.adapters.logic.TimeLogicAdapter",
"chatterbo... |
from cytoolz.dicttoolz import (
assoc,
)
def construct_formatting_middleware(request_formatters=None,
result_formatters=None,
error_formatters=None):
if request_formatters is None:
request_formatters = {}
if result_formatters ... |
from djmodels.conf.urls import include, url
from djmodels.contrib.flatpages.sitemaps import FlatPageSitemap
from djmodels.contrib.sitemaps import views
# special urls for flatpage test cases
urlpatterns = [
url(r'^flatpages/sitemap\.xml$', views.sitemap,
{'sitemaps': {'flatpages': FlatPageSitemap}},
... |
# encoding=utf-8
__all__ = [
"HttpMethod",
"HttpVersion",
"HttpStatus",
"HttpHeader",
"PopularHeaders",
]
from enum import Enum
from ahserver.util.parser import FieldNameEnumParser, IntPairEnumParser
from . import httpheader as HttpHeader
@FieldNameEnumParser("http_method")
class HttpMethod(En... |
# Marcelo Campos de Medeiros
# ADS UNIFIP
# REVISÃO DE PYTHON
# AULA 09 GUSTAVO GUANABARA
'''
Faça um programa leia oum número de 0 a 9999 e moste cada um dos digitos separados.
ex: 1834
milhar:1; centena:8; dezena:3; unidade:4.
'''
print('='*30)
print('{:@^30}'.format(' STRAING DE NÚMEROS '))
print('='*30)
print()
... |
"""
ASGI config for django_project_alexandrin project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdef... |
from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
import os
app = FastAPI()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.get("/items/")
async def read_items(token: str = Depends(oauth2_scheme)):
return {"token": token}
if __name__ == '__main__':
print(f'I... |
# Copyright 2019 Eli Lilly and Company
#
# 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 l... |
import logging
from typing import TYPE_CHECKING, List, Literal, Optional, Sequence
from pysqlcipher3 import dbapi2 as sqlcipher
from rotkehlchen.chain.ethereum.modules.eth2.structures import (
Eth2Deposit,
Eth2Validator,
ValidatorDailyStats,
)
from rotkehlchen.constants import ONE, ZERO
from rotkehlchen.c... |
import requests
from flask import Blueprint, render_template, request
app_homepages = Blueprint('homepages', __name__,
url_prefix='/homepages/',
template_folder='templates/homepages',
static_folder='static',
static_... |
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in [0] * n]
s = 0
for i in range(n):
for j in range(m):
t = []
for x, y in ((0, 1), (1, 0), (0, -1), (-1, 0)):
i_ = i
j_ = j
if 0 > x or 0 > y:
continue
k = a... |
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import multi_apply, multiclass_nms, multiclass_nms_sorting, distance2bbox, bbox2delta, bbox_overlaps
from ..builder import build_loss
from ..registry import HEADS
from ..utils import bias_init_with_prob, Scale, ConvModule
from IPython... |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... |
import json
import webbrowser
from os import path
from logging import getLogger, INFO
from tornado import web
from tornado.web import StaticFileHandler
from tornado.websocket import WebSocketHandler
from tornado.ioloop import IOLoop
from .io import JoystickStream
from multiprocessing import Process
getLogger(__name__)... |
"""
WSGI config for BeaverStacks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdef... |
r"""
Definition
----------
This model is a trivial extension of the core_shell_sphere function where the
core is filled with solvent and is surrounded by $N$ shells of material
(such as lipids) interleaved with $N - 1$ layers of solvent. For $N = 1$, this
returns the same as the vesicle model, except for the normalisa... |
"""circles app"""
# Django
from django.apps import AppConfig
class CirclesAppConfig(AppConfig):
"""circles App Config"""
name = 'cride.circles'
verbose_name = 'circles'
|
from enum import IntEnum, auto
from typing import Iterator, Tuple
from executor import env
class DatasetType(IntEnum):
UNKNOWN = auto()
TRAINING = auto()
VALIDATION = auto()
CANDIDATE = auto()
def _index_file_for_dataset_type(env_config: env.EnvConfig, dataset_type: DatasetType) -> str:
mapping... |
from o3seespy.base_model import OpenSeesObject
class BeamIntegrationBase(OpenSeesObject):
op_base_type = "beamIntegration"
class Lobatto(BeamIntegrationBase):
"""
The Lobatto BeamIntegration Class
Create a Gauss-Lobatto beamIntegration object.Gauss-Lobatto integration is the most common approac... |
# coding: utf-8
"""
Argo
Python client for Argo Workflows # noqa: E501
OpenAPI spec version: release-2.8
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class V1ConfigMapEnvSource(object):
"""NOTE: This class is auto... |
from dataclasses import dataclass
from logging import Logger, getLogger
from typing import Dict, Union
import numpy as np
import pandas as pd
from fseval.types import IncompatibilityError, TerminalColor
from omegaconf import MISSING
from .._experiment import Experiment
from ._config import RankAndValidatePipeline
@... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
from pandas import Int64Index, MultiIndex, PeriodIndex, UInt64Index
from pandas._libs.tslib import iNaT
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
def test_fillna(idx):
# GH 11343... |
import numpy as np
import numba as nb
@nb.jit(nopython=True, parallel=True, fastmath=True)
def kernel(alpha, beta, C, A, B):
temp2 = np.empty((C.shape[1], ), dtype=C.dtype)
C *= beta
for i in range(C.shape[0]):
for j in nb.prange(C.shape[1]):
C[:i, j] += alpha * B[i, j] * A[i, :i]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.