text stringlengths 2 999k |
|---|
import pkg_resources
default_app_config = "pinax.images.apps.AppConfig"
__version__ = pkg_resources.get_distribution("pinax-images").version
|
#!/usr/bin/env python
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
#coding=utf-8
import socket
import json
import time
import os
basedir = os.path.abspath(os.path.dirname(__file__))
#file path
file_path = basedir +os.sep + 'datas.json'
file_path_log = basedir +os.sep + 'logs.txt'
file_path_control_commands = basedir +os.sep + 'control_commands.json'
#control commands
try:
wi... |
import os
import time
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from lib import utils
from model.pytorch.dcrnn_model import GARNNModel
from model.pytorch.loss import masked_mae_loss
from model.pytorch.loss import masked_rems_loss
from model.pytorch.loss import masked_mape_loss
... |
from enum import Enum
from samtranslator.plugins import SamPlugins, BasePlugin, LifeCycleEvents
from unittest import TestCase
from unittest.mock import Mock, patch, call
class TestSamPluginsRegistration(TestCase):
def setUp(self):
# Setup the plugin to be a "subclass" of the BasePlugin
self.mock... |
import typing
from .event import Event
class TaskFinishedEvent(Event):
"""Event to be sent when a task has finished."""
__module__ = 'pyobs.events'
def __init__(self, name: str = None, id: typing.Any = None,):
"""Initializes a new task finished event.
Args:
name: Name of tas... |
"""Prior to Python 3.8, this should raise SyntaxError: invalid syntax"""
print(walrus := True)
|
import difflib
import os
class TestConfig:
FOLDER = 'services/nginx'
DEV = os.path.join(FOLDER, 'dev_default.conf')
PROD = os.path.join(FOLDER, 'default.conf')
def test_configs_mostly_match(self) -> None:
with open(self.DEV) as dev:
with open(self.PROD) as prod:
di... |
__version__ = 'null' |
dataset_type = 'MyDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from copy import deepcopy
import pytest
from datadog_checks.dev import TempDir, docker_run
from datadog_checks.dev.utils import create_file, path_exists
from datadog_checks.openldap import OpenLDAP
fro... |
"""Protocol for retrocookie.retrocookie."""
from pathlib import Path
from retrocookie.pr.compat.typing import Protocol
class Retrocookie(Protocol):
"""The retrocookie function."""
def __call__(
self, repository: Path, *, branch: str, upstream: str, path: Path
) -> None:
"""Import commits... |
"""This module contains a wrapper around LASER for extended analysis
purposes."""
import copy
from mythril.analysis.security import get_detection_module_hooks, get_detection_modules
from mythril.laser.ethereum import svm
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.strategy.basi... |
import os
is_arch_valid = 1
flags_arch = '-Wall -O0 -g'
flags_link_charm = ' -rdynamic' # required for backtraces
cc = 'gcc'
f90 = 'gfortran'
flags_prec_single = '-fdefault-real-4 -fdefault-double-8'
flags_prec_double = '-fdefault-real-8 -fdefault-double-8'
libpath_fortran = '.'
libs_fortran = ['gfortran']
ho... |
import torch.utils.data
import torchvision.transforms as transforms
import numpy as np
import matplotlib.pyplot as plt
import os, sys, math, argparse, zipfile, glob, cv2, random
FileDirPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(FileDirPath, '..'))
sys.path.append(os.path.join(FileD... |
# -*- coding: utf-8 -*-
from requests import post, delete, get
from time import sleep
from urlparse import urljoin
from django.core.exceptions import ObjectDoesNotExist
from dbaas_credentials.models import CredentialType
from physical.models import Host, Instance, Ip
from util import get_credentials_for
from base imp... |
import unittest
from katas.kyu_8.triple_trouble import triple_trouble
class TripleTroubleTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(triple_trouble('aaa', 'bbb', 'ccc'), 'abcabcabc')
def test_equals_2(self):
self.assertEqual(triple_trouble('aaaaaa', 'bbbbbb', 'cccccc... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Any, Iterable
import numpy as np
from keras import Input, Model
from keras.activations import tanh, sigmoid
from keras.layers import Dense, concatenate
from keras.optimizers import adam
from keras.utils import to_categorical
import keras.backend as K
... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
##############################################################################
#
# PURPOSE:
# Handle exceptions caught by the AWS Step Function workflow
# and optionally update the execution status of the... |
# 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, software
# distributed under t... |
number = 21
number = 22
number = 23
number = 24
number = 26
number1 = 12
number2 = 7
|
# Copyright: (c) 2019, 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__ = type
import fnmatch
import json
import operator
import os
import shutil
import tarfile
import tempfile
... |
# -- coding: utf-8 --
import json
import pymysql
def get_connection():
file = open('db_config', 'r')
host = file.readline().replace('\n', '')
pwd = file.readline().replace('\n', '')
file.close()
return pymysql.connect(host=host, port=3306, user='admin', password=pwd, db='eva', charset='utf8')
de... |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------#
# Purpose: Check whether PDF is encrypted/otherwise not parseable
# Author: CM
# Date: 2016
# Language: Python (.py)
#----------------------------------------------------------------------------#
... |
import numpy as np
from ...core.make_table import create_table
def do_comp_stats(output_name,hindcast,measured,short_name=''):
gd=np.logical_and(~np.isnan(hindcast),~np.isnan(measured))
stats=np.empty((6,3),dtype="object")
stats[0,0]='MAE'
stats[1,0]='RMSE'
stats[2,0]='MRAE'
stats[3,0]='BIAS'
... |
# https://codeforces.com/problemset/problem/460/A
n, m = [int(x) for x in input().split()]
days = n
while True:
add_days = n // m
if add_days == 0:
break
days += add_days
n = add_days
while days % m == 0:
days += 1
print(days)
|
import torch
import torch.nn as nn
import block as B
def make_model(args, parent=False):
model = RFDN()
return model
class RFDN(nn.Module):
def __init__(self, in_nc=3, nf=50, num_modules=4, out_nc=3, upscale=4):
super(RFDN, self).__init__()
self.fea_conv = B.conv_layer(in_nc, ... |
# Copyright 2019 The Keras Tuner 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from pykafka import KafkaClient
import pykafka.exceptions
import pykafka.producer
import json ,requests, logging, time
from kafka import KafkaProducer
from datetime import datetime
from datetime import datetime
#r =requests.get('http://3.7.183.103:8080/metrics')
topic = '20A1'
def create_topic(topic):
prod = Kafk... |
"""
ASGI config for curaSWISS project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SET... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from ... import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .account import *
from .adls_gen1_file_... |
from __future__ import print_function
import numpy as np
from numpy import pi
from . import model
class SQGModel(model.Model):
"""Surface quasigeostrophic model."""
def __init__(
self,
beta=0., # gradient of coriolis parameter
Nb = 1., # Buoyancy ... |
import logging
from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
from unittest.mock import MagicMock, ANY
try:
from mpfmc.core.audio import SoundSystem
from mpfmc.assets.sound import SoundStealingMethod
except ImportError:
SoundSystem = None
SoundStealingMethod = None
logging.warning("mpfmc.core... |
print('UTILIZANDO MÓDULOS!!!')
import math
num=float(input('Digite um número:'))
n1= math.floor(num)
print(f'O número {num} tem a parte inteira {n1}.') |
import dash
import dash_core_components as dcc
import dash_html_components as html
# Since we're adding callbacks to elements that don't exist in the app.layout,
# Dash will raise an exception to warn us that we might be
# doing something wrong.
# In this case, we're adding the elements through a callback, so we can i... |
import cv2
import numpy as np
import math
from picamera import PiCamera
import time
center_cone_x = 978#978 #974
center_cone_y = 655#655 #654
RedLed = (0,8040)
GreenLed = (8040,8040)
BlueLed = (8040,0)
YellowLed = (0,0)
g_low = (32, 110, 90)
g_high = (43, 255,255)
b_low = (10, 200, 75)
b_high = (15, 255,255)
r_low = ... |
import numpy as np
import os, sys
import RLkit
from RLkit.environment import Environment
from RLkit.algorithms.policy_gradients import REINFORCE
network_specs = [
{
"type": "dense",
"size": 64,
"activation":"relu"
},
{
"type": "dense",
"size": 32,
"activation":"relu"
}
]
value_estimat... |
import torch
from transformers import BertModel, BertTokenizer
import re
import os
import requests
from tqdm.auto import tqdm
def protein_seq_parser(fasta):
reader = open(fasta, "r")
line = reader.readline()
aa_list = []
while line:
aa_frag = line.rstrip()
aa_frag = list(aa... |
#AUTOGENERATED! DO NOT EDIT! File to edit: dev/05_data_core.ipynb (unless otherwise specified).
__all__ = ['TfmdDL', 'DataBunch', 'FilteredBase', 'TfmdList', 'decode_at', 'show_at', 'DataSource']
#Cell
from ..torch_basics import *
from ..test import *
from ..transform import *
from .load import *
from ..notebook.show... |
#!/usr/bin/env python
"""
Configure folder for 3D-DAOSTORM '2d' / '2dfixed' Jupyter example.
Hazen 03/18
"""
import os
import storm_analysis
import storm_analysis.sa_library.parameters as parameters
import storm_analysis.sa_library.sa_h5py as saH5Py
import storm_analysis.simulator.background as background
import sto... |
"""admin URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.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-based v... |
# (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import os
from distutils.version import LooseVersion # pylint: disable=E0611,E0401
import pytest
# project
from datadog_checks.zk import ZookeeperCheck
import conftest
def test_check(aggregator, spin_up_zk, ge... |
from app import app
app.run(host="0.0.0.0", port=8089, debug=True)
|
# 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 u... |
'''
Functions for interacting with Solr, as a Tracking Database.
NOTE requires Solr > 7.3 as uses 'add-distinct'
See https://lucene.apache.org/solr/guide/7_3/updating-parts-of-documents.html
'''
import requests
import logging
import json
import os
logger = logging.getLogger(__name__)
class SolrKeval... |
import re
import itertools
def format_text(prefix, start, texts):
output = []
curr = []
if start:
curr.append(start)
linebreaks = 0
for text in texts:
lines = []
length = len(prefix)
if start:
length += + len(start)
# split text into words by spli... |
# Generated by Django 2.2 on 2019-04-14 11:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('products', '0005_auto_20180708_1955'),
]
operations = [
migrations.CreateModel(
name='ProductCond... |
from unittest import TestCase
from orientacao_objetos.motor import Motor
class CarroTestCase(TestCase): #herdar da classe test e iniciar o método com o prefixo test
def test_velocidade_inicial(self):
motor = Motor()
self.assertEqual(0, motor.velocidade) #verifica se o valor de velocidade é igual ... |
"""SCons.Tool.dvi
Common DVI Builder definition for various other Tool modules that use it.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated document... |
from django.core.management import BaseCommand
from tqdm import tqdm
from data.constants import AttachmentSourceType
from data.models import AttachmentFile
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('external_ids', nargs='*')
def handle(self, external_ids, *arg... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
'''
Authors: Donnie Marino, Kostas Stamatiou
Contact: dmarino@digitalglobe.com
Unit tests for the gbdxtools.Idaho class
'''
from gbdxtools import Interface
from gbdxtools import S3Image, CatalogImage
from auth_mock import gbdx
import vcr
from os.path import join, isfile, dirname, realpath
import tempfile
import unitt... |
#coding:utf-8
#定义三个变量里面存放数值
people = 20
cats = 30
dogs = 15
#判断20 是否大于 30 ,正确就执行紧跟在他后面缩进的语句,为假不执行之间诶跳过
if people < cats:
print "Too many cats! The world is dommed!"
if people > cats:
print "Not many cats! The world is saved!"
if people < dogs:
print "The world is drooled on!"
if people > dogs:
prin... |
# coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... |
from collections import defaultdict, abc as container_abcs
import torch
from copy import deepcopy
from itertools import chain
import warnings
import functools
class _RequiredParameter(object):
"""Singleton class representing a required parameter for an Optimizer."""
def __repr__(self):
return "<requi... |
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
return b"pong"
@cherrypy.expose
def ping(self):
return b"pong"
@cherrypy.expose
def text(self):
return b"Hello world"
@cherrypy.expose
def no_content(self):
cherrypy.response.status... |
#
# PySNMP MIB module Nortel-Magellan-Passport-FileSystemMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-FileSystemMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:17:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4... |
"""
Django settings for main project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib im... |
"""Module to test airplane schema"""
import pytest
from src.schemas import AirplaneSchema
from tests.mocks.airplane import VALID_AIRPLANE_DETAILS
class TestAirplaneSchema:
"""Test Airplane Schema"""
def test_airplane_schema_deserialization_succeeds(self):
"""Test aiplane schema deserialization succe... |
"""
functions.py
A python package for analyzing and visualizing xyz file. MolSSI Best Practices Workshop
Handles the primary functions
"""
import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#%matplotlib notebook
def canvas(with_attribution=True):
"""
Place... |
from collections import OrderedDict
from datetime import datetime
import os
from app import app
from config import constants, universal, partner_details
from flask import (jsonify, redirect, render_template,
request, flash, g, url_for, Response, stream_with_context)
from flask_babel import gettext, ... |
from extras.plugins import PluginConfig
from .version import __version__
class QRCodeConfig(PluginConfig):
name = 'netbox_qrcode'
verbose_name = 'qrcode'
description = 'Generate QR codes for the objects'
version = __version__
author = 'Nikolay Yuzefovich'
author_email = 'mgk.kolek@gmail.com'
... |
'''
Python program to alternate the case of each letter in
a given string and the first letter of the said string must be uppercase.
Original string: Python Exercises
After alternating the case of each letter of the said string: PyThOn ExErCiSeS
Original string: C# is used to develop web apps, desktop apps,
mobile app... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 20:53:30 2018
@author: Ian
"""
#Description:
#This script runs a motion detector to test proof the concept of video analytics in optimizing situational awareness of key water installations
#The aim is to contribute to a Smart Water Security Management ecosystem with a... |
#!/usr/bin/env python
from __future__ import print_function
import sys
from time import time
from initialize.parse_conf import parse_config
from ifp_processing import get_bitstring
from similarity import count_abcdp, how_similar
def replace_bit_char(bitstring, bit_index_list):
for i, v in enumerate(bit_index_l... |
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes':
[
'deqp.gypi',
'../../build/common_defines.gypi',
],
'variables':
{
'angle_build_conforman... |
import os
import pickle
import signal
from datetime import datetime
from queue import Empty
from time import sleep
from loguru import logger
from typing import Optional, List
from queuable_tasks import max_number_of_workers
from vcm import vcm as vcm
from data_sources.coguk_sars_cov_2.sample import COGUKSarsCov2Sample
... |
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"Uaktualnij" jest dodatkowym wyra\xc5\xbceniem postaci "pole1=\'nowawarto\xc5\x9b\xc4\x87\'". Nie mo\xc5\xbcesz uaktualni\xc4\x87 lub usun\xc4\x85\xc4\x87 wynik\xc3\xb3w z JOIN:',
'%Y-%m-%d': '%Y-%m-... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
import scrape_common as sc
inhabitants = {
'Broye': 32894,
'Glane': 24337,
'Greyerz': 55726,
'Saane': 106136,
'See': 36800,
'Sense': 43990,
'Vivisbach': 18831,
}
district_ids = {
'Broye': 1001,
... |
#!/usr/bin/python
import simple_test
simple_test.test("test36", ["-h", ])
|
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 23:26:27 2015
@author: Owner
"""
import pandas as pd
import numpy as np
#pd.set_option('display.max_rows',5000)
roster = pd.read_csv("data/cfl_data/cfl_roster.csv")
height = roster.iloc[0:,9]
weight = roster.iloc[0:,10]
location = roster.iloc[0:,12]
ID = roster.... |
# -*- coding: utf-8 -*-
"""
slixmpp.xmlstream.matcher.id
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Part of Slixmpp: The Slick XMPP Library
:copyright: (c) 2011 Nathanael C. Fritz
:license: MIT, see LICENSE for more details
"""
from slixmpp.xmlstream.matcher.base import MatcherBase
class MatchIDSender(Matc... |
# UNIDAD 01.D23
print('\n\n---[Diapo 23.ar]--------------')
# Forma resumida de Operadores
contador = 0
print('El valor inicial del contador es', contador)
contador = contador + 1
print('El valor final es', contador)
print('\n\n---[Diapo 23.b]--------------')
# Forma resumida de Operadores
contador = 0
print('El va... |
import pandas as pd
import numpy as np
import logging
import random
import matplotlib.pyplot as plt
# ACTIONS = ['Left', 'Right', 'Up', 'Down']
ACTIONS = ['←', '→', '↑', '↓']
threshold = 0.05
def moveOneStep(current, action, shape): # Equivalent to a transition matrix
current = np.copy(current)
if action ==... |
from PIL import Image as CROPPER
import simplejson as JSON
import os, sys
import datetime
class CropImage():
def start_crop(self, imgSrc, jsnSrc):
#Openning image file use to PIL lib.
img = CROPPER.open(imgSrc)
gen = self.crop(jsnSrc, img)
for r i... |
from blesuite.entities.gatt_device import BLEDevice
from blesuite.entities.permissions import Permissions
import blesuite.utils.att_utils as att_utils
import json
# Initialize new BLEDevice object
ble_device = BLEDevice()
# Create a new primary service with starting handle 1, ending handle 6, and UUID 2124
service1 =... |
"""
ASGI config for gender_ai_proj project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANG... |
# -*- coding: utf-8; -*-
#
# Licensed to Crate (https://crate.io) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License");
# yo... |
from config.token import TOKEN_API
import tushare as ts
class DownloadData(object):
def __init__(self):
self.pro = ts.pro_api(TOKEN_API)
@staticmethod
def get_data(self):
pass
|
import asyncio
async def hyperglance_automation(credential, resource: dict, cloud, automation_params = '', **kwargs):
from azure.mgmt.resource.resources import ResourceManagementClient
url = cloud.endpoints.resource_manager
client = ResourceManagementClient(
credential,
resource['subscription'],
... |
import torch
import random
import numpy as np
import pandas as pd
def seeding(seed=31):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = True
torch.set_printoptions(precis... |
import csv
from tempfile import NamedTemporaryFile
from airflow.hooks.postgres_hook import PostgresHook
from airflow.hooks.S3_hook import S3Hook
from airflow.models import BaseOperator
from airflow.plugins_manager import AirflowPlugin
from airflow.utils.decorators import apply_defaults
from airflow.operators.postgres_o... |
import os
import os.path as osp
import numpy as np
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
FLAGS2 = {}
######################
# General Parameters #
######################
FLAGS2["pixel_means"] = np.array([[[102.9801, 115.9465, 122.7717]]])
tf.app.flags.DEFINE_integer('rng_seed', 3, "Tensorflow seed for r... |
# Generated by Django 3.2.5 on 2021-08-27 01:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('participant_profile', '0017_auto_20210825_0624'),
]
operations = [
migrations.AlterField(
model_name='reportfileparticipant',
... |
from django.contrib import admin
from .models import Estoque, EstoqueItens, EstoqueSaida, EstoqueEntrada
class EstoqueItensInline(admin.TabularInline):
model = EstoqueItens
extra = 0
@admin.register(EstoqueEntrada)
class EstoqueEntradaAdmin(admin.ModelAdmin):
inlines = (EstoqueItensInline,)
list_dis... |
"""Chapter 8 Practice Question 1
Using paper and pencil (*cough*), decrypt the following messages with the key 9.
Note:
Contains spoilers for Chapter 9 (importing transpositionDecrypt)
"""
from pythontutorials.books.CrackingCodes.Ch08.transpositionDecrypt import decryptMessage
def main():
messages = ["H cb... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'composite_form.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CompositeForm(object):
def setupUi(self, CompositeForm):
... |
# 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, software
# d... |
# -*- coding: utf-8 -*-
import os
import sys
import json
# Python 3 comparability
if sys.version_info >= (3, 0):
import configparser as ConfigParser
else:
import ConfigParser
__LOCAL__ = ['sensor', 'projection', 'orbit', 'polarizations', 'acquisition_mode',
'start', 'stop', 'product', 'spacing',... |
from ..broker import Broker
class DeviceBroker(Broker):
controller = "devices"
def index(self, **kwargs):
"""Lists the available devices. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lists, using this method is most efficient.
... |
import os
from telegram import Update, Bot
from telegram.ext import Dispatcher, CommandHandler, MessageHandler, Filters
def start(bot,update):
update.message.reply_text("Olá, esse bot foi feito para spammar o orgulho dasiano! Digite /dasi.", quote=False)
def dasi(bot, update):
update.message.reply_text("GR... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# math2html: convert LaTeX equations to HTML output.
#
# Copyright (C) 2009-2011 Alex Fernández
#
# Released under the terms of the `2-Clause BSD license'_, in short:
# Copying and distribution of this file, with or without modification,
# are permitted... |
# -*- coding: utf-8 -*-
import unittest
from gilded_rose import Item, GildedRose
class GildedRoseTest(unittest.TestCase):
def test_concert_under_5(self):
items = [Item("Backstage passes to a TAFKAL80ETC concert", 2, 30)]
gilded_rose = GildedRose(items)
gilded_rose.update_quality()
... |
"""Generate Flatbuffer binary from json."""
load(
"//tensorflow:tensorflow.bzl",
"tf_cc_test",
"tf_cc_shared_object",
)
def tflite_copts():
"""Defines compile time flags."""
copts = [
"-DFARMHASH_NO_CXX_STRING",
] + select({
str(Label("//tensorflow:android_arm64")): [
"-... |
from typing import List
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
"""
1. 将数组排序
2. 判断两个指针的值是否相等
3. 如果相等双指针+1
4. 如果相等指针小的+1
5. 判断条件为小数组指针到末尾,由于排序过,当小数组遍历完成,大数组一定找不到和它相等的值了
"""
s1, s2, e1, e2 = 0, 0, len(nums1... |
from django import template
register = template.Library()
@register.simple_tag
def greet_user(message, username):
return "{greeting_message}, {user}!!!".format(greeting_message=message, user=username)
|
__all__ = ["simple"]
|
import unittest
from app.models import Comment, Pitch
from app import db
class TestPitchComment(unittest.TestCase):
def setUp(self):
self.new_pitch = Pitch(content = "A ship that uses controlled explosions", category='Innovative')
self.new_comment = Comment(comment = "Interesting", pitch=self.new_... |
#
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE 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-... |
from itertools import chain
from math import cos, sin, radians
class OpenGLFactory(object):
def __init__(self):
self._polyhedron = self._render_polyhedron()
@property
def polyhedron(self):
return self._polyhedron.copy()
@staticmethod
def _render_polyhedron():
shape = []
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.