text stringlengths 3.07k 22.1k |
|---|
from __future__ import print_function
import numpy as np
from sklearn.preprocessing import OneHotEncoder
from cvxopt.solvers import qp
from cvxopt import matrix, spmatrix
from numpy import array, ndarray
from scipy.spatial.distance import cdist
# solve_qp adapted from https://github.com/stephane-caron/qpsolvers/blob/... |
import pandas as pd
import numpy as np
import multiprocessing as mp
def mT(A):
return (A * m_p)
def reduced(m1, m2):
return (m1 * m2 / (m1 + m2))
def r(mH, A):
return (4 * A * m_p * mH / (A * m_p + mH) ** 2)
def F(eR, A):
if eR == 0:
return (1)
else:
qF = np.sqrt(2 * mT(A) * ... |
import pygame
from pygame.locals import *
import numpy as np
import time,sys,io,random,os,getpass,winsound
from datetime import datetime
basePath=os.getenv('APPDATA')+"\\CONWAY_FILES\\"
formato=".txt"
print(basePath)
if not os.path.exists(basePath):
os.mkdir(basePath)
__Version__="1.21.5"
__Authors__=["Nadi... |
#!/usr/local/bin/python3
# coding: utf-8
#############################################################################################################################################################################################
# ... |
import math
import operator
import random
from queue import PriorityQueue
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from log import timeit
SOS_token = 2
EOS_token = 3
MAX_LENGTH = 50
class Encoder(nn.Module):
def __init__(self, input_size, embed_size,... |
import cv2
from generate_eyes_model import WIDTH, HEIGHT, load_trained_model
import numpy as np
EYES_OPEN = 'open'
EYES_CLOSED = 'closed'
# The prediction threshold is very low because there are almost no false-positives for open eye detection, On the other
# hand, closed eye detection amounts to values far below 0.1... |
# ==============================================================================
# ARSC (A Relatively Simple Computer) License
# ==============================================================================
#
# ARSC is distributed under the following BSD-style license:
#
# Copyright (c) 2016-2017 <NAME>
# All rights... |
import os
import time
import keyboard
from asciicanvas import AsciiCanvas
check = 0
choose = 0
memo_x, memo_y = 0, 0
ascii_canvas_memo = ''
enter_line = list(range(100))
keys = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c"... |
# -*- coding:utf-8 -*-
import tkinter as tk
import numpy as np
import random
from matplotlib import pyplot as plt
plt.ion()
from PIL import Image
import matplotlib.image as mpimg
from math import sqrt, ceil
import warnings
np.seterr(all='warn')
class Network():
def __init__(self, id, sizes, activation_function_... |
from __future__ import absolute_import
from .Node import Op
from .. import ndarray
from .. import gpu_links as gpu_op
from .. import stream
import numpy as np
import ctypes
class ParameterServerCommunicateOp(Op):
def __init__(self, nodeA, parameter, learning_rate):
super().__init__(ParameterServerCommuni... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Handle ReadTheDocs.org build -------------------------------------------
import os... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.signal import argrelmin
from scipy.constants import m_p, m_n, e, pi
def WEST_toroidal_field(Itor=1250, R=2.37):
"""
Returns the WEST toroidal field magnitude as a function of the radius R
and the current flowing in the toroidal coils
Arguments:... |
import os
import re
import sys
sys.path.append('.')
import cv2
import math
import time
import scipy
import argparse
import matplotlib
import numpy as np
import pylab as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from collections import OrderedDict
from sci... |
import requests
import os
import json
import time
import logging
from datetime import datetime, timedelta, timezone
from tcx import create_tcx
from dateutil import parser
from pathlib import Path
import dill as pickle
import shutil
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument("--activit... |
import os
import random
import pygame
import zwave.helper
class Player(pygame.sprite.Sprite):
def __init__(self, game, model = "01"):
super(Player, self).__init__()
self.weapon = {}
self.weapon["type"] = "gun"
self.weapon["delay"] = 20
self.weapon["timer"] = 0
s... |
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
parentdir = os.path.dirname(parentdir)
print(parentdir)
sys.path.append(parentdir)
from performance_eval import *
import csv
from collections import defaultdict
def generate_roc(csv_files, positive_label, co... |
import sys
import torch
import torch.nn as nn
from torch.optim import Adam
from torch.autograd import Variable
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
import numpy as np
from torch.optim.lr_scheduler import LambdaLR
from models import model_factory
def soft_update(target, source, t... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import shutil
import subprocess
from pathlib import Path
import pytest
import requests
from flexmock import flexmock
from requests import Response
from dist2src.core import Dist2Src
from tests.conftest import clone_package_rpms, run_dist2s... |
# -*- coding: utf-8 -*-
from builtins import object
from collections import Counter
import django_tables2 as tables
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.db import IntegrityError
from django.http import JsonResponse
from django.shortcuts import rend... |
from django.urls import reverse
from django.db import models,transaction
from contact.models import Customer
from product.models import ProductVariant
from django.utils import timezone
from datetime import timedelta,date
from django.db.models import Sum,Q,F
from django.utils.translation import gettext_lazy as _
from dj... |
#!/usr/bin/python3
import sys
import os
import asyncio
import concurrent
import getopt
import datetime
import json
import serial
import urwid
from meddela import (
Message,
load_messages_from_file,
load_enums_from_file,
)
messages = {}
enums = {}
selected_messages = {}
key_mapping = ... |
import os
import sys
import time
import click
import sqlite3
DATABASE = os.path.join(os.path.dirname(os.path.realpath('__file__')), 'data.db')
# METADATA_DATABASE = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'metadata.p')
LEVELS_TO_INTERVALS = {
0: 3600 * 0, # 0 hrs
1: 3600 ... |
"""Representations Writers
Module with various writers for saving representations/activations. Currently,
two file types are supported:
1. ``hdf5``: This is a binary format, and results in smaller overall files.
The structure of the file is as follows:
* ``sentence_to_idx`` dataset: Contains a single json stri... |
from auto_machine_learning.data_preprocessing.preprocessing import *
from auto_machine_learning.feature_engineering.select_from_model import select_from_model
from auto_machine_learning.feature_engineering.anova import anova_classifier, anova_regressor
from auto_machine_learning.feature_engineering.correlation import c... |
## Copyright (c) 2016-2017 Upstream Research, Inc. All Rights Reserved. ##
## Subject to an 'MIT' License. See LICENSE file in top-level directory ##
## #python-3.x
## python 2 does not work due mostly to issues with csv and io modules with unicode data
help_text = (
"CSV-APPEND tool version 20170602\n"
... |
#!/usr/bin/python3
# ns.png.py - Script to convert NS data to rss
# 2020 sep 23 v1 <NAME> Copied from rss4
version = "v1"
# To merge Python into Apache on Ubuntu:
# sudo apt install apache2 libapache2-mod-wsgi-py3 # for python3
# Create a python script (e.g. ns.png.py) and assign rights
# sudo ch... |
# Copyright (C) 2017 Mandiant, Inc. All Rights Reserved.
import re
import time
import inspect
import logging
import argparse
import contextlib
from typing import Set, Tuple, Iterable, Optional
from collections import OrderedDict
import tqdm
import tabulate
import viv_utils
import envi.archs
import viv_utils.emulator_d... |
import datetime
import time as mod_time
from aredis.exceptions import (ResponseError,
RedisError,
DataError)
from aredis.utils import (merge_result,
NodeFlag,
first_key,
b, dict_me... |
"""
Test suite configuration
"""
import json
import apsw
import time
from datetime import datetime
import pytest
import bitcoin as bitcoinlib
import logging
from counterpartylib.lib import log
log.set_logger(logging.getLogger())
from counterpartylib.test import util_test
from counterpartylib.test.fixtures.vectors im... |
import logging
import numpy as np
import pandas as pd
import re
# divide between term (r) and relation (r) in relation path
divider_tr = '.'
divider_rt = '~'
def _tuple_list_to_dict(tuple_list):
tuple_dict = {}
for k, v in tuple_list:
try:
tuple_dict[k].append(v)
except KeyError:
... |
#!/usr/bin/env python3
#
# Copyright (c) 2018, <NAME>
# Copyright (c) 2018, <NAME>
# All Rights Reserved.
#
# The file is part of the lbuild project and is released under the
# 2-clause BSD license. See the file `LICENSE.txt` for the full license
# governing this code.
import os
import lbuild.utils
import lbuild.filte... |
import os
import re
import sys
import tarfile
import zipfile
import numpy as np
import tensorflow as tf
from six.moves import urllib
import psutil
from collections import defaultdict
DATA_URL = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz'
IMAGE_EXTENSION = ('jpg', 'jpeg', 'bmp', 'png... |
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
from unittest import TestCase
from unittest.mock import MagicMock
from signalflow_algorithms.algorithms.graph import Graph, Branch, Node
class TestGraph(TestCase):
def test_graph_copy(self):
# Create graph
graph = Graph()
node_1 = Node(graph)
node_2 = Node(graph)
node_3 =... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2019 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
from __future__ import annotations
from http import HTTPStatus
from sphero.sphero_bolt import SpheroBolt
from flask import Flask, render_template, Response, jsonify, request, abort
import numpy as np
from cv2 import cv2
from typing import List, Type
import json
import helper
from flask_cors import CORS, cross_origin
fr... |
# encoding: utf-8
"""
aspath.py
Created by <NAME> on 2009-11-05.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from struct import unpack
from struct import error
from exabgp.bgp.message.open.asn import ASN
from exabgp.bgp.message.open.asn import AS_TRA... |
# SPDX-License-Identifier: BSD-3-Clause
"""
zotero.py
---------
This is the zotero meta adapter
"""
import sys
import os
from shutil import copyfile
from tempfile import gettempdir
from datetime import datetime
from orator import Model, orm
from tqdm import tqdm
from .. import config
from ..common import *
from .... |
import numpy as np
import re
import glob
def read_generic_file(filepath):
""" reads any generic text file into
list containing one line as element
"""
text = []
with open(filepath, 'r') as f:
for line in f.read().splitlines():
text.append(line.strip())
return tex... |
import sys, os
import socket
from distutils import sysconfig
from Package import Package
petsc_text = r'''
#include <stdlib.h>
#include <stdio.h>
#include <mpi.h>
#include <petsc.h>
int main(int argc, char* argv[]) {
PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
printf("MPI version %d.%d\n", MPI_VERSION... |
"""User interface widgets."""
from model.battery import BatteryState
from typing import Optional
import pygame
import model
import ui.resources
import ui.utils
# How many pixels to pad the inside of widgets.
PADDING = 5
# If set to True then debug lines will be drawn in widgets
WIDGET_DEBUG = False
class Widget(p... |
from fts.system import Value, C, I, O, Constraint, Parameter
class LazySample(object):
def __init__(self, sampler, inputs, var):
self.sampler = sampler
self.inputs = inputs
self.var = var
def __repr__(self):
return '?{}'.format(self.var)
class Generator(object):
def _... |
from gevent.pywsgi import WSGIServer
from flask import Flask, abort, render_template
from urllib.request import Request, urlopen
from urllib.error import HTTPError
import json
from collections import defaultdict
from operator import itemgetter
import datetime
import os
import time
from pprint import pprint
app = Flask... |
from binascii import hexlify, unhexlify
from dataclasses import dataclass
import random
import uuid
from flask import (
Flask,
Blueprint,
request,
render_template,
)
from Crypto.Random import (
get_random_bytes
)
from crypto.crypto import (
get_rsa_key,
get_public_key,
sign_message,
... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
from six.moves.urllib.error import URLError
import spack.ci as ci
import spack.main as spack_main... |
#-*- coding:utf-8 -*-#
# author: Qian | <EMAIL>
import sys
import random
import time
import os
import unicodedata
poster = ' Merry Christmas! '
star_density = 16
snow_density = 8
min_density = 1
max_density = 32
speed = 5
min_speed = 1
max_speed = 10
is_snow_cover = False
air = ' '
woods = ['-', '|']
stars = ['☆★'... |
"""This script contains all of our service 1 logic."""
# Imports --------------------------------------------------------------
import ast
import random
import requests
from src.service1_init import service1
# Functions ------------------------------------------------------------
def random_download_text():
... |
from flask import render_template
from datetime import datetime
from enum import Enum
from jinja2 import Environment, FileSystemLoader, DebugUndefined, Template
from tpgnow.singletable import SingleTableUnescaped
env = Environment(
loader=FileSystemLoader("./templates"),
undefined=DebugUndefined
)
""" This mo... |
# -*- coding: utf-8 -*-
"""
Created in August 2019
@author: Zhengui
"""
import numpy as np
import matplotlib.pyplot as plt
## -- Function to read all the rankings of the 12 teams for the 66 queries --
def extractRankings(input_file, topN, output_file):
fr = open(input_file, 'r')
# R... |
import tensorflow as tf
from tensorflow.keras.datasets import boston_housing
from tensorflow.keras.layers import Activation, Add, BatchNormalization, Conv2D, Dense, GlobalAveragePooling2D, Input, concatenate, Flatten
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.callbacks impor... |
#!/usr/bin/env python
# ===============================================================================
# Copyright 2015 Geoscience Australia
#
# 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
... |
import re
import os
import json
import numpy as np
import xml.etree.ElementTree as ET
from typing import Dict
try:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
except ImportError:
pass
class WebotsGameLogParser:
"""
The if the root class of the interface.
It connect... |
"""hutgame_mvc
Simple example on implementing MVC architecture for Python GUI app.
This module is compatible with Python 3.5.x and Python 2.7.9. It contains
supporting code for the book, Learning Python Application Development,
Packt Publishing.
The application is a trivial game where the player has to select a
radi... |
import numpy as np
from . import logger
from duckietown_utils.expand_variables import expand_environment
import os
__all__ = [
'd8n_read_images_interval',
'd8n_read_all_images',
'd8n_get_all_images_topic',
]
def d8n_read_images_interval(filename, t0, t1):
"""
Reads all the RGB data from the ba... |
import tensorflow as tf
import numpy as np
import tqdm
__all__ = ('pad_ragged_2d', 'shuffle_ragged_2d',
'inputs_to_labels', 'get_pos_encoding',
'get_quant_time', 'softmax_with_temp',
'generate_midis')
def pad_ragged_2d(ragged_tensor, pad_idx):
# ragged_tensor -> RAGGED(batch_siz... |
# -*- coding: utf-8 -*-
"""
gyroid.space_group
==================
"""
import numpy as np
from numpy.linalg import inv
from .symmetry import Symmetry
__all__ = ["symmetry_generator1",
"symmetry_generator2",
"symmetry_generator3"
]
def symmetry_generator1(ITA_number,b,h):
''' Outp... |
import argparse
import codecs
import gzip
import json
import logging
import time
from functools import partial
from itertools import islice
from multiprocessing.dummy import Pool
from tempfile import NamedTemporaryFile
from elasticsearch import Elasticsearch
from elasticsearch.helpers import streaming_bulk, parallel_b... |
#!/usr/bin/env pytest-3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2018, Nokia"
__license__ = "BSD-3"
from pybgl.graphviz import graph_to_html
from pybgl.property_map import make_func_property_map
from ... |
# Copyright (c) <2015-2016>, <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 and the... |
# Copyright 2021-present Kensho Technologies, LLC.
from abc import ABCMeta
from dataclasses import dataclass, field
from enum import Enum, unique
from typing import Any, Callable, Dict, Iterable, Mapping, Optional, cast
from dataclasses_json import DataClassJsonMixin, config
from graphql import (
GraphQLList,
... |
"""
Created on Tue Sep 5 16:54:20 2017
@author: HeyDude
"""
import warnings
import logging
import json
from datetime import datetime
import dateutil
import pydicom
from SimpleDicomToolkit.logger import Logger
ISO_DATE = '%Y-%m-%d'
ISO_TIME = "%H:%M:%S.%f"
ISO_DATETIME = "%Y-%m-%d %H:%M:%S.%f"
DICOM_DATE = '%Y%m%d... |
import itertools as it
from tempfile import TemporaryDirectory
from pathlib import Path
import gc
import numpy as np
import pandas as pd
import pytest
from hypothesis import given, assume, settings
import hypothesis.strategies as st
from hypothesis.extra.numpy import arrays, scalar_dtypes
from binpickle.read import B... |
# Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import numpy as np
def _gauss(x,mu,sigma,A):
return A*np.exp(-(x-mu)**2/2/sigma**2)
def _bimodal(x,mu1,sigma1,A1,mu2,sigma2,A2):
return _gauss(x,mu1,sigma1,A1)+_gauss(x,mu2,sigma2,A2)
def tag_halos_tidal_peaks(snapshot, fname, nbins=20, cl=3):
P,C,bincenters,dx,hid,tidal_force_tdyn,\
indexes... |
"""
Copyright (c) 2019 The Cereja Project
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, distri... |
import argparse
import itertools
import os
import random
import time
from pprint import pformat
import texttable
import torch
import yaml
from torch.optim.lr_scheduler import _LRScheduler
from tqdm import tqdm
from src.utils import utils
from src.utils.sysutils import is_debug_mode
try:
from yaml import CLoader ... |
import datetime
import json
from collections import Counter, defaultdict
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.paginator import Paginator
from django.core.serializers.json import DjangoJSONEncoder
from django.views import generic
from accounts.models import Child, User
from exp.u... |
import sys
import datetime
import numpy as np
def get_tsys(fslog):
#2021.266.12:20:01.38#dbtcn#tsys/ 001l, 71.0, 002l, 78.6, 003l, 77.8, 004l, 63.7, 005l, 74.3, 006l, 89.0, 007l, 76.2, 008l, 87.0, ia,155.2
#2021.266.12:20:01.38#dbtcn#tsys/ 009l, 51.7, 010l, 54.8, 011l, 55.8, 012l, 46.7, 013l, 66.3, 014l, 69.8, 015l, 6... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Author: <NAME> (<EMAIL>)
# @Date: 2018-12-11
import numpy as np
def relu(Z):
A = np.maximum(0, Z)
assert (A.shape == Z.shape)
return A
def relu_backward(dA, cache):
Z = cache
dZ = np.array(dA, copy=True)
dZ[Z <= 0] = 0
assert (dZ.shape =... |
import torch
import torchvision
from torch import nn as nn
from utils import util
class GANLoss(nn.Module):
"""Define different GAN objectives.
The GANLoss class abstracts away the need to create the target label tensor
that has the same size as the input.
"""
def __init__(self, gan_mode, targe... |
#!/usr/bin/env python
"""
CreateNetwork: Creates a TF-TF gene regulation network from annotated transcription factor binding sites
@author: <NAME>
@contact: mette.bentsen (at) mpi-bn.mpg.de
@license: MIT
"""
import os
import sys
import argparse
import pyBigWig
import numpy as np
import glob
#impo... |
from meld_classifier.experiment import Experiment, save_config, load_config, submit_experiments_array
import meld_classifier.paths as paths
import numpy as np
import os
import sys
import logging
import csv
import argparse
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
def make_str(variable):
# make string
if isins... |
import io
from os.path import join
# fix a bug in intel
import mpi4py
import numpy as np
import obspy
import pandas as pd
import pyasdf
from mpi4py import MPI
from obspy.geodetics.base import gps2dist_azimuth
from obspy.io.sac.sacpz import attach_paz
from obspy.signal.invsim import simulate_seismometer
mpi4py.rc.recv... |
from genotypes import PRIMITIVES, PRIMITIVES_DARTS, Genotype_opt, Genotype_nested, ResNet18, Xception, residual_layer_simple, ResNet50
import pandas as pd
import numpy as np
from scipy.spatial.distance import hamming
import plotly.express as px
import json
from train import TrainArgs, TrainNetwork
from scipy.stats impo... |
#!/usr/bin/env python
# coding=utf-8
import argparse
import csv
import sys
UNKNOWN_VALUE = ''
HEADER = [
'Landeskennung',
'Kennzeichen',
'Datum',
'Startzeit',
'Landezeit',
'Flugzeit',
'Startort',
'Landeort',
'Anzahl Landungen',
'Ausland',
'Preiskategorie',
'PIC1',
... |
import sys
import numpy as np
import tensorflow as tf
#import matplotlib.pyplot as plt
class Config:
def __init__(self, data):
self.data = data
def __getattr__(self, attr):
return self.data[attr]
def __setattr__(self, attr, value):
if attr == 'data':
super().__setattr__(attr, value)
self.data[attr] =... |
#!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 CNRS
#
# 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 lim... |
try:
import caffe2.python.predictor.predictor_exporter as pe
except ImportError:
print('Please check that Caffe2 is installed correctly to run this demo.')
import numpy as np
import os
import shutil
from caffe2.python import core, model_helper, workspace, brew
from tensorboardX import TorchVis
"""
This is a d... |
import bisect
import itertools
from typing import Iterable, List, NamedTuple, Sequence, Tuple
from eth_typing import Hash32
from eth_utils import to_tuple
from eth_utils.toolz import sliding_window
from ssz.constants import CHUNK_SIZE, ZERO_BYTES32
from ddht.v5_1.alexandria.constants import GB, POWERS_OF_TWO
from ddh... |
import sys
import os
import argparse
import json
import re
import requests
import tensorflow.compat.v1 as tf
import numpy as np
import pymysql
from pymysql_comm import UsingMysql
import time
from train.modeling import GroverModel, GroverConfig, sample
from tokenization import tokenization
##### ignore tf deprecated w... |
import random
import pygame
# TODO: Organize files into folder (assets)
# TODO: Organize GUI into single class? (online examples) (Inherit from GameEngine)
# TODO: Game engine wrapper class for handling
# TODO: Clean up globals. Put into GUI or GameEngine class
# TODO: After Refactor, figure out new features.
# TODO: ... |
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... |
import argparse
import subprocess
import multiprocessing
import time
import json
import socket
import shutil
from multiprocessing import Pool
import os
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(('10.255.255.255', 1))
ip = s.getsockname()[0]
except Ex... |
# Copyright 2016-2020 Blue Marble Analytics 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# black --line-length 100
#
# TODO: it is possible to override distutils.dist.Distribution and pass within
# setup `distclass=MyDistribution`. However, it's not clear how to
# remove unsupported commands from possible commands, e.g. `upload_docs`
# and... |
from PyQt5 import QtCore, QtGui
from gonhang.core import Config
from gonhang.core import System
from gonhang.core import Nvidia
from gonhang.core import StorTemps
from gonhang.core import Net
from gonhang.core import Weather
from gonhang.displayclasses import DisplaySystem
from gonhang.displayclasses import DisplayNvid... |
"""
Module that provides a simple class that represents a collection of sorted intervals and allows for some
basic interval-based operations.
Internally this stores the intervals using standard sorted lists. This is not optimal and may
incur a O(n) overhead on some operations depending on the result set. It also may i... |
#!/usr/bin/env python
# Author: <NAME> (<EMAIL>)
##############
# Produce background maps for XMM EPIC via smart smoothing
##############
import argparse
import logging
import astropy.io.fits as pyfits
import numpy
import os
from astropy.convolution import Gaussian2DKernel
log = None
def validFITSfile(arg):
... |
# this file include source code of this beautiful repositry --> https://github.com/acrosson/nlp/tree/master/subject_extraction
import warnings
warnings.filterwarnings('ignore')
import os
import sqlite3
import re
import numpy as np
from gensim.parsing.preprocessing import STOPWORDS
from nltk.tokenize import word_tokeni... |
# Copyright (C) 2020-2021 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distrib... |
#!/usr/bin/env python3
"""
Search CMIP6 datasets via `ESGF RESTful API`_, get `OPeNDAP`_ URLs and
other information of found dataset.
Basic Usage
===========
Typical flow of searching and downloading CMIP6 dataset from ESGF is as
follows;
1. create a :class:`esgfsearch.ESGFSearch` instance,
2. do search via the :meth... |
# Import libraries
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import tensorflow as tf
import plottools as pt
#print('Using TensorFlow v {}'.format(tf.__version__))
# Define a function to generate associated input and output samples
def gen_training_ex(n_inputs, seq_len, n_seq):
p = ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import jinja2
import json
import logging
import netifaces as ni
import os
import subprocess
import threading
import time
import urllib3
from odoo import http
from odoo.addons.hw_drivers.connection_manager import connect... |
import collections
import enum
import filecmp
import itertools
import shutil
import sys
import click
from .. import configs
from .common import (
check_installation, get_active_names, get_version,
set_active_versions, version_command,
)
class Overwrite(enum.Enum):
yes = 'yes'
no = 'no'
smart = ... |
import logging
import numpy as np
import pytest
import nengo
from nengo.exceptions import MovedError, Unconvertible
from nengo.utils.builder import (
full_transform,
generate_graphviz,
objs_and_connections,
remove_passthrough_nodes,
)
def test_full_transform():
N = 30
with nengo.Network():
... |
from tqdm import tqdm_notebook, tqdm, tnrange
from ModelStats import ModelStats
import torch.nn.functional as F
import torch
import sys
class Train:
def __init__(self, model, trainloader, dataloader, optimizer, stats, scheduler=None, batch_scheduler=False, L1lambda = 0, LossFunction='CrossEntropyLoss', tb=Non... |
import pandas as pd
import re
import os
def network(full_path): # full_path from FGT_Auditor.py
wordlist = ['https', 'http', 'ssh', 'telnet', 'delamrede']
null_serie = "Series([], )"
df = pd.read_csv(full_path, sep=';', header=0)
table = []
interface_added = False
for word in word... |
import re
import statistics
import attr
from clldutils.misc import slug
from pypofatu import errata
from pypofatu.util import * # noqa: F403
__all__ = [
'Contribution', 'Artefact', 'Measurement', 'Method', 'Site', 'Sample', 'Analysis', 'Location',
'MethodReference', 'MethodNormalization', 'Parameter']
ANAL... |
##############################################################################
# Copyright (c) 2007 Open Kernel Labs, Inc. (Copyright Holder).
# All rights reserved.
#
# 1. Redistribution and use of OKL4 (Software) in source and binary
# forms, with or without modification, are permitted provided that the
# following ... |
# Copyright (c) MONAI Consortium
# 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, so... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.