text stringlengths 3.07k 22.1k |
|---|
import os
import math
import numpy as np
import astropy.io.fits as fits
from .base import interpolate_data, interpolate_param
from ..parameter.metal import feh_to_z
class _Geneva(object):
'''Geneva stellar evolution tracks and isochrones.
.. csv-table:: Structure of Geneva track file
:header: Key, Ty... |
import glob
import os
import re
from string import Template
import socket
import fcntl
import struct
import ipaddress
from pygluu.containerlib import get_manager
from pygluu.containerlib.persistence import render_hybrid_properties
from pygluu.containerlib.persistence import render_couchbase_properties
from pygluu.cont... |
'''
base object for a single instance. handles all file/io for a single instance. logic reported to it is through the LogicManager and the DistributionManager. which are handled wy the Manager
__ __
/ \ ^ / \
\ / | \ /
| . | . |
\__A__/
\|. / | \ .|/
\+<| | |>+/
\ /|\ ... |
from threading import Thread, Timer, Event
import sublime_plugin
import sublime
import copy
import time
from .SoftwareHttp import *
from .SoftwareUtil import *
from ..Software import *
from .MusicPlaylistProvider import *
from .SoftwareMusic import *
# ACTIVE_DEVICE = {}
computer_device = {}
def checkSpotifyUser()... |
# config.py
#
# Copyright 2017 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notic... |
#!/usr/bin/env python3
from Bio import SeqIO
from frippa import formatters
class Cluster:
"""Stores proteins in a RiPP cluster, DUF3328 hits, precursor peptide.
Parameters:
_proteins (list): Protein objects in this cluster.
duf (list): Indices in proteins of elements with DUF3328 hits.
... |
# %%
# import the libraries and resources
import cv2 # computer vision library
import helpers # helper functions
import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg # for loading in images
# Image data directories
IMAGE_DIR_TRAINING = "traffic_light_images/training/"
IMA... |
import numpy as np
from numpy import linalg
import time
import sys
import math
import cmath
global pi
pi = np.pi
global sin
sin = np.sin
global cos
cos = np.cos
global asin
asin = np.arcsin
global acos
acos = np.arccos
global atan2
atan2 = np.arctan2
def asind(x):
temp_theta = asin(x.real)
return np.mul... |
import requests
import uuid
import time
import re
from bs4 import BeautifulSoup
_HOST_URL = "www.amazon.com"
_HTML_PARSER = "html.parser"
################## USER-AGENT HEADERS ##################
_DEFAULT = 'Mozilla/5.0 (Linux; Android 7.0; \
SM-A520F Build/NRD90M; wv) AppleWebKit/537.36 \
(KHTML, like Gecko) Versio... |
# Copyright 2021 <NAME>. 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 applicable law or agree... |
# Copyright (c) ZenML GmbH 2021. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
import os, sys
import argparse
import pickle
import math
from efficientnet_pytorch import EfficientNet
import torch.optim as optim
from torch.optim import lr_scheduler
import tim... |
#!/usr/bin/env python3
import pyrebase
config = {
"apiKey": "AIzaSyByA7celafHSloxdOLA7_s-D097Ld10Jus",
"authDomain": "firepack-66e50.firebaseapp.com",
"databaseURL": "https://firepack-66e50.firebaseio.com",
"projectId": "firepack-66e50",
"storageBucket": "firepack-66e50.appspot.com"
}
firebase = pyrebase.i... |
# tools to ease plotting
# first, adjust params in matplotlib
import matplotlib
matplotlib.use('Agg')
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rcParams['axes.linewidth'] = 0.1
matplotlib.rcParams['xtick.labelsize'] = 4
matplotlib.rcParams['xtick.major.width'] = 0.1
ma... |
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
import json
from taskmanager_app.models import *
from django.core.serializers.json import DjangoJSONEncoder
from django.conf import settings
import datetime
from django.utils.timezone import utc
from django.db.models import Q... |
# -----------------------------------------------------------
# This script provides functions for adding additional
# information to OSM street graph.
#
#
# <NAME>, 2020 ETH Zuerich
# email: <EMAIL>
# -----------------------------------------------------------
import numpy as np
import math
import geopandas as gpd
im... |
import argparse
import json
from queue import deque
import numpy as np
import tensorflow as tf
from keras.preprocessing.image import ImageDataGenerator
from resnet.model import ResNet
from resnet.tool import load_data
parser = argparse.ArgumentParser(description="CIFAR-10 Classification with Deep Residual Neural Netw... |
# MIT License
#
# Copyright (c) 2019 <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 restriction, including without limitation the rights
# to use, copy, modify, merge, publi... |
'''
camera extrinsics visualization tools
modified from https://github.com/opencv/opencv/blob/master/samples/python/camera_calibration_show_extrinsics.py
'''
from utils.print_fn import log
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
from numpy import linspace
... |
"""
Removed all actions_env from mpe environments
"""
import time
import numpy as np
import torch
from onpolicy.runner.shared.base_runner import Runner
import wandb
import imageio
def _t2n(x):
return x.detach().cpu().numpy()
class FootballRunner(Runner):
"""Runner class to perform training, evaluation. and ... |
from logging import getLogger
from rester.http import HttpClient
from rester.struct import DictWrapper
from testfixtures import log_capture
from rester.aws import AWSLogin
import collections
import re
import traceback
from rester.report import ResultReport
import json
Failure = collections.namedtuple("Failure", "error... |
"""
These methods are used for grouping CoMetGeNe trails by reactions.
Version: 1.0 (May 2018)
License: MIT
Author: <NAME> (<EMAIL>)
"""
import sys
import numpy as np
from NeighborhoodResolver import NeighborhoodResolver
from ..definitions import PICKLE_GEN
from trail_grouping_utils import get_species_object
from t... |
import os
import numpy as np
import ecogdata.filt.time as ft
import ecogdata.util as ut
from ecogdata.datastore import load_bunch, save_bunch
from ecogdata.trigger_fun import process_trigger
import ecogdata.parallel.sharedmem as shm
from ecogdata.parallel.mproc import parallel_controller
from ecogdata.parallel.split_me... |
from __future__ import print_function
import sys
import socket
import time
import pickle
from time import sleep
import sqlite3
import json
import hashlib
from concurrent.futures import ThreadPoolExecutor
from bisect import bisect_left
from time import sleep
from random import uniform
class RSA:
@classmethod
def gcd(... |
from time import sleep
from random import random
# Installed dependencies
from pynput.keyboard import Listener, Key
import colorama
# Misc
from utils import flush_input, clear_term
from tetris import shapes
SHAPE_LIST = (
shapes.IShape,
shapes.JShape,
shapes.LShape,
shapes.OShape,
shapes.SShape,
... |
import logging
import sys
from typing import List
def create_module_logger(mn):
ml = logging.getLogger(mn)
ml.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(
"%(asctime)s - {%(name)s} - "
"{%(filename)s:%(funcName)s:%(lineno)d} - "
... |
import os
import sys
import time
import numpy as np
from urllib.request import urlretrieve
from urllib.error import HTTPError
from urllib.error import URLError
def get_file(fname,
origin,
cache_dir=None):
"""A function to download file from url.
Heritage from keras.utils
"""
... |
# -*- coding: utf-8 -*-
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples, silhouette_score
# import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm as cm
# from matplotlib.ticker import FixedLocator, FixedFormatter
import numpy as np
fr... |
import streamlit as st
import pandas as pd
import numpy as np
from scipy import spatial
import plotly.graph_objects as go
from pathlib import Path
import platform
############
### PATH ###
############
if platform.system() == 'Darwin':
main_path = Path(".")
logo_path = Path(".")
else:
main_path = Path("RI... |
from datetime import datetime, timedelta
from app.models.sampling import (Station, DHT, Temperature, Pressure,
HeatIndex, DS18B20, FC37, TEMT6000, BME280,
Wind, get_samples_for_day, add_new_sample,
find_temperature, find_... |
"""
ModelTree.py (author: <NAME> / git: ankonzoid)
"""
import numpy as np
from copy import deepcopy
from graphviz import Digraph
class ModelTree(object):
def __init__(self, model, max_depth=5, min_samples_leaf=10,
search_type="greedy", n_search_grid=100):
self.model = model
s... |
import numpy as np
import sklearn.metrics.pairwise as pw
import matplotlib.pyplot as plt
import random
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
--- CALCULATION OF LEAVE-PAIR-OUT FOLDS ---
DESCRIPTION:
- This function will produce fold set for leave-pair-out cross-va... |
# -*- encoding: utf-8 -*-
"""
HTTP Processing Library
Author: <NAME> (matt [at] themattharris dot com)
Version: 0.2
Updated: 20 Sep 2009
License: MIT License (included file MIT-LICENSE)
"""
import urllib
import urllib2
import urlparse
import gzip
from StringIO import StringIO
import logging
# Who are we
USER_AGENT... |
import sys
import os
import unittest
import shutil
from io import StringIO
sys.path.append(".")
from mock_gff3 import Create_generator
from mock_helper import extract_info, read_dict, gen_file
import annogesiclib.combine_gff as c_gff
class Mock_Gff_parser(object):
def __init__(self):
self.example = Exampl... |
'''
Created on Aug 22, 2014
@author: sdc50
'''
import unittest
from condorpy import Job
from condorpy import Templates
import os
import shutil
from collections import OrderedDict
def load_tests(loader, tests, pattern):
return unittest.TestLoader().loadTestsFromTestCase(TestJob)
class TestJob(unittest.TestCase):... |
import numpy as np
import re
import sys
sys.path.insert(0, "../lib")
from fmisims import patch_string
import tables as tb
from matplotlib.mlab import find
from numpy.lib.recfunctions import append_fields
### utilities to load a data file produced by this framework
class value_range:
def __init__(self, low=0, up=0... |
import os
import sys
import re
import shutil
from collections import deque
PARSE_FILE = 0
EXTERNAL_FILE = 1
ALREADY_SCANNED = 2
CPP_SRC_FILE_EXT = set([ ".cpp" , ".c" , ".cxx", ".cc"])
CPP_HEADER_FILE_EXT = set([".hpp" , ".h" , ".hxx" , ".hh" , ".inl"])
INCLUDE_FILE_MATCHER = re.compile(r'#include\s*[... |
import numpy as np
import numpy.linalg as la
import math
import random
# Ellipse: Ax^2+Bxy+Cy^2+Dx+Ey+F=0
def fitEllipse(x,y):
x = x[:,np.newaxis]
y = y[:,np.newaxis]
# design matrix
D = np.hstack((x*x, x*y, y*y, x, y, np.ones_like(x)))
print(D)
# scatter matrix
S = np.dot(D.T,D)
# ... |
from settings import *
from sklearn.preprocessing import MinMaxScaler
import math
from collections import Counter
import pandas as pd
import numpy as np
import re
from urllib.parse import parse_qs
import ast
import multiprocessing
import time
from alive_progress import alive_bar
class Preprocessing:
def __init_... |
import discord
from discord import Guild, Embed, Color, TextChannel, NotFound, Forbidden, Role, Member, Message, utils
from discord.ext import commands
from discord.ext.commands import Context as CommandContext, Group
from discord.raw_models import RawReactionActionEvent
import re
from database import *
class TicketC... |
from __future__ import annotations
import json
import pathlib
import shutil
import tempfile
import typing
import click
from cryptography.fernet import Fernet
from ruamel.yaml.nodes import ScalarNode
from .yaml import BaseYAML, KonvertType
if typing.TYPE_CHECKING:
from ruamel.yaml.constructor import Constructor
... |
from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance
try:
import accimage
except ImportError:
accimage = None
import numpy as np
import numbers
import types
import collections
import warnings
from torchvision.transforms import Scale, CenterCrop, Ra... |
"""Submodule for the `LogicalRegister` class."""
from ..config import MetadataConfig
from ..utils import doc_enumerate
from .mixins import Named, Unique, Accessed
from .block import Block
def _enumerate_fields(fields):
"""Enumerates fields using their mnemonics, for use in error messages and
generated documen... |
import copy
from abc import ABC, abstractmethod
import threading
import multiprocessing
from typing import List
import merlin
class AnalysisAlreadyStartedException(Exception):
pass
class AnalysisAlreadyExistsException(Exception):
pass
class InvalidParameterException(Exception):
pass
class AnalysisT... |
"""
Module for
- setting thaaLam/jaathi/nadai
- getting solkattu patterns for mridangam accompaniement - per music notation
"""
import configparser
import random
import itertools
from carnatic import settings
def _get_thaaLa_index(thaaLam):
return settings.THAALA_NAMES.index... |
# Original Repo:
# https://github.com/clovaai/overhaul-distillation
# @inproceedings{heo2019overhaul,
# title={A Comprehensive Overhaul of Feature Distillation},
# author={<NAME> and <NAME> and <NAME> and <NAME>
# and <NAME> and <NAME>},
# booktitle = {International Conference on Computer Vision (ICCV)},
# year={2... |
################################################################################
# Import packages
################################################################################
import dash
from dash import Dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components... |
import cv2
import numpy as np
from functools import partial
def to_list(func):
'''Converts the return value of the generator to a list.
'''
def __wrapper(*args, **kwargs):
return list(func(*args, **kwargs))
return __wrapper
class Particle():
'''Represents an individual pa... |
# Copyright (c) 2016-2021 InSeven Limited
#
# 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, merge, publish... |
"""
Life cycle management for the runner (startstop) component.
Use by both web UI and update process.
"""
__docformat__ = 'epytext en'
import os
import signal
import re
import datetime
from twisted.internet import protocol, reactor, defer, error
from codebay.l2tpserver import constants
from codebay.l2tpserver impo... |
import numpy as np
# This solver only applies on minimizing functions with 2 variables
""" Nelder-Mead Algorithm from Wikipedia"""
class NMSolver:
def __init__(self, f, vertices):
""" External Inputs"""
self.f = f
self.vertices = vertices
""" Internal Variables """
self.x0 =... |
def memoize(f):
""" Memoization decorator for functions taking one or more arguments. """
class memodict(dict):
def __init__(self, f):
self.f = f
def __call__(self, *args):
return self[args]
def __missing__(self, key):
ret = self[key] = self.f(*key)
return ret
return memodict(f)
def C_factory... |
# Copyright (c) 2020 Intel Corporation. All Rights Reserved.
#
# 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, mod... |
#! /usr/bin/env python3
#
# KiCad part/footprint importer
#
import os
import glob
import shapely.geometry as sg
import shapely.affinity as sa
import shapely.ops as so
from .sexp_parser import *
from pcbflow import *
KI_LAYER_DICT = {
"F.SilkS": "GTO",
"F.Paste": "GTP",
"F.Mask": "GTS",
"F.Cu": "GTL",... |
import scipy.special
import numpy as np
import opt_einsum as oe
def sample_spherical(ndim=3):
vec = np.random.rand(ndim)
vec /= np.linalg.norm(vec)
return vec
def mapA(T, A):
p1 = np.tensordot(A, T, axes=(0, 0))
p2 = np.tensordot(p1, A, axes=(1, 0))
result = np.tensordot(p2, A, axes=(1, 0))
... |
import numpy as np
import scipy.signal as signal
import ecogdata.util as ut
from ecogdata.expconfig.exp_descr import StimulatedExperiment
import ecogdata.parallel.array_split as array_split
def _auto_level(ttl, verbose=False):
"""Iteratively refine an estimate of the high-level cluster
of points in a TTL sig... |
import os
import json
from subprocess import run
from traceback import format_exc
from urllib.error import HTTPError
from ansible.module_utils.urls import open_url
from ansible.module_utils.basic import AnsibleModule
class StrError(RuntimeError):
pass
class Pacman:
def run(self, params):
res = run([... |
import msp_fr5969_model as model
from msp_isa import isa
# low level wrappers for isa methods
def _as(fmt, name, smode, dmode, fields):
ins = isa.modes_to_instr(fmt, name, smode, dmode)
#print('{:s} {:s} {:s} {:s}'.format(name, smode, dmode, repr(fields)))
words = isa.inhabitant(ins, fields)
return wo... |
import pytest
import numpy as np
import pickle
from glob import glob
from os import remove
from copy import deepcopy
from flare.env import AtomicEnvironment
from flare.struc import Structure
from flare.gp import GaussianProcess
from flare.mgp.mgp_en import MappedGaussianProcess
from flare.gp_from_aimd import Trajector... |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
from tensorflow.keras import Sequential
import tensorflow.keras.layers as nn
from einops import rearrange
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# Pre-defined CCT Models
__all__ = ['cct_2', 'cc... |
import string
import math
import torch
from data import data_utils
def get_symbols_to_strip_from_output(generator):
if hasattr(generator, "symbols_to_strip_from_output"):
return generator.symbols_to_strip_from_output
else:
return {generator.bos, generator.eos}
def decode_fn(x, tgt_dict, bp... |
from datetime import datetime
from graphene_sqlalchemy import SQLAlchemyObjectType
from graphql_relay import from_global_id
from database.base import db_session
from database.model_triangle import ModelTriangle
import graphene
import json
import chainladder as cl
import sys
import docstring_parser
import pickle
class ... |
import re
import subprocess
import shutil
import os
import yaml
def get_int_tuples(text):
"""
Convert Stratego simulation output to list of tuples
(int, int).
"""
string_tuples = re.findall(r"\((\d+),(\d+)\)", text)
int_tuples = [(int(t[0]), int(t[1])) for t in string_tuples]
return int_tu... |
import cvxpy as cvx
import numpy as np
from typing import Optional, Set, Dict, Any
from snc.agents.hedgehog.minimal_draining_time import compute_minimal_draining_time_from_workload \
as compute_min_drain_time
from snc.agents.hedgehog.strategic_idling.strategic_idling import StrategicIdlingOutput, \
StrategicId... |
import functools
import numpy as np
def forgive_none(func):
@functools.wraps(func)
def wrapper_decorator(a, b):
if a is not None and b is not None:
return func(a, b)
elif a is None and b is not None:
return b
elif a is not None and b is None:
... |
from __future__ import division
import time
import numpy as np
from torch import nn, optim
import torch.nn.functional as F
import torch
import itertools
from dim_red.support_func import loss_permutation, loss_top_1_in_lat_top_k, normalize_numpy,\
get_nearestneighbors, sanitize, forward_pass, Normalize, stopping_... |
import sys, socket, time, subprocess, select
import argparse, atexit
import os.path
# Include dependencies.
from dependencies.libwifi.wifi import *
from dependencies.wpaspy import Ctrl
# Metadata.
NAME = "Wi-Fi Daemon"
VERSION = "1.0"
# ----------------------------------- Wi-Fi Daemon -------------------------------... |
from typing import Union, Optional, List, Any, Dict
import os
import numpy as np
from pathlib import Path
import torch
import torch.utils.data
from .config_reader import Config
from .utils import try_to_cuda
from .constants import FIRM_CHARS_DICT
PATH_TYPE = Union[Path, str]
UNKNOWN_VAL = -99.99
def to_tensor(inp... |
# -*- coding: utf-8 -*-
import unittest
import os
from io import StringIO, BytesIO
import numpy as np
import h5py
from ribopy import create
from ribopy.core.coverage import find_coverage
from ribopy.core.get_gadgets import get_reference_names,\
get_reference_lengths,\
... |
import boto3, logging, json
import datetime, time
import random
import rsa, base64
logger = logging.getLogger()
logger.setLevel(logging.INFO)
TESTING = True
dynamodb = boto3.resource("dynamodb")
registered = dynamodb.Table("")
compParams = dynamodb.Table("")
#*********currently the master AMI with a default passwor... |
import numpy as np
import sys
import cv2
import time
import copy
import os
import traceback
import ffmpeg
import subprocess as sp
import os.path as path
from pprint import pprint
from concurrent.futures import ThreadPoolExecutor
from PIL import ImageColor
np.set_printoptions(threshold=np.inf)
def is_point_in_box(poi... |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: direct.gui.DirectScrolledList
__all__ = [
'DirectScrolledListItem', 'DirectScrolledList']
from panda3d.core import *
import DirectGuiGl... |
# By: <NAME>
# Treap - a balanced binary search tree
# Version 1.0
# (This work is licensed under a CC BY 3.0 license)
"""
A treap or a randomized binary search tree that stores items in a sorted order and offers efficient lookup,
addition and removal of items in the treap.
A treap is a combination of a randomly balan... |
import argparse
import copy
import importlib.util
import pickle
import shutil
import subprocess
import sys
import time
from functools import partial
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
from prompt_toolkit.shortcuts import checkboxlist_dialog, radiolist_dialog
from mlxtk imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Email: <EMAIL>
# DateTime: 2019-02-28 23:31:29
__author__ = "chenwx"
import sys
import redis
import requests
import yaml
import time
from pathlib import Path
from lib.worklog import My_log
from lib.daemon import daemon
from lib.myconf import conf_data
class check_web_s... |
__author__ = "<NAME>"
__credits__ = ["<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "1.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Prototype"
import time
import tomtomSearch
from flask import Flask, render_template, request, redirect, flash, session, jsonify... |
# imports
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
import tensorflow_probability as tfp
from tensorflow_probability import distributions as tfd
import copy
from tensorflow_probability import edward2 as ed
from .utils import *
from . import titration
# import analyzer
# from bindingmodels i... |
from cassiegazebo_ctypes import *
from distutils.util import strtobool
import ctypes
import numpy as np
import time
import argparse
import tensorflow as tf
import json
import os
import pickle
from softlearning.policies.utils import get_policy_from_variant
class CassieUdp:
motor_names = ['hipRollDrive', 'hipYawDr... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import os
import sys
import numpy as np
from parsable import parsable
from six.moves import range
from six.moves import zip
from treecat.config import deserialize_config
from treecat.co... |
"""
squad_manager.py
Module that implements squad selection algorithm.
"""
import sys, argparse
from io import TextIOWrapper
import json
import requests
from requests.models import Response
import pandas as pd
import pyomo.environ as pyo
# API base URL
API_URL = r'https://gaming.uefa.com/en/uclfantasy'
# functio... |
import datetime
import AlteryxPythonSDK as Sdk
import xml.etree.ElementTree as Et
import tweepy
import user_input
from obj_query import AyxDataMap, FieldType, Query
def none_to_empty_string(value):
if value is None:
return ''
else:
return value
def get_text_from_xml(value):
if value is N... |
# -*- coding: utf-8 -*-
from z3 import *
from utils import *
from globals import aggregation_function, application_function, diffusion_function
#########################
# AGGREGATION FUNCTIONS #
#########################
## Dictionary of possible aggregation functions
aggregation = {
## Sum patterning vectors: in... |
import sys
from okonomiyaki.errors import InvalidPEP440Version
from ..pep440 import _MIN, _MAX, PEP440Version
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
V = PEP440Version.from_string
class TestMinMax(unittest.TestCase):
def test_min(self):
self.assertFals... |
import re
import sys
import json
from os.path import join, exists
from transformers import BertTokenizer
def tokenize_no_unk(tokenizer, text):
split_tokens = []
for token in tokenizer.basic_tokenizer.tokenize(text, never_split=tokenizer.all_special_tokens):
wp_tokens = tokenizer.wordpiece_tokenizer.tok... |
from pydocumentdb import document_client
from model import parameters as keys
from model import calcutalor
import datetime as dt
import itertools
client = document_client.DocumentClient(keys.COSMOSDB_HOST, {'masterKey': keys.COSMOSDB_KEY})
def get_data():
"""Function that retrieves all the available co... |
"""
A two player version of Hnefatafl, a Viking board game.
A full description of the game can be found here: http://tinyurl.com/2lpvjb
Author: <NAME>
Date: 4/4/2019
"""
import sys
import pygame
from pygame.locals import *
import time
import random
import numpy as np
from tensorflow.keras import Sequential
from ten... |
#!/usr/bin/env python
"""
Parse and cache a Darshan log to simplify reanalysis and sharing its data.
"""
import os
import re
import json
import glob
import warnings
import datetime
import argparse
import multiprocessing
import hashlib
import pandas
import tokio.connectors.darshan
FSNAME_TO_SYSTEM = {
"mira-fs1": ... |
import json
import re
import pandas as pd
import requests
import unidecode
from bs4 import BeautifulSoup
class CarParser:
"""
Class extracting data from car advertising page
"""
def __init__(self, manufacturer=None, model=None, id=None, debug=False):
self.manufacturer = manufacturer
... |
"""
A configuration system using biparser.
The format of configuration file is a sub-language of python.
"""
import itertools
import keyword
import re
import typing
from inspect import cleandoc
from pathlib import Path
from . import parsec as pc
from . import serializers as sz
@pc.parsec
def make_field_parser(config... |
from collections import namedtuple
from moviepy.editor import VideoFileClip
import numpy as np
import cv2
from . import camera, image, warp, filters, lanes
_metres_per_pixel_y = 30/720
_metres_per_pixel_x = 3.7/700
Parameter = namedtuple('Parameter', ['value', 'min', 'max', 'type'])
def make_slider(param:Parameter... |
# -*- coding: utf-8 -*-
# Copyright (c) 2022, libracore and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from mvd.mvd.utils.qrr_reference import get_qrr_reference
from frappe.utils.data import add_days, t... |
import io
import os
import subprocess
import tempfile
from bson import ObjectId
from celery import chord
from celery.utils.log import get_task_logger
from girder.models.file import File
from isic_archive import Image
from isic_archive.celery import app
from isic_archive.models.segmentation_helpers import ScikitSegme... |
"""
This module provides the `Run` class that is one of the main classes of
Ivory library. In addition, `Task` and `Study` classes are defined, which manages
multiple runs for cross validation, hyperparameter tuning, and so on.
To create an `Run` instance:
import ivory
client = ivory.create_run('example')
T... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 19 13:16:46 2020
@author: <NAME>
MIT License
Copyright (c) 2020 <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 restriction, includ... |
#Note: Please run seperately dont run this file
import textwrap
"""
Question 1: Given the names and grades for each student in a class of N students, store them in a nested list
and print the name(s) of any student(s) having the second lowest grade.
"""
python_students = [['Harry', 37.21], ['Berry', 37.21], ['Tina', 37... |
# Copyright (c) 2016-2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions ... |
from AlphaGo.models.preprocessing import Preprocess
import AlphaGo.go as go
import numpy as np
import unittest
def simple_board():
# make a tiny board for the sake of testing and hand-coding expected results
#
# X
# 0 1 2 3 4 5 6
# B W . . . . . 0
# B W . . . . . 1
# B . . . B . . 2
# Y . . . B... |
import json
import hashlib
import numpy as np
from os import path
import seaborn as sns
from tqdm import tqdm
from scipy.stats import zscore
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.decomposition import PCA
from multiprocessing import Process, Manager, Pool
from Code import sam... |
## !!-----this is where the user specifies the ERROR FUNCTION to quantify model goodness-of-fit-------!!
## by default, we use the root mean square error statistic (cf Schaffner 2005) for all statistics and populations.
## this can be toggled in order to fit certain parts of the model: e.g., we might explore parameter... |
import glob
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import bezpy
from scipy.interpolate import interp1d
plt.style.use(['seaborn-paper', 'tex.mplstyle'])
mt_data_folder = '../data'
list_of_files = sorted(glob.glob(mt_data_folder + '*.xml'))
MT_sites = {site.name: s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.