seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
3997891282
import asyncio import logging from aiohttp import web from jupiter_http.AuthFactory import auth_factory from jupiter_http.Jinja2Filter import datetime_filter from jupiter_http.Jinja2Setting import Jinja2SettingC from jupiter_http.LoggerFactory import logger_factory from jupiter_http.ResponseFactory import ...
dianbaer/jupiter
jupiter_http_test/AioInit.py
AioInit.py
py
2,560
python
en
code
142
github-code
90
18332704909
import sys input = sys.stdin.readline def calc(N, g): for k in range(N): for i in range(N): for j in range(N): g[i][j] = min(g[i][j], g[i][k] + g[k][j]) def main(): N, M, L = map(int, input().split()) adj = [{} for _ in range(N)] for _ in range(M): A, B, C...
Aasthaengg/IBMdataset
Python_codes/p02889/s701044419.py
s701044419.py
py
1,004
python
en
code
0
github-code
90
27644992635
import numpy as n import matplotlib.pyplot as plt import matplotlib.colors as colors import scipy.fftpack as fft import argparse # Creating ArgParse thing parser = argparse.ArgumentParser(description= 'enter following arguments: data_period, type of fourier transform, percent') parser.add_argument("data_period", type...
pranjagar/ComputationalMethods_HWs_PA
CompMethods_HW_5_PA.py
CompMethods_HW_5_PA.py
py
2,394
python
en
code
0
github-code
90
12845465368
from django.urls import path from django.views.decorators.cache import cache_page from .apps import AppBlogConfig from .views import ( PostCreateView, PostDetailView, PostListView, PostUpdateView, PostDeleteView ) app_name = AppBlogConfig.name urlpatterns = [ path('posts/', cache_page(60 * 2)...
IngAivar/Curse_work_6_-SkyStore-
app_blog/urls.py
urls.py
py
679
python
en
code
0
github-code
90
20451184820
import os import discord from discord.ext import commands import youtube_dl from discord import abc import requests import random import datetime import asyncio from bs4 import BeautifulSoup as bs from asyncio import sleep intents = discord.Intents.default() intents.members = True settings = { 'bot': 'Малюсенька...
Orxideja/Imperror
main.py
main.py
py
4,638
python
en
code
0
github-code
90
18480716779
import sys import math import fractions from collections import deque from collections import defaultdict sys.setrecursionlimit(10**7) H, W, K = map(int, input().split()) if W == 1: print(1) exit(0) pattern = [0] * (W - 1) total = 0 for i in range(2 ** (W - 1)): bit = format(i, 'b').zfill(W - 1) fla...
Aasthaengg/IBMdataset
Python_codes/p03222/s068211872.py
s068211872.py
py
1,407
python
en
code
0
github-code
90
18413733012
import os import csv # Path to collect data from the Resources folder pybank_csv = os.path.join('Resources', 'budget_data.csv') # declaring my list and variables total_months = [] profit_loss = [] change_profit_loss = [] # Read in the CSV file with open(pybank_csv, 'r') as csvfile: # Split the data on commas ...
wjriebel/Python-Challenge
**PyBank**/main.py
main.py
py
2,116
python
en
code
0
github-code
90
9203124516
import argparse import os import cv2 import termcolor import yaml from sklearn import model_selection from sklearn.metrics import accuracy_score, f1_score, classification_report import numpy as np from gomrade.classifiers.manual_models import ManualBoardStateClassifier, ManualBoardExtractor from gomrade.classifiers.k...
smolendawid/Gomrade
gomrade/classifiers/validate_full_images.py
validate_full_images.py
py
4,536
python
en
code
4
github-code
90
18413827239
import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり N = I() A = LI() from fractions import gcd L = [0]*N # L[i] = A[0]からA[i]までの最大公約数 R = [0]*N # R[i] = A[i]からA[N-1]までの最大公約数 for i in range(N-1): if i == 0: L[i] = A[...
Aasthaengg/IBMdataset
Python_codes/p03061/s164795600.py
s164795600.py
py
593
python
en
code
0
github-code
90
41218304847
# coding=utf-8 from reportlab.platypus import Paragraph, SimpleDocTemplate, Image from reportlab.lib.styles import getSampleStyleSheet import os import PIL # http://blog.csdn.net/kingken212/article/details/47209791 # http://blog.csdn.net/liangyuannao/article/details/8896563 def create_pic_pdf(filename): styleshe...
crystal0913/AI
crawler/creadepdf2.py
creadepdf2.py
py
1,912
python
en
code
1
github-code
90
25572094774
from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime import select import socket import threading from tests.unit.framework.common import get_socket _TCP_PROXY_BUFFER_SIZE = 1024 _TCP_PROXY_TIMEOUT = datetime.timedelta(milliseconds=500) def _i...
grpc/grpc
src/python/grpcio_tests/tests/unit/_tcp_proxy.py
_tcp_proxy.py
py
4,389
python
en
code
39,468
github-code
90
13929368433
from bson.objectid import ObjectId from great import db class Invite(): def __init__(self, id=0, user=None, classe=None, createdAt="", status=""): self.id = id self.user = user self.classe = classe self.createdAt = createdAt self.status = status def createInvite(self, i...
alanaecp/great-ui
great/models/Invite.py
Invite.py
py
1,520
python
en
code
0
github-code
90
73070402856
import json import os from copy import deepcopy from enum import Enum, auto from typing import List from google.cloud.datastore import Client, Entity from folker.decorator import loggable_action, resolvable_variables, timed_action from folker.logger import TestLogger from folker.model import Context, StageAction from...
felipehernandez/folker-test
folker/module/gcp/datastore/action.py
action.py
py
8,685
python
en
code
2
github-code
90
40433166399
#!/usr/bin/python3 def fill_gap(verb, noun,adjective): """ Fills the users input to spaces below returns story """ story = "After reading The Alchemst by Paulo Coelho i {0} that in life every step you is a step shorter towards achieving what the world has in store for you. We live thinking that {1} is just a pla...
Titus210/Python-High-level
worldly_programs/2-fill_gap.py
2-fill_gap.py
py
834
python
en
code
3
github-code
90
39068362776
#!/usr/bin/python3 import logging import os import urllib.parse import gi gi.require_version('Gtk', '3.0') gi.require_version('WebKit2', '4.0') from gi.repository import Gtk, WebKit2 from keyman_config import KeymanComUrl, _, __releaseversion__, __tier__ from keyman_config.accelerators import init_accel from keyma...
keymanapp/keyman
linux/keyman-config/keyman_config/downloadkeyboard.py
downloadkeyboard.py
py
4,558
python
en
code
307
github-code
90
22777746989
from parlai.scripts.display_model import DisplayModel from parlai.scripts.train_model import TrainModel from parlai.core.teachers import register_teacher, DialogTeacher from parlai.core.agents import register_agent, Agent import os from sys import argv import boto3 from botocore.client import Config from botocore.excep...
Seagate/cortx
doc/integrations/parlAI/training/train.py
train.py
py
4,734
python
en
code
631
github-code
90
34869517410
from typing import ( Sequence, overload, ) from pandas._typing import ( AnyArrayLike, DataFrame, Index, Series, ) # note: this is a lie to make type checkers happy (they special # case property). cache_readonly uses attribute names similar to # property (fget) but it does not provide fset and ...
pandas-dev/pandas
pandas/_libs/properties.pyi
properties.pyi
pyi
717
python
en
code
40,398
github-code
90
18007142279
from collections import Counter n = int(input()) can_use = Counter(input()) for _ in range(n-1): S = Counter(input()) for k in "abcdefghijklmnopqrstuvwxyz": can_use[k] = min(can_use[k], S[k]) ans = [] for k, v in can_use.items(): for _ in range(v): ans.append(k) ans.sort() print("".join(ans)...
Aasthaengg/IBMdataset
Python_codes/p03761/s406250674.py
s406250674.py
py
322
python
en
code
0
github-code
90
37134489342
#!/usr/bin/env python3.5 # -*- coding: utf-8 -*- """ Calculates and plots similarities between antigens and genes in pathogen and host populations. Does it separately for hosts and for pathogens. Created on Tue Nov 3 16:10:58 2015 for Evolutionary Biology Group, Faculty of Biology Adam Mickiewicz University, Pozn...
pbentkowski/MHC_Evolution
PyScripts/MHC_similiraty.py
MHC_similiraty.py
py
11,119
python
en
code
1
github-code
90
4786510432
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import argparse import json import gzip import shutil import logging import re import time import operator import ConfigParser from datetime import datetime from collections import namedtuple ParsedLine = namedtuple('ParsedLine', ('url', 'response_ti...
antipetrov/logalyze
log_analyzer.py
log_analyzer.py
py
11,147
python
en
code
0
github-code
90
73427203815
# -*- coding: utf-8 -*- # standard library imports from pathlib import Path # first-party imports import pytest import sh # module imports from . import ANN_PATH from . import FASTA_PATH from . import GENOME_PATH from . import GFF_PATH from . import fasta_count from . import line_count DOWNLOAD_URL = "http://generis...
legumeinfo/bionorm
tests/1prefixing_test.py
1prefixing_test.py
py
3,524
python
en
code
0
github-code
90
10930308954
from itertools import product light_dict = { 1 : ((2, 4, 9), (6, 12, 17)), 2 : ((10, 12, 15), (7, 13, 14)), 3 : ((2, 16, 20), (5, 7, 18)), 4 : ((8, 11, 14), (4, 7, 13)), 5 : ((6, 7, 16), (5, 10, 19)), 6 : ((2, 10, 13), (5, 8, 14), (6, 19)), 7 : ((9, 12, 15), (8, 11, 14)), 8 : ((3, 10, 2...
math-club/c0d1ngUP-2021
ford_test.py
ford_test.py
py
1,482
python
en
code
0
github-code
90
70904632937
import sys input = sys.stdin.readline s = input().rstrip() k = input().rstrip() def make_table(s): l, j = len(s), 0 table = [0] * l for i in range(1, l): while j > 0 and s[i] != s[j]: j = table[j - 1] if s[i] == s[j]: j += 1 table[i] = j return table...
dohun31/algorithm
2021/week_10/210907/16172.py
16172.py
py
661
python
en
code
1
github-code
90
18891046685
from PIL import ImageTk, Image import avlt.avl_model as avlt import mvc_base.model_double_child as mdc import mvc_base.view_double_child as vdc from core.constants import white, black, circle_node_text_modifier class AVLView(vdc.DCView): def __init__(self, node_width, node_height, columns_to_skip): supe...
MarcinKozak005/Educational-tree-GUI
avlt/avl_view.py
avl_view.py
py
2,388
python
en
code
0
github-code
90
23038407906
from state import State import random class PipesState(State): #in order to allow box drawing characters on windows cmd, the charset #is set to cp437 (see https://en.wikipedia.org/wiki/Code_page_437) #the charset is set via the cmd command 'chcp 437' characters = { 'line':{ 'up': 1...
robalb/python-phaser
demos/pipes/states.py
states.py
py
4,840
python
en
code
2
github-code
90
12721991681
import pygame pygame.init() dis=pygame.display.set_mode((600,600)) pygame.display.set_caption("TIC TAC TOE") yellow = (255, 255, 102) font_style = pygame.font.SysFont("bahnschrift", 25) def message(msg, color): mesg = font_style.render(msg, True, color) dis.blit(mesg, [100,300]) game_over=False ...
sairithish-17/my-projects
PONGGAME.py
PONGGAME.py
py
799
python
en
code
0
github-code
90
41003828541
import logging # logging.basicConfig(filename='../run.log', level=logging.INFO, format='[%(asctime)s][Signal]: %(message)s') class Signal(): def __init__(self,direction,price,size,order_type,instrument,logger): self.method = direction self.price = price self.amount = size self.ord...
w-dq/deribit-trading
strategy/Signal.py
Signal.py
py
1,469
python
en
code
1
github-code
90
73985108455
from parse_input import parseInput from part1 import reflect, valid_point import numpy as np def fold_paper_completely(paper, instructions): for ins in instructions: new_paper = set() for coord in paper: if valid_point(coord, ins): new_paper.add(reflect(coord, ins)) ...
amayomode/advent-of-code
2021/day 13/part2.py
part2.py
py
937
python
en
code
0
github-code
90
74919023976
import os import sys import fileinput import re replacements = {':::info':'<div class="alert alert-info" role="alert" markdown="1">', ':::warning':'<div class="alert alert-warning" role="alert" markdown="1">', ':::danger':'<div class="alert alert-danger" role="alert" markdown="1">', ':::success':'<div class="alert ale...
lemasyma/cours
parser.py
parser.py
py
853
python
en
code
8
github-code
90
16882894358
#!/usr/bin/env python3 import sha3 ## Joseph McGill ## Fall 2016 ## # A semi-pure implementation of Brent's cylce finding algorithm # It is modified to keep track of the previously found hashes # The SHA3 implementation used can be downloaded from here # https://github.com/bjornedstrom/python-sha3 # # This program is ...
Joseph-McGill/misc-implementations
python/brents_algorithm/brents_algorithm.py
brents_algorithm.py
py
2,912
python
en
code
0
github-code
90
40152153018
#!/usr/bin/env python3 from datetime import datetime, timedelta import os import subprocess import click import shutil from click.types import STRING import toml import yaml import json import tarfile from pathlib import Path import boto3 import requests import tarfile, io @click.group() @click.option( "--casper-...
CasperLabs/casper-kube
casper-tool.py
casper-tool.py
py
26,507
python
en
code
4
github-code
90
4586100052
so=[] while True: a=(input('')) if a=='': break so.append(float(a)) Trungbinh=sum(so)/len(so) DuoiTrungbinh=[] GiatriTrungbinh=[] TrenTrungbinh=[] for a in so: if a<Trungbinh: DuoiTrungbinh.append(a) elif a==Trungbinh: GiatriTrungbinh.append(a) else: TrenTrungbinh...
tkieuvt/CoSoLapTrinh123
Nhom5/Bai112.py
Bai112.py
py
542
python
vi
code
0
github-code
90
23902885221
class Data: def __init__(self, full_name, email, file_name, color): self.__full_name = full_name self.__email = email self.__file_name = file_name self.__color = color @property def full_name(self): return self.__full_name @full_name.setter def f...
BeSamara/HW6
main.py
main.py
py
2,397
python
en
code
0
github-code
90
29393801911
from coref.hylang import nsHYInit, nsHyEval, nsHyPipeline def _hylangInit(ns): nsHYInit(ns) return True _lib = { '/bin/hy': nsHyEval, '/bin/hy|': nsHyPipeline, } _init = { 1: { 'hylang': { 'start': _hylangInit, } }, } _mkdir = [ '/pbin', '/psbin', '/et...
vulogov/core.F
coref/stdlib/sys/hylang.py
hylang.py
py
337
python
en
code
0
github-code
90
18488582339
import sys,math,collections,itertools input = sys.stdin.readline N,M=list(map(int,input().split())) mn = M//N ml = M%N if ml == 0: print(mn) exit() ans = 0 for i in range(mn+1,0,-1): if i < ans: break tmp = math.gcd(i,M-i*(N-1)) ans = max(ans,tmp) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03241/s838222322.py
s838222322.py
py
288
python
en
code
0
github-code
90
74709872935
from setuptools import find_packages, setup import os, sys exec(open("image_tools/version.py").read()) github_url = "https://github.com/amirhamiri" package_name = "python-image-tools" package_url = "{}/{}".format(github_url, package_name) package_path = os.path.abspath(os.path.dirname(__file__)) long_description_fil...
amirhamiri/python-image-tools
setup.py
setup.py
py
2,238
python
en
code
29
github-code
90
19251151450
import cv2 import numpy import math from dataclasses import dataclass, fields G = 6.67*pow(10, -11) SCREEN_H = 100 SCREEN_W = 100 SCREEN_S = 5 RADIUS = 25 class OrbitSim: @dataclass class Object: x: float = 0 y: float = 0 color: tuple = (255, 255, 255) s...
AlessandroLibotte/OrbitSim
main.py
main.py
py
17,407
python
en
code
0
github-code
90
20937558341
""" This module has helper functions to make http requests to other apis. """ import requests import ocp_build_data.constants as app_constants import lib.constants as constants import traceback import os import yaml import time from ocp_build_data.models import OpenShiftCurrentAdvisory def get_all_ocp_build_data_bra...
Global19/art-dashboard-server
lib/http_requests.py
http_requests.py
py
7,405
python
en
code
null
github-code
90
7329792371
import sys import numpy as np import pandas as pd import importlib.util from sklearn import preprocessing # ignore pandas warnings import warnings warnings.filterwarnings('ignore') # metrics imports from math import sqrt from sklearn.metrics import ( mean_squared_error, r2_score , mean_absolute_error ) ...
PeterHamfelt/blitzml
blitzml/tabular/_regression.py
_regression.py
py
14,540
python
en
code
null
github-code
90
18324583799
Slist=input() Slist=Slist.replace("><",">,<").split(",") ans=0 for S in Slist: a=S.count("<") b=S.count(">") n=max(a,b) m=len(S)-n ans=ans+n*(n+1)//2+(m-1)*m//2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p02873/s613891240.py
s613891240.py
py
191
python
en
code
0
github-code
90
31757800734
from scipy.stats import poisson import threading from config import DEBUG from debug_utils import debug_print, stringify_queue, print_queue_status from utils import Message, MessageTransport, get_random_sample import time from message_types import READY_SUBSCRIBE, READY, SEND, GOSSIP_SUBSCRIBE, ECHO_SUBSCRIBE, GO...
diegochll/scalable-byzantine-reliable-broadcast-recreation
node.py
node.py
py
13,853
python
en
code
0
github-code
90
28945717846
import bw_app_ui import config import tkinter as tk import tkinter.ttk as ttk from tkinter import font as tkfont from tkinter import * from tkcalendar import Calendar, DateEntry from PIL import Image, ImageTk import tkinter.simpledialog from datetime import datetime # For date object from dateutil.relativedelta import...
mateo-ls/budget-wiz
AddTransactionPage.py
AddTransactionPage.py
py
9,392
python
en
code
3
github-code
90
24556837671
import time,re print('Hello, and welcome to my first simple project!\nI hope you like it! Have fun!') print() time.sleep(2) def enter_info(): global boy_name, vegetable, teacher_name, girl_name, vegetable1, boy_name1, vegetable2 while True: try: boy_name = input("Enter a boy's first name: ...
v-petrov/Python_ex
Projects/mad_libs.py
mad_libs.py
py
3,182
python
en
code
0
github-code
90
533956674
# https://www.hackerrank.com/challenges/the-minion-game def main(): s = input().strip() kevin = 0 stuart = 0 vowels = "AEIOU" slen = len(s) for i in range(slen): if vowels.find(s[i]) >= 0: kevin += (len(s) - i) else: stuart += (len(s) - i) if kevin ...
mbhushan/pycode
hr_py_strings/fast_minion.py
fast_minion.py
py
490
python
en
code
2
github-code
90
5363087796
from __future__ import absolute_import, division, print_function import logging import os import warnings from botocore.credentials import RefreshableCredentials from datacube.utils.aws import configure_s3_access from flask import Flask, request from rasterio.errors import NotGeoreferencedWarning from datacube_ows.o...
opendatacube/datacube-ows
datacube_ows/startup_utils.py
startup_utils.py
py
8,391
python
en
code
62
github-code
90
40370882217
import io import json import numpy as np from six.moves import urllib from torch_geometric_temporal.signal import StaticGraphTemporalSignal class TrafficDataLoader(object): def __init__(self, name_city): file= open('./data/data_%s.json'%name_city, "r") self._dataset = json.load...
fatemehsrz/Traffic_Framework
loader.py
loader.py
py
1,510
python
en
code
0
github-code
90
74157172777
import numpy as np from numpy.linalg import inv import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import gym e = gym.make('CartPole-v0') class Reward(): """ Reward is the class defining a reward function for the IRL problem. Reward is a linear combination ...
thomasw21/ReinforcementLearningMVAProject
utils/reward_general.py
reward_general.py
py
3,588
python
en
code
0
github-code
90
26156758204
# -*- coding: utf-8 -*- # 링크 : https://arisel.notion.site/14889-042afaa42d5c4b208ce9eba33b7e2f36 from sys import stdin from itertools import combinations class GoldenBalance(object): def __init__(self, n, arr): self.n = n self.arr = arr self._map = {i : [self.arr[i][j] + self.arr[j][i] for j in range(...
arisel117/BOJ
code/BOJ 14889.py
BOJ 14889.py
py
1,087
python
en
code
0
github-code
90
44577332137
from PyQt5 import QtCore, QtGui, QtWidgets import pyqtgraph import numpy import sql as s class Ui_SmashUI(object): # Sets up the UI layout (used Qt Designer to set up layout) def setupUi(self, SmashUI): # Tab Widget Setup / Initialize Theme self.tabWidget = QtWidgets.QTabWidget(SmashUI) s...
ianpeck/smashbrosgui
gui.py
gui.py
py
32,085
python
en
code
0
github-code
90
4613338912
import os, PyPDF2, json, time, defaults from selenium import webdriver from selenium.webdriver.firefox.options import Options class arxivScraper: def __init__(self, filedir = defaults.directory["Resource"], respdir = defaults.directory["Response"], bibdir = defaults.directory["Bibliography"]): self.fi...
jibran-bohra/arXivScraper
scraper.py
scraper.py
py
5,604
python
en
code
0
github-code
90
16090092177
import azure.cognitiveservices.speech as speechsdk import openai import asyncio import json from collections import namedtuple import tiktoken import time EOF = object() # Load config.json def load_config(): try: with open('config.json', encoding='utf-8') as f: config = json.load(f, object_hoo...
jackwuwei/gptspeaker
gptspeaker.py
gptspeaker.py
py
9,709
python
en
code
21
github-code
90
24426921350
"""Exercício 3 da Atividade Prática - Lógica de programação e Algorítimos""" print("Bem-vindo ao Exportation Logistic's Yuri Nogueira de Moraes") # Dicionário de rotas com suas respectivas informações routes = { "RS": ("De Rio de Janeiro até São Paulo", 1), "BS": ("De Brasília até São Paulo", 1.2), "BR": ...
yuri-moraes/logica_de_programacao_python
ex21.py
ex21.py
py
3,556
python
pt
code
0
github-code
90
40813320048
from selenium import webdriver from pyquery import PyQuery as pq def get_pq(url): options = webdriver.FirefoxOptions() options.add_argument('-headless') html = webdriver.Firefox(firefox_options=options) # set headless model html.get(url) doc = html.page_source doc = pq(doc) html.close() # print(doc) return ...
clearloveqi/A-simple-crawler----Amazon
getchildren.py
getchildren.py
py
1,425
python
en
code
0
github-code
90
44289854443
def compute(n): if n < 2: return n else: return compute(n - 1) + compute(n - 2) num = int(input()) for i in range(num): print(compute(i), end = " ") # def fib(n): # if n <= 1: # return n # else: # return fib(n - 1) + fib(n - 2) # def compute(n): # ...
SoraneYuki/TQC-Python
第五類/PYA510.py
PYA510.py
py
711
python
en
code
0
github-code
90
10402595666
from selenium.webdriver.support.ui import Select # from selenium.webdriver.common.keys import Keys from BaseToPage.base_mail_page import * from BaseToPage.base_page import * # import time # from selenium.common.exceptions import NoSuchElementException class MailPage(BasePage): def type_in_fields(self): ...
kAntonQA/qa.intita_ui_autotest
Python_course/pages/mail_page.py
mail_page.py
py
1,794
python
en
code
0
github-code
90
10281378809
from http.server import BaseHTTPRequestHandler, HTTPServer from threading import Thread from typing import Optional result: Optional[str] class WebserverThread(Thread): result: Optional[str] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.result = None def ru...
nrubin29/scrobblefix
from_api/webserver_thread.py
webserver_thread.py
py
812
python
en
code
0
github-code
90
11597652295
import sqlite3 #RM: practice SQLite on another python file need to connect to database and create a cursor Python code required #connectdatabase = sqlite3.connect("customers.db") #cursorc = connectdatabase.cursor() #connecttotemporarydatabaseinmemory = sqlite3.connect(":memory:") connectdatabase = sqlite3.connect("c...
raymondmar61/pythonsql
sqlitedatabase.py
sqlitedatabase.py
py
7,913
python
en
code
0
github-code
90
6178450928
import os class IPPairsGenerator(): def __init__(self, ip_pairs_dict): self.ip_pairs_dict = ip_pairs_dict def jwkj_get_filePath_fileName_fileExt(self, file_path): (filepath, tempfilename) = os.path.split(file_path) (shortname, extension) = os.path.splitext(tempfilename) # fil...
parahaoer/AnalyzeChecksum
IPPairsGenerator.py
IPPairsGenerator.py
py
2,028
python
en
code
0
github-code
90
18500087469
import math N,K = list(map(int,input().split(" "))) nums = (K) * [0] for i in range(1,N+1): nums[i%K] += 1 ans = 0 for a in range(K): b = (K-a) % K c = (K-a) % K if (2 * K - 2 * a) % K != 0: continue # print("a,b,c = ",a,b,c) # print("nums:",nums) ans += nums[a] * nums[b] * nums[c...
Aasthaengg/IBMdataset
Python_codes/p03268/s102574980.py
s102574980.py
py
333
python
en
code
0
github-code
90
2179394711
class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: req_map = defaultdict(list) for a, b in prerequisites: req_map[a].append(b) visit = set() def dfs(course): if not req_map[course]: return T...
wlyu1208/Leet-Code
0207-course-schedule/0207-course-schedule.py
0207-course-schedule.py
py
705
python
en
code
1
github-code
90
2467033640
import numpy as np import matplotlib.pyplot as plt #import sounddevice as sd import pygame import time from random import randrange import threading import wave def CharListToInt(list): hex_dict = { '0' : 0x0, '1' : 0x1, '2' : 0x2, '3' : 0x3, '4' : 0x4,...
Crask21/Mobile-Robotsystems
Protocol/Physical/Class_DTMF.py
Class_DTMF.py
py
10,619
python
en
code
1
github-code
90
18361428729
L = list(input()) n = len(L) a = [] b = [] for i,l in enumerate(L): if l =='R': a.append(i) else: b.append(i) from bisect import bisect_left M = [] for i,l in enumerate(L): if l=='R': j = bisect_left(b,i) idx = b[j] M.append((l,idx)) else: j = bisect_left(...
Aasthaengg/IBMdataset
Python_codes/p02954/s284786550.py
s284786550.py
py
700
python
en
code
0
github-code
90
33557997229
from __future__ import print_function import os import shutil import tempfile import functools import warnings from six import StringIO from mock import Mock, patch from os.path import join from zope.interface import implementer, directlyProvides from twisted.trial import unittest from twisted.test import proto_helpe...
meejah/txtorcon
test/test_torconfig.py
test_torconfig.py
py
61,698
python
en
code
245
github-code
90
22763952583
from fastapi import FastAPI import datetime import asyncio import logging from .firstnames import FIRSTNAMES from random import randrange, choice from pydantic import BaseModel from fastapi_utils.timing import add_timing_middleware START_DATE = datetime.datetime(1900, 1, 1, 0, 0, 0, 0) END_DATE = datetime.datetime.now...
xganneval-ma/test_api
test_api/adapters/create_app.py
create_app.py
py
1,610
python
en
code
0
github-code
90
19434036553
#!/bin/python3 from subprocess import run, DEVNULL import os import argparse from progress.bar import Bar build_dir = ".build" output_dir = "pdf" uid_template = "template.tex" states = ["debug", "release"] state = "release" def tempStore(): """Sets up the build location to store all the intermediate data befo...
liamlaing/uid_pdf_printer
id_testpaper.py
id_testpaper.py
py
2,520
python
en
code
0
github-code
90
33369172607
# creamos la conexion con la BD import json import pymysql from collections import Counter import os import time import openai import tiktoken import config conn = pymysql.connect(user=config.user, password=config.password, host=config.host, database=config.database) cursor = conn.cursor() # Guarda l...
clausoriano/Clustering-y-clasificacion-de-errores-en-usuarios-de-AppInventor
data_processing_and_analysis/tags.py
tags.py
py
7,776
python
en
code
0
github-code
90
24632797732
import argparse import logging import textwrap from pathlib import Path from typing import Any, List, Optional, Sequence, Union from craft_cli.dispatcher import _CustomArgumentParser from juju_spell import utils from juju_spell.cli.base import JujuWriteCMD from juju_spell.commands.config import ApplicationConfig, Con...
gabrielcocenza/juju-spell
juju_spell/cli/config.py
config.py
py
3,440
python
en
code
null
github-code
90
33179385189
import random import math import os import numba import numpy as np import pygame from scipy.ndimage import gaussian_filter from numba import cuda from numba.cuda.random import create_xoroshiro128p_states, xoroshiro128p_uniform_float32 SCREEN_WIDTH = 1000 SCREEN_HEIGHT = 1000 SCALE = 1 TPB = (16, 16) RANDOM_START =...
m235917b/swarms
ants.py
ants.py
py
10,106
python
en
code
0
github-code
90
18909311635
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import dearpygui.dearpygui as dpg import random import dbm import json from collections import deque from Trie import DTrie """ # Helper classes/functions - CONTEXT - get_words # viewport/windows - main - add_word_filter_window - add_recently_searched_window ...
gkegke/Trie-Dictionary
simple_gui.py
simple_gui.py
py
7,328
python
en
code
0
github-code
90
9209150267
from keras.preprocessing.image import ImageDataGenerator from keras.models import load_model import os #load the model model = load_model('dogs_and_cats_tl_weights.h5') # summary of the model model.summary() #set up base and test directories base_dir = '/Users/NavSha/Documents/tensorflow-projects/cats_and_dogs_small...
NavSha/transfer-learning
test.py
test.py
py
702
python
en
code
0
github-code
90
71369913576
import unicodedata from ref_geo.models import BibAreasTypes, LAreas from geonature.utils.env import DB from pypnnomenclature.models import TNomenclatures from sqlalchemy import and_, desc, func, or_ from sqlalchemy.sql.expression import select from utils_flask_sqla.generic import GenericQuery from .api_error import Z...
PnX-SI/gn_module_ZH
backend/gn_module_zh/search.py
search.py
py
17,655
python
en
code
3
github-code
90
24446036487
# -*- coding: utf-8 -*- """This functions are based on my own technical analysis library: https://github.com/bukosabino/ta You should check it if you need documentation of this functions. """ import pandas as pd import numpy as np """ Volatility Indicators """ def bollinger_hband(close, n=20, ndev=2): mavg = ...
bukosabino/financial-forecasting-challenge-gresearch
ta.py
ta.py
py
3,076
python
en
code
40
github-code
90
41900884201
from simplex_method import SimplexMethod import copy class GomoryMethod(SimplexMethod): def __init__(self, num_vars: int, constraints: list, objective_function: tuple): """ The method calls the constructor of the SimplexMethod parent class and initializes the parameters of the simplex algorithm. ...
AndreyRysistov/GomoryMethod
ObjectOrientedApproach/gomory_method.py
gomory_method.py
py
6,391
python
en
code
2
github-code
90
40246109254
import shutil import tempfile from django.test import Client, TestCase, override_settings from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse from django.conf import settings from posts.forms import PostForm, CommentForm from posts.models import Post, Group, User, Comment T...
iliakoll/project_Yatube
yatube/posts/tests/test_forms.py
test_forms.py
py
5,034
python
en
code
0
github-code
90
35167367736
from random import randrange, randint t = 150 f = open("biginput.txt", "w") f.write(str(t) + "\n") # percent chance, 0-100% def chance(percent): return randrange(100) < percent for c in range(t): n = randint(10000, 100000) # generate array b b = [0] * n # for random number of times, up to n/3...
colefuerth/ICPC
practice/beginner contest/QABC/gen.py
gen.py
py
1,299
python
en
code
0
github-code
90
71210341417
def part1(file): gamma = '' epsilon = '' with open(file, 'r') as f: lines = f.readlines() total = len(lines) count_arr = [0] * 12 for i in range(0, total): for j in range(0, 12): if lines[i][j] == '1': count_arr[j] += 1 for i in range(0, 12): if count_arr[i] ...
ArpanGyawali/Advent_of_code_2021
day_3.py
day_3.py
py
1,751
python
en
code
3
github-code
90
30574386419
import pathlib import configparser import json from itertools import chain import csv import pytest @pytest.fixture def empty_contents(tmp_path): return { "exam": {"a_text": "string", "b_text": "999"}, "pdf_exam": {"c_text": "home"}, "pdf_checker": {"d_text": "house"}, "DictReader...
agossino/p66
tests/conftest.py
conftest.py
py
4,988
python
en
code
0
github-code
90
6620202731
# 图片融合 import cv2 import numpy as np back = cv2.imread('C:\\Users\\joysu\\Pictures\\joysun\\2009.jpg') before = cv2.imread('C:\\Users\\joysu\\Pictures\\joysun\\20052.jpg') print(back.shape) print(before.shape) result = cv2.addWeighted(back, 0.7, before, 0.3, 0) # 0.7和0.3分别代表两张照片在融合时的权重 cv2.imshow('fuse', result) cv...
joysun545/WindowsOpencv_testOpencv
fuseImg.py
fuseImg.py
py
373
python
en
code
0
github-code
90
70323452136
import paho.mqtt.client as mqtt import pandas as pd data=[] client=mqtt.Client() client.connect('broker.hivemq.com',1883) print('Broker Connected') client.subscribe('gpcet/data') i=0 def notification(client,userdata,msg): global i k=msg.payload k=k.decode('utf-8') k=k.split(':') h=k[1] t=k[-...
maddydevgits/ml-dev-hackathon-2023-gpcet
activity-5/subscriber.py
subscriber.py
py
648
python
en
code
6
github-code
90
1993677185
import json from django.utils import timezone from datetime import datetime from channels.generic.websocket import AsyncWebsocketConsumer from gpsDatingApp.otherConfig.GroupNameConfig import GroupNameConfig from gpsDatingApp.otherConfig.LifeCycleConfig import LifeCycleConfig from gpsDatingApp.game.GameStateCode impor...
GitHub-WeiChiang/main
GpsDatingApp/Back-End/DjangoEnv/project/gpsDatingApp/consumer/GameConsumer.py
GameConsumer.py
py
4,910
python
en
code
7
github-code
90
40103523041
# Importing the modules import tkinter as tk import subprocess # Creating the main window window = tk.Tk() window.title("C++ to Assembly Converter") # Creating the input box for the C++ program input_box = tk.Text(window) input_box.pack() # Creating the output box for the assembly output output_box = tk.Text(window)...
jwcarlyon/Professional_work
python_based_C++_compilerExplorer/compiler_explorer.py
compiler_explorer.py
py
2,142
python
en
code
0
github-code
90
2233991028
class Solution: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: if not intervals: return 0 intervals.sort(key=lambda x: x[1]) # intervals.sort(key=lambda x: x[0]) max_val = intervals[0][1] min_num = 0 for interval in intervals[1:]: ...
vyshor/LeetCode
Non-overlapping Intervals.py
Non-overlapping Intervals.py
py
693
python
en
code
0
github-code
90
74779234856
from mrjob.job import MRJob from urllib.parse import urlparse import string string_punctuation = '!,.:;?' def n_grams(words_list, n): ngrams_list = [] if n > len(words_list): return ngrams_list for i in range(len(words_list)-n+1): tmp = ['']*n for j in range(n): tmp[j] ...
imaashishlk/norwegian-web-language-model
MRjob_N-grams/generate_1-gram.py
generate_1-gram.py
py
2,157
python
en
code
0
github-code
90
15757306901
from base import Arguments import os import sys import signal from manual import manual as man def signal_handler(sig, frame): print(' Bye!') sys.exit(1) def main(): signal.signal(signal.SIGINT, signal_handler) if len(sys.argv) == 1: print('Workon version 1.0') elif sys.ar...
DumiduPramith/workon-manager
module/workon.py
workon.py
py
557
python
en
code
0
github-code
90
6549038776
class Solution: def canPartition(self, nums): total=sum(nums) if total&1: return False target = total/2 nums.sort(reverse=True) def dfs(idx, target): if idx==len(nums): return target==0 num=nums[idx] ...
gycggd/Leetcode
code/416/Python/dfs.py
dfs.py
py
534
python
en
code
0
github-code
90
72972967978
from selenium import webdriver import time driver = webdriver.Chrome() driver.get('http://127.0.0.1:8000/') assert "Welcome, You Are Not Logged In" in driver.page_source time.sleep(2) print("OK") driver.quit()
Abimanyu-TheProgrammer/Python_Environment
Scripts/story-10_v2/func_test.py
func_test.py
py
214
python
en
code
0
github-code
90
18224233269
from django.db.models import Count from django.shortcuts import render, get_object_or_404 from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView, FormView from django.contrib.auth.views import LoginView, LogoutView from .models import Post, Category, Comment, Gallery, Site, Skill, Sub...
SuperWallaby/gf-blog
blog/views.py
views.py
py
10,938
python
en
code
0
github-code
90
7767315569
from turtle import Turtle, Screen, pensize, title import random as rd title("Random walk") screen = Screen() screen.bgcolor("white") milo = Turtle() milo.heading() milo.speed(1) directions = [0, 90, 180, 270] colors = ["CornflowerBlue", 'green', 'red', 'wheat', 'yellow', 'violet', "orange"] milo.shape('turtle') milo.p...
M-RAY47/Turtle-graphic
random_walk.py
random_walk.py
py
467
python
en
code
0
github-code
90
2274494205
from django.contrib.auth import get_user_model from rest_framework import serializers from rest_framework.generics import get_object_or_404 from rest_framework.relations import SlugRelatedField from reviews.models import Comment, Review, Title, Category, Genre User = get_user_model() class SignupSerializer(serializ...
David18704/api_yamdb
api_yamdb/api/serializers.py
serializers.py
py
4,124
python
en
code
0
github-code
90
41133930388
import pytest import numpy as np import pandas as pd from curvefit.uncertainty.residual_model import _ResidualModel, SmoothResidualModel from curvefit.utils.smoothing import local_deviations, local_smoother def test_residual_model(): rm = _ResidualModel( cv_bounds=[1e-4, np.inf], covariates={'far...
ihmeuw-msca/CurveFit
tests/uncertainty/test_residual_model.py
test_residual_model.py
py
5,127
python
en
code
192
github-code
90
8082002606
"""Main entry point for the bot. You should not run this file directly. Instead, run it via `python -m bot`. """ import os import asyncio import dotenv from .rulebot import Rulebot bot = Rulebot() async def main() -> None: """Asynchronous entry point for the bot.""" if not os.path.exists(".env"): ...
interrrp/rulebot
bot/__main__.py
__main__.py
py
697
python
en
code
0
github-code
90
20003294285
#!/usr/bin/env python3 import os, glob, shutil, platform if platform.system() == 'Windows': source_root = os.getenv('MESON_SOURCE_ROOT') build_root = os.getenv('MESON_BUILD_ROOT') dest_dir = 'release' install_prefix = os.getcwd() bin_dir = os.path.join(install_prefix, dest_dir, 'bin') if...
robertoesteves13/opengl-backup
install.py
install.py
py
1,167
python
en
code
0
github-code
90
12331113156
# -*- coding: utf-8 -*- """ Low level API for loading of word embedding file that was implemented in `word2vec <https://code.google.com/archive/p/word2vec/>`_, by Mikolov. This implementation is for word embedding file created with ``-binary 0`` option (the default). """ from __future__ import absolute_import, divisio...
koreyou/word_embedding_loader
word_embedding_loader/loader/word2vec_text.py
word2vec_text.py
py
2,927
python
en
code
3
github-code
90
161943131
def findroot(s): start = 0 end = 1 ''' abcddeffab s[start:end] --> a s[start:end] --> ab ''' for i in range(0,len(s),1): #boolean expression #Bigger Idea: And are short circuited # AND - If the first condition fails the rest is ignored. This makes it possible # to do lenght checks and have p...
PMiskew/contest_problems
DWITE/cs4hs1.py
cs4hs1.py
py
1,470
python
en
code
1
github-code
90
18527073549
from collections import defaultdict from itertools import permutations N, C = map(int,input().split()) D = [] for _ in range(C): D.append(list(map(int,input().split()))) c = [] for _ in range(N): c.append(list(map(int,input().split()))) P = [defaultdict(int) for _ in range(3)] for i in range(N): for j in ...
Aasthaengg/IBMdataset
Python_codes/p03330/s529596708.py
s529596708.py
py
571
python
en
code
0
github-code
90
4663311196
from django.shortcuts import render from django.core.files import File from django.http import JsonResponse, HttpResponse, FileResponse import json import inflect import mimetypes from pathlib import Path import os from rest_framework.decorators import api_view,permission_classes from rest_framework import permi...
firstclick6820/youtube_api
base/views.py
views.py
py
6,359
python
en
code
0
github-code
90
74726941737
import curses import config screen=curses.initscr() curses.noecho() player = '@' # arranging the map map = [] for i in range(24): map.append(['.']*80) list=config.CONFIG.split('\n') #READING THE MAP FROM CONFIG for x in range(len(list)-1): line = list[x] if not line.strip(): continue elif line[0] == 'R': R...
nir04m/myschoolfile
pythonfile/assignment2.py
assignment2.py
py
2,246
python
en
code
0
github-code
90
36162390744
import numpy as np from os.path import join def read_dataset(parent_dir, files, pad=False): dataset = [] for file in files: filepath = join(parent_dir, file) with open(filepath, 'r') as f: lines = [] f.next() # discard first line for i in range(500): ...
aclapes/SinglePixel
reader.py
reader.py
py
2,244
python
en
code
0
github-code
90
7324993485
from flask import Flask app = Flask(__name__) # Import flask and template operators from flask import Flask, render_template # Import SQLAlchemy from flask.ext.sqlalchemy import SQLAlchemy # Define the WSGI application object app = Flask(__name__) # Load default configuration (dev) app.config.from_object('app.confi...
markhumphrey/flask-app-template
app/__init__.py
__init__.py
py
1,751
python
en
code
0
github-code
90
9260265571
#short circuiting is_friend = True is_user = False #print(is_friend and is_user) # if is_friend and is_user: #have both true # print('best friend forever') # if is_friend or is_user: #one of this is true # print('best friend forever')
MBee05/Section4_Python_basic2
Py_b/5short_circuiting.py
5short_circuiting.py
py
260
python
en
code
0
github-code
90