text stringlengths 3.07k 22.1k |
|---|
from kivy.app import App
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.properties import ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.core.text import LabelBase
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
fro... |
import argparse
import os
import time
from datetime import datetime
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from torch.utils.data.dataloader import DataLoader
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from dataset im... |
from PIL import Image, ImageDraw
import numpy as np
import torch
import torch.nn as nn
from skimage import io
import math
from torch.utils.data import Dataset, DataLoader, TensorDataset
import torch.nn.functional as F
import os
import cv2
import matplotlib.pyplot as plt
import time
# gen images
IMG_X, IMG_Y = 200,... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import pymysql
from MysqlHelper import *
import requests
import json
import time
from bs4 import BeautifulSoup
from WechatPush import *
CHAPTER_TABLE_NUM=20
MANAGE_URL = 'http://localhost/show-request-headers.php'
CUSTOM_HEADERS = {
'user-agent': 'Mozilla/5.0 (iPhone; C... |
import asyncio
import re
import discord
from discord.ext import commands
from config.utils.checks import combined_permissions_check
class Moderation(commands.Cog):
"""Moderation related commands"""
def __init__(self, bot):
self.bot = bot
self.session = bot.session
@staticmethod
asyn... |
r"""
--- Day 7: The Sum of Its Parts ---
You find yourself standing on a snow-covered coastline; apparently, you landed a little off course. The region is too hilly to see the North Pole from here, but you do spot some Elves that seem to be trying to unpack something that washed ashore. It's quite cold out, so you dec... |
"""Watched the crawled documents log queue and passes entries to w3act
Input:
{
"annotations": "ip:192.168.127.12,duplicate:digest",
"content_digest": "sha1:44KA4PQA5TYRAXDIVJIAFD72RN55OQHJ",
"content_length": 324,
"extra_info": {},
"hop_path": "IE",
"host": "acid.matkelly.com",
"jobName":... |
import unittest
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.model_selection import TimeSeriesSplit, GridSearchCV
from sklearn.pipeline import make_pipeline
from ira.analysis.tools import srows, drop_duplicated_indexes
from qlearn import Imply, Neg, Or, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 <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 TO opy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
import torch
import torch.nn as nn
import utils
import numpy as np
'''
I think we need to rethink how the combinator works
Perhaps if we add more noise, higher-level representations will work better?
Part of what we need to fix is the way that the model learns spatial representations
'''
class KIDEyeLoss(nn.Module)... |
#!/usr/bin/env python
# Copyright (c) 2021, <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 ... |
#!/usr/bin/env python3
# Do the same thing as in phylo-with-map.py, but without the outgroup clade.
# Also draw lines between phylogeny and map.
import operator
import csv
import ete3
from plot_eteTree import plot_tree2, to_coord
import cartopy
import cartopy.crs as ccrs
import numpy as np
import matplotlib
matpl... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from ..util.units import Units
def projection(sp, dim):
if dim == 0 or dim == 'z':
spx = sp['x1']
spy = sp['x2']
spz = sp['x3']
elif dim == 1 or dim == 'y':
spx = sp['x1']
spy = sp['x3']
... |
import os
from collections import OrderedDict
from configparser import ConfigParser
# import pytest
from pylcg import preferences as pr
__author__ = "<NAME> :: New Mexico Mira Project, Albuquerque"
TEST_TOP_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) # the dir holding this (test) .py file.
TEST_DATA_DIR... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
#imports libraries required for gui
from tkinter import *
from tkinter import messagebox as mb
#Global variables used in the game
x=[]
counter=1
player='X'
color='lightgreen'
list1=[['1', '2', '3'],['4', '5', '6'],['7', '8', '9']] #The cells in the board
b1,b2,b... |
"""Interface for Symbolic Functions and AutoDiff."""
import copy
from dataclasses import dataclass, asdict
from typing import Callable, Union, Iterable
from sysopt.types import Domain
from sysopt.block import Block, Composite, check_wiring_or_raise
from sysopt.helpers import flatten, strip_nones
from sysopt.symbolic... |
"""
jupylet/audio/device.py
Copyright (c) 2020, <NAME> - <EMAIL>
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
... |
import unittest
from docker_image import digest
from docker_image import reference
class TestReference(unittest.TestCase):
def test_reference(self):
def create_test_case(input_, err=None, repository=None, hostname=None, tag=None, digest=None):
return {
'input': input_,
... |
#!/usr/bin/env python3
import click
import copy
import functools
import games
import helpers
import itertools
import json
import numpy
import operator
import os
import os.path
import results_stats
import scipy.optimize
import time
def to_int(v):
return int(round(v))
def to_unsigned_int(v):
return max(int(r... |
from secrets import choice, randbelow
import configparser
import os
from zxcvbn import zxcvbn
from zxcvbn.matching import add_frequency_lists
from modules.data import *
# User configuration file.
config = configparser.ConfigParser()
config.read(os.path.realpath(__file__)[:-21] + os.sep + 'tkp.conf')
replace_path = c... |
""" Elsevier author data downloader """
from requests import Request, exceptions
from client import ElsClient, ElsSearch, ElsAuthor
from models import *
from colorama import Style, Fore
import re
import atexit
import time
import pprint as pp
import logging
import boto3
# Create an SNS client
awsclient = boto3.client(
... |
# Copyright 2019 The TensorFlow 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 applica... |
import re
from . import Processors, AnswerException
from .dependency_checker import dep_check
from .models import Answer, Question, RunInfo
from .parsers import BooleanParser, parse_checks
from .parsers import BoolNot, BoolAnd, BoolOr, Checker
from .request_cache import request_cache
def get_runinfo(random):
"Retu... |
# game-of-life_mit-ocw_musovzky.py
# Python version: 3.4.3
# Created by: Musovzky (<EMAIL>)
# Created on: July 24, 2016
# Conway's Game of Life is a zero-player game
# Run the program, and the pattern will "evolve" automatically
# This is the second project of MIT OpenCourseWare:
# A Gentle Introduction to Pro... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: stream/filter.py
# Purpose: classes for filtering iterators of streams...
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 2008-2017 <NAME> and the music21 Project
#... |
from empire.python.typings import *
from json import loads, dumps
from empire.bit.flags import has_flag
from empire.fs.list_files import list_files_within_directory
from empire.ejson.json_flatten import JSONFlatten
from empire.python.python_util import PythonUtil
from empire.util.execution_report import the_report
fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility functions models code
"""
import numpy as np
import numpy.lib.recfunctions as nprf
from six import integer_types
from six.moves import range
from sm2.compat.python import asstr2
from sm2.tools.linalg import pinv_extended, nan_dot, chain_dot # noqa:F841
from... |
import asyncio
import configargparse
import logging
import json
import sys
import aiohttp.client_exceptions
from asyncio_mqtt import Client
import asyncio_mqtt.error
from distutils.util import strtobool
from pyess.aio_ess import ESS
from pyess.ess import autodetect_ess
logger = logging.getLogger(__name__)
# The c... |
""" =============================================================================
MIT License
Copyright (c) 2018 <NAME> (bigman73)
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 r... |
"""
Remote control for Sony TVs
"""
## how to use
## python -c "execfile('main.py'); command('http://127.0.0.1', 'Home')"
## python main.py command('')
import os
import logging
import uuid
import json
import requests
logging.basicConfig(filename='SonyTV.log', level=logging.DEBUG)
APP_NAME = "Sony TV Client for Vera"... |
import io
import pytest
import libconf
# Helper functions
##################
def dump_value(key, value, **kwargs):
str_file = io.StringIO()
libconf.dump_value(key, value, str_file, **kwargs)
return str_file.getvalue()
def dump_collection(c, **kwargs):
str_file = io.StringIO()
libconf.dump_colle... |
from aenum import NamedConstant
from ...__share__ import classproperty
__all__ = ["tokenise_line", "Prefix", "Suffix", "Node"]
def has_precedent(seen, prefix):
"""
Check if there is a seen node with a given prefix.
No need to do this for suffixes as their precedent only ever checked
for directly prece... |
"""
Models definition for IETF's BCP 47 standard.
Used standard: IETF's BCP 47.
Standar RFC: http://www.rfc-editor.org/rfc/rfc5646.txt
For fun links:
https://www.w3.org/International/articles/language-tags/
https://en.wikipedia.org/wiki/IETF_language_tag
from RFC, a langtag is composed by:
langtag = language
... |
"""This file contains utility functions used for numpy data manipulation"""
import json
import logging
try:
import dicom
except:
import pydicom as dicom
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
import os
import SimpleITK as sitk
logging.basicConfig(level=logging.INFO, format='%(asc... |
import logging
from sqlalchemy import desc
from rapidpro_webhooks.apps.core.db import db
from rapidpro_webhooks.apps.fusiontables.utils import build_drive_service, build_service
from rapidpro_webhooks.settings import RAPIDPRO_EMAIL
class FT(db.Model):
id = db.Column(db.Integer, primary_key=True)
ft_id = db.... |
# -*- coding: utf-8 -*-
# Copyright 2014,2017 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import json
import os
import re
import pandas as pd
from sklearn.preprocessing import MultiLabelBinarizer
# --- basic cleaning ---#
def empty_list_to_string(x):
if isinstance(x, list) and len(x) == 0:
return ""
else:
return x
def remove_unit_signs(x):
return re.sub("\s*m²|\s*€", "", x)
... |
"""
Data:2021/08/26
Target:
从原始的nasbench101_108eps(tfrecord文件)中提取423624个结构的数据到json方便计算,共有fixed_metrics和computed_metrics两个数据
fixed_metrics
{'module_adjacency':
array(
[[0, 1, 0, 0, 1, 1, 0],
[0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 1],
[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1,... |
import imp
import random
import argparse
from typing import Union, Tuple
import numpy as np
import pandas as pd
import csv
import sys
import os
import __init__
# os.environ['CUDA_VISIBLE_DEVICES'] = '7'
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.nn import Para... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, <NAME>; Luczywo, Nadia
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the ... |
'''
[许可证条款抽取]の训练时的评测
'''
from model.data_utils import CoNLLDataset
from model.ner_model import NERModel
from model.config import Config
import numpy as np
import os
def align_data(data):
"""Given dict with lists, creates aligned strings
Adapted from Assignment 3 of CS224N
Args:
data: (dict) data... |
# -*- coding: utf-8 -*-
"""Configure labeltype model for the warning based tasks of the SpiceUp mobile app.
Used to calculate farm specific tasks from parcel location, plant age, local measurements and raster data.
Warning based tasks are generated with a Lizard labeltype. This labeltype triggers warning based tasks pe... |
#!/usr/bin/env python
# Copyright (C) 2019-2020 <NAME>
#
# This file is part of ARADEEPOPSIS.
# ARADEEPOPSIS 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 opti... |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function
import functools
import os
import sys
import pytest
import six
from packaging.version import Version
import pythonfinder
from .testutils import (
is_in_ospath,
normalize_path,
normalized_match,
print_python_versions,
)
if... |
import json
from tastypie.exceptions import TastypieError
from tastypie.http import HttpBadRequest
from django.http import HttpResponse
from tastypie.exceptions import ImmediateHttpResponse
import attr
import datetime
from enumfields import Enum
from django.contrib.gis.geos import Point
import uuid
import serpy
import... |
"""
Script plots trends of 2 m temperature over the WACC period. Subplot compares
all six experiments with ERA-Interim.
Notes
-----
Author : <NAME>
Date : 20 February 2019
"""
### Import modules
import datetime
import numpy as np
import matplotlib.pyplot as plt
import cmocean
from mpl_toolkits.basemap impor... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
from sklearn.preprocessing import LabelEncoder
import pytorch_lightning as pl
import json
import transformers
import torch
def compute_masks(mask):
one_idx = [i for i, b in enumerate(mask) if b]
zeros = torch.zeros(len(mask), dtype=torch.long)
cls_mask, sep1_mask, sep2_mask = [torch.scatter(zeros, 0, torch... |
#!/usr/bin/env python3
#
# SMNCopyNumberCaller
# Copyright 2019-2020 Illumina, Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
#
# 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
#
# ... |
from __future__ import print_function
#from . import vanilla_unet
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import glob
import skimage.io as io
import skimage.transform as trans
from skimage.util import *
import numpy as np
from keras.models import *
from keras.layers import... |
"""Model testing and validation"""
import matplotlib.pyplot as plt
import numpy as np
import time
def validate_model(model_generator, datasets_generator, epochs=50, loss_name="mean_squared_error", measure_name="val_mean_squared_error", \
print_summary=True):
"""K-fold validation of model"""
... |
import discord
from discord.ext import commands
import asyncio
import itertools
import sys
import traceback
from async_timeout import timeout
from functools import partial
#from youtube_dl import YoutubeDL
import json
import glob
import random
class MusicPlayer:
__slots__ = ('bot', '_guild', '_channel', '_cog', '... |
#!/usr/bin/env python
"""
Download interface for ASOS/AWOS data from the asos database
"""
import time
import cgi
import re
import os
import sys
import datetime
import pytz
import psycopg2.extras
from pyiem.datatypes import temperature, speed
from pyiem import meteorology
from pyiem.util import get_dbconn, ssw
def d... |
from .imports import *
from.encoders import *
from .metrics import *
from .logging import *
from .text import *
from .lm import *
from .samplers import *
from .classifiers.linear import Linear
from .utils.core import *
class LearningParameters(object):
r"""
n_cycle (int): Number of cycles.
cycle_len (int):... |
import sys
import gc
import timeit
import time
import numpy as np
import numpy.linalg as l
import torch
import torch.nn as nn
import torch.nn.functional as F
from gck_cpu_cpp import conv_fwd_3x3
from gck_layer import GCK3x3Layer
repeat_count = 100
# Compare YOLO_Lite
input = torch.randn(1,3,224,224, dtype=torch.float3... |
import argparse
import matplotlib.pyplot as plt
from plot_score_contours import load_json_dump
from algebra import get_ellipse_from_covariance
from matplotlib.colors import LogNorm
import pandas as pd
import json
import numpy as np
from plot_score_contours import load_cluster_parameters
from matplotlib import ... |
#####################################################################################
#
# Copyright (c) <NAME>. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution... |
import numpy as np
from PIL import Image
import xml.etree.ElementTree as ET
import scipy.misc as scm
def crop_center(img, bboxes, cropx,cropy):
y,x = img.shape
startx = x//2-(cropx//2)
starty = y//2-(cropy//2)
new_img = img[starty:starty+cropy,startx:startx+cropx]
bboxes[:, 0]-=starty
bboxe... |
# Classes that wrap around ui elements
# as a layer of abstraction to increase productivity
import renderer
import mathHelpers
import math
import colors
import pygame.constants as pyConst
import pygame
import textDraw
import textHelpers
import renderer
class HudScreen():
def __init__(self, inte... |
from collections import OrderedDict
import logging
import os
import random
import math
from functions import *
import pyglet
pyglet.options['debug_gl'] = False
# GLOBAL VARIABLES
ROOT = os.path.dirname(__file__)
RES_PATH = os.path.join(ROOT, "resources")
SCREENRES = (1440, 900) # The resolution for the game window
C... |
#!/usr/bin/env python
import requests
import json
import statistics
import time
import re
from pathlib import Path
gt_url = 'https://gt-scan.csiro.au'
ens_url = 'https://rest.ensembl.org'
genome_path = '/scratch1/obr17q/GRCh38'
sequence_path = './sequences'
gtscan_params = {'mismatches': 3, 'genome': 'GRCh38', 'mode'... |
# Importing necessary packages for this project
import cv2
import numpy as np
import matplotlib.pyplot as plt
# Setting seed for reproducibility
UBIT = 'damirtha'
np.random.seed(sum([ord(c) for c in UBIT]))
#-------Line Detection-------#
# Apply gradient mask on image for edge detection, given image and mask
def g... |
#!/usr/bin/env python
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge... |
import numpy as np
import pandas as pd
from sklearn.grid_search import GridSearchCV
from sklearn.model_selection import train_test_split
from keras.callbacks import EarlyStopping, ModelCheckpoint, TensorBoard
from keras.models import Model, Sequential
from keras.layers import Activation, AveragePooling2D, BatchNormal... |
import socket
import json
import threading
import sys
import argparse
import os
from datetime import datetime
from message import Message
from streaming import createMsg, streamData, initializeAES, decryptMsg, returnVector
from clientConnectionObj import ClientConnection
import pyDHE
import time
serverDH = pyDHE.new()... |
"""
UI implementation of the graphs view.
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2021, <NAME>, Bavaria/Germany'
__license__ = 'Apache License 2.0'
from kivy.uix.boxlayout import BoxLayout
from kivy_garden.graph import Graph, LinePlot
from kivy.clock import Clock
from history import SignalHistory
import... |
#!/usr/bin/python
# Imports
import subprocess
import sys
import urllib.request
import urllib.error
import re
import os
import argparse
import time
import shutil
import http.client
from PIL import Image
from joblib import *
from xml.etree import ElementTree as ET
# Global Variables
IMAGES_TOTAL = 7... |
import argparse
import time
from datetime import datetime
from hashlib import blake2b
from base58 import b58encode_check
from Faucet import Faucet
from tonclient.errors import TonException
from tonclient.types import ClientConfig, ClientError, SubscriptionResponseType, \
ParamsOfSubscribeCollection, ResultOfSubsc... |
# -*- coding: utf-8 -*-
import pytest
from doclink import arg
from doclink import utils
from doclink.exceptions import RequiredArgMissingError
from doclink.request_meta import RequestMeta
@pytest.fixture(scope='class')
def raw_args():
return dict(
raw=utils.RawArg(**{
'name': '... |
import numpy as np
import cvxpy as cvx
import pandas as pd
from uuid import uuid4
import scipy as sp
import torch as ch
from matplotlib import pyplot as plt
from scipy.stats import betabinom, beta
from scipy.optimize import minimize
from scipy.special import betainc, comb
import scipy.special
REL_IMPROVE_THRESH = 1e-3... |
import datetime
import os
import time
import torch
import torch.utils.data
from cvtk.losses.train_segmentation_with_bbox import (grid_loss, line_loss,
topk_loss)
from cvtk.models.segmentation import coco_utils, segmentation, utils
from references.segmentation.visua... |
import random
import math
from mesa import Model, Agent
from mesa.time import RandomActivation
from mesa.space import SingleGrid
from mesa.datacollection import DataCollector
class Settler(Agent):
def __init__(self, unique_id, pos, vision, breed, model):
super(Settler, self).__init__(unique_id, model)
... |
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Colmap database import as basic kapture objects functions
"""
from kapture.io.tar import TarCollection
import logging
import numpy as np
from tqdm import tqdm
from typing import Tuple, Optional
# kapture
import kapture
import kapture.io.features
# l... |
# -*- coding: utf-8 -*-
import os, sys, codecs, platform
from tkinter import *
from io import open
import tkinter.messagebox
import tkinter.filedialog
current_file = None
DIR = os.getcwd() + "/../src/"
os.chdir(DIR)
def isEmptyDir(dir):
if not os.listdir(dir):
return True
else:
return False
d... |
# Copyright 2021 The TensorFlow Probability 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... |
#!/usr/bin/python
#-*- coding: UTF-8 -*-
#
# @file: revise.py
#
# 源代码文件修改之后,运行这个脚本会自动更新代码的版本和时间
#
# @author: $author$
# @create: $create$
# @update: 2021-10-29 20:40:50
# @version: 1.0.0
########################################################################
import os, sys, stat, signal, shutil, inspect, time, datet... |
import numpy as np
import scipy as sp
from scipy.linalg import null_space
import FrankWolfeCoreset as FWC
import copy
import time
from FastEpsCoreset import sparseEpsCoreset
SMALL_NUMBER = 1e-7
def checkIfPointsAreBetween(p, start_line, end_line):
return (np.all(p <= end_line) and np.all(p >= start_line)) or (np... |
# -*- coding: utf-8 -*-
"""
Test script for jwzthreading.
"""
# pylint: disable=c0103,c0111,r0904
import textwrap
from email import message_from_string
import pytest
from jwzthreading import (Message, Container,
unique, prune_container,
thread, sort_threads)
d... |
# Copyright 2018-2021 the MIDOSS project contributors, The University of British Columbia,
# and Dalhousie University.
#
# 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... |
import argparse
import time
import pickle
import seq2seq.dataset.dataset as dataset
from seq2seq.dataset.dataset import Vocabulary
from seq2seq.util.checkpoint import Checkpoint
from seq2seq.util.seed import seed_all
from seq2seq.models import *
from split import split, generate_split_regex, generate_split_regex_in_par... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
import tensorflow as tf
import numpy as np
import ee
class Inference :
def __init__(self,num_classes,model_name):
self.num_classes = num_classes
import joblib
if 'umap' in model_name or 'pca' in model_name :
self.mapper = joblib.load('models/'+model_name+'.sav')
... |
# -*- coding: utf-8 -*-
"""
Collection of utility objects and functions for the :mod:`fluxdataqaqc`
module.
"""
import numpy as np
import pandas as pd
from pathlib import Path
class Convert(object):
"""
Tools for unit conversions for ``flux-data-qaqc`` module.
"""
# this is a work in progress, add mor... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
import random
import string
import base64
import os
import re
from jose import jwt
from jose.exceptions import JWTError
from kombu import Queue
from celery import subtask
from celery.utils import uuid
from celery import Celery, chain
from celery.utils.log import get_task_logger
from workers.find_regions.find_region... |
import os
import logging
import sys
import time
from functools import partial
import errno
import hashlib
from dateutil.parser import parse
from dateutil.tz import tzlocal
from botocore.compat import quote
from awscli.customizations.s3.utils import find_bucket_key, \
uni_print, guess_content_type, MD5Error, bytes... |
# Copyright 2004-2021 <NAME> <<EMAIL>>
#
# 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,... |
from typing import Tuple, Optional
import logging
from pathlib import Path
import shutil
import random
import numpy
from datasets import load_dataset
import json
import torch
from transformers import DataCollatorForSeq2Seq
from transformers import T5ForConditionalGeneration, T5Model, AutoTokenizer
from omegaconf import... |
from tkinter import *
from pymysql import *
import windows_control
import datetime
#连接数据库
db = connect(
host = 'localhost' ,port = 3306 ,user = 'root' ,password = '<PASSWORD>' ,database = 'test'
)
#实例化数据库对象
cur = db.cursor()
#字典
#此刻正在操作的员工
opration = {
'id':'',
'name':'',
}
#列表
commodity = ['果汁','毛巾','... |
from collections import namedtuple as _namedtuple
from intent_parser.intent_parser_exceptions import ConnectionException
from difflib import Match
from http import HTTPStatus
import json
import Levenshtein
import re
IPSMatch = _namedtuple('Match', 'a b size content_word_length')
def get_google_doc_id(doc_url):
... |
''' a package of exception classes '''
__author__ = 'rcj1492'
__created__ = '2016.01'
__license__ = 'MIT'
class ModelValidationError(Exception):
def __init__(self, message='', error_dict=None):
text = '\nModel declaration is invalid.\n%s' % message
self.error = {
'message': message
... |
from datetime import datetime
from multiprocessing.pool import ThreadPool
from config.constants import (
CONCURRENT_NETWORK_OPS, CHUNKS_FOLDER, CHUNKABLE_FILES,
PROCESSABLE_FILE_EXTENSIONS, data_stream_to_s3_file_name_string,
)
from libs.file_processing import process_file_chunks
from libs.s3 import s3_list_fi... |
from typing import Tuple, Union
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.ticker import PercentFormatter
from mne import create_info
from mne.viz import plot_topomap
from ..utils._checks import _check_participants
from ..utils._docs import fill_doc
from ..utils.alig... |
from datetime import timedelta
from typing import Iterable, Optional, cast
from openpyxl.cell import Cell
from openpyxl.styles import Font
from openpyxl import Workbook
from openpyxl.worksheet.worksheet import Worksheet
from lxml import etree
from lxml.etree import SubElement
import package.utilities as utils
from pa... |
import argparse
from collections import defaultdict
from uge2slurm.commands.argparser import set_common_args, parse_ge_datetime
from uge2slurm.utils.py2.argparse import HelpFormatter
parser_args = dict(
description="Mapping UGE qsub command to slurm",
add_help=False,
formatter_class=HelpFormatter
)
clas... |
"""
pylibftdi.driver - interface to the libftdi library
Copyright (c) 2010-2014 <NAME> <<EMAIL>>
See LICENSE file for details and (absence of) warranty
pylibftdi: https://github.com/codedstructure/pylibftdi
"""
import itertools
from collections import namedtuple
# be disciplined so pyflakes can check us...
from ct... |
import pandas as pd
from pathlib import Path
import pylab as pl
import my_figure as myfig
from scipy.stats import ttest_ind, ttest_1samp
import numpy as np
from tqdm import tqdm
import cv2
from deepposekit.io import DataGenerator
from matplotlib.colors import to_rgb
import imageio
from PIL import Image
#from my_general... |
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNorm(nn.Module):
r"""Applies Layer Normalization over a mini-batch of inputs as described in
the paper `Layer Normalization`_ .
.. math::
y = \frac{x - \mathrm{E}[x]}{ \sqrt{\mathrm{Var}[... |
# coding: utf-8
# Começando com os imports
import csv
import matplotlib.pyplot as plt
# Vamos ler os dados como uma lista
print("Lendo o documento...")
with open("chicago.csv", "r") as file_read:
reader = csv.reader(file_read)
data_list = list(reader)
print("Ok!")
# Vamos verificar quantas linhas nós temos
p... |
#Fourier Coefficient PCA vizualizer using Dash
# Relevant references
# Dash tutorial: https://www.youtube.com/watch?v=hSPmj7mK6ng&ab_channel=CharmingData
# Did similar layout to: https://github.com/plotly/dash-svm/blob/master/app.py
#Plotting
import dash
import dash_core_components as dcc
import dash_html_compone... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.