text stringlengths 3.07k 22.1k |
|---|
# To add a new cell, type '# #'
# To add a new markdown cell, type '# # [markdown]'
# # [markdown]
# # 6.4 循环神经网络的从零开始实现
# #
import time
import math
import numpy as np
import torch
from torch import nn, optim
import torch.nn.functional as F
import sys
sys.path.append('././code')
import d2lzh_pytorch as d2l
device = ... |
"""
This module contains the basic transformer to traverse and change an AST as
well as constants used during translation.
Classes:
Transformer -- Base class to modify ASTs.
ProgramTransformer -- Class to rewrite parity constraints.
Functions:
str_location -- Turn a location into a string.
Constants:
g_aux_na... |
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from ou_noise import OUNoise
from replay_buffer import ReplayBuffer
from utils import hard_update, soft_update
import random
from model import Actor, Critic
def rand_from_seed(seed):
random.seed(seed)
retur... |
import os
import shutil
import pytest
import psutil
import smartsim
from smartsim import Experiment
from smartsim.database import (
CobaltOrchestrator, SlurmOrchestrator,
PBSOrchestrator, Orchestrator,
LSFOrchestrator
)
from smartsim.error.errors import SSUnsupportedError
from smartsim.settings import (
... |
# Copyright 2020-2021 Huawei Technologies Co., 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 applicable law or agre... |
from pycocotools.coco import COCO
import sys, os
from dataset.image_base import *
class MuPoTS(Image_base):
def __init__(self,train_flag=True, split='val', **kwargs):
super(MuPoTS,self).__init__(train_flag)
self.data_folder = os.path.join(self.data_folder,'MultiPersonTestSet/')
self.split ... |
#! /usr/bin/python3
#
# @(!--#) @(#) rpass.py, version 003, 01-july-2020
#
# verify and (optionally) change password on one or more Raritan PDUs
#
############################################################################
DEBUG = False
############################################################################
i... |
from ..visualize import plot
from ..utils import use_gpu, seed, U
from ..data_structures import DotDict
import framework
import os
import shutil
import sys
from datetime import datetime
import socket
from typing import List, Callable, Optional, Any
from .saver import Saver
from .argument_parser import ArgumentParser
im... |
# @th3_protoCOL
import os, re, csv, time, json, jsbeautifier, requests, zipfile, urllib
from tqdm import tqdm
from bs4 import BeautifulSoup
from elasticsearch import Elasticsearch
class EXT_Analyze():
def __init__(self, id):
self.id = id
ext_name = str(requests.get("https://chrome.google.com/webst... |
#!/usr/bin/python
import logging, pdb
import cPickle, gzip
import numpy
import bisect
from functools import wraps
from collections import namedtuple
LOG_LEVEL_CONSOLE = logging.INFO
LOG_LEVEL_FILE = logging.DEBUG
RESULTS_PATH="/v/rg/shental2/groupData/zahi/results/synthetic/"
LOG_FILE = RESULTS_PATH + "ctwc__logger.l... |
import pytest
from model_mommy import mommy
from rest_framework.test import APIClient
from reqs.models import Agency, AgencyGroup, Policy, Requirement, Topic
@pytest.mark.django_db
@pytest.mark.parametrize('path,num_results', (
('/topics/', 10),
('/topics/?name=0000000000', 1),
('/topics/?name=000000', 0... |
import tkinter as tk
from tkinter import *
from tkinter import Message ,Text
import cv2
import os
import shutil
import csv
import numpy as np
from PIL import Image, ImageTk
import pandas as pd
import datetime
import time
import tkinter.ttk as ttk
import tkinter.font as font
#from RegistrationPage import R... |
import os
import sys
import webapp2
import json
import jinja2
import datetime
import logging
from google.appengine.ext import db
from google.appengine.api import memcache
from google.appengine.api import users
from webapp2_extras import sessions
from google.appengine.api import mail
template_dir = os.path.join(os.p... |
import functools
import os
import sys
import pandas as pd
import torch
from robustcode.models.modules.dgl.gcn import GCNNet
from robustcode.models.modules.dgl.ggnn import GGNNNet
from robustcode.models.modules.dgl.utransformer import GraphModel
from robustcode.models.modules.dgl.utransformer import UGraphTransformer
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020, <NAME>
# All rights reserved.
#
# Licensed under the BSD 3-Clause License:
# http://opensource.org/licenses/BSD-3-Clause
#
'''
Base classes for representing material objects.
'''
import collections
import importlib
import re
from typing import Dict, List, Optional, Se... |
#!/usr/bin/env python
"""
A script to lint and test ProxyFS project code.
"""
from __future__ import print_function, unicode_literals
from threading import Timer
import os
import argparse
import functools
import logging
import platform
import contextlib
import subprocess
import shutil
import sys
import tempfile
impo... |
import json
import logging
import os
from argparse import Namespace
from collections import defaultdict
import click
import seqeval.metrics
import torch
from torch.utils.data import DataLoader, RandomSampler
from torch.utils.data.distributed import DistributedSampler
from tqdm import tqdm
from transformers import WEIG... |
"""Some code is borrowed and adapted from:
https://github.com/DM-Berger/unet-learn/blob/6dc108a9a6f49c6d6a50cd29d30eac4f7275582e/src/lightning/log.py
https://github.com/fepegar/miccai-educational-challenge-2019/blob/master/visualization.py
"""
from pathlib import Path
from typing import Any, List, Tuple, Union, Option... |
import argparse
import json
import os
import sqlite3
import tqdm
class SQLiteHelper:
create_pkg_table = ('''CREATE TABLE IF NOT EXISTS pkgs (
pid integer primary key autoincrement,
pkg text,
version text);''')
cre... |
import torch
from torch import multiprocessing, cuda
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.backends import cudnn
import numpy as np
import importlib
import os
import voc12.dataloader
from misc import torchutils, imutils
import cv2
cudnn.enabled = True
from step.gradCAM imp... |
# Licensed under Apache License Version 2.0 - see LICENSE
import pytest
import iteration_utilities
from iteration_utilities import Seen
import helper_funcs as _hf
from helper_cls import T
def test_seen_new_None1():
# seenset=None is identical to no seenset
assert Seen(None) == Seen()
def test_seen_new_No... |
# coding=utf-8
# Copyright 2021 The Trax 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 or a... |
import numpy as np
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
from sklearn.model_selection import train_test_split as tt_split
from sklearn.metrics import r2_score
import warnings
warnings.filterwarnings('ignore')
# 计算方差
class squaredError:
def __init__(self) -> None:
pass
... |
#!/usr/bin/env python
# Author: <NAME>
import sys
import struct
def calculatePressTemp(C, D1, D2):
# Given C1-C6 and D1, D2, calculated TEMP and P
# Do conversion first and then second order temp compensation
dT = int(0)
SENS = int(0)
OFF = int(0)
SENSi = int(0)
OFFi = int(0)
Ti = int(0)
OFF2 = int(0)
SENS... |
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2017 McAfee LLC - All Rights Reserved.
################################################################################
from __future__ import absolute_import
import json
import logging
import time
... |
#!/usr/bin/env python3
import os
import re
import bs4
import logging
import requests
import urllib.parse
try:
import lxml
PARSER = 'lxml'
except:
PARSER = 'html.parser'
class LoginError(Exception):
pass
def ensure_login(func):
def wrapper(self, *args):
if not self._is_login:
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator; '''for generating batches of tensor image with real-time data augmentation '''
from keras.models import Sequential
fr... |
import doctest
import optparse
import pytest
try:
import pathlib
except ImportError:
import pathlib2 as pathlib
from flake8_rst.rst import RST_RE, apply_default_groupnames, apply_directive_specific_options, merge_by_group
from flake8_rst.sourceblock import SourceBlock, _extract_roles
from hypothesis import as... |
import tensorflow as tf
import numpy as np
def cumprod(xs):
"""
Cumulative product of a tensor along first dimension.
https://github.com/tensorflow/tensorflow/issues/813
"""
values = tf.unpack(xs)
out = []
prev = tf.ones_like(values[0])
for val in values:
s = prev * val
... |
### MDP Value Iteration and Policy Iteration
### Reference: https://web.stanford.edu/class/cs234/assignment1/index.html
import numpy as np
import sys
np.set_printoptions(precision=3)
"""
For policy_evaluation, policy_improvement, policy_iteration and value_iteration,
the parameters P, nS, nA, gamma are defined as fo... |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import random
import shutil
import sys
import os
import torch
from torch.autograd import Variable
import... |
import os
import re
import torch
import random
import time
import logging
import argparse
import subprocess
import numpy as np
from tqdm import tqdm, trange
from collections import defaultdict
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import DataLoader, SequentialSampler
from transformers.... |
#!/usr/bin/env python
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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 req... |
import itertools
import re
import sys
import operator
from collections import defaultdict, namedtuple
from copy import copy
from dataclasses import dataclass
from enum import Enum
from itertools import product
from math import prod
from queue import PriorityQueue
from typing import List, Dict, Any, Tuple
import aocd
fr... |
# -*- coding: utf-8 -*-
'''qeez_stat.utils test module
'''
import sys
import string
from random import SystemRandom
import pytest
from redis import StrictRedis
from qeez_stats import utils
from .config import CFG
from .commons import get_redis, get_token
def setup_module(module):
from qeez_stats import utils... |
from machine import UART
from machine import RTC
from machine import SPI
from machine import Pin
import time
import sys
import machine
import pycom
import _thread
import utime
import struct
import binascii
import read
import os
import utime
import gc
pycom.heartbeat(False)
pycom.nvs_set('p0', 0)
pycom.nvs_set('p1', 0)... |
# -*- coding: utf-8 -*-
import datetime, json, logging, os, pprint
import django, sqlalchemy
from disa_app import settings_app
from disa_app import models_sqlalchemy as models_alch
from disa_app.lib import person_common
from django.conf import settings
from django.core.urlresolvers import reverse
from sqlalchemy impo... |
import numpy as np
from sklearn.base import RegressorMixin
from sklearn.linear_model.base import LinearModel
from sklearn.utils import check_X_y, check_array, as_float_array
from sklearn.utils.validation import check_is_fitted
from scipy.linalg import svd
import warnings
class BayesianLinearRegression(RegressorMixin... |
from .models import App
import random
import os
import shutil
from ftplib import FTP
import paramiko
import sys
import threading
import zipfile
import importlib
def check_dir(account):
#path = os.path.join(account.path, 'downloadfiles')
#files = os.listdir(path)
#files_copy = files.copy()
#for f in files:
# filt ... |
import binascii
import copy
import logging
import os
import sys
from collections import defaultdict
import bsdiff4
from basefs import exceptions
from basefs.utils import Candidate, issubdir
logger = logging.getLogger('basefs.view')
class ViewNode:
def __str__(self, indent=''):
ret = repr(self) + '\n'
... |
import aiohttp
import argparse
import asyncio
import configparser
import os
import re
import sys
import traceback
folder = os.path.join(os.path.abspath(os.path.expanduser('~/')), '.termex')
repo_name_pat = re.compile('/([^/]+).git$')
def _normpath(x):
return os.path.normpath(os.path.abspath(x))
def fetch_git(s... |
#!/usr/bin/env python
import os
import numpy as np
# from timeit import default_timer as timer
import eigensystem
from tools import cd, format_float
from custom_parser import parse
def optional_color(element, color):
"""Add optional color to the element"""
return '{\\color{' + color + '}' + element + '}' if... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
import torch.nn as nn
from torch import distributed as dist
from torch.nn import functional as F
from cvpods.layers import ShapeSpec
from cvpods.structures import ImageList
from cvpods.layers.batch_norm import NaiveSyncBatchNorm1d
fro... |
"""In this file, we analyze the contrast in the source space.
- We apply the inverse operator to the covariances for different conditions.
- We subtract the source estimates between the two conditions.
- We average across subjects this contrast.
For now, the inverse operator uses the empty room covariance.
Inspired ... |
import csv
from card_kingdom import Card_kingdom
import os
from bcolors import info_print
import requests
import json
import time
ck_fields = {
'NAME': 'card name',
'SET': 'edition',
'FOIL': 'foil',
'COUNT': 'quantity',
}
fields = {
'ALTERED_ART': 'Altered Art',
'ARTIST_PROOF': 'Artist Proof',
'CARD_NUM... |
"""
Copyright (c) 2018 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.0
Unless required by applicable law or agreed to in writin... |
# Copyright 2020 The Vertizee 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 or agreed to in ... |
import re
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
from scipy.interpolate import interp1d
from chempy import Substance
import pathlib
import time
DF = pd.read_csv(
'../data/aqueous_solubility_inorganic_temperatures.csv', index_col=0)
DF_PHASE_CHAN... |
"""PySunways interacts as a library to communicate with Sunways inverters"""
import asyncio
import httpx
import concurrent
from datetime import date
import logging
#import requests_async as requests
from httpx import DigestAuth
from requests.auth import HTTPDigestAuth
# from pip._vendor import requests
_LOGGER = log... |
from prettytable import PrettyTable
import datetime
##change the format from "day month(in str type) year" to "year-month-day"
def change_date_format(month_list, str_input):
date_list = str_input.split(" ")
date_list[1] = str(month_list.index(date_list[1])+1)
temp = date_list[0]
date_list[0] = date_lis... |
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from django.utils.html import strip_tags
from django import forms
import uuid, random, string
def ran_gen(size, chars=string.ascii_uppercase... |
###############################################################################
# Server process to keep track of unlinked resources, like folders and
# semaphores and clean them.
#
# author: <NAME>
#
# adapted from multiprocessing/semaphore_tracker.py (17/02/2017)
# * include custom spawnv_passfds to start the proce... |
import itertools
import time
import sys
import requests
from collections import defaultdict
COMPLEMENTS = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G', 'N': 'N', 'M': 'M', 'R': 'R', 'S': 'S', 'K': 'K', 'Y': 'Y'}
def kmers_range(seq, k):
# last kmer is seq[len(seq) - k : len(seq)]
# last value of i is len(seq) - ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... |
#!/usr/env/python
# -*- coding: utf-8 -*-
'''
Script that grabs all "instance of" attributes for all articles associated
with a certain category containing talk pages.
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation f... |
import asyncio
import io
import os
import time
import lyricsgenius
import requests
import wget
from pyrogram import filters
from pyrogram.types import Message
from tswift import Song
from youtube_dl import YoutubeDL
from youtubesearchpython import SearchVideos
from innexiaBot.conf import get_str_key
from innexiaBot.p... |
import discord
from discord.ext import commands
import pymongo
from pymongo import MongoClient
import aiohttp
from datetime import datetime as d
import json
with open('config.json', 'r') as config_file:
config = json.loads(config_file.read())
connection = MongoClient(config['mongodb'])
db = connection['Pylon']
keys =... |
# Copyright (c) 2008, <NAME>. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... |
#!/usr/bin/env python3
__author__ = '<EMAIL>'
"""
After running collapse, combine with the cluster FL/nFL assignment to get abundance information.
cluster_report.csv format in IsoSeq3:
cluster_id,read_id,read_type
transcript/0,m54056_171130_193019/8388911/ccs,FL
where .group.txt is:
PB.1.1 transcript/0,transcr... |
"""
bioBakery Workflows: config module
Configuration settings for workflows and tasks
Copyright (c) 2016 Harvard School of Public Health
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 re... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import abc
import json
import logging
import os
from typing import Dict, Any, Callable, Tuple, List, Generator, Union
from google import auth
from google.auth import iam
from google.auth.credentials import Credentials
from google.auth.impersonated_credentials import Credentials as ImpersonatedCredentials
from google.a... |
# -*- coding: utf-8 -*-
from . import cosmic_params
import numpy as np
#%% obtain best-fit parameters from chains
#!!! to be updated, build a class for this part, move this function to plc and refer plc
def _quantile(x, q, weights=None):
"""
Compute sample quantiles with support for weighted samples (a funct... |
#!/usr/bin/env python3
# vim: nospell expandtab ts=4
# SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-2-Clause
from __future__ import annotations
from typing import Any, Callable, Dict, Iterable, List, Sequence, Tuple, Union
import dataclasses
import hashlib
import hmac
import json
i... |
# -*- coding: utf-8 -*-
"""
(c) 2018 - Copyright Red Hat Inc
Authors:
<NAME> <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import base64
import datetime
import logging
import os
import stat
import struct
import six
import werkzeug.utils
from celery import Celery
from cryptography im... |
__author__ = 'karthi'
import time
import RPi.GPIO as GPIO
import fonts
fontWidth = 6
currentScreen = 0
class LCD_GPIO(object):
# Timing constants
E_PULSE = 0.000000070 # Addess setup time 140ns
E_DELAY = 0.000000100 # Data setup time 200ns
def __init__(self, RST,RS,RW,E1,E2,CS1,CS2, D0, D1, D2, D3,... |
"""
This script runs a series of EMAN2 processing steps in the order specified in the steps_to_run
variable. The steps_to_run and other parameters for various steps will be filled in dynamically by
the eman2_processor.py module based on the configurations file provided to ets_process_data.py by
the user.
Note: Python3... |
"""
Sure Independence Screening
https://orfe.princeton.edu/~jqfan/papers/06/SIS.pdf
"""
import logging
from itertools import combinations
from typing import Optional, Dict, List
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.metrics import get_scorer
from maml.apps.symbolic._selec... |
import struct
from datetime import datetime
import numpy as np
from pySDC.helpers.pysdc_helper import FrozenClass
from pySDC.implementations.sweeper_classes.generic_implicit import generic_implicit
class _fault_stats(FrozenClass):
def __init__(self):
self.nfaults_called = 0
self.nfau... |
import string
import numpy
import copy
import molsys.mol
from molsys.addon import base
import os
import tempfile
#from molsys.molsys_mpi import mpiobject
# molecules module
# atm it is just those routines that are removed from the old molsys stored here as backup
import logging
logger = logging.getLogger("molsys.mol... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.histories import HistoryClient
from bioblend.galaxy.libraries import LibraryClient
from bioblend.galaxy.tools import ToolClient
from bioblend.galaxy.datasets import DatasetClient
from bioblend.galaxy.jobs import JobsClient
from urllib.parse import urlpars... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
_tab20c_data = (
(0.19215686274509805, 0.5098039215686274, 0.7411764705882353 ), # 3182bd
(0.4196078431372549, 0.6823529411764706, 0.8392156862745098 ), # 6baed6
(0.6196078431372549, 0.792156862745098, 0.8823529411764706 ), # 9ecae1
(0.7764705882352941, 0.8588235294117647, 0.93725490196078... |
#!/usr/bin/env python
# coding: utf-8
"""This script adds command line interface (CLI) to the isfreader.py script.
Now you may specify a directory with .isf binary files and the script wil convert all the files
to csv format and save to a specified output directory.
Simple usage:
python isfconverter.py -f inputfile.i... |
# -*- coding: utf-8 -*-
"""
Tests of the neo.core.epoch.Epoch class
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
import quantities as pq
try:
from IPython.lib.pretty import pretty
except ImportError as err:
HAVE_IPYTHON = False
else:
HAVE_IPYTHON = ... |
import logging
log = logging.getLogger(__name__)
SPLIT_CHAR = ";"
def get_path_value(path, cur_dict, must_exist=True, ensure_dict=False, no_msg=False):
"""
topology_template.node_templates.vnf.properties.descriptor_id
Pass in a path and a dict the path applies to and get the value of the key
"""
... |
#!/usr/bin/env python2
from __future__ import print_function
import atexit
import logging
import os
import os.path
import re
import shlex
import string
import subprocess
import sys
import ssg_test_suite.oscap as oscap
import ssg_test_suite.virt
from ssg_test_suite import xml_operations
from ssg_test_suite.virt import... |
import numpy as np
from collections import namedtuple
import json
import copy
# Defining the neural network model
ModelParam = namedtuple('ModelParam',
['input_size', 'output_size', 'layers', 'activation', 'noise_bias', 'output_noise'])
model_params = {}
model_test1 = ModelParam(
input_s... |
import argparse
import os
import math
import ruamel.yaml as yaml
import numpy as np
import random
import time
import datetime
import json
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
from models.model_captioning import XVLM
import utils
from utils.checkp... |
import functions
# from flaskapp import functions
import re
NO_GAME_MESSAGE = "You are not currently playing a game of Sleeper Agent! " \
"Text \"Begin enlisting your_name_no_spaces\" without quotes to start"
BEGIN_ENLIST_ST = "Began enlisting as "
BEGIN_ENLIST_MID = " ! Tell others to join by textin... |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines 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 ap... |
import sublime
import sublime_plugin
import os
from hashlib import md5
__version__ = "1.11.6"
CONFIG_NAME = "Localization.sublime-settings"
LANGS = {
"ZH_CN": {
'zipfile': 'ZH_CN.zip',
'syntax_md5sum': '44cd99cdd8ef6c2c60c0a89d53a40b95'
},
"ZH_TW": {
"zipfile": "ZH_... |
# coding=utf-8
from __future__ import unicode_literals
import json
import os
import random
import unittest
from faker import Generator
from faker.utils import text, decorators
TEST_DIR = os.path.dirname(__file__)
class BarProvider(object):
def foo_formatter(self):
return 'barfoo'
class FooProvider(... |
""" Mixins for setting up particular course structures (such as split tests or cohorted content) """
from datetime import datetime
from pytz import UTC
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory... |
# Pydifact - a python edifact library
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, co... |
"""
Classes for working with PyTorch Dataloaders and PyTorch-Lightning DataModules
"""
from typing import Callable, Dict
import janitor
import numpy as np
import pytorch_lightning as pl
from pybbbc import BBBC021
from torch.utils.data import DataLoader, Dataset
from .transforms import aug_transform, transform
cla... |
'''
NOTE: "segments" as used in this file is mostly unrelated to tilegrid.json usage
ie tilegrid.json has names like SEG_CLBLL_L_X2Y50 where as here they are tile based and named like seg_00400100_02
Instead of using tilegrid.json "segments, segments are formed by looking for tiles that use the same address + offset
S... |
'''Train CIFAR10 with PyTorch.'''
import argparse
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from mup.coord_check import get_coord_data, plot_coord_data
from mup import MuAdam, MuSGD, get_shapes, make_base_s... |
"""ProsperSlides.py
Utility for making/pushing weekly Prosper Market Show Sldies
Using: https://developers.google.com/slides API
-- python lib: https://developers.google.com/slides
"""
from datetime import datetime
from os import path, makedirs, access, W_OK#, R_OK
import platform
import ujson as json
import reques... |
#!/usr/bin/env python
import os
import sys
import random
from rgbw_colorspace_converter.colors.converters import RGB, HSV
os.environ["TERM"] = "xterm-256color" # screen
os.system("tput clear; tput init; tput civis;stty -echo; ")
## The following code is basically a mess as it grew from a small testing example to s... |
import click
import json
import os
import requests
import testindata
import shutil
from testindata.cli import account
from testindata.cli.cliUpload import CliUpload
from testindata.TDA import TDA
from testindata.utils import util
def _download(url, savePath):
res = requests.get(url)
saveDir = os.path.split(s... |
"""
This is the main program that does the work.
"""
from apscheduler.schedulers.blocking import BlockingScheduler
from transitions import Machine
from datetime import datetime, timedelta
import ephem
import enum
import logging
import logging.handlers
import secrets
import os, sys
import yaml
import numpy as np
from u... |
"""
Retrieve data from EIA Form 860 spreadsheets for analysis.
This modules pulls data from EIA's published Excel spreadsheets.
This code is for use analyzing EIA Form 860 data.
"""
import glob
import logging
import os.path
import pandas as pd
import pudl
import pudl.constants as pc
import pudl.workspace.datastore... |
import pygame
from pygame.locals import *
import copy
import logging
import tools
logging.basicConfig(format='%(levelname)s @ %(asctime)s: %(message)s') # setup logging as 'WARNING @ 1:32: Bing bong'
pygame.init()
_tile_registry = [] # registry of the names of all of the created tiles
def _sticky_load_image(image):... |
'''
Guided creation of CycleGAN configuration files.
Usage: create_config out_config_path
<NAME>,
Real-Time Computer Vision,
Institut fuer Neuroinformatik,
Ruhr University Bochum.
'''
import sys
import cyclegan.util.config as cfg
CONFIG_INFO_BASE = {
cfg.IMAGE_SIZE : "A list of two integers specifying size (he... |
from unittest.mock import patch
from cloudbridge.factory import CloudProviderFactory
from cloudbridge.factory import ProviderList
from django.contrib.auth.models import User
from django.urls import reverse
from djcloudbridge import models as cb_models
from rest_framework import status
from rest_framework.test impor... |
############################################################################
# Proxylab testing framework
# Creating and using test files
############################################################################
import datetime
import random
import os
import os.path
import sys
import glob
import socket
import Str... |
# Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
"""
Symbolic module
"""
import sys
import inspect
import numpy as np
import sympy as sp
# List of symbols used in pylbm
nx, ny, nz, nv = sp.symbols("nx, ny, nz, nv", integer=True) #pylint: disable=invalid-name
ix, iy, iz, iv = sp.symb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.