text stringlengths 1 927k |
|---|
# Generated by Django 3.0.2 on 2020-05-28 15:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('profiles', '0005_auto_20200526_2009'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='created_at',
... |
# Generated by Django 2.0.9 on 2018-11-24 16:49
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Employee',
fie... |
# Copyright 2015 WebAssembly Community Group participants
#
# 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 ... |
import _plotly_utils.basevalidators
class ShowexponentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showexponent", parent_name="layout.ternary.baxis", **kwargs
):
super(ShowexponentValidator, self).__init__(
plotly_name=plotly_name,
... |
#!/usr/bin/env python3
# Copyright (c) 2017 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test digibyte-cli"""
from test_framework.test_framework import DigiByteTestFramework
from test_framework.ut... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... |
# Example of LOOCV and LPOCV splitting
import numpy
from sklearn.model_selection import LeaveOneOut, LeavePOut
# Configurable constants
P_VAL = 2
def print_result(split_data):
"""
Prints the result of either a LPOCV or LOOCV operation
Args:
split_data: The resulting (train, test) split data
... |
###############################################################################
#
# file: rssfeed.py
#
# Purpose: refer to module documentation for details
#
# Note: This file is part of Termsaver application, and should not be used
# or executed separately.
#
########################################... |
"""
Autogenerate Python interface to cuSOLVER functions.
"""
from __future__ import absolute_import, print_function
import re
from os.path import join as pjoin
import numpy as np # don't remove! is used during call to exec() below
import cuda_cffi
from cuda_cffi._cffi_autogen_common import wrap_library
from cuda_... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
import time
headers = {
'host': "dataservice.tianyancha.com",
'connection': "keep-alive",
'upgrade-insecure-requests': "1",
'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Saf... |
# http://www.gwicks.net/dictionaries.htm
import csv
with open('words.txt', 'r') as f:
dat = f.read().splitlines()
with open('words5.csv', 'w') as f:
writer = csv.writer(f)
writer.writerows([[f'"{x}"' for x in dat if len(x) == 5]]) |
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField, SubmitField
from wtforms.validators import Required, Email, ValidationError
from flask_wtf.file import FileField,FileAllowed
from flask_login import current_user
from ..models import User
class CreateBlog(FlaskForm):
title = StringField... |
from unittest import SkipTest
from collections import OrderedDict
import numpy as np
from bokeh.core.properties import value
from holoviews.core import Dimension, DynamicMap, NdOverlay, HoloMap
from holoviews.element import Curve, Image, Scatter, Labels
from holoviews.streams import Stream, PointDraw
from holoviews.p... |
import numpy as np
from copy import deepcopy
from skimage.transform import resize
from scipy.ndimage import binary_fill_holes
from skimage.measure import regionprops
from diagnosis.src.Utils.configuration_parser import *
def crop_MR(volume, parameters):
original_volume = np.copy(volume)
volume[volume >= 0.2] ... |
import pyeccodes.accessors as _
def load(h):
h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
h.add(_.Codetable_un... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... |
# 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 app... |
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('app.urls'))
] |
import discord, asyncio
import json
import wikipedia
import glob
from os import listdir
from os.path import join,isfile
from .riotinterface import RiotInterface
from .jeevesuserinterface import JeevesUserInterface
from .db import DB
from discord.ext import ... |
import peewee
class StockInfo(peewee.Model):
id = peewee.CharField(primary_key=True, max_length=64)
name = peewee.CharField(max_length=64)
class meta:
table_name = "stock_information"
class StockMarket(peewee.Model):
date = peewee.DateField(index=True)
category = peewee.IntegerField()
... |
from setuptools import setup
broker_name = 'privatmarket'
pkg_name = 'robot_tests.broker.{}'.format(broker_name)
setup(name=pkg_name,
version='0.0.dev1',
description='{} broker for ProzorroUKR Robot tests'.format(broker_name),
author='',
author_email='',
url='https://github.com/ProzorroU... |
import os
import requests
import pickle
import logging
import urlparse
import json
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
class Widget:
def __init__(self, widget_name):
self.widget_name = widget_name
pass
def log(self, message):
logging.basicConfig(filename='/{}/{}'.f... |
fin = "/Users/steve/Downloads/log+death-rate.csv"
from tabl import Tabl as tbl
from tabl import *
from infixpy import *
def lmap(fn,x): return list(map(fn,x))
def tp(msg,o=None):
import datetime
omsg = ": %s" %repr(o) if o is not None else ""
dtf = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print... |
"""
.. module:: plugins_mgr
:platform: linux
:synopsis: A module to manage the plugins.
.. moduleauthor:: Paul Fanelli <paul.fanelli@gmail.com>
.. modulecreated:: 6/27/15
"""
import importlib
import inspect
import sys
from zope.interface import implements
from planet_alignment.mgr.interface import IPluginsMana... |
#!/usr/bin/python
# (C) 2015 Muthiah Annamalai, <ezhillang@gmail.com>
# Ezhil Language Foundation
#
from __future__ import print_function
import codecs
import json
import sys
import tamil
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
class WordList:
@staticmethod
def extract_words(filename):
... |
# -*- coding: utf-8 -*-
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
# Imported to avoid needing to duplicate redis-related code.
from zerver.lib.red... |
"""Handle auto setup of IHC products from the ihc project file."""
import logging
import os.path
from defusedxml import ElementTree
import voluptuous as vol
from homeassistant.config import load_yaml_config_file
from homeassistant.const import CONF_TYPE, CONF_UNIT_OF_MEASUREMENT, TEMP_CELSIUS
from homeassistant.core ... |
# Copyright 2020 InterDigital Communications, 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 ... |
# Copyright (c) 2013 AndroWiiid <androwiiid@gmail.com>
# Copyright (c) 2014-2016, 2018-2019 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015-2016 Ceridwen <ceridwenv@gmail.com>
# Copyright (c) 2018 Anthony Sottile <asottile@umich.edu>
# Copyright (c) 2018 Bryce Guinta <bryce.p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `mcc` package."""
import unittest
from click.testing import CliRunner
from mcc import mcc
from mcc import split
class TestMcc(unittest.TestCase):
"""Tests for `mcc` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def... |
def _getUrlWithJWT(url, token):
import requests
headers = {
'Authorization': 'JWT {}'.format(token),
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
def fetchResourceInJupyter(varname, url):
from IPython.display import HTML, Javascr... |
import requests
import tempfile
from multiprocessing.pool import ThreadPool
from typing import NoReturn, List, Optional
from urllib.parse import urlparse
def download_image(url: str, timeout_ms: int) -> Optional[bytes]:
try:
response = requests.get(url, timeout=(timeout_ms * 0.001, timeout_ms * 0.001))
... |
# 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 ... |
from django import template
from base.forms import MaterialsDonationForm
from django.template.context_processors import csrf
register = template.Library()
@register.inclusion_tag('base/donate.html')
def money_donation_instructions():
return {}
@register.inclusion_tag('base/material_donation.html', takes_context=... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
# ====================================================
# main
# ====================================================
import os
import shutil
import numpy as np
import pandas as pd
from sklearn.model_selection import GroupKFold
from utils import get_score, seed_torch
from train import train_loop, set_params
from logge... |
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.LabellingTask)
admin.site.register(models.Labels) |
""" App database access information """
class sa_db_access:
def username(self):
""" Get database username """
sa_usr = "__db_user_name__"
return sa_usr
def password(self):
""" Get database password """
sa_pwd = "__mysql_user_password__"
return sa_pwd
def db... |
from PIL import Image
import numpy as np
correct_path = False
CELL_X_OFFSET = 10
CELL_Y_OFFSET = 10
GREY_GRADATION = 50
while not correct_path:
img_path = input("Enter path to image for filtering: ")
try:
img = Image.open(img_path)
correct_path = True
except:
print("Incorrect path/f... |
from typing import Dict, List, Optional
from pydantic import BaseModel
class SetuData(BaseModel):
title: str
urls: Dict[str, str]
author: str
tags: List[str]
pid: int
p: int
r18: bool
class SetuApiData(BaseModel):
error: Optional[str]
data: List[SetuData]
class Setu:
def _... |
import matplotlib.pyplot as plt
from matplotlib.offsetbox import AnnotationBbox
from flexitext.parser import make_texts
from flexitext.textgrid import make_text_grid
class FlexiText:
"""Handle storing and drawing of formatted text.
Parameters
----------
texts: tuple or list of flexitext.Text insta... |
from rekall import Interval, IntervalSet, IntervalSetMapping, Bounds3D
from rekall.predicates import *
from rekall.stdlib import ingest
from rekall.stdlib.merge_ops import *
from vgrid import VGridSpec, VideoMetadata, VideoBlockFormat, FlatFormat
from vgrid import SpatialType_Bbox, SpatialType_Caption, Metadata_Generic... |
import logging
import coloredlogs
from Coach import Coach
from othello.OthelloGame import OthelloGame as Game
from othello.pytorch.NNet import NNetWrapper as nn
from utils import *
# import gym
# import gym_trading
# env = gym.make('btc-dev-mcts-v1',
# state_window=48+16, # TODO check 48+4 might no... |
# This file was generated by 'versioneer.py' (0.18) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
version_json = '''
{
"date": "2021-04-20T14:18:02-0400",
"dirty": false,
"error"... |
# TestSwiftDedupMacros.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2018 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTO... |
# Diagrama Momento x curvatura para seções transversais de concreto armado
#
# ENTRADA DE DADOS
# Chamar biblioteca matemática
import numpy as np
#
def tensao(esl):
# Calcula a tensão no aço
# es = módulo de elasticidade do aço em kN/cm2
# esl = deformação de entrada
# fyd = tensão de escoamento de cálc... |
import argparse
from lib.tournament import Tournament, print_pairings, write_scorecard_csv
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Start a new tournament.')
parser.add_argument('name', type=str, help='tournament name')
parser.add_argument('players', type=str, nargs='+', he... |
# Copyright 2015, 2016 OpenMarket 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 applicable law or agreed to in ... |
import sys
import io
input_txt="""
5
1 1 2 2 3
2
1 2
"""
sys.stdin = io.StringIO(input_txt)
tmp = input()
# copy the below part and paste to the submission form.
# ---------function------------
def main():
_ = input()
array_A = input().split()
_ = input()
array_B = input().split()
array_inters... |
import os
import shutil
import string
import sys
import tempfile
from functools import partial as p
from pathlib import Path
import pytest
import yaml
from tests.helpers.agent import ensure_fake_backend
from tests.helpers.assertions import has_datapoint_with_dim, has_datapoint_with_metric_name
from tests.helpers.form... |
import numpy as np
a = np.arange(10, 35).reshape(5, 5)
print(a)
# [[10 11 12 13 14]
# [15 16 17 18 19]
# [20 21 22 23 24]
# [25 26 27 28 29]
# [30 31 32 33 34]]
col_swap = a[:, [3, 2, 4, 0, 1]]
print(col_swap)
# [[13 12 14 10 11]
# [18 17 19 15 16]
# [23 22 24 20 21]
# [28 27 29 25 26]
# [33 32 34 30 31]]
co... |
# program that prompts the user to enter the number of people attending a party and prints the estimated cost
try:
number_of_people = int(input("Enter the number of people: \n"))
if number_of_people <= 50:
print("The wedding will cost $ 4,000")
elif number_of_people <= 100:
print("The weddi... |
import htmls
import mock
from django import test
from django.http import QueryDict
from cradmin_legacy.viewhelpers import listbuilder
from cradmin_legacy.viewhelpers.multiselect2 import manytomanyview
class TestViewMixin(test.TestCase):
def test_get_selected_values_list(self):
view = manytomanyview.View... |
#%%
from nose.tools import assert_equal
#%% [markdown]
'''
- Median of Two Sorted Arrays
- https://leetcode.com/problems/median-of-two-sorted-arrays/
- Hard
'''
'''
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity sho... |
#!/usr/bin/env python2
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter as ADHF
from sys import stdout, stderr, exit
from itertools import chain
from os.path import basename
from random import sample
import logging
from nearest_neighbor_go_scores import readAssociations, readGO, readGenes, \
... |
from django.contrib.auth.models import User
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.audit.models import AuditLog
class TestSignals(TestCase):
def setUp(self):
self.user = get(
User,
username='test',
)
self.user.set_... |
#!/usr/bin/env python
connector_status = {
'ascend_ex': 'yellow',
'balancer': 'green',
'beaxy': 'green',
'binance': 'green',
'binance_perpetual': 'yellow',
'binance_perpetual_testnet': 'yellow',
'binance_us': 'yellow',
'bitfinex': 'yellow',
'bittrex': 'yellow',
'blocktane': 'gre... |
"""
WSGI config for application project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... |
# Copyright 2019 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... |
# Code generated by protoc-gen-twirp_python v5.7.0, DO NOT EDIT.
# source: AsyncTypes.proto
try:
import httplib
from urllib2 import Request, HTTPError, urlopen
except ImportError:
import http.client as httplib
from urllib.request import Request, urlopen
from urllib.error import HTTPError
import jso... |
#!/usr/bin/python3
import re
import sys
__version__ = '0.6.1'
utf_8 = 'utf_8'
class tlStr:
''' string templating class '''
__vars = {}
_sep = '\$'
flags = dict(
showUnknowns = False,
entityEncode = True
)
def __init__(self, s = '', **kwargs):
self.__s = s
self... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def render_the_map():
return render_template('mural_map.html')
if __name__ == '__main__':
app.run(debug=True) |
import os
import os.path as osp
from PIL import Image
__all__ = [ "ImageDataset" ]
class ImageDataset:
def __init__(self, root, transform):
self.root = root
self.transform = transform
self.files = [ osp.join(root, f) for f in os.listdir(root) ]
def __len__(self):
return len(s... |
# Copyright 2013-2020 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.compiler import Compiler, UnsupportedCompilerFlag
from spack.version import ver
class Pgi(Compiler):
# Su... |
from DataStructures.LinkedList.DoublyLinkedList import *
dll = DoublyLinkedList([i for i in range(1,7)])
print(dll)
dll.add(7)
dll.add(9,1)
print(dll)
dll.remove(9)
a = dll.getNode(6)
print(a.data)
print(dll.len())
print(dll) |
from unittest_utils import RDLSourceTestCase
import systemrdl.rdltypes as rdlt
class TestStructs(RDLSourceTestCase):
def test_structs(self):
root = self.compile(
["rdl_src/structs.rdl"],
"struct_test"
)
with self.subTest("6.3.2.2.1"):
amap = root.find_b... |
from .heroku import *
# Debug Toolbar needs these
INSTALLED_APPS += ['debug_toolbar',]
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
INTERNAL_IPS = ('127.0.0.1',)
DEBUG = True
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_SECURE = False |
import os
import sys
import winreg
import threading
import locale
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
import globals
from languages import *
version = 2.79
versionName = "2.8.0-beta"
def _(s): #Translate function
global lang
try:
t = lang.lang[s]... |
__author__ = 'Winston' |
# Generated by Django 3.0.2 on 2020-12-17 23:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('puzzles', '0014_auto_20201126_0504'),
]
operations = [
migrations.AddField(
model_name='channelparticipation',
name=... |
from utils import CanadianScraper, CanadianPerson as Person
COUNCIL_PAGE = 'http://www.abbotsford.ca/city_hall/mayor_and_council/city_council.htm'
CONTACT_PAGE = 'http://www.abbotsford.ca/contact_us.htm'
class AbbotsfordPersonScraper(CanadianScraper):
def scrape(self):
councillor_seat_number = 1
... |
# -*- test-case-name: vumi.transports.opera.tests.test_opera -*-
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from urlparse import parse_qs
from twisted.python import log
from twisted.web import xmlrpc, http
from twisted.web.resource import Resource
from twisted.internet.defer import inlineCallbac... |
import os
import torch
from skimage import io
from skimage.color import gray2rgb
from torch.utils.data import Dataset
from torchvision.transforms import Compose, Resize, RandomHorizontalFlip, \
RandomVerticalFlip, RandomAffine, Normalize, ToTensor, ToPILImage, Grayscale
train_transform = Compose([
ToPILImage(... |
"""The definition of the base geometrical entity with attributes common to
all derived geometrical entities.
Contains
========
GeometryEntity
GeometricSet
Notes
=====
A GeometryEntity is any object that has special geometric properties.
A GeometrySet is a superclass of any GeometryEntity that can also
be viewed as ... |
from tkinter import*
root = Tk()
root.title("Caculator")
root.minsize(width=364, height=523)
root.maxsize(width=364, height=523)
def Calc(source, side):
storeObj = Frame (source, borderwidth=4, bd=4, bg="blue")
storeObj.pack(side=side, expand=YES, fill=BOTH)
return storeObj
def button(source, side, text,... |
import re
from math import log10
class Vulcanizer():
def __init__(self, log_fold_re_list, p_value_re_list):
self.log_fold_re_list = log_fold_re_list
self.p_value_re_list = p_value_re_list
def vulcanize(self, dataframe):
"""
Given a dataframe,
identify the columns for ... |
# Generated by Django 2.2.14 on 2020-08-04 13:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0009_auto_20200804_1149'),
]
operations = [
migrations.AlterField(
model_name='crop',
name='quantity',
... |
#!/usr/bin/env python3
import sys; assert sys.version_info[0] >= 3, "Python 3 required."
from sapling_generators import (
find_group_hash,
NOTE_POSITION_BASE,
WINDOWED_PEDERSEN_RANDOMNESS_BASE,
)
from sapling_jubjub import Fr, Point
from sapling_utils import cldiv, i2leosp
#
# Pedersen hashes
#
def I_D_... |
# -----------------------------------------------------------
# Code adapted from: https://github.com/akanazawa/cmr/blob/master/utils/geometry.py
#
# MIT License
#
# Copyright (c) 2018 akanazawa
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... |
from fTestDependencies import fTestDependencies;
fTestDependencies();
try:
import mDebugOutput;
except:
mDebugOutput = None;
try:
try:
from oConsole import oConsole;
except:
import sys, threading;
oConsoleLock = threading.Lock();
class oConsole(object):
@staticmethod
def fOutput(*tx... |
from pip.locations import build_prefix, src_prefix
from pip.util import display_path, backup_dir
from pip.log import logger
from pip.exceptions import InstallationError
from pip.commands.install import InstallCommand
class BundleCommand(InstallCommand):
name = 'bundle'
usage = '%prog [OPTIONS] BUNDLE_NAME.pyb... |
#!/usr/bin/python3
# file: src/transform/do_transform.py
# andrew jarcho
# 2017-03-16
"""
Read lines from stdin, transform to a db-friendly format, and write to stdout.
The output will be usable by the database with a minimum of further
processing, and will hold all relevant data from the input.
"""
import sys
im... |
import MySQLdb
import json
import random
import string
import os
os.system('php /var/www/worldofhackers.eu/python/npc_generator.php')
os.system('php /var/www/worldofhackers.eu/python/software_generator.php')
os.system('php /var/www/worldofhackers.eu/python/software_generator_riddle.php')
os.system('python /var/www/wo... |
"""
Caller class interacts with the SDI OS API directly, returning responses to the requester.
"""
from typing import Any, Dict, Optional
from apii.api_calls import CALLS, Method
from authorizer.authorizer import Authorizer
class Caller:
def __init__(self, authorizer: Authorizer) -> None:
"""
Us... |
from flask import render_template,url_for,flash,redirect,request
from . import auth
from flask_login import login_user,login_required,logout_user
from .forms import RegForm,LoginForm
from ..models import User
from .. import db
from ..email import mail_message
@auth.route('/login', methods = ['GET','POST'])
def login()... |
import rosbag
import numpy as np
import matplotlib.pyplot as plt
import os
import matplotlib.patches as patches
bag = rosbag.Bag(os.path.expanduser("/d/Documents/classes/me131/_2020-02-10-20-44-36.bag"))
topics = bag.get_type_and_topic_info()[1].keys()
types = []
for i in range(0,len(bag.get_type_and_topic_info()[1]... |
from tkinter import *
def create_button(screen, text, action):
return Button(screen, text=text, command=action)
def create_label(screen, text):
return Label(screen, text=text, font=("arial", 16, "bold", "italic"), bg='red', width=15)
def create_listbox(screen, items):
list = Listbox(screen, bg='blue')
for ite... |
"""
Problem 3_5:
Write a function that will look up a phone number given a name. Use this
dictionary of phone numbers in your program, so that the grader will know
what phone numbers are available. In it's simplest form, the program will
crash if a name that isn't in its dictionary is asked for.
Here is a ... |
# https://www.hackerrank.com/challenges/richie-rich/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'highestValuePalindrome' function below.
#
# The function is expected to return a STRING.
# The function accepts following parameters:
# 1. STRING s
# 2. INTEGER n
# ... |
import socket
LOCALHOST = 'localhost'
Socket = None
Connection = None
def send(data):
Connection.sendall(('%s\n' % data).encode())
def send_list(data):
send(','.join(list(map(str, data))))
def get():
data = ''
while (byte := Connection.recv(1)) != b'\n':
data += byte.decode()
return data
def get_lis... |
#ABC020d
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6) |
import random
from hathor.crypto.util import decode_address
from tests import unittest
from tests.utils import add_blocks_unlock_reward, add_new_blocks, add_new_tx, start_remote_storage
class HathorSyncMethodsTestCase(unittest.TestCase):
def setUp(self):
super().setUp()
self.network = 'testnet'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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-... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
""" Fast and failsafe GL console """
import numpy ... |
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
exten... |
from sklearn.externals import joblib
import signals, suggestions
clf = joblib.load('model1.pkl')
# classes = joblib.load('classes.pkl')
sample_test = signals.Sample.load_from_file("./test_z.txt")
print sample_test
lin = sample_test.get_linearized(reshape=True)
#Predict the number with the machine learning model
num... |
from network import PNet,ONet
import torch,cv2,itertools
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import time
from matlab_cp2tform import get_similarity_transform_for_cv2
import math
def alignment(src_img,src_pts, crop_size = (112, 112)):
ref_pts = np.array([ [30.2946,... |
"""Unit test for String representations."""
from unittest.mock import patch
import pytest
from xknx import XKNX
from xknx.devices import (
BinarySensor,
Climate,
ClimateMode,
Cover,
DateTime,
ExposeSensor,
Fan,
Light,
Notification,
Scene,
Sensor,
Switch,
Weather,
)
f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 07:24:10 2020
@author: virati
CTRL example from JAX/examples
"""
# Copyright 2019 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 ... |
"""
Default model implementations. Custom database or OAuth backends need to
implement these models with fields and and methods to be compatible with the
views in :attr:`provider.views`.
"""
from django.db import models
from django.conf import settings
from provider import constants
from provider.constants import CLIE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.