text stringlengths 2 999k |
|---|
import FWCore.ParameterSet.Config as cms
# EventSetup modules
from RecoLocalMuon.RPCRecHit.cscObjectMapESProducer_cfi import *
from RecoLocalMuon.RPCRecHit.dtObjectMapESProducer_cfi import *
# EDProducer
from RecoLocalMuon.RPCRecHit.rpcPointProducer_cfi import *
|
from setuptools import setup, find_packages
'''
py_modules:只识别.py文件,其他文件不识别
可以自动添加README.rst和MANIFEST.in文件,但不能自动添加LICENSE.txt文件
packages=find_packages 让setup自动查找需要打包的子包
platforms=["all"] 支持所有平台使用
'''
setup(
name='fileutil',
version='1.0.4',
description=r'''
file union,file split by row/... |
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from uniborg.util import lightning_cmd
@borg.on(lightning_cmd("mask ?(.*)"))
async def _(event):
if event.fwd_from:
return
if not event.reply_to_msg_id:
await event.edit("```Reply to any user message.```"... |
from cpu import getCPU, X86, X86_64
from makeutils import extractMakeVariables, parseBool
from outpututils import rewriteIfChanged
import sys
def iterBuildInfoHeader(targetPlatform, cpuName, flavour, installShareDir):
platformVars = extractMakeVariables(
'build/platform-%s.mk' % targetPlatform,
dict.fromkeys(
... |
from datetime import timedelta as delta
from os import path
from glob import glob
import numpy as np
import dask
import math
import xarray as xr
from netCDF4 import Dataset
import warnings
import matplotlib.pyplot as plt
warnings.simplefilter('ignore', category=xr.SerializationWarning)
from parcels import AdvectionRK4... |
class DataObject(object,IDataObject,IDataObject):
"""
Implements a basic data transfer mechanism.
DataObject()
DataObject(data: object)
DataObject(format: str,data: object)
"""
def ContainsAudio(self):
"""
ContainsAudio(self: DataObject) -> bool
Indicates whether the data object con... |
# -*- coding: utf-8 -*-
import scrapy
import logging
class CountriesSpider(scrapy.Spider):
name = 'countries'
allowed_domains = ['www.worldometers.info']
start_urls = ['https://www.worldometers.info/world-population/population-by-country/']
def parse(self, response):
countries = response.xpath... |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v2.model_utils import (
ModelNormal,
cached_property,
... |
import os
import sys
from oba_rvtd_deployer import REPORTS_DIR, CONFIG_DIR, CONFIG_TEMPLATE_DIR
class FabLogger():
'''Copied from http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python
'''
def __init__(self, filename=os.path.join(REPORTS_DIR, 'fab.log')):
self.termina... |
import time
import torch
import torchani
import pynvml
import gc
import os
from ase.io import read
import argparse
summary = '\n'
runcounter = 0
N = 200
last_py_speed = None
def checkgpu(device=None):
i = device if device else torch.cuda.current_device()
t = torch.cuda.get_device_properties(i).total_memory
... |
"""
@author: Jun Wang
@date: 20201101
@contact: jun21wangustc@gmail.com
"""
import os
import logging as logger
import cv2
import numpy as np
import torch
from torch.utils.data import Dataset
logger.basicConfig(level=logger.INFO,
format='%(levelname)s %(asctime)s %(filename)s: %(linen... |
"""
Copyright (c) 2019 Uber Technologies, Inc.
Licensed under the Uber Non-Commercial License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at the root directory of this project.
See the License for the specific language governing permissions a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 4 22:06:18 2021
@author: daze
"""
import sys
sys.path.append('../')
import factories as f
gateway = f.GatewayFactory().default_gateway() |
"""Simple question program by gabr0."""
class Question:
"""Basic question generator."""
answer = None
text = None
class Add(Question):
"""Sum question generator."""
def __init__(self, num1, num2):
"""Declare text and answer."""
self.text = '{} + {}'.format(num1, num2)
s... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 18:35:37 2018
@author: JinJheng
"""
for x in range(1,10):
for y in range(1,10):
print(x*y,"\t",end="")
print() |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Red Hat, Inc
# Copyright (c) 2010 Seth Vidal
#
# kitchen is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opt... |
from .resnet import *
from .res2net import *
from .tridentnet import *
from .pyconvresnet import *
from .rexnet import *
from .darknet import *
from .darknetv2 import *
from .darknetv3 import *
from .darknetv4 import *
from .sknet import *
from .repvgg import *
from . import detection
from . import segmentation
|
#!/usr/bin/env python
import webob
def make_middleware(app):
from repoze.profile.profiler import AccumulatingProfileMiddleware
return AccumulatingProfileMiddleware(
app,
log_filename='/tmp/profile.log',
discard_first_request=True,
flush_at_shutdown=True,
path='/__profile... |
from spatz import Spatz
from spatz import Middleware
from spatz import Model
from spatz import render_template
app = Spatz()
@app.route("/home")
def home(request, response):
response.text = "Hello from the HOME page"
@app.route("/about")
def about(request, response):
response.text = "Hello from the ABOUT p... |
from Gaudi.Configuration import *
from Configurables import DaVinci
#from Configurables import AlgTool
from Configurables import GaudiSequencer
MySequencer = GaudiSequencer('Sequence')
#For 2012 MC
#DaVinci.DDDBtag='dddb-20130929-1'
#DaVinci.CondDBtag='sim-20130522-1-vc-md100'
#for 2011 MC
DaVinci.DDDBtag='dddb-20130... |
# coding=utf-8
# Author: Li xinming
# coding=utf-8
from math import log10
from math import pow
from operator import attrgetter
from random import choice
from random import random
from random import sample
from sys import argv
# save_out = stdout
# 输出重定向至指定的文件中,便于查看
# file_obj = open('out.txt', 'w+')
# stdout = file... |
"""Public API for the NUTS Kernel"""
from typing import Callable, NamedTuple, Tuple
import jax
import jax.numpy as jnp
import numpy as np
import blackjax.mcmc.hmc as hmc
import blackjax.mcmc.integrators as integrators
import blackjax.mcmc.metrics as metrics
import blackjax.mcmc.proposal as proposal
import blackjax.mc... |
# Copyright (c) 2020-2022 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import numpy as np
from pandapipes.component_models.ext... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *********************************************
# OM Ganesha
# *********************************************
"""elasticdatamanager.py view.
"""
import transaction
import logging
import json
from transaction.interfaces import ISavepointDataManager, IDataM... |
from django.db import models
# import json
# Create your models here.
# class JSONFiled(models.TextField):
# description = "Json"
# def to_python(self, value):
# v = models.TextField.to_python(self, value)
# try:
# return json.loads(v)['v']
# except:
# pass
#... |
"""
Revision ID: 0305b_branding_request_template
Revises: 0305a_merge
Create Date: 2019-07-30 09:26:00
"""
from alembic import op
from flask import current_app
revision = '0305b_branding_request_template'
down_revision = '0305a_merge'
templates = [
{
'id': '7d423d9e-e94e-4118-879d-d52f383206ae',
... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# xcs
# ---
# Accuracy-based Classifier Systems for Python 3
#
# http://hosford42.github.io/xcs/
#
# (c) Aaron Hosford 2015, all rights reserved
# Revised (3 Clause) BSD License
#
# Implements the XCS (Accuracy-based Cla... |
# Copyright 2014 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.
import contextlib
import datetime
import logging
import urlparse
from google.appengine.api import taskqueue
from google.appengine.api import modules
from go... |
from discord.ext import commands
import os
import traceback
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_command_error(ctx, error):
orig_error = getattr(error, "original", error)
error_msg = ''.join(traceback.TracebackException.from_exception(orig_err... |
from django.contrib import admin
# Register your models here.
from .models import Comment
from django.urls import reverse
from django.utils.html import format_html
def disable_commentstatus(modeladmin, request, queryset):
queryset.update(is_enable=False)
def enable_commentstatus(modeladmin, request, queryset):
... |
"""Linter to check for duplicate functions in test files."""
from __future__ import absolute_import
import collections
import re
from shared.testutil import lintutil
_TEST_FN_RE = re.compile(r'^\s{4}def (\w*test\w*)\(', re.MULTILINE)
_CLASS_NAME_RE = re.compile(r'^class (\w*)', re.MULTILINE)
def _matches_with_lin... |
# import packages
import math
import argparse
import graphlab as gl
########################################################################################################################
# loads data
def load_data():
# load data
data = gl.SFrame.read_csv('../../../data/nowplaying_subset.csv', delimiter='... |
# Copyright 2011 Piston Cloud Computing, 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
#
# Unle... |
from datetime import datetime, timedelta
import pytest
import pytz
from pyhamtools.locator import calculate_sunrise_sunset
UTC = pytz.UTC
class Test_calculate_sunrise_sunset_normal_case():
def test_calculate_sunrise_sunset(self):
time_margin = timedelta(minutes=1)
locator = "JN48QM"
t... |
def math():
test_case = int(input())
for i in range(test_case):
a, b = map(int, input().split())
res = a + b
if res == 0:
print('PROXYCITY')
elif res == 1:
print('P.Y.N.G.')
elif res == 2:
print('DNSUEY!')
elif res == 3:
... |
from .base import Callback
from .base import CallbackHandler
from .log import LoggerCallback
from .adaptive_lr import AdaptiveLearningRateCallback
from .model_checkpoint import ModelCheckpointCallback
|
from ztag.annotation import *
class HTTPServerParse(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port = None
tests = {
"nginx":{
"local_metadata":{
"product":"nginx",
"version":"1.4.6"
},
"global_metadata":{
"os":... |
"""Synthesizes speech from the input string of text or ssml.
Note: ssml must be well-formed according to:
https://www.w3.org/TR/speech-synthesis/
"""
from google.cloud import texttospeech
from playsound import playsound
# Instantiates a client
client = texttospeech.TextToSpeechClient()
# Set the text input to be ... |
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloo... |
import torch
from torch import nn
from transformers.modeling_auto import AutoModel
from torch.nn import CrossEntropyLoss
import sys,os
import logging
logger = logging.getLogger(__name__)
WEIGHTS_NAME_STUB = "pytorch_model"
import git
class OneTeacherOneStudent(nn.Module):
def __init__(self,config,model_name_or_pat... |
from net_test_tools.topic import udping
if __name__ == "__main__":
LOCAL = ("127.0.0.1", 8000)
REMOTE = ("127.0.0.1", 8001)
PACKET_SIZE: int = 2048 # 每个包的(最大)长度,[1, 4096] bytes
N_PACKET = 100 # 总共生成多少个包,[1, 256^256)个
RANDOM_SIZE: bool = True # 是否随机长度,如果为True,每个包的长度范围是 [1, PACKET_SIZE]
TIMEO... |
"""
entrada
galones-->int-->g
salida
precio-->str-->p
"""
g=int(input("digite la cantidad de galones "))
pp=g*3785
p=pp*50000
print("el precio a pagar es de $ "+str (p)) |
"""Exposes paths to assets"""
import pathlib
ROOT = pathlib.Path(__file__).parent
CSS_ROOT = ROOT / "css"
IMAGE_ROOT = ROOT / "images"
BOOTSTRAP_PANEL_EXPRESS_CSS = CSS_ROOT / "bootstrap_panel_express.css"
CODE_HILITE_PANEL_EXPRESS_CSS = CSS_ROOT / "code_hilite_panel_express.css"
SCROLLBAR_PANEL_EXPRESS_CSS = CSS_ROO... |
#
# doom_instance_bt.py, doom-net
#
# Created by Andrey Kolishchak on 01/21/17.
#
import os
import glob
from vizdoom import *
from doom_instance import DoomInstance
from doom_object import DoomObject
import numpy as np
import math
import itertools
from wad import Wad
class DoomInstanceBt(DoomInstance):
def __init... |
"""Provide the PRAW models."""
from .auth import Auth
from .front import Front
from .helpers import LiveHelper, MultiredditHelper, SubredditHelper
from .inbox import Inbox
from .list.redditor import RedditorList
from .list.trophy import TrophyList
from .listing.domain import DomainListing
from .listing.generator import... |
"""
Copyright (c) 2011 Tencent Inc.
All rights reserved.
Author: Huan Yu <huanyu@tencent.com>
Feng Chen <phongchen@tencent.com>
Yi Wang <yiwang@tencent.com>
Chong Peng <michaelpeng@tencent.com>
Date: October 20, 2011
This is the scons rules genearator module which invokes... |
import numpy as np
import pandas as pd
import pytest
from sdmetrics import compute_metrics
from sdmetrics.demos import load_single_table_demo
from sdmetrics.single_table.base import SingleTableMetric
from sdmetrics.single_table.bayesian_network import BNLikelihood, BNLogLikelihood
from sdmetrics.single_table.detection... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hovii_34298.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Im... |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.teleport.JailTeleportActorOV
from pirates.teleport.DistributedTeleportActorOV import DistributedTeleportActorOV
class JailTelep... |
# -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
class CalendarEvents():
pass
|
# Copyright (c) Aishwarya Kamath & Nicolas Carion. Licensed under the Apache License 2.0. All Rights Reserved
"""Postprocessors class to transform MDETR output according to the downstream task"""
from typing import Dict
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from mdetr.ut... |
"""Declares the current version for use in setuptools and the like"""
__version__ = '3.1.6'
|
from src.merkle_tree import merkelize, mk_branch, verify_branch
from src.compression import compress_fri, decompress_fri, compress_branches, decompress_branches, bin_length
from src.poly_utils import PrimeField
import time
from src.fft import fft
from src.fri import prove_low_degree, verify_low_degree_proof
from src.ut... |
import sys
import tensorflow as tf
import pandas as pd
import numpy as np
import os
import matplotlib
import matplotlib.pyplot as plt
import random
import tensorflow as tf
import tensorflow.contrib.learn as tflearn
import tensorflow.contrib.layers as tflayers
from tensorflow.contrib.learn import learn_runner
import ten... |
'''
Description:
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones' positions (in units) in sorted ascending order, determine if the frog is able to cross the riv... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
float_or_none,
int_or_none,
parse_duration,
str_to_int,
xpath_text,
)
class TNAFlixNetworkBaseIE(InfoExtractor):
# May be overridd... |
import os
PROJECT_ROOT_ENV = 'GAUGE_PROJECT_ROOT'
STEP_IMPL_DIR_ENV = 'STEP_IMPL_DIR'
def get_project_root():
try:
return os.path.abspath(os.environ[PROJECT_ROOT_ENV])
except KeyError:
return ""
def get_step_impl_dirs():
step_impl_dir_names = map(str.strip, os.getenv(STEP_IMPL_DIR_ENV).... |
# test_diff.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.test.lib import (
TestBase,
StringProcessAdapter,
fixture,
ass... |
import binascii
import os
SDM_META_READ_KEY = binascii.unhexlify(os.environ.get("SDM_META_READ_KEY", "00000000000000000000000000000000"))
SDM_FILE_READ_KEY = binascii.unhexlify(os.environ.get("SDM_FILE_READ_KEY", "00000000000000000000000000000000"))
ENC_PICC_DATA_PARAM = os.environ.get("ENC_PICC_DATA_PARAM", "picc_da... |
#!/usr/bin/env python
#
# Copyright (c) 2016-2017 Nest Labs, 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/lice... |
"""app models"""
import uuid
QUESTIONS = {}
ANSWERS = {}
class Question:
def __init__(self, question_id, title, question):
"""class constructor"""
self.id = question_id
self.title = title
self.question = question
self.answers_id = str(uuid.uuid4())
def add(self):
... |
import numpy as np
from gurobipy import *
from collections import deque
import copy
import sys, math
class AdaptiveRouting(object):
def __init__(self, tolerance_fairness, max_intrablock_distance=2):
## records the maximum number of hops we permit packets to traverse within a block
self.max_tolerable_intrablock_di... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BalancedBudget.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise... |
from PIL import Image, ImageOps, ImageDraw
import glob, os
size = 80, 80
for infile in glob.glob("static/images/diasLiturgicos/*.*"):
name = os.path.basename(infile)
file, ext = os.path.splitext(infile)
im = Image.open(infile)
output = ImageOps.fit(im, size, centering=(0.5, 0.5))
output.... |
# Make sure that caffe is on the python path:
caffe_root = '../' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
# Load the original network and extract the fully connected layers' parameters.
net = caffe.Net('../models/bvlc_reference_caffenet/... |
class Character():
__race: str
__gender: str
__hair: str
__hair_color: str
__height: str
__pain_remark: str
__celebration_remark: str
__flirtatious_remark: str
__sexy_remark: str
__angry_remark: str
# Character remarks
def sound_pain(self) -> None:
print(self.... |
import FWCore.ParameterSet.Config as cms
'''
Produces "preppedMuons"
Uses the MET uncertainty variations from runMETCorrectionsAndUncertainties() function
See L768 of PhysicsTools/PatUtils/python/tools/runMETCorrectionsAndUncertainties.py
'''
def muonPrep(process, isMC):
# TODO: corrections
# KaMuCa? Rochester... |
# Generated by Django 3.1.2 on 2020-11-19 03:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_auto_20201119_0116'),
]
operations = [
migrations.AlterField(
model_name='order',
name='status',
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from caffe2.proto import caffe2_pb2
def _parseFile(filename):
out_net = caffe2_pb2.NetDef()
# TODO(bwasti): A more robust handler for pathnames.
di... |
# Copyright (c) 2015 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
import torch.nn as nn
from simplecv.interface import ConfigurableMixin
from simplecv.module._hrnet import hrnetv2_w18
from simplecv.module._hrnet import hrnetv2_w32
from simplecv.module._hrnet import hrnetv2_w40
from simplecv.module._hrnet import hrnetv2_w48
from simplecv.module import context_block
from simplecv.modul... |
# *-* coding:utf-8 *-*
import json
import os
import time
import urlparse
from selenium import webdriver
from weibo import APIClient
class WeiboHelper(object):
"""
app_key, app_secret 新浪开放平台获取http://open.weibo.com/
callback_url 回调地址,必须为一个公网地址
account, password 用于分享的账号/密码
"""
def __init__(self... |
from django.conf.urls import url
from website.views import (
about,
championships,
city_page,
contacts,
ermc_qualification_2019,
export_tournament_results,
home,
iormc_2018,
online_tournament_rules,
rating_faq,
search,
wrc_qualification_2020,
)
urlpatterns = [
url(r... |
#
# Copyright (c) 2018 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... |
#
#
# KDE_plasma.py - Commands for KDE env
#
# Created by Benoît(Bensuperpc@gmail.com) 30, April of 2019
# Updated by X for python 3.X
#
# Released into the Public domain with MIT licence
# https://opensource.org/licenses/MIT
#
# Written with Sublime text 3 and python 3.7.3
# Script compatibility : Linux (Ubuntu ad deb... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_0.models.auth_ac... |
# Generated by Django 3.1.2 on 2021-02-23 20:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_corelevelplans_joining_pv'),
]
operations = [
migrations.AddField(
model_name='corelevelplans',
nam... |
"""zetakappa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
# Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//h1[@class='product-name']",
'price' : "//p[@class='product-price price-box']/label/span[@class='price product-price']",
'categor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utilities for viewing DataFrames with molecules.
"""
# import os.path as op
import base64
import time
from itertools import chain
from io import BytesIO as IO
import pandas as pd
import numpy as np
pd.set_option("display.max_colwidth", None)
from PIL import Image,... |
from collections import deque
import sys
import math
import numpy as np
def interact(env, agent, num_episodes=20000, window=100):
""" Monitor agent's performance.
Params
======
- env: instance of OpenAI Gym's Taxi-v1 environment
- agent: instance of class Agent (see Agent.py for details)
-... |
from __future__ import division
from models import *
from utils.utils import *
from utils.datasets import *
import os
import sys
import time
import datetime
import argparse
from PIL import Image
import torch
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable... |
"""
@author: Hasan Albinsaid
@site: https://github.com/hasanabs
"""
import numpy as np
import itertools
from tensorflow import keras
from tensorflow.keras.layers import Dense, BatchNormalization
from tensorflow.keras.optimizers import SGD
def nck(n,k):
return np.math.factorial(n)/np.math.factorial(k)/np.math.fact... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
#import FWCore.Framework.test.cmsExceptionsFatal_cff
#process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options
process.load("FWCore.MessageService.test.Services_cff")
process.MessageLogger = cms.Service("MessageLogger",
sig_deb... |
"""quote unquote scripts."""
|
'''
urlresolver XBMC Addon
Copyright (C) 2013 Bstrdsmkr
This program 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.
This program is distri... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from store.models import Product, Supplier, Buyer, Order
@login_required(login_url='login')
def dashboard(request):
total_product = Product.objects.count()
total_supplier = Supplier.objects.count()
tot... |
from typing import Optional
from fastapi import FastAPI, Security, HTTPException
from fastapi.responses import HTMLResponse
from starlette import status
# api
from api.security import *
from api.models import *
# clearos
from clearos.firewall import *
from clearos.dhcp import *
CLEAROS_API_VER = "0.2.0"
app = FastA... |
import torch
import torchvision
import torchvision.transforms as transforms
import torch.utils.data as data
import argparse
import numpy as np
from scripts.data_dependent_prior_sgd import train_classifier_epoch
from src.model.cnn import resnet20
from src.model.base.classifier import Classifier
from tqdm import tqdm
imp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Developed by Shangchen Zhou <shangchenzhou@gmail.com>
from models.submodules import *
from utils.network_utils import *
from config import cfg
class StereoDeblurNet(nn.Module):
def __init__(self):
super(StereoDeblurNet, self).__init__()
# encoder
... |
"""awwwards URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.db.models import Max
from django_sample_generator import fields, generator
from .models import Comment
from .utils import update_comments_h... |
from copy import deepcopy
import inspect
import logging
import os
from pathlib import Path
from pprint import pformat
import re
import shutil
import tempfile
from typing import BinaryIO, Iterable, List, Optional, Tuple, Union
import uuid
import asdf
import humanize
import numpy
import pygtrie
import scipy.sparse
from... |
from __future__ import print_function, division
from sympy import Number
from sympy.core import Mul, Basic, sympify, Add
from sympy.core.compatibility import range
from sympy.functions import adjoint
from sympy.matrices.expressions.transpose import transpose
from sympy.strategies import (rm_id, unpack, typed, flatten,... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyNeuroc(PythonPackage):
"""Python library neuron morphology analysis"""
homepage = ... |
import numpy as np
from pre import point, example, golden_search
def ALM(loss_function: example, start: point, y_t: float, epsilon=0.1, iteration_max=1000) -> list:
points, M, k = [start], len(start), 0
while True:
# find the new point by cyclic coordinate method
p = points[k]
p_old =... |
#!/usr/bin/env python3
"""
Update the `version_info` embedded in the library to the given version.
"""
import sys
from os.path import abspath, join, dirname
if __name__ == '__main__':
try:
major, minor, patch = map(int, sys.argv[1].split('.'))
except (IndexError, ValueError):
print('Need versio... |
from datetime import datetime
from netmiko import ConnectHandler
from datetime import datetime
from net_system.models import NetworkDevice, Credentials
import django
def main():
django.setup()
start_time = datetime.now()
devices = NetworkDevice.objects.all()
for a_device in devices:
pr... |
"""
Exports the embeddings and labels of a directory of images as numpy arrays.
Typicall usage expect the image directory to be of the openface/facenet form and
the images to be aligned. Simply point to your model and your image directory:
python facenet/contributed/export_embeddings.py ~/models/facenet/20170216-0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.