text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import json
import pdb
import argparse
import glob
import multiprocessing as mp
import numpy as np
import os
import tempfile
import time
import warnings
import cv2
import tqdm
from detectron2.config import get_cfg
from detectron2.data.detection_utils impo... |
# Author:尉玉林(Mr.Wei)
# Create Date:2019/10/22
# Edition:V1.0.0
# Python自带库
import sys
import sqlite3
from time import sleep
# 第三方库
from PySide2.QtWidgets import QMainWindow, QApplication, QMessageBox, QSplashScreen, QLabel
from PySide2.QtCore import QThread, Signal, Qt
from PySide2.QtGui import QPixmap, QFont
from ... |
"""Memoization: utils associated with memoization experiments
"""
# Import libLF
import os
import sys
sys.path.append(os.path.join(os.environ['MEMOIZATION_PROJECT_ROOT'], 'eval', 'lib'))
import libLF
# Other imports
import json
import re
import tempfile
import pandas as pd
###
# Constants
###
class ProtoRegexEngine... |
import math
from collections import deque
from functools import partial
from typing import Tuple, Deque, Set, List
import src.FrameModel.FrameModel
import src.FrameModel.Object as Object
from src.Types import AbsolutePosition
def rotate_object_about_point(
obj: Object.Object,
angle: int,
about_point: Tup... |
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify
from db import *
import json
import pandas as pd
import os
# 跨域支持
def after_request(response):
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'PUT,GET,POST,DELETE'
response.headers['... |
import argparse
import torch
import torch.nn.functional as F
import pytorch_lightning as pl
import pytest
from torchvision import transforms
from torchvision.datasets import MNIST
from torch.utils.data import Dataset, RandomSampler
import nni.retiarii.nn.pytorch as nn
from nni.retiarii import strategy, model_wrapper, ... |
"""
Superclasses for various Pyte things.
"""
import dis
import functools
from pyte import tokens, util
from pyte.exc import ValidationError
from pyte.util import PY36
BIN_OP_MAP = {}
for num, val in enumerate(dis.cmp_op):
BIN_OP_MAP[val] = num
class _PyteOp(object):
"""
This is a superclass for an opc... |
#!/usr/bin/env python
# Passing an environment variable containing unicode literals to a subprocess
# on Windows and Python2 raises a TypeError. Since there is no unicode
# string in this script, we don't import unicode_literals to avoid the issue.
from __future__ import print_function
from __future__ import division
... |
import csv
import glob
import itertools
import json
import logging
import numpy as np
import os
import pandas as pd
import shutil
import zipfile
from datetime import datetime
from django.core.management.base import BaseCommand
from django.db import connection
from openpyxl import load_workbook
from time import perf_co... |
import mock
import time
import threading
import unittest
from uuid import uuid4
from pyramid import testing
from pyramid import httpexceptions
from kinto.core.storage.exceptions import BackendError
from kinto.core.utils import sqlalchemy
from kinto.core import events
from kinto.core.testing import skip_if_no_postgres... |
#!/usr/bin/env python
import argparse
import os
import sys
import importlib
import pkgutil
import glob
import shlex
import deploy_config_generator.output as output_ns
from deploy_config_generator.site_config import SiteConfig
from deploy_config_generator.deploy_config import DeployConfig
from deploy_config_generator.... |
# Copyright (c) 2020, <NAME>
# License: MIT License
import pytest
from ezdxf.lldxf.validator import (
is_in_integer_range,
is_valid_aci_color,
is_valid_layer_name,
is_valid_lineweight,
is_not_null_vector,
is_positive,
fix_lineweight,
is_integer_bool,
is_valid_one_line_text,
fix_... |
import json, re, time, random
import nltk
from nltk.stem import PorterStemmer
from datetime import date
ps = PorterStemmer()
# size_of_trainning = 500000
labels = json.loads(open('corpus_for_trainning').read())
c_labels = labels[0]
i_labels = labels[1]
p_labels = labels[2]
print('number of c_labels', len(c_labels))... |
"""Performs face alignment and calculates L2 distance between the embeddings of images."""
# MIT License
#
# Copyright (c) 2016 <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 wit... |
# PRAW - https://praw.readthedocs.io/en/latest/index.html
# Script is ran at approximately 11:59 P.M. and 11:59 A.M. EST each day
# Removal of duplicates done by the Sifter.py
# Formatting into a .docx is done elsewhere
import sys
import os
file_path = os.path.dirname(os.path.realpath(__file__)) + "\\" # Obtains the ... |
"""
Logging module for printing status during an exploit, and internally
within ``pwntools``.
Exploit Developers
------------------
By using the standard ``from pwn import *``, an object named ``log`` will
be inserted into the global namespace. You can use this to print out
status messages during exploitation.
For e... |
import operator
from collections import defaultdict
from cliquet import utils
from cliquet.storage import (
StorageBase, exceptions, Filter,
DEFAULT_ID_FIELD, DEFAULT_MODIFIED_FIELD, DEFAULT_DELETED_FIELD)
from cliquet.utils import COMPARISON
def tree():
return defaultdict(tree)
class MemoryBasedStorag... |
import pygame
import random
import os
import sys
import time
import neat
pygame.font.init() # Init font in pygame
pygame.mixer.init() # Init Mixer in pygame
# Setting constants
WIN_WIDTH = 600
WIN_HEIGHT = 800
FLOOR = 730
STAT_FONT = pygame.font.Font(os.path.join('assets/font', 'flappy_bird.ttf'), 50)
END_FONT = pyg... |
#!/usr/bin/env python
import datetime
import pandas as pd
from pathlib import Path
new_tutorial_name = {
'16S Microbial Analysis with Mothur': '16S Microbial Analysis with mothur (extended)',
'16S Microbial Analysis with mothur': '16S Microbial Analysis with mothur (extended)',
'Quality Control ': 'Qualit... |
from dataclasses import dataclass
from typing import Callable, Sequence, Optional, List, Mapping
from math import log10
from logzero import logger
from ._pickle import load_pickle, save_pickle
from ._proc import run_command
@dataclass(eq=False, frozen=True)
class Scheduler:
"""Utility for submitting scripts using... |
""" Export tool helper
.. moduleauthor:: `<NAME> <github.com/mfe>`_
"""
__version__ = "0.1"
import utils.lut_presets as presets
from utils.ocio_helper import OCIO_LUTS_FORMATS
from utils.debug_helper import make_full_version_action
from utils.threedl_helper import THREEDL_HELPER
from utils.csp_helper import CSP_HELPE... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
#!/usr/bin/env python3
"""This module plots and outputs beamforming pattern.
Example usage: python3 beamforming_pattern_gen.py
Author: CGrassin (http://charleslabs.fr)
License: MIT
"""
import numpy as np
import math
import matplotlib.pyplot as plt
import argparse
def dBtoLinear(db):
"""Converts... |
"""
run.py (arxiv_elasticsearch)
============================
Transfer arXiv data from MySQL to elasticsearch, principally intended
for the `arXlive <http://arxlive.org>`_ `hierarXy <https://arxlive.org/hierarxy/>`_
searchkit front-end.
"""
from nesta.core.luigihacks.elasticsearchplus import ElasticsearchPlus
from a... |
import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete
import time
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
from torch_geometric.data import Data, Batch
from torch_g... |
import json
import logging
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, redirect
from django.template import RequestCo... |
"""The module containing support for router modules.
This contains functions that are shared between the routes modules.
"""
import asyncio
import os
import shutil
import zipfile
from datetime import datetime
from snake import db
from snake import enums
from snake import error
from snake import schema
from snake imp... |
from __future__ import with_statement
import numpy as np
import hashlib
import os
import quantities as pq
from neo import description
import neo
def assert_arrays_equal(a, b):
assert isinstance(a, np.ndarray), "a is a %s" % type(a)
assert isinstance(b, np.ndarray), "b is a %s" % type(b)
assert a.shape ==... |
# -*- coding: utf-8-*-
from datetime import datetime, time
import sys
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app, request
from flask.ext.login import UserMixin, AnonymousUserMixin
from ap... |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms.fields import CharField
from django.forms.fields import FloatField
from django.forms.fields import DecimalField
from django.forms.models import BaseModelFormSet
f... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... |
# -*- coding: utf-8 -*-
import pytest
asyncio = pytest.importorskip("asyncio")
import os
import sys
from mygeotab import API, server_call_async
from mygeotab.exceptions import AuthenticationException, MyGeotabException, TimeoutException
from tests.test_api_call import USERNAME, PASSWORD, DATABASE, TRAILER_NAME
USER... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import itertools
import logging
import os
import traceback
from io import BytesIO
from typing import Any, Dict, List, Optional
import caffe2.python.onnx.backend
import numpy as np
import onnx
import torch
from caffe2.python... |
"""
This file is part of the accompanying code to our manuscript:
<NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., "Benchmarking
a Catchment-Aware Long Short-Term Memory Network (LSTM) for Large-Scale Hydrological Modeling".
submitted to Hydrol. Earth Syst. Sci. Discussions (2019)
You should have received a copy... |
# Copyright 2018 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 applic... |
# This script will be called from the command line to execute other scripts.
from argparse import ArgumentParser
from mutperiodpy import RunNucleosomeMutationAnalysis, RunAnalysisSuite, GenerateFigures, StratifyNucleosomeMap
from mutperiodpy.input_parsing import ParseCustomBed, ParseICGC
from mutperiodpy.helper_scripts... |
#This is essentially a binary JSON type container.
#Each entry can hold a value of a specic type or more entries embedded into it.
#Values are always little endian.
from struct import unpack
import io
from collections import OrderedDict
def unXor(path):
"""Take a filename (usually toc or cat), decrypt the file if ... |
#!/usr/bin/python3
#-*-coding:utf-8-*-
import os
import socket
import time
import threading
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import utils
from worker import FileWorker
from worker import SockWorker
from worker import DataWorker
from authority import AuthClient... |
#!/usr/bin/env python3
from datetime import datetime
from datetime import timedelta
from ebaysdk.exception import ConnectionError
from ebaysdk.finding import Connection
import pygsheets
import re
import time
def conditionsToWrite(itemURL, dupeURL, fromCountry, itemCountry, itemBuyNow,
itemConditionID, condition... |
import collections
_vector_lists = dict(
xyz=['_x', '_y', '_z'],
xy=['_x', '_y'],
pyr=['_p', '_y', '_r'],
PYR=['_pitch', '_yaw', '_roll'],
)
class _VectorNames():
def __init__(self, veclist):
if not isinstance(veclist, collections.Hashable):
# TODO: check that its valid?
... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Create and manipulate objects via REST API."""
# pylint: disable=too-few-public-methods
import json
from requests import exceptions
from lib import environment, factory
from lib.constants import url, ob... |
import argparse
import json
import logging
import multiprocessing
import os
import subprocess
from contextlib import ExitStack
import yaml
from pyntcloud import PyntCloud
from map_color import run_mapcolor
from utils import mpeg_parsing
from utils.experiment import assert_exists
from utils.parallel_process import par... |
import cv2
import os
import torch
import numpy as np
from glob import glob
import data_util
import util
from collections import defaultdict
import h5py
class SceneInstanceDataset(torch.utils.data.Dataset):
"""This creates a dataset class for a single object instance (such as a single car)."""
def __init__(se... |
import collections
import unittest
import types
import sugar
GLOBAL = 'original value'
class ExpressionTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.var = sugar.Expression('self.var')
# Left operators
def test_left_add_operator(self):
self.assertEqual((self.var ... |
# -*- coding: utf-8 -*-
import time, datetime
import re
import sys, traceback
import xbmc
try: import json
except ImportError: import simplejson as json
from dateutil.parser import parse
from dateutil.tz import gettz
from dateutil.tz import tzlocal
#######################################
# Time and Date Helpers
#####... |
import moviepy.editor
"""this library is used here to write audio file from a video"""
from tkinter import Label, Button, Entry, Tk, mainloop, StringVar, OptionMenu, filedialog
"""Tkinter is GuiProgramming toolkit for Python"""
"""used to recognize audio and convert to text"""
from gtts import gTTS
import PyPDF2
... |
#!/usr/bin/env python
#------------------------------------------------------------------------------
from __future__ import print_function
from __future__ import division
from collections import defaultdict
import argparse
import glob
import simplejson
import os.path
import sys
from boto.utils import JSONDecodeError... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import copy
import json
import logging
import os
import pytest
import six
import time
from azure.containerregistry import ContainerRegistryClient
from az... |
"""
SAT solver using CDCL
"""
import os
import time
from collections import deque
from pkg.utils.constants import TRUE, FALSE, UNASSIGN
from pkg.utils.exceptions import FileFormatError
from pkg.utils.logger import set_logger
logger = set_logger()
class Solver:
def __init__(self, filename, do_stat=False):
... |
# -*- coding: utf-8 -*-
"""Main module."""
from . import __version__
from six.moves import UserDict
from six.moves.urllib.parse import urljoin, urlparse, parse_qsl
from requests import Session
from requests.adapters import HTTPAdapter
from requests.auth import HTTPBasicAuth, AuthBase
from urllib3.util import Retry... |
# MIT License
#
# 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, copy, modify, merge, publi... |
'''
equation balencer, that balences your chemical or math equations
Created on Jun 23, 2016
@author: <NAME>
'''
import re
import numpy
from itertools import chain
from fractions import gcd
from functools import reduce
from builtins import max
class Equation():
'''
Takes an equation, splits it... |
from __future__ import print_function
import argparse
import os
import shutil
import time
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data as data
import torchvision.transforms as tran... |
import logging
from decimal import Decimal
from typing import TYPE_CHECKING, List, Union
from urllib.parse import urljoin
from django.conf import settings
from prices import Money, TaxedMoney
from ....checkout import models as checkout_models
from .. import TaxType, zero_taxed_money
from ..errors import TaxError
from... |
import numpy as np
import random
import loggers as lg
from game import Game, GameState
from model import Residual_CNN
from agent import Agent, User
import config
def playBattleSnake(env, run_version, player1version, player2version, EPISODES, logger, turns_until_tau0, goes_first = 0):
# Initialize Traine... |
#
# ch4-filteringdata.py
#
# Code for the first example from chapter 4.
# The only change from the original filteringdata.py is the addition of the music dictionary.
#
# Code file for the book Programmer's Guide to Data Mining
# http://guidetodatamining.com
# <NAME>
#
from math import sqrt
users = {"Angelica": ... |
import discord
import json
from discord.ext import commands
from bot.utils.paginator import Paginator
from bot.utils.prefixes import get_real_prefix
from bot.utils.checks import is_admin
from bot.constants import Colour
from .src.database import DB
BLACKLIST_PATH = "bot/ext/pictionary/src/blacklisted.json"
class ... |
# pyinfra
# File: pyinfra_cli/prints.py
# Desc: print utilities for the CLI
from __future__ import print_function, unicode_literals
import json
import re
import traceback
import click
import six
from pyinfra import logger
from pyinfra.api.facts import get_fact_names
from pyinfra.api.host import Host
from pyinfra.ap... |
import numpy as np
import math
import cv2
import matplotlib.pyplot as plt
import time
import numpy.ma as ma
import gym
from gym import spaces
from gym.envs.toy_text import discrete
from stable_baselines.common.policies import MlpPolicy
from stable_baselines import PPO2
from stable_baselines.common.env_checker import ... |
"""
Error handling logic for the PDF generation process, to improve/simplify the LaTeX compiler's
error logs.
The following code is adapted from: https://github.com/tsgates/die/blob/master/bin/parse-latex-log.py:
<NAME>
Original License:
This file is part of Rubber and thus covered by the GPL
(c) <NAME>, 2002--... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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... |
#!/usr/bin/env python3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from xml.dom import minidom
from writers import gpo_editor_writer, xml_formatted_writer
from writers.admx_writer import AdmxElemen... |
#!/usr/bin/python
import unittest
import env
import simplepdb as pdb
import os
from plumbum.cmd import awk, head, tail
class IOTests(unittest.TestCase):
'''
Tests PDB file parsing and writing.
'''
def setUp(self):
self.pdb = pdb.simplepdb('chignolin.pdb')
self.maxDiff = None
def te... |
import os, sys
import argparse
import cv2
import dlib
import time
from mxnet import nd
sys.path.append(os.path.abspath(os.path.dirname(__file__)) + os.sep + '../MobileFace_Detection/')
from mobileface_detector import MobileFaceDetection
sys.path.append(os.path.abspath(os.path.dirname(__file__)) + os.sep + '../MobileFac... |
import os
import sys
import logging
import rootpath
import sentry_sdk
from shutil import copy
from pydoc import locate
from getpass import getpass
from alembic import command
from copy import deepcopy
from alembic.config import Config
from sqlalchemy_searchable import sync_trigger
from alembic.command import init as al... |
import numpy as np
import os
import torch
from .episodes import get_episodes
def save_npy(filepath, data):
np.savez_compressed(filepath, data=data)
print("Data saved to {}".format(filepath))
def load_npy(filepath, file_name='arr_0'):
loaded_data = np.load(filepath, allow_pickle=True, mmap_mode="r")
print("Data l... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import logging
from abc import ABC, abstractmethod
from datetime import datetime
from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, MutableMapping, Optional
import pendulum
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.stream... |
import torch
import torch.nn as nn
from torch.nn.utils.weight_norm import weight_norm
from fc import FCNet
from torch.nn import functional as F
class Attention(nn.Module):
def __init__(self, v_dim, q_dim, num_hid):
super(Attention, self).__init__()
self.nonlinear = FCNet([v_dim + q_dim, num_hid])
... |
# Author: <NAME>.
#
# Modified from Pytorch examples code.
# Original license shown below.
# =============================================================================
# BSD 3-Clause License
#
# Copyright (c) 2017,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modi... |
""" Code file to create a version 2 keras model using cross-validation """
import warnings
from typing import Union
from sklearn.model_selection import KFold
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import... |
# -*- coding: utf-8 -*-
import json
import logging
from docker import DockerClient
from flask import Blueprint, request, current_app, url_for, jsonify
from badwolf.context import Context
from badwolf.tasks import start_pipeline, check_pr_mergeable
from badwolf.extensions import bitbucket, sentry
from badwolf.bitbucke... |
import re
import random
from datetime import datetime, timedelta
import bcrypt
from yamo import (
Document, EmbeddedDocument, IDFormatter, Index,
BooleanField,
StringField,
BinaryField,
ListField,
IntField,
FloatField,
DateTimeField,
EmbeddedField,
)
class Code(Document):
""... |
import time
import math
import concurrent.futures
from pytest import approx, raises
import conftest
from msl.network import connect, Service
from msl.examples.network import BasicMath, MyArray, Echo
def test_echo():
manager = conftest.Manager(Echo)
cxn = connect(**manager.kwargs)
echo = cxn.link('Ech... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.naming import make_autoname
from frappe.utils.global_search import search
from frappe.... |
#!/usr/bin/env python3
"""
copyed from https://github.com/wleftwich/aoc2020/blob/main/29_jurassic_jigsaw.py, under MIT license
"""
import math
from collections import defaultdict, Counter
import sys
import numpy as np
from scipy import ndimage
datafile = sys.argv[1] if len(sys.argv) > 1 else "input1"
NESW = [0+1j,... |
from _plotly_future_ import v4_subplots
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import datetime as dt
import pandas as pd
def prediction_graph(Stock, ticker, data, action_model_prediction, price_model_prediction, indication, start_date, interval):
indicators = {'General Analysis':... |
import traceback
from datetime import datetime
from math import floor
from typing import Union
import discord
from data.services import user_service
from discord.commands import (Option, errors, message_command, slash_command,
user_command)
from discord.ext import commands
from discord.ut... |
import argparse
import torch
import os
import json
from relation_canonical_form import CANONICAL_FORMS
from transformers import GPT2Config, GPT2LMHeadModel, GPT2Tokenizer
CLEANINGMAP = {'-RRB-': ')', '-LRB-': '(', '-LSB-': '[',
'-RSB-': ']', '-LCB-': '{', '-RCB-': '}',
' ': ' ', '&... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from typing import Tuple
import cv2
import numpy as np
from sudoku import Field
from sudoku.solver import load_image, cut_out_field, show_image, clean_image, \
find_digit_bounding_boxes
def find_number_mask(bin_field: Field):
number_mask = np.full(bi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import socket
import select
import os.path
master_encoding = 'latin-1'
if str is bytes: # Python 2
polystr = str
polybytes = bytes
polyord = ord
polychr = str
input = raw_input
def string_escape(... |
import argparse, time, logging, os, tempfile
import mxnet as mx
from mxnet import gluon, nd
from mxnet import autograd as ag
from mxnet.gluon import nn
from mxnet.gluon.data.vision import transforms
from gluoncv.data import imagenet
from gluoncv.model_zoo import get_model
from gluoncv.utils import makedirs, LRSchedul... |
import logging
import pandas as pd
from neuron import h
from src.iocurves.analysis import load_from_file, save_to_file
from src.utils.nrnpy import get_base_vm_cli, load_file
from src.utils.timing import current_time
logger = logging.getLogger("cl time")
TSTOP = 10000.0 # ms
SUBSAMPLE = 200 # don't load every point... |
import numpy as np
from typing import Union, List
from rdkit import Chem, RDConfig, RDLogger
from rdkit.Chem import AllChem
from rdkit.Chem import Lipinski
from rdkit.Chem import Crippen
from rdkit.Chem import rdMolDescriptors
from rdkit.Chem import rdPartialCharges
atom_features = [
'chiral_center',
'cip_cod... |
import numpy as np
import tables
from tqdm import tqdm
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import pandas as pd
X_MAX, Y_MAX, Z_MAX = 191., 191., 191.
E_SCALE = 50
def plot_3d(X, l):
"""
Function that draw two 3D-plots. First one with energy as a color, and second one sh... |
import gldac
import numpy as np
import pandas as pd
import typing
import os
from sklearn.feature_extraction.text import CountVectorizer
from d3m.primitive_interfaces.unsupervised_learning import UnsupervisedLearnerPrimitiveBase
from d3m.primitive_interfaces import base
from d3m import container, utils
from d3m.metada... |
# Copyright 2019-2020 <NAME>
#
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative ... |
import torch.nn as nn
import torch
import pytorch_lightning as pl
from layers import ConvNorm2d,ConvTransposeNorm2d,ResBlocks2d
from hparams import horse2zebra as hparams
from torchsummaryX import summary
from image_pool import ImagePool
import itertools
from collections import OrderedDict
class Generator(nn.Module):
... |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2017 PyMeasure Developers
#
# 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 limit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The :mod:`mixturelib.mixture` contains classes:
- :class:`mixturelib.mixture.Mixture`
- :class:`mixturelib.mixture.MixtureEM`
"""
from __future__ import print_function
__docformat__ = 'restructuredtext'
import math
import torch
import torch.nn as nn
import torch.nn.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import gc
import logging
from multiprocessing import Manager, Process
import os
import random
import sys
import time
from shellbot import Context
from shellbot.stores import Store
class MyStore(Store):
def on_init(self, **kwargs):
self.value... |
from django.conf import settings
from django.db import models
from rauth.service import OAuth1Service
from raven.contrib.django.raven_compat.models import client
import requests
from apps.share_tracking.models import get_share_page_url_with_tracking
from canvas import bgwork
from canvas.util import papertrail
from can... |
import subprocess
import time
import datetime
from signal import signal, SIGINT
from sys import exit
import sys
# Using raw, these are line separated entries
ping_these_raw = """8.8.8.8
1.1.1.1
google.com
192.168.0.1
192.168.0.100
"""
print('Running. Press CTRL-C to exit.')
ping_these = ping_these_raw.splitlines()... |
from ..db import db
from ..enums import (
BoxState,
ShipmentState,
TransferAgreementState,
TransferAgreementType,
)
from ..exceptions import (
InvalidShipmentState,
InvalidTransferAgreementBase,
InvalidTransferAgreementState,
)
from ..models.definitions.box import Box
from ..models.definitio... |
import pandas as pd
import plotly.express as px
import dash
import dash_bootstrap_components as dbc
from dash import dcc
from dash import html
from dash.dependencies import Input, Output
from pathlib import Path
import statsmodels.api as sm
from statsmodels.formula.api import ols
from components import jumbotron, a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 18:53:55 2021
@author: dejan
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, transform
from scipy.ndimage import median_filter
from sklearn.experimental import enable_iterative_imputer
from sklearn import preprocess... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys, os, pickle, gzip, pdb
if sys.version_info[0]<3:
import cPickle
import numpy as np
import pandas
from data.mnist import mnist
from data.SSL_DATA import SSL_DATA
import scipy.io
from keras.utils i... |
from crispy_forms.layout import Div, Layout, HTML
from crum import get_current_user
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
import django_filters
from django.conf import settings
from django.contrib.auth import get_user_model
from django.http.response import HttpResp... |
import os
import sys
sys.path.append('../Utils')
import matplotlib.pyplot as plt
import numpy as np
import keras
import datetime
from keras.models import load_model, Sequential
import keras.backend as K
import tensorflow as tf
from CodeBook.Utils.Logger import Logger
import keras.backend as K
import copy
import time
i... |
# -*- coding: latin-1 -*-
# Copyright (c) 2008 Pycircuit Development Team
# See LICENSE for details.
import circuit
import pycircuit.utilities.param as param
import sympy
import sympy.printing.lambdarepr
import numpy as np
import inspect
from copy import copy
class Node(circuit.Node):
@property
def V(self):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.