text stringlengths 1 927k |
|---|
import socket
from cmd_functions import is_ip_valid, is_port_valid
'''
A library that allows AVA to connect to various cloud services
'''
def send_to_cloud(socket, data):
"""
Send data over the specified socket to the associated cloud
socket = any socket object
data = a string or int to be sent over t... |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") 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"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import uuid
import requests_mock
from canvasapi import Canvas
from canvasapi.assignment import Assignment, AssignmentGroup
from canvasapi.exceptions import CanvasException, RequiredFieldMissing
from canvasapi.progress i... |
import numpy as np
import pprint
from keras.models import Sequential
from keras.layers import Convolution2D, Dense, Flatten, Activation, MaxPooling2D, Dropout
from keras.layers.recurrent import LSTM
from keras.layers.advanced_activations import ELU
from keras.layers.embeddings import Embedding
from kerasify import ex... |
from datetime import datetime, date
from marqeta.response_models.avs_information import AvsInformation
from marqeta.response_models.avs_information import AvsInformation
from marqeta.response_models.response import Response
from marqeta.response_models import datetime_object
import json
import re
class AddressVerifica... |
from __future__ import unicode_literals
import os
from io import BytesIO
try:
from PIL import Image, ImageOps
except ImportError:
raise RuntimeError('Get Pillow at https://pypi.python.org/pypi/Pillow '
'or run command "pip install Pillow".')
from .utils import import_from_string, gene... |
import collections
import os
import random
import re
import traceback
from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
from qtpy import QtGui as QG
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusGlob... |
from math import sin, cos, radians
def func_args_unpack(func, args):
return func(*args)
def get_len(iterable, total):
try:
length = iterable.__len__()
except AttributeError:
length = total
return length
def cpu_bench(number):
product = 1.0
for elem in range(number):
... |
## From the dictionary in connection.py, extract the dataframes
rsl=walis_dict[0].copy()
countries=walis_dict[1].copy()
regions=walis_dict[2].copy()
MIS_ages=walis_dict[3].copy()
references=walis_dict[4].copy()
hrzpos=walis_dict[5].copy()
rslind=walis_dict[6].copy()
sldatum=walis_dict[7].copy()
vrt_meas=walis_dict[8].c... |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Some Bio.PDB-specific exceptions."""
# General error
class PDBException(Exception):
... |
from aiogram.types import Message
from loader import dp, db
from .menu import delivery_status
from filters import IsUser
@dp.message_handler(IsUser(), text=delivery_status)
async def process_delivery_status(message: Message):
orders = db.fetchall('SELECT * FROM orders WHERE cid=?', (message.chat.id,))
... |
"""
Copyright 2019 Faisal Thaheem
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... |
# -*- Mode: Python -*-
# Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp
# Author: Sam Rushing <rushing@nightmare.com>
# ======================================================================
# Copyright 1996 by Sam Rushing
#
# All Rights Reserved
#
# Permission to use, copy, modify,... |
from openmdao.api import Group, Problem, MetaModelUnStructuredComp, NearestNeighbor
from openmdao.utils.assert_utils import assert_near_equal
import numpy as np
import unittest
class CompressorMap(MetaModelUnStructuredComp):
def __init__(self):
super(CompressorMap, self).__init__()
self.add_inp... |
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
import argparse
import sys, os
from Models.login_model import login_stuff, url_builder
from helpers.helpers1 import db_tables
from Views.sample_login import LoginForm
from Views.all_view import VAS_view,VCRH_view ,VCCP_view,VCRH_Edit, ... |
import logging
from matplotlib.cm import get_cmap
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from wildwood.datasets import get_signal, make_regression
from wildwood.forest import ForestRegressor
from wildwood._binning import Binner
pd.set_option("display.max_columns", 20)
pd.set_option("... |
# -*- coding: utf-8 -*-
"""AnaFlow - analytical solutions for the groundwater-flow equation."""
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(HERE, "README.md"), encoding="utf-8") as f:
README = f.read()
with open(os.path.join(HERE... |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from .fields import TemplateField
class DocumentTemplateSandboxForm(forms.Form):
result = forms.CharField(
help_text=_('Resulting text from the evaluated template.'),... |
# Copyright 2022 Cortex Labs, 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 wri... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
# 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, ... |
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2018/6/17.
"""
from sqlalchemy import Column, Integer, String, ForeignKey
from app.models.base import Base
from app.models.image import Image
__author__ = 'Allen7D'
class Theme2Product(Base):
__tablename__ = 'theme_product'
theme_id = Column(Integer, ForeignKey(... |
from unittest import skipUnless
from django.contrib.contenttypes.models import ContentType
from django.template import Context, Template
from django.urls import reverse
from mezzanine.blog.models import BlogPost
from mezzanine.conf import settings
from mezzanine.core.models import CONTENT_STATUS_PUBLISHED
from mezzan... |
"""
AWR + SAC from demo experiment
"""
from rlkit.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from rlkit.launchers.experiments.awac.awac_rl import experiment, process_args
import rlkit.misc.hyperparameter as hyp
from rlkit.launchers.arglauncher import run_variants
from rlkit.torch.sac.policies im... |
import numpy as np
import pickle
class Kernel:
def __init__(self):
self.train_phi = None
self.K_matrix = None
self.test_phi = None
self.X_train = None
pass
def build_gram_matrix(self, X):
raise NotImplementedError("Method build_gram_matrix not implemented.")
... |
"""Main module"""
def main():
"""Main app"""
if __name__ == '__main__':
main() |
import numpy as np
import random
import xml
import cv2
import os
def read_file(file_name):
"""
读取 file_name 文件全部内容
return:文件内容list
"""
if not os.path.isfile(file_name):
return None
result = []
with open(file_name, 'r') as f:
for line in f.readlines():
# 去掉换行符和空格... |
# Copyright 2018-2021 Xanadu Quantum Technologies 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... |
import os
from typing import Any, Dict, List, Union
import onnx
import onnxoptimizer
import mlrun
from mlrun.artifacts import Artifact
from mlrun.frameworks._common import ModelHandler
class ONNXModelHandler(ModelHandler):
"""
Class for handling an ONNX model, enabling loading and saving it during runs.
... |
# pylint: disable=W0614
import sys
import json
import random
from helper import *
from itertools import combinations
import copy
def brokenJson(jsonInput: dict, key_set: list, maxPower: int):
''' similar to generateStr() except this has a higher chance of having the characters {}" '''
choices = r'abcdefghijkl... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Bravo Logistics and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestVehicleChecklist(unittest.TestCase):
pass |
# baleen.utils.logger
# Logging utility for Baleen
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Mon Sep 22 15:47:34 2014 -0400
#
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: logger.py [caaaaca] benjamin@bengfort.com $
"""
Logging utility for Baleen
"""
##... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import os
import random
random.seed(i... |
"""
Comparing refinement with adjoint-flagging vs refinement using
surface-flagging by running the full code for all three runs.
"""
import os
currentdir = os.getcwd()
adjointdir = currentdir + '/../adjoint'
forwarddir = currentdir + '/..'
#-------------------------------------------
# Compute solution for a... |
import logging
from struct import unpack
from typing import Optional, Dict
from anthemtool.cas.cas import Cas
from anthemtool.io.providers.base import Decompressor
from anthemtool.util import PathUtil
LOG = logging.getLogger(__name__)
class CasWriter:
"""
Writer for CAS file entries.
"""
DECOMPRE... |
# Copyright 2017 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... |
# -*- coding: utf-8 -*-
import tuna_service_sdk.api.test_plan.test_plan_client
class Client(object):
def __init__(self, server_ip="", server_port=0, service_name=""):
self.test_plan = tuna_service_sdk.api.test_plan.test_plan_client.TestPlanClient(server_ip, server_port, service_name) |
from .mcts import * |
#
# 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 sys
sys.path.insert(1, "../../")
import h2o
def https_import(ip,port):
url = "https://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv.zip"
aa = h2o.import_file(path=url)
aa.show()
if __name__ == "__main__":
h2o.run_test(sys.argv, https_import) |
#!/Users/ammarkhan/Desktop/seniorproject/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import locale
... |
#!/Users/het/Desktop/hacker/qqpy/bin/python3.6
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# the image into a set of tiles... |
# Generated by Django 3.1.3 on 2020-11-18 06:50
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', m... |
from lib2to3.pgen2 import driver
#import requests
#import self as self
from selenium.webdriver.chrome import options
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium import webdriver
#from selenium.webdriver.firefox.webdriver im... |
#-*-coding:utf8;-*-
#qpy:console
from random import randint
print('\n')
print('-' * 5, 'ADIVINHE O NÚMERO', '-' * 5)
print('\n')
opção = input('Quer jogar comigo: ').lower().strip()
print('\n')
if opção == 'sim':
print('Muito bom! Adivinhe o número que estou pensando entre 0 a 5')
print('\n')
n = randint(0... |
from django.db import models
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length = 200)
pub_date = models.DateTime |
# coding: utf-8
"""
speechapi
Speech APIs enable you to recognize speech and convert it to text using advanced machine learning, and also to convert text to speech. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ impor... |
"""Defi Controller Module"""
__docformat__ = "numpy"
import argparse
from typing import List
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.cryptocurrency.defi import (
graph_model,
coindix_model,
terraengineer_model,
te... |
# 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 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Enabe I2C
# sudo apt-get update
# sudo apt-get install -y git python3-smbus i2c-tools
# pip3 install smbus2
# i2cdetect -y 1 # expect 0x0d
import smbus2
from time import sleep
import math
C_REG_A = 0x09 # Address of Configuration register A
C_REG_B = 0x0a # Address o... |
# Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 Thomas Voegtlin
#
# 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 rig... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 16 12:14:37 2019
@author: carlosalcantara
"""
'''
Expand data with engineered features using the feature_engineering_function.py
Saves new csv file with specified name, overwriting input file if no save file
name is given.
Usage: engineered_featur... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""HostLog... |
# Copyright (C) 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- encoding:utf-8 -*-
SETS = {
'D': '01234456789',
'L': 'abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ',
'C': '01234456789abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ!"·#$%&/()=?¿¡ºª*+^`[]´Ç¨{}-_:.;,<>\'\\\t '
}
AUTOMATAS = (
{'name': 'comment',
'states': (
((('#',... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 18 14:03:19 2014
@author: crousse
"""
class Pipette(object):
def __init__(self):
self.resistance = 0
self.internal = ""
self.id = 0 # which pipette number
self.depth = 0.0
self.hitQuality = 0 # 0 to 5
self.sealQuality =... |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2021 New York University Abu Dhabi
#
# 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 limitatio... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geovinci.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
"""Auto-generated file, do not edit by hand. MU metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_MU = PhoneMetadata(id='MU', country_code=230, international_prefix='0(?:0|[2-7]0|33)',
general_desc=PhoneNumberDesc(national_number_pattern='[2-9]\\d{6,7}', possible_n... |
from typing import Tuple, FrozenSet
from collections import Iterable
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msat_make_not, msat_mak... |
import pytest
#from blogcookiecutter.users.models import User
#from blogcookiecutter.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory() |
# -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
# ----------------------------------------------------------------------
# Administrative Domain loader
# ----------------------------------------------------------------------
# Copyright (C) 2007-2015 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
#... |
# The purpose of this script is to collect all the station data into a single data structure.
# This will require regular expressions to find things like station changes.
#the hope is that we can simply export this single data structure to a single file is whatever format we want.
# Need to figure out how to deal ... |
from dataclasses import dataclass
from typing import List, Optional, Tuple
from ethgreen.types.blockchain_format.program import Program
from ethgreen.types.blockchain_format.sized_bytes import bytes32
from ethgreen.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class CCInfo(Streama... |
'''
system_hotkey.util
general utilites..
'''
import _thread as thread
import threading
from queue import Queue
import queue
from functools import wraps
import time
def unique_int(values):
'''
returns the first lowest integer
that is not in the sequence passed in
if a list looks like 3,6
... |
import os
import socket
import StringIO
import traceback
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import redis as redislib
import requests
from kombu import Connection
from PIL import Image
import olympia.core.logger
from olympia.amo import search
from olympia.amo.te... |
# coding=utf-8
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
from torch.utils.data import DataLoader, Dataset
from PIL import Image
from PIL import ImageDraw
from addict import Dict
import os.path as osp
import numpy as np
import argparse
import matplotlib.pyplot as plt
import... |
import skytools
def test_version():
a = skytools.natsort_key(skytools.__version__)
b = skytools.natsort_key('3.3')
assert a >= b |
#
# Tests for the jacobian methods
#
import pybamm
import numpy as np
import unittest
from scipy.sparse import eye
from tests import get_mesh_for_testing
def test_multi_var_function(arg1, arg2):
return arg1 + arg2
class TestJacobian(unittest.TestCase):
def test_variable_is_statevector(self):
a = py... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
Invoking commands in the command library
"""
import logging
import os
import yaml
import copy
import pkg_resources
from tern.utils import constants
from tern.report import errors
# base... |
# generated by datamodel-codegen:
# filename: api.json
# timestamp: 2021-01-16T01:13:01+00:00
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class SubNetworkIdentifier(BaseModel):
network: str = Field(..., example... |
import ast
from collections import defaultdict
from pathlib import Path
from typing import List, Optional
from samples_validator.base import ApiTestResult, CodeSample, HttpMethod
class TestExecutionResultMap:
"""
Data structure for storing results of test runs for each code sample
based on its HTTP resou... |
# Copyright (C) 2020 FireEye, 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: [package root]/LICENSE.txt
# Unless required by applicable law or agreed to in writing,... |
## @package checkpoint
# Module caffe2.python.checkpoint
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
from caffe2.python import core, context
from caffe2.python.net_builder import ops
from c... |
# -*- coding: utf-8 -*-
"""
@author: Taran Driver
This module holds useful functions for pC-2DMS analysis
"""
import numpy as np
import scipy.io
def circList(r):
'Returns all indices within circle of radius r'
return [[x, y] for x in range(r+1) for y in range(r+1) if x**2+y**2<=r**2]
def clearCirc(array... |
# f = open("file.txt", "r", encoding="utf-8")
# content = f.readLines()
# f.close()
# content_list = content.split(". ")
# i = 0
# for sentence in content:
# print("i", sentence)
# //f2 = open("FILE" + str(i) + ".txt", "w+", encoding="utf-8")
# / i = i + 1
# f2.write(sentence)
# f2.close()
# print(content_list)
# ... |
# File: isitphishing_connector.py
#
# Copyright (c) 2017-2021 Splunk 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 require... |
"""
Main Author: Will LeVine
Corresponding Email: levinewill@icloud.com
"""
from tensorflow import keras
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.utils.validation import check_array, check_is_fitted, check_X_y
from .base import BaseTransformer
class NeuralClassificationTransfor... |
from typing import List, Any
from .task_utilities import find_task_scheduled, \
find_task_retry_timer_created, set_processed, parse_history_event, \
find_task_completed, find_task_failed, find_task_retry_timer_fired
from ..models.RetryOptions import RetryOptions
from ..models.Task import (
Task)
from ..mod... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import requests
import cloudsight
from goodreads import client
import goodreads
import os
import sys
import re
import subprocess
from googlesearch import *
print("Welcome to the simple book-review tool")
print("--------------------------... |
import pytest
import sys
from math import isclose
from mock import patch, call
from pathlib import Path
from textwrap import dedent
from phykit.phykit import Phykit
here = Path(__file__)
@pytest.mark.integration
class TestTotalTreeLength(object):
@patch("builtins.print")
def test_total_tree_length0(self, mo... |
#!/usr/bin/python3
"""Base functionality for Cinch AI agents.
Method reference:
class AIBase
--send_data(data)
--handle_daemon_command(raw_msg)
--run()
--start()
--stop()
--bid(bid)
--chat(chat_msg)
--play(card_val)
--is_legal_bid(bid)
--is_legal_play(card)
--act()
TODO:
- have 'thinking' timeout value (hal... |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Eleccoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests some generic aspects of the RPC interface."""
import os
from test_framework.authproxy import JS... |
from queue import Queue
from threading import Thread
from time import sleep
from bripy.bllb.logging import logger, DBG
def unloadq(q, stop, limit=2000, rest=.1, check=100):
i = limit
loops = 0
results = []
while True and ((i and not stop()) or q.qsize()):
loops += 1
if loops % check ==... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugin... |
# 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 2.3.33.0
# ... |
# Copyright (c) 2015 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 ... |
"""Exemple Pile"""
class PilePleineException(Exception):
def __init__(self, message="Erreur : Pile pleine"):
Exception.__init__(self,message)
def __str__(self):
return "PilePleine(message:{0})".format(self.args)
class Pile(object):
"""Pile de type FILO"""
def __init__(self, taille=10... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/shield_generator/shared_shd_incom_rayshield_z7.iff"
... |
import json
class FileMgmt:
@classmethod
def save_json(cls, fp: str, data):
with open(fp, mode='w', encoding='utf-8') as file:
json.dump(data, file)
@classmethod
def load_json(cls, fp: str):
with open(fp, mode='r', encoding='utf-8') as file:
return json.load(fi... |
# Generated by Django 2.1 on 2018-09-08 08:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('authentication', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
# -*- coding utf-8 -*-
# filename: main.py
import web
from handle import Handle
urls = (
'/wx', 'Handle',
)
if __name__ == '__main__':
app = web.application(urls, globals())
app.run() |
# 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 agreed to in writing, s... |
import requests
from bs4 import BeautifulSoup
class Client:
def __init__(self, base_url, user, passw, cert=None, cafile=None):
self.base_url = base_url
self.session = requests.Session()
self.session.auth = (user, passw)
self.session.cert = cert
self.session.verify = cafile
def exists(self, url):
respons... |
# Copyright (c) 2016-2017 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 functiona... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 fumikazu.kiyota@gmail.com
#
from mongoengine import connect
def load(db):
u"""データベースにコネクトする
"""
connect(
db['name'],
host=db['host'],
port=db['port']
) |
# -*- coding: UTF-8 -*-
import pycodestyle
from metrics.report_keys import CODE_STYLE
def code_style(code_path, results, ignore_codes=None):
"""
Check code style.
:param code_path: Path to the source code.
:param results: Dictionary with the results.
:param ignore_codes: List of PEP8 code to ign... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.