text stringlengths 2 999k |
|---|
################################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Unit tests for `categorical` module.
"""
import warnings
import ... |
import pytest
from exc_factory import make_exception
def test_attrs():
Foo = make_exception('Foo', ('a', 'b'))
e = Foo('hotel', a='trivago')
assert str(e) == 'hotel'
assert e.a == 'trivago'
assert e.b == None
def test_default_attrs():
Foo = make_exception('Foo')
e = Foo('hi')
assert str(e) == 'hi'
assert e... |
# coding: utf-8
import requests
import json
import paramiko
import time
import logging
import os
import difflib
from coreutils.logdecorator import logwrap
from coreutils import get_delta_from_expected_and_generated_configs
@logwrap
def execute_command(ssh_connection_handler):
'''
This method provides execute_comm... |
# __author__ = "shekkizh"
# """Custom solver for solving batched nnk objective - motivated by ISTA algorithm"""
import torch
@torch.no_grad()
def approximate_nnk(AtA, b, x_init, x_tol=1e-6, num_iter=100, eta=0.05, normalize=False):
"""
Solves an approximation to Non-Negative Kernel regression by ISTA type op... |
from d107 import moeda
p = float(input('Digite o preço: R$ '))
print(f"Com o preço de {moeda.moeda(p)}, temos")
print(f" -> O dobro é {moeda.moeda(moeda.dobro(float(p)))};")
print(f" -> A metade é {moeda.moeda(moeda.metade(p))};")
print(f" -> Com aumento de 50% fica {moeda.moeda(moeda.aumentar(p))};")
print(f" -> Com ... |
from typing import Any, Optional
from collections.abc import Mapping
import numpy as np
import pandas as pd
def _right_squeeze(arr, stop_dim=0):
"""
Remove trailing singleton dimensions
Parameters
----------
arr : ndarray
Input array
stop_dim : int
Dimension where checking sh... |
# Copyright (c) 2015
#
# All rights reserved.
#
# This file is distributed under the Clear BSD license.
# The full text can be found in LICENSE in the root directory.
import sys
import time
import pexpect
import base
import atexit
import ipaddress
import os
import binascii
import glob
from termcolor import colored, c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# QuickWeb documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 2 08:51:04 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
import click
from datasuper import *
from datasuper.database import *
import sys
from json import dumps as jdumps
from ..version import __version__
@click.group()
@click.version_option(__version__)
def main():
pass
@main.command()
def init():
'''Create a repo in the current directory.'''
try:
R... |
""" Code allowing tools to define extra files associated with an output datset.
"""
import logging
import operator
import os
import re
from tempfile import NamedTemporaryFile
import galaxy.model
from galaxy.model.dataset_collections import builder
from galaxy.model.dataset_collections.structure import UninitializedTre... |
from typing import List
from .argumentation_system import ArgumentationSystem
from .queryable import Queryable
class ArgumentationTheory:
"""
An ArgumentationTheory consists of an ArgumentationSystem and a knowledge base (which is a list of Queryables).
Arguments can be inferred on the basis of an Argume... |
import time
import meilisearch
from meilisearch.tests import BASE_URL, MASTER_KEY
class TestRankingRules:
client = meilisearch.Client(BASE_URL, MASTER_KEY)
index = None
new_ranking_rules = ['typo', 'exactness']
default_ranking_rules = [
'typo',
'words',
'proximity',
'att... |
import json
import numpy as np
HTTPS_token = '14120'
RT_token = '56898'
at_token = '137'
hashtag_token = '108'
gt_token = '135'
lt_token = '133'
amp_token = '111'
question_token = '136'
esclamation_token = '106'
period_token = '119'
two_periods_token = '131'
coma_token = '117'
dollar_token = '109'
period_coma_token ... |
from subprocess import check_output
from dateutil import parser
from datetime import datetime, timedelta
accessions = set()
for accession in open("master_table/forgotten_bgc_rescaffold.txt"):
accession = accession.strip()
accessions.add(accession)
last_hour_date_time = datetime.now() - timedelta(hours = 4)
f... |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
from... |
# 界面
import time
class Admin(object):
# 类属性
admin = '1' # 管理员账号
passwd = '1' # 管理员密码
# 方法
# 管理员登陆界面
def printAdminView(self):
print('*************************************************')
print('* *')
print... |
import sys
import psychopy
import psychopy.app
import psychopy.data
import psychopy.gui
import psychopy.gui.qtgui
import psychopy.gui.wxgui
import psychopy.hardware
import psychopy.monitors
import psychopy.preferences
# Disable sounddevice test on Windows, as currently we don't have a
# soundfile package, without whi... |
from dataclass_structor import structure, unstructure
from ._fixtures import DataClassGuest as Guest
def test_unstructure__guest_with_first_name():
expected = {"first_name": "Bobby Jim"}
assert unstructure(Guest(first_name="Bobby Jim")) == expected
def test_structure__guest_with_first_name():
expected ... |
'''
The gdx functions are located in a gdx.py file inside a folder named "gdx". In order for
the import to find the gdx folder, the folder needs to be in the same directory as this python program.
The gdx functions used in a typical program to collect data include:
gdx.open_usb() or gdx.open_ble()
gdx.select... |
"""GATK variant calling -- MuTect2.
"""
from distutils.version import LooseVersion
import os
import numpy as np
from bcbio import bam, broad, utils
from bcbio.bam import is_paired
from bcbio.log import logger
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# chomp documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... |
# Copyright 2018 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 datetime import timedelta
# import pandas as pd
# from testfixtures import TempDirectory
# from nose_parameterized import parameterized
from catalyst.algorithm import TradingAlgorithm
# from catalyst.errors import TradingControlViolation
# from catalyst.testing import (
# add_security_data,
# create_da... |
import numpy as np
#sasa_grid is depracted
#from gips.grid_solvent.spatial import sasa_grid
from gips.grid_solvent.spatial import sasa_softgrid
from gips import FLOAT
from gips import DOUBLE
class gdat_fit_lib(object):
def __init__(self, gdatarec_dict,
gdata_dict,
... |
#!/usr/bin/env python
""" A ROS planning node that subscribes to a costmap
and generates a path by using the Djikstra algorithm"""
import sys
import math
import rospy
import tf
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point, PoseStamped, PointStamped
from nav_msgs.msg import Path
from... |
# -*- coding: utf-8 -*-
import pkg_resources
import colander
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import get_renderer
from pyramid.view import view_config
from briefkasten import _, is_equal
title = "ZEIT ONLINE Briefkasten"
version = pkg_resources.get_distribution("briefkasten").version... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import pytest
from flask import request, session
from indico.mod... |
import socket
import time
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.bind(("127.0.0.1", 14900))
conn.listen(1)
conn.setblocking(False)
while True:
try:
client_s, address = conn.accept()
print(f"Connected to: {address}")
conn.setblocking(True)
data = ... |
import sys,os
sys.path.append(os.pardir)
from dataset.mnist import load_mnist
(x_train,t_train),(x_test,t_test)=load_mnist(flatten=True,normalize=False)
print(x_train.shape)
print(t_train.shape)
print(x_test.shape)
print(t_test.shape) |
from sense_hat import SenseHat
import time
def set_message(message, background_color=(0, 0, 0), foreground_color=(255, 255, 255), speed=0.10):
sense = SenseHat()
sense.show_message(message, text_colour=foreground_color, back_colour=background_color, scroll_speed=speed)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dask.array as da
import numpy as np
import pytest
from dask_image.ndfilters import threshold_local
cupy = pytest.importorskip("cupy", minversion="7.7.0")
@pytest.mark.parametrize('block_size', [
3,
[3, 3],
np.array([3, 3]),
da.from_array(np.array... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from flask_restful import Resource, fields, marshal
from http import HTTPStatus
from typing import Iterable, Union, Mapping, Tuple, Any
from flasgger import swag_from
from flask import current_app as app
from metadata_service.en... |
import torch
import sys
sys.path.append('..')
# def collate(batch):
# """A custom collate function for dealing with batches of features that have a different number of associated targets
# (action instances).
# """
# max_len = max([len(feat) for feat,_,_ in batch])
#
# features = []
# targets =... |
"""
proxy.py - A script that will help me to change my IP when I'll be ban from the server
@ Bastien Lasorne - 2021
v1.0
"""
import requests
URL = "https://www.sofascore.com/"
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36... |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 3 07:30:57 2021
@author: user
"""
import numpy as np
import sys
if sys.version_info >= (3,8):
import pickle
else:
import pickle5 as pickle
import tensorflow as tf
from tensorflow import keras
import os
import matplotlib.pyplot as plt
sys.path.insert(1, '..')
imp... |
#!/usr/bin/env python
"""
MakePDB
---------
title parm mdtraj
"""
import sys
def makepdb(title,parm,traj):
"""
Make pdb file from first frame of a trajectory
"""
cpptrajdic ={'title':title,'parm':parm,'traj':traj}
cpptrajscript="""parm {parm}
trajin {traj} 0 1 1
center
rms first @CA,C,... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
import mobile_cv.arch.fbnet_v2.fbnet_builder as fbnet_builder
def _build_model(arch_def, dim_in):
arch_def = fbnet_builder.unify_arch_def(arch_def, ["blocks"])
torch.manual_seed(0)
... |
from .simu import Simu
from .simu_with_features import SimuWithFeatures
|
# -*- coding: utf-8 -*-
import remi
import remi.gui as gui
import cv2
from threading import Timer, Thread
import traceback
import time
import math
import base64
import numpy as np
b64encoded_sample_icon = "iVBORw0KGgoAAAANSUhEUgAAADwAAAAuCAYAAAB04nriAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAFnQAABZ0B24EKIgAAABl0RVh0U29mdHdhc... |
import asyncio
import websockets
from ftx_python.stream.channel import Channel
from ftx_python.stream.subscription import Subscription
import json
from typing import Union, Dict, DefaultDict
import warnings
import time
import hmac
from collections import defaultdict
from itertools import zip_longest
import zl... |
# Copyright (c) 2012 Spotify AB
#
# 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, s... |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkPLYWriter(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkP... |
#
# MIT License
#
# Copyright (c) 2017-2019 Paul Taylor
#
# 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, ... |
def process(p, f, args, kwargs):
try:
val = f(*args, **kwargs)
p.fulfill(val)
except Exception as e:
p.reject(e)
|
# BSD 3-Clause License
#
# Copyright (c) 2016-21, University of Liverpool
# 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 above copyright notic... |
from typing import List, Optional
import marshmallow as ma
from marshmallow_sqlalchemy import ModelSchema, SQLAlchemyAutoSchema
from sqlalchemy_models import Wine
class Wine(SQLAlchemyAutoSchema):
class Meta:
model = Wine
class WineRecordsProcessed(ma.Schema):
class Meta:
fields = ("proces... |
import FWCore.ParameterSet.Config as cms
simGmtStage2Digis = cms.EDProducer("L1TMuonProducer",
autoBxRange = cms.bool(True),
autoCancelMode = cms.bool(True),
barrelTFInput = cms.InputTag("simKBmtfDigis","BMTF"),
bmtfCancelMode = cms.string('kftracks'),
bxMax = cms.int32(2),
bxMin = cms.int32(-2... |
##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except jin compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
# -*- coding: utf-8 -*-
# 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 o... |
class Config(object):
def __init__(self, db_type, ip, port, db, user, passwd):
"""
:param db_type:
* mysql
* oracle
* postgresql
:param ip:
:param port:
:param db:
:param user:
:param passwd:
"""
self.__db_t... |
# Copyright 2014 Google Inc. 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 applicable law or a... |
from tensorflow.python.framework import ops
import tensorflow as tf
from utilities import model as md
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
import os
import time
import cv2
def model(photos_train, Y_train, photos_test, Y_test, learning_rate=0.0005,
... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
import pyt... |
#!/usr/bin/env python
from optparse import OptionParser
from os.path import expandvars
usage = "usage: %prog [options] inputfile"
parser = OptionParser(usage)
parser.add_option("-o", "--outfile",default="test_flashes.i3",
dest="OUTFILE", help="Write output to OUTFILE (.i3{.gz} format)")
parser.add_o... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
#!/home/yanis/projetannuel/Mask_RCNN/env-test-model/bin/python3
# $Id: rst2xetex.py 7847 2015-03-17 17:30:47Z milde $
# Author: Guenter Milde
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Lua/XeLaTeX code.
"""
try:
import locale
lo... |
# Copyright 2014 Openstack Foundation
# 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 requ... |
"""
此模块提供了异常类。
"""
__all__ = [
'Error',
'ApiNotAvailable',
'ApiError',
'HttpFailed',
'ActionFailed',
'NetworkError',
'TimingError',
]
class Error(Exception):
"""`aiocqhttp` 所有异常的基类。"""
pass
class ApiNotAvailable(Error):
"""CQHTTP API 不可用。"""
pass
class ApiError(Error, ... |
import data.make_stterror_data.utils as utils
import os
import sys
import subprocess
# TTS imports
from gtts import gTTS
import pyttsx3
# sys.path.append("~/PycharmProjects/pyfestival") # https://github.com/techiaith/pyfestival/pull/4
# import festival
__author__ = 'Gwena Cunha'
"""
Text-To-Speech Module
"""
... |
import tensorflow as tf
from synthesizer.utils.symbols import symbols
from synthesizer.infolog import log
from synthesizer.models.helpers import TacoTrainingHelper, TacoTestHelper
from synthesizer.models.modules import *
from tensorflow.contrib.seq2seq import dynamic_decode
from synthesizer.models.architecture_wrappers... |
from math import pi, log
from functools import wraps
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def cache_fn(f):
cache = None
... |
from tests.diff import diff
from unittest import TestCase
class DiffTest(TestCase):
def test__assert_no_diff(self):
for obj in [
1,
'string',
{'complex': {'object': {'with': ['lists']}}},
]:
self.assertEqual(diff(obj, obj), [])
def t... |
import copy
import numpy as np
import random
from collections import namedtuple, deque
from keras import layers, models, optimizers
from keras import backend as K
class ReplayBuffer:
def __init__(self, buffer_size, batch_size):
self.memory = deque(maxlen=buffer_size)
self.batch_size = batch_s... |
import networkx as nx
from scapy.all import *
g=nx.Graph()
host=['clemson.edu','cs.clemson.edu']
hops=[]
global b
def trcroute(urls):
for url in urls:
try:
print ("Tracing :"+url)
a,u=traceroute([url])
for i in range(len(a)):
hops.append(a[i][1].src)
g.add_node(a[i][1].src)
print (a[i][1].sr... |
# Copyright 2022 Bill Wendling, 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 applicable law o... |
from youtubesearchpython import SearchVideos, VideosSearch
from Evie import xbot, CMD_HELP
from html import unescape
import os
from telethon import types, Button, custom, events
from telethon.tl import functions
from Evie.events import register
import re
from re import findall
from urllib.parse import quote
import re... |
import collections
import os
import random
import sklearn.preprocessing
import nn.utils as utils
import nn.utils_nlp as utils_nlp
class Dataset(object):
"""A class for handling data sets."""
def __init__(self, token_to_vector):
self.name = ''
self.verbose = False
self.debug = False
... |
a, b = map(int, input().split())
while a != b:
if a < b:
print("Crescente")
else:
print("Decrescente")
a, b = map(int, input().split())
|
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Dirk Chang and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from cloud.cloud.doctype.cloud_company.cloud_company import list_admin_companies
def is_company_admin(user... |
"""Test suite.
"""
import unittest
from .test_vector import VectorTests # noqa: F401
def main_tests() -> None:
unittest.main()
if __name__ == "__main__":
main_tests()
|
import torch
import torch.nn as nn
import torch.nn.functional as F
from subnet import ImageConvNet, AudioConvNet
class AVENet(nn.Module):
def __init__(self):
super(AVENet, self).__init__()
# image subnetwork
self.icn = ImageConvNet()
self.img_pool = nn.AdaptiveMaxPool2d(1)
... |
# 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, ... |
#!/usr/bin/env python
# coding=utf-8
'''
@Author: Mingxue Cai
@Email: im_caimingxue@163.com
@Date: 2021-06-03 15:00
'''
'''off-policy
'''
import sys,os
import datetime
import gym
import collections
import time
from common.utils import create_file, save_results
from common.plot import plot_rewards
from dqn_agent import ... |
#!/usr/bin/env python2.4
#
import os, sys
if __name__ == '__main__':
import sys
import getopt
def usage():
"Print helpful, accurate usage statement to stdout."
print "Usage: split_multi_mol2_file.py -i filename"
print
print " Description of command..."
print ... |
#https://www.educative.io/blog/crack-amazon-coding-interview-questions#prepare
# 3. Merge two sorted linked lists
# Assumption: do not have to be of equal length
# goal: merge two sorted linked lists so the resulting merged list is ordered
# complexity after written: O(n+m) where n and m are the lengths of the initial ... |
"""
developeraccount
FILE: utils
Created: 6/27/15 8:39 AM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.mail import send_mail, EmailMultiAlternatives
from django.template imp... |
#!/usr/bin/env python
# Copyright 2019 ARC Centre of Excellence for Climate Extremes
# author: Scott Wales <scott.wales@unimelb.edu.au>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
import json
import sys
from datetime import datetime
from typing import Any
import greenlet
import structlog
from .sampler import collect_frames
log = structlog.get_logger(__name__)
def install_switch_log():
# Do not overwrite the previous installed tracing function, this could be
# another profiling tool,... |
# coding: utf-8
"""
Pdf4me
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class... |
# coding=utf-8
from unittest import TestCase
from click.testing import CliRunner
import yoda
class TestPeople(TestCase):
"""
Test for the following commands:
| Module: People
| command: people
"""
def __init__(self, methodName="runTest"):
super(TestPeople, self).__init__... |
def make_list(data):
'''wraps data in a list if it isn't already a list'''
return data if isinstance(data, (list, tuple)) else [data] |
# coding: utf-8
"""
DocuSign Rooms API - v2
An API for an integrator to access the features of DocuSign Rooms # noqa: E501
OpenAPI spec version: v2
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... |
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
app = Celery("pastebin")
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - ... |
# -*- coding: utf-8 -*-
"""
test
~~~~
Tests for all of the code in the package.
:license: MIT and BSD
"""
import unittest
from unittest import TestCase
|
from __future__ import division
# LIBTBX_SET_DISPATCHER_NAME phenix.rank_scale_map
from cctbx import maptbx
import iotbx.mrcfile
from cctbx import crystal
from libtbx.utils import Sorry
from scitbx.array_family import flex
import sys, time
def show_overall_statistics(m, header):
s = maptbx.more_statistics(m)
prin... |
# ==============================================================================
#
# Use:
# decrypt(b'WzM3NDQyLCA1MjQ4OCwgNTU4NzQsIDU2MDcyLCA1NzQxMCwgMTcxNjAsIDQ1MTIyLCA1NzYwOCwgNTg5NDYsIDU2MDcyLCA1MTc3OCwgMTc2NzJd', "key")
# => "Hello World!"
#
# ===============================================================... |
# Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SearchIO BlastIO parsers."""
import os
import unittest
from Bio.SearchIO im... |
import pytest
from paths_cli.compiling.plugins import *
from unittest.mock import Mock
class TestCompilerPlugin:
def setup(self):
self.plugin_class = Mock(category='foo')
self.plugin = CategoryPlugin(self.plugin_class)
self.aliased_plugin = CategoryPlugin(self.plugin_class,
... |
"""
mlperf inference benchmarking tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import array
import collections
import json
import logging
import os
import threading
import time
from queue import Queue
import mlperf_loadgen as l... |
"""
Support for Denon Network Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.denon/
"""
import logging
import telnetlib
import voluptuous as vol
from homeassistant.components.media_player import (
PLATFORM_SCHEMA, SUPPORT_NE... |
# モジュールのインポート
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
# `lenet.py`と`cifar10.py`にあるものを読み込んでいる(アンコメントせよ(シャープを外せ))
# from lenet import Net
# from cifar10 import load_data
import warnings
warnings.filterwarnings("ignore") # warningを表示しない
def train... |
__version_info__ = (0, 15, 6, 0, "dev0")
__version__ = ".".join(str(i) for i in __version_info__)
|
import sys
import webbrowser
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
import requests
if __name__ == "__main__":
print("Googling.....")
url = "https://www.google.com/search?q=" + " ".join(sys.argv[1:])
res = requests.get(url, headers={"UserAgent": UserAgent().random})
# res.... |
import unittest
from abc import ABCMeta, abstractproperty
class MyABC(metaclass=ABCMeta):
@abstractproperty
def propA(self):
pass
class MyMixin(metaclass=ABCMeta):
@abstractproperty
def propB(self):
pass
class MyClassNoPropA(MyABC, MyMixin):
@property
def propB(self):
... |
import os
import sys
import tensorflow as tf
import numpy as np
import random
import time
from setup_imagenet import ImageNet, ImageNetModel
from Iter_FGSM_attack import Iter_FGSM
from utils_for_test import linf_loss, l0_loss, l1_loss, l2_loss, dump, generate_data
def main(args):
with tf.Session() as sess:
... |
import re
from parse import parse
def memoize(f):
def helper(self, s):
memoize_key = f"{f.__name__}:{s}"
if memoize_key not in self._memo:
self._memo[memoize_key] = f(self, s)
return self._memo[memoize_key]
return helper
class Route:
_param_pattern = re.compile(r"{([... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.alter_column('sentry_projectoptions', 'key', self.gf('django.db.models.fields.CharField')(max_length=64))
de... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Tim Rightnour <thegarbledone@gmail.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = ... |
import tensorflow as tf
import numpy as np
import utils
class ModelBasedPolicy(object):
def __init__(self,
env,
init_dataset,
horizon=15,
num_random_action_selection=4096,
nn_layers=1):
self._cost_fn = env.cost_fn
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.