text stringlengths 2 999k |
|---|
# Generated by Django 3.2.8 on 2021-10-10 16:18
import uuid
import django.db.models.deletion
from django.apps.registry import Apps
from django.core.exceptions import FieldError
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
import authentik.lib.models
imp... |
import FWCore.ParameterSet.Config as cms
l1PhaseIITree = cms.EDAnalyzer("L1PhaseIITreeProducer",
muonToken = cms.untracked.InputTag("simGmtStage2Digis"),
egTokenBarrel = cms.InputTag("L1EGammaClusterEmuProducer",""),
######tkEGTokenBarrel = cms.InputTag("L1TkElectronsCrystal","EG"), ##REMOVED
tkEGTokenBa... |
#!/usr/bin/env python
import sys
import re
import os
sys.path.insert(0, '/root/workshop-ansible/SMS/')
from sms import send_sms
sys.path.insert(0, '/root/workshop-ansible/OpenStack/')
from credentials import get_nova_credentials_v2
from novaclient.client import Client
credentials = get_nova_credentials_v2()
nova_c... |
"""Test creation of all devices."""
import unittest
import traceback
from pyinsteon.device_types.ipdb import IPDB
from tests.utils import random_address
from tests import _LOGGER
class TestCreateDevices(unittest.TestCase):
"""Test creation of all devices."""
def test_create_devices(self):
"""Test de... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Math Algorithms
#
# Purpose: Performs the subtraction of any two matrices
# Language: Python
# Author: José Cintra
# Year: 2021
# Web Site: https://github.com/JoseCintra/MathAlgorithms
# License: Unlicense, described in http://unlicense.org
# Online demo: https://online... |
from django.urls import path
from . import views
app_name = "polls"
urlpatterns = [
path('', views.index, name='index'),
path('<int:question_id>/', views.detail, name='detail'),
path('<int:question_id>/results/', views.results, name='results'),
path('<int:question_id>/vote/', views.vote, name='vote'... |
"""Python setup.py for xpath package"""
import io
import os
from setuptools import find_packages, setup
def read(*paths, **kwargs):
"""Read the contents of a text file safely.
>>> read("xpath", "VERSION")
'0.1.0'
>>> read("README.md")
...
"""
content = ""
with io.open(
os.path... |
from data import COCODetection, YoutubeVIS, get_label_map, MEANS, COLORS
from yolact import Yolact
from utils.augmentations import BaseTransform, BaseTransformVideo, FastBaseTransform, Resize
from utils.functions import MovingAverage, ProgressBar
from layers.box_utils import jaccard, center_size
from utils import timer... |
# 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 ... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... |
from LocationList import location_table
from enum import Enum
class Location(object):
def __init__(self, name='', address=None, address2=None, default=None, type='Chest', scene=None, hint='Termina', parent=None, filter_tags=None):
self.name = name
self.parent_region = parent
self.item = N... |
# Copyright (c) 2018 PaddlePaddle 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 appli... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
if not A:
return 0
max_profit = 0
current_stock = A[0]
for i in A:
if i > current_stock:
if i - current_stock > max_profit:
max_profit = i - current_sto... |
import unittest
from unittest.mock import patch
import amocrm.conf
class BaseCopySettings(unittest.TestCase):
def setUp(self):
self.conf = amocrm.conf.AmoSettings()
self.domain = 'https://example.amocrm.ru'
self.user_login = 'vasya'
self.user_hash = 'hash'
def tearDown(self... |
import os
from setuptools import setup
version_txt = os.path.join(os.path.dirname(__file__), 'vimgolf', 'version.txt')
with open(version_txt, 'r') as f:
version = f.read().strip()
with open('README.md') as f:
long_description = f.read()
setup(
author='Daniel Steinberg',
author_email='ds@dannyadam.com... |
# For querying
# rebuild entity fastText
# rebuild annoyIndex
#
|
#!/usr/bin/env python
# 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
# "L... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..mesh import ComputeMeshWarp
def test_ComputeMeshWarp_inputs():
input_map = dict(
metric=dict(usedefault=True, ),
out_file=dict(usedefault=True, ),
out_warp=dict(usedefault=True, ),
... |
"""
Django settings for swd project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
fr... |
class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
return [
'FizzBuzz' if i % 15 == 0 else (
'Fizz' if i % 3 == 0 else (
'Buzz' if i % 5 == 0 else (
str(i)
)
)
)
for i in xrange(1, n+1)
]
print Solution().fizzBuzz(15) |
#!/usr/bin/env python
#
# Copyright 2007 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 o... |
# Copyright 2018 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, s... |
''' '''
'''
ISC License
Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all c... |
from collections import deque
def main():
n, q = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
adj[a].append(b)
adj[b].append(a)
queue = deque()
queue.append(0)
dist = [-1 for... |
import numpy as np
import scipy
import itertools
import time
from math import factorial
import copy as cp
import sys
from fermicluster import *
from pyscf_helper import *
import pyscf
ttt = time.time()
np.set_printoptions(suppress=True, precision=10, linewidth=1500)
print("GITHUB TREE")
import subprocess
label = subpr... |
import unicodedata
import collections
class Vocab(object):
r"""Vocabulary
Read the vocabulary file, and store the
[id, token] and [token, id] pairs.
Args:
vocab_file: Vocabulary file
"""
def __init__(self, vocab_file):
self.vocab = collections.OrderedDict()
idx = 0
... |
import bs4
import datetime
import json
import os
import pickle
import random
import re
import requests
import sys
from textblob.classifiers import NaiveBayesClassifier
import time
import tweepy
from urllib.parse import urlparse
home_art = """
,--, ,--,
... |
#!/usr/local/bin/python3
# Written By Peter Yang
# Copyright 2017
import subprocess
import os
import sys
import time
import requests
import base64
import xml.dom.minidom
from subprocess import Popen
#below define the global variables for the program
total_software_count=100#total number of software
base_directory=... |
"""news help text"""
NEWS = dict(
text="""This is RedBrick's famous news system!
There are over 65 "news boards" on all sorts of topics; sports, tv
programmes, news, debates, shopping, jobs, academic etc.
The first time you use this:
You will see a list of all the news boards available. Navigate using the
up and ... |
from django.contrib.auth.tokens import default_token_generator
from django.core.mail import send_mail
from django.shortcuts import get_object_or_404
from django.db.models import Avg
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, permissions, status, viewsets
from rest_... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Video4.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui... |
# Copyright 2016 The TensorFlow 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 applica... |
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
from xsdata.models.datatype import XmlTime
class FooTypeFoo(Enum):
VALUE_13_20_00_05_00 = XmlTime(13, 20, 0, 0, -300)
VALUE_13_20_00 = XmlTime(13, 20, 0, 0)
VALUE_01_50_40 = XmlTime(1, 50, 40, 0)
@dataclass
class ... |
import openpype.api
from openpype.hosts.photoshop import api as photoshop
class ExtractSaveScene(openpype.api.Extractor):
"""Save scene before extraction."""
order = openpype.api.Extractor.order - 0.49
label = "Extract Save Scene"
hosts = ["photoshop"]
families = ["workfile"]
def process(sel... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-19 16:30
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SteamProphet', '0018_creat... |
# -*- coding: utf-8 -*-
import math
import sys
# Courtesy of http://stackoverflow.com/a/6800214
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(math.sqrt(n)) + 1) if n % i == 0)))
def exhaust_elves(elves, house_num):
return (elf for elf in elves if house_num ... |
#!/usr/bin/env python
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="ds-pipeline",
version="0.3.1",
author="Dmitri Babaev",
author_email="dmitri.babaev@gmail.com",
description="Data Science oriented tools, mostly in form of scikit-lea... |
import pytest
from terraformpy import TFObject
@pytest.fixture(autouse=True, scope='function')
def reset_tfobject():
TFObject.reset()
|
# Lint as: python3
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import factory
from datetime import timedelta
from io import BytesIO
from faker import Factory
from random import randint
from zeus import models
from zeus.db.types.file import FileData
from zeus.utils import timezone
from .base import ModelFactory
from .types import GUIDFactory
faker = Factory.create()
def make_... |
import numpy as np
import freud
from benchmark import Benchmark
from benchmarker import run_benchmarks
class BenchmarkLocalityLinkCell(Benchmark):
def __init__(self, L, r_max):
self.L = L
self.r_max = r_max
def bench_setup(self, N):
self.box = freud.box.Box.cube(self.L)
np.ran... |
from data_wizard.loaders import BaseLoader
from itertable import JsonStringIter
class CustomLoader(BaseLoader):
default_serializer = "data_wizard.registry.SimpleModelSerializer"
def load_iter(self):
return JsonStringIter(string=self.content_object.json_data)
|
import pytest
from functions.messagecolors import MessageColors
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from .conftest import bot, channel
@pytest.mark.asyncio
@pytest.mark.parametrize("roll", ["1d20", "2d8", "1d20k7", "1*3", ""])
async def test_dice(bot: "bot", channel: "channel", roll: str)... |
#!/usr/bin/env python
#
# 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 requir... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 13:27:07 2019
@author: elisn
"""
from nordic_model import Model
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
import datetime
from help_functions import str_to_date
from model_definitions import MWtoGW
... |
# 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... |
from hashlib import sha256
import hashlib
import os
import random
from ptCrypt.Math import base
from ptCrypt.Math import primality
from ptCrypt.Util.keys import IFC_APPROVED_LENGTHS, millerRabinTestsForIFC, getIFCSecurityLevel, getIFCAuxiliaryPrimesLegths
from ptCrypt.Asymmetric import RSA
from ptCrypt.Math.primality i... |
from decimal import Decimal
from django.core.management.base import BaseCommand
from clint.textui import progress
from photos.models import Photo
from intrinsic.models import IntrinsicPoint
from intrinsic.tasks import sample_intrinsic_points_task
class Command(BaseCommand):
args = ''
help = 'Sample intrinsi... |
''' 2018/11/29 1.添加 frame_gen 逻辑用于方便的生成流输入
2.测试中存在丢失端口检测的情况
3.复位极性,时钟,复位信号无法自动检测
4.信号没有再系统初始化的时候自动添加复位(reg型)
添加 function blog2
function integer blog2(input integer num);
for ( blog2 = 0 ; num > 0... |
import gym
#env = gym.make('CartPole-v0')
#env = gym.make('MountainCar-v0')
env = gym.make('CarRacing-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
env.close()
|
from tkinter import *
from backend2 import *
def get_selected_row(event):
try:
index = list1.curselection()[0]
selected_tuple = list1.get(index)
print(selected_tuple[0])
title.delete(0,END)
title.insert(END,selected_tuple[1])
author.delete(0... |
#
# 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 us... |
def extractXiakeluojiao侠客落脚(item):
"""
Xiakeluojiao 侠客落脚
"""
badwords = [
'korean drama',
'badword',
]
if any([bad in item['tags'] for bad in badwords]):
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'... |
from . import winclude as w
from gpiozero import *
from .wlcd import lcd as LabLCD
print ('Setup pins')
Device.pin_factory = w.wfactory.WFactory()
def pause():
print ("Press Enter to end the program")
raw_input()
w._exit(0)
for eachPin in w.pinsAll:
globals()[eachPin] = eachPin
class DHTsensor:
... |
"""
Django settings for intered project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# B... |
# -*- 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 py2neo.ogm import GraphObject, Property, RelatedFrom, RelatedTo
class Relationship():
E = 'E'
POR='POR'
CITA = 'CITA'
FONTE='FONTE'
E_FONTE='E_FONTE'
PUBLICOU='PUBLICOU'
PUBLICOU_NO='PUBLICOU_NO'
CONHECIDO_COMO='CONHECIDO_COMO'
class Tipo(GraphObject):
__primarykey__ =... |
from scipy import stats
import numpy as np
import argparse
import heapq
import math
import random
import multiprocessing as mp
from itertools import product
from operator import attrgetter
MULTIPROCESSING_CPUS = mp.cpu_count()
dists = {
"exponential": stats.expon,
"uniform": stats.uniform,
"normal": stats... |
# class, xmin, ymin, xmax, ymax, 3d_height, width, length, x, y, z, yaw
""" Helper methods for loading and parsing KITTI data.
Author: Charles R. Qi
Date: September 2017
"""
from __future__ import print_function
import numpy as np
import cv2
import os
import ipdb
st = ipdb.set_trace
import torch
import utils_geom
c... |
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
from enum import Enum
CocoTask = Enum('CocoTask', [
'instances',
'person_keypoints',
'captions',
'labels', # extension, does not exist in the original COCO format
'image_info',
# 'panoptic',
# 'stuff',
])
class ... |
import torch as t
import torch.nn as nn
from model.AttentionLayer import AttentionSCN
def generate_graph(m, num_nodes):
now = 0
graph = []
while now * m + 1 < num_nodes:
col = [now]
col = col + [node for node in range(now * m + 1, now * m + 1 + m)]
graph.append(t.tensor(col, dtype=... |
# Copyright 2009-2010 by Ka-Ping Yee
#
# 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 w... |
from datetime import date, datetime, timedelta
from distutils.version import LooseVersion
import numpy as np
import pytest
import pytz
from pandas._libs.tslibs import (
NaT, OutOfBoundsDatetime, Timedelta, Timestamp, conversion, timezones)
from pandas._libs.tslibs.frequencies import (
INVALID_FREQ_ERR_MSG, ge... |
def test_example_resource(example_resource):
"""Check that the example resource was loaded correctly."""
assert len(example_resource) == 4
assert example_resource[0]["average"] == 6.29
|
# Copyright (c) 2021 PaddlePaddle 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 appli... |
s = int(input())
print('{}:{}:{}'.format(s//3600, (s - (3600*(s//3600)))//60,s%60)) |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
"""kubernetes check
Collects metrics from cAdvisor instance
"""
# stdlib
from collections import defaultdict
from fnmatch import fnmatch
import numbers
import re
import time
import calendar
# 3rd party
import req... |
from summarizer import summarize
import newspaper
from newspaper import Article
from pyteaser import SummarizeUrl
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
url = 'http://www.politifact.com/truth-o-meter/statements/2017/jun/22/antinews/its-fake-news-chinese-lunar-rover-found-no-evidenc/'
a = Article(u... |
from gzip import READ
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
from typing import Tuple
class Refiner(nn.Module):
"""
Refiner refines the coarse output to full resolution.
Args:
mode: area selection mode. Options:
"full" - N... |
import pybithumb
con_key = "2bdd34c82dcc9aac96ead793887db3b8"
sec_key = "abe0ed795d11f363259f688582269d7c"
bithumb = pybithumb.Bithumb(con_key, sec_key)
unit = bithumb.get_balance("BTC")[0]
order = bithumb.sell_market_order("BTC", unit)
print(order)
|
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
|
PARAMETER_TYPES = [(1, 'query'), (2, 'user')]
TRANSFORMATION_TYPES = [(1, 'Transpose'), (2, 'Split'), (3, 'Merge')]
COLUMN_TYPES = [(1, 'dimension'), (2, 'metric')]
|
#!/usr/bin/env python
#
# Copyright 2014-2017 42 Lines, Inc.
# Original Author: Jack Neely <jjneely@42lines.net>
# edite by: Alexander Svyatov alexander_svyatov@epam.com
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... |
import unittest
from graph import Graph
class GraphTestCase(unittest.TestCase):
def setUp(self):
self.g = Graph()
def test_add_vertex(self):
for i in range(1, 7):
self.g.add_vertex(i)
vertexes = [1, 2, 3, 4, 5, 6]
self.assertEqual(vertexes, list(self.g.dic... |
import json
import os
import time
from opsbro.log import cprint
from opsbro.info import BANNER, TITLE_COLOR
import sys
pth = os.path.join(os.path.dirname(__file__), 'linux-dashboard.json')
f = open('/root/counter.txt', 'a')
f.write('%d\n' % time.time())
f.close()
f = open(pth, 'r')
buf = f.read()
f.close()
tutoria... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
The MNIST Database is a database of handwritten digits, which has a training
set of 60,000 examples, and a test set of 10,000 examples. It is a subset of
a larger set available from NIST. The digits have been size-normalized and
centered in a fixed-size image.
... |
import pickle
import numpy as np
import pytest
import tensorflow as tf
from garage.tf.envs import TfEnv
from garage.tf.policies import CategoricalMLPPolicy2
from tests.fixtures import TfGraphTestCase
from tests.fixtures.envs.dummy import DummyBoxEnv
from tests.fixtures.envs.dummy import DummyDiscreteEnv
class TestC... |
import random
import string
import sys
import threading
import weakref
class Local:
"""
A drop-in replacement for threading.locals that also works with asyncio
Tasks (via the current_task asyncio method), and passes locals through
sync_to_async and async_to_sync.
Specifically:
... |
#!/usr/bin/env python
#
# Copyright 2018 Alexandru Catrina
#
# 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, modif... |
# coding=utf-8
#
# Copyright 2014-2016 F5 Networks 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... |
from gempy.library import config
class calRequirementConfig(config.Config):
do_cal = config.ChoiceField("Calibration requirement", str,
allowed={"procmode": "Use the default rules set by the processing"
"mode.",
"force": "Req... |
#
# 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 us... |
import pandas as pd
import numpy as np
import warnings
from numpy import cumsum, log, polyfit, sqrt, std, subtract
from datetime import datetime, timedelta
import scipy.stats as st
import statsmodels.api as sm
import math
import matplotlib
import matplotlib.pyplot as plt
from tqdm import tqdm
from scipy.stats import no... |
# This game is an adapted version of the Snake game available here: https://github.com/shubham1710/snake-game-python
# Import libraries
import random
import pygame
# Define display width and heigth
dis_width = 800
dis_height = 600
# Define the width of one snake square
snake_block = 10
# Define the snake's moving ... |
from numpy import exp, array, random, dot
class NeuralNetwork():
def __init__(self):
random.seed(1)
self.weights = 2 * random.random((14, 1)) - 1
def __sigmoid(self, x):
# Ham chuan hoa
# YT = 1 / (1 + exp(e(-Y)))
return 1 / (1 + exp(-x))
def __sigmoid_derivative(sel... |
import base64
import binascii
import json
import re
import uuid
import warnings
import zlib
from collections import deque
from types import TracebackType
from typing import (
TYPE_CHECKING,
Any,
AsyncIterator,
Deque,
Dict,
Iterator,
List,
Mapping,
Optional,
Sequence,
Tuple,
... |
# Copyright 2020 Mathias Lechner
#
# 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 in writ... |
# Place or mount as studlan/settings/local.py or specify it using env var CONFIG_FILE_DIR.
# WARNING: This version contains settings for testing only!
DEBUG = False
SITE_NAME = 'example'
ALLOWED_HOSTS = [
'example.net'
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgr... |
#!/usr/bin/env python3
'''
Supondo que a população de um país A seja da ordem de 80000 habitantes com uma taxa anual de crescimento de 3% e que a população de B seja 200000 habitantes com uma taxa de crescimento de 1.5%. Faça um programa que calcule e escreva o número de anos necessários para que a população do país A ... |
# Generated by Django 3.1.6 on 2021-03-27 16:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('donor', '0008_auto_20210325_1423'),
]
operations = [
migrations.AddField(
model_name='donordetail',
name='address',
... |
n = int(input())
print(n)
n100 = n // 100
n = n - n100*100
n50 = n // 50
n = n - n50*50
n20 = n // 20
n = n - n20*20
n10 = n // 10
n = n - n10*10
n5 = n // 5
n = n - n5*5
n2 = n // 2
n = n - n2*2
n1 = n // 1
n = n - n1*1
print('{} nota(s) de R$ 100,00'.format(n100))
print('{} nota(s) de R$ 50,00'.format(n50))
pri... |
"""A rule for encoding a text format protocol buffer into binary.
Example usage:
proto_library(
name = "calculator_proto",
srcs = ["calculator.proto"],
)
encode_binary_proto(
name = "foo_binary",
deps = [":calculator_proto"],
message_type = "mediapipe.CalculatorGra... |
# Copyright 2015 OpenMarket Ltd
# Copyright 2017 New Vector 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 required by appli... |
# coding=utf-8
# Copyright 2021 The Facebook AI Research Team Authors and The HuggingFace Inc. team.
#
# 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/LIC... |
import numpy as np
import os
import numpy.random as rd
import gym
class StockTradingEnv(gym.Env):
metadata = {'render.modes': ['human']}
"""FinRL
Paper: A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance
https://arxiv.org/abs/2011.09607 NeurIPS 2020: Deep... |
# egret_web.py: Web interface for EGRET using Flask
#
# Copyright (C) 2016-2018 Eric Larson and Nicolas Oman
# elarson@seattleu.edu
#
# This file is part of EGRET.
#
# 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 Fre... |
# https://projecteuler.net/problem=19
# Run with: 'python solve19.py'
# using Python 3.6.9
# by Zack Sargent
# Prompt:
# You are given the following information,
# but you may prefer to do some research for yourself.
# 1 Jan 1900 was a Monday.
# Thirty days has September,
# April, June and November.
# All the rest ha... |
"""
Utilities helpful for handling the vehicle model: find floor/ceiling, convert coordinates to
voxel grid points, label regions (and based on a specific point), etc.
"""
import logging
import numpy as np
from scipy.ndimage import measurements as meas
class Component(object):
"""Object to store informa... |
from capa.features.common import Characteristic
from capa.features.extractors import loops
def extract_function_calls_to(f):
for inref in f.inrefs:
yield Characteristic("calls to"), inref
def extract_function_loop(f):
"""
parse if a function has a loop
"""
edges = []
for bb_from, bb_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.