content stringlengths 5 1.05M |
|---|
from pyrogram import Client
from os import getenv
from config import API_ID,API_HASH,BOT_TOKEN,PLUGINS
Client('bot', api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN,plugins=PLUGINS).run() |
''' The filename of the CSV file containing the case data. '''
DATA_CSV_FILENAME = 'latestdata.csv'
''' The path to the latest data gzip in the nCoV2019 repo. '''
DATA_GZIP_FILENAME = 'latestdata.tar.gz'
''' The path to the latest data gzip in the nCoV2019 repo. '''
DATA_REPO_PATH = 'latest_data'
''' The filename of... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import csv
from collections import defaultdict
import matplotlib.pyplot as plt
import matplotlib.style as style
style.use('ggplot')
color1 = "#F8766D"
color2... |
import sys
import time
import unittest
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
CHECK = u'\u2713 '
HEAVY_CHECK = u'\u2714 '
CROSS = u'\u2717 '
HEAVY_CROSS = u'\u2718 '
SKULL = u'\u2620 '
SKIP = u'\u2014 '
def color(txt, color=WHITE, bold=True, bgcolor=None, inverse=False):
'''Construct str... |
import os
import networkx
import itertools
from networkx.readwrite import json_graph
import json
import codecs
from multiprocessing import Process
from multiprocessing import JoinableQueue
CONFIG = {}
"""
Logs a message to the .log file about a span.
"""
def log(message, span):
if verbose:
log_messages.pu... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import io
import logging
import re
import time
import requests
import werkzeug.wrappers
from PIL import Image, ImageFont, ImageDraw
from lxml import etree
from base64 import b64decode, b64encode
from odoo.http import req... |
"""
This file tests the poll() functionality.
Target files:
- libdesock/src/poll.c
"""
import ctypes
import helper
import desock
def do_syscall(method, *args):
s = desock.socket(desock.AF_INET, desock.SOCK_DGRAM, 0)
s1 = desock.dup2(s, desock.FD_TABLE_SIZE)
pollfds = (desock.pollfd * 1)()
pollfd... |
from django import forms
from gallery.models import Tag
class FilterForm(forms.Form):
'''
Форма фильтра для списка фотографий.
'''
def __init__(self, *args, **kwargs):
super(FilterForm, self).__init__(*args, **kwargs)
self._tags = Tag.objects.all().order_by('name')
# Множест... |
from django import template
from django.conf import settings
from django.urls import reverse, NoReverseMatch
from django.utils.encoding import escape_uri_path
from django.template.loader import get_template
register = template.Library()
@register.simple_tag(takes_context=True)
def is_in_favourites(context, beer, *ar... |
from infra import dynamodb, emitter
from infra.autotag import register_auto_tags
from infra.bucket import Bucket
from infra.config import DEPLOYMENT_NAME, LOCAL_GRAPL
from infra.engagement_creator import EngagementCreator
from infra.metric_forwarder import MetricForwarder
from infra.secret import JWTSecret
from infra.s... |
import sys
import Xlib.display
import time
from pathlib import Path
import os
#from os import path
import pyscreenshot as ImageGrab
_debug = False
def _verify_destination(destination):
p = Path(destination)
if not p.exists():
p.mkdir()
else:
if p.is_file():
raise NotADirector... |
from django.shortcuts import render,redirect,get_object_or_404
from django.contrib.auth.decorators import login_required
# Create your views here.
from .models import Posts,Category
from .forms import PostForm
def blog(request):
posts = Posts.objects.all().order_by('-published')
cats = Category... |
import KratosMultiphysics
import KratosMultiphysics.HDF5Application as KratosHDF5
from KratosMultiphysics.HDF5Application import core
from KratosMultiphysics.HDF5Application.core import operations, file_io
import KratosMultiphysics.KratosUnittest as KratosUnittest
from KratosMultiphysics.HDF5Application.core.utils impo... |
from yacs.config import CfgNode as CN
_C = CN()
_C.SYSTEM = CN()
_C.SYSTEM.NUM_GPUS = 8
_C.SYSTEM.NUM_WORKERS = 4
_C.TRAIN = CN()
_C.TRAIN.HYPERPARAMETER_1 = 0.1
_C.TRAIN.SCALES = (2, 4, 8, 16)
cfg = _C
|
import math
n,s=eval(input(">>"))
area=(n*s*s)/(4*math.tan(math.pi/n))
print(area)
|
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 21:10:58 2015
@author: piotr at nicecircuits.com
"""
from libraryManager.cadPackage import cadPackage
from libraryManager.library import libraryClass
import os.path
from libraryManager.common import *
from libraryManager.footprintPrimitive import *
from libraryManage... |
import os
project_root = f'{os.path.dirname(os.path.abspath(__file__))}/..'
import numpy as np
import pandas as pd
import time
import json
import pickle
from datetime import datetime, timezone, timedelta
date = datetime.now(timezone(timedelta(hours=+9), 'JST')).strftime('%Y-%m-%d %H:%M:%S')
# mecab_dic = '/usr/lib/... |
import praw
def get_top_jokes(posts = 1):
r = praw.Reddit('jokegetter by /u/reffit_owner')
submissions = r.get_subreddit('Jokes')
posts = submissions.get_top(params={'t': 'hour'}, limit=posts)
jokes = []
for i in posts:
jokes.append(i.title + "\n" + i.selftext)
if len(jokes) == 1:
... |
"""
Utilities for request signing and response verification based on QSeal
certificates.
"""
import os
from jose import jws
class SignedClientMixin:
"""
Enables NBG API clients that can sign requests and verify responses based
on QSeal certificates.
"""
_tpp_private_key: str = None
_tpp_cer... |
"""Additional NeuroDriver Components for ANTcircuits"""
from .NoisyConnorStevens import NoisyConnorStevens
from .OTP import OTP
|
from django.conf.urls import *
urlpatterns = patterns('actividades.formutils.views',
url(r'^$', 'fill', name='fill'),
) |
'''
Visualizing Apple Watch Health Data w/ Bokeh
'''
import os
from datetime import datetime
import logging
import pandas as pd
from bokeh.io import show
from bokeh.plotting import figure, output_file, save, reset_output
from bokeh.models import (
ColumnDataSource,
HoverTool,
LinearColorMapper,
BasicTic... |
import base64
import gzip
import json
import logging
import os
from urllib.parse import urlparse
import yaml
from zentral.core.exceptions import ImproperlyConfigured
from .config import ConfigDict, ResolverMethodProxy
__all__ = ['contact_groups', 'settings', 'user_templates_dir']
logger = logging.getLogger("zentral... |
from django.conf.urls import url
from ..views import (RoundStateListView, RoundStateCreateView, RoundStateDetailView,
RoundStateUpdateView, RoundStateDeleteView)
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^create/$', # NOQA
RoundStateCreateView.as... |
from chainer.serializers import load_npz
from scipy import sparse
from chainer import Variable
from pathlib import Path
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
import os, json, sys
from train import get_model
from chainer import function
from joblib import load, dump
fr... |
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views import View
from applications.appointments.models import Appointment
from applications.medical_history.models import Medica... |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... |
#!/usr/bin/env python3
"""Classe to manage SNMP agent configurations."""
# Standard imports
from copy import deepcopy
# Import project libraries
from pattoo_shared import configuration, files
from pattoo_shared.configuration import Config
from pattoo_shared.variables import IPTargetPollingPoints
from .constants impor... |
import inspect
import weakref
from tornado import gen
from streamz import Stream
# sinks add themselves here to avoid being garbage-collected
_global_sinks = set()
class Sink(Stream):
_graphviz_shape = 'trapezium'
def __init__(self, upstream, **kwargs):
super().__init__(upstream, **kwargs)
... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict
import torch
import torchcontrol as toco
from torchcontrol.utils import to_tensor
class DefaultController(toco.Polic... |
"""
https://leetcode.com/problems/maximum-width-of-binary-tree/
Tags: POTD; Medium; Binary Tree; BFS/Level Order
"""
from typing import List, Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
... |
import os
from docx import Document
from .decision_create import (
add_line,
application_reason,
application_subject,
find_staff,
line_with_bold,
normal_center,
normal_left,
referent_speech,
referent_speech1,
staff_decree
)
from .styles import my_styles
class Protokol():
... |
#!/usr/bin/env python
from distutils.core import setup
long_description = '''
Essential Paxos provides basic implementations of the Paxos algorithm. The
distinguishing characteristic of this implementation, as compared to other
freely available and open-source implementations, is that this library is
independent of a... |
#!/usr/bin/env python
"""Client for motionEye."""
from __future__ import annotations
import hashlib
import json
import logging
from pathlib import PurePath
from types import TracebackType
from typing import Any
from urllib.parse import urlencode, urljoin, urlsplit, urlunsplit
import aiohttp # type: ignore
from . im... |
# 10th Solutions
#--------------------------
factorial = lambda x: 1 if x <= 1 else x*factorial(x-1)
print(factorial(int(input())))
|
"""
Internal package providing a Python CRUD interface to MLflow experiments and runs.
This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is
exposed in the :py:mod:`mlflow.tracking` module.
"""
import time
import os
from mlflow.store.tracking import SEARCH_MAX_RESULTS_DEFAULT
from mlflow.... |
# coding=utf-8
# Copyright 2021 The Tensor2Tensor 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... |
from .rectangular_roi import RectangularRoi
from .pinwheel import Pinwheel
|
# 从配置文件config中获取DB
# 手动修改下
class SQLManager(object):
# 初始化实例方法
def __init__(self):
self.conn = None
self.cursor = None
self.connect()
# 连接数据库
def connect(self):
self.conn = pymysql.connect(
host=DB_CONFIG["host"],
port=DB_CONFIG["port"],
... |
#!/usr/bin/env python
import sys,os
from Bio import SeqIO
from Bio.SeqIO import FastaIO
def split_records(fasta_in):
for record in SeqIO.parse(fasta_in, "fasta"):
in_fasta_basename = os.path.splitext(os.path.basename(fasta_in))[0]
out_basedir = os.path.realpath(os.path.join(os.path.dirname(fasta_in... |
from django.contrib.auth import authenticate, login
from django.contrib.auth.hashers import make_password
from rest_framework_jwt.settings import api_settings
from rest_framework import permissions
from rest_framework import viewsets, generics
from rest_framework.response import Response
from rest_framework.exceptions... |
# -*- coding: utf-8 -*-
def isInsideRestriction(lat, lon, way_nodes):
inside = False
j = len(way_nodes) - 1
for i in range(len(way_nodes)):
if ((way_nodes[i].lon > lon) != (way_nodes[j].lon > lon) and
lat < (float(way_nodes[j].lat) - float(way_nodes[i].lat)) * (lon - float(way_node... |
from flask import Flask
from os import getenv
from random import randint
app = Flask(__name__)
@app.route("/hostname")
def hostname():
return str(getenv("HOSTNAME"))
@app.route("/random")
def random_generator():
no_of_phaes = 4
return str(randint(1,no_of_phaes))
if __name__=="__main__":
app.run(host... |
"""
Example.aecSpaceGrid
Assuming you've downloaded this source to your desktop, these instructions
should work.
These classes and this example were developed using the Anaconda development
environment, relevant due to the need for the pythonOCC toolkit, a Python
wrapper around the open source openCascade geometry ke... |
'''
util for file path and log format
'''
from enum import Enum, unique
import os
import pandas as pd
@unique
class DATASET(Enum):
Android = 'Android'
Apache = 'Apache'
BGL = 'BGL'
Hadoop = 'Hadoop'
HDFS = 'HDFS'
HealthApp = 'HealthApp'
HPC = 'HPC'
Linux = 'Linux'
Mac = 'Mac'
O... |
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
from Common.optimizer import *
def f(x, y):
return x**2 / 20.0 + y**2
def df(x, y):
return x / 10.0, 2.0*y
init_pos = (-7.0, 2.0)
params = {}
params['x'], params['y'] = init_pos[0], init_pos[1]
grads = {... |
import numpy as np
args = 'Args { bitrates: true, runtimes: false, runtimes_count: 5, pause: 0 }'
start_time = '2021-12-13 15:59:10.417691698 +01:00'
git_commit = '09f4adc-modified'
entropies_headers = ('time step', 'entropy per symbol')
bitrates_headers = ('time step', 'cross entropy per symbol', 'bits per symbol')
... |
# coding=utf-8
import sys as _sys;from os import path as _p#endswith 是为了适配qgb处于另外一个包内的情况
if __name__.endswith('qgb.F'):from . import py
else:import py
T=py.importT()
import os as _os
try:from pathlib import Path
except:pass
gError=[]
def setErr(ae):
global gError
U=py.importU()
if U.gbLogErr:# U.
if... |
# Install python3 HID package https://pypi.org/project/hid/
import hid
# default is Adafruit VID
USB_VID = 0x239A
print("Openning HID device with VID = 0x%X" % USB_VID)
for dict in hid.enumerate(USB_VID):
print(dict)
dev = hid.Device(dict['vendor_id'], dict['product_id'])
if dev:
whil... |
from .property_base import Property_Base
class Property_String(Property_Base):
def __init__(self, node, id, name, settable=False, retained=True, qos=1, unit=None, data_type='string', data_format=None, value=None, set_value=None):
super().__init__(node,id,name,settable,retained,qos,unit,'string',d... |
from thumt.utils.hparams import HParams
from thumt.utils.inference import beam_search, argmax_decoding, sample
from thumt.utils.evaluation import evaluate
from thumt.utils.checkpoint import save, latest_checkpoint
from thumt.utils.scope import scope, get_scope, unique_name
from thumt.utils.misc import get_global_step, ... |
#!/usr/bin/env python
# This file is part of Fuzzgrind.
# Copyright (C) 2009 Gabriel Campana
#
# This work is licensed under the terms of the GNU GPL, version 3.
# See the LICENSE file in the top-level directory.
import getopt
import os
import re
import sys
import shutil
import subprocess
import sys
import t... |
import os
import time
import uuid
import zipfile
from pprint import pprint
from BBTools.utils.BBToolsRunner import BBToolsRunner
from installed_clients.KBaseReportClient import KBaseReport
from commandbuilder import build_options
from .file_util import (
download_interleaved_reads,
upload_interleaved_reads,
... |
from django.db import connection
from calaccess_campaign_browser import models
from calaccess_campaign_browser.management.commands import CalAccessCommand
class Command(CalAccessCommand):
help = "Flush CAL-ACCESS campaign browser database tables"
def handle(self, *args, **options):
self.header("Flush... |
#!/usr/bin/env python3
import os, sys, glob
import numpy as np
import matplotlib.pyplot as plt
import scipy, scipy.optimize, scipy.special
import mpl_toolkits
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from dicke_methods import spin_op_vec_dicke
from boson_methods import extract_avg_var_state
init... |
import smartpy as sp
admin_mixin = sp.io.import_script_from_url("file:contracts/Administrable.py")
class Pausable(admin_mixin.Administrable):
def __init__(self, administrator):
self.update_initial_storage(
paused = False
)
admin_mixin.Administrable.__init__(self, administrator... |
import numpy as np
def polinom(dif, xs,x):
resultado = dif[0]
erro = dif[len(dif)-1]*( x-xs[0] )
for i in range(1, len(xs)):
prod = 1
erro = erro * ( x - xs[i] )
for j in range(0,i):
prod = prod*( x-xs[j] )
resultado = resultado + dif[i]*prod
#print("O err... |
# 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 helix import helix
helix(n=100) |
from pyramid import testing
import unittest
class TestLetsencryptContent(unittest.TestCase):
def test_response(self):
from pyramid_letsencrypt import letsencrypt_content
request = testing.DummyRequest()
request.registry.settings = {'letsencrypt.content': 'foo.bar'}
response = le... |
''' Holds the fitness structure.
Later I want to modify this to take in the population and/or individual object, but not needed yet
Created on: 1-27-2021
Version: Python 3.8.5
Created by: Bayley King (https://github.com/king2b3)
'''
import abc
import math
class Fitness(abc.ABC):
def __init__(self... |
# -*- coding: utf-8 -*-
"""
322. Coin Change
You are given coins of different denominations and a total amount of money amount.
Write a function to compute the fewest number of coins that you need to make up that amount.
If that amount of money cannot be made up by any combination of the coins, return -1.
Note:
You m... |
from enum import Enum
from segeval.window.pk import pk
from segeval.window.windowdiff import window_diff as WD
from segeval.similarity.boundary import boundary_similarity as B
from segeval.similarity.segmentation import segmentation_similarity as S
class CalculateEnum(Enum):
"""
Four indicates: pk,windiff,bo... |
# The MIT License (MIT)
# Copyright (c) 2019 by the xcube development team and contributors
#
# 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... |
import textwrap
from storybro.play.settings import PlayerSettings
from storybro.stories.block import Block
from storybro.stories.story import Story
from storybro.story.utils import cut_trailing_sentence
class BlockFormatter:
def __init__(self, settings: PlayerSettings):
self.settings: PlayerSettings = se... |
import hypothesis.strategies as st
from hypothesis_cfg import ContextFreeGrammarStrategy
import mtl
GRAMMAR = {
'phi': (
('Unary', 'phi'),
('(', 'phi', 'Binary', 'phi', ')'),
('AP', ), ('FALSE', ), ('TRUE', )
),
'Unary': (('~', ), ('G', 'Interval'), ('F', 'Interval'), ('X', )),
... |
from pypy.rpython.lltypesystem.llmemory import raw_malloc, raw_free
from pypy.rpython.lltypesystem.llmemory import raw_memcopy, raw_memclear
from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage
from pypy.rpython.memory.support import DEFAULT_CHUNK_SIZE
from pypy.rpython.memory.support import get_addres... |
import cv2
from time import sleep
import numpy as py
import re
import sys
import os
import urllib.parse
import urllib.request
import multiprocessing
from ffpyplayer.player import MediaPlayer
def live_tv(channel_name,queue):
m3u8_dict={'aajtak':'https://vidcdn.vidgyor.com/at-origin/liveabr/at-origin/live4... |
i=10
这是基础代码
|
from .protos import videogame_pb2, videogame_pb2_grpc
from .validators.videogamesValidator import VideogameValidation
ROUTING = {
'videogames': {
'PROTO': videogame_pb2,
'PROTO_RPC': videogame_pb2_grpc,
'VALIDATOR': VideogameValidation,
'HOST': 'localhost:50051'
}
} |
### File created by preshma
import numpy as np
from HotPixelFilter import HotPixelFilter
from BackgroundFilter import BackgroundFilter
from maskRegionFilter import maskRegionFilter
import functools
def extract_from_aedat(aedat, events, startTime, stopTime, sx, sy, nbcam, thrEventHotPixel, dt, xmin_mask1, xmax_mask1, y... |
"""Unit tests for scan module."""
from unittest.mock import patch
import pytest
from pyatv.core.mdns import Response, Service
from pyatv.core.scan import BaseScanner, get_unique_identifiers
TEST_SERVICE1 = Service("_service1._tcp.local", "service1", None, 0, {"a": "b"})
TEST_SERVICE2 = Service("_service2._tcp.local... |
import random
import numpy as np
import os
import torch
class Agent:
def __init__(self):
self.model = torch.load(__file__[:-8] + "/agent.pkl")
def act(self, state):
with torch.no_grad():
state = torch.tensor(np.array(state)).float()
a, _, _ = self.model.act(sta... |
from .cluster import HydraCluster
from .cluster import HydraDockerCluster
def start_cluster(name: str, port: int, proxy_port: int, stats_port: int) -> HydraCluster:
clstr = HydraDockerCluster(name, port, proxy_port, stats_port)
clstr.start()
return clstr
def destroy_cluster(name: str) -> HydraCluster:
... |
miller_arrays[0].i_over_sig_i()
|
from .jobs import (
start_background_job,
resume_background_job,
suspend_background_job,
abort_background_job,
handle_interrupted_jobs,
read_jobs,
read_job,
delete_job,
)
from .runner import JobRunner
__all__ = [
"start_background_job",
"resume_background_job",
"suspend_back... |
# Generated by Django 3.2.5 on 2021-11-29 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0059_salesordershipment_tracking_number'),
]
operations = [
migrations.AlterField(
model_name='salesordershipment',
... |
import time
import numpy as np
from scipy import stats
from sklearn.cluster import SpectralClustering
from sklearn.cluster import KMeans
from scipy.stats import norm
import statsmodels.stats.multitest
from sklearn.impute import SimpleImputer
from Pipeline.CBASS_L3_MergeFilters import MergeFilters
from Pipeline.CBASS... |
from skimage.metrics import structural_similarity as ssim
from glob import glob
from PIL import Image
import numpy as np
import ntpath
import dhash
import cv2
from database_structure import database_migrations
IMAGE_FOLDER = "./image_store"
ALLOWED_EXTENSIONS = ['png', 'jpg', 'jpeg']
image_store_hash = dict()
db_ops ... |
set1 = {'A','B','C','D'}
set2 = {'C','D','E','F'}
set3 = {}
set4 = {}
set5 = {}
print(f'\nSet1 = {set1} \nSet2 = {set2}')
set3 = set1 | set2
#set3 = set1.union(set2)
print(f'União = {set3}')
set4 = set1 & set2
#set4 = set1.intersection(set2)
print(f'Intersecção = {set4}')
set5 = set1 - set2
#set5 = set1.difference(s... |
# ------------------------------------------------
# IMPORTS ----------------------------------------
# ------------------------------------------------
#####
# Python dist and 3rd party libraries
#####
import os, requests, json, string, datetime, logging, time
from os.path import join, dirname
from weblogger import ad... |
#
# PySNMP MIB module ADTRAN-AOS-MEDIAGATEWAY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-MEDIAGATEWAY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:14:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
name: 泛微OA filedownaction SQL注入
referer: https://wooyun.shuimugan.com/bug/view?bug_no=76418
author: Lucifer
description: fileid参数引起的布尔盲注。
'''
import sys
import requests
class weaver_oa_download_sqli_BaseVerify:
def __init__(self, url):
self.url = url
... |
import numpy as np
import pandas as pd
import torch
from preprocessor import Preprocessor
from collections import Counter, defaultdict
from sklearn.preprocessing import OneHotEncoder
import torch.utils.data as Data
from modifiers import Modifiers
class DataLoader:
def __init__(self, data, batch_size, k, context_w... |
from flask import render_template
class IndexController:
def __init__(self, app):
self.app = app
def index(self):
return render_template('apps-list.html')
|
import os
from setuptools import setup
# Utility function to read the README file, borrowed from
# https://github.com/Innovailable/pysipgate/blob/master/setup.py
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='sipgate',
python_requires='>=3',
version='... |
from __future__ import print_function
from argparse import ArgumentParser
from WMCore.Database.CMSCouch import CouchServer
from WMCore.Lexicon import splitCouchServiceURL
def cleanDeletedDoc(couchURL, totalLimit, filter, limit, type, lastSeq):
couchURLBase, dbName = splitCouchServiceURL(couchURL)
couchDB = ... |
# Copyright 2018 Tensorforce Team. 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 la... |
# Chessboard Class
import copy
import math
import sys
import string
import re
from itertools import combinations_with_replacement as comb
from itertools import product
import logging
from colorline import cprint
ASC_ONE = ord('1')
ASC_NINE = ord('9')
ASC_A = ord('A')
ASC_Z = ord('Z')
ASC_a = ord('a')
ASC_z = ord('z... |
# -*- coding: UTF-8 -*-
from PIL import Image
from resizeimage import resizeimage
import os
class FyImage(object):
sizes = {
'thumbnail': [150, 150, 'thumbnail'],
'thumbnail-s': [150, 150, 'tcrop'],
'thumbnail-lg': [270, 175, 'crop'],
'medium': [400, 0, 'width'],
... |
import numpy as np
from hyperactive import Hyperactive
def objective_function(opt):
score = -opt["x1"] * opt["x1"]
return score
search_space = {
"x1": np.arange(0, 1000, 1),
}
err = 0.001
def test_random_state_0():
hyper0 = Hyperactive()
hyper0.add_search(
objective_function,
... |
"""empty message
Revision ID: 8980655f2454
Revises:
Create Date: 2018-03-13 15:47:41.019599
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8980655f2454'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
from machine import I2C,Pin
import _thread,json,time
i2c=I2C(sda=Pin(5), scl=Pin(4), freq=40000000)
from ssd1306 import SSD1306_I2C
oled = SSD1306_I2C(128, 64, i2c)
# def tu(a,b,c):
# oled.fill(0)
# oled.text(a,2,2,1)
# oled.text(b,2,12,1)
# oled.text(c,2,22,1)
# oled.show()
def tu(a... |
from predict import Predict
from os import write
import os
import random
import copy
def printBoard(board):
for r in range(5, -1, -1):
line = '|'
for c in range(7):
token = Board(board, c, r)
token = '@' if token == 0 else 'O' if token == 1 else ' '
line = line +... |
"""
__init__.py
================
Package definition for barnesandnoble.model
This file is a part of RIT Textbook Tool.
Copyright (C) 2015 Steven Mirabito.
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
"""
__all__ = ['course', 'department', 'section', 'textbook']
|
from ridengui.ui.main import Ui_MainWindow
from ridengui.ui.serial import Ui_Serial
from ridengui.ui.settings import Ui_Settings
|
#!/usr/bin/python
#
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.urls import open_url
from .enrolled_identities import EnrolledIdentity
from .pkcs11.crypto import PKCS11Crypto
try:
from cryptography impor... |
# Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
# 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 ... |
from os import path as P
from traitlets.config import Application
from traitlets.traitlets import (
Bool, Unicode, Integer, List, Dict
)
# -- Load config
class CookaApp(Application):
server_port = Integer(8240).tag(config=True)
language = Unicode("en_US").tag(config=True)
data_directory = Unicode("~/... |
from SBMLKinetics import *
from SBMLKinetics.kinetics_output import *
from SBMLKinetics._version import __version__ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.