text stringlengths 1 927k |
|---|
class Color(object):
""" 输出各种颜色,方便 shell观察 """
@staticmethod
def black(text):
""" 黑色 """
return '\033[90m{content}\033[0m'.format(content=text)
@staticmethod
def red(text):
""" 红色 """
return '\033[91m{content}\033[0m'.format(content=text)
@staticmethod
def ... |
"""
Copyright 2017-present, Airbnb Inc.
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, sof... |
"""
Functions to help with calculating batch properties for experiments objects.
"""
from __future__ import annotations
import logging
from dials.array_family import flex
logger = logging.getLogger("dials")
class batch_manager:
def __init__(self, batches, batch_params):
# batch params is a list of dic... |
# -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
# Import python libs
import logging
import os.path
import os
import StringIO
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.utils
import salt.utils.templates
import salt.utils.validate... |
#!/usr/bin/env python2
#Author: Stefan Toman
import itertools
import numpy as np
from operator import mul
from sklearn.linear_model import LinearRegression
if __name__ == '__main__':
#read input
f, n = map(int, raw_input().split())
X = []
y = []
for _ in range(n):
line = raw_input().split... |
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from bokeh.sampledata.iris import flowers
from bokeh.plotting import figure, show, output_server
colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
flowers['color'] = flowers['species'].map(lambda x: colormap... |
import Queue
class binary_node(object):
def __init__(self, _value):
self.value = _value
self.left = None
self.right = None
'''
Breadth-First search
'''
def breadth_first(_tree):
if not _tree:
return False
result = []
queue = Queue.Queue()
queue.put(_tree)... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... |
#version 15:38
import random
import string
#name = 'zzz'
set_off = 23
def convert(name):
for i in range(len(name)):
if name[i].lower() == 'i' or name[i].lower() == 'y' or name[i].lower() == '9':
name = list(name)
name[i] = 'g'
name = ''.join(name)
indx = 0
... |
import logging
import os
import pytest
import time
import grpc
import requests
from docker import Client
from tools.minicluster.main import setup, teardown, config as mc_config
from tools.minicluster.minicluster import run_mesos_agent, teardown_mesos_agent
from host import start_maintenance, complete_maintenance, wait... |
# -*- 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 or... |
from recip.network.messages.extensions.ExtMessage import ExtMessage
from recip.network.messages.extensions import ExtMessageType
from recip.core.Account import Account as CoreAccount
from recip.core import AccountType
from recip.storage import Accounts
from recip.util import Address
from recip.util import Crypto
from r... |
import tensorflow as tf
import cv2
from glob import glob
import sys
import os
from os import path
import json
import random
from datasets.datasets_features import bytes_feature
# Metodo que regresa el dataset de f360 ya procesado a tfrecord
# Los data set tiene el formato:
# x: tensor con la imagen normalizada
# ... |
# Auto generated by 'inv collect-airflow'
from airfly._vendor.airflow.decorators.base import DecoratedOperator
from airfly._vendor.airflow.operators.python import PythonOperator
class _PythonDecoratedOperator(DecoratedOperator, PythonOperator):
pass |
from __future__ import absolute_import, unicode_literals
from ..util import Wheel
from ....util.path import Path
BUNDLE_FOLDER = Path(__file__).absolute().parent
BUNDLE_SUPPORT = {
"3.10": {
"pip": "pip-21.3.1-py3-none-any.whl",
"setuptools": "setuptools-58.3.0-py3-none-any.whl",
"wheel": ... |
#!/usr/bin/python3
import turtle
def draw(t, length, n):
if n == 0:
return
angle = 50
t.fd(length*n)
t.lt(angle)
draw(t, length, n-1)
t.rt(2*angle)
draw(t, length, n-1)
t.lt(angle)
t.bk(length*n)
bob = turtle.Turtle()
print(bob)
draw(bob, 7, 5)
turtle.mainloop() |
from flask import json
from lms.lmsdb.models import Solution, User
from tests import conftest
USER_COMMENT_BEFORE_ESCAPING = '<html><body><p>Welcome "LMS"</p></body></html>'
USER_COMMENT_AFTER_ESCAPING = (
'<html><body><p>Welcome "LMS"'
'</p></body></html>'
)
c... |
for i in range(1,11):
print(str(i))
print(list(range(1,11))) |
import dateutil.parser
import datetime
import logging
import re
from kestrel.utils import dedup_dicts
from kestrel.semantics import get_entity_table
from kestrel.syntax.paramstix import parse_extended_stix_pattern
from kestrel.exceptions import (
InvalidAttribute,
UnsupportedStixSyntax,
KestrelInternalErro... |
"""
==========================================================================
SystolicCL_test.py
==========================================================================
Test cases for Systolic Array with CL data/config memory.
Author : Cheng Tan
Date : Dec 28, 2019
"""
from pymtl3 import ... |
# Generated by Django 2.2.16 on 2021-05-08 23:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Attic', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='consultation',
name='service',
... |
#!usr\bin\python
"""SubModule counter"""
#count how many objects of module are modules themselfs
__author__ = "JayIvhen"
def u_input():
pass
def u_count(name):
a = 0
try:
module = __import__(name)
for i in dir(module):
try:
print i,
print typ... |
# Databricks CLI
# Copyright 2017 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"), except
# that the use of services to which certain application programming
# interfaces (each, an "API") connect requires that the user first obtain
# a license for the use of the APIs from Databricks,... |
import os
from datetime import datetime
from glob import glob
from pathlib import Path
from astropy.io import fits
from matplotlib import pyplot as plt
from tabulate import tabulate
from termcolor import cprint
from tqdm import tqdm
import amical
def _select_data_file(args, process):
"""Show report with the dat... |
# FIXME: fix all "happy paths coding" issues
import liblo
from threading import Thread
class Mext(object):
device = None
def __init__(self, device_port=5000):
self.device_receiver = liblo.ServerThread(device_port)
self.device_receiver.add_method("/monome/grid/key", "iii", self.on_grid_key)
... |
from __future__ import unicode_literals
import re
import string
from datetime import date
from datetime import datetime
from datetime import time
from enum import Enum
from typing import Any
from typing import Dict
from typing import Generator
from typing import List
from typing import Optional
from typing import Uni... |
# -*- coding: utf-8 -*-
#*****************************************************************************
# Copyright (C) 2003-2006 Gary Bishop.
# Copyright (C) 2006 Jorgen Stenarson. <jorgen.stenarson@bostream.nu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYIN... |
"""
This file was auto-generated by an ObjectFactory of aTLAS
"""
NAME = 'Basic Scenario'
AGENTS = ['A', 'B', 'C', 'D']
OBSERVATIONS = [{'authors': ['A'],
'before': [],
'details': {'content_trust.topics': ['Web Engineering'],
'uri': 'http://example.co... |
# Copyright (c) 2015, Scott J Maddox. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file.
import os
import sys
fpath = os.path.abspath(os.path.join(os.path.dirname(__file__),
'../fdint/_dfd.pyx'))
with open... |
from Experiment import *
from GIF import *
from GIF_K import *
from AEC_Badel import *
from Tools import *
from Filter_Rect_LinSpaced import *
from Filter_Rect_LogSpaced import *
from Filter_Exps import *
import matplotlib.pyplot as plt
import numpy as np
import copy
import json
import scipy
from scipy import io
i... |
import sys
import cv2
import colorize
import os
colorize.loadDNN(False)
gif_path = sys.argv[1]
cam = cv2.VideoCapture(gif_path)
counter = 0
while True:
ret,img = cam.read()
if not ret:
break
temp_img_path = '/tmp/%06d.jpg'%counter
cv2.imwrite(temp_img_path,img)
coloredImage = colorize.ru... |
# mailbox_or_url_parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_it... |
import networkx as nx
import matplotlib.pyplot as plt
G = nx.DiGraph()
#with open ("shortinput.txt") as fd:
with open ("input.txt") as fd:
for line in fd:
x = line.split(" ")
before = x[1]
after = x[7]
G.add_edge(before, after, weight=ord(after)-64)
nx.draw(G, with_labels=True)... |
import pymongo
from flask import Flask, jsonify, request
def get_db_connection(uri):
client = pymongo.MongoClient(uri)
return client.cryptongo
app = Flask(__name__)
db_connection = get_db_connection('mongodb://localhost:27017/')
def get_documents():
params = {}
name = request.args.get('name', '')
... |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
PY3 = bytes != str
# Below IsCygwin() function copied from pylib/gyp/common.py
def IsCygwin():
tr... |
import os
import random
from os.path import join, basename, dirname
import cv2
import numpy as np
import torch
from glob import glob
import ipdb
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from utils import normalize, Crop, Flip, ToTensor
class AnthroDeblurDataset(Dataset):
... |
"""This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: ... |
import pandas as pd
import pytest
from pandas.testing import assert_frame_equal, assert_series_equal
import komono.pandas._reduce_memory as rd
@pytest.fixture
def base_data():
return {
"int8": [-128, 127],
"int16": [-129, 127],
"Int8": [None, 127],
"Str": ["foo", "bar"],
}
@... |
from pytest import fixture, raises
import easy_dict as nd
@fixture()
def n():
return nd.NestedDict({'a': {'b': {'c': 123}}, 'd': {'e': 456}, 'f': {'e': 789}})
def test_mod_rooted_chain(n):
n['a']['b']['c'] = 234
assert n == {'a': {'b': {'c': 234}}, 'd': {'e': 456}, 'f': {'e': 789}}
def test_mod_float... |
"""
群成员权限验证
"""
from typing import Iterable, List
from app import db
from app.models import Group, GroupUser, MainUser, GroupUserRelation
from app.utils.db import get_group
def is_(role: List[str], main_user: MainUser, group_id, platform):
"""
该用户是否是指定群组的管理员
需要用户先绑定群组!
:param role: 群角色,可选 'admin' 或 '... |
__author__ = 'sulantha'
from Utils.DbUtils import DbUtils
import Config.PipelineConfig as pc
from Pipelines.ADNI_T1.ADNI_T1_Helper import ADNI_T1_Helper
from Utils.PipelineLogger import PipelineLogger
import distutils.dir_util
import distutils.file_util
import shutil
import subprocess
from Manager.QSubJob import QSubJ... |
import numpy as np
from allvar import *
def _distance(r1, r2):
"""Return Euclidean _distance between positions"""
return np.sqrt(np.sum((r1 - r2)**2.))
def drdt(r, v):
"""Return position derivative
:param r: shape: (x_earth, y_earth, x_jupiter, y_jupiter))
:param v: shape: (vx_earth, vy_earth,... |
from convlab2.nlu.svm.multiwoz import SVMNLU
from convlab2.nlu.jointBERT.multiwoz import BERTNLU
from convlab2.nlu.milu.multiwoz import MILU
from convlab2.dst.rule.multiwoz import RuleDST
from convlab2.policy.rule.multiwoz import RulePolicy
from convlab2.nlg.template.multiwoz import TemplateNLG
from convlab2.dialog_age... |
import os
import glob
from legacy.unet3dlegacy.data import write_data_to_file, open_data_file
from legacy.unet3dlegacy.generator import get_training_and_validation_generators
from legacy.unet3dlegacy.model import unet_model_3d
from legacy.unet3dlegacy.training import load_old_model, train_model
config = dict()
confi... |
#!/usr/bin/python
import os
# Link to the UIUC Car Database
# http://l2r.cs.uiuc.edu/~cogcomp/Data/Car/CarData.tar.gz
# dataset_url = "http://l2r.cs.uiuc.edu/~cogcomp/Data/Car/CarData.tar.gz"
# dataset_path = "../data/dataset/CarData.tar.gz"
# Fetch and extract the dataset
# if not os.path.exists(dataset_path):
# ... |
"""crudProj 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-base... |
from collections import OrderedDict
import pytest
import gym
from gym import spaces
import torch
from torch import nn
import torch.nn.functional as F
from torch import distributions
import pytorch_lightning as pl
from lightning_baselines3.on_policy_models.on_policy_model import OnPolicyModel
class DummyModel(On... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#!/usr/bin/env python
"""MNIST Tutorial"""
# pylint: disable=C0103
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
def main(training_runs):
"""The basic model."""
x = tf.placeholder(tf.float32, [None, 784])
... |
from dataclasses import dataclass
from typing import Sequence
from openapi.data.fields import str_field
from openapi.utils import docjoin
from .pagination import from_filters_and_dataclass
class SearchVisitor:
def apply_search(self, search: str, search_fields: Sequence[str]) -> None:
raise NotImplemente... |
pkgname = "byacc"
pkgver = "20210808"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--program-transform=s,^,b,"]
pkgdesc = "Berkeley yacc, a LALR(1) parser generator"
maintainer = "q66 <q66@chimera-linux.org>"
license="custom:byacc"
url = "http://invisible-island.net/byacc"
source = f"ftp://ftp.invisible-... |
"""
Evaluates systems that extract temporal information from text
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE file in the root
directory of this source tree or at
http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works o... |
import secrets
import time
class Utils:
_instance = None
def __init__(self) -> None:
pass
@staticmethod
def generateRandomId():
"""
Generates a random hexicdecimal string
Returns:
`str`: string with hexidecimal values
>>>
"""
toke... |
class spam:
def __init__(self):
self.msgtxt = "this is spam"
def msg(self):
print self.msgtxt
if __name__ == '__main__':
s = spam()
s.msg() |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from .principal_association import *
from .resource_association import *
from .resource_sha... |
#!/usr/bin/env python3
import trio
async def a():
print('enter a')
await trio.sleep(0)
print('leave a')
async def b():
print('enter b')
await trio.sleep(0)
print('leave b')
async def main():
async with trio.open_nursery() as nursery:
print(nursery.start_soon(a))
nursery.start_soon(b)
# seems like the ou... |
from .chord import Chord, BassChord, UkuleleChord
from .fretboard import Fretboard
__version__ = '1.0.0'
__author__ = 'Derek Payton <derek.payton@gmail.com>'
__license__ = 'MIT' |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# -*- coding: utf-8 -*-
"""
Template render systems
"""
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import codecs
import logging
import os
import sys
import tempfile
import traceback
# Import 3rd-party libs
import jinja2
import jinja2.ext
# Import Salt libs
import s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import unittest
import numpy as np
import tensorflow as tf
from onnx_tf.backend import run_node
from onnx_tf.common import supports_device
from onnx_tf.common... |
from django.apps import AppConfig
class ShowsConfig(AppConfig):
name = 'shows' |
from django import template
from django.core.urlresolvers import resolve, reverse, Resolver404, NoReverseMatch
from django.utils.encoding import smart_unicode, smart_str
from datetime import datetime, timedelta
from Bcfg2.Server.Reports.utils import filter_list
register = template.Library()
__PAGE_NAV_LIMITS__ = (10,... |
import unittest
from get_longest_composite import get_longest_composite
class Test_Case_Get_Longest_Composite(unittest.TestCase):
def test_get_longest_composite(self):
self.assertEqual(get_longest_composite(['bobby', 'brosef', 'john', 'apple', 'seed', 'pear', 'punch', 'bottom', 'appleseeds', 'applejohn']),... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
"""
Copyright 2018 University of Liège
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 b... |
import pygal
def picture():
"""picture Bar"""
line_chart = pygal.Bar()
line_chart.title = 'Director (in %)'
line_chart.x_labels = map(str, range(2002, 2013))
line_chart.add('Action',[None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1])
line_chart.add('Adventure',[None, None, None, None, N... |
# -*- coding: utf-8 -*-
"""Console script for pyalmondplus."""
import sys
import time
import click
import pyalmondplus.api
import threading
import asyncio
def do_commands(url, my_api):
click.echo("Connecting to " + url)
while True:
value = click.prompt("What next: ")
print("command is: " + val... |
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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 ... |
# -*- coding: UTF-8 -*-
# Interstitial Error Detector
# Version 0.2, 2013-08-28
# Copyright (c) 2013 AudioVisual Preservation Solutions
# All rights reserved.
# Released under the Apache license, v. 2.0
# Created on Aug 12, 2014
# @author: Furqan Wasi <furqan@avpreserve.com>
import shlex, subprocess, os
# Constructor
... |
#!/usr/bin/python3
# https://practice.geeksforgeeks.org/problems/game-with-string/0
import heapq
def sol(s, k):
"""
Keep decreasing the max frequency by 1 uptill k.
We store the frequencies in a max heap to get the max each time
"""
f = [0]*26
for x in s:
f[ord(x)-97] -= 1
# We... |
"""
A module for reading dvi files output by TeX. Several limitations make
this not (currently) useful as a general-purpose dvi preprocessor, but
it is currently used by the pdf backend for processing usetex text.
Interface::
with Dvi(filename, 72) as dvi:
# iterate over pages:
for page in dvi:
... |
import os
import torch
from torch.utils.data import DataLoader
from cityscape_dataset import CityScapeDataset
from ssd_util import load_dataset_list, load_dataset_list_original, show_loss, show_log
from ssd_net import SSD
from ssd_train import train_net
from ssd_test import test_net
if __name__ == '__main__':
# D... |
from sklearn.naive_bayes import GaussianNB
import random
import numpy as np
import math
from pylab import scatter,figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show,semilogx, semilogy
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
# Generation of data to train t... |
# -*- coding: utf-8 -*-
"""
获取用户关注
"""
import json
import redis
from scrapy_redis.spiders import RedisSpider
from ..items import Relationship
from .bos_filter import RedisDB, BosFilter
class RelationshipSpider(RedisSpider):
rdb = RedisDB()
r = redis.Redis(host="127.0.0.1")
name = 'relationship'
allow... |
import torch
import torch.nn.functional as F
def dice_score(inputs, targets, smooth=1):
# Flatten label and prediction tensors
inputs = inputs.view(-1)
targets = targets.view(-1)
intersection = (inputs * targets).sum()
dice_score = (2.*intersection + smooth)/(inputs.sum... |
from django.contrib import admin
from .models import Record
class RecordAdmin(admin.ModelAdmin):
search_fields = ('resource', 'user__username')
list_display = ('time', 'resource_type', 'client_ip', 'user')
list_display_links = ('time', )
admin.site.register(Record, RecordAdmin) |
from machine import SoftI2C, Pin, RTC
import onewire, ds18x20, time
import utime, dht, network, urequests
import OLED, ntptime
temp=30
url = "https://api.thingspeak.com/update?api_key=CTVG0E49RI7RSV78"
#------------------------------------------WIFI-------------------
def conectaWifi (red, password):
global miR... |
#!/usr/bin/env python
u"""
interp_sea_level_ICESat2_ATL07.py
Written by Tyler Sutterley (05/2021)
Interpolates sea level anomalies (sla), absolute dynamic topography (adt) and
mean dynamic topography (mdt) to times and locations of ICESat-2 ATL07 data
https://www.aviso.altimetry.fr/en/data/products/sea-surface-hei... |
from ..tree.tree_node import TreeNode
from ..tree.tree_builder import display_tree
from ..widgets.dynamic_widgets import DynamicWidget
from ..utils.data_structure_utils import nested_defaultdict
try:
from IPython.display import display
import ipywidgets as widgets
from ipywidgets import HBox, Label, VBox
... |
import collections
import datetime
#pypy import numpy
import random
import re
import struct
import subprocess
import sys
import zlib
import bio
import fasta
import features
import statistics
import vcf
SOFT_CLIP_CONFIDENCE = 0.0
class SamToMultiChromosomeVCF(object):
def __init__( self, sam, multi_fasta_reference,... |
# encoding: utf-8
"""
@author: liaoxingyu
@contact: sherlockliao01@gmail.com
"""
import math
import torch
from torch import nn
from torch.utils import model_zoo
from models.context_block import *
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://do... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
#!/usr/bin/python
#Created : Thu 04 Sep 2008 12:25:03 PM GMT
#Last Modified : Tue 01 Jan 2013 06:24:01 AM GMT
import os
import sys
from time import strftime
import time
import datetime
#from pysqlite2 import dbapi2 as sqlite
import sqlite3
con = sqlite3.connect("/usb/phpmysql/lessonplan2010.db", isolation_level=None)... |
import pytest
from PIL import Image
from yoga.image import helpers
class Test_image_have_alpha(object):
@pytest.mark.parametrize(
"image_path",
[
"test/images/image1.jpg",
"test/images/unused-alpha.png",
"test/images/indexed.png",
"test/images/grays... |
from player import Player
p = Player(7,11)
new = p.check_come_out_roll()
print(new) |
from django.contrib import admin
from .models import Product
class ProductAdmin(admin.ModelAdmin):
list_display = ['__str__', 'slug']
class Meta:
model = Product
admin.site.register(Product, ProductAdmin) |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from robotnik_msgs/SetElevatorActionResult.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import actionlib_msgs.msg
import genpy
import robotnik_msgs.msg
im... |
#!/usr/bin/env python3
# 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.
"""
Adapted from: http://www.benjack.io/2017/06/12/python-cpp-tests.html
"""
import argparse
import builtins
import glo... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
"""
full_width_encode.py
Copyright 2006 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hop... |
import os
import sys
import types
import textwrap
import pytest
import cloudpickle
import prefect
from prefect import Flow, Task
from prefect.storage import Docker, Local
from prefect.exceptions import FlowStorageError
from prefect.run_configs import DockerRun, UniversalRun
from prefect.utilities.storage import (
... |
#!/usr/bin/env python
# Copyright 2017 Google Inc.
#
# 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... |
import time
import e2e.clickhouse as clickhouse
import e2e.kubectl as kubectl
import e2e.yaml_manifest as yaml_manifest
import e2e.settings as settings
import e2e.util as util
from testflows.core import *
from testflows.asserts import error
@TestScenario
@Name("test_ch_001. Insert quorum")
def test_ch_001(self):
... |
"""
WSGI config for djnic project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTING... |
# -*- coding: utf-8 -*-
#
# documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 23 19:40:08 2015.
#
# 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
# autogenerated file.
#
# All confi... |
import FWCore.ParameterSet.Config as cms
from SimG4Core.Application.hectorParameter_cfi import *
## HF Raddam Dose Class in /SimG4CMS/Calo
from SimG4CMS.Calo.HFDarkeningParams_cff import *
## This object is used to customise g4SimHits for different running scenarios
common_heavy_suppression = cms.PSet(
NeutronT... |
import cv2
import keras
from keras.models import Sequential, Model
from keras.callbacks import EarlyStopping
from keras.optimizers import Adam
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from random import shuffle
# import tensorflow as tf
import time
file_list = os.lis... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
# Read image
img = cv2.imread("imori.jpg").astype(np.float32)
H, W, C = img.shape
# Otsu binary
## Grayscale
out = 0.2126 * img[..., 2] + 0.7152 * img[..., 1] + 0.0722 * img[..., 0]
out = out.astype(np.uint8)
## Determine threshold of Otsu's binarization
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v4/proto/resources/campaign.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import mes... |
#! /usr/bin/env python3
import argparse
from pathlib import Path
import subprocess
import sys
import scripts.templates
from scripts.templates import P2020, MPC5777M, CORES, TOP_DIR, PSY_DIR, STUBS_DIR, SRC_DIR, CFG_DIR, Help, AGENT_CONFIG_HJSON_TEMPLATE, CORUNNER_CONFIG_HJSON_TEMPLATE, CORUNNER_KMEMORY_JSON_TEMPLATE, ... |
import numpy as np
import matplotlib.pyplot as plt
from ctsutils.cparameterspace import CParam, CParameterSpace
def foo(X, Y, Y2):
""" """
return (1 - X / 2 + X ** 5 + (Y + Y2 ) ** 3) * np.exp(-X ** 2 - (Y + Y2 ) ** 2) # calcul du tableau des valeurs de Z
def foo(X, Y, Y2, Y3):
""" """
return (1 -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.