text stringlengths 2 999k |
|---|
import discord
import sys
import random
import aiohttp
token = sys.argv[1]
SERVER = sys.argv[2]
tokenno = sys.argv[3]
msgtxt = sys.argv[4]
textchan = sys.argv[5]
allchan = sys.argv[6]
useproxies = sys.argv[7]
if useproxies == 'True':
proxy_list = open("proxies.txt").read().splitlines()
proxy = ... |
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import permission_classes
from rest_framework.permissions import AllowAny
from django.contrib.auth.models import User
from mentorship_profile.models import Profile, Men... |
import os
import tempfile
class TmpFile:
"""The TmpFile objets are designed to be used for temporary files.
It ensures that the file is unlinked when the object is
out-of-scope (with __del__).
Parameters
----------
path : str
Actual path of the file.
"""
def __init__(self, pa... |
# (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
@pytest.mark.e2e
def test_e2e(dd_agent_check):
instance = {}
aggregator = dd_agent_check(instance)
metrics = [
'jvm.non_heap_memory_max',
'jboss.jdbc_preparedstatemen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# 如果你感到困惑,下面的视频可能会有所帮助(需要科学上网)
#
# http://bit.ly/about_asserts
... |
n, a, b = map(int, input().split(" "))
s = input()
if s[a-1] == s[b-1]:
print(0)
else:
print(1)
|
import os
print('Please Input The Version Name:')
version = input()
ins1 = 'python train.py --batch-size 64 --train /data/g_data --max-epoch 50 --version {}'.format(version)
ins2 = 'python train.py --train /data/unlabeled2017 --batch-size 32 --max-epoch 100 --version {} --checkpoint 00000050'.format(version)
ins3 ... |
#!/usr/bin/env python
# coding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
class MSC_BCM(nn.Module):
"""
Multi-scale inputs with Box-driven Class-wise Masking(BCM).
"""
def __init__(self, base, scales=None, n_classes=21):
super(MSC_BCM, self).__init__()
s... |
import os
import json
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
CONFIG_FILE_NAME = '/etc/randomcab/main.ini'
INSTALL_DIR = ""
from configparser import RawConfigParser
config = RawConfigParser()
if os.path.exists(CONFIG_FILE_NAME):
DEBUG = False
config.read(CONFIG_FILE_NAME)
INSTALL_DIR = conf... |
from lib.message.base_message import base_message
from lib.message.set_nickname import set_nickname
from lib.message.add_server import add_server
from lib.message.del_server import del_server
from lib.message.query_server import query_server
from lib.message.print_server import print_server
from lib.message.list_tags i... |
# Copyright (c) 2012, 2015 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the function... |
# Copyright 2018 OpenStack Foundation.
#
# 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 ... |
#!/usr/bin/python3
from datetime import datetime
import CruxpoolFetcher as CF
import CryptoWalletFetcher as CWF
from logger import LOG
class Data():
__date_time_format = "%Y-%m-%dT%H:%M:%S.%fZ"
def __init__(self, wallet, fiat_code, theorical,
pay_amount, coin, coin_full):
self.__co... |
#! /usr/bin/env python
# run this scritp along with _06Briding_openCV_ROS.py from this package
import rospy, cv2, time
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image
# CONSTANTS
NODE_NAME = "image_publisher"
IMAGE_TOPIC = "image"
# GLOBALS
image_pub = None
bridge = CvBridge()
def m... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
('pages', '0005_bannerplugin'),
]
operations = [
migrations.CreateModel(
... |
import errno
import os
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
from django.core.files import storage
from django.utils import timezone
class DummyStorage(storage.Storage):
"""
A storage class that implem... |
"""
MIT License
Copyright (c) 2020 Airbyte
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, merge, publish, distr... |
# 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 applic... |
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
import jh_util as jh
import constants as const
import logging
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
logging.info('starting up')
... |
from output.models.nist_data.list_pkg.date.schema_instance.nistschema_sv_iv_list_date_max_length_2_xsd.nistschema_sv_iv_list_date_max_length_2 import NistschemaSvIvListDateMaxLength2
__all__ = [
"NistschemaSvIvListDateMaxLength2",
]
|
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# 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 modifications or derivat... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField, FloatField
from wtforms.validators import DataRequired, Length
class SendMoneyForm(FlaskForm):
to = StringField('Username',
validators=[DataRequired(), Length(min=2, max=20)])
concept = TextAreaFi... |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.backen... |
import math
import numpy as np
from common.basedir import BASEDIR
from selfdrive.controls.lib.drive_helpers import get_steer_max
from cereal import log
from common.numpy_fast import clip, interp
from common.realtime import DT_CTRL
class LatControlModel:
def __init__(self, CP):
# Model generated using Konverter:... |
#Python chatbot lol
from time import sleep
import time
print("This chatbot is only compatible with correct spelling and only lowercase. Say stop to make the chatbot stop. Say hi or hello to start the conversation.")
lol = 1
text = str(input())
while lol == 1:
if text == "hi":
print("hello. My name is genius... |
"""
MIT License
Copyright (c) present TheHamkerCat
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, merge, publis... |
# Copyright (c) 2015-2017 Blizzard Entertainment
#
# 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, me... |
import argparse
import os, sys, tempfile
import torch
this_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.abspath(os.path.join(this_dir, '..', '..'))
if root_dir not in sys.path:
sys.path.insert(0, root_dir)
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.data import make_da... |
import scrapy
from scrapy import Request
from datetime import datetime
from dateutil import parser
from blog_abierto_al_publico.LanguageDetector import LanguageDetector
# import pdb
# import mymodule
# import locale
class QuotesSpider(scrapy.Spider):
name = "blogs_iadb"
allowed_domains = ["blogs.iadb.org"]
... |
from collections import defaultdict
REG_MAX = 2 ** 32
USER_MEM = 8192
P_VALUES = { 32: 2147565569, \
64: 9223372036855103489, \
128: 170141183460469231731687303715885907969, \
192: 3138550867693340381917894711603833208051177722232017256453, \
256: 578960446186580977... |
import sys
import random
import time
import datetime
INF = float("inf")
class Team59:
# The team's entire code to be written under this class
def __init__(self):
self.timestart = 0.00
self.maxTime = 8
self.terminate = False
pass
def heuristic(self,board):
heu = 0
blockmap = ( 0 , 3 , 9 ,... |
# *********************************************************************************
# *********************************************************************************
#
# File: labels.py
# Purpose: Extract labels from assembler result
# Date : 22nd December 2018
# Author: paul@robsons.org.uk
#
# **************... |
"""
Functions to load and dump graphs in YAML and JSON formats.
"""
import contextlib
import json
import io
import ruamel.yaml
import demes
@contextlib.contextmanager
def _open_file_polymorph(polymorph, mode="r"):
"""
Open polymorph as a path and yield the fileobj. If that fails,
just yield polymorph un... |
from core.query import BetaMoveQuerySet
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
class BodyPart(models.TextChoices):
"""A body part that someone could put on a hold"""
# we could easily expand this later to include knees, spleen, etc.
... |
# 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 ... |
import os
import shutil
import pytest
from .utils import srcdir, prefixdocumentsrcdir, customobjectsrcdir, pythondomainsrcdir, intersphinxsrc
@pytest.fixture(autouse=True, scope='function')
def remove_sphinx_build_output():
"""Remove _build/ folder, if exist."""
for path in (srcdir, prefixdocumentsrcdir, cus... |
try: # py 2
from profile import profile, stats, kpystones, pystones
from meminfo import MemInfo
from cpuinfo import CpuInfo
from .gprofiler import GProfiler
except ImportError: # py 3
from .profile import profile, stats, kpystones, pystones
from .meminfo import MemInfo
... |
# 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: release-1.18
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
# The MIT License (MIT)
#
# Copyright (c) 2019 Henry Zhao
#
# 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... |
from flask import Flask, request
import werkzeug
from healthcheck import HealthCheck, EnvironmentDump
import mqresources.mqutils as mqutils
import load_report_service.load_report_service as load_report_service
from load_report_service.load_report_exception import LoadReportException
'''This class is currently entirel... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
class TestWiseOperator(TransactionCase):
def test_wise_operator(self):
# Create a new storable product
product_wise = self.env['product.product'].crea... |
from django import forms
from .models import Customer
from .models import Customer, Stock, Investment
from django.contrib.auth.models import User
class CustomerForm(forms.ModelForm):
class Meta:
model = Customer
fields = ('cust_number', 'name', 'address', 'city', 'state', 'zipcode', 'email', 'cell_p... |
import json
import os
import sys
import csv as csv
import re
from tqdm import tqdm
import multiprocessing as mp
POISON = "POISON" # this is the kill switch for the write process
pwd = "/home/srivbane/shared/caringbridge/data/projects/sna-social-support/csv_data/"
def process_user(uid_lines, queue, uid):
total_in... |
name = input("name")
def operation(quantity):
cash = int(input('cash'))
overall = price*quantity
change = cash - overall
if change>=0:
return overall
else:
print("van nehvataet cash")
return -change
def search(name):
if name in data:
print(data[name])
retu... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "This action is used to close all investigations that fall within a date range"
class Input:
ALERT_TYPE = "alert_type"
DATETIME_FROM = "datetime_from"
DATETIME_TO = "datetime_to"
MAX_INVESTIGATIONS_T... |
from flask import Flask, request,jsonify,json
from flask_cors import CORS, cross_origin
app = Flask(__name__)
Cors = CORS(app)
CORS(app, resources={r'/*': {'origins': '*'}},CORS_SUPPORTS_CREDENTIALS = True)
app.config['CORS_HEADERS'] = 'Content-Type'
@app.route("/dataentry", methods=["POST","GET"])
def submitData():... |
import inspect
import pprint
import re
from typing import TYPE_CHECKING
import lale.helpers
if TYPE_CHECKING:
from lale.operators import IndividualOp
def _indent(prefix, string, first_prefix=None):
lines = string.splitlines()
if lines:
if first_prefix is None:
first_prefix = prefix
... |
"""Support for Meteoclimatic weather data."""
import logging
from meteoclimatic import MeteoclimaticClient
from meteoclimatic.exceptions import MeteoclimaticError
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinat... |
"""
Micro Service that extracts info from IdP metadata if available
"""
import logging
from satosa.internal_data import InternalResponse
from satosa.micro_services.base import ResponseMicroService
logger = logging.getLogger('satosa')
class MetaInfo(ResponseMicroService):
"""
Metadata info extracting micro_se... |
import ctk_cli
import itertools
from girder.models.model_base import ValidationException
_SLICER_TO_GIRDER_WORKER_INPUT_TYPE_MAP = {
'boolean': 'boolean',
'integer': 'integer',
'float': 'number',
'double': 'number',
'string': 'string',
'integer-vector': 'integer-vector',
'float-vector': 'n... |
# Copyright (c) 2013 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 os
from gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class WebGLConformance... |
from flats_scraper.scrap_otodom_page import scrap_otodom_ad
from httmock import HTTMock, all_requests, urlmatch
@all_requests
def case1(url, request):
with open('tests/test_src/otodom_test1.html') as f:
return f.read()
def test_ads_getter():
with HTTMock(case1):
results = scrap_otodom_ad(
... |
# for07.py
a = [10,20,30,40,50]
for i in a : print(i)
for i in range(len(a)) : print(a[i])
######################
# 1 : 10
for i, v in enumerate(a):
print("{} : {}".format(i+1,v))
|
# Generated by Django 2.2.5 on 2019-09-23 08:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('visualizer', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='Video',
),
]
|
# coding: utf-8
from __future__ import absolute_import
# import models into model package
from huaweicloudsdkcbs.v1.model.candidate_intention import CandidateIntention
from huaweicloudsdkcbs.v1.model.chat_answers import ChatAnswers
from huaweicloudsdkcbs.v1.model.collect_hot_questions_request import CollectHotQuestio... |
import pytest as pytest
from plenum.common.constants import ROLE, STEWARD, NYM, TXN_TYPE
from plenum.common.exceptions import UnauthorizedClientRequest
from plenum.common.request import Request
from plenum.common.txn_util import get_payload_data, get_reply_nym
from plenum.server.database_manager import DatabaseManager... |
#-----------------------------------------------------------------------------
# Title : PyRogue PyDM Top Level GUI
#-----------------------------------------------------------------------------
# This file is part of the rogue software platform. It is subject to
# the license terms in the LICENSE.txt file found i... |
import random
import sys
from peewee import *
from playhouse.fields import *
try:
from playhouse.fields import AESEncryptedField
except ImportError:
AESEncryptedField = None
try:
from playhouse.fields import PasswordField
except ImportError:
PasswordField = None
from playhouse.tests.base import databas... |
'''
Converts weighted graphs in GTgraph format to the WeightedAdjacencyGraph format of Ligra.
Note that GTgraph creates multigraphs; this script handles duplicate edges; the latest (in-file)
update to an edge's weight will be the one used in the final result.
Also includes symmetric back edges as a convenience ... |
import time
import datetime
import socket
import threading
import shlex
import os
import platform
import sys
global OS
OS=platform.system()
#global t1
#t1 = LinkedList()
t1 = ''
class RSentry:
CookieNo = 0
PeerCnt = 0
ActvCnt = 0
def __init__(self,hostname=None,list_port=0,cookie=0,... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Hackman.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
# -*- coding: utf-8 -*-
import logging
import unittest
from app.http_handlers import g_taipei_city_road_case_next_road_case_handler
class TestGTaipeiCityRoadCaseNextRoadCaseHandler(unittest.TestCase):
'''unit tests for g_taipei_city_road_case_next_road_case_handler'''
def setUp(self):
'''setup for al... |
# 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,... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 modifications or derivative wo... |
from src.db.database import locked, Database
from src.models.customer import Customer, DeleteCustomer
from src.models.query_response import InsertResponse, UpdateResponse
@locked
def insert_customer(customer: Customer):
cursor = Database.get_instance().get_conn_cursor()
try:
args = [
custo... |
"""
DSA^2 F: Deep RGB-D Saliency Detection with Depth-Sensitive Attention and Automatic Multi-Modal Fusion
"""
import os
import torch
from torch.autograd import Variable
from torch.utils.data import DataLoader
import torch.nn.functional as F
import time
import torchvision
import logging
import sys
import argparse
i... |
import FWCore.ParameterSet.Config as cms
hltL1SingleNNTau150 = cms.EDFilter("L1TPFTauFilter",
MaxEta = cms.double(2.172),
MinEta = cms.double(-2.172),
MinN = cms.int32(1),
MinPt = cms.double(150.0),
PassLooseNN = cms.int32(0),
Scalings = cms.PSet(
barrel = cms.vdouble(-9.54135, 1.73403,... |
# _______ _______ ______ _______ __
#| || _ || __ \| __|| |.-----.
#| - _|| || <|__ || || _ |
#|_______||___|___||___|__||_______||__|| __|
# |__|
# QARSlp Qtile + Arch Ricing Script
# By: gibranlp <thisdoesnotwork@gibranlp.dev... |
import collections
class Solution:
def wordSubsets(self, A: List[str], B: List[str]) -> List[str]:
table = collections.Counter()
for b in B:
count = collections.Counter(b)
for k, v in count.items():
table[k] = max(table[k], v)
result = []
for a... |
# Generated by Django 2.2 on 2021-05-16 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
... |
from telegram import ParseMode, ReplyKeyboardMarkup, ReplyKeyboardRemove
from telegram.ext import ConversationHandler
from pdf_bot.analytics import TaskType
from pdf_bot.consts import (
BACK,
BY_PERCENT,
TO_DIMENSIONS,
WAIT_SCALE_DIMENSION,
WAIT_SCALE_PERCENT,
WAIT_SCALE_TYPE,
)
from pdf_bot.fi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from txt import txt
__all__ = ['dat']
def dat(from_file, to_txt, opts):
return txt(from_file, to_txt, opts)
|
# Copyright 2020 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 agr... |
from .module import Module
from .utils import _pair, _quadruple, _ntuple
from .. import functional as F
from torch import Tensor
from ..common_types import _size_2_t, _size_4_t, _size_6_t
from typing import Sequence, Tuple
# TODO: grad_output size asserts in THNN
class _ConstantPadNd(Module):
__constants__ = [... |
from pydantic import BaseModel
from pydantic import Field
__all__ = [
"MySqlConfig",
]
class MySqlConfig(BaseModel):
host: str = "127.0.0.1"
port: int = Field(3306, gt=0, lt=65536)
database: str = "asteriskcdrdb"
user: str
password: str
|
import logging
from functools import wraps
import airflow
from airflow.api.common.experimental import delete_dag
from airflow.exceptions import DagFileExists, DagNotFound
from airflow.utils.log.logging_mixin import LoggingMixin
from flask import current_app, flash, g, redirect, request, url_for
from flask_appbuilder i... |
import unittest
import numpy
import os
from unittest.mock import (Mock, patch)
from app.parser.yuv import ParserYUV420, ParserYUV422, ParserYUV420Planar, ParserYUV422Planar
from enum import Enum
class DummyPixelFormat(Enum):
YUV = 1
YVU = 2
UYVY = 3
YUYV = 4
class DummyEndianness(Enum):
LITTLE_E... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AnttechBlockchainTwcUserinfoMatchModel(object):
def __init__(self):
self._alipay_user_id = None
self._call_no_hash = None
self._unify_no = None
self._unify_no_hash... |
"""
Django settings for open_discussions.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import datetime
import logging
import os
import platform
from urllib.p... |
"""Automatically generated by hassfest.
To update, run python3 -m script.hassfest
"""
# fmt: off
FLOWS = [
"abode",
"accuweather",
"acmeda",
"adax",
"adguard",
"advantage_air",
"aemet",
"agent_dvr",
"airly",
"airnow",
"airthings",
"airtouch4",
"airvisual",
"ala... |
import pdb
import copy
import struct
import pytest
import threading
import datetime
import logging
from time import sleep
from multiprocessing import Process
import numpy
import sklearn.preprocessing
from milvus import Milvus, IndexType, MetricType
from utils import *
dim = 128
collection_id = "test_search_by_ids"
nb ... |
# -*- coding: utf-8 -*-
"""
Monte Carlo Tree Search in AlphaGo Zero style, which uses a policy-value
network to guide the tree search and evaluate the leaf nodes
@author: Junxiao Song
"""
import numpy as np
import copy
def softmax(x):
probs = np.exp(x - np.max(x))
probs /= np.sum(probs)
return probs
c... |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
"""
Django settings for Product project.
Generated by 'django-admin startproject' using Django 2.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... |
import os
import multiprocessing
import queue
import time
import sys
import traceback
import hashlib
import numpy as np
from typing import List, Optional, Callable
from .file import ArchiveFile
from .db_core import VfsDatabase, VfsNode, language_codes, node_flag_v_hash_type_4, node_flag_v_hash_type_8
from .db_wrap imp... |
#!/usr/bin/env jython
# $Id$
"""
This is to be used with the DB API compatibility test available @
http://stuartbishop.net/Software/DBAPI20TestSuite/
"""
__rcs_id__ = '$Id$'
__version__ = '$Revision$'
import dbapi20
import unittest
from com.ziclix.python.sql import zxJDBC as zxjdbc
class test_zxjdbc(dbapi20.Dat... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for the inotify wrapper in L{twisted.internet.inotify}.
"""
from twisted.internet import defer, reactor
from twisted.python import filepath, runtime
from twisted.trial import unittest
try:
from twisted.python import _in... |
from datetime import datetime
import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString, Polygon, MultiPolygon
def make_time(row):
datetime_str = str(row["date_begin"]) + str(row["time_begin"])
return pd.datetime.strptime(datetime_str, "%y%m%d%H%M%S")
def make_line(row):
coordi... |
from datetime import date
ano = int(input('Ano de nascimento: '))
atual = date.today().year
idade = atual - ano
print('Atletas nascidos em {} tem {} anos em {}.'.format(ano, idade, atual))
if idade <= 9:
print('Sua categoria é a MIRIM.')
elif idade <= 14:
print('Sua categoria é a INFANTIL.')
elif idade... |
from visual import *
# Display extruded text (uppercase only at present)
# By default, display text along x axis, with letters pointing up parallel to y axis
# Bruce Sherwood, Carnegie Mellon University, begun March 2000
# Example with default values:
# text(pos=(0,0,0), axis=(1,0,0), string='ABC',
# heig... |
# Generated by Django 3.1.1 on 2020-10-05 19:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Turma',
fields=[
('id', models.AutoField(au... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-07-18 00:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PrivateMessage'
db.create_table('sphmessaging_privatemessage', (
(... |
from setuptools import setup
with open('README.md') as f:
readme = f.read()
setup(
version='0.9.4',
name='FuelSDK',
description='ExactTarget Fuel SDK for Python',
long_description=readme,
author='ExactTarget',
author_email='code@exacttarget.com',
py_modules=['ET_Client'],
packages=... |
# Generated by Django 2.2.16 on 2020-10-27 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('testproject', '0002_auto_20190728_1359'),
]
operations = [
migrations.AddField(
model_name='samplemodel',
name='som... |
# Open a filefo = open("foo.txt", "wb")print "Name of the file: ", fo.name
# Here it does nothing, but you can call it with read operation.fo.flush()# Close opend filefo.close() |
adfgvx = 'ADFGVX'
def encrypt(message, keysquare, keyword):
key = []
for c in keyword:
if c not in key: key.append(c)
n = len(key)
k = sorted(range(n), key=lambda i: key[i])
s = []
for c in message.lower():
if c.isalpha() or c.isdigit():
row, col = divmod(keysquare.... |
from django.db.models import Q
from cloud_provider import get_cloud_client
from cloud_provider.compute_model import get_compute_model_meta
from cloud_provider.models import Plan, Zone
from kubeops_api.adhoc import drain_worker_node
from kubeops_api.models.host import Host
from kubeops_api.models.node import Node
from ... |
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.