content stringlengths 5 1.05M |
|---|
# Generated by Django 3.0.5 on 2020-04-30 08:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('login', '0003_login_new'),
]
operations = [
migrations.RemoveField(
model_name='login_new',
name='image_url',
),
... |
# -*- coding: utf-8 -*-
from .base import App
# ...
__all__ = [
'App'
] |
class A73:
pass
|
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import pyroapi
import pytest
import torch
from pyro.infer.autoguide import AutoNormal
from tests.common import assert_equal
# put all funsor-related imports here, so test collection works without funsor
try:... |
#Cristina Borges 08-Mar-18
arquivo = open("Data\iris.csv","r")
for linha in arquivo:
coluna = linha.split(",")
print(coluna[0], " ", " ", coluna[1], " ", coluna[2]," ", coluna[3])
arquivo.close |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Plot influence of V_s30 predicted by CY14 model."""
import matplotlib.pyplot as plt
import pygmm
fig, ax = plt.subplots()
for v_s30 in [300, 600, 900]:
s = pygmm.model.Scenario(
mag=7, dist_jb=20, dist_x=20, dist_rup=25, dip=90, v_s30=v_s30)
m = pygmm... |
import os
ON_DEV = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
engineauth = {
# Login uri. The user will be returned here if an error occures.
'login_uri': '/', # default 'login/'
# The user is sent here after successfull authentication.
'success_uri': '/',
'secret_key': 'CHANGE_TO_A_SE... |
import setuptools
from version import VERSION
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="tkhtmlview",
version=VERSION,
author="Palash Bauri",
author_email="[email protected]",
description="View Simple HTML docs on tkinter",
long_description=lon... |
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
elif age < 65:
price = 40
elif age >= 65:
price = 20
print(f"Your admission cost is ${price}.") |
import paho.mqtt.client as mqtt
import time
import json
def main():
def on_connect(client, userdata, flags, rc):
print("CONNECTED!")
client = mqtt.Client()
client.on_connect = on_connect
client.connect("46.101.168.60", 1883, 60)
client.loop_start()
f = open("testDrive.csv")... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 BigML
#
# 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 ... |
"""reverse track coords
Revision ID: 6cca33764ed5
Revises: c206a3641567
Create Date: 2016-02-04 22:58:51.312968
"""
# revision identifiers, used by Alembic.
revision = "6cca33764ed5"
down_revision = "c206a3641567"
import re
from alembic import op
import sqlalchemy as sa
_linestring_rx = re.compile("^LINESTRING\(... |
"""Function to find all matching nodes in a linked list."""
from .linked_list import LinkedList
from .node import Node
from .k_tree import KTree
def find_matches(ktree, target_value):
"""
Perform search for all nodes.
if node's value matches with target_value, the node is
added to ist.
"""
... |
## FuzzingTool
#
# Authors:
# Vitor Oriel C N Borges <https://github.com/VitorOriel>
# License: MIT (LICENSE.md)
# Copyright (c) 2021 Vitor Oriel
# 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 ... |
# -*- coding: utf-8 -*-
"""Models for the SLiM Flask application."""
from __future__ import absolute_import
import datetime
from flask_sqlalchemy import SQLAlchemy
from flask_security import UserMixin, RoleMixin
db = SQLAlchemy()
# Security
roles_users = db.Table(
'roles_users',
db.Column('user_id', db.... |
from pytube import YouTube
# digite o link do video e o local que deseja salvar o video
link = input("digite o link do video que deseja baixar: ")
path = input("digite o diretório que deseja salvar o video: ")
yt = YouTube(link)
# Mostrar os detalhes do video
print("Titulo: ", yt.title)
print("Número de views: ", yt.... |
# fa20-516-238 E.Cloudmesh.Common.5
from cloudmesh.common.util import banner
from cloudmesh.common.Shell import Shell
from cloudmesh.common.StopWatch import StopWatch
class CloudmeshCommon:
def demo_stopwatch(self):
count = 1
StopWatch.start("demo")
while (count < 5):
ping = ... |
"""Module that interacts with the Riot API
and transforms the received data in
a user readable way.
"""
import shelve
import matplotlib.pyplot as plt
import logging
from discord.ext import commands
import discord
import pandas as pd
from core import (
timers,
exceptions,
config
)
from core.state import Ge... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import annotations
from copy import deepcopy
from itertools import chain
from re import search
from typing import List, Optional
from numpy import ndarray, linspace, inf
from . import Group, Report
class Collection(object):
"""Collection storage class.
... |
#
# @lc app=leetcode id=105 lang=python3
#
# [105] Construct Binary Tree from Preorder and Inorder Traversal
#
# https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/
#
# algorithms
# Medium (51.38%)
# Likes: 4990
# Dislikes: 128
# Total Accepted: 480K
# Total Submis... |
import logging
from pygdbmi.printcolor import fmt_cyan
class StringStream:
"""A simple class to hold text so that when passed
between functions, the object is passed by reference
and memory does not need to be repeatedly allocated for the string.
This class was written here to avoid adding a dependen... |
def enabled():
return True
def title():
return "Calvin and Hobbes"
def subtitle():
return "View Calvin's adventures with good old Hobbes"
def run():
import feedparser
import re
import os
d = feedparser.parse('http://calvinhobbesdaily.tumblr.com/rss')
strip = re.match(r'<img[^>]*\ssrc="(.*?)"' , d['entries'][... |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E08000010"
addresses_name = "parl.2019-12-12/Version 2/Democracy_Club__12December2019Wig.tsv"
stations_name = "parl.2019-12-12/Version 2/Democracy_Club__12Dec... |
# for PDF miner use
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams, LTTextBox, LTTextLine
from pdfminer.pdfpage import PDFPag... |
import asyncio
import logging
from aioredlock import Aioredlock, LockError, LockAcquiringError
async def basic_lock():
lock_manager = Aioredlock([{
'host': 'localhost',
'port': 6379,
'db': 0,
'password': None
}])
if await lock_manager.is_locked("resource"):
print(... |
# -*- coding: utf-8 -*-
'''
Plots numerical results
'''
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def linear(df, x, y, ci=None):
'''
df: DataFrame with numerical values
x: string of column names to use in x-axis
y: string of column names to use in x-... |
#1usr/bin/env python3
#-*-coding:utf-8 -*-
#Filename:Mail.py
#The email from user->MUA->MTA->another user
#It obeys the SMTP(simple mail tranfer protol)
from email.mime.text import MIMEText
msg=MIMEText('hello,send by Frank...','plain','utf-8')
#input the Email address
from_addr=input('From: ')
password=inpu... |
import pandas as pd
#read the data
data = pd.read_csv('diabetes.csv')
#labels for discretization
labels = ['low','medium','high']
#Preprocessing
for j in data.columns[:-1]:
mean = data[j].mean()
data[j] = data[j].replace(0,mean)
data[j] = pd.cut(data[j],bins=len(labels),labels=labels)
#train test split
... |
"""
Precisely APIs
Enhance & enrich your data, applications, business processes, and workflows with rich location, information, and identify APIs. # noqa: E501
The version of the OpenAPI document: 11.9.3
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F4... |
# -*- coding: utf-8 -*-
import os
import numpy as np
import cv2
import imgproc
from scipy.spatial import distance
from PIL import ImageFont, ImageDraw, Image
###################
font_dir = "arial.ttf"
# ###################
def count_rec(box):
dis1 = int(np.ceil(distance.euclidean(box[0], box[1])))
dis2 = int(np.ce... |
# this is for login and logout authentication
from rest_framework.renderers import JSONRenderer
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.authtoken.models import Token
from django.contrib.auth import login as django_l... |
from web3 import HTTPProvider
from .quorum import Web3Quorum, Web3QuorumMock
from .utils import enode_to_raft_id
HTTPProvider = HTTPProvider
Web3Quorum = Web3Quorum
Web3QuorumMock = Web3QuorumMock
enode_to_raft_id = enode_to_raft_id
|
# Maciej Izydorek
# program counts how many times it was run
import os.path
filename = 'count.txt'
if not os.path.isfile(filename):
print('File does not exsist')
# init file here
writeNumber(0)
def readNumber():
try:
with open(filename, 'r') as reader:
number = int(reader.read())... |
import unittest
import os
import logging
import gzip
from htseq_tools.tools.merge_counts import merge_files
logger = logging.getLogger()
class TestMergeCounts(unittest.TestCase):
len_file = os.path.join(os.path.dirname(__file__),
'etc/test_lengths.txt')
ct_file_1 = os.path.join(o... |
import cairo
import os
from libqtile import bar
import base
BAT_DIR = '/sys/class/power_supply'
CHARGED = 'Full'
CHARGING = 'Charging'
DISCHARGING = 'Discharging'
UNKNOWN = 'Unknown'
BATTERY_INFO_FILES = {
'energy_now_file': ['energy_now', 'charge_now'],
'energy_full_file': ['energy_full', 'charge_full'],
... |
# create a path
path = BezierPath()
# move to a point
path.moveTo((100, 100))
# line to a point
path.lineTo((100, 200))
path.lineTo((120, 100))
# set stroke color to black
stroke(0)
# set no fill
fill(None)
# set the width of the stroke
strokeWidth(10)
# draw the path
drawPath(path)
# move the canvas
translate(100,... |
#!/usr/bin/env python
#
# A lightweight Telegram Bot running on Flask
#
# Copyright 2020 Rodion Nehoroshev <[email protected]>
#
# 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
#
# ... |
import json
import os
import boto3
from botocore.exceptions import ClientError, ProfileNotFound
from tweet.twitter import TwitterCredentials, TwitterClient
def get_secret(boto3_session, secret_name):
client = boto3_session.client(
service_name='secretsmanager',
region_name=boto3_session.region_n... |
"""Amazon S3 Module."""
import concurrent.futures
import csv
import logging
import time
import uuid
from itertools import repeat
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
import boto3 # type: ignore
import botocore.exceptions # type: ignore
import pandas as pd # type: ignore
im... |
"""
249. Count of Smaller Number before itself
https://www.lintcode.com/problem/count-of-smaller-number-before-itself/description
"""
import math
class Block:
def __init__(self):
self.count = {}
self.total = 0
class BlockArray:
def __init__(self, array_range):
self.array_size = int(math... |
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See LICENSE
"""
frappe.coverage
~~~~~~~~~~~~~~~~
Coverage settings for frappe
"""
STANDARD_INCLUSIONS = ["*.py"]
STANDARD_EXCLUSIONS = [
"*.js",
"*.xml",
"*.pyc",
"*.css",
"*.less",
"*.scss",
"*.vue",
"*.html",
"*/test_*"... |
import pathlib
import time, os
def PunctuationRemover(wordsstring, normalise_spelling=False, return_list=True):
a = wordsstring
if normalise_spelling == True:
a = wordsstring.replace('oͤ', 'ö').replace('Oͤ', 'Ö').replace('aͤ', 'ä').replace('Aͤ', 'Ä').replace('uͤ', 'ü').replace('Uͤ', 'Ü')\
... |
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
from gensim.models import Word2Vec
import numpy as np
import gc
def train_word2vec(documents, embedding_dim):
"""
train word2vector over traning documents
Args:
documents (list): list of document
... |
import requests
import json
key = "9247ef2009ba4e86a10874c39a1f1868"
#relative path to your new query file
queryFilePath = '/path/to/your/query.json'
headerDict = {}
paramDict = {}
#baseUrl = 'https' + '://' + 'api.yuuvis.io'
objectId = '805715d6-9ed9-4069-8922-bb587ce9d652'
baseUrl = 'https' + '://' + 'api.yuuvis.io... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from userena.forms import SignupForm
from .models import MyProfile
class SignupFormExtra(SignupForm):
blank_choice = (('', _('Please choose an option')),)
gender = forms.ChoiceField(label=_(u'gender'), choices=blank_choice+MyProfi... |
#!/usr/bin/env python
## HiC-Pro
## Copyright (c) 2015 Institut Curie
## Author(s): Nicolas Servant, Eric Viara
## Contact: [email protected]
## This software is distributed without any guarantee under the terms of the BSD-3 licence.
## See the LICENCE file for details
"""
Script... |
import itertools
import multiprocessing
import os
from datetime import datetime as dt
import jinja2
import networkx as nx
import numpy as np
import pandas as pd
import yaml
from tqdm import tqdm
from classifier import classifier_output
from graphs import random_delaunay, random_grid, random_realization
from planner i... |
# Generated by Django 4.0 on 2022-02-13 11:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Sales',
fiel... |
# Copyright 2020 Sorunome
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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 requi... |
import json
import os
from typing import Iterator, Tuple
import pytest
from altair_saver.savers import BasicSaver
from altair_saver._utils import JSONDict
def get_testcases() -> Iterator[Tuple[str, str, JSONDict]]:
directory = os.path.join(os.path.dirname(__file__), "testcases")
cases = set(f.split(".")[0] ... |
#!/usr/bin/python
from clients.keystone import Client
from core import agent
__author__ = 'beb'
if __name__ == '__main__':
ksclient = Client()
print 'token: %s' % ksclient.get_token()
print 'endpoint: %s' % ksclient.get_endpoint()
print 'network endpoint: %s' % agent._get_endpoint('network')
|
"""
build_SIM_with_deposits.py
Create an augmented version of the SIM model (Godley & Lavoie Chapter 3), but with deposits added.
Since we do not have a central bank sector, this falls short of the model PC specifcation (Chapetr 4).
Copyright 2016 Brian Romanchuk
Licensed under the Apache License, Version 2.0 (the ... |
# 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 u... |
import os
import time
import pytest
import numpy as np
from jina import Document, DocumentArray
from .. import MongoDBStorage
NUM_DOCS = 10
@pytest.fixture
def storage():
return MongoDBStorage()
@pytest.fixture
def docs_to_index():
docu_array = DocumentArray()
for idx in range(0, NUM_DOCS):
d... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from app import app, logging
from flask import (request, make_response)
@app.route('/api/airtime/dlr/', methods=['POST'])
def airtime_dlr_callback():
if request.method == 'POST':
# Reads the variables sent via POST from our gateway
_from = request.v... |
"""Use to transfer a MySQL database to SQLite."""
from __future__ import division
import logging
import re
import sqlite3
from datetime import timedelta
from decimal import Decimal
from math import ceil
from os.path import realpath
from sys import stdout
import mysql.connector
import six
from mysql.connector import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Material related operations
"""
import numpy as np
import mechkit
tensors = mechkit.tensors.Basic()
class SpecificMaterial(object):
def __init__(self):
self.con = mechkit.notation.VoigtConverter(silent=True)
def _copy_upper_triangle(self, matrix):
... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import tensorflow as tf
class Blur:
"""
Base class for Blur objects.
"""
def __init__(self, size=1):
"""
Initialize a Blur object with a specified kernel size.
https://en.wikipedia.org/wiki/Kernel_(image_processing)
Note: blurring is most efficient when size is odd.
... |
i = 4
d = 4.0
s = 'HackerRank '
# Declare second integer, double, and String variables.
# For declaring we need to give some value to the variables
# Read and save an integer, double, and String to your variables.
inte=int(input())
do=float(input())
st=input()
# Print the sum of both integer variables on a new line.
p... |
# _*_ coding: utf-8 _*_
__author__ = 'nick'
__date__ = '2019/2/20 1:06'
import xadmin
from xadmin import views
from .models import EmailVerifyRecord, ViewPage, UserProfiles
class BaseSetting:
# 更改后台的主题样式
enable_themes = True
use_bootswatch = True
class GlobalSettings:
# 更改后台的标题和页脚显示
site_title... |
import mock
from zeep import exceptions
def get_side_effect(
returned_token="RETURNED_TOKEN",
returned_status=100,
raise_zeep_fault=False,
raise_zeep_error=False,
):
# noinspection PyPep8Naming
# noinspection PyMethodMayBeStatic
# noinspection PyUnusedLocal
class ClientService:
... |
class TeampassHttpException(Exception):
def __init__(self, http_code, msg=None):
self.msg = msg
self.http_code = http_code
def __str__(self):
return u"HTTP CODE: {}, Error: {}".format(self.http_code, self.msg)
def __unicode__(self):
return u"HTTP CODE: {}, Error: {}".format... |
"""
Tests for cogdb.eddn
"""
import datetime
import pathlib
import shutil
import tempfile
try:
import rapidjson as json
except ImportError:
import json
import cogdb.eddn
import cogdb.schema
from cogdb.schema import TrackByID
from cogdb.eddb import FactionActiveState
EXAMPLE_JOURNAL_CARRIER = """{
"$sche... |
import contextlib
import json
import mimetypes
import os
import subprocess
import sys
import threading
import time
import traceback
from binaryornot.check import is_binary
from collections import deque
from datetime import datetime, timedelta
from pathlib import Path
from textwrap import dedent
from .server import Se... |
#!/usr/bin/env python
from __future__ import division
import pdb
import numpy as np
from scipy.optimize import fsolve
from geometry import Geometry, Strip, Panel
import plotting
import matplotlib.pyplot as plt
from math import sin, cos, asin, exp, pi, atan, tan, log
from numpy import sqrt
class Aero... |
import sys
from .cli import main
sys.exit(main()) # pragma: no cover
|
class SlashException(Exception):
@classmethod
def throw(cls, *args, **kwargs):
raise cls(*args, **kwargs)
class TerminatedException(BaseException):
pass
INTERRUPTION_EXCEPTIONS = (KeyboardInterrupt, TerminatedException)
class NoActiveSession(SlashException):
pass
class ParallelServerIsD... |
import numpy as np
import pandas as pd
class Stat:
# base class of stat objects
def get_constant(self, name, n):
factor = pd.read_csv('factor_table.csv')
return factor[name][factor['n']==n].to_numpy()[0]
def get_params(self):
print(self.params)
def set_params(sel... |
from django.apps import AppConfig
class DjkalendarConfig(AppConfig):
name = 'djkalendar'
|
codontable= {"UUU":"F", "UUC":"F", "UUA":"L", "UUG":"L",
"UCU":"S", "UCC":"s", "UCA":"S", "UCG":"S",
"UAU":"Y", "UAC":"Y", "UAA":"STOP", "UAG":"STOP",
"UGU":"C", "UGC":"C", "UGA":"STOP", "UGG":"W",
"CUU":"L", "CUC":"L", "CUA":"L", "CUG":"L",
"CCU":"P", "CCC":"P", "CCA":"P", "CCG":"P",
... |
#!/usr/bin/python
import initExample ## Add path to library (just for examples; you do not need this)
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from pyqtgraph.ptime import time
app = QtGui.QApplication([])
p = pg.plot()
p.setWindowTitle('pyqtgraph performance: InfiniteLine')
p.s... |
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2018-08-23 14:13:36
# @Last Modified by: 何睿
# @Last Modified time: 2018-08-23 14:13:36
import random
def DirectInsertionSort():
# 直接插入排序,递增排序:
number_list = random.sample(range(0, 500), 20)
print("%-*s" % (15, "UnSorted List"), n... |
from pytorch_fit.visuals import plot_history
history = {'Loss': {'train_loss': [0.4477573685088561,
0.15534080869922653,
0.11754136811213749,
0.10495792154564278,
0.09372215639394... |
#!/usr/bin/env python
import unittest
from utils import TaskQueue
from page_crawl import Page
class TestTaskPriorityQueue(unittest.TestCase):
def check_empty_queue(self, queue):
self.assertTrue(queue.total_task_cnt == 0)
for pri in range(10):
self.assertTrue(queue.prio_task_cnt[pri] == 0)
self... |
# Copyright (C) 2013-2021, Stefan Schwarzer
# and ftputil contributors (see `doc/contributors.txt`)
# See the file LICENSE for licensing terms.
"""
tool.py - helper code
"""
import os
__all__ = ["same_string_type_as", "as_str", "as_str_path"]
def same_string_type_as(type_source, string, encoding):
"""
Ret... |
from django import forms
from .models import *
class OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = ("customer_name","customer_email","customer_phone","customer_address","delivery","payment","confirm","comments") |
from Player import Player
from Constants import *
class Computer(Player):
def __init__(self, colour):
super().__init__(colour)
pass
def make_move_decision(self, board, colour):
pass
|
import os
from flask import Flask, flash, request, redirect, url_for, send_from_directory, render_template, send_file
from werkzeug.utils import secure_filename
from redis import Redis
import rq
import math
import time
UPLOAD_FOLDER = 'uploaded'
ALLOWED_EXTENSIONS = {'wav', 'mp3'}
app = Flask(__name__)
app.config['UP... |
# Generated by Django 3.1.7 on 2021-04-11 18:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0003_info_auth'),
]
operations = [
migrations.AlterField(
model_name='info',
name='auth',
field=... |
#!/usr/bin/env python
from flask_wtf import Form
from wtforms import StringField, IntegerField, BooleanField, DateField,DateTimeField
from wtforms.validators import DataRequired
class SearchForm(Form):
server = StringField('server', validators = [DataRequired()])
dt = DateField('Date', format = '%Y-%m-%d')
|
# coding: utf-8
from kay.utils.forms import modelform
from static.models import SPage
class SPageForm(modelform.ModelForm):
class Meta:
model = SPage
fields = ('title', 'meta_desc', 'body')
|
class FourConcealedPungs:
name = "Four Concealed Pungs"
points = 64
excluded = ("All Pungs", "Concealed Hand", "Three Concealed Pungs", "Two Concealed Pungs")
def __init__(self, handObj):
self.hand = handObj
def examine_standard_hand(self):
return self.hand.standardhand
def examine_no_chows(self):
pun... |
from .forms import ContactForm
from django.conf import settings
from django.contrib import messages
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.utils import timezone
import random
import ... |
f=open("Test.txt","a+")
while(str!=0):
str=input()
if(str!=0):
f.write(str)
f.seek(0,0)
print("File contents are:")
str=f.read()
print(str)
|
def run_transaction(driver, function, string, **kwargs):
with driver.session() as session:
return session.read_transaction(function, string=string, **kwargs)
def cleanup_string(string):
try:
return string.strip()
except AttributeError:
return ValueError("search string is invalid")
... |
'''
author : Plaban Nayak
mail : [email protected]
''' |
# impy - a post-processor for HYADES implosion simulations
# Copyright (c) Massachusetts Institute of Technology / Alex Zylstra
# Distributed under the MIT License
import platform
import os
import pkgutil
import tkinter as tk
import tkinter.ttk as ttk
# from tkinter.filedialog import askdirectory
from impy.gui.Window... |
import numpy as np
import math
import pandas as pd
def rastrigin_FitnessFunc(pop):
print("pop")
print(pop)
def rastr(x):
summ = 0
summ += x[0]**2 - 10.0 * np.cos(2 * math.pi * x[0])
summ += x[1]**2 - 10.0 * np.cos(2 * math.pi * x[1])
return (20 + summ)/40
genes = []
... |
from typing import Tuple, List, Dict, Union
import fiona
from geopandas import GeoDataFrame
from shapely.geometry import Polygon
from map_poster_creator.color_schemes import get_color_schemes
from map_poster_creator.geojson import get_polygon_from_geojson, get_map_geometry_from_poly, MapGeometry
from map_poster_creat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import oskar
from mpi4py import MPI
if __name__ == '__main__':
# Check command line arguments.
if len(sys.argv) < 3:
raise RuntimeError(
'Usage: mpiexec -n <np> '
'python sim_mpi_multi_channel.py '
... |
# -*- coding: utf-8 -*-
from datetime import timedelta
from math import ceil
DEFAULT = {
"second": "second",
"seconds": "seconds",
"minute": "minute",
"minutes": "minutes",
"hour": "hour",
"hours": "hours",
"day": "day",
"days": "days",
}
SHORT = {
"second": "sec",
"seconds": "sec",
"minute... |
import datetime
import decimal
import time
import unittest
import uuid
import dateutil.parser
import django.test
import django.urls
import django.utils.timezone
import mock
import rest_framework.test
from behave import *
import api.tests.factories
import jetstream.tests.tas_api_mock_utils
@step('we create a new use... |
from setuptools import setup, find_packages
setup(
# this will be my Library name.
name='option-pricing-python',
# Want to make sure people know who made it.
author='Davis W. Edwards',
# also an email they can use to reach out.
author_email='[email protected]',
... |
from .list import ProjectListQuery
from .duplication_checks import ProjectDuplicationCheckQuery
class ProjectsQuery(
ProjectDuplicationCheckQuery,
ProjectListQuery,
):
pass
|
from PIL import Image, ImageStat
import numpy as np
from progressbar import ProgressBar
import photo_mosaic.util
from photo_mosaic import dbmanager
class PhotoMosaicGenerator:
def __init__(self, materials_db: str):
self._db = dbmanager.DBManager(dbname=materials_db)
self._materials = self._db.ge... |
try:
from mac import Mac
from censor import Censor
except ImportError:
from heyyou.mac import Mac
from heyyou.censor import Censor
class Config:
interface: str = None
mac: Mac = None
auth_token: str = None
summary: bool = False
censor: Censor = None
def __init__(self, args):
... |
# importing nessesary modules in our Program
from tkinter import *
import tkinter.messagebox as msg
# making root variable as Tk class and Updating Title, minimum and maximum size and Title of our GUI application
root = Tk()
root.geometry("655x333")
root.maxsize(655, 333)
root.minsize(655, 333)
root.title("ListBox usi... |
from dottygen.generator.dotty_generator import DottyGenerator |
from time import sleep
from random import choice
def color_it(text, color):
red = "\033[1;31;40m"
green = "\033[1;32;40m"
yellow = "\033[1;33;40m"
cyan = "\033[1;36;40m"
purple = "\033[1;35;40m"
normal = "\033[0;37;40m"
if color == "red":
return "{}{}{}".format(red, text, normal)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.