text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2020, bikbuk and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.model.document import Document
from vet_website.vet_website.doctype.vetjournalentry.vetjournalentry import new_journal_en... |
import glob
import os
import torch
from PIL import Image
from tqdm import tqdm
from ssd.config import cfg
from ssd.modeling.predictor import Predictor
from ssd.modeling.vgg_ssd import build_ssd_model
import argparse
import numpy as np
import cv2
from ssd.utils.viz import draw_bounding_boxes
from shapely.geometry impor... |
import struct
from enum import IntEnum, Enum
from typing import NamedTuple, Tuple, Union
from bleak import BleakClient
from async_property import async_property
from pyobservable import Observable
class Pose(IntEnum):
"""Supported poses."""
REST = 0x00
FIST = 0x01
WAVE_IN = 0x02
WAVE_OUT = 0x03
... |
"""
generate-legacy-users.py WIKI_PAGES_PATH
"""
from __future__ import absolute_import, print_function, division
import os
import re
import sys
import glob
from HTMLParser import HTMLParser
def main():
path = sys.argv[1]
users = {}
pages = {}
ipython_pages = [os.path.splitext(os.path.basename(fn)... |
"""
This module exports types and functions used for ``SELECT`` queries.
Main purpose is providing a type which contains information of selecting columns,
i.e. which columns are selected and how they are expressed in the query.
Using the same instance of the type in both of query genration and reading results ena... |
import pygame
from pygame.math import Vector2 as V2
from PyWorld2D.gui.parameters import RMOUSE_COLOR
##DELTA_STATIC_OBJECTS = [(1,0),(-1,0),(0,-1),(0,1),(0,0),
## (1,1), (-1,1), (1,-1), (-1,-1)]
DELTA_STATIC_OBJECTS = [(1,0),(-1,0),(0,-1),(0,1),(0,0)]
class Camera:
def __init__(self):
... |
""" Implementation of AtlasNet [1] with differential geometry properties based
regularizers [2] for point-cloud auto-encoding task on ShapeNet.
[1] <NAME> et al. AtlasNet: A Papier-Mâché Approach to Learning 3D
Surface Generation. CVPR 2018.
[2] <NAME> et al. Shape Reconstruction by Learning Differentiable Sur... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
import datetime
import time
import unittest
from django.db.models import Q
from django.test import TestCase
import pytz
from vesper.django.app.models import (
AnnotationInfo, Clip, Device, DeviceModel, Recording, Station,
StationDevice, StringAnnotation)
import vesper.django.app.model_utils as model_utils
imp... |
# Dependencies
from torchvision import transforms
from torchvision.datasets import MNIST
from torch.utils.data import DataLoader
import torch
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from time import time
import glob
import ast
import librosa
import os
from ess... |
import re
import nbformat
import nbconvert
## TODOs:
### pass AssignmentNumber as argument to this python program
### later add CourseID, CourseName and Course Instance as additional args
def addCourseDetails(NB, CourseID='1MS926', CourseName='Applied Statistics',
CourseInstance='Spring 2019... |
"""Tensor classes and utilities used for cross-mesh resharding."""
from collections.abc import Iterable
from dataclasses import dataclass
from typing import List, Any
import numpy as np
from jax.interpreters import pxla
from jax.interpreters.pxla import Replicated, ShardingSpec
from alpa.device_mesh import VirtualPhy... |
#!/usr/bin/env python3
"""===============================================================================
FILE: heartbeat_habits.py
USAGE: (not intended to be directly executed)
DESCRIPTION:
OPTIONS: ---
REQUIREMENTS: ---
BUGS: ---
NOTES: ---
AUTHOR: <NAME> (<EMAIL>)
ORGANI... |
# coding=utf-8
# Copyleft 2019 project LXRT.
import sys
import os
sys.path.append(os.getcwd() + '/src/')
import json
import collections
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.utils.data.dataloader import DataLoader
from finetune_param import args
from tasks.rank_model im... |
# Created by cc215 at 02/05/19
# Modified by cc215 at 11/12/19
# This code is for testing basic segmentation networks
# Steps:
# 1. get the segmentation network and the path of checkpoint
# 2. fetch images tuples from the disk to test the segmentation
# 3. get the prediction result
# 4. update the metric
# 5. sav... |
from torch import zeros, ones, zeros_like, ones_like, randn
from torch import matmul, sigmoid, tanh, relu, exp
from torch import Tensor, stack ; import random
max_prop_time = 55
def create_networks(network_structs, vector_size, storage_size, hm_vectors):
return (create_enc_network(n... |
import arrow
import logging
#This function takes a gcal service, a list of calendars, and a dateTime range and returns
# a list of all events from the list of calendars that fall within or overlap that dateTime range
def getEventsFromAllCalendars(gcal_service, calendars, begin, begin_time, end, end_time):
b_hrs, b... |
from mcnp_input_reader import MCNPCells, MCNPCell, MCNPSurfs, MCNPSurf, MCNPMaterial, MCNPMaterials, MCNPTransformation, MCNPTransformations
import re
import multiprocessing
import itertools
# import time
cell_pattern = re.compile(r'^\d')
# surface_pattern = re.compile(r'^(\*)?\d+')
transformation_pattern = re.compile... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# 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 res... |
import tensorflow as tf
import numpy as np
import time
import os
def pick_top_n(preds, vocab_size, top_n=5):
p = np.squeeze(preds)
# 将除了top_n个预测值的位置都置为0
p[np.argsort(p)[:-top_n]] = 0
# 归一化概率
p = p / np.sum(p)
# 随机选取一个字符
c = np.random.choice(vocab_size, 1, p=p)[0]
return c
# class pre... |
#!env/bin/python
import abc # abstract base class
import numpy as np
from overrides import overrides
def rescale(x, from_lo, from_hi, to_lo, to_hi):
# y = yi + (yf-yi)/(xf-xi)*(x-xi)
y = to_lo + (to_hi-to_lo)/(from_hi-from_lo)*(x-from_lo)
return y
class Scatter:
def __init__(self, x_domain=[-np.inf... |
from __future__ import absolute_import, division, print_function
import os
import copy
import itertools
import math
import numpy as np
import matplotlib.pyplot as plt
from vivarium.compartment.composition import (
load_compartment,
simulate_compartment,
simulate_with_environment)
# composites
from vivar... |
#encoding: utf-8
'''
Various utilities for using the ISLE dictionary with praat textgrids
see
**examples/alignment_example.py**
**examples/syllabify_textgrid.py**
'''
from pysle import pronunciationtools
from pysle import isletool
class OptionalFeatureError(ImportError):
def __str__(self):
return "ERR... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
from collections import OrderedDict
import logging
import os
from typing import Union, Optional, Collection
import numpy a... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 12:05:08 2017
@author: daniele
"""
import scipy.ndimage
from joblib import Parallel, delayed
import multiprocessing
import numpy as np
from modules.data_loading import load_training_data, load_training_labels
from modules.neural_network import ov... |
"""
python GPU version of c-csn algorithm
https://github.com/LinLi-0909/c-CSN
"""
import os, argparse, pandas as pd, numpy as np
from scipy import sparse, stats
import sys
sys.path.append('.')
import useful_functions as uf
from numba import cuda #for GPU
from numba import jit #for CPU
def condition_g(adjmc, kk=... |
import tensorflow as tf
import cv2
import numpy as np
import datetime
from skimage.segmentation import clear_border
try:
import cvtools as tt
except:
tt=None
try:
import sud_model as sm
except:
sm=None
try:
import OCR as ocr
except:
ocr=None
try:
import sudoku as sd
except... |
#!/usr/bin/env python
# Copyright 2017 <NAME>
#
# Licensed under the modified BSD (3-clause BSD) License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... |
import cv2 as cv
import numpy as np
import time
def surf_image_match(left_image, right_image):
gray_left_image = cv.cvtColor(left_image, cv.COLOR_BGR2GRAY)
gray_right_image = cv.cvtColor(right_image, cv.COLOR_BGR2GRAY)
gpu_gray_left_image = cv.cuda_GpuMat(gray_left_image)
gpu_gray_right_image = cv.cud... |
from tesstlog import Log
logger = Log.init_log(__name__, False)
import torch
import numpy as np
import torchvision
import torchvision.transforms as transforms
import time
import sys
from matplotlib import pyplot as plt
import colorful.colorful as cf
import random
import torch.utils.data as Data
import torch.nn as nn
f... |
import urllib.request
import base64
import time
from miflora.miflora_poller import MiFloraPoller, \
MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY
# Settings for the domoticz server
# Forum see: http://domoticz.com/forum/viewtopic.php?f=56&t=13306&hilit=mi+flora&start=20#p105255
domoticzserve... |
#Right now designed to be one driver for each thermostat. (Could be one driver for every thermostat if we want)
#for some reason in BaseRegister class, the python class for everything is set to int. Reg_types are bit or byte
import requests
import xmltodict
import datetime
import gevent
import grequests
import logging
... |
#!/usr/bin/env python
""" Copyright (C) 2018 github.com/volskaya
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 use, copy, modify,... |
import gzip
import numpy as np
import math
import time
import pandas as pd
start = time.time()
total_class = 10
cols = 28
rows = 28
total_px = cols * rows
dt = np.dtype(np.uint8).newbyteorder(">")
def loadMNIST(data_file, label_file):
f_ti = open(data_file, "rb")
f_tl = open(label_file, "rb")
_ = f_ti.... |
import torch
import torch.nn.functional as F
import numpy as np
def _format_weight(weight, shape, device):
if isinstance(weight, np.ndarray):
return torch.Tensor(weight).to(device)
elif isinstance(weight, torch.Tensor):
return weight.to(device)
elif isinstance(weight, (int, float)):
... |
import torch
from math import sqrt
from functools import reduce
from torch.optim.sgd import SGD
import logging
log = logging.getLogger(__name__)
# from https://github.com/scipy/scipy/blob/master/scipy/optimize/linesearch.py
def _scalar_search_armijo(phi, phi0, derphi0, args=(), c1=1e-4, alpha0=1, amin=1.0e-8):
"""... |
"""
Utils functions.
"""
import numpy as np
from glob import glob
import re
import pandas as pd
import seaborn as sns
from pylab import plt
from pyriemann.utils.covariance import _lwf
from numpy import ones, kron, mean, eye, hstack, dot, tile
from scipy.linalg import pinv
from sklearn.metrics import confusion_matrix... |
import numpy as np
import torch
from torch.autograd import Variable
from torch.utils.data import DataLoader
import time
import os
import matplotlib.pyplot as plt
import pickle
import json
from enn import enn, enrml, lamuda
from net import netLSTM_withbn
from data import TextDataset
from configuration import... |
import numpy as np
G = 4.32275e-3 # (km/s)^2 pc/Msun
G_pc = G*1.05026504e-27 # (pc/s)^2 pc/Msun
from scipy.interpolate import interp1d, InterpolatedUnivariateSpline
from scipy.integrate import quad
from abc import ABC, abstractmethod, abstractproperty
#def SampleAMC(n_samples):
def P_delta(delta):
#T... |
import os
import cv2
import random
import numpy as np
from PIL import Image
from glob import glob
import matplotlib.pyplot as plt
from torch.utils.data import IterableDataset, DataLoader
# Ref.: https://github.com/yjn870/ESPCN-pytorch/blob/ab84ee1bccb2978f2f9b88f9e0315d9be12c099e/prepare.py#L16
# Train Dataset Class
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import collections
import logging
import argparse
import numpy as np
from layers import *
from tools import config_setting
def weightedsum(input_tensor):
x = input_tensor[0]
a = input_tensor[1]
a = torch.unsquee... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import beanmachine.ppl as bm
from beanmachine.ppl.compiler.gen_bmg_cpp import to_bmg_cpp
from beanmachine.ppl.compiler.gen_... |
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import torch.nn.functional as F
import os
import torch
import numpy as np
def normalize_transform():
return transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
def trai... |
import random
import numpy as np
from math import ceil
from math import factorial
random.seed()
#functions to access useful parameters of a weighted tree
def leftSubtree(tree):
children = tree[0]
return children[0]
def rightSubtree(tree):
children = tree[0]
return children[1]
def children(tree):
... |
# -*- coding: utf-8 -*-
"""
Copyright 2016 University of Freiburg
<NAME> <<EMAIL>>
This file contains the main function for the similarity search for sounds.
To perform a search you need to call similarsounds.py from the terminal.
Given a soundbase and a query the program will return a list
of most similar sounds to ... |
# Refresher script to get familiar with the code-base API
import matplotlib as mpl
mpl.use('Agg')
import os
import numpy as np
import pandas as pd
import joblib
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
import ep_clustering as ep
from tqdm import tqdm # Progress Bar
# Make Paths to output/figur... |
import datetime
import pandas as pd
import logging
from san.extras.strategy.prices import Prices
from pandas.api.types import is_datetime64_any_dtype as is_datetime
from san.extras.utils import str_to_ts
def prepare_df(source_df: pd.DataFrame):
'''
DF can be provided to the object with dt index or dt column
... |
"""
Exercise: Simulation of a Vestibular Implant
Authors: <NAME>, <NAME>, <NAME>
Version: 6
Date: 09.06.2019
Naming convention in this file:
Rotation matricies start with R
quaternions start with q
R_a_b is rotation from coordinates a to coordinates b
name_a is a vector in coordinates a
ap... |
from numba.core.typing.templates import ConcreteTemplate
from numba.core import types, typing, funcdesc, config, compiler
from numba.core.compiler import (CompilerBase, DefaultPassBuilder,
compile_result, Flags, Option)
from numba.core.compiler_lock import global_compiler_lock
from numb... |
# -*- coding: utf-8 -*-
"""
@author: wi-ith
"""
import numpy as np
import tensorflow as tf
import flags
FLAGS = tf.app.flags.FLAGS
def one_image_validation(GT_loc,
GT_cls,
loc_pred,
cls_pred,
num_objects):
GT_loc=np... |
from __future__ import print_function
import logging
import spacy
from os import path
from typing import List
from srl_nlp.logical_representation.fol import FOL
from srl_nlp.logical_representation.logicalform import LF
from srl_nlp.stanford_parser.parser import Parser as StanfordParser
# import sys
# if sys.version_i... |
# Copyright (c) 2015 Mirantis 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 writ... |
from __future__ import absolute_import
import six
import re
import logging
from datetime import datetime
from uuid import uuid4
from clims import utils
from clims.models.substance import Substance, SubstanceVersion
from clims.models.extensible import ExtensibleProperty
from clims.models.location import SubstanceLocat... |
import sys
import random
from game import utilites
def action_handler(game_manager, player, action):
world = game_manager.world
character = player #FIX THIS THIS IS WRONG
feed = game_manager.iofeed
action = action.lower()
action = action.split(' ')
if action[0] == "attack":
attack... |
# 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... |
import time
import tensorflow as tf
from six.moves import cPickle as pickle
import numpy as np
import matplotlib.pyplot as plt
import skimage.transform as skt
import skimage.io as io
from skimage import exposure, img_as_float, img_as_uint
import os
"""
References and code snippets from:
Tensorflow manual: https://www.... |
from PySide import QtCore, QtGui
from colors import Colors
from demoitem import DemoItem
from demoitemanimation import DemoItemAnimation
from demotextitem import DemoTextItem
from scanitem import ScanItem
class ButtonBackground(DemoItem):
def __init__(self, type, highlighted, pressed, logicalSize, scene, parent)... |
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
import iwaves.utils.isw as kdv
#from iwaves.kdv.kdv import KdV
from iwaves.kdv.kdvimex import KdVImEx as KdV
from iwaves.kdv.vkdv import vKdV as KdV
import pdb
# In[2]:
###########
# Stratification and wave functions
def ideal_rho(z, drho, dp, L):
... |
import collections
import itertools
import numpy as np
from qecsim import paulitools as pt
import matplotlib.pyplot as plt
import qecsim
from qecsim import app
from qecsim.models.generic import PhaseFlipErrorModel,DepolarizingErrorModel,BiasedDepolarizingErrorModel
#from qecsim.models.planar import PlanarCode, PlanarMP... |
#!/usr/bin/env python
#This is the loquis reference interpreter
import inspect
from collections import namedtuple
import os,os.path
from functools import partial
import importlib
from platform import system as sysname
platform=sysname()
platform_type=None
if(platform in ['Linux','Windows','FreeBSD','MacOS']):
platfo... |
# -*- encoding: utf-8 -*-
from __future__ import print_function, unicode_literals, division
import logging
from enocean.protocol import crc8
from enocean.protocol.eep import EEP
from enocean.protocol.constants import PACKET, RORG, PARSE_RESULT, DB0, DB2, DB3
logger = logging.getLogger('enocean.protocol.packet')
eep =... |
# -*- coding: utf-8 -*-
__all__ = ["atomstogrid",
"mark_cavities",
"cavity_triangles",
"cavity_intersections"]
import numpy as np
import itertools
import sys
from math import ceil
from gr3 import triangulate
dimension = 3
dimensions = range(dimension)
def atomstogrid(grid,
... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Turn-Taking Measurement Tools v0.91
#
# lineplot.py
#
# By <NAME> 16 November 2012
#
# Reference:
# <NAME>., <NAME>., <NAME>., and <NAME>. (2012).
# A simple metric for turn-taking in emergent communication.
# Adaptive Behavior, 20(2)... |
import subprocess
import pipreqs
import boto3
import yaml
import sys
import os
import json
from pathlib import Path
lambda_client = boto3.client('lambda', 'ap-northeast-2')
iam_client = boto3.client('iam')
api_client = boto3.client('apigatewayv2', 'ap-northeast-2')
event_client = boto3.client('events', 'ap-northeast-2... |
# -*- coding: utf-8 -*-
"""
IO test cases that apply to both etree and ElementTree
"""
import unittest
import tempfile, gzip, os, os.path, sys, gc, shutil
this_dir = os.path.dirname(__file__)
if this_dir not in sys.path:
sys.path.insert(0, this_dir) # needed for Py3
from common_imports import etree, ElementTree... |
from inspect import CO_GENERATOR
import numpy as np
from matplotlib import patches, text, lines
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import pandas as pd
import math
class Visualizer(object):
"""The visualizer object stores parameters and methods for generating an
anim... |
#- Python 3 source code
#- barplot-spatial-blocking-by-month.py ~~
#
# This program creates a barplot by month that shows the spatial-only
# blocking probability, separated into two categories: "Blocked by CSC108"
# and "Unexplained". The reason that this is useful is because it illustrates
# the difference ... |
"""Command line interface for qmap"""
import logging
import os
import sys
from datetime import datetime
from os import path
import click
from qmap import executor, template as mtemplate
from qmap.job import JobParameters
from qmap.job import status
from qmap.manager import Submitted, Reattached
from qmap.profile imp... |
import random
import open3d as o3d
import numpy as np
import time
from tqdm import tqdm
import thortils.vision.projection as pj
import thortils as tt
from thortils.vision import thor_rgbd
from thortils import constants
from thortils.utils.math import sep_spatial_sample, remap, euclidean_dist
from thortils.grid_map i... |
import copy
import logging
from typing import Iterable, Tuple
import discord
from discord.ext import commands
from kaztron import KazCog
from kaztron.utils.checks import mod_only, admin_only
from kaztron.utils.discord import get_named_role, get_group_help
from kaztron.utils.logging import message_log_str
logger = lo... |
import datetime
import numpy as np
import pandas as pd
from .calculate_perc_missing import calculate_perc_missing
def build_summary(df, performance_start_time):
# Not yet implimented
# Expectancy [%] 6.92
# SQN 1.77
# Sortino Ratio ... |
import tensorflow as tf
tf.set_random_seed(777) # reproducibility
def conv2d(x, f=64, k=4, s=2, reuse=False, act=None, pad='SAME', name='conv2d'):
"""
:param x: input
:param f: filters, default 64
:param k: kernel size, default 3
:param s: strides, default 2
:param reuse: param re-usability... |
from aiohttp import web
import aiohttp_cors
import asyncio
import numpy as np
import optparse
import traceback
import glob, os
import re
from PIL import Image
from PIL import ImageOps
import soundfile as sf
from App import App
import base64
import math
import psycopg2
import struct, json
from io import BytesIO
import o... |
import enum, io, os, re
from collections import namedtuple, OrderedDict
from types import SimpleNamespace
from typing import Any, Dict, Iterable, Iterator, List, Match, NoReturn, Optional, Pattern, Tuple, Union
# from mjotool._util import Fore as F, Style as S
# S2 = SimpleNamespace(RESET_ALL='\x1b[0m', BRIGHT='\x... |
import os
import telebot
from flask import Flask, request
from pony.orm import db_session, commit, TransactionIntegrityError, select, count
from pony.flask import Pony
from models import Task, Chat, db
from services import imgur_client, generate_qr, decode_qr, text_to_speech
from io import BytesIO
from telebot.apihel... |
from celery import current_app
from django.contrib.auth.models import AbstractUser, Group
from django.contrib.auth.validators import ASCIIUsernameValidator
from django.db import models
from django.utils.datetime_safe import datetime
from django_countries.fields import CountryField
from guardian.shortcuts import assign_... |
#!/usr/bin/env python
# _*_ coding: UTF-8 _*_
import argparse
import codecs
import json
import os
from tqdm import tqdm
def text2lines(textpath, lines_content=None):
"""
read lines from text or write lines to txt
:param textpath: filepath of text
:param lines_content: list of lines or None, None mean... |
import sys
from comet_ml import Experiment
from sklearn.metrics import classification_report
from datetime import datetime
from typing import Dict
import pandas as pd
import pickle
import json
import os
import module_results
#_____________________________________________________________________________________________... |
# -*- coding:utf-8 -*-
#
# Author : 寒江雪
# E-mail :
# Date : 19/10/10 00:03:44
# Desc :
#
"""
Dependencies:
tensorflow r1.14
pygame 1.9.4
"""
from __future__ import print_function
import tensorflow as tf
import cv2
import sys
sys.path.append("game/")
import wrapped_flappy_bird as game
import random
... |
from . import *
class User(O.Model):
id = Id()
username = Text()
@classmethod
def relations(cls):
cls.posts = Has('many', Post, on_other_col="author_id")
class Post(O.Model):
id = Id()
text = Text()
author_id = Integer()
@classmethod
def relations(cls):
cls.author... |
from abc import ABC
from datetime import datetime, timedelta
from os import sync
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional
import requests
from airbyte_cdk.sources.streams.core import IncrementalMixin, SyncMode, package_name_from_class
from airbyte_cdk.sources.streams.http import HttpSt... |
# -*- coding: utf8 -*-
import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
import sys, traceback
import json
from cogs.utils import helper_functions as hf
from datetime import datetime, timedelta
from pytz import reference
import os
dir_path = os.path.d... |
import random
import aiohttp
import discord
import asyncio
import secrets
from discord.ext import commands
from cogs.utils import utilities as utils
from typing import Union
class Fun(commands.Cog, name="Fun"):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def pizza(self, c... |
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import ValidationError
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.forms.widgets import Select
from django.utils.encoding import force_text
from d... |
"""
Usage:
quicklook.py <path> <year> <month> <day> [<resolution>] [<grid>] [<output_path>]
quicklook.py (-h | --help)
Arguments:
<path>
<year>
<month>
<day>
<resolution>
<grid>
<output_path>
Options:
-h --help
Show this screen.
"""
import datetime
import matplotlib.p... |
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time as t
from astropy.coordinates import SkyCoord
import astropy.units as u
import src.orbit_fitting.orbfit_management as om
# import src.utils as utils
import multiprocessing as mp
from src.others.utils import load_data
... |
from __future__ import annotations
from collections import OrderedDict
import copy
from enum import Enum
from typing import Any, Dict, List, Optional, Tuple, Union
import warnings
import yaml
class ConfigEnum(Enum):
"""Enumerate for configuration data that can be created from a string."""
@classmethod
d... |
""""
Base API Classes
"""
from __future__ import annotations
import functools
from abc import ABC, abstractmethod
from typing import Any
from dataclass_wizard.abstractions import W
from requests import Session, RequestException
from .constants import WISTIA_API_TOKEN
from .log import LOG
from .models import Containe... |
## ###
# IP: GHIDRA
#
# 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... |
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine, QQmlListProperty, qmlRegisterType, QQmlComponent
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QUrl, pyqtProperty, QTimer
from PyQt5.QtQuick import QQuickView
from PyQt5.Qt import QMetaObject
from PyQt5.QtWidgets import QMe... |
from rich.console import Console
from dbt_coves.tasks.base import BaseConfiguredTask
from dbt_coves.tasks.generate import sources
from dbt_coves.utils import shell
from dbt_coves.utils.airbyte_api import AirbyteApiCaller
from pathlib import Path
import requests, json, os, subprocess, pathlib
from typing import Dict
f... |
import requests, random, selenium, bs4, time, openpyxl, datetime
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from openpy... |
#!/usr/bin/python
import getopt
import sys
import json
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
# Load settings from settings.py
try:
import settings
except ImportError as e:
sys.stderr.write("No settings.py file found, will use default values.\n")
def... |
import numpy as np
import matplotlib.pyplot as plt
import sympy
from sympy.parsing.sympy_parser import parse_expr
from matplotlib.ticker import MultipleLocator
def prettify_fn(fn_string, lsubs=None, simplify=False):
"""
Prepare function for Latex with optional simplification and substitutions.
Args:
... |
import asyncio
import hashlib
import json
import random
import time
import typing
from abc import ABC
from collections import OrderedDict
from html.parser import HTMLParser
from io import StringIO
import aiohttp
from aiocodeforces.blog_entry import BlogEntry
from aiocodeforces.comment import Comment
from aiocodeforce... |
"""
This module contains all ABC classes and exceptions needed to create and manage
a Remote Data Adapter.
"""
from abc import ABCMeta, abstractmethod
__all__ = ['DataProvider', 'ItemEventListener', 'DataError',
'DataProviderError', 'SubscribeError', 'FailureError']
class DataProvider(metaclass=ABCMeta):
... |
import time
import subprocess
import sys
from oslo_log import log as logging
from networking_tn._i18n import _, _LE
from networking_tn.tnosclient import tnos_driver as tn_drv
from networking_tn.ovsctl import ovsctl
from networking_tn.common import config
from networking_tn.tnosclient import templates
from networking_... |
import geopandas as gpd
import numpy as np
import pandas as pd
from shapely.ops import cascaded_union
import os
#This script splits the global basins (in total: 57025) following the Pfafstetter rules until all basins are under 5000 km2
#<NAME>, October 2019
def trace_upstream_id(COMID,riv):
#function to trace the... |
import os, random, string
from datetime import datetime
from flask import Blueprint, render_template, flash, request, redirect, url_for, current_app, send_file
from flask.ext.login import login_required, current_user
from werkzeug import secure_filename
from sqlalchemy import desc, func
from geoalchemy2 import Geom... |
# Importing necessary modules
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
import os
# pycryptodome documentation: https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html
# Asymmetric Cryptography Tutorial: https://medium.com/@ashiqgiga07/asymmetric-cryptography-with-python-5eed8677... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.