text stringlengths 3.07k 22.1k |
|---|
import numpy as np
from fairlearn.postprocessing import ThresholdOptimizer
from sklearn.metrics import roc_auc_score
class pseudo_classifier:
""" Note that the actual classifier is already trained (unaware as it ought to be) and
post-processing does not require access to the underlying features. So this class... |
import sys
import unittest
import importlib
is_py3k = bool(sys.version_info[0] == 3)
from subpy import detect
from subpy import features as f
tests = []
#------------------------------------------------------------------------
class TestFeatureDetect(unittest.TestCase):
def has(self, feature, fn):
sel... |
import pandas as pd
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from utils.crawler import Crawler
def draw_multiple_node_classification(losses, aucs, aps, epoches , config = {}, plot_path = None, savefig=False):
# assert len(losses) == 2
# assert len(aucs) == ... |
import sys
from crossword import *
import copy
class CrosswordCreator():
def __init__(self, crossword):
"""
Create new CSP crossword generate.
"""
self.crossword = crossword
self.domains = {
var: self.crossword.words.copy()
for var in self.crosswor... |
"""Compound methods created from building block, implementing common use cases."""
from typing import List
from typing import Tuple
import torch
from torch import Tensor
from torch.nn import functional
from torch.nn import Softmax
from torch.nn.modules import Module
from torch.nn.modules import Sequential
import midn... |
import sys
# for linux env.
sys.path.insert(0,'..')
from datetime import datetime
import os
import pandas as pd
from tqdm import tqdm
import time
import pickle
import argparse
import csv
import utils
import numpy as np
import functools
print = functools.partial(print, flush=True)
def parse_args():
parser = argpar... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 25 13:40:07 2019
@author: santh
"""
import struct
from datetime import timedelta
from time import time
import pickle
import xlsxwriter
from itertools import groupby
from statistics import mean
import sys
import os
if len(sys.argv)!=2:
print("... |
# mathematical imports -
import numpy as np
from matplotlib import pyplot as plt
from sklearn import metrics
from math import sqrt
import seaborn as sns
sns.set()
import torch
# load network imports -
import os
import sys
sys.path.insert(0, '/Users/chanaross/dev/Thesis/MachineLearning/forGPU/')
from CNN_LSTM_NeuralNe... |
import psutil
import platform
from datetime import datetime
import subprocess
import GPUtil
from tabulate import tabulate
import re
import uuid
from savloc import temp
import os
# Check public ip using CLI
# (Invoke-WebRequest ifconfig.me/ip).Content.Trim()
# nslookup myip.opendns.com resolver1.opendns.com
def get_s... |
### Speedymurmurs Routing
import numpy as np
import networkx as nx
#import matplotlib.pyplot as plt
import json
import csv
import random
import operator
import sys
from datetime import datetime
random.seed(datetime.now())
def dist(c1, c2):
common_prefix_length = 0
shorter_length = np.minimum(len(c1), len(c2))
for ... |
from __future__ import division
from rest_framework import serializers
from django.db import transaction
from crowdsourcing import models
from crowdsourcing.serializers.dynamic import DynamicFieldsModelSerializer
from crowdsourcing.serializers.template import TemplateSerializer
from crowdsourcing.serializers.message ... |
# Copyright (C) 2017 TU Dresden
# Licensed under the ISC license (see LICENSE.txt)
#
# Authors: <NAME>, <NAME>
import sys
import numpy as np
from hydra.utils import instantiate
from mocasin.representations import MappingRepresentation
import mocasin.util.random_distributions.lp as lp
from mocasin.util import logging... |
import dgl
import mxnet as mx
import numpy as np
import logging, time, argparse
from mxnet import nd, gluon
from gluoncv.data.batchify import Pad
from gluoncv.utils import makedirs
from model import faster_rcnn_resnet101_v1d_custom, RelDN
from utils import *
from data import *
def parse_args():
parser = argparse.... |
import lex
import variable
def use_var(name):
if name in name_types:
return name_types[name]
variable.notFound(name, name_types)
# print('varriable not found', name)
exit()
def compile_all(tree):
global compiled
global ctabs
global imported
ctabs = 0
compiled = ''
for... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 11:52:39 2020
@author: aarid"""
import pandas as pd
import random
from matplotlib import pyplot as plt
from pathlib import Path
import argparse
import logging
""" Convert MD frame number to nanoseconds, print 2 list of random frame
numbers, and plot the RMSD"""
... |
# -----------------------------------------------------------------------------
# Copyright (c) 2019-, PKSHA Technology Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------... |
from __future__ import division
import os
import sys
import time
import math
import warnings
try: from urllib import urlencode
except ImportError: from urllib.parse import urlencode
import httplib2
import ujson as json
import pandas as pd
from numpy import array_split
import jmespath
try: from errors import APIErro... |
import sys,os
p = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if not (p in sys.path):
sys.path.insert(0,p)
from AML.mathlib.math2d import *
from AML.physics.colliders import *
class Node:
"""
Represents the joints of limbs
Nodes are used to define limbs as segments b... |
import pandas as pd
import numpy as np
from tqdm import tqdm
#读取轨迹数据
i = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
user = pd.read_csv(r"G:\track data and travel prediction\dataset\DataTech_Travel_Train_User",
sep='|', names=['USER_ID', 'FLAG', 'TRAVEL_TYPE'])
#user = u... |
"""
Copyright 2014 Rackspace
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
dist... |
#
# DRAGONS
#
# recipe_system
# config.py
# -----------------------------------------------------------------------... |
import math
from dataclasses import dataclass
from utils import *
from settings import *
import json
from typing import List, Dict, Tuple
def mute_mask_repr(mask):
reprs = []
i = 0
for instrument in reversed(RANDOM_SONG_INSTRUMENT_SETTINGS):
num_cs = 2 * instrument.num_cps
... |
"""
Author: Jianyou (<NAME>
Date: Sep 2020
"""
import tensorflow as tf
import nltk
import pdb
import os
import pickle
import numpy as np
from collections import defaultdict
import heapq
import random
import argparse
from LimGen.Limericks import LimGen
def init_parser():
parser = argparse.Argume... |
# Feature extractor
# Author: <EMAIL> (<NAME> (TJU))
# Date: 2021/9/1 15:00
# Last modified: 2021/9/27 10:00
import os
import librosa
import numpy as np
from scipy.fftpack import dct
import matplotlib
import matplotlib.pyplot as plt
np.seterr(divide='ignore', invalid='ignore')
def plt_wav(wav, label):
plt.figur... |
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_daq as daq
import dash_html_components as html
from dash.exceptions import PreventUpdate
from operator import add
import dash
import pandas as pd
import pathlib
import numpy as np
import pandas as pds
import plotly.graph_objects as ... |
#!/usr/bin/python3
"""
Given an input method, evaluate the false english rate and false vietnamese rate.
Input method: A string of English letters to replace "`^'-]+}.?[{~", which stands for grave, e-roof, acute, d-dash, o-roof, u-hook, a-roof, underdot, hook, o-hook, a-hook and tilde respectively.
"""
import sys
fr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import colorama
from colorama import*
import traceback
import argparse
import copy
import os
import sys
import time
from types import SimpleNamespace
import jwt
import requests
from utils.ratelimit import *
from utils.appointment import checkAndBook
from utils.displayData ... |
import torch
import logging
import os
import io
from torchtext.utils import download_from_url, extract_archive
from torchtext.vocab import build_vocab_from_iterator
from torchtext.data.utils import get_tokenizer
from torchtext.vocab import Vocab
from torchtext.data.functional import numericalize_tokens_from_iterator
U... |
# -*- coding: utf-8 -*-
"""
Ejercicio nivel 3: Atletas Olímpicos.
Interfaz basada en consola para la interacción con el usuario.
Temas:
* Instrucciones repetitivas.
* Listas
* Diccionarios
* Archivos
@author: zejiran.
"""
import olympics_module as olim
def ejecutar_cargar_atletas() -> list:
"... |
import argparse
from generator_multiple_gan import GeneratorMultipleGAN
from generator_single_gan import GeneratorSingleGAN
class IterAction(argparse.Action):
def __init__(self, option_strings, dest, nargs=None, **kwargs):
if nargs is not None:
raise ValueError("nargs not allowed")
supe... |
#!/usr/bin/env python3
# Copyright (C) 2013 FlowKit Ltd, Lausanne, Switzerland
# E-mail contact: <EMAIL>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License, either
# version 3 of the License, or (at your option) any later version.
##
PROGRAM... |
#!/usr/bin/env python3
''' unit test suite for ytameta '''
import os
import time
import shutil
import pytest
import utils
import sqlite3
from requests.exceptions import RequestException
import ytameta
# --------------------------------------------------------------------------- #
@pytest.mark.network
@pytest.mark.tu... |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... |
import lxml.html
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.loader.processor import Compose
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import HtmlXPathSelector
from rho_blogs.loaders import (BlogPostLoader, BlogAuthorLoader,
... |
import math
import random
import re
from functools import reduce
from typing import Tuple
import pyproj
DEFAULT_PROJECTIONS_BBOX = {
'+units=m +init=epsg:3857': (-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244),
'+units=m +init=epsg:3395': (-20037508.342789244, -15496570.73972... |
import datetime
import os
import gzip
from mako.template import Template
from mako import exceptions
from bottle import request, response
from sqlalchemy.orm import aliased
from sqlalchemy import or_, func, desc
from pynab.db import db_session, NZB, NFO, Release, User, Category, Group, Episode, Movie, DBID, TvShow, l... |
import json
import os
import re
import sys
from collections import OrderedDict
from pathlib import Path
import pkg_resources
from github import Github
from toml import loads
event_name = os.environ['GITHUB_EVENT_NAME']
if not event_name.startswith('pull_request'):
print(f'No-op for {event_name}')
sys.exit(0)
... |
#!/usr/bin/env python3
# coding=utf-8
import os
import numpy as np
import sys
import pdb
# (foo)bar\1 # (x)匹配 x 并记住匹配(捕获组) \1 表示括号内的表达式
# 123foobarfoo234
# 123foobar234
# RedApple # Red(?=Apple)
# RedOrange
# 像(010)88886666,或022-22334455,或02912345678等 # \(0\d{2}\)[- ]?\d{8}|0\d{2}[- ]?\d{8}
# 也能匹配010)12345... |
# Copyright 2016 Google Inc. 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... |
#!/usr/bin/env python3
############################################################
## <NAME> ##
## Copyright (C) 2019-2020 <NAME> Lab, IGTP, Spain ##
############################################################
"""
Create RNA biotype analysis using STAR and featureCounts
"""
##... |
import operator
import functools
from copy import deepcopy
from math import sqrt
lines = [l.strip() for l in open('input20').readlines()]
tiles = {}
tid = None
for l in lines:
if 'Tile' in l:
tid = int(l.split()[1][:-1])
tiles[tid] = []
elif l != '':
tiles[tid].append(l)
tile_d... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 27 19:14:01 2021
Figure 3.2: The comparison of the shrinkage parameter, MSE and Riemannian dist-
ance for Ledoit-Wolf shrinkage and grid search.
"""
from matplotlib import pyplot as plt
import numpy as np
from pyriemann.utils.distance import distanc... |
import os
import requests
import sys
import re
import html
import csv
def pripravi_imenik(ime_datoteke):
'''Če še ne obstaja, pripravi prazen imenik za dano datoteko.'''
imenik = os.path.dirname(ime_datoteke)
if imenik:
os.makedirs(imenik, exist_ok=True)
... |
"""Support for the GCE Ecodevices RT2."""
import logging
from datetime import timedelta
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_API_KEY
... |
import flask
from flask import Flask, render_template, request
from flask import jsonify
from main import Main
from flask import g
import sqlalchemy
from sqlalchemy import create_engine,text
import mysql.connector
app = Flask(__name__)
#Connect to database on RDS
def connect_to_database(URI,PORT,DB,USER,PASSWORD):
db... |
from typing import Dict, Any, Optional, List, Tuple, Set
import networkx
from .edge import Edge
class Direction:
TOP = 0
BOTTOM = 1
BOTH = 2
class TreeGraphEdgeRouter:
def __init__(self,
layers: List[List[Any]],
vertical: bool,
layer_widths: List[... |
'''
Helper functions for MASQ pipeline
'''
import os, sys
import numpy as np
import gzip
from collections import Counter, defaultdict
import fileinput
import operator
import pickle
import time
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import editdistance
import re
import logging
## nice functio... |
import os, re
import tensorflow as tf
import pandas as pd
import tensorflow_hub as hub
from tqdm import tqdm
import numpy as np
from bert.tokenization import FullTokenizer
from tensorflow.keras.callbacks import ModelCheckpoint
from sklearn.model_selection import train_test_split
from tensorflow.keras import backend as ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
'''
#################################################################################
#################################################################################
#########################################... |
#Handle MongoDB backend queries, searches, sorts
import dns
from pymongo import *
from errors import *
import random
import string
import datetime
#Global variables
LOAN_DURATION = datetime.timedelta(days=27)
MAX_LOANS = 7
RENEW_DURATION = LOAN_DURATION
#Books
def gen_new_bookID(bookobj):
#Generate new book ID in t... |
import time
import json
import datetime
import re
import random
import csv
from django.shortcuts import render
from django.db.models import Count, Q
from django.http import HttpResponse
from apps.data.models import (
Dataset,
DATA_MAPPING,
DatasetOrganization,
Taxon,
RawDataOccurrence,
SimpleD... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
"""Fully automated ordered chapters creation from a remuxed BDMV."""
__author__ = 'Dave <<EMAIL>>'
__date__ = '3 August 2020'
import copy
import functools
import os
import pathlib
import random
import sys
import xml.etree.ElementTree as ET
from typing import Dict, Generator, List, Tuple, Union
import acsuite
import v... |
###########################################
#
# authors: <EMAIL>
# <EMAIL>
#
# DESCRIPTION:
# Python library implementing utilities to manipulate Knowledge Bases
# based on the tomasys metamodel (Tbox), using the owlready2 library
##########################################
from owlready2 import get_ontolo... |
import os
import numpy as np
import pandas as pd
from pathlib import Path
from .encryption import decrypt_csv
# this needs to be overridden if run from a directory other than the project root
DEFAULT_DATA_PATH = "./data"
def get_data_path(filename=""):
return Path(os.getenv("CRIMS_DATA_PATH", DEFAULT_DATA_PATH)) ... |
import math
import random
import threading
import time
import cv2
import numpy as np
from PIL import Image
import config
import eyedetect
import media
class DropObject:
def __init__(self, speed, radius, object_type):
self.speed = speed
self.radius = radius
self.x = random.randint(120, 5... |
import functools
from time import time_ns as globalTimeStamp
# Try to import introbind and replace if fail
try:
import introbind as ib
def ibLoaded():
return True
def ibLoadReplacement(comm, writeDir):
pass
def ibWrite(writeDir):
pass
except:
class ib:
"""This cl... |
"""
A collection of classes and function for creating custom :code:`Packet`s.
"""
import ctypes
from collections import OrderedDict
from calpack.utils import typed_property, PY2, PYPY, FieldNameError, \
FieldAlreadyExistsError, FieldNameDoesntExistError
from calpack.models.fields import Field
__all__ = ['Packet']
i... |
#!/usr/bin/env python
#
# Copyright (c) 2016 In-Q-Tel, Inc, 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
#... |
# -*- coding: utf-8 -*-
import os
import glob
import argparse
import time
import itertools
from prometheus_client import start_http_server, Gauge, REGISTRY
from threading import Lock, Thread
GAUGES = {}
GAUGES_LAST_UPDATE = {}
GAUGES_LABELS_LAST_UPDATE = {}
GAUGES_LOCK = Lock()
GAUGES_TTL = 60
SST_ABSPATH_TO_SIZE_IN... |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
from __future__ import print_function
import numpy as np
from pyNastran.converters.panair.assign_type import integer
def print_float(value): # sInt #string_float_value
"""int represented as a short float"""
value = "%f" % value
return value.rstrip('0')
class PanairPatch(object):
"""Used for physica... |
from app import app, request, jsonify, json, requests, get_jwt_identity, jwt_required
from app import db
from model import Master, MasterSchema, Products, User
import json
import base64
import shopify
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 23 09:37:45 2021
@author: leyuan
reference:
https://github.com/ShangtongZhang/reinforcement-learning-an-introduction/blob/master/chapter12/mountain_car.py
"""
import time
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
fr... |
# -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2010, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... |
'''VGG for CIFAR10. FC layers are removed.
(c) <NAME>
'''
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import math
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.o... |
from collections.abc import Iterable
import cupy as cp
import numpy as np
from cupyimg.scipy import ndimage as ndi
from ..util import img_as_float
from .._shared.utils import warn, convert_to_float
__all__ = ["gaussian", "difference_of_gaussians"]
def gaussian(
image,
sigma=1,
output=None,
mode="ne... |
# 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... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Create the UCSC chain file which is needed to lift over from one coordinate
system to another.
File format:
<http://genome.ucsc.edu/goldenPath/help/chain.html>
chain 4900 chrY 58368225 + 25985403 25985638 chr5 151006098 - 43257292 43257528 1
9 1 0
10 ... |
import sys
from io import BytesIO
from typing import Dict, Optional, Tuple, List
import zlib
import os
import struct
from collections import defaultdict, namedtuple
def _read_int(x: BytesIO, n_bytes: int, signed: bool=True) -> int:
return int.from_bytes(x.read(n_bytes), byteorder="little", signed=signed)
def rea... |
# -*- coding: utf-8 -*-
"""
Created on Mon, March 30 10:10:10 2020
@author: <NAME>
scriptVersion = 1.0..0
"""
#TODO: Add API Key generation to this script as well.
from flask import current_app as app
import json
from datetime import datetime
import secrets
import os
"""
Initialization of all the necessary paths requ... |
import os;
import time;
import zipfile
import shutil
import traceback
Dev = r"..\dev" #relative to build.py
Release = r"..\release" #relative to build.py
PathToMonk = r"Jagent\Monk.jar" #relative to build.py
Readme = "readme.txt" #relative to dev
Versionfile = "version.txt" #relative to build.py
FileTyp... |
import math
import numpy as np
from ..simplicial_complexes import flag_complex as flCpx
###############################################################################
# Jump to next hypercube in cover
def next_hypercube(pos, div):
"""Jumps to next hypercube in cubical cover
Parameters
----------
p... |
import numpy as np
def rank_alignment(alignment):
ranks = {}
if "fine_match_info" in alignment.keys():
ranks["fine_match_info"] = _rank_alignment(alignment["fine_match_info"])
ranks["match_info"] = _rank_alignment(alignment=alignment["match_info"])
return ranks
def _rank_alignment(alignment)... |
#!/usr/bin/env python3
'''Author: <NAME> (https://github.com/lungj)
Maybe I just stopped you from doing something foolish. Or in retrospect brilliant (d'oh).
In any case...
ETH/ETC: 0xc5500095A395B4FB3ba81bB0D8e316c675d1F47C
THIS PROGRAM DOES NOT CONSTITUTE INVESTMENT ADVICE. IT IS OFFERED AS-IS AND WITHOUT
WARRANTY. ... |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import requests, sys, os, time, datetime
from Helper import *
import Configuration as cfg
import accesscontrol.LoginScreenSQL as LoginScreenSQL
import accesscontrol.LoginScreenFB as LoginScreenFB
import accesscontrol.LoginScreen as logi... |
# Support for the Numato Saturn (http://numato.com/product/saturn-spartan-6-fpga-development-board-with-ddr-sdram)
# Original code from : https://github.com/timvideos/litex-buildenv/blob/master/targets/waxwing/base.py
# By <NAME>
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import As... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import numpy as np
from glumpy import app, gloo, gl, data
from... |
"""
This file is copied/apdated from https://github.com/berkeleydeeprlcourse/homework/tree/master/hw3
"""
import sys
import pickle
import numpy as np
from collections import namedtuple
from itertools import count
import random
import gym.spaces
import torch
import torch.nn as nn
import torch.nn.functional as F
imp... |
import atexit
import datetime
import os
import shutil
import sqlite3
from collections import defaultdict
import CommonUtils
import MediaLib
from CommonUtils import FileScanner
from MediaLib.runtime.library import AudioLibrary
def create_new_database():
"""
Will create a new library from the template
"""
... |
from caqi.transforms.all_sensors_transforms import convert_types_from_csv
from datetime import datetime
from pathlib import PurePath
import pandas as pd
from caqi.clients.file_system_client import FileSystemClient
from caqi.clients.http_client import HttpClient
from typing import Any, Dict
from dataclasses import dat... |
# -*- coding: utf-8 -*-
"""@package grass.pygrass.messages
@brief PyGRASS message interface
Fast and exit-safe interface to GRASS C-library message functions
(C) 2013 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from api.migrations import (
get_property,
get_property_raw,
load_property,
set_property,
delete_property_blob,
)
import abc
from collections import defaultdict
from copy import copy
import datetime
im... |
import torch
import torch.nn.functional as F
from torch.distributions import Normal
import numpy as np
class Policy(torch.nn.Module):
def __init__(self, state_space, action_space):
super().__init__()
self.state_space = state_space
self.action_space = action_space
self.hidden = 512
... |
import os
import zipfile
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import random
from tensorflow import keras
from tensorflow.keras import layers
import nibabel as nib
from scipy import ndimage
def read_nifti_file(filepath):
"""Read and load... |
import asyncio
import json
import sys
from tempfile import NamedTemporaryFile
from typing import Callable, Generator, Type
from unittest import mock
import pytest
from pytest_mock import MockFixture
from requests import Response # type: ignore
from starlette.testclient import TestClient
from example.param_verify imp... |
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 bs4 import BeautifulSoup
import datetime
import os
import time
import pytz
from pony.orm import *
from daemonize impo... |
import sys
sys.path.append('..')
import datetime
import numpy as np
import xarray as xr
import json
import os
import boto3
from wrfroutines.helper_jc import get_precep_array
from wrfroutines.helper_jc import for_windspeed
from wrfroutines.helper_jc import for_winddirection
from wrfroutines.helper_jc import get_lightn... |
from __future__ import print_function
import os
import copy
import pickle
from collections import OrderedDict
import orca
from urbansim.utils import yamlio
from .__init__ import __version__
from .utils import update_name, version_greater_or_equal
_templates = {} # global registry of template classes
_steps = {} ... |
# -*- coding: utf-8 -*-
"""
Main stats subplugin for hero-plugin, shows primary skills like attack-defense,
hero level, movement and experience and spell points, spellbook toggle,
and war machines.
------------------------------------------------------------------------------
This file is part of h3sed - Heroes... |
import math
import os
import time
import numpy as np
import mxnet as mx
from mxnet import gluon, autograd
from mxnet.gluon import nn, rnn, data as gdata
import zipfile
from MXnet import utils
from gensim.models import word2vec
import pandas as pd
import numpy as np
class Dictionary(object):
def __init__(self):
... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.cuda import memory_summary
#### misc #####
def parameter_count(model):
print('# parameters:', sum(p.numel() for p in model.parameters() if p.requires_grad))
def gpu_usage():
print('gpu usage (current/max): {:.2f}... |
#!/usr/bin/env python3
"""
Export rsyslog counters as prometheus metrics (impstats via omprog)
Copyright (c) 2018, <NAME> <<EMAIL>>
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... |
from os import system, name
from colors import Colors as c
import random, json
from os import path, listdir
import getkey
x = 0
y = 0
items = 0
depth = 1
def clear():
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
def waiting():
input("Pressez ENTER pour continuer")
clear()
n... |
import sys
import queue
from copy import deepcopy
rows = "ABCDEFGHI"
cols = "123456789"
# CSP
class CSP:
""" Constraint satisfaction problem class """
def __init__ (self, grid, domain = cols):
""" Initialize variables, values and constraints """
self.variables = cross(rows, cols)
... |
import time
import numpy as np
#from scipy.fftpack import fft,ifft,fft2,ifft2
import pyfftw
from numpy import cos,sin
from numpy.fft import fft, ifft,fft2,ifft2
from math import pi
#from pyfftw.interfaces.numpy_fft import fft
#from pyfftw.interfaces.numpy_fft import fft2
#from pyfftw.interfaces.numpy_fft import ifft
... |
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# Copyright 2021 <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 writing, software... |
from flask import Blueprint, render_template, request, flash, url_for, redirect, session, jsonify
from sqlalchemy import true
from app.models.product import Product
from app.models.listing import Listing
from app import listing_schema, listings_schema
import boto3, logging
from werkzeug.utils import secure_filename
im... |
import numpy as np
import cv2 as cv
from scipy.signal import convolve2d
import math
import scipy.ndimage
import time
def imBrightness3D(img, In=([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]), Out=([0.0, 0.0, 0.0], [1.0, 1.0, 1.0])):
# "J = low_out +(high_out - low_out).* ((I - low_in)/(high_in - low_in)).^ gamma"
# Modifi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.