text stringlengths 3.07k 12.6k |
|---|
from __future__ import unicode_literals, print_function, division
# import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import sklearn.decomposition
import re
from io import open
import glob
import os
import unicodedata
import string
import torch
import torch.nn as nn
import torch.nn.functiona... |
import numpy as np
import matplotlib.pyplot as plt
N = 12
dt = 5e-5
dx = 1 / N
rho = 4e1
num_face = 2 * N ** 2 # number of faces
num_vert = (N + 1) ** 2 # number of vertices
E, nu = 4e4, 0.2 # Young's modulus and Poisson's ratio
mu, lam = E / 2 / (1 + nu), E * nu / (1 + nu) / (1 - 2 * nu) # Lame parameters
ball_pos,... |
import pandas as pd
import numpy as np
def dispersion(s):
# calculate range
return s.max() - s.min()
def build_feature(tele, tele_iqr, win_mean_std, pca_gyro, cluster_win):
"""
Build 3 type of features from raw telematics data.
Type 1: Statistical summary of telematics data, including mean,
... |
#!/usr/bin/env python
import setuptools
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import os
import numpy
import platform
import sys
import urllib
try:
from urllib.request import urlretrieve
excep... |
"""
MemoryKeyValueStore
Class for a KeyValueStore that is stored in local memory.
The value is stored with an expiration time, which is checked on
retrieval to make sure it is not expired.
A heap of (exptime, key) tuples is maintained to track of keys
eligible for expiration; it is checked on each store() call.
""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import unittest
import os
import io
import types
import json
import datetime
from eve.tests import TestMinimal
# from eve.tests.endpoints import TestEndPoints
from api.store_image import ImageStorage, allowed_file, read_zip, get_md5
from api.main import create_ap... |
# -*- coding: utf-8 -*-
###############################################################################
#
# finder.py
#
# class Finder: executes a file find
#
###############################################################################
import os
from typing import List, Optional
from .filetypes import FileType, Fil... |
#!/usr/bin/python2.5
#
# Copyright 2014 <NAME>.
#
# Author: <NAME> (<EMAIL>)
#
# 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
# t... |
import pandas as pd
import requests
import json
import datetime
from dateutil.parser import parse
import numpy as np
import time
# def get_config(file="local.ini", sec="DEFAULT"):
# """Reads a section of a configpareser INI file"""
# import configparser
# config = configparser.ConfigParser()
# config.read(file)... |
#!/usr/bin/env python
# ####################################################################
#
#
# ####################################################################
from __future__ import print_function
import DB2
import sys
import os
import time
import string
class MMCS:
def __init__(self):
(self.... |
"""Contains common utility functions."""
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
#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/LIC... |
"""
`SyncableModelRegistry` holds all syncable models for a project, on a per profile basis.
This class is registered at app load time for morango in `apps.py`.
"""
import sys
from collections import OrderedDict
from django.db.models.fields.related import ForeignKey
from django.utils import six
from morango.errors im... |
# Copyright 2011 Autodesk, Inc. All rights reserved.
#
# The MIT License
#
# 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
... |
# -*- coding: utf-8 -*-
import logging
from odoo import api, fields, models
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class DinDinMessageTemplateLine(models.Model):
_name = 'dindin.message.template.line'
_description = "消息模板列表"
_rec_name = 'template_id'
sequence = ... |
# -*- coding: utf8 -*-
import pytest
import mclispy
from mclispy.lisp import parse, leval, Atom, global_env, parse_all
@pytest.fixture(scope='module')
def core():
return [leval(exp) for exp in parse_all(mclispy.core)]
def test_quote():
assert leval(parse('(quote a)')) == Atom('a')
assert leval(parse('... |
from PIL import Image
from skimage.metrics import structural_similarity as ssim
import argparse
import functools
import glob
import losses.losses as losses
import numpy as np
import os
import os.path as osp
import skimage.measure
import tensorflow as tf
import tensorflow_gan as tfgan
parser = argparse.ArgumentParser(... |
import datetime
import numpy as np
import math
import pandas as pd
import pyarrow as pa
from pandas.api.types import (
is_bool_dtype,
is_integer_dtype,
is_float_dtype,
is_object_dtype,
is_datetime64_any_dtype,
)
from omnisci.mapd.ttypes import (
TColumn, TColumnData, TColumnType
)
from omnisc... |
"""
bitcoingraph
A Python library for extracting and navigating graph structures from
the Bitcoin block chain.
"""
import logging
from bitcoingraph.bitcoind import BitcoinProxy, BitcoindException
from bitcoingraph.blockchain import Blockchain
from bitcoingraph import entities
from bitcoingraph.graphdb import GraphC... |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
import os
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinitio.tasks import *
from pymatgen.io.abinitio.tasks import TaskPolicy
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", 'test_files... |
#
# Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
"""The simplest possible interface for ATS. A layer that can be used in any
Keras model."""
from keras import backend as K
from keras.engine import Layer
from ..data.from_tensors import FromTensors
from ..utils.laye... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
from collections import defaultdict
import functools
import multiprocessing
# Three kinds of streams:
# 000LLLLL Literal string of L+1 bytes
# LLLaaaaa bbbbbbbb Backref of L+3 bytes
# 111aaaaa LLLLLLL... |
#!/usr/bin/env python
u"""
verify_box_tpxo.py
Written by <NAME> (10/2020)
Verifies downloaded TPXO9-atlas global tide models from the box file
sharing service
CALLING SEQUENCE:
python verify_box_tpxo.py --token <token> --tide TPXO9-atlas-v4
where <username> is your box api access token
COMMAND LINE OPTION... |
r"""undocumented
这个页面的代码很大程度上参考(复制粘贴)了https://github.com/huggingface/pytorch-pretrained-BERT的代码, 如果你发现该代码对你
有用,也请引用一下他们。
"""
__all__ = [
'RobertaModel'
]
import torch
import torch.nn as nn
from .bert import BertEmbeddings, BertModel, BertConfig
from fastNLP.io.file_utils import _get_file_name_base_on_postfi... |
# Copyright 2020-present <NAME>
#
# 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 writin... |
# Copyright 2018-2021 Xanadu Quantum Technologies 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... |
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
import collections
import glob
import os
import importlib
import json
import xarray as xr
def _wrap_sequence(obj):
if isinstance(obj, str):
obj = [obj]
return obj
def is_dataref_characterised(data_ref):
return True
def is_characterised(data_refs, require_all=False):
""... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 31 16:13:15 2022
@author: Elliot
This exercise uses Object Oriented Programming to create an Agent Based Model
(A model showing sheeps interaction with an environment)
Steps
1. Import Libaries and files being worked with. (Line 29 - 38)
The agentframe and environ fi... |
"""
-----------------------------
Author: <NAME>
Email: <EMAIL>
-----------------------------
A collection of list-searching functions, utilising various algorithms
"""
# UNSORTED LIST SEARCH FUNCTIONS
def linear_search(array: list, element, start_idx=None, stop_idx=None) -> int:
# Iterate through the array unt... |
# -*- coding: utf-8 -*-
"""
"""
import os, sys
import platform
import re
import pytest
from cslug._cc import cc, which, _parse_cc_version, _macos_architecture
from cslug import exceptions, misc
from cslug._cslug import strip_useless_warnings
from tests import DUMP, uuid, RESOURCES
pytestmark = pytest.mark.order(-4... |
from copy import deepcopy
from itertools import product
import numpy as np
from PlanningCore.robot import Robot
from PlanningCore.core import (
coordinate_transformation,
constants as c,
get_common_tangent_angles,
get_line_formula,
get_vector_angles,
State,
)
def init_table(cue_ball_pos, bal... |
from __future__ import unicode_literals, print_function
markdown_escape_map = {
"&": "&",
"<": "<",
">": ">",
"*": "\*",
"_": "\_",
"`": "\`",
"#": "\#",
"[": "\[",
"]": "\]",
"\\": "\\\\"
}
def markdown_escape(text):
return "".join(markdown_escape_map.get(c, c) ... |
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import value_and_grad
from scipy.optimize import minimize
from gaussian_process import make_gp_funs, rbf_covariance
def build_step... |
import sys
import gmpy2
LL1 = 32768 * 8
LL2 = 262144 * 8
LL3 = 8388608 * 8
page4k = 4096 * 8
page2M = 2048 * 1024 * 8
def nu(j):
assert j >= 0, "nu is undefined"
return bin(j)[2:].count('1')
def rho(j):
assert j != 0, "rho is inf"
return gmpy2.bit_scan1(j)
def lbda(j):
assert j > 0, "lambda is u... |
# Copyright (C) 2019 Uber Technologies, Inc.
# Modifications copyright Microsoft
# 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 re... |
import pickle
import os
import pathlib
class Account:
accNo = 0
name = ''
deposit = 0
type = ''
def createAccount(self):
self.accNo = int(input("Enter The Account Number: "))
self.name = input("Enter The Account Holder Name: ")
self.type = input("Enter The Type Of Account ... |
"""# Mutable BeautifulSoup database type
## Examples
#### Setup
```python
from sqlalchemy_mutablesoup import MutableSoupType
from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
# standard session creat... |
# This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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... |
"""
Copyright [2019] [Gazorpazorp]
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 faker
from faker import Faker
import random
import numpy as np
import sys
import datetime
from datetime import date
from datetime import timedelta
import fileinput
import random
from collections import defaultdict
import json
import sparkov_data_generation.demographics as demographics
from sparkov_data_generatio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# csslex/__init__.py
#
# tokenizer for a css file
# Based on: http://www.w3.org/TR/CSS2/syndata.html#tokenization
# ----------------------------------------------------------------
# copyright (c) 2014 - <... |
import os
from string import Template
from uuid import uuid4
from actstream import action
from django.contrib.auth import get_user_model
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.db.models.signals import post_save
from django.db.transaction import atomic
from django... |
# -*- coding: utf-8 -*-
"""Functions to call when running the function.
This module should contain a function called `run_module`, that is executed
when the module is run with `python -m MODULE_NAME`.
"""
import atexit
from datetime import datetime
import time
from typing import Dict, Any
from delphi_utils import (
... |
#!/usr/local/bin/python3
from flask import Flask, render_template, send_from_directory, request
import sys
import json
import re
import codecs
import requests
# App logic
answers = { '#cyantab': { 'solution': 'fire',
'code': 0b1000 },
'#violettab': { 'solution': 'banana',
... |
import collections
import logging
import os
from pulsar.client.util import to_base64_json
from pulsar.main import (
PULSAR_ROOT_DIR,
)
from pulsar.mesos import (
mesos_pb2,
MesosSchedulerDriver,
Scheduler,
)
from pulsar.messaging import bind_amqp
log = logging.getLogger(__name__)
DEFAULT_FRAMEWORK_... |
from collections import deque
import numpy as np
import math
import carla
from misc import get_speed
from Container import Container
class PID(object):
errorBuffer = deque(maxlen=20)
def UpdateBuffer(self,error):
if self.errorBuffer.count == self.errorBuffer.maxlen:
self.erro... |
import os
import sys
import json
import logging
import lib_util
def credentials_filename():
"""
This returns the JSON file name containing the credentials.
The logic is a bit complicated because it has to handle several environments with security constraints.
"""
# TODO: Override this logic ... |
import sys
from math import cos, exp, sin, sqrt
from .utils.util import flights, get_minutes, people
# All domains defined with a single-tuple/or without a multiplier have n-dimensional Input Domain
ackley_N2_d = [(-32, 32)]*2
schaffer_N1_d = [(-100, 100)]*2
matyas_d = [(-10, 10)]*2
griewank_d = [(-600, 600)]
sphere_... |
#!/usr/bin/env python3
import argparse
from migen import *
from litex.boards.platforms import arty
from litex.soc.cores import *
from litex.soc.integration import soc_core
from litex.soc.interconnect.csr import *
from litex.soc.cores import gpio
from litex.soc.cores.uart import UARTWishboneBridge
from litex.soc.inte... |
# coding: utf-8
import json
import os
import pretend
import pytest
from static_precompiler import compilers, exceptions, utils
def test_compile_file(monkeypatch, tmpdir):
monkeypatch.setattr("static_precompiler.settings.ROOT", tmpdir.strpath)
convert_urls = pretend.call_recorder(lambda *args: None)
monk... |
# 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... |
import os.path
import re
from uttl.buildout.command_recipe import CommandRecipe
from zc.buildout import UserError
class QtDeployRecipe(CommandRecipe):
def __init__(self, buildout, name, options):
super().__init__(buildout, name, options, executable='windeployqt.exe')
self.options.setdefault('target', 'release')... |
# coding=utf-8
import numpy as np
import scipy.sparse as sp
import json
import torch
from sklearn.preprocessing import OneHotEncoder
import sys
import os
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
current_dir = os.getcwd()
sys.path.insert(0, parent_dir)
# from GPG.util.nlp_utils import *
from s... |
from bs4 import BeautifulSoup
import json
import requests
import os.path
import logging
from sbnation_article_list_scraper import get_existing_articles_list
from collections import defaultdict
from datetime import datetime
from pprint import pformat
# create logger with 'this modules name'
logger = logging.... |
#coding: utf8
'''
Created on 2020年2月17日
'''
import os
import json
import sys
from builtins import staticmethod
sys.path.append('..')
sys.path.append('../..')
FILE_PATH = os.path.dirname(__file__) + "/patient-position"
from src.libs.database import Database
from src.data.region_recognition import REGIONS, check_city
fro... |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2019 PyMeasure Developers
#
# 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 limit... |
import csv
import sqlite3
from geslo import sifriraj_geslo
#Prebere datoteko in ustvari tabele
conn = sqlite3.connect('knjigarna.db')
with open('knjigarna.sql', encoding='utf-8') as f:
sql_ukazi = f.read()
conn.executescript(sql_ukazi)
#Prebere dtoteko in ustavi podatke v tabele
with open('podatki.sql', encodin... |
import matplotlib.pyplot as plt
import sklearn.metrics
import networkx as nx
import numpy as np
import pandas as pd
fontsize=16
minor_size=14
def get_pos(Gp):
pos = {}
for node in Gp.nodes():
r, phi, z = Gp.nodes[node]['pos'][:3]
x = r * np.cos(phi)
y = r * np.sin(phi)
pos[nod... |
from re import A
from django.shortcuts import redirect, render, get_object_or_404
from django.contrib.auth.decorators import login_required
from rest_framework import serializers
from .models import My_projects, Profile, Comments, Rates
from django.contrib.auth.models import User
from .forms import CommentForm, UpdateP... |
"""
Adapted with permission from ReportLab's DocEngine framework
"""
import os
import json
from io import StringIO
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.contrib import messages
from django.db import transaction
from d... |
from __future__ import division, print_function, unicode_literals
"""
This module tests the combinatoric generation of compositions.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2015, Correlated Materials Laboratory"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either ... |
from json import JSONDecodeError
from urllib.parse import urljoin
import requests
from django.core.urlresolvers import reverse
from django.forms.models import model_to_dict
from django.http import JsonResponse, HttpResponseBadRequest
from django.shortcuts import redirect, get_object_or_404
from django.template.default... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
基于pygame模块做的贪吃蛇小游戏
"""
import pygame
import numpy as np
import time
from pygame.locals import *
BOARD_WIDTH = 48
BOARD_HEIGHT = 28
score = 0
class Food(object):
"""食物"""
def __init__(self):
self.item = (4, 5) # 初始位置
se... |
import requests
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Float
from sqlalchemy.orm import sessionmaker
from apscheduler.schedulers.blocking import BlockingScheduler
import time
from xml.etree import ElementTree
PSKRe... |
"""
Module defines ImplicitDatabase and ImplicitTable,
where ImplicitDatabase is a conceptual model describes
a website and ImplicitTable describes an API endpoint.
"""
from io import StringIO
from json import load as jload
from json import loads as jloads
from pathlib import Path
from typing import Any, Dict, List, Na... |
import logging
from datetime import datetime, timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeas... |
import logging
import os
import subprocess
from pathlib import Path
from typing import IO, Optional, Union
import click
import numpy as np
import pandas as pd
from click.decorators import command
from edmund.entrypoint import cli
from edmund.utils import cqdm
log = logging.getLogger(__name__)
def read_vcf_header(f... |
#!/usr/bin/env python3
from pytest import approx
from klab.rosetta.log_files import LoopModelingTrajectory
def test_loop_modeling_log():
with open('loop_modeling_log.stdout') as file:
stdout = file.read()
traj = LoopModelingTrajectory.from_path('loop_modeling_log.stdout')
assert traj.scores['bui... |
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
import pytorch_lightning as pl
from pytorch_lightning import Callback
from pytorch_lightning.metrics.functional import accuracy
from pytorch_lightning import loggers as pl_loggers... |
import urllib.request
import json
import tkinter
import asyncio
import websocket
import glob
import re
import time
root = tkinter.Tk()
ESP32_IP = [192,168,1,183]
esp32_vars = [tkinter.IntVar() for i in range(4)]
[esp32_vars[i].set(ESP32_IP[i]) for i in range(4)]
ws = websocket.WebSocket(timeout=1)
ws.settimeout(1)
... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import platform
import shlex
import shutil
from collections import namedtuple
from contextlib import contextmanager
from io import open
from subprocess import Popen
from tempfile import TemporaryFile, mk... |
import torch
import time
import os
import argparse
import sys
from rescoring import rescoring
from helper import Helper
from mmcv import ProgressBar
coco_categories = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,... |
import copy
from queue import Empty
from mp_event_loop.events import Event, CacheEvent
from mp_event_loop.event_loop import EventLoop
from mp_event_loop.mp_functions import mark_task_done, LoopQueueSize, QUEUE_TIMEOUT, is_parent_process_alive
__all__ = ['run_iter_event_loop', 'IterEventLoop']
class LoopIterQueueSi... |
import argparse
import sys
import gym
import matplotlib.pyplot as plt
import numpy as np
from stable_baselines3 import A2C
from stable_baselines3.common.distributions import SquashedDiagGaussianDistribution
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.monitor import Mo... |
import json
import os
from datetime import datetime
import cactus
import dotenv
import pandas
import pytz
import requests
import twitter
# Load the .env
dotenv.load_dotenv(dotenv.find_dotenv())
STATS_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '../vaccine-stats.json'))
def current_timestamp():
... |
# -*- coding: utf-8 -*-
"""
Allow "availability" admonitions to be inserted into your documentation.
Inclusion of availabilities can be switched of by a configuration variable.
The availabilitylist directive collects all availabilities of your project
and lists them along with a backlink to the original location.
"""
... |
import unittest
import os
import sys
import string
import inflect
import imp
try:
imp.find_module('gbasm_dev')
from gbasm_dev import set_gbasm_path
set_gbasm_path()
except ImportError:
pass
from gbasm import BufferReader
from gbasm import InstructionSet, Instruction, InstructionPointer
# from gbasm.in... |
#!/usr/bin/env python
import numpy # Hint to PyInstaller
import cv2
import scipy.io
import scipy.sparse
class HistogramClassifier(object):
def __init__(self):
self.verbose = False
self.minimumSimilarityForPositiveLabel = 0.075
self._channels = range(3)
self._histSize = [256] * ... |
"""Code for computation of PLCC, SRCC and KRCC between
PIQ metrics predictions and ground truth scores from MOS databases.
"""
import argparse
import functools
from typing import List, Callable
import piq
import tqdm
import torch
import pandas as pd
from pathlib import Path
from skimage.io import imread
from scipy... |
import datetime, types, decimal
from sets import Set
from reportlab.lib.units import cm
from reportlab.lib.colors import black
from base import BAND_WIDTH, BAND_HEIGHT, Element
from utils import get_attr_value
from exceptions import AttributeNotFound
class Widget(Element):
"""A widget is a value representation o... |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
import os
import logging
import numpy as np
from PIL import Image
import math
from Utils.shortcuts import channel_last
from matplotlib import pyplot as plt
plt.switch_backend("Agg")
def make_grid(tensor,
nrow=10,
padding=2,
normalize=False,
vrange=None,
... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
import mock
from doozerlib.model import Model
from doozerlib.image import ImageMetadata
import json
from unittest import TestCase
from unittest.mock import MagicMock, patch
from doozerlib.cli import release_gen_payload as rgp
import doozerlib.runtime
def _fake_generator():
runtime = MagicMock(doozerlib.runtime)
... |
import json
import re
from six.moves import http_client
import logging
from flask import g, request
from flask_smorest import abort
from drift.core.extensions.jwt import current_user
from driftbase.models.db import CorePlayer, PlayerEvent
from driftbase.models.db import PlayerJournal
from driftbase.models.db import... |
import itertools
from time import sleep
import threading
from queue import Queue, Empty
import logging
def instruction(code, nb_inputs, as_output, can_jump=False):
def __instruction(f):
def wrapper(self, memory, pos):
assert memory[pos] % 100 == code
modes = self.get_mode(memory[p... |
import random
def readPrecalculatedDifferences() -> tuple[list, list]:
f = open(f"precalculatedDifferences.txt", "r")
differences, occurrences = f.readlines()
f.close()
differences = eval(differences)
occurrences = eval(occurrences)
return differences, occurrences
def readRawData() -> tuple[l... |
print("\n\n\n")
print("=========== WELCOME TO XYZ BLOOD DONATION BLOOD DONATION CENTER ==========")
print("\n\nThis Is A Login Portal\n\n")
print("Please follow the given instructions in order to log in")
print("\nFOR ADMIN LOGIN: PRESS 1")
print("FOR USER LOGIN : PRESS 2")
myinput = int(input())
# Donor Class conta... |
import logging
import json
import os
import time
from pathlib import Path
from threading import Thread
from typing import List, Optional
from subprocess import check_output
from watchdog.events import DirModifiedEvent, FileSystemEventHandler
from watchdog.observers import Observer
# when not testing `dy_static_file_se... |
import urllib.request
import os
import json
import bz2
import re
from dataclasses import dataclass
from typing import List
import itertools
import logging
@dataclass
class SnpInfo:
dbsnp_id: str
assembly_id: str
gen_type: str
gene_name: str
gene_abbr: str
gene_id: str
dna_change: List[str]... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
#! /usr/bin/env python
import sys
import os
import argparse
import numpy as np
import pandas as pd
import configparser
import ctdcal.process_ctd as process_ctd
import ctdcal.sbe_reader as sbe_reader
import ctdcal.convert as cnv
DEBUG = False
#File extension to use for output files (csv-formatted)
FILE_EXT = 'csv'
#F... |
import logging
import multiprocessing as mp
from copy import deepcopy
from multiprocessing.connection import Connection
from typing import Sequence
import dm_env
import gym
import jax
import jax.numpy as jnp
from bsuite.utils.gym_wrapper import DMEnvFromGym
from gym_minigrid.wrappers import *
from helx.image import gr... |
#!/usr/bin/env python2.7
import sys
import argparse
import gzip
import clsnaputil
#assumes you already have the AUCs
#pulled out using:
#wiggletools print non_unique_base_coverage.bw.auc AUC non_unique_base_coverage.bw
RECOUNT_TARGET = 40 * 1000000
SNAPTRON_FORMAT_CHR_COL = 1
SNAPTRON_FORMAT_COUNT_COL = 11
def load_... |
"""
This module contains logic for comparing output from two sql queries run on two database connections
2020-09-10 RL Created
"""
import logging
from concurrent.futures._base import as_completed
from concurrent.futures.thread import ThreadPoolExecutor
from .sql_to_xl import SqlToXl
from .compare import... |
# -*- coding: utf-8 -*-
"""
Created 2019-05-27 17:56:03
@author: <NAME>
"""
from symbtools.test import unittesthelper as uth
import unittest
import sys
import sympy as sp
from typing import Sequence
import symbtools as st
import symbtools.mpctools as mpc
import numpy as np
from IPython import embed as IPS
class ... |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, The BiPy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------------... |
# coding : utf-8
"""Auxiliary utilities for PyGeM."""
import vtk
import numpy as np
import matplotlib.pyplot as plt
def write_bounding_box(parameters, outfile, write_deformed=True):
"""
Method that writes a vtk file containing the FFD lattice. This method allows
to visualize where the FFD control points... |
import sys
import ipdb
import math
import ntpath
import random
import numpy as np
import pandas as pd
sys.path.append('..')
import argparse
from tabulate import tabulate
from core.text_analyzer import TextAnalyzer
__VALID_ASPECT_CHOICES = ('distinct', 'basic', 'pos', 'dep', 'ner', 'stopword', 'zipflaw', 'concreteness... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.