text string | size int64 | token_count int64 |
|---|---|---|
from app import create_app, db
from flask_migrate import Migrate
from app.models import User, Posts
from flask_script import Manager,Server
app = create_app()
# manager = Manager(app)
# manager.add_command('server', Server)
# #Creating migration instance
# migrate = Migrate(app, db)
# manager.add_command('db',Migrate... | 545 | 182 |
# Админка раздел редактор курсов
# Энпоинты меню редактора курсов ДШ в тек. уг
path_admin_schedules_grade_1 = '/schedules?grade=1&school=true&'
path_admin_schedules_grade_2 = '/schedules?grade=2&school=true&'
path_admin_schedules_grade_3 = '/schedules?grade=3&school=true&'
path_admin_schedules_grade_4 = '/schedules?gra... | 2,354 | 960 |
from .loader import *
from .swagger import *
def parse(url,deep=5,**kwargs):
source = load_url(url,**kwargs)
return Swagger(source,deep=deep)
def parse_file(path,deep=5):
source = load_file(path)
return Swagger(source,deep=deep)
| 248 | 89 |
with open("input/input07.txt") as f:
content = f.read().splitlines()
positions = list(map(lambda x: int(x), content[0].split(",")))
max_pos = max(positions)
min_pos = min(positions)
possible_pos = range(min_pos, max_pos + 1)
fuel_costs1 = []
for align_pos in possible_pos:
fuel_costs1.append(sum([abs(pos - al... | 963 | 370 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright © 2018 PocketBudgetTracker. All rights reserved.
Author: Andrey Shelest (khadsl1305@gmail.com)
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 Licens... | 2,227 | 686 |
"""
Copyright (C) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | 5,305 | 1,531 |
import os
import time
import unittest
import bitcoin.rpc
import grpc
import lnd_grpc.lnd_grpc as py_rpc
import lnd_grpc.protos.rpc_pb2 as rpc_pb2
# from google.protobuf.internal.containers import RepeatedCompositeFieldContainer
#######################
# Configure variables #
#######################
CWD = os.getcwd... | 19,686 | 6,690 |
# Copyright 2018 TVB-HPC contributors
#
# 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 applicab... | 3,683 | 1,432 |
#
# 20. Valid Parentheses
#
# Q: https://leetcode.com/problems/valid-parentheses/
# A: https://leetcode.com/problems/valid-parentheses/discuss/9214/Kt-Js-Py3-Cpp-Stack
#
class Solution:
def isValid(self, A: str) -> bool:
s = []
for c in A:
if c == '(': s.append(')')
elif c... | 484 | 180 |
import common
lines = common.read_file('2016/23/data.txt').splitlines()
# part 1
eggs = 7
# part 2
eggs = 12
registers = dict(a=eggs, b=0, c=0, d=0)
def get_val(val_spec):
if val_spec in registers.keys():
return registers[val_spec]
return int(val_spec)
def is_reg(val_spec):
return val_spec in r... | 1,474 | 578 |
"""
This module contains functions that are imported and called by the
server whenever it changes its running status. At the point these
functions are run, all applicable hooks on individual objects have
already been executed. The main purpose of this is module is to have a
safe place to initialize eventual custom modu... | 798 | 211 |
from django.urls import path
from . import views
urlpatterns = [
path('register/student/', views.StudentCreate.as_view(), name='student-register'),
path('register/prof/', views.ProfCreate.as_view(), name='prof-register'),
path('remove/student/<pk>/', views.StudentRemove.as_view(), name='student-remov... | 407 | 133 |
import sys
from dataclasses import dataclass
from io import StringIO
from pathlib import Path
from typing import Any
import numpy as np
from sklearn.model_selection import StratifiedKFold
from utils.logger import logger
from .artifacts import ExperimentArtifacts
INPUT_COLUMNS = [
"Time", "V1", "V2", "V3", "V4", ... | 3,272 | 1,127 |
# 4.Crie uma lista que vá de 1 até 100.
list = [ cont for cont in range(1,101)]
print(list) | 92 | 42 |
"""Fig. 3 from Heitzig & Hiller (2020) Degrees of individual and groupwise
backward and forward responsibility in extensive-form games with ambiguity,
and their application to social choice problems. ArXiv:2007.07352
drsc_fig3:
v1: i
├─╴dont_hesitate╶─╴w3: lives ✔
╰─╴hesitate╶─╴v2: i
├─╴try_after_all╶─... | 1,385 | 556 |
def fib(n):
if (n<2):
return n
return fib(n-2) + fib(n-1)
fib(30)
| 82 | 43 |
from dataclasses import dataclass
from bindings.csw.code_type_1 import CodeType1
__NAMESPACE__ = "http://www.opengis.net/ows"
@dataclass
class Role(CodeType1):
"""Function performed by the responsible party.
Possible values of this Role shall include the values and the
meanings listed in Subclause B.5.5... | 414 | 140 |
from .image_generator import *
| 31 | 9 |
import warnings
import urllib
warnings.filterwarnings("ignore", category=UserWarning)
from fuzzywuzzy import fuzz
from bs4 import BeautifulSoup
from discogstagger.crawler import WebCrawler
class LyricsSearcher:
def __init__(self, artist_name):
self.artist_name = artist_name
self.url_base = "http:... | 1,847 | 603 |
"""
Just some text transformation functions related to our
conditions-related workarounds
"""
# Borrowed from parliament. Altered with normalization for lowercase.
def translate_condition_key_data_types(condition_str):
"""
The docs use different type names, so this standardizes them.
Example: The conditio... | 1,478 | 412 |
# -*- coding: utf-8 -*-
import sys
import re
from .input import Input
from ..exceptions import NoSuchOption, BadOptionUsage, TooManyArguments
class ArgvInput(Input):
def __init__(self, argv=None, definition=None):
super(ArgvInput, self).__init__(definition)
if argv is None:
argv = ... | 7,798 | 2,129 |
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from bs4 import BeautifulSoup as bs
def send_mail(email, password, FROM, TO, msg):
# initialize the SMTP server
server = smtplib.SMTP("smtp.gmail.com", 587)
# connect to the SMTP server as TLS mode (secure) a... | 1,528 | 484 |
# flake8: noqa
from .base import Base
from .item import Item, ItemCreateModel, ItemModel
from .user import User, UserCreateModel, UserModel
| 140 | 41 |
#!/usr/bin/python3
# direwatch
"""
Craig Lamparter KM6LYW, 2021, MIT License
modified by W4MHI February 2022
- see the init_display.py module for display settings
- see https://www.delftstack.com/howto/python/get-ip-address-python/ for the ip address
"""
import sys
import argparse
import time
from netifaces import... | 3,371 | 1,151 |
from __future__ import division
import hashlib
import logging
import os
import re
__all__ = [
'is_unsplitable',
'get_root_of_unsplitable',
'Pieces',
]
UNSPLITABLE_FILE_EXTENSIONS = [
set(['.rar', '.sfv']),
set(['.mp3', '.sfv']),
set(['.vob', '.ifo']),
]
logger = logging.getLogger(__name__)
... | 7,007 | 2,156 |
gs2 = gridspec.GridSpec(3, 1)
for ss in gs2:
ax = fig.add_subplot(ss)
example_plot(ax)
ax.set_title("")
ax.set_xlabel("")
ax.set_xlabel("x-label", fontsize=12)
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5) | 232 | 120 |
from __future__ import print_function, division
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import random
import model
from torch.autograd import... | 5,679 | 1,666 |
from argparse import ArgumentParser
from datetime import datetime
from os import path, listdir, getcwd, chdir
import subprocess
from dateutil.parser import parse as dt_parse
from ruamel.yaml import YAML
def transform_posts(src_dir, dest_dir, featured_path=None):
featured = load_featured(featured_path) if feature... | 5,203 | 1,649 |
"""Copyright (c) 2018 Great Ormond Street Hospital for Children NHS Foundation
Trust & Birmingham Women's and Children's NHS Foundation Trust
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 withou... | 4,262 | 1,183 |
import pygame
import lib.common as common
# initializing module
pygame.init()
class Clock:
__instance = None
# implementing this class as singleton
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
cls.__instance = super().__new__(cls)
return cls.__instance
... | 639 | 188 |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Social Network Analysis module group project 2020',
author='Dean Power',
license='',
)
| 231 | 72 |
from __future__ import annotations
from jigu.core import AccAddress, Coins
from jigu.util.serdes import JsonDeserializable, JsonSerializable
from jigu.util.validation import Schemas as S
from jigu.util.validation import validate_acc_address
__all__ = ["Input", "Output"]
class MultiSendIO(JsonSerializable, JsonDeser... | 994 | 329 |
class RegressionSystemID:
def __init__(self):
self.initialized = False
def initialize(self, n, m, K=None, learning_rate=0.001):
self.initialized = True
self.n, self.m = n, m
self.T = 0
self.K = K if K != None else np.zeros((m, n))
self.lr = learning_rate
... | 1,743 | 647 |
"""
A package dedicated to a memory related components, interfaces and utilities.
""" | 85 | 20 |
""" Vertical Order Traversal On Binary Tree
"""
from collections import defaultdict
class Node:
""" class representing node in binary tree """
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def preorder(root, horizontal_dist, hd_map):
if root is No... | 1,121 | 387 |
import torchvision.transforms as transforms
import torch
import torchvision
__author__ = "Dublin City University"
__copyright__ = "Copyright 2019, Dublin City University"
__credits__ = ["Gideon Maillette de Buy Wenniger"]
__license__ = "Dublin City University Software License (enclosed)"
def get_train_set():
tra... | 1,452 | 476 |
import cProfile
import functools
import logging
import pstats
import sys
import six
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.DEBUG)
_stream_handler = logging.StreamHandler(sys.stdout)
_stream_handler.setLevel(logging.DEBUG)
_logger.addHandler(_stream_handler)
def profile(
fn=None, sor... | 1,018 | 326 |
import helper_funcs.spline
import helper_funcs.plotter
import helper_funcs.grid | 79 | 26 |
import os
import sys
from urllib.parse import urlencode
from flask import Flask, Response, abort, request, stream_with_context, jsonify
from flask_restx import Api, Resource, fields, reqparse
import requests
from qwc_services_core.api import CaseInsensitiveArgument
from qwc_services_core.app import app_nocache
from q... | 3,948 | 1,168 |
class BoneGroups:
active = None
active_index = None
def new(self, name="Group"):
pass
def remove(self, group):
pass
| 153 | 51 |
from matplotlib import pyplot as plt
# data speding from Federal Government Plan
planes = ['Transferência para saúde', 'FPE e FPM', 'Assistência Social',
'Suspensão de dívidas da União', 'Renegociação com bancos']
spend = [8, 16, 2, 12.6, 9.3]
plt.axis("equal")
plt.pie(spend, labels=planes, ... | 403 | 173 |
import unittest
from nexusmaker import CognateParser
class TestCognateParser(unittest.TestCase):
def test_simple(self):
self.assertEqual(CognateParser().parse_cognate('1'), ['1'])
self.assertEqual(CognateParser().parse_cognate('10'), ['10'])
self.assertEqual(CognateParser().parse_cogn... | 9,817 | 3,508 |
from django.contrib import admin
from django.urls import path
from . import views
from django.conf.urls import url
urlpatterns = [
path('',views.home,name='home'),
path('register/',views.register,name='register'),
path('login/',views.Login,name='login'),
path('logout/', views.logout_view, name='logou... | 867 | 293 |
# Copyright (c) 2020 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... | 32,810 | 9,742 |
def normalize(values, gammas):
"""Adjust a list of brightness values according to a list of gamma values.
Given a list of light brightness values from 0.0 to 1.0, adjust the value
according to the corresponding maximum brightness in the gamma list. For
example::
>>> gammas = [0.3, 1.0]
... | 661 | 243 |
import sys
import cv2 # it is necessary to use cv2 library
import numpy as np
# https://docs.opencv.org/4.5.2/d4/dc6/tutorial_py_template_matching.html
def main( input_filename, template_filename ):
img = cv2.imread(input_filename,0)
template = cv2.imread(template_filename,0)
w, h = template.shape[::-1]
... | 1,407 | 609 |
n = int(input())
s = input()
bcnt = [0]*n
wcnt = [0]*n
result = 2 * 10 ** 5
# 累積和
if s[0] == "#":
bcnt[0] = 1
if s[n-1] == ".":
wcnt[n-1] = 1
for i in range(1,n):
bcnt[i] = bcnt[i-1]
if s[i] == "#":
bcnt[i] += 1
for i in range(n-2,-1,-1):
wcnt[i] = wcnt[i+1]
if s[i] =... | 516 | 294 |
#!/usr/bin/env python3
"""Script for Tkinter GUI chat client."""
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import tkinter
from tkinter import filedialog, Tk
import os
import time
def recv_file():
print("file request from ")
fname = client_socket.recv(BUFSIZ).decode("utf8")
... | 9,413 | 3,211 |
import wexpect
import time
import sys
import os
here = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, here)
from long_printer import puskas_wiki
print(wexpect.__version__)
# With quotes (C:\Program Files\Python37\python.exe needs quotes)
python_executable = '"' + sys.executable + '" '
... | 1,689 | 539 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 10:17:51 2020
description : Sampling methods from sir space to data space
author : bveitch
version : 1.0
project : EpidPy (epidemic modelling in python)
Usage:
Data fitting in least squares fit
Also acts on labels for data ... | 3,694 | 1,339 |
"""
API to sanitation session.
Sanitation session allows having a state within a single sanitation
process.
One important thing stored to the session is a secret key which is
generated to a new random value for each sanitation session, but it
stays constant during the whole sanitation process. Its value is never
reve... | 4,597 | 1,423 |
import pyb
def callb(timer):
print("Interval interrupt")
print(timer)
def callbTimeout (timer):
print("Timeout interrupt")
print(timer)
print("Test Timers")
t1 = pyb.Timer(1)
t2 = pyb.Timer(2)
t1.interval(2000,callb)
t2.timeout(5000,callbTimeout)
t1.freq(1)
print("f t1:"+str(t1.freq()))
t1.period(204000000)
... | 573 | 278 |
import json
import os
import tempfile
import unittest
from unittest.mock import patch
from waterfalls import Viewer, viewer
class TestViewer(unittest.TestCase):
"""
Tests the `waterfalls.Viewer` module.
"""
def test_detect_overlap(self) -> None:
"""
Tests detecting overlap of timing ... | 17,219 | 5,325 |
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit import PromptSession,prompt,print_formatted_text
from reflect.style import *
import os
from prompt_toolkit.shortcuts import clear
from prompt_toolkit.formatted_text import FormattedText
def get_menu(menu_items):
message = []
for k in menu_... | 4,491 | 1,457 |
from matrix import Matrix as CMatrix
from py_matrix import PyMatrix
def test(matrix_class, rows=3, columns=2):
m = matrix_class([
[column for column in range(row * columns, row * columns + columns)]
for row in range(rows)
])
# # or
# m = matrix_class([
# [1, 2],
# [3, 4... | 636 | 225 |
def answer(numbers):
ans = numbers[0]
for i in numbers[1:]:
ans ^= i
return ans
| 100 | 35 |
import datetime
import json
from django.conf import settings
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from horizon import exceptions, tables
from horizon_telemetry.forms import DateForm
from horizon_telemetry.utils.influ... | 3,947 | 1,086 |
from unittest import TestCase
from util.boyer_moore_search import z_array
from util.boyer_moore_search import boyer_moore, BoyerMoore
__author__ = 'Yifei'
class TestBoyerMooreSearch(TestCase):
def test_z_array(self):
# Test Case 0
s = 'aabcaabxaaaz'
n = len(s)
z = z_array(s)
... | 1,983 | 924 |
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.shortcuts import render, redirect
# Create your views here.
def loginUser(request):
if request.method == 'POST':
email_address = request.POST['email']
... | 1,668 | 400 |
import random
nouns = ["автомобиль", "лес", "огонь", "город", "дом"]
adverbs = ["сегодня", "вчера", "завтра", "позавчера", "ночью"]
adjectives = ["веселый", "яркий", "зеленый", "утопичный", "мягкий"]
def get_jokes(count: int) -> list:
#формируем список состящий из фраз. Каждая фраза содержит по три слова, которые сл... | 1,335 | 535 |
#
# Dates and Times in Python: Dates & Time
# Python Techdegree
#
# Created by Dulio Denis on 12/24/18.
# Copyright (c) 2018 ddApps. All rights reserved.
# ------------------------------------------------
# Challenge 4: strftime & strptime
# ------------------------------------------------
# Challenge Task 1 of 2... | 1,140 | 398 |
from google.appengine.ext import ndb
class Dresseur(ndb.Model):
tirage = ndb.KeyProperty(kind='Tirage')
nomig = ndb.StringProperty()
codeami = ndb.StringProperty()
| 177 | 68 |
# Generated by Django 2.1.4 on 2019-11-18 11:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_resetpassword'),
]
operations = [
migrations.RemoveField(
model_name='resetpassword',
name='expires_at',
... | 331 | 114 |
#!/usr/bin/python
from __future__ import division
from __future__ import with_statement
import matplotlib
from matplotlib import rcParams
from matplotlib import pyplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d import Axes3D
from PIL import Image
#import Image
from pylab import *
... | 22,410 | 7,195 |
from hata import Client
MELON : Client
#@MELON.commands.from_class
#class prefix:
# pass
#@MELON.commands.from_class
#class slowmode:
# pass
#@MELON.commands.from_class
#class logs:
# pass
#@MELON.commands.from_class
#class warn:
# pass
#@MELON.commands.from_class
#class mute:
# pass
#@MELON.comma... | 568 | 237 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Implementation of linting support over LSP.
"""
import json
import pathlib
import sys
from typing import Dict, Sequence, Union
# Ensure that will can import LSP libraries, and other bundled linter libraries
sys.path.appe... | 5,837 | 1,869 |
from .webapi import WebAPI
| 27 | 9 |
from pybloom import BloomFilter
if __name__ == '__main__':
total_items = 9585058
error = 0.01
bf = BloomFilter(capacity=total_items, error_rate=error)
for i in range(total_items):
bf.add(i)
cf = 0
ct = 0
for i in range(total_items, 2*total_items):
if i in bf:
c... | 422 | 180 |
# Generated by Django 2.1.7 on 2019-10-31 16:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0032_auto_20191008_2022'),
]
operations = [
migrations.AddField(
model_name='dataset',
name='doi',
... | 397 | 147 |
from .cmdline import CmdUtils
class AzRole:
def __init__(self):
self.subscription = None
self.id = None
self.name = None
self.principalId = None
self.principalName = None
self.principalType = None
self.roleDefinitionName = None
self.roleDefinitionId ... | 2,411 | 686 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-24 18:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_babycrib'),
]
operations = [
migrations.CreateModel(
... | 950 | 299 |
#!/usr/bin/env python3
PKG = 'test_harmoni_speaker'
# Common Imports
import unittest, rospy, rospkg, roslib, sys
#from unittest.mock import Mock, patch
# Specific Imports
from actionlib_msgs.msg import GoalStatus
from harmoni_common_msgs.msg import harmoniAction, harmoniFeedback, harmoniResult
from harmoni_common_lib... | 1,880 | 587 |
"""
An utility class for initializing different explainer objects.
"""
from torch import nn
import numpy as np
from captum.attr import DeepLift, IntegratedGradients, ShapleyValueSampling, LayerGradCam, Saliency
from captum.attr._utils.attribution import LayerAttribution
class Explainer(nn.Module):
def __init__(s... | 3,996 | 1,159 |
from django.shortcuts import render
from . import forms
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate,login,logout
# Create your views here.
@login_required... | 2,188 | 599 |
from django.conf import settings
from django.contrib import admin
from geotrek.common.admin import MergeActionMixin
from geotrek.outdoor.models import Practice, SiteType
if 'modeltranslation' in settings.INSTALLED_APPS:
from modeltranslation.admin import TranslationAdmin
else:
TranslationAdmin = admin.ModelAdm... | 708 | 221 |
from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from apiclient.http import MediaFileUpload
import gdown
def gdrive... | 3,516 | 1,280 |
import pytest
from pathlib import Path
@pytest.mark.parametrize("module", ["S_2", "S_3", "C2v14"])
def test_load(driver, module: str):
driver.go("/")
driver.driver.find_element_by_css_selector(f'a[data="{module}"]').click()
driver.wait_complete()
driver.check_svg(f"{module}_load.svg")
@pytest.mark.p... | 705 | 270 |
def init():
# @TODO(aaronhma): UPDATE
def catchErrors():
# @TODO(aaronhma): UPDATE | 91 | 36 |
import os, logging
from foresight.environment.git.git_helper import GitHelper
from foresight.environment.git.git_env_info_provider import GitEnvironmentInfoProvider
from foresight.environment.github.github_environment_info_provider import GithubEnvironmentInfoProvider
from foresight.environment.gitlab.gitlab_environmen... | 5,905 | 1,671 |
import math
import os
import random
import re
import sys
def plusMinus(arr):
posNums=0.0
negNums=0.0
zeroNums=0.0
posFraction=0.0
negFraction=0.0
zeroFraction=0.0
arrLen=len(arr)
for i in range(arrLen):
if arr[i]==0:
zeroNums+=1
elif arr[i]>0:
po... | 660 | 267 |
#!/usr/bin/env python3
"""Start the godoc server and open the docs in a browser window.
This uses the 'open' command to open a web browser.
"""
import argparse
import http
import http.client
import subprocess
import time
def is_ready(host, port):
"""Check if the web server returns an OK status."""
conn = h... | 1,403 | 422 |
import glob
import os
import random
import re
import sys
import numpy as np
import bio
import config
def align( read, siteA, siteB, mapper_name, rm=True, alt_pos=1000, correct_pos=3000, single_insertion=False ):
prefix = 'tmp/tmp%i' % random.randint(1, 1e9)
# make fastq
fastq = '%s.fastq' % prefix
with open... | 19,371 | 7,572 |
class MissingValueException(Exception):
pass
class ProductScrapeException(Exception):
pass
class GetPageException(Exception):
pass
class NoResultsException(Exception):
pass
| 195 | 54 |
"""Extend user table
Revision ID: e3dda7be6a95
Revises:
Create Date: 2021-06-07 11:43:45.144088
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "e3dda7be6a95"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.add_column("auth_... | 393 | 172 |
"""In a small town the population is p0 = 1000 at the beginning of a year.
The population regularly increases by 2 percent per year and moreover 50 new
inhabitants per year come to live in the town.
How many years does the town need to see its population greater or equal to p = 1200 inhabitants?
1) At the end of the f... | 1,752 | 694 |
#!/usr/bin/python3
import threading
import time
import PySimpleGUI as sg
"""
DESIGN PATTERN - Multithreaded Long Tasks GUI using shared global variables
Presents one method for running long-running operations in a PySimpleGUI environment.
The PySimpleGUI code, and thus the underlying GUI framework, ru... | 4,144 | 1,161 |
from io import StringIO
from django.core.management import call_command
import os
from . import utils
class ImportMemberTest(utils.BaseTest):
def test_dry_run(self):
dir_path = os.path.dirname(os.path.realpath(__file__))
csv = f"{dir_path}/../fixtures/members.csv"
out = StringIO()
... | 1,838 | 529 |
def greet(bot_name, birth_year):
print('Hello! My name is ' + bot_name + '.')
print('I was created in ' + birth_year + '.')
def remind_name():
print('Please, remind me your name.')
name = input()
print('What a great name you have, ' + name + '!')
def guess_age():
print('Let me guess your age... | 1,385 | 490 |
# -*- coding: utf-8 -*-
"""
AQSmtpClient Module.
This class provides utilities to use a Smtp client.
"""
from pineboolib.fllegacy.flsmtpclient import FLSmtpClient
class AQSmtpClient(FLSmtpClient):
"""AQSmtpClient Class."""
pass
| 241 | 98 |
from typing import List
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from assistant.orders.models import Order
from assistant.products.models import Product
class DashboardViewMixin(LoginRequiredMixin):
title: str = None
breadcrumbs: List = []
... | 871 | 245 |
import os
import datetime
import pandas as pd
from chmap.settings.app import App
from chmap.database.db_classes import *
from chmap.database.deprecated.db_funs import init_db_conn
from sqlalchemy.orm import joinedload
# Assume that we are using images from the 'reference_data' setup supplied with repo
# manually s... | 2,024 | 747 |
from ..sensor import ArgDict, Sensor
class Announcer(Sensor):
_argtypes: ArgDict = {
"value": str
}
def __init__(self, value: str = "ON", **kwargs):
super().__init__(**kwargs)
self._value = value
def fire(self):
self._loop.publish(self.name, self._value)
| 308 | 103 |
def selection_11():
# Library import
import numpy
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Library version
matplotlib_version = matplotlib.__version__
numpy_version = numpy.__version__
# Histo binning
xBinning = numpy.li... | 85,669 | 78,414 |
from fastapi import FastAPI, status, HTTPException, Response, APIRouter, Depends
from sqlalchemy.orm import Session
from typing import List
from .. import schemas, models, utils #You can move up 2 steps using ..
from ..database import get_db
router = APIRouter(
prefix="/users",
tags=['users']
)
@router.post... | 1,286 | 419 |
import os
import requests
import json
import pathlib
from abc import ABCMeta, abstractmethod
from .news import News, print_format_markdown, print_format_telebot
KEY_PATH = pathlib.Path(os.path.dirname(__file__), "../..")
class NewsCollector(metaclass=ABCMeta):
@abstractmethod
def format_news(self):
... | 7,295 | 2,196 |
Normalize mean=[0.1307] std=[0.3081]
ReLU
[[-0.02289694733917713, -0.0015768347075209022, -0.007779418025165796, -0.018946761265397072, 0.009356001392006874, -0.01212845928966999, -0.019499225541949272, 0.014134012162685394, -0.022251857444643974, 0.03429203853011131, 0.007956764660775661, 0.01797821931540966, 0.0398... | 982,074 | 959,319 |
# Renewable generation at Findhorn
from windpowerlib import WindFarm
from windpowerlib import WindTurbine
from windpowerlib import WindTurbineCluster
from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain
import pvlib
from pvlib.pvsystem import PVSystem
from pvlib.location import Location
from pvl... | 9,282 | 2,754 |
"""Tests for the minio component."""
| 37 | 11 |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Hive-ml project of OneApp',
author='Ravikant Bade',
license='MIT',
)
| 213 | 72 |
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
import os
import requests
app = dash.Dash(external_stylesheets=[dbc.themes.JOURNAL])
server = app.server
search_url = "https://api.twitter.com/2/t... | 1,985 | 649 |