text stringlengths 2 999k |
|---|
#!/usr/bin/env python
# Copyright (c) 2012 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 copy
import re
class PolicyTemplateGenerator:
'''Generates template text for a particular platform.
This class is use... |
import mysql.connector
import dbconfig as cfg
db = mysql.connector.connect(
host=cfg.mysql['host'],
user=cfg.mysql['user'],
password=cfg.mysql['password'],
)
cursor = db.cursor()
sql="CREATE DATABASE datarepresentation"
cursor.execute(sql) |
def can(book,start, end):
if start==end:
return True
elif start==None:
return False
g=False
if start in book:
for val in book[start]:
g=g or can(book,val, end)
return g
book1 = {
"squirtle" : ["wartortle"],
"wartortle" : ["blastoise"],
"blastoise" :... |
#
# This program reads through the input file for lptsmanager, and
# lists the values found there for each data field.
#
from xml.dom import minidom
import io
XML_FILENAME = "FCBH Intro/qry_dbp4_Regular_and_NonDrama.xml"
OUT_FILENAME = "DBP4_Analyze_XML.txt"
out = io.open(OUT_FILENAME, mode="w", encoding="utf-8")
xml... |
from data_set_info_data_class.data_class.data_set_info import DataSetInfo
from data_set_remover.classes.data_class.data_for_criteria_remove import DataForCriteriaRemove
from data_set_remover.classes.remover.criteria_remover.criteria_remover import CriteriaRemover
class CriteriaRemoverImpl(CriteriaRemover):
def re... |
from flask_babel import lazy_gettext as _
from wtforms import StringField, PasswordField
from wtforms.fields.html5 import EmailField
from wtforms.validators import DataRequired, EqualTo, Email
from .base import ModestForm, SubmitButtonField, strip
class RegisterUserForm(ModestForm):
firstname = StringField(
... |
__author__ = "saeedamen" # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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 applicabl... |
from django.contrib import admin
# Register your models here.
from .models import Category, Ingredient
admin.site.register(Category)
admin.site.register(Ingredient) |
import numpy as np
from parachute import array, shape, Arbitrary
def test_type_arbitrary():
Array = array()
assert not Array("No good type").is_valid()
assert not Array(["a", "b"]).is_valid()
assert Array(3.2).is_valid()
assert Array([1, 2]).is_valid()
assert Array((5, 6)).is_valid()
asse... |
# -#- coding: utf-8 -#-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from leonardo.module.web.models import Widget
from leonardo.utils import get_htmltext_widget
class GDPRWidget(Widget):
domain_name = models.CharField("Domain name", max_length=255)
company_name = mod... |
from .submodule import Class1, func1 # NOQA
|
from flask import Blueprint
client = Blueprint('client', __name__)
from . import routes
|
import graphene
class Query(graphene.ObjectType):
sk = graphene.String(name=graphene.String(default_value="Sekai"))
def resolve_sk(self, info, name):
return 'Kono subarashi ' + name
try:
schema = graphene.Schema(query=Query)
result = schema.execute('{sk}')
print(result)
except:
print('Error') |
from typing import Dict, List, Any
import gym
import torch.nn as nn
from allenact.base_abstractions.experiment_config import TaskSampler
from allenact.base_abstractions.sensor import SensorSuite
from allenact_plugins.gym_plugin.gym_models import MemorylessActorCritic
from allenact_plugins.gym_plugin.gym_sensors impor... |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... |
# -*- coding: utf-8 -*-
__author__ = """Chih-Wei Chang"""
__email__ = 'bert.cwchang@gmail.com'
__version__ = '0.2.0'
|
import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelBinarizer
from sklearn.preprocessing import Imputer
from sklearn.pipeline import FeatureUnion
from... |
import tempfile
import tinynn as tn
def test_md5_checksum():
md5_test_vectors = [
("", "d41d8cd98f00b204e9800998ecf8427e"),
("a", "0cc175b9c0f1b6a831c399e269772661"),
("abc", "900150983cd24fb0d6963f7d28e17f72"),
("message digest", "f96b697d7cb7938d525a2f31aaf161d0"),
("abc... |
# -*- coding: utf-8 -*-
import logging
import base64
import time
from lxml import etree
from odoo import api, fields, models, _, Command, tools
from lxml_to_dict import lxml_to_dict
from odoo.addons.wecom_api.api.wecom_abstract_api import ApiException
_logger = logging.getLogger(__name__)
WECOM_USER_MAPPING_ODOO_EMP... |
#!/usr/bin/env python
"""
This script takes a bigfix prefetch and validates it
BigFix Prefetches:
- Must have size
- int or int(string) greater than 0
- Must have sha1 if prefetch statement, always expected (except-invalid-prefetch-statement)
- prefetch blocks do NOT require SHA1 (warn-optional... |
"""
Copyright 2020 Goldman Sachs.
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 di... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
from typing import Any, Callable, NamedTuple, Tuple
import functools
import jax.numpy as jnp
QFunction = Any
ActionSpace = Tuple[int, ...]
State = jnp.ndarray
class Agent(NamedTuple):
select_action: Callable[[QFunction, State, ActionSpace, float, int], int]
update: Callable[[QFunction, State, int, State, flo... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
from typing import Union, Optional, TYPE_CHECKING
from cdm.enums import CdmObjectType
from .cdm_object_ref import CdmObjectReference
if TYPE_CHECKING:
from ... |
"""
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
... |
import sqlite3 as dbHandle
import os
from typing import List
def exec_sql(sql, values, opType = 0):
try:
flag = False
error = {}
if not os.path.exists("./dist"):
os.mkdir("dist")
conn = dbHandle.connect("./dist/log.db")
cur = conn.cursor()
if opType == 1:... |
from .path import Path
from .process import Process
from .rsync import auto_rsync
from .session import Session
from .watch import Watch
|
'''Utility functions and classes for handling image datasets.'''
import os.path as osp
import numpy as np
import tensorflow as tf
def process_image(img, scale, isotropic, crop, mean):
'''Crops, scales, and normalizes the given image.
scale : The image wil be first scaled to this size.
If isotropi... |
from prophet import Prophet
import datetime
import pandas as pd
# predict stickprice
def predict_stockprice(data, date_col, target_col, periods=100, future_data=None):
'''
data: Your current data to training model
date_col: Date column name
target_col: Target Variable columns name.
periods: How man... |
import cbpos
from .root import MenuRoot
from .item import MenuItem
from .menu import Menu
from .action import Action
cbpos.config.set_default('menu', 'show_empty_root_items', False)
cbpos.config.set_default('menu', 'show_disabled_items', False)
|
#! /usr/bin/env python
# Usage: calibration.py [target/calibration_data_file.csv] [output_file.png]
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
CALIBRATION_FILE = sys.argv[1]
OUT_IMG_FILE = sys.argv[2]
labels = []
counts = []
prec = []
counts_train = []
for ... |
from .utils.consts import *
from .interfaces import *
# TypedDict for disbursement specs
class Disbursement(TypedDict):
address: str
amount: int
class BalancedAddresses(TypedDict):
loans: Address
dex: Address
staking: Address
rewards: Address
reserve: Address
dividends: Address
da... |
# print name of 1st groupmember below this line
Agata
# print name of 2nd groupmember below this line
Yvon
|
import voc
import cityscapes |
# -*- coding: utf-8 -*-
#
# exercise2 documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 configuration values have... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... |
# Python Template Project
# @Author:
# @version: 1.0
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser # ver. < 3.0
class Config:
def __init__(self, context):
self.context = context
@staticmethod
def get_stage_file(self):
funct... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup -------------------------------------... |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Building)
admin.site.register(Worker)
admin.site.register(Cage)
admin.site.register(Breed)
admin.site.register(Chicken)
admin.site.register(Report)
|
# Copyright (c) 2009 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions... |
# coding=utf-8
# Copyright 2021 The TensorFlow GAN 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 applicabl... |
from UGATIT import UGATIT
import argparse
from utils import *
"""parsing and configuration"""
def parse_args():
desc = "Tensorflow implementation of U-GAT-IT"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('--phase', type=str, default='train', help='[train / test / test_discriminat... |
# ----------------------------------------------------------------------------
# Title: Scientific Visualisation - Python & Matplotlib
# Author: Nicolas P. Rougier
# License: BSD
# ----------------------------------------------------------------------------
#
# -------------------------------------------------------... |
################################################################################
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
import queue
import random
i... |
"""Tests for sys.audit and sys.addaudithook
"""
import subprocess
import sys
import unittest
from test import support
if not hasattr(sys, "addaudithook") or not hasattr(sys, "audit"):
raise unittest.SkipTest("test only relevant when sys.audit is available")
AUDIT_TESTS_PY = support.findfile("audit-tests.py")
c... |
# Copyright 2020, Batakrishna Sahu, mailto:<Batakrishna.Sahu@suiit.ac.in>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
.. fb:display_title::
Deep Factorization-Machine Modules
=====
The following m... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""Defi context API."""
import os
from gamestonk_terminal.helper_classes import ModelsNamespace as _models
# flake8: noqa
# pylint: disable=unused-import
# Menu commands
from .terraengineer_view import display_terra_asset_history as aterra
from .terraengineer_view import display_anchor_yield_reserve as ayr
from .terr... |
import itertools
import json
import os
from copy import deepcopy
from multiprocessing import Pool, cpu_count
from six import PY3, iteritems, itervalues, string_types, binary_type, text_type
from . import vcs
from .item import (ConformanceCheckerTest, ManifestItem, ManualTest, RefTest, SupportFile,
T... |
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/settings.ui'
#
# Created by: PyQt5 UI code generator 5.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Mai... |
# Copyright 2018 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 law or agreed to in writing, ... |
# Ivan Carvalho
# Solution to https://www.urionlinejudge.com.br/judge/problems/view/1115
# -*- coding: utf-8 -*-
'''
Escreva a sua solução aqui
Code your solution here
Escriba su solución aquí
'''
while True:
x,y = [int(k) for k in raw_input().split(" ")]
if x == 0 or y == 0:
break
else:
if... |
########################################
#### Licensed under the MIT license ####
########################################
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from numpy import prod
import capsules as caps
class CapsuleNetwork(nn.Module):
def __init_... |
# sum of elements in given range
import math
def buildSparseTable(arr,n):
for i in range(n):
lookup[i][0]=arr[i]
j=1
for j in range(1,k+1):
for i in range(n-(1<<j)+1):
lookup[i][j]=lookup[i][j-1]+lookup[i+(1<<(j-1))][j-1]
def SumInRange(L,R):
ans=0
for j in range... |
argv = None
byteorder = "little"
def exit():
pass
implementation = None
maxsize = 2147483647
modules = None
path = None
platform = "pyboard"
def print_exception():
pass
stderr = None
stdin = None
stdout = None
version = "3.4.0"
version_info = None
|
"""VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
import os
import torch
import torch.utils.data as data
import cv2
import numpy as np
import sys
if sys.version_info[0] == 2:
import xml.etr... |
''' Useful utilities to make like easier when coding other modules
This includes:
- generically applicable functions
- a WTForm template (to be inherited as a parent)
- a SQLAlchemy table template (to be inherited as a parent)
'''
# -------------------------------------------------------------------------... |
import numpy
import pytest
import pandas
import vtreat # https://github.com/WinVector/pyvtreat
def test_outcome_name_required():
numpy.random.seed(235)
d = pandas.DataFrame(
{"x": ['1', '1', '1', '2', '2', '2']})
y = [1, 2, 3, 4, 5, 6]
transform = vtreat.NumericOutcomeTreatment(
... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.3.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# + [markdown] toc=true
# <h1>T... |
#encoding=utf-8
# Copyright (C) 2016 Intel Corporation
# Copyright (C) 2016 Broadcom
#
# 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... |
import pandas as pd
from dash_app import show_dashboard
def read_data():
data = pd.read_csv('Womens Clothing E-Commerce Reviews.csv', index_col=0)
return data
def main():
data = read_data()
show_dashboard(data)
if __name__ == '__main__':
main()
|
from sys import stderr
from typing import Any, Callable, Optional
from django.views.generic import DetailView
from django.http import Http404
from django.db import models
from requests import get, Response
from servers.models import Server
from posts.models import Post
class ServerDetailView(DetailView):
# Over... |
_base_ = './faster_rcnn_r50_fpn_1x_coco.py'
train_cfg = dict(rcnn=dict(sampler=dict(type='OHEMSampler')))
|
import cv2
import numpy as np
import imutils
from shapedetector import ShapeDetector
cap = cv2.VideoCapture(0)
def findContours(mask, frame):
# find contours in the treshholded frame and initialize the shape detector
ratio = 1.0
cnts = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMP... |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from openrecipes.items import RecipeItem, RecipeItemLoader
import re
class MybakingaddictionMixin(object):
source = 'mybakingaddiction'
def parse... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Neil Lasrado and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestMJFreewayAPISettings(unittest.TestCase):
pass
|
"""Joint scatter plot of two variables."""
import matplotlib.pyplot as plt
from ..data import convert_to_dataset
from .kdeplot import plot_kde
from .plot_utils import _scale_fig_size, get_bins, xarray_var_iter, make_label, get_coords
from ..utils import _var_names
def plot_joint(
data,
var_names=None,
co... |
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
N = len(costs)
diff = [c[0] - c[1] for c in costs]
indexes = sorted(range(0, N), key=lambda x: diff[x])
result = 0
for i in range(N//2):
result += costs[indexes[i]][0]
... |
r"""
A utility module which provides functionality to easily load common VirTex
models (optionally with pretrained weights) using a single line of code.
Get our full best performing VirTex model (with pretrained weights as):
>>> import virtex.model_zoo as mz
>>> model = mz.get("width_ablations/bicaptioning_R_5... |
"""
Define platform-specific functions with decorators
https://stackoverflow.com/a/60244993
"""
import platform
import sys
from typing import Union as U, List, Tuple
class _Not_Implemented:
def __init__(self, func_name):
self.func_name = func_name
def __call__(self, *args, **kwargs):
raise N... |
import datetime as dt
import uuid
import ipaddress
import decimal
import math
import pytest
from marshmallow import EXCLUDE, INCLUDE, RAISE, fields, Schema, validate
from marshmallow.exceptions import ValidationError
from marshmallow.validate import Equal
from tests.base import assert_date_equal, assert_time_equal, ... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
r"""
In the example script a generic network is created then exported as a
Salome Python script. The script should be executed from Salome with
"load script". The geometry is then built. The geometry generation on
Salome may take some time depending on the number of pores.
"""
import numpy as np
import openpnm as op
... |
class BadFileExstension(Exception):
"""
"""
def __init__(self, *args, **kwargs):
super(BadFileExstension, self).__init__(
"Il file %s ha una estensione non supportata." % str(*args),
**kwargs
)
|
#!/usr/bin/env python
# Copyright 2013 Brett Slatkin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# Convert to Hugging Face compatible checkpoint
# python convert_to_hf_ckpt.py /path/to/model_to_convert /path/to/dir_to_save
from bert_of_theseus.modeling_bert_of_theseus import BertForSequenceClassification
import sys
import os
model = BertForSequenceClassification.from_pretrained(sys.argv[1])
model.bert.encoder.la... |
# -*- coding: utf-8 -*-
'''
Network Probes
===============
Configure RPM (JunOS)/SLA (Cisco) probes on the device via NAPALM proxy.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm p... |
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número '))
s = n1+n2
m = n1*n2
d = n1/n2
di = n1//n2
e = n1**n2
r = n1%n2
print('A soma é {}, o produto é {} e a divisão é {}.'.format(s, m, d))
print('Divisão inteira {}, potência {} e resto {}.'.format(di, e, r)) |
"""
This file offers the methods to automatically retrieve the graph Betaproteobacteria bacterium RBG_16_56_24.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v1... |
from django.test import TestCase, RequestFactory
from django.template import Context, Template
from django.contrib.auth import get_user_model
class InternalExternalTemplateTagTests(TestCase):
def setUp(self):
super(InternalExternalTemplateTagTests, self).setUp()
self.user = get_user_model().object... |
# this segment tree will support two operations:
# 1. apply set with value v for all elements on [l, r)
# 2. find sum for all elements on [l, r)
# Difference from previous problem is that we need to give argument len in our
# op_modify function
class SegmentTree:
def __init__(self, n):
self.size = 1
... |
# -*- coding: utf-8 -*-
"""Automate the creation of development environments"""
from __future__ import annotations
import argparse
import os
from pathlib import Path
from shutil import copytree, rmtree
import subprocess
from typing import Dict, List, Union
from rich import print
from dvnv import SCRIPTS_DIR, VERSION
... |
"""
WSGI config for eventmgr 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/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eventmgr.settings")
from django.cor... |
# -*- coding: utf-8 -*-
#
# Sphinx configuration for aiida-champ
#
# 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 configuration values have a default; values that are commented out
#... |
'''
Author: daoyi
Date: 2021-08-18 13:33:31
Description: Quant strategy
'''
import backtrader as bt
class DoubleMA():
'''Backtrader strategy
'''
params = dict(
pfast = 20, # fast period
pslow = 50) # slow period
def __init__(self):
self.dataclose ... |
'''Exercício Python 053: Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os espaços.'''
print('=+=+=+=+=+=+=+=+='*3)
titulo = str('PALÍDROMOS')
print('{:^51}'.format(titulo))
print('=+=+=+=+=+=+=+=+='*3)
frase = str(input('Digite uma frase: ')).strip().upper()
palavra = frase... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
# -*- coding: utf-8 -*-
import keras.engine.training
from typing import Callable
from typing import Tuple
from typing import List
from typing import Union
from util_types import types_of_loco
from network_model.distillation.distillation_model_builder import DistllationModelIncubator
from network_model.build_model impor... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.core.turn_context import TurnContext
from .dialog_state import DialogState
from .dialog_turn_status import DialogTurnStatus
from .dialog_turn_result import DialogTurnResult
from .dialog_reason import DialogRea... |
#!/usr/bin/python
import os
import shutil
# from testutil import run_gasoline, test_result
import pynbody as pyn
import numpy as np
import matplotlib.pyplot as plt
import pynbody.plot.sph as p_sph
#Parameters for the test
testdir='sedov'
files = ["data/sedov.std", "data/sedov.param"]
exe = "./ChaNGa"
testname = "Sedov... |
from NewDeclarationInQueue.processfiles.customprocess.text_with_special_ch import TextWithSpecialCharacters
class SearchTextLineParameter:
"""
Defines the parameters to search a line of text in the JSON returned by the Azure service
"""
start_with_text: TextWithSpecialCharacters
contains_wor... |
# Copyright 2017 Suomi Corporation
#
# 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 wri... |
from db.mysql_model.user import User
class Auth:
authorizations = {
}
@staticmethod
def auth_add_poc(user):
if user.is_checker():
return True
return False
|
import sys
from django.utils.timezone import now
try:
from django.db import models
except Exception:
print("There was an error loading django modules. Do you have django installed?")
sys.exit()
from django.conf import settings
import uuid
# Instructor model
class Instructor(models.Model):
user = mod... |
"""
Actions of the `critic` app
"""
from django.core.mail import mail_admins
from critic import signals
def create_app_links():
"""
Creates links of the `critic` app
"""
signals.app_link_ready.send(
sender=None, # not specified
base_pattern=r'^critic/',
url_name='critic:revi... |
"""
File name: load.py
Author: Daniel Liden
Date created: 2021-08-19
Date last modified: 2021-08-25
Python Version: 3.9
"""
import bitdotio
import csv
import pandas
import sqlalchemy
from io import StringIO
def create_new_schema(
schema_name: str, pg_string: str, bitio_key: str, bitio_userna... |
import numpy as np
import tensorflow as tf
import reader
DATA_PATH = 'E:/datasets/ptb'
VOCAB_SIZE = 10000
HIDDEN_SIZE = 200 # lstm隐含层神经元数
NUM_LAYERS = 2 # lstm结构层数
LEARNING_RATE = 1.0 # 学习率
KEEP_PROB = 0.5 # Dropout保留率
MAX_GRAD_NORM = 5 # 控制梯度膨胀的系数
TRAIN_BATCH_SIZE = 20 # 训练batch尺寸
TRAIN_NUM_STEP = 35 # 训练数据的截... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.