text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
import os
import json
import boto3
import argparse
import os
import sys
from PIL import Image
import keras
import tensorflow as tf
from object_detector_retinanet.keras_retinanet import models
from object_detector_retinanet.keras_retinanet.preprocessing.csv_generator import CSVGenerator
from obj... |
#!/usr/bin/env python3
try:
import tornado.ioloop
import tornado.web
import tornado.websocket
import tornado.template
from tornado import locks, gen
from tornado.platform.asyncio import AsyncIOMainLoop
from tornado import gen
from tornado.options import options, define
from tornado.queues import Queue
except ... |
from __future__ import print_function # 캘린더 API
from PIL import Image, ImageTk
from contextlib import contextmanager
from tkinter import *
from urllib.request import urlopen, Request
import urllib
import bs4
import time
import feedparser
# 캘린더 API
import datetime
import pickle
import os.path
from googleapiclient.disco... |
##### SOLVING VIBRATIONS PROBLEMS BY NUMERICAL METHODS #####
import numpy as np
import numpy.linalg as la
import Dynas as dyn
import pandas as pd
import matplotlib.pyplot as plt
K = np.array([[ 8, -4, 0],
[-4, 8, -4],
[ 0, -4, 4]])
M = np.diag([4, 4, 4])
def modal_analysi... |
import numpy as np
from random import randint
def flip(image, option_value):
"""
Args:
image : numpy array of image
option_value = random integer between 0 to 3
Return :
image : numpy array of flipped image
"""
if option_value == 0:
# vertical
image = np.fli... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author: 蘑菇君
# @Date : 2021/01/03
# @Desc : 自动获取免费代理IP
import threading
from rules import *
proxy_ok_ip = [] # 验证后的代理IP列表
# 复写Thread类
class MyThread(threading.Thread):
def __init__(self, func, args):
threading.Thread.__init__(self)
self.func = ... |
from typing import List, Optional, Tuple
import cv2
import numpy as np
from l5kit.data.zarr_dataset import AGENT_DTYPE
from l5kit.data.filter import filter_agents_by_labels, filter_agents_by_track_id
from l5kit.geometry import rotation33_as_yaw # , transform_points
from l5kit.rasterization.rasterizer import EGO_EXTE... |
# -*- coding: utf-8 -*-
"""
"""
import pickle
import numpy as np
import pytest
from cslug import ptr
from rockhopper import RaggedArray
from rockhopper._ragged_array import _2_power, _big_endian
pytestmark = pytest.mark.order(3)
def test_2_power():
assert _2_power(np.int8) == 0
assert _2_power(np.int16) =... |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import json
import logging
import os
from io import BytesIO
from xml.dom import minidom
from xml.sax.saxutils import escape
from testcase import const
from testcase.parser import config
from testcase.utils import get_xmind_testsuites, get_xmind_testcases, get_absolute_path
... |
from collections import Counter
import csv
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from pathlib import Path
from pprint import pprint
import re
import sys
from typing import Dict, List, Tuple
import click
import html2text
import MeCab
from readability import Document
import requests
from sklearn.feat... |
from collections import deque
from twisted.python import log
from twisted.internet import protocol
from twisted.application import service
from DataObjects.battle import Battle
from DataObjects.player import *
from verifyProtocol import *
class BattleProtocol(JsonReceiver):
STATE_AWAITING_OPPONENT = 1
... |
import numpy as np
import torch as th
from torch import nn
from torch.nn import init
from braindecode.models.base import BaseModel
from braindecode.torch_ext.modules import Expression
from braindecode.torch_ext.functions import safe_log, square
from BiModNeuroCNN.models.network_utils import reshape_tensor, resha... |
"""Initial
Revision ID: 1f1e9d3f7891
Revises:
Create Date: 2015-03-04 04:14:06.639097
"""
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by A... |
# Copyright 2022 <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... |
import datetime
from discord.ext import commands
import discord
from .util.categories import category
class Core:
@category('info')
@commands.command()
async def help(self, ctx, *args):
'''This help message :D'''
cmds = {i for i in ctx.bot.all_commands.values()}
if len(args) == ... |
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
from functools import partial
nonlinearity = partial(F.relu, inplace=True)
class DACblock(nn.Module):
def __init__(self, channel):
super(DACblock, self).__init__()
self.dilate1 = nn.Conv2d(
... |
import tensorflow as tf
import numpy as np
import pdb
import os
from datetime import datetime
import slim.net.inception_v1 as inception_v1
from create_tf_record import *
import tensorflow.contrib.slim as slim
from tensorflow.python.ipu.scopes import ipu_scope
from tensorflow.python.ipu import utils
from tensorflow.pyt... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 27 12:35:21 2017
@author: pudutta
"""
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import nltk
import gensim
from nltk.corpus import brown
from nltk.corpus import stopwords
from nltk.tag import StanfordNERTagge... |
# -*- coding: utf-8 -*-
"""
This module provides a set of helper functions to make mayavi scenes into
nice plots. It also provides routines for the visualisation of flux surfaces.
"""
import numpy as np
from mayavi import mlab
__all__ = ['set_text', 'set_cbar_text', 'add_axes', 'add_cbar_label',
'add_colo... |
#coding: utf-8
import pytest
import numpy as np
from psydac.core.bsplines import ( find_span,
basis_funs,
basis_funs_1st_der,
basis_funs_all_ders,
collocation_matrix )
#==============================================================================
@pytest.mark.parametrize( 'lims', ([0... |
# -*- coding: utf-8 -*-
"""
PROJECT 1 - DEEP LEARNING
test.py
<NAME>, <NAME> and <NAME>
Obtain the results provided in the report
"""
from models import *
from bci_dataset import *
import torch
from utils import *
from sklearn.svm import SVC # "Support vector classifier"
def run_test_CNN(train_loader, test_loade... |
"""
Utilities for computing crops and normalizing images
"""
import numpy as np
import torch
import os
import h5py
import scipy
from typing import List
def getCropsForDataset(
dataset_file : str, dataset_name : str,
num_crops : int,
crop_size : int, offset_factor : int,
fill_rate_percent : int, mask_... |
import torch
import torchfile
from torch.utils.data import Dataset, DataLoader
import os
import numpy as np
from PIL import Image
from torchvision import transforms
from torch.utils.data.sampler import SubsetRandomSampler
import torch.nn as nn
import torch.nn.functional as F
from itertools import cycle
import matplotli... |
# ==================================================================================
# Copyright (c) 2020 AT&T Intellectual Property.
# Copyright (c) 2020 Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 11:13:42 2015
@author: jessime
Warnings
--------
* A lot of this code is dependent on GENCODE formatted fasta files.
* The C code in the shuffle function will segfault if the string is too big.
This will cause the Python Kernel to crash.
Issues
------
1. Filters are ... |
"""
This module defines the CircuitModel abstract base class.
A CircuitModel models a large unitary as a circuit of gates.
This enables the decomposition of unitaries.
All model plugins must extend this class and implement the
functionality outlined here.
"""
import abc
import numpy as np
import functools as ft
im... |
import datetime
import os
import pickle
import platform
import subprocess
import sys
from argparse import ArgumentParser
from collections import Counter
from math import ceil, floor, sqrt
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
plt.rcParams["toolbar"]... |
import numpy as np
import tensorflow as tf
from keras import initializers
from keras.models import Model
from keras.layers import Embedding, Input, Dense, Flatten, concatenate, Dot, Lambda, multiply, Reshape, multiply
from keras.optimizers import Adagrad, Adam, SGD, RMSprop
from keras import backend as K
from id.DeepCF... |
#!/usr/bin/env python3
# import pprint
import os
from datetime import datetime
# from nltk.metrics.agreement import AnnotationTask
# from krippendorff import alpha
# from pprint import pprint
from pydactyl.dactyler.Dactyler import Dactyler
from pydactyl.dactyler.Parncutt import Parncutt, Jacobs, Badgerow
from pydactyl.... |
from app import app, db, devel_site
from app.staticdata import TabColor, TabSex, TabHair, FAidSpecial
from app.models import User, Cat, VetInfo, Event
from app.helpers import cat_delete
from flask import render_template, redirect, request, url_for, session
from flask_login import login_required, current_user
from sqlal... |
import random
import time
def mostrarInstrucciones():
instrucciones="******************************************************\
***************\n"+\
"*** || || |||||||||| || || || ||\n"+\
"** |||| |||| || || || || || ||\n"+\
"* ||... |
import os
from pandas import to_datetime
from xspectre.utils.image import ExistingImage, ArrayImage
# TODO: replace this file with a settings file
def hk_model_reshape(
original_image_filename, output_filename, image_hdu=1, x_scale=-1/0.925, y_scale=-1/0.93,
x_translation=269, y_translation=161, ro... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-11-25 16:14
import os
import shutil
import sys
from collections import defaultdict
from os import listdir
from os.path import join, isfile
from typing import List
from phrasetree.tree import Tree
from hanlp.components.parsers.conll import read_conll
from hanlp.util... |
""" Helpers for dealing with RGB(A) images.
"""
import functools
from typing import Any, List, Optional, Tuple
import numpy as np
import xarray as xr
from ._interop import is_dask_collection
# pylint: disable=import-outside-toplevel
def is_rgb(x: xr.DataArray):
"""
Check if array is RGB(A).
"""
if ... |
from mojo.subscriber import Subscriber, registerGlyphEditorSubscriber
from mojo.UI import CurrentGlyphWindow
from mojo.UI import getGlyphViewDisplaySettings
from lib.tools.defaults import getDefaultColor, getDefault
from fontTools.misc.fixedTools import otRound
from lib.tools.misc import NSColorToRgba
import merz
fro... |
"""Tests for Sloan ETL"""
import datetime
from decimal import Decimal
import pytest
import pytz
from bs4 import BeautifulSoup
from course_catalog.etl.see import (
transform,
extract,
_parse_run_dates,
_parse_topics,
_parse_price,
)
short_description = "Sed elementum tempus egestas sed sed risus ... |
import cv2
import numpy as np
import os
from tkinter import *
import math
import argparse
from tkinter.filedialog import askopenfilename
from matplotlib import pyplot as plt
# Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
# filename = askopenfilename() # show an "Open" dialog box a... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Intel Corporation, 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.or... |
import logging
import os
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Fieldset, Layout, Submit
from django import forms
from django.core.exceptions import ValidationError
from django.forms import Form
from django.utils.translation import ugettext_lazy as _
from rest_framework.revers... |
import numpy as np
import tempfile
import unittest
import os
import shutil
import hypothesis.strategies as hst
from hypothesis import given, settings
import strax
from strax.testutils import Records, Peaks, run_id
def test_growing_result():
@strax.growing_result(np.int64, chunk_size=2)
def bla(_result_buffer=... |
"""Test the wonk.models module."""
import json
from string import ascii_lowercase
import pytest
from wonk import models
STATEMENT_SIMPLE = {
"Action": {"SVC:Action1", "SVC:Action2", "SVC:Action3", "SVC:Action4", "SVC:Action4"},
"Effect": "Allow",
"Resource": "*",
}
STATEMENT_NOTACTION = {
"Effect":... |
import numpy as np
from matplotlib import pyplot as plt
from csv import read_csv
from colour_names import name_colour
def do_hist(v):
v = [vi for vi in v if not np.isnan(vi)]
bins, edges = np.histogram(v, bins='auto', density=True)
#bins = np.divide(bins, len(v))
edges = np.average([edges[1:], edges[:... |
# Copyright 2018 U.C. Berkeley RISE Lab
#
# 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 python
# -*- coding: utf-8 -*-
'''
Created by: <NAME>
Email: <EMAIL>
Text Normalization: V1
'''
import sys
import re
#sys.setdefaultencoding('utf-8')
##########################Clean Text Data #######################################
########################Global Variable Declaration###################... |
"""Setup for the AI Feynman software components
Copyright (C) 2015 <NAME> (<EMAIL>)
Copyright (C) 2019, 2020 <NAME> (<EMAIL>)
This file basically just uses CMake to compile the given project.
To build the package:
python3 setup.py build
To build and install:
python3 setup.py install
To package the wheel (... |
import cv2 as cv
import numpy as np
import copy
import os
import time as mytime
def parse_block(val):
is_horizontal = (val & (1 << 7)) != 0
len_ = ((val & (1 << 6)) >> 6) + 2
row = (val >> 3) & (2 ** 3 - 1)
col = val & (2 ** 3 - 1)
return Block(row, col, len_, is_horizontal)
class Block:
def... |
# -*- coding: utf-8 -*-
from __future__ import division
__copyright__ = "Copyright (C) 2014 <NAME>"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... |
# -*- coding: utf-8 -*-
"""
Cooperative ``contextvars`` module.
This module was added to Python 3.7. The gevent version is available
on all supported versions of Python. However, see an important note
about gevent 20.9.
Context variables are like greenlet-local variables, just more
inconvenient to use. They were desi... |
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import chainer
from chainer.datasets import TransformDataset
from chainer.optimizer_hooks import WeightDecay
from chainer import serializers
from chainer import training
from chainer.training import extensions
from ... |
#!python
class Node(object):
def __init__(self, data):
"""Initialize this node with the given data."""
self.data = data
self.next = None
def __repr__(self):
"""Return a string representation of this node."""
return 'Node({!r})'.format(self.data)
class LinkedList(obj... |
import re
import traceback
def parseUserAgent(useragent):
uasplit = splitUserAgent(useragent)
if not uasplit:
return {}
if not seemsLikeANormalUA(useragent):
return None#{'text': useragent}
parsed = {}
url = getURLFromUA(useragent)
if url is not None:
parsed.update... |
# Copyright (c) 2014, Fundacion Dr. <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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import socket
import sys
import struct
import pickle
import time
import pprint
import traceback
import subprocess
import Queue
import threading
import logging
import server_option_parser
# for importing in systems where "." ... |
"""This module contains all logic to manage grammars. It includes classes for Non Terminal, Terminal, Variables and the
Grammar itself."""
import re
import functools
from operator import mul
from threading import Lock
from enum import Enum
import numpy as np
class ProbabilisticModel(Enum):
"""Enum defining proba... |
# -- Imports --------------------------------------------------------------------------
from sanic import __version__
from sys import version_info
from orjson import loads
from requests import post
from .. import moca_modules as mzk
from .. import core
# ---------------------------------------------------------------... |
#!/usr/bin/env python
# Convert data from msaccess to mysql
from collections import OrderedDict
import re
import os
# def load_ciudades():
# ciudades = {}
# data = open('ciudad.sql', 'r').readlines()
# for row in data[1:]:
# id, nombre, prov = split_fields(row.strip())
# ciudades[id] = (n... |
'''Quantile regression trees'''
from sklearn.tree import BaseDecisionTree, DecisionTreeRegressor
from sklearn.utils import check_array, check_X_y
from typing import Optional, Union, Sequence, Tuple
import numpy as np
from .utils import weighted_percentile
FloatArray = Sequence[float]
NumericArray = Sequence[Union[fl... |
import FreeCAD
import FPEventDispatcher
from FPInitialPlacement import InitialPlacements
import FPSimServer
import generated.python.FPSimulation_pb2 as Proto
lastRotationIncrementsAtAquire = dict()
buttonState = dict()
class FPSimRotaryEncoder(InitialPlacements):
def __init__(self, obj):
InitialPlacement... |
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
import numpy as np
import os
import sys
import h5py
import torch
import torch.nn as nn
import itertools
import operator
from collections import Orde... |
"""
Author: <NAME>
Student number: 1234358
Email: <EMAIL>
Program file GCG_utils.py
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tqdm import tqdm
from scipy.io import loadmat
from tabulate import tabulate
def get_MNIST(conv_reshape, normalize=True):
"""
Loads and retur... |
#!/usr/bin/env python3
"""
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein mu... |
import math
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.keras.models import Model
from loss.sat import softplus_mixed_loss, softplus_loss
from model.mlp import NeuroCoreMLP
from utils.parameters_log import *
from utils.sat import is_batch_sat
class NeuroCoreQuery(Model):
def __i... |
import numpy
from scipy import spatial
from pointpats import distance_statistics as ripley, geometry, random
from libpysal.cg import alpha_shape_auto
import pygeos
import warnings
import pytest
points = numpy.asarray(
[
[66.22, 32.54],
[22.52, 22.39],
[31.01, 81.21],
[9.47, 31.02],
... |
import sys
import pkg_resources
from parselmouth import PraatError
from parselmouth.praat import run_file
import pandas as pd
import numpy as np
from scipy.stats import binom
from scipy.stats import ks_2samp
from scipy.stats import ttest_ind
import os
def get_praat_script_path():
return pkg_resou... |
import torch.multiprocessing
from transformations import rotate, translate, Filter, get_vingette_mask
import argparse
import torch
import torch.nn as nn
import sys
from util import str2bool, Logger
import torch.backends.cudnn as cudnn
from datetime import datetime
import random
import os
import glob2 as glob
import num... |
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Allows creation of i2c interface via libftdii2c (C) library for FTDI devices.
"""
import ctypes
import logging
import common as c
import ftdi_comm... |
import socket
import numpy,enum
from time import sleep
class serial_port:
debug = False
def __init__(self, sock_addr):
self.delay = 0.05
self.sock = socket.create_connection(sock_addr)
def comm(self, data, n_ret=32):
""" data: hex string (a list) to be sent
n_ret:... |
# -*- coding: utf-8 -*-
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
""" This module is responsible to run the analyzer commands. """
import os
import os.path
import tempfile
import functools
imp... |
#!/usr/bin/python
DOCUMENTATION = '''
---
module: comware_config
short_description: Back uo current configuration to the specified file
description:
- Back uo current configuration to the specified file
version_added: 1.8
category: System (RW)
author: liudongxue
notes:
- This modules backup the config to s... |
import json
import MalmoPython
from textworld.logic import State, Variable, Proposition, Action, Rule
from xml.etree import ElementTree as ET
from parse_mission_xml import namespace
from constants import *
from math import sin, cos, exp
class MalmoLogicState(State):
def __init__(self, facts=None, actions=[], trigg... |
import torch
import numpy as np
import math
import util.const as const
import util.run_length as run_length
import util.submit as submit
__all__ = [ 'pad_image', 'generate_tile_names', 'get_tile_layout', 'get_img_name', 'get_tile', 'stitch_predictions', 'merge_preds_if_possible' ]
def remove_tile_borders(image, til... |
import copy
import numpy as np
import sympy as sp
import scipy.sparse
import matplotlib.pyplot as plt
import cvxpy
def __vectorize__(M):
'''
Converts M (a n by k matrix) into a colum of n*k height,
where each column of M is stacked on top of the other.
Parameters
----------
M : 2D numpy Matri... |
from Sequences.Manipulations import offset
from Sequences.Simple import naturals, sign_sequence
from Sequences.MathUtils import poly_mult
from Sequences.Divisibility import primes
from itertools import cycle
def factorials():
"""
Factorial Numbers: Product of the the first n positive integers\n
OEIS A0001... |
import time
import sys
from collections import OrderedDict
from metadata_parser.utils import time_memory_track
"""Step 03 (D): Function for Table To VCF"""
@time_memory_track
def fnc_table_to_vcf(infile, meta_header, outfile, samples, formats, infos, genotype_is):
print("converting Table file to VCF")
begin... |
#! /usr/bin/env python3
# coding: utf-8
'''
虚拟宠物猫游戏
在达成题目要求的前提下,增加了手动存档读档、死亡后删档并保存游玩记录等功能。
加入了游戏秘籍以便调试,用法如下:
首先输入"cheatmode",来激活调试模式,然后输入"property=value"
例如输入"health=100"可以将生命值调整为100
可以调节的属性有hungry, happiness, health和hours
有关os.system的代码仅在 Windows和Linux 下测试过,因此对于mac的兼容性未知。
'''
__author__ = 'hejk2008 (<NAM... |
#! /usr/bin/python3
#
# Copyright (c) 2018 <NAME> <<EMAIL>>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... |
'''
Created on Oct. 30, 2019
Main script for DSE simulation (SimDSE)
@file simulator_master.py
@author <NAME>
@date 2019.10.30
@version 0.1
@company University of Alberta - Computing Science
'''
import os
import sys
import csv
import mosaik
import argparse
from datetime import datetime
import numpy as np
fro... |
import ast
from mkinit.util.orderedset import OrderedSet as oset
__all__ = [
"TopLevelVisitor",
]
_UNHANDLED = None
class TopLevelVisitor(ast.NodeVisitor):
"""
Parses top-level attribute names
References:
# For other visit_<classname> values see
http://greentreesnakes.readthedocs.i... |
import os
import cv2
import sys
import time
import socket
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import scipy.misc as sm
import numpy as np
import scipy.io as sio
from os import listdir, makedirs, system
from argparse import ArgumentParser
from utils import *
from det_lstm import DET_LSTM
d... |
import re
from typing import List
from django.db.models.expressions import RawSQL
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.db.models import Count, Value
from rest_framework import mixins, serializers
from rest_framework.decorators import api_view, permission_classe... |
import numpy as np
import torch
from torch import Tensor
from typing import Union, Tuple
def initialize(X: Tensor, num_clusters: int, method: str='plus') -> np.array:
r"""
Initialize cluster centers.
:param X: matrix
:param num_clusters: number of clusters
:param method: denotes different initiali... |
import csv
import pandas as pd
import collections
from numpy import matrix, rank
from numpy.linalg import matrix_rank
import networkx as nx
#import matplotlib.pyplot as plt
import numpy
import sys
import heapq
#from GF import GF
import sympy
from scipy.linalg import lu
import timeit
import matplotlib
matplotlib.use(... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# TensorFlow Chessbot
# This contains ChessboardPredictor, the class responsible for loading and
# running a trained CNN on chessboard screenshots. Used by chessbot.py.
# A CLI interface is provided as well.
#
# $ ./tensorflow_chessbot.py -h
# usage: tensorflow_chessbot.p... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, random, sys, time
import urllib.parse
from selenium import webdriver
from bs4 import BeautifulSoup
def Launch():
# Check if the file 'config' exists, otherwise quit
if os.path.isfile('config') == False:
print ('Error! No configuration file.')
... |
import diffrax
import jax
import jax.numpy as jnp
import pytest
from helpers import random_pytree, shaped_allclose, treedefs
def test_fill_forward():
in_ = jnp.array([jnp.nan, 0.0, 1.0, jnp.nan, jnp.nan, 2.0, jnp.nan])
out_ = jnp.array([jnp.nan, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0])
fill_in = diffrax.misc.fill_... |
import requests, urllib3, datetime, time, smtplib, ssl, email, json
from email.mime.multipart import MIMEMultipart
from email.mime import text
### Used to disable Insecure warning despite using https...
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
basicAuth = requests.auth.HTTPBasicAuth('[SPLUN... |
import argparse
import os
import shutil
import sys
from argparse import ArgumentParser
from subprocess import PIPE, run, STDOUT
from clearml import Dataset, Task
from pathlib2 import Path
from iva.common.magnet_train import main as train_tlt
def parse_known_args_only(self, args=None, namespace=None):
return sel... |
# Data Parallel Control (dpctl)
#
# Copyright 2020-2021 Intel Corporation
#
# 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.... |
# import libraries
from nltk.tokenize import TweetTokenizer
from sqlalchemy import create_engine
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfTransformer, CountVectorizer
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_mode... |
""" Exmod utils """
import ast
from ast import Assign, Expr, ImportFrom, List, Load, Module, Name, Store, alias
from functools import partial
from inspect import getfile, ismodule
from itertools import chain
from operator import attrgetter, eq
from os import extsep, makedirs, path
from cdd import emit
from cdd.ast_ut... |
import datetime
import sqlite3
import time
import os
from os import linesep
import io
import discord
from Bot import error_embed, success_embed, no_dm
from discord.ext import commands
# Snipe
channels = {}
# Editsnipe
beforemsg = {}
aftermsg = {}
# Usersnipe
users = {}
# Multisnipe
multi = {}
time... |
"""Parse to and from a JSON file format for isotherms."""
import json
import pandas
from ..core.isotherm import Isotherm
from ..core.modelisotherm import ModelIsotherm
from ..core.pointisotherm import PointIsotherm
from ..modelling import get_isotherm_model
from ..utilities.exceptions import ParsingError
from ..util... |
#!/usr/bin/env python
import time
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits import mplot3d
from drone_navigation.srv import PointQuery, PointQueryRequest, PointQueryResponse
from drone_navigation.srv import TrajectoryQuery, TrajectoryQueryRequest, TrajectoryQueryResponse
from drone_navig... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This script helps you to insert specific kernels (specs in json files) into our kernel_db
Some more explains to customize it for your needs
param_list : specify the parameters and their data types for a certain type of kernel
gen_key ... |
# -*- coding: utf-8 -*-
"""
Web-app model for AWS lambda
"""
import biosteam as bst
from chaospy import distributions as shape
import biorefineries.cornstover as cs
sys = cs.cornstover_sys
tea = cs.cornstover_tea
model = bst.Model(sys, exception_hook='raise')
# ======================================================... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# file: extensions.py
# authors: <NAME>, <NAME>
# ---
# license: the mit license
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restrict... |
#! /usr/bin/env python
#-*- coding: utf-8 -*-
"""
mainpage.py - this is the place where everything is happening, the user will never
ever see a page change during the whole visit. Everything the user iw
shown is injected as a LiveElement into the page and deleted after it
has ... |
# coding=utf-8
# Copyright 2021 The Meta-Dataset 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 ... |
'''
Aggregate lineage .dat files, extract genotype sequences and compressed phenotype sequences.
'''
import argparse, os, copy, errno, csv, subprocess, sys, statistics
output_dump_dir = "./avida_analysis_dump"
treatment_whitelist = ["change", "l9", "empty", "limres"]
tasks = ["not", "nand", "and", "ornot", "or", "a... |
from datetime import datetime
import requests
import json
from m3u8 import M3U8
from Crypto.Cipher import AES
from Sakurajima.models.relation import Relation
from Sakurajima.models.recommendation import RecommendationEntry
from Sakurajima.models.chronicle import ChronicleEntry
from Sakurajima.models.media import Media
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.