text string | size int64 | token_count int64 |
|---|---|---|
# Copyright 2019 gRPC 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 writing... | 2,439 | 733 |
import os
import threading
import time
from collections import deque
import numpy as np
from threading import Thread
from agents.dqn_agent import DqnAgent
from main import App
# Number of games to play
from utils.logger import DataLogger
n_episodes = 10000
save_period = 50 # Saves off every n episodes' model
bat... | 6,634 | 2,124 |
import logging
import pytest
from selenium.webdriver.remote.remote_connection import LOGGER
from stere.areas import Area, Areas
LOGGER.setLevel(logging.WARNING)
def test_areas_append_wrong_type():
"""Ensure a TypeError is raised when non-Area objects are appended
to an Areas.
"""
a = Areas()
... | 2,840 | 1,029 |
import with_sql as sqlprovider
import unittest
class SQLStoreTestCase(unittest.TestCase):
def setUp(self):
sqlprovider.app.config['TESTING'] = True
self.app = sqlprovider.app.test_client()
def error_mime_json(self):
return "Return payload data must be a JSON String"
def error_no... | 1,388 | 433 |
from django.contrib.auth.models import User
from django.contrib.auth.views import LoginView
from django.contrib.auth.forms import AuthenticationForm
from django.views.generic import CreateView
from django.shortcuts import reverse, redirect
from users.forms import JoinusForm
class LoginView(LoginView):
template_n... | 765 | 202 |
#!/usr/bin/env python3
import socket
#debugon = False
#forks = 3
worklist = ["localhost", "127.0.0.1"]
def worker(var):
sock = None
ports = [21, 22, 25, 80, 110, 443, 445, 3306]
# for port in range(1, 65536):
for port in ports:
try:
sock = socket.create_connection((var, port),... | 688 | 271 |
import numpy as np
from random import sample, seed
#import matplotlib.pyplot as plt
from sys import argv, stdout
#from scipy.stats import gumbel_r
from score_matrix import readScoreMatrix, getMatrix
from seqali import smithWaterman, smithFast, plotMat, plotTraceMat
from multiprocessing import Process, Manager
def scra... | 2,940 | 1,244 |
import numpy as np
def gaussian_noise(image, mean=0, var=1):
n_rows, n_cols = image.shape
noise = np.random.normal(mean, var**0.5, (n_rows, n_cols))
noise = noise.reshape((n_rows, n_cols))
result = (noise + image).astype(np.uint8)
# print(np.any(result[result > 255]))
# result = result.astype(... | 883 | 370 |
import os
import time
import csv
import json
import re
import twint
from cleantext import clean
from textblob import TextBlob
from google.cloud import translate_v2
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"C:\\Users\\ht_ma\\env\\service-account-file.json" # Key needed
translate_client_0 = translate... | 12,223 | 3,895 |
import time
import cv2
from threading import Thread
import numpy as np
from hydroserver.physical_interfaces.camera_streamer import CameraStreamer
from hydroserver.physical_interfaces.camera_storage import CameraStore
import hydroserver.model.model as Model
class CameraController(Thread):
def __init__(
... | 2,792 | 789 |
# coding=utf-8
"""
Class used for representing tIntermediateCatchEvent of BPMN 2.0 graph
"""
import graph.classes.events.catch_event_type as catch_event
class IntermediateCatchEvent(catch_event.CatchEvent):
"""
Class used for representing tIntermediateCatchEvent of BPMN 2.0 graph
"""
def __init__(sel... | 478 | 140 |
class InvalidInputError(Exception):
pass
| 45 | 12 |
from .purestorage import FlashArray, PureError, PureHTTPError, VERSION
| 71 | 23 |
"""Compiler/transpiler for the GerryOpt DSL."""
import ast
import json
import inspect
from copy import deepcopy
from textwrap import dedent
from dataclasses import dataclass, field, is_dataclass, asdict
from enum import Enum
from itertools import product
from typing import (Callable, Iterable, Sequence, Set, Dict, List... | 28,600 | 8,883 |
#
# Copyright (c) 2017, Massachusetts Institute of Technology 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
# list o... | 3,122 | 986 |
#! /usr/bin/env -S python3 -u
import os, shutil, sys, glob, traceback
from easyterm import *
help_msg="""This program downloads one specific NCBI assembly, executes certains operations, then cleans up data
### Input/Output:
-a genome NCBI accession
-o folder to download to
### Actions:
-c bash command ... | 6,805 | 2,302 |
nome = input('Digite seu nome: ')
name = input('Type your name: ')
print('É um prazer te conhecer, {}{}{}!'.format('\033[1;36m', nome, '\033[m'))
print('It is nice to meet you, {}{}{}!'.format('\033[4;30m', name, '\033[m'))
| 224 | 97 |
"""Test cases for inventory item"""
import pytest
from Module_06.src.elements.inventory_item import InventoryItem
from Module_06.src.pages.login import LoginPage
from Module_06.tests.common.test_base import TestBase
from Module_06.src.pages.checkout_details import CheckoutDetailsPage
from Module_06.src.pages.checkout_... | 2,289 | 703 |
import cupy as cp
import numpy as np
import pandas as pd
import itertools
import math
import networkx as nx
from gpucsl.pc.kernel_management import get_module
function_names = [
"compact<6,6>",
]
module = get_module("helpers/graph_helpers.cu", function_names, ("-D", "PYTHON_TEST"))
def test_compact_on_random_ske... | 2,217 | 1,028 |
# -*- coding: utf-8 -*-
''' Python configuration module for CAPSUL
This config module allows the customization of python executable and python path in process execution. It can (as every config module) assign specific config values for different environments (computing resources, typically).
Python configuration is s... | 4,583 | 1,151 |
import asyncio
import io
import glob
import os
import sys
import time
import uuid
import requests
from urllib.parse import urlparse
from io import BytesIO
# To install this module, run:
# python -m pip install Pillow
from PIL import Image, ImageDraw
from azure.cognitiveservices.vision.face import FaceClien... | 3,600 | 1,184 |
#!/usr/bin/env python3
'''Simple example of using tesselation to render a cubic Bézier curve'''
import numpy as np
import moderngl
from ported._example import Example
class Tessellation(Example):
title = "Tessellation"
gl_version = (4, 0)
def __init__(self, **kwargs):
super().__init__(**kwargs)... | 2,741 | 979 |
"""
author: Rahul Mohandas
"""
import setuptools
setuptools.setup(
name="smv",
version="0.1",
packages=setuptools.find_packages(exclude=["tests"]),
author="Rahul Mohandas",
author_email="rahul@rahulmohandas.com",
description="It's like scp but for moving",
license="MIT",
test_suite="tes... | 326 | 117 |
import logging; module_logger = logging.getLogger(__name__)
from pathlib import Path
# ----------------------------------------------------------------------
def get_chart(virus_type, assay, lab, infix="", chart_dir=Path("merges")):
if virus_type in ["bvic", "byam"]:
vt = virus_type[:2] # virus_type[0] + ... | 905 | 284 |
"""The base class for many SciUnit objects."""
import sys
PLATFORM = sys.platform
PYTHON_MAJOR_VERSION = sys.version_info.major
if PYTHON_MAJOR_VERSION < 3: # Python 2
raise Exception('Only Python 3 is supported')
import json, git, pickle, hashlib
import numpy as np
import pandas as pd
from pathlib import Path... | 14,650 | 3,907 |
# -*- coding: utf-8 -*-"
from numpy import pi, exp, sqrt
from scipy.special import erf
def regularized_payoff(x, k_strk, h, method):
"""For details, see here:
Parameters
----------
x : array, shape (j_,)
k : scalar
method: string
h: scalar
Returns
-------
... | 741 | 306 |
from typing import Union
NUMBER_DICT = {
'0': 'zero',
'1': 'one',
'2': 'two',
'3': 'three',
'4': 'four',
'5': 'five',
'6': 'six',
'7': 'seven',
'8': 'eight',
'9': 'nine',
'.': 'and',
}
def number_to_str(number: Union[int, float]) -> str:
"""
>>> number_to_str(1969)... | 623 | 247 |
from mWindowsSDK import *;
from .fbIsValidHandle import fbIsValidHandle;
from .fbLastErrorIs import fbLastErrorIs;
from .fohOpenForProcessIdAndDesiredAccess import fohOpenForProcessIdAndDesiredAccess;
from .fsGetPythonISA import fsGetPythonISA;
from .fThrowLastError import fThrowLastError;
from .oSystemInfo import oSys... | 5,343 | 1,724 |
class ATMOS(object):
'''
class ATMOS
- attributes:
- self defined
- methods:
- None
'''
def __init__(self,info):
self.info = info
for key in info.keys():
setattr(self, key, info[key])
def __repr__(self):
return 'Instance of class AT... | 325 | 104 |
import dataclasses
import datetime
import json
import os
import tempfile
from core.excel.directions import DirectionsExcel
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.files import File
from django.shortcuts import ... | 9,746 | 2,884 |
t=int(input())
if not (1 <= t <= 100000): exit(-1)
dp=[0]*100001
dp[3]=3
for i in range(4,100001):
if i%3==0 or i%7==0: dp[i]=i
dp[i]+=dp[i-1]
query=[*map(int,input().split())]
if len(query)!=t: exit(-1)
for i in query:
if not (10 <= int(i) <= 80000): exit(-1)
print(dp[int(i)])
succ=False
try: input(... | 361 | 189 |
# -*- coding: utf-8 -*-
"""
Representation of Hierarchical Equations of Motion
"""
import numpy
from ... import REAL, COMPLEX
from ..propagators.dmevolution import DensityMatrixEvolution
from ..hilbertspace.operators import ReducedDensityMatrix
from ..hilbertspace.operators import UnityOperator
from ...core.units... | 21,108 | 7,010 |
import numpy as np
import threading
import os
import plotly.graph_objects as go
import pandas as pd
import sys
import re
from scipy import constants as cts
from IPython.display import display, HTML
import time
work_dir = os.path.join(os.path.dirname(__file__), '../')
work_dir = os.path.abspath(work_dir)
path = os.path... | 17,980 | 5,827 |
import time
import profile
from vclib.ccvs import rcsparse
import viewvc
try:
import tparse
except ImportError:
tparse = None
def lines_changed(delta):
idx = 0
added = deleted = 0
while idx < len(delta):
op = delta[idx]
i = delta.find(' ', idx + 1)
j = delta.find('\n', i + 1)
line = int(de... | 5,036 | 1,956 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ct', '0015_migrate_fsm'),
]
operations = [
migrations.AlterField(
model_name='concept',
name='title',
field=models.CharField(max_length=200),
... | 1,206 | 344 |
""" Contains the pipeline used to test models. """
| 51 | 13 |
#!/usr/bin/env python
""" Script to convert a result into the standard format of this directory """
import argparse
import bilby
import numpy as np
# Set a random seed so the resampling is reproducible
np.random.seed(1234)
parser = argparse.ArgumentParser()
parser.add_argument('result', help="The result file to imp... | 1,954 | 624 |
# BSM Python library and command line tool
#
# Copyright (C) 2020 chargeIT mobility GmbH
#
# SPDX-License-Identifier: Apache-2.0
from . import config
from . import md
from . import util as butil
from ..crypto import util as cutil
from ..sunspec.core import client as sclient
from ..sunspec.core import suns
from ..suns... | 18,653 | 5,561 |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext as _
from simple_history.models import HistoricalRecords
from phonenumber_field.modelfields import PhoneNumberField
from internals.models import School, Univ... | 5,664 | 1,808 |
from enum import Enum
class Sort(int, Enum):
NEWEST = 2
MOST_RELEVANT = 1
| 84 | 38 |
import numpy as np
def make_grid_edges(x, neighborhood=4, return_lists=False):
if neighborhood not in [4, 8]:
raise ValueError("neighborhood can only be '4' or '8', got %s" %
repr(neighborhood))
inds = np.arange(x.shape[0] * x.shape[1]).reshape(x.shape[:2])
inds = inds.ast... | 1,282 | 530 |
# -------------------------------------------------------------------------- #
# OpenSim Muscollo: plot_inverse_dynamics.py #
# -------------------------------------------------------------------------- #
# Copyright (c) 2017 Stanford University and the Authors #
# ... | 1,939 | 491 |
from dataclasses import dataclass
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
import torch
from omegaconf import DictConfig
from torch.utils.data import DataLoader, Dataset
from xd.utils.configs import dynamic_load
@dataclass
class XView3DataSource:
train_csv: Path = Path("data/in... | 6,485 | 2,317 |
"""
Define the environment paths
"""
#Path variables
TEMPLATE_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/master/"
STATIC_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/static/"
| 216 | 81 |
from flask.globals import request
import pytest
from flask import Flask
from typing import Dict
from customs import Customs
from customs.exceptions import UnauthorizedException
from customs.strategies import LocalStrategy
def test_local_strategy_initialization_without_customs():
class Local(LocalStrategy):
... | 3,181 | 1,009 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | 3,105 | 1,022 |
import TmConv
import time
class Data():
def __init__(self, content):
self.content = content
self.corrent = '-'
self.object = {}
def update(self):
Cp, name = self.content.Update()
if Cp != self.corrent:
self.corrent = Cp
self.object = {
... | 984 | 339 |
r"""
Super modules
"""
#*****************************************************************************
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*********************************... | 8,002 | 2,239 |
from abc import ABC
from typing import Iterable, Any, Tuple, Mapping
from emissor.persistence import ScenarioStorage
from emissor.persistence.persistence import ScenarioController
from emissor.representation.scenario import Signal, Modality
class DataPreprocessor(ABC):
def preprocess(self):
raise NotImpl... | 2,616 | 757 |
from colour import Color
from pprint import pprint
def test_function():
red = Color("red")
green = Color("green")
colors = list(red.range_to(green, 20))
# pprint(colors)
# pprint(dir(colors[0]))
for color in colors:
print(color.get_hex())
return
if __name__ == '__main__':
... | 336 | 117 |
# @Author: Jose Rojas
# @Date: 2018-07-10T08:20:17-07:00
# @Email: jrojas@redlinesolutions.co
# @Project: ros-libav-node
# @Last modified by: jrojas
# @Last modified time: 2018-07-13T17:26:29-07:00
# @License: MIT License
# @Copyright: Copyright @ 2018, Jose Rojas
import rospy
import av
import av.filter
class No... | 2,779 | 960 |
# -*- coding: utf-8 -*-
"""
Metodo per la stima dell'ordine
"""
import numpy as np
def stima_ordine(xks,num_iterazioni):
k = num_iterazioni - 3
return np.log(abs(xks[k+2]-xks[k+3])/abs(xks[k+1]-xks[k+2])) / np.log(abs(xks[k+1]-xks[k+2])/abs(xks[k]-xks[k+1])) | 266 | 142 |
import pygame
from src.game_objects.dynamic import Dynamic
from src.game_objects.foes.foe import Foe
class Projectile(Dynamic):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def decayable(self):
"""
Overriding decayable in GameObject
:ret... | 539 | 164 |
import requests
import urllib.parse
from bs4 import BeautifulSoup
from geopy.geocoders import Nominatim
def parseCoord (coord):
start = 0
for i in range(0, len(coord)):
if coord[i].isnumeric () or coord[i] == '-' :
start = i
break
coordAsStr = coord[start: - 1].split (", ")... | 1,773 | 572 |
#!/usr/bin/env python
import socket
import sys
if len(sys.argv) == 2:
port = int(sys.argv[1])
else:
print('Usage: ./echoserver.py <port>')
sys.exit(1)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('127.0.0.1', port))
s.listen(1)
while 1:
client, address = s.accept()
data = client... | 390 | 166 |
from math import sin,cos,pi
def cal_ges(PIT,ROL,l,b,w,x,Hc):
YA=0
P=PIT*pi/180
R=ROL*pi/180
Y=YA*pi/180
#腿1
ABl_x=l/2 - x -(l*cos(P)*cos(Y))/2 + (b*cos(P)*sin(Y))/2
ABl_y=w/2 - (b*(cos(R)*cos(Y) + sin(P)*sin(R)*sin(Y)))/2 - (l*(cos(R)*sin(Y) - cos(Y)*sin(P)*sin(R)))/2
ABl_z= - Hc - (b*(... | 1,416 | 874 |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2
import ipaddress
from typing import Any
from typing import Dict
from typing import Optional
from urllib import parse
import tau_clients
try:
import pymisp
except ImportError:
raise ImportError("This module requires 'pymisp' to be installed.") from... | 7,477 | 2,163 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 18 16:21:13 2017
@author: Xiangyong Cao
This code is modified based on https://github.com/KGPML/Hyperspectral
"""
import scipy.io
import numpy as np
from random import shuffle
import random
import scipy.ndimage
from skimage.util import pad
import os
import time
import pan... | 12,398 | 4,434 |
import torch
from torch import nn
from pdb import set_trace as st
def get_encoder(model_type):
model_type = model_type.lower().capitalize()
return eval("{}".format(model_type))
class Cnn1(nn.Module):
def __init__(self, data_size, n_classes):
"""
"""
super(Cnn1, self).__init__()
... | 1,253 | 492 |
from .regra import Regra
class Valor(Regra):
def __init__(self, valor):
self.__valor = float(valor)
def is_valid(self):
if type(self.__valor) is not float and type(self.__valor) is not int:
raise Exception('Valor inválido')
| 263 | 87 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from abc import abst... | 4,075 | 1,280 |
N = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
if a > 10:
ans += a - 10
print(ans) | 122 | 56 |
from django.db import models
class Room(models.Model):
SUBJECTS = (
('math', 'Математика'),
('inf', 'Информатика'),
('othr', 'Другое')
)
SUBJECTS_COLOR = (
('math', '#28a745'),
('inf', '#007bff'),
('othr', '#6c757d')
)
name = models.CharField(max_le... | 842 | 292 |
from pynet import socket_utility
class Message:
"""
Stores a string message and whether or not it is a notification (NTF) or plain message (MSG)
"""
def __init__(self, message):
self.message = message
def prepare(self, max_bytes=None):
return socket_utility.prepare(... | 412 | 135 |
# Generated by Django 3.0.3 on 2020-06-27 20:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0009_auto_20200625_2347'),
]
operations = [
migrations.AlterModelOptions(
name='hiredservice',
options={'orde... | 1,181 | 373 |
import urllib2
from cookielib import CookieJar
import os
import re
import time
import json
cookies = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 '
'(KHTML, like... | 1,184 | 432 |
import socket as Socket
import threading as Threading
from pprint import pprint
import Packet
def main():
serverThread = startServer()
#getCommands(serverThread)
print("Goodbye.")
def getCommands(serverThread):
print("Server Commands")
while True:
cmd = input("0- Halt")
if cmd == "0":
print("H... | 1,939 | 630 |
#!/bin/python3
import sys
def kangaroo(x1, v1, x2, v2):
if (x1 < x2 and v1 <= v2) or (x2 < x1 and v2 <= v1):
return "NO"
if ((x2 - x1) % (v2-v1)) == 0:
return "YES"
return "NO"
x1, v1, x2, v2 = input().strip().split(' ')
x1, v1, x2, v2 = [int(x1), int(v1), int(x2), int(v2)]
result = kanga... | 354 | 181 |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "espcms")
whatweb.recog_from_file(pluginname, "templates/wap/cn/public/footer.html", "espcms")
| 216 | 84 |
import coinonepy
btc = coinonepy.get_current_price("btc")
btc_last_price = float(btc['last'])
print(btc_last_price) | 116 | 48 |
import functools
from unittest import TestCase
from common.base_game_spec import BaseGameSpec
from common.network_helpers import create_network
from games.tic_tac_toe import TicTacToeGameSpec
from games.tic_tac_toe_x import TicTacToeXGameSpec
from techniques.train_policy_gradient import train_policy_gradients
class ... | 2,115 | 623 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 2,865 | 926 |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | 3,448 | 1,192 |
import time
import os
import glob
import datetime
import numpy
import threading
import subprocess
#import scipy.stats
from PyQt4 import QtCore, QtGui
import matplotlib
matplotlib.use('TkAgg')
matplotlib.rcParams['backend'] = 'TkAgg'
import pylab
def shortenTo(s,maxsize=100):
if len(s)<=maxsize: return s
fir... | 36,675 | 11,894 |
import random
from crypto_commons.generic import bytes_to_long, multiply, factor, long_to_bytes
from crypto_commons.netcat.netcat_commons import nc, receive_until_match, receive_until, send
from crypto_commons.rsa.rsa_commons import gcd_multi
def prepare_values():
prefix = bytes_to_long("X: ")
factors, _ = f... | 2,000 | 855 |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""
non-subscription event sent immediately after connecting,
contains server information
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..commands import ChatCommandHandler
from ..exceptio... | 1,458 | 446 |
vetor = []
entradaUsuario = int(input())
repetir = 1000
indice = 0
adicionar = 0
while(repetir > 0):
vetor.append(adicionar)
adicionar += 1
if(adicionar == entradaUsuario):
adicionar = 0
repetir -= 1
repetir = 1000
while(repetir>0):
repetir -= 1
print("N[{}] = {}".format(indice, vetor[indice]))
indic... | 327 | 156 |
"""
This module implements some pytest fixtures for use with Selenium WebDriver.
"""
import os
import time
import pytest
# pip installed
from dotenv import find_dotenv, load_dotenv
from selenium.webdriver import Chrome
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support.wait impor... | 1,620 | 450 |
import requests
import time
import pandas
class DataFetcher():
"""
Python interface for the CKAN Indiana Coronavirus Data Site.
URL: https://hub.mph.in.gov/dataset?q=COVID
"""
_session = requests.Session()
_session.headers = {
'application': 'IndCovid.com',
'User-Agent': 'NLeRoy917@gmail.... | 4,029 | 1,332 |
from audio.sounds import beep
import numpy as np
import time
class VarioTone(object):
""" A class to make vario sounds
"""
def __init__(self, max_val=5.0):
""" Constructor
Arguments:
max_val: optional (defaults to 5), the saturation vario reading in
meters per second
... | 1,631 | 562 |
from functions import decorate, ascii_text
def rules(): # Some Game rules, first shown at screen !
decorate(" ************************************************************ ")
decorate(" * * ")
decorate(" * Welcome to Word jumbling, Suffl... | 1,309 | 367 |
from shutil import copy, make_archive, rmtree
from os import mkdir, remove
from os.path import join, exists
from .io import DATA_PATH, fetch_locus
def pack(name, locus_ids, include_alerts=False):
if exists(name + '.zip'):
raise FileExistsError(name + '.zip')
DST_PATH = name + '_temp'
print(f'Creat... | 1,224 | 419 |
from Crypto.Util import number
def random_prime(bit_size):
return number.getPrime(bit_size)
def random_int(bit_size):
return number.getRandomInteger(bit_size)
class KeyChain:
def __init__(self):
self.keys = []
self.keyids = []
def new_key(self, key, key_id):
self.k... | 975 | 321 |
"""
You can run this in the following format:
For decimal: python3 ip2dh.py D <Ip-address>
For Hexadecimal: python3 ip2dh.py H <Ip-address>
https://gist.github.com/mzfr
"""
#!/usr/bin/python3
import sys
if len(sys.argv) < 3:
print('\nYou must give desired format and IPv4 address as input...')
print('e.g.: D 1... | 731 | 314 |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from config import Config
from main import User, Submission
app = Flask(__name__)
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
app.config.from_object(Conf... | 485 | 167 |
# -*- coding: utf-8 -*-
"""
eve-app settings
"""
# Use the MongoHQ sandbox as our backend.
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_USERNAME = ''
MONGO_PASSWORD = ''
MONGO_DBNAME = 'notifications'
# also, correctly set the API entry point
# SERVER_NAME = 'localhost'
# Enable reads (GET), inserts (POS... | 3,176 | 1,003 |
from lib.pygame_ui import UIManager, Widgets, Shapes, load_theme
| 66 | 23 |
#Created by: Declan Quinn
#May 2019
#To run tests:
#In this file: [test_StandardAtmosphere.py]
#In all files in the current directory: [python -m unittest discover]
#Add [-v] for verbose output (displays names of all test functions)
import unittest
from MAPLEAF.Motion import ForceMomentSystem
from MAPLEAF.Motion imp... | 2,884 | 1,035 |
import getpass
import os
import subprocess
from cpuinfo import get_cpu_info
from psutil import virtual_memory
try:
from urllib.parse import urlparse
except ImportError:
# Python 2.7
from urlparse import urlparse
def _encode_str(out):
as_string = out.decode('utf-8')
if as_string and as_string[-1... | 2,349 | 782 |
# imports - compatibility imports
from __future__ import print_function
from pipupgrade._compat import input
# imports - standard imports
import inspect
# imports - module imports
from pipupgrade.cli.parser import get_parsed_args
from pipupgrade.util import get_if_empty, merge_dict
_ACCEPTABLE_YES = ("", "y", ... | 1,138 | 436 |
from . import views
from django.contrib.auth import views as auth_views
from django.urls import path
urlpatterns = [ #Kari CSV_TO_TABLE Commit
path('csv_upload/', views.csv_table, name='csv_table'),
path('today/', views.today_table, name='today_table'),
path('search/', views.search, name='search'),
... | 321 | 104 |
from unittest import TestCase
from src.lineout.data import *
class TestDataUtils(TestCase):
def test_get_result_list(self):
sample_list = [{'id': 1, 'name': 'a'}, {'id': 2, 'name': 'b'}]
paginated = {
'count': 2,
'previous': None,
'next': None,
'resu... | 810 | 266 |
# import unittest
# import os
# from gateway.can.sdo.message import SdoMessage
# from gateway.can.sdo.message import CommandByte
# class TestSdoMessage(unittest.TestCase):
# def setUp(self):
# self.sdoMessage = SdoMessage.getMessege(0x1018,0x01,0x00)
# self.anotherMessage = SdoMessage.getMessege(0x2... | 738 | 317 |
from typing import List
import app.views.v1.misc
import app.db_models as db_models
from . import bp
from flask import request, jsonify
from loguru import logger
import flask_jwt_extended
import app.db_schemas as db_schemas
import app.utils.authentication_utils as authentication_utils
import app.actions as actions
... | 6,295 | 2,260 |
from Graphics import *
CELL_SIZE = 20
ROWS, COLUMNS = 40, 40
class Cell:
def __init__(self, pos):
self.pos = pos
self.alive = False
self.flipNextGen = False
def switch(self):
self.alive = not self.alive
def draw(self, win):
r = Rectangle(Point(self.pos[0], self.pos[... | 3,305 | 1,105 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
"""
Find the value of n ≤ 1,000,000 for which n/φ(n) is a maximum.
"""
from factorization import primefactorize, totient
def problem69():
"""
in fact, it can be solved by print 2*3*5*7*11*13*17... | 679 | 274 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import collections
import heapq
class Queue:
""" Basic queue implementation using collections.deque() """
def __init__(self):
self.elements = collections.deque()
def empty(self):
""" Test if queue is empty """
return len(self.eleme... | 5,018 | 1,544 |
# Binary Euler Tour
# A Binary Euler Tour base class providing a specialized tour for binary tree.
from eulerTour import EulerTour
class BinaryEulerTour(EulerTour):
"""Abstract base class for performing Euler tour of a binary tree.
This version includes an additional _hook_invisit that is called after the to... | 1,259 | 382 |
from django.contrib import admin
from base.conf import settings
admin.site.site_title = f'{settings.ICO_TOKEN_NAME} Wallet'
admin.site.site_header = f'{settings.ICO_TOKEN_NAME} Wallet Administration' | 200 | 68 |
from django.db import models
# Create your models here.
class Ingredient(models.Model):
account = models.CharField(max_length=255)
member = models.CharField(max_length=255)
ref_meal = models.CharField(max_length=255,blank=True)
ref_date = models.DateField(blank=True)
ingredient ... | 462 | 144 |