content stringlengths 5 1.05M |
|---|
"""
This module contains the HiSockClient, used to power the client
of HiSock, but also contains a `connect` function, to pass in
things automatically. It is strongly advised to use `connect`
over `HiSockClient`, as `connect` passes in some key arguments
that `HiSockClient` does not provide
===========================... |
#!/usr/bin/env python3
# -*- encoding=utf-8 -*-
# description:
# author:jack
# create_time: 2018/9/19
from dueros.directive.Display.BaseRenderPlayerInfo import BaseRenderPlayerInfo
class RenderAudioPlayerInfo(BaseRenderPlayerInfo):
def __init__(self, content=None, controls=[]):
super(RenderAudioPlayerI... |
import os
from random import randint
import praw
from dotenv import load_dotenv
load_dotenv()
client_id = os.environ.get("CLIENT_ID")
client_secret = os.environ.get("CLIENT_SERVER")
user_agent = os.environ.get("USER_AGENT")
reddit = praw.Reddit(client_id=client_id,
client_secret=client_secret,
... |
from models.decoders.decoder import PredictionDecoder
from models.decoders.utils import bivariate_gaussian_activation
import torch
import torch.nn as nn
from typing import Dict
class MTP(PredictionDecoder):
def __init__(self, args):
"""
Prediction decoder for MTP
args to include:
... |
from pycspr.crypto import cl_checksum
from pycspr.serialisation.binary.cl_value import encode as encode_cl_value
from pycspr.serialisation.json.cl_type import encode as encode_cl_type
from pycspr.serialisation.utils import cl_value_to_cl_type
from pycspr.serialisation.utils import cl_value_to_parsed
from pycspr.types i... |
#!/usr/bin/env python
__copyright__ = """
Copyright (c) 2020 Tananaev Denis
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, cop... |
import pandas as pd
import numpy as np
def safeSubset(lst, idx):
if len(lst) >= idx:
return np.nan
else:
return lst[idx]
def getLat(lst):
rawlat = safeSubset(lst, 7)
if rawlat == np.nan:
return rawlat
if rawlat[-1] == 'N':
sign = 1
else:
sign = -1
re... |
from unittest import TestCase
from nba_data.data.season import Season
from nba_data.data.season_range import SeasonRange
class TestSeasonRange(TestCase):
def test_instantiation(self):
start_season = Season.season_2015
end_season = Season.season_2016
self.assertIsNotNone(SeasonRange(start=... |
import discord
import asyncio
import time
from nltk.corpus import wordnet
from collections import defaultdict
import re
import requests
from model import *
def generate_image(keyword):
url = 'https://image.baidu.com/search/flip?tn=baiduimage&ie=utf-8&word='+keyword+'&ct=201326592&v=flip'
result = requests.get... |
from google.appengine.ext import ndb
#
# One row per match. Each match has two players, a winner and a loser.
# The match takes place at a club, in a tourney.
#
import clubs
import tourneys
import players
class Match(ndb.Model):
"""Models a match between two players."""
matchid = ndb.IntegerProperty()
c... |
# Don't call this flask.py!
# Documentation for Flask can be found at:
# https://flask.palletsprojects.com/en/1.1.x/quickstart/
from flask import Flask, render_template, request, session, redirect, url_for, jsonify, abort
import os
app = Flask(__name__)
app.secret_key = b'REPLACE_ME_x#pi*CO0@^z'
@app.route('/')
de... |
import requests
from bs4 import BeautifulSoup
import xlsxwriter
from fake_headers import Headers
workbook = xlsxwriter.Workbook('resault_amazon.xlsx')
worksheet = workbook.add_worksheet()
search_text = input('please enter book name: ')
search_text = search_text.replace(' ', '+')
url = 'https://www.amazon.... |
import unittest
from linear_algebra.matrix import Matrix
A = Matrix(dims=(3, 3), fill=1.0)
B = Matrix(dims=(3, 3), fill=2.0)
class Testclass(unittest.TestCase):
def test_matrix_A(self):
T = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
self.assertEqual(A.A, T, "Left add (Matrix-Matrix)")
... |
import json as json_handler
from yahoo_weather.classes.errors import Error
class Location:
def __init__(self,woeid, city, country, lat, long, region, timezone_id):
self.woeid = woeid
self.city = city
self.country = country
self.lat = lat
self.long = long
self.regio... |
import ctypes
so3 = ctypes.CDLL("./so3.so")
a = 1
b = 2
c = so3.add(a, b)
print(c)
|
# -*- coding=utf-8 -*-
from SplineInterpolator import SplineInterpolator
__author__ = 'balin'
# noinspection PyPep8Naming
def generateSplineFunction(array1, array2):
interpolator = SplineInterpolator()
return interpolator.interpolate(array1, array2)
def interpolate(spline, x):
# noinspection PyBroadE... |
import asyncio
import hashlib
import logging
import magic
import os
from abc import ABC, abstractmethod
from polyswarmclient import Client
from polyswarmclient.events import SettleBounty
from polyswarmclient.exceptions import LowBalanceError, FatalError
from polyswarmclient.utils import asyncio_stop
logger = logging... |
def func2():
pass
ctrl5 = root.Controls['ConnFrame']
ctrl6 = ctrl5.Controls['layTable']
ctrl8 = ctrl6.Controls['tbxDataSource']
ctrl8.Text = 'localhost';DoEvents()
ctrl10 = ctrl6.Controls['tbxLogin']
ctrl10.Text = 'root';DoEvents()
ctrl12 = ctrl6.Controls['tbxPassword']
ctrl12.Text =... |
from django.core.management.base import BaseCommand
from app.posts.models import Post
class Command(BaseCommand):
"""Add specifique commande to manage.py
:param BaseCommand: Legacy from BaseCommand class
:type BaseCommand: BaseCommand
"""
help = "Clean all Product from the db"
def handle(se... |
from turtle import Screen
from paddle import Paddle
from ball import Ball
from scoreboard import Scoreboard
import time
pantalla = Screen()
pantalla.setup(width=800, height=600)
pantalla.bgcolor("black")
pantalla.title("Pong")
pantalla.tracer(0)
player_2 = Paddle(350)
player_1 = Paddle(-350)
ball = Ball()
scoreboard ... |
"""
Abstract Syntax Trees: https://docs.python.org/3/library/ast.html
"""
import ast as _ast
import sys
from typing import Type
from ._base import AST, immutable
if (3, 7) <= sys.version_info < (3, 8):
import asttrs._py3_7 as _asttrs
from asttrs._py3_7 import * # noqa
pass
elif (3, 8) <= sys.version_i... |
import battlecode as bc
class FactoryManager():
def __init__(self, controller):
self.controller = controller
def handle(self, unit):
pass
|
"""Export all the data from an assessment within Gophish into a single JSON file.
Usage:
gophish-export [--log-level=LEVEL] ASSESSMENT_ID SERVER API_KEY
gophish-export (-h | --help)
gophish-export --version
Options:
API_KEY Gophish API key.
ASSESSMENT_ID ID of the assessment to... |
import argparse
import shlex
from discord.ext import commands
class FlagConverter(
commands.FlagConverter, prefix="--", delimiter=" ", case_insensitive=True
):
pass
class _Arguments(argparse.ArgumentParser):
def error(self, message):
raise RuntimeError(message)
class LegacyFlagItems:
def _... |
# Copyright 2017 The Sonnet 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 l... |
# MIT License
#
# Copyright (c) 2021, Bosch Rexroth AG
#
# 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, m... |
from workers.base import contextualProcess
from services.config import get_cameras, get_stream_dir, get_capture_command
from time import sleep
from pathlib import Path
from subprocess import Popen, DEVNULL
class capturerProcess(contextualProcess):
def __init__(self, context):
super().__init__(context, 'Ca... |
from src.gamelogic.board import Board, Color
class Game:
def __init__(self, size):
self.current_color = Color.BLACK
self.history = [Board(size)]
def place_token(self, position, color):
if self.current_color != color:
return False
next_board = self.current_board.set_... |
for i in range(1, 101):
if i ** 0.5 % 1:
state = 'open'
else:
state = 'close'
print("Door {} {}".format(i, state))
|
from django.db.models import F
from django.db.models.query import QuerySet
from django.utils.translation import get_language
from .compat import Manager
class TranslatableFilterMixin(object):
def translate(self, language=None):
if language is None:
language = get_language()
return self... |
#! /usr/bin/env python
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for t... |
class Config():
SECRET_KEY = "7c9270027a164800f09e52vb828q1384523667f"
#change if not using gmail
MAIL_SERVER = "smtp.gmail.com"
MAIL_PORT = 465
MAIL_USE_SSL = True
#mail port info ends
#add email and password
MAIL_USERNAME = "[email protected]"
MAIL_PASSWORD = "pycavmail"... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted News: A NNTP-based news service.
"""
|
import shutil
from easydict import EasyDict
from ding.league import BaseLeague, ActivePlayer
class DemoLeague(BaseLeague):
# override
def _get_job_info(self, player: ActivePlayer, eval_flag: bool = False) -> dict:
assert isinstance(player, ActivePlayer), player.__class__
player_job_info = Easy... |
"""
Copyright (c) 2021, Electric Power Research Institute
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 li... |
from sqlalchemy import String
class StringTypes:
SHORT_STRING = String(16)
MEDIUM_STRING = String(64)
LONG_STRING = String(255)
LONG_LONG_STRING = String(4096)
I18N_KEY = String(255)
LOCALE_CODE = String(5)
PASSWORD_HASH = String(128)
class QueryArgumentError(Exception):
def __init_... |
'''
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.
Given an integer n, return the nth ugly number.
Example 1:
Input: n = 10
Output: 12
Explanation: [1, 2, 3, 4, 5, 6, 8, 9, 10, 12] is the sequence of the first 10 ugly numbers.
Example 2:
Input: n = 1
Output: 1
Explanation: 1... |
import numpy as np
scoreboard = np.array(range(0, 441))
team1 = {
'char1': [
1, 2, 3,
50, 49, 48,
53, 54, 55,
102, 101, 100,
105, 106, 107,
],
'char2': [
5, 6, 7,
46, 45, 44,
57, 58, 59,
98, 97, 96,
109, 110, 111
],... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.postgres.operations import HStoreExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('raster_aggregation', '0002_aggregationlayer_modified'),
]
operations = [
... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017-2020, SCANOSS Ltd. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import hashlib
def parse_diff(src):
"""
Parse a commit diff.
This function parses a diff string and generat... |
# Generated by Django 2.1.1 on 2018-11-13 02:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0004_points_round'),
]
operations = [
migrations.CreateModel(
name='Club',
f... |
# Written By - Shaswat Lenka
# DATE: 22nd October 2019
# Code Review Requested.
from scrapers.helpers import Webrequests
from bs4 import BeautifulSoup
import csv
# Get the drug name from a drug database
# Get all the discussions regarding the drug from medications.com
# Preprocess and save the same to disc
# testin... |
from fastapi import FastAPI
# custom modules
from models.algebra import array
app = FastAPI()
@app.get("/")
def read_root():
return {"msg": "Hello Universe !"}
@app.get("/array")
def get_array():
return {"result": array.get_random().tolist()}
|
"""
Script for building the example.
Usage:
python setup.py py2app
"""
from setuptools import setup
plist = dict(CFBundleName='FieldGraph')
setup(
name="FieldGraph",
app=["Main.py"],
setup_requires=["py2app"],
data_files=["English.lproj", 'CrossCursor.tiff', 'Map.png'],
options=dict(py2app=dic... |
# https://www.pygame.org/docs/ref/sprite.html
# https://www.pygame.org/docs/ref/rect.html
import pygame
import random
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
class Game_object(pygame.sprite.Sprite):
# Constructor. Pass in the color of the block,
# and its x and y position
def __init__(self, game, ima... |
"""
OAIPJsfopiasjd
"""
first_name = input("Enter your first name: ")
middle_name = input("Enter your middle name: ")
last_name = input("Enter your last name: ")
#Ahfojf
full_name = first_name + " " + middle_name + " " + last_name
print full_name
|
#!/usr/bin/env python
"""
train_SVM.py
VARPA, University of Coruna
Mondejar Guerra, Victor M.
15 Dec 2017
"""
import os
import csv
import gc
import cPickle as pickle
import time
from imblearn.over_sampling import SMOTE, ADASYN
from imblearn.combine import SMOTEENN, SMOTETomek
import collections
from sklearn impo... |
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Servus(CMakePackage):
"""Servus is a small C++ network utility library that provides a zero... |
#Se importan las librerías que se van a necesitar
import matplotlib.pyplot as plt
import time
import numpy as np
import random
#Definimos una variable global para llevar el número de iteraciones (para imprimir el resultado):
iteracion = 1
#Definimos nuestra función a integrar:
def function(x):
return 2*x
#Funci... |
"""
Main file for training multi-camera pose
"""
import sys
import time
import traceback
import itertools as it
from joblib import Parallel, delayed
import cPickle as pickle
import optparse
from copy import deepcopy
import numpy as np
import scipy.misc as sm
import scipy.ndimage as nd
import Image
import cv2
import ... |
# -*- coding: utf-8 -*-
"""
Create at 16/12/13
"""
__author__ = 'TT'
import os
import tornado.options
import tornado.ioloop
from tornado.options import options
import tornado.web
from tornado.httpserver import HTTPServer
from controllers.index import Index, Index1
from controllers.wx import WX, WXUser
class Applic... |
"""The tests for Philips Hue device triggers for V1 bridge."""
from homeassistant.components import automation, hue
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.hue.v1 import device_trigger
from homeassistant.setup import async_setup_component
from .conftes... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_datatab.ui'
#
# Created by: PyQt5 UI code generator 5.14.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_data(object):
def setupUi(self, data):
data.setObjectN... |
# Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is
# licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
# coding=utf-8
import unittest
__author__ = 'Lorenzo'
from src.stock import Stock
from datetime import datetime
class StockTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
def setUp(self):
self.stock = Stock("GOOG")
def trend_fixture(self, prices):
"""Create ... |
#!/usr/bin/env python
# coding: utf-8
# In[19]:
idade = input("Informe a sua idade: ")
print(idade, type(idade))
# In[24]:
idade = int(idade)
print(idade, type(idade))
# In[26]:
print(float('123.52'))
print(str(123.25))
print(bool(''))
print(bool('abc'))
print(bool(0))
print(bool(-2))
# In[32]:
salario =... |
# Generated by Django 3.1.1 on 2020-09-26 21:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20200926_2241'),
]
operations = [
migrations.CreateModel(
name='Donator',... |
from hypothesis import given
from hypothesis_bio import protein
from .minimal import minimal
@given(protein())
def test_protein_type(seq):
assert type(seq) == str
def test_smallest_example():
assert minimal(protein()) == ""
def test_smallest_example_3_letter_abbrv():
assert minimal(protein(single_le... |
import torch
import torch.distributed as dist
from oslo.torch.distributed._seed.helper import moe_set_seed
def _check_sanity(parallel_context):
if (
parallel_context.tensor_parallel_size > 1
or parallel_context.pipeline_parallel_size > 1
or parallel_context.sequence_parallel_size > 1
... |
from datetime import datetime
import hashlib
def construct_url(base: str, endpoint: str) -> str:
"""Construct a URL from a base URL and an API endpoint.
Args:
base: The root address, e.g. http://api.backblaze.com/b2api/v1.
endpoint: The path of the endpoint, e.g. /list_buckets.
Returns:
A URL base... |
from pylab import *
from scipy.signal import *
from velocity import *
# Plotting, velocity curves and derivatives
def plotcurves(curves, titles, vel_yrange=None, dif_yrange=None):
for n, v in enumerate(curves):
acc = v-vel
subplot(len(curves),2,n*2+1)
plot(time, v)
if (vel_yrange!=... |
import asyncio
import contextlib
import pytest
from qurpc import *
class Error(QuLabRPCError):
pass
class MySrv:
def __init__(self, sid=''):
self.sid = sid
class Test:
def hello(self):
return "hello, world"
self.sub = Test()
def add(self, a, b):
... |
f = float(input('Podaj liczbe zmiennoprzecinkowa: '))
d = int('%1d' % f)
x = d % 10
z = float('%.1f' % f) - d
y = int(z * 10)
print('Cyfra przed przecinkiem: ', x)
print('Cyfra po przecinku: ', y) |
# Copyright 2020 The Kraken 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 applicable law or agreed to in wr... |
# A function that returns the 'year' value:
def myFunc(e):
return e['year']
# Used lambda as function for sort year wise
myF = lambda e : e['year']
cars = [
{'car': 'Ford', 'year': 2005},
{'car': 'Mitsubishi', 'year': 2000},
{'car': 'BMW', 'year': 2019},
{'car': 'VW', 'year': 2011}
]
cars.sort(key=myF)
pr... |
from .metacrypt import MetaCrypt |
"""Implementation of SMS"""
|
def run_this_command(cmd):
import subprocess
res = subprocess.run(cmd.split(' '), stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
return res.stdout.decode('ascii').strip(), res.returncode == 0
build_hash = "N/A"
build_tag = "untagged build"
build_branch = "unknown branch"
_, this_is_a_git_repo = run_t... |
'''
MEDIUM 74. Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous row.
Example 1:
Input: matrix = ... |
"""
A discogs_client based search query utility with filtering support.
"""
import configparser
import discogs_client
class Conf(configparser.ConfigParser):
"""A class to read and store configuration items."""
def __init__(self, filename):
super(Conf, self).__init__()
self.filename = filenam... |
from typing import Any, Dict
from weakref import ref
from flask import Blueprint
from kombu import Connection
from rethinkdb.ast import Table
from pysite.constants import (
BOT_EVENT_QUEUE, BotEventTypes,
RMQ_HOST, RMQ_PASSWORD, RMQ_PORT, RMQ_USERNAME
)
from pysite.database import RethinkDB
from pysite.oauth ... |
import random
from manga_py.crypt import ManhuaGuiComCrypt
from manga_py.provider import Provider
from .helpers.std import Std
class ManhuaGuiCom(Provider, Std):
servers = [
'i.hamreus.com:8080',
'us.hamreus.com:8080',
'dx.hamreus.com:8080',
'eu.hamreus.com:8080',
'lt.hamr... |
"""
prepacked queries
"""
import warnings
warnings.warn("prepacked_queries are deprecated", DeprecationWarning, stacklevel=2)
DEPRECATION_MESSAGE = (
"The prepacked_queries modules will be removed. A replacement is under consideration but not guaranteed."
)
|
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from optparse import make_option
import sys
class GenericCommand(BaseCommand):
''' paloma postfix management
'''
args = ''
help = ''
model = None
option_list = BaseCommand.option_list + (
make_option(
... |
from .manager import AppManager
from .deploy import deploy
from .test import test
from .show import show
from .build import build
import click
@click.group()
@click.pass_context
def kctl(ctx):
"""
kctl controls the \033[1;3;4;34mKoursaros\033[0m platform.
Find more information at: https://github.com/kour... |
import unittest
import tempfile
from xl_helper.FileUtils import FileUtils
from tests.util.TestingUtils import TestingUtils
class TestWithTempDirs(unittest.TestCase):
default_temp = tempfile.mkdtemp()
created_dirs = [default_temp]
test_config = TestingUtils.get_test_config()
@classmethod
def t... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-20 13:26
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
... |
from __future__ import print_function
import numpy as np
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
from matplotlib import cm
import pyplasma as plasma
import pyplasmaDev as pdev
import initialize as init
import injector
from visualize_amr import plot2DSlice
def filler(xloc, ulo... |
from distutils.version import LooseVersion
from typing import Tuple, Union
import torch
from torch_complex.tensor import ComplexTensor
from espnet2.diar.layers.tcn_nomask import TemporalConvNet
from espnet2.enh.layers.complex_utils import is_complex
from espnet2.enh.separator.abs_separator import AbsSeparator
is_tor... |
import sys
def usage():
print 'Usage: jython jython_checker.py <module name created by make_checker>'
sys.exit(1)
if not len(sys.argv) == 2:
usage()
checker_name = sys.argv[1].split('.')[0]#pop off the .py if needed
try:
checker = __import__(checker_name)
except:
print 'No module "%s" found' % chec... |
#
# PySNMP MIB module ZHONE-MAU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-MAU-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:41:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
#!/usr/bin/env python
# Copyright 2011 Jonathan Kinred
#
# 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... |
class MaxStack:
def __init__(self):
"""
initialize your data structure here.
"""
self.stack = []
self.maxs = []
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.stack.append(x)
if not self.maxs or x > sel... |
from distutils.core import setup
from setuptools import find_packages
import re
# http://bugs.python.org/issue15881
try:
import multiprocessing
except ImportError:
pass
def parse_requirements(file_name):
requirements = []
for line in open(file_name, 'r').read().split('\n'):
if re.match(r'(\s*... |
from .settings import *
DEBUG = TEMPLATE_DEBUG = False
ALLOWED_HOSTS = [
'.treehouse-app.com',
] |
# Copyright 2014 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.
from core import perf_benchmark
from benchmarks import silk_flags
import ct_benchmarks_util
from measurements import smoothness
import page_sets
from page_... |
# %% [markdown]
'''
# The hidden secrets of the bitcoin price
'''
# %% [markdown]
'''
Bitcoin is a digital currency created in 2009 by Satoshi Nakamoto, he describes it as a "peer-to-peer version of electronic cash" <cite> nakamoto2019bitcoin </cite>.
One big advantage of bitcoin (and other cryptocurrencies) is that al... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import numpy as np
from ...testing import utils
from .. import nilearn as iface
from ...pipeline import engine as pe
import pytest
import numpy.testing as npt
no_nilearn = True
try:
__imp... |
import argparse
import copy
import random
from generator import makeBasicProject, addSpriteSheet, makeBackground, makeScene, makeActor, addSymmetricSceneConnections, makeMusic, reverse_direction, initializeGenerator, writeProjectToDisk
def SachitasGame():
"""
Create an empty world as an example to build future projec... |
passw = "123"
uid = "xiaoming"
if passw=="123" and uid=="xiaoming" :
print("login success")
|
#!/usr/bin/python3
"""Saved contour plots for the ETGM paper"""
# Standard Packages
import sys; sys.path.insert(0, '../'); sys.path.insert(0, '../../')
import logging
# 3rd Party Packages
import matplotlib.pyplot as plt
# Local Packages
import modules.options # Import here even though it's unused to avoid issues
f... |
# pylint: disable=W0603
'''Logging share library.'''
import logging
from logging.handlers import TimedRotatingFileHandler
from enum import Enum
SLOG_LOGGER = None
SLOG_AMOUNT_OF_KEEPED_LOG_FILE = 7
SLOG_DEFAULT_FILE = 'log/system.log'
class SLogLevel(Enum):
'''Define logging level Enumerations.'''
DEBUG = 1... |
import pandas as pd
from sqlalchemy import MetaData, Table, Column
import config
def load_query(query):
"""
loads data from db, based on the given sql query
:param query: sql query in string
:return: dataframe
"""
df = pd.read_sql_query(query, con=config.db_connection)
return df
def... |
class Config():
'''
This is the setting file. You can change some parameters here.
'''
'''
--------------------
主机的地址和端口号
Host and port of your server
'''
HOST = '0.0.0.0'
PORT = '6116'
'''
--------------------
'''
'''
--------------------
游戏API地址前缀
... |
"""
:module:
:synopsis:
:author: Julian Sobott
"""
import os
import unittest
from OpenDrive.server_side import database, paths as server_paths
from tests.server_side.database.helper_database import h_setup_server_database
class TestDatabaseConnections(unittest.TestCase):
def setUp(self) -> None:
h_setu... |
__author__ = 'kocsen'
import logging
import time
import json
import mysql.connector
from mysql.connector import errorcode
from mysql.connector.errors import IntegrityError
"""
Used to write app feature data to a DB.
NOTE: This script is VERY specifically tied to the way data is modeled
in the existing Database App... |
nome = input('Escreva uma frase:').strip().lower()
print('Quantas vezes aparece a letra "A"? {} vez(es)!'.format(nome.count('a')))
print('Em que posição a letra "A" aparece a primeira vez? Na {} posição!'.format(nome.find('a')))
print('Em que posição a letra "A" aparece por ultimo? Na {} posição!'.format(nome.find('a',... |
from datetime import datetime, timedelta
import calendar
from dateutil.relativedelta import relativedelta
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from timezone_field import TimeZoneField
import fleming
import pytz
from .fields import DurationField
INTERVAL_CHOICES ... |
#!/usr/bin/env python3
# Copyright (c) 2020 Bitcoin Association
# Distributed under the Open BSV software license, see the accompanying file LICENSE.
from test_framework.blocktools import create_block, create_coinbase, create_transaction
from test_framework.test_framework import BitcoinTestFramework, ChainManager
fro... |
from .pram2mesa import pram2mesa
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.