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
44902733283
# -*- coding: utf-8 -*- import os import unittest from typing import List, Dict from camelback.case_converter import CaseStyleEnum, case_convert_to_style, case_convert_stream, case_convert, get_casing_style class TestCaseConversion(unittest.TestCase): SNAKE_CASE_FILE = os.path.join(os.path.dirname(__file__), 'b...
codyd51/camelback
tests/test_case_conversion.py
test_case_conversion.py
py
3,428
python
en
code
2
github-code
90
7671164285
""" git_remote_hg.test: testcases for git_remote_hg ================================================ Actually there are no "tests" as such just yet. This is simply here out of habit, since I use it to sync the main docstring with README.rst. """ import os import unittest import git_remote_hg class TestDocstrin...
rfk/git-remote-hg
git_remote_hg/test.py
test.py
py
1,101
python
en
code
41
github-code
90
18274089809
n,k=map(int,input().split()) l=list(map(int,input().split())) maxi=0 suml=sum(l[:k]) maxl=sum(l[:k]) for i in range(n-k): if suml-l[i]+l[k+i]>maxl: maxl=suml-l[i]+l[k+i] maxi=i+1 suml=suml-l[i]+l[k+i] sumsum=0 for j in range(maxi,maxi+k): sumsum+=(l[j]+1)/2 print(sumsum)
Aasthaengg/IBMdataset
Python_codes/p02780/s054269747.py
s054269747.py
py
299
python
en
code
0
github-code
90
30836026654
def execute_scripts_from_file(cursor, filepath: str): """Opens an SQL script an runs every query in it. In case of an error, the function will print the error message to the terminal. Parameters ---------- filepass: str The full path to the sql query. """ fd = open(filepath, 'r') ...
LolipopnJoker/Inventory_Project
Python/python_function_reading_sql.py
python_function_reading_sql.py
py
594
python
en
code
2
github-code
90
1220452671
# Importando a Biblioteca do Python import pandas as pd def Leitura_Tratamento_Dados_Arduino(): # Nome do arquivo csv com os dados do arduino arquivo = 'dados_do_arduino.csv' # DataFrame Pandas com os dados do arduino data = pd.read_csv(arquivo) # Transformando as leituras em inteiros (int) data = data['Senso...
Persapius/PID-soil-moisture
PlotGrafico.py
PlotGrafico.py
py
1,507
python
pt
code
0
github-code
90
18455121429
n=int(input()) h=list(map(int,input().split())) ans=0 temp=[0]*n while True: a=0 b=1 cnt=1 for i in range(n): if h[i]!=temp[i]: temp[i]=temp[i]+1 a=1 b=0 elif a==1: cnt=cnt+1 a=0 b=1 if b==1: cnt=cnt-1 ans=ans+cnt if sum(temp)==sum(h): break print(ans)
Aasthaengg/IBMdataset
Python_codes/p03147/s363610214.py
s363610214.py
py
318
python
en
code
0
github-code
90
19361667414
#!/usr/bin/env python # # This script is needed to patch heaplog from the device: it converts all FW # addresses there into corresponding symbolic names. # # Invoke with `--help` option to get list of options with description. # # See the file ./README.md for usage example. # import subprocess import argparse import ...
cesanta/mongoose-os
tools/heaplog_viewer/heaplog_symbolize.py
heaplog_symbolize.py
py
3,179
python
en
code
2,425
github-code
90
18060105689
from itertools import product s = str(input()) a = list(product(['+', ''], repeat=len(s)-1)) ans = 0 tmp = "" for i in a: tmp = "" for j in range(len(s)-1): tmp += (s[j]+i[j]) tmp += s[len(s)-1] ans += eval(tmp) print(ans)
Aasthaengg/IBMdataset
Python_codes/p04001/s027958018.py
s027958018.py
py
250
python
en
code
0
github-code
90
24472282898
N = int(input()) for _ in range(N): pages, location = list(map(int, input().split())) new_location = location queue = list(map(int, input().split())) queue = [(i, idx) for idx, i in enumerate(queue)] count = 0 while True: if queue[0][0] == max(queue, key=lambda x: x[0])[0]: ...
LazyMG/coding-test
fastcampus/backjoon/ch1/1966.py
1966.py
py
522
python
en
code
0
github-code
90
18205177389
n=int(input()) a=[] b=[] for i in range(n): tmpa,tmpb = map(int,input().split()) a.append(tmpa) b.append(tmpb) a.sort() b.sort() if n%2==1: print(b[n//2] - a[n//2] +1) else: print((b[n//2]+b[n//2-1]) - (a[n//2]+a[n//2-1]) +1)
Aasthaengg/IBMdataset
Python_codes/p02661/s627098023.py
s627098023.py
py
249
python
en
code
0
github-code
90
18058289939
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): a = int(input()) b = int(input()) h = int(input()) res = ((a + b) * h) // 2 print(res) if __name__ == '__main__': resolve()
Aasthaengg/IBMdataset
Python_codes/p03997/s770873677.py
s770873677.py
py
250
python
en
code
0
github-code
90
4174341832
from unittest import TestCase from unittest.mock import Mock, patch, sentinel, call from gnucashcategorizer.suggester import Suggester, Suggestion, NoSuggestion class TestSuggester(TestCase): def test_get_suggestions(self): splits = [ sentinel.split_1, sentinel.split_2, sentinel.split_3, senti...
seddonym/gnucash-categorizer
tests/test_suggester.py
test_suggester.py
py
6,165
python
en
code
0
github-code
90
22830634994
import logging import threading import OPi.GPIO as GPIO import opz_ha.defaults as defaults from opz_ha.devices import ReedSwitch from opz_ha.utils import check_config, get_mode logger = logging.getLogger(__name__) def constructor(*a, **k): _ = ReedSwitch(*a, **k) def launcher(mqttc, modestring, config): ...
untergeek/opz_ha
opz_ha/launcher/reedswitch.py
reedswitch.py
py
2,107
python
en
code
0
github-code
90
39634292969
from statistics import mean GRADES = [ (28, 30, 5), (24, 27, 4), (21, 23, 3), (18, 20, 2), (15, 17, 1), (0, 14, 0) ] def get_grade(summed): for low, high, grade in GRADES: if low <= summed <= high: return grade def parse_points(points): grades = [] for test...
SamimiesGames/itslearning
osa-4/6/arvosanatilasto.py
arvosanatilasto.py
py
1,483
python
en
code
3
github-code
90
18336374069
a, b = map(int, input().split()) roota = int(a ** 0.5) def pcheck(n): rootn = int(n ** 0.5) for i in range(2, rootn + 2): if n % i == 0: return False return True pa = [] for i in range(2, roota + 2): if a % i == 0: pa.append(i) while a % i == 0: a //= i ...
Aasthaengg/IBMdataset
Python_codes/p02900/s198830347.py
s198830347.py
py
471
python
en
code
0
github-code
90
18217451859
import sys n = int(input()) si = [] for _ in range(n): s = input() l = 0 r = 0 count = 0 for i in range(len(s)): if s[i] == "(": count += 1 else: count = max(0, count-1) l = count count = 0 for i in range(len(s)-1, -1, -1): if s[i] == ")": ...
Aasthaengg/IBMdataset
Python_codes/p02686/s871733119.py
s871733119.py
py
893
python
en
code
0
github-code
90
22708471338
# -*-codeing=utf-8-*- # @Time:2022/5/1510:50 # @Author:xyp # @File:CIE.py # @Software:PyCharm import tool get_message=[] hide_pic_pix=[] codebook={0:[0,0],1:[1,0],2:[2,0],3:[3,0],4:[-2,1],5:[-1,1],6:[0,1],7:[1,1],8:[2,1],9:[3,1],10:[-2,2],11:[-1,2],12:[0,2],13:[1,2], 14:[2,2],15:[3,2],16:[-3,-2],17:[...
18281765528/picture_handle
CIE.py
CIE.py
py
1,933
python
en
code
0
github-code
90
5155279841
matrizEntradas = [[1,-1, 1,-1], [1, 1, 1, 1]] pesos = [-1,-1,0,0] target = [1, 1] aprendizado = 0.25 def calculaNet(entradas, pesos): if len(entradas) != len(pesos): print("tamanho entradas diferente de pesos") exit() net = 0 i=0 for a in entradas: net =...
vlucasx/PGC
aprendizado.py
aprendizado.py
py
1,757
python
pt
code
0
github-code
90
75072836775
from __future__ import annotations from . import util from collections import namedtuple from typing import TYPE_CHECKING, Match, Any import re import xml.etree.ElementTree as etree try: # pragma: no cover from html import entities except ImportError: # pragma: no cover import htmlentitydefs as entities if ...
Python-Markdown/markdown
markdown/inlinepatterns.py
inlinepatterns.py
py
35,530
python
en
code
3,429
github-code
90
20815448401
import os, sys, glob import cv2 import numpy as np import matplotlib.pyplot as plt from pdf2image import convert_from_path from image_processing_tools import * img_directory = "../../Soma_Draw/img_save/data/" ## override directory path excluded = [".ipynb_checkpoints", "unprocessed", "cyan", "red", "scaled"] names = [...
hci-dance-visuals/sensor-drawings
latent_steps_visualizer/sketch_feature_extractor/webdraw_feature_extractor.py
webdraw_feature_extractor.py
py
2,148
python
en
code
1
github-code
90
43188205225
import ipywidgets as ipw import traitlets from aiida.orm import StructureData, Float, Str, BandsData from aiida.plugins import WorkflowFactory from aiida.engine import submit from wizard import WizardApp from codes import CodeSubmitWidget from util import load_default_parameters class ComputeBandsSubmitWidget(CodeS...
mbercx/aiidalab-qe
bands.py
bands.py
py
4,900
python
en
code
null
github-code
90
37833085185
# -*- coding: utf-8 -*- """ Created on Tue Sep 4 12:53:00 2018 @author: 李立宗 lilizong@gmail.com 《opencv图穷匕见-python实现》 电子工业出版社 """ from matplotlib import pyplot as plt #随机生成两组数组 #生成60粒直径大小在[0,50]之间的xiaoMI xiaoMI = np.random.randint(0,50,60) #生成60粒直径大小在[200,250]之间的daMI daMI = np.random.randint(200,250,60) #将xiaoMI和d...
taochangwan/learnOpencv
源代码及图像/chapter22/例22.1.py
例22.1.py
py
1,152
python
zh
code
1
github-code
90
2348420784
import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler class ReadStandardTimeFill: def __init__(self,Path): self.Master = pd.read_csv(Path,delimiter = ',',header = 0,na_values = -9999) self.Master = self.Master.set_index(pd.DatetimeIndex(pd.to_datetime(self.Maste...
June-Skeeter/Illisarvik_Processing
ReadStandardTimeFill.py
ReadStandardTimeFill.py
py
2,757
python
en
code
0
github-code
90
40592530151
# *args def sum_all(num1, num2, num3): return num1 + num2 + num3 print(sum_all(2, 3, 4)) # !To add any number of dynamic arguments def sum_all2(*nums): print(nums) # printing like a tuple -> (2, 3, 4) total = 0 for num in nums: total += num return total print(sum_all2(2, 3, 4)) prin...
tsabunkar/python_basic
functions/more.py
more.py
py
1,998
python
en
code
0
github-code
90
40820919144
import matplotlib.pyplot as plt # lib for graphs import random import numpy as np import math n = 10 N = 256 W0 = 150 Wmax = 1500 signals = np.zeros(N) W = np.arange(W0, Wmax + W0, W0) for w in W : A = random.random() phi = random.random() for t in range(N): signals[t] += A * math.sin(w * t + phi) ...
burbokop/rts
lab_1.1/lab_1.1.py
lab_1.1.py
py
497
python
en
code
0
github-code
90
17251475548
import re import socket import shutil import subprocess from datetime import datetime from typing import Optional, Sequence, Tuple, Dict, List, Any from netmonitor.monitors.monitor import Monitor class PingMonitor(Monitor): def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, ...
pseudorandomuser/netmonitor
netmonitor/monitors/pingmonitor.py
pingmonitor.py
py
2,170
python
en
code
0
github-code
90
23408118748
# -*- coding: utf-8 -*- import json import time import threading import os.path from utils import Console SHL = Console("EmotesHandler") filename = os.path.join("app", "emotes", "emotes.json") class Emotes: def __init__(self, start): self.emotes = {} self.runCheck = start self.emit_sta...
FI18-Trainees/FISocketChat
src/app/emotes/emote_handling.py
emote_handling.py
py
1,354
python
en
code
4
github-code
90
13794034687
from __future__ import unicode_literals from django.db import models from NAPS.settings import MEDIA_ROOT import re import datetime import random #import the Classifier class from /classify/classify.py from classification import classification #import the Extractor class from /extractor/extract.py from Text_extractor ...
sean-tu/NAPS
articles/models.py
models.py
py
4,685
python
en
code
0
github-code
90
72052677736
# house.py 01/12/2014 D.J.Whale # # The house follows the garden outside_temp to monitor it. # It also has a catflap that can be remotely controlled. # Written using the (simpler) IOT wrapper # You can only have one owner and one node per script using the IOT wrapper. import IoticLabs.IOT as IOT # CONFIGURATION -...
ForToffee/demo
house.py
house.py
py
1,811
python
en
code
0
github-code
90
4423416915
def repeatedString(s,n): ''' A function that takes a string s and an integer n as inputs. Consider the first n elements of the infinite string s+s+s+..., and identify the number of times the letter 'a' occurs in this section of the inifinite string. An iterative process is not desirable for n>10^6. Time ...
jd1618/Python-Codes
Hackerrank/Problem_Solving_Easy/Repeated_string.py
Repeated_string.py
py
683
python
en
code
1
github-code
90
33066445535
''' migration_72.py A module that adds a new field to the Tags table ''' from os.path import dirname, join import arcpy import domains arcpy.env.workspace = sde = join(dirname(__file__), 'local@electrofishing.sde') table_name = 'Tags' fldFREQUENCY = 'FREQUENCY' fldTRANSPONDER_FREQ = 'TRANSPONDER_FREQ' fldTRANSMITT...
agrc/electrofishing
scripts/migrations/migration_72.py
migration_72.py
py
2,690
python
en
code
0
github-code
90
24248617468
import math import time i = 1 v = [] factors = [] v.append(0) factors.append(1) qtd = 0 Q = 4 while(1): j = 1 div = 0 end = 0 if(i % 10000 == 0): print("i ", i) while j <= math.sqrt(i): if(i % j == 0 and j != 1): div = 1 v.append(j) tmp = i s = set([]) while tmp != 1: s.add(v[int(...
EnzoHideki/algo
sites/projecteuler/47.py
47.py
py
594
python
en
code
0
github-code
90
42261710047
""" Test for autocomplete command """ from core.base_test.tns_test import TnsTest from products.nativescript.tns import Tns # noinspection PyMethodMayBeStatic class AutocompleteTests(TnsTest): changed_to_enable = 'Restart your shell to enable command auto-completion.' changed_to_disable = 'Restart your shell ...
NativeScript/nativescript-tooling-qa
tests/cli/misc/autocomplete_tests.py
autocomplete_tests.py
py
1,650
python
en
code
4
github-code
90
25410597859
import pygame import time import random pygame.init() white=(255,255,255) red=(255,0,0) black=(0,0,0) green=(0,155,0) display_width=800 display_hieght=600 block_size=20 fps=20 AppleThickness=30 direction="right" img=pygame.image.load('Untitled.png') appleimg=pygame.image.load('apple.png') smallFont=pygame.font.SysFont...
vasujain00/slither-
23.py
23.py
py
7,745
python
en
code
0
github-code
90
7866070846
# https://school.programmers.co.kr/learn/courses/30/lessons/169199 from collections import deque def solution(board): n = len(board) m = len(board[0]) for i in range(n): for j in range(m): if board[i][j] == "R": x_s, y_s = i, j if board[i][j] == "G": ...
GitofHJH/Programmers-with-Python
Level_2/230425 리코쳇 로봇.py
230425 리코쳇 로봇.py
py
1,248
python
en
code
0
github-code
90
34627293830
import requests import mysql.connector from datetime import datetime import schedule import time API_KEY = "912c622485ebcccfe6e75ebb3dc2de10" API_CITY = "Kraków" API_ENDPOINT = f"https://api.openweathermap.org/data/2.5/weather?q={API_CITY}&appid={API_KEY}&appid={API_KEY}&units=metric&lang=pl" def fetch_weather(): ...
dominika-kotecka/weather.app
main.py
main.py
py
1,417
python
en
code
0
github-code
90
35168828406
#!/usr/bin/python3 """ "Echo" pattern for G810 keyboard requires keyboard module, which needs root access to hook into the keyboard """ import keyboard from time import sleep from color_codes import colors, RGB import subprocess from sys import stderr import threading from keys import * color1 = colors['blueviolet'] ...
colefuerth/g810-led-patterns
echo.py
echo.py
py
2,213
python
en
code
0
github-code
90
25585420961
from typing import List import lightgbm as lgb import numpy as np import pandas as pd import xgboost as xgb from sklearn import linear_model from sklearn.ensemble import GradientBoostingRegressor from sklearn.model_selection import GridSearchCV def res_statistic(data): print('_min', np.min(data)) print('_max...
chivalryq/rrcSpider
model/model.py
model.py
py
4,049
python
en
code
0
github-code
90
22181486814
# -*- coding: utf-8 -*- # Imports import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.decomposition import PCA from ...
thadley13/Youtube-Comments
initial_eda.py
initial_eda.py
py
5,935
python
en
code
0
github-code
90
9695278997
#!/usr/bin/python3 strip_comments_and_strings = True def evaluate_matches(lines, fn): errors = [] for lineno, line in enumerate(lines): if line.count('typedef'): errors.append( (fn, lineno+1, "Do not use \"typedef\". Use \"using\" instead.")) return errors # /end eva...
widelands/widelands
cmake/codecheck/rules/do_not_use_typedef.py
do_not_use_typedef.py
py
425
python
en
code
1,844
github-code
90
17981350559
n = int(input()) a = list(map(int, input().split())) a1, a2 = [],[] for index, i in enumerate(a, start=1): if index % 2 == 0: a2.append(i) else: a1.append(i) ans = [] if n % 2 == 0: ans = a2[::-1] + a1 else: ans = a1[::-1] + a2 print(" ".join(str(i) for i in ans))
Aasthaengg/IBMdataset
Python_codes/p03673/s463577715.py
s463577715.py
py
282
python
en
code
0
github-code
90
2608643471
import openai # openai.organization = 'org-nuoujL7o1bWpXExT4n9H9Xpy' with open ('./auto_bot_discord/gpt_key.txt','r') as f: api_key = f.read() # print(openai.Model.list()) def get_gpt_reply(api_key,query): openai.api_key = api_key model_engine = "text-davinci-001" prompt = query compl...
Yuxiang-M/Discord_bot_selenium
get_gpt_reply.py
get_gpt_reply.py
py
685
python
en
code
2
github-code
90
17974873039
N,K = map(int, input().split()) A = [int(i) for i in input().split()] A.sort() if A[-1] < K: print("IMPOSSIBLE") exit() from bisect import bisect_left flag = False for i in range(N): if A[i] == K: flag = True idx = bisect_left(A, K - A[i]) if idx < N and i != idx and A[idx] == K - A[...
Aasthaengg/IBMdataset
Python_codes/p03651/s430034835.py
s430034835.py
py
405
python
en
code
0
github-code
90
5118574867
#importando as bibliotecas from iqoptionapi.stable_api import IQ_Option import time, logging from datetime import datetime import getpass email = str(input("Digite seu Email: ")) senha = getpass.getpass('Digite sua Senha: ') API = IQ_Option(email, senha) API.connect()#connect to iqoption logging.disable(le...
favitor/teste
Bot.py
Bot.py
py
1,685
python
pt
code
0
github-code
90
1309575136
import sys is_tinypy = "tinypy" in sys.version if not is_tinypy: from boot import * import asm import disasm ################################################################################ RM = 'rm -f ' VM = './tinypy ' TINYPY = './tinypy ' TMP = 'tmp.txt' SANDBOX = '-sandbox' in ARGV def system_rm(fname): sy...
scrgiorgio/tinypy
tests.py
tests.py
py
30,137
python
en
code
0
github-code
90
23197698947
res = 0 c = '' d = 0 while c != '999': numb = int(input('Digite um numero [999 para parar]: ')) if numb == 999: c = str(numb) else: res += numb d += 1 print('Você digitou {} numeros e a soma entre eles foi {}'.format(d, res))
isacepifanioo/python
desafios/d65.py
d65.py
py
263
python
pt
code
2
github-code
90
70298207338
from torch import nn import math import torch from cogie.models import BaseModule from transformers import BertModel import numpy as np from tqdm import tqdm from sklearn.metrics import * def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class ConditionalLayerNorm(nn.Module): def __init__(s...
jinzhuoran/CogIE
cogie/models/ee/bert_casee.py
bert_casee.py
py
27,498
python
en
code
63
github-code
90
2339094632
''' 对原始数据进行归一化操作,并变成1-1的训练数据形式 ''' import os import numpy as np import tarfile import stat import netCDF4 as nc def Image_normalizeration(Image): print(Image.shape) x_norm = None for i in range(len(Image)): i = Image[i, :, :] _range = np.max(i) - np.min(i) image_norm = (i - np.min(...
dpp1013/GAN_tropical_cyclone
src/extractLatLon.py
extractLatLon.py
py
3,112
python
en
code
2
github-code
90
18487535929
n=int(input()) info=[list(map(int,input().split())) for i in range(n)] for cx in range(0,101): for cy in range(0,101): H=-10**20 lim=10**20 for l in info: x,y,h=l if h==0: lim=min(lim,abs(x-cx)+abs(y-cy)) else: ...
Aasthaengg/IBMdataset
Python_codes/p03240/s489264164.py
s489264164.py
py
492
python
en
code
0
github-code
90
17952104879
A,B,C,D,E,F = map(int,input().split()) water = set() sugar = set() s = 0 a = 0 b = 0 for i in range(30): for j in range(30-i): if 100*A*i+100*B*j <= F: water.add(100*A*i+100*B*j) water.remove(0) for i in range(3000): for j in range(3000-i): if C*i+D*j <= F: sugar.add...
Aasthaengg/IBMdataset
Python_codes/p03599/s197616012.py
s197616012.py
py
782
python
en
code
0
github-code
90
9675889328
import os import json # Co-Simulator imports import common import configurations_manager from default_directories_enum import DefaultDirectories from common.launching_manager import LaunchingManager class CoSimulator: """ Class representing the Co-Simulator tool Methods: -------- run(args...
multiscale-cosim/TVB-NEST
launcher/common/cosimulator.py
cosimulator.py
py
14,586
python
en
code
5
github-code
90
3391605544
from src import objects from src import utils from edamino.api import Embed from src.database import db import time from src.antispam.register import getLevel async def get_user_checkins(ctx, userId): timezone = time.timezone resp = await ctx.client.request('GET', f"check-in/stats/{userId}?timezone={-timezone ...
leafylemontree/nati_amino-bot
src/subcommands/userInfo.py
userInfo.py
py
2,886
python
es
code
5
github-code
90
37176620125
import pandas as pd import tensorflow as tf import cv2 import urllib import numpy as np from urllib.request import urlopen, urlretrieve from PIL import Image # Plant Spy AI Deep Learning Models : model_categorie = tf.keras.models.load_model('Models/model_LeNet1_Categorie_AllData_Softmax') model_healthy = tf.kera...
ielboulo/PlantSpy
PlantSpyModels.py
PlantSpyModels.py
py
10,085
python
en
code
0
github-code
90
18194476569
import sys def input(): return sys.stdin.readline().strip() def main(): K = int(input()) S = input() mod = 10 ** 9 + 7 n = len(S) ans = 0 fact =[1]*(K+n) factinv = [1]*(K+n) inv = [0,1] for i in range(2,K+n): fact[i] = (fact[i-1] * i) % mod inv.append((-inv[...
Aasthaengg/IBMdataset
Python_codes/p02632/s386908353.py
s386908353.py
py
708
python
en
code
0
github-code
90
37120458457
import sys import argparse #MonianHello #2020年3月25日 01:57:02 #--- table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr={} for i in range(58): tr[table[i]]=i s=[11,10,3,8,4,6] xor=177451812 add=8728348608 def enc(x): x=(x^xor)+add r=list('BV1 4 1 7 ') for i in range(6): r[s[i]]=table[x//58**...
MonianHello/BilibiliVideoDownloader
changeavtobv.py
changeavtobv.py
py
653
python
ja
code
2
github-code
90
72788008297
# -*- coding: utf-8 from flask import Flask, jsonify, request from models.db import db app = Flask(__name__) db.init_app(app) app.config.from_object('config') app.debug = app.config.get('DEBUG', False) from models.models import Title, Name from config import PAGE_SIZE @app.route('/movies/<int:page>/') def get_...
tdiak/imdbMoviesImporter
app.py
app.py
py
1,201
python
en
code
0
github-code
90
18428385519
MOD = 10 ** 9 + 7 CHARS = 'ACGT' def pos(ch): return CHARS.index(ch) def ok(s): if 'AGC' in s: return False l = list(s) for i in range(len(s) - 1): l[i], l[i + 1] = l[i + 1], l[i] if 'AGC' in ''.join(l): return False l[i], l[i + 1] = l[i + 1], l[i] retur...
Aasthaengg/IBMdataset
Python_codes/p03088/s248915004.py
s248915004.py
py
1,182
python
en
code
0
github-code
90
18530995569
def abc098_d(): n = int(input()) A = list(map(int, input().split())) ans = 0 rt = 0 total = 0 for lf in range(n): while rt < n: if total ^ A[rt] == total + A[rt]: total += A[rt] rt += 1 else: break ans += rt ...
Aasthaengg/IBMdataset
Python_codes/p03340/s390402639.py
s390402639.py
py
440
python
en
code
0
github-code
90
74845857896
import processamento as process import cv2 import webapi import time from flask import Flask from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) @app.route('/capturarFoto') def capturarFoto(): webapi.capturarImagem() time.sleep(30) # em segundos, para esperar a captura da imagem weba...
lucascalzavara/backend-pos
main.py
main.py
py
890
python
pt
code
0
github-code
90
10545894656
from decimal import Decimal, getcontext getcontext().prec=50000 pi = 0 for k in range(10000): pi += 1/Decimal(16)**k *\ (Decimal(4)/(8*k+1) - Decimal(2)/(8*k+4) - Decimal(1)/(8*k+5) - Decimal(1)/(8*k+6)) if k % 100 == 99: print(k, pi)
sillyemperor/langstudy
python/py3study/bignumber/pi.py
pi.py
py
295
python
en
code
0
github-code
90
156202670
#!/usr/bin/env python """ A unittest script for the Project module. """ import unittest import json from cutlass import Project from cutlass import MIXS, MixsException from CutlassTestConfig import CutlassTestConfig from CutlassTestUtil import CutlassTestUtil # pylint: disable=W0703, C1801 class ProjectTest(unitt...
ihmpdcc/cutlass
tests/test_project.py
test_project.py
py
10,246
python
en
code
5
github-code
90
37418432451
# 1. להכין רשימה של שמות # 2. ליצור לולאה אשר אומרת בוקר טוב ולילה טוב לכל שם ברשימה # 3. קודם הוא יגיד לכולם בוקר טוב ואחר כך הוא יגיד לכולם לילה טוב # Bonus - > שלב 3 לעשות בלולאה 1 mystr="itay shay raz noam" mylist=mystr.split() for i in mylist: print("good morning",i,"good night")
ZENEVA66/python_hw
hm_lesson3.py
hm_lesson3.py
py
418
python
he
code
0
github-code
90
34376760599
''' File to manage all dataset related stuff ''' import pandas as pd from PIL import Image import cv2 import torch from torch.utils.data.dataset import Dataset from torch.utils.data import DataLoader from torchvision import transforms from sklearn.model_selection import train_test_split from collections import Count...
MIDATA-UofT/Imbalance-Mitigation-Wendi-Qu
read_dataset.py
read_dataset.py
py
5,067
python
en
code
0
github-code
90
18198834369
n=int(input()) a=list(map(int,input().split())) a.sort() c=[0]*(10**6+1) ans=0 for i in range(n): x=a[i] if c[x]: continue else: if i<=n-2: if x!=a[i+1]: ans+=1 else: ans+=1 for j in range(x,10**6+1,x): c[j]=1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p02642/s747657531.py
s747657531.py
py
317
python
en
code
0
github-code
90
10744233735
#!/usr/bin/python import numpy as np import cupy as cp class GC: 'Gamma Correction' def __init__(self, img, mode,clip=1.0,gamma=0.5,bandwidth_bit=12): self.img = img #self.lut = lut self.mode = mode self.clip = clip self.gamma = gamma self.bandwidth_bit = bandwid...
eric612/CuPyISP
model/gac.py
gac.py
py
2,129
python
en
code
1
github-code
90
4709552216
# # Полный обход дерева решений с отсечением # import sys from datetime import timedelta from timeit import default_timer as timer from klasses import Task, STNode import prefix import nc import cut_prefix import children import loggging import ilayer def solve(task: Task, log2=sys.stdout, gap=None): """Обход де...
ukoloff/PCGTSP-BnB
playground/walk.py
walk.py
py
4,083
python
en
code
0
github-code
90
18198958109
from collections import Counter def solve(string): n, *a = map(int, string.split()) table = [True] * (10**6 + 1) ma = max(a) for _a in a: if table[_a]: for i in range(2 * _a, ma + 1, _a): table[i] = False return str(sum(table[k] for k, v in Counter(a).items() if...
Aasthaengg/IBMdataset
Python_codes/p02642/s912248543.py
s912248543.py
py
417
python
en
code
0
github-code
90
1220557582
import matplotlib.pyplot as plt # helper function for data visualization import numpy as np import torch import torchmetrics import cv2 import torch.nn as nn from scipy import ndimage from segmentation_models_pytorch.utils import base,functional from segmentation_models_pytorch.base.modules import Activation from seg...
FDU-VTS/DRAC
challenge1/utils.py
utils.py
py
4,650
python
en
code
9
github-code
90
19182820226
from datetime import datetime from rest_framework import serializers from django.core.files.base import ContentFile import base64 import random class Utils: def convertFromBase64ToFile(image, name): format, imgstr = image.split(';base64,') # type: ignore if format != None: ext = forma...
pparce/drf-backend
api/utils.py
utils.py
py
2,037
python
en
code
0
github-code
90
18313078665
#!/usr/bin/env python3 """ WhatTheFuzz's submission for the <CTF> challenge '<name>. This script can be used in the following manner: python3 ./solve.py <REMOTE/LOCAL> Args: param1: LOCAL will operate locally on the user's machine. REMOTE will connect to the CTF webserver and grab the flag. ...
WhatTheFuzz/CTFs
csaw/warm-up/password-checker/solve.py
solve.py
py
2,611
python
en
code
1
github-code
90
43411908390
class Hero(): def __init__(self, name, health, attackpower, armorNumber): self.health = health self.name = name self.attackpower = attackpower self.armorNumber = armorNumber def serang (self, lawan): print(self.name + ' menyerang ' + lawan.name) lawan....
edwwardz/Python
Object_oriented_program/practice.py
practice.py
py
1,431
python
en
code
0
github-code
90
13974582029
from flask import Flask, render_template, jsonify, request import json import process app = Flask(__name__) # secure our flask app with a secret sec_file = open('secret.json').read() secret = json.loads(sec_file) app.config['SECRET_KEY'] = secret['secret'] # render the chatbot page @app.route('/', methods=["GET", "P...
uknow4real/LetsChat
app.py
app.py
py
817
python
en
code
0
github-code
90
16457906566
import re import urllib.request import urllib.error import urllib.parse from selenium import webdriver from selenium.webdriver.chrome.options import Options def get(url): links=[] chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') dri...
Junewang0614/NetEase-Music
Get_Tag_infor/web_get.py
web_get.py
py
1,542
python
en
code
0
github-code
90
6384889598
from errors.base_error import BaseError class AuthenticationError(BaseError): INVALID_CREDENTIALS = 'INVALID_CREDENTIALS' def __init__(self, code: str): message = self._get_error_message_by_code(code) super(AuthenticationError, self).__init__(code, message) @staticmethod def _get_er...
EduardoThums/online-bookstore-challenge
errors/authentication_error.py
authentication_error.py
py
492
python
en
code
0
github-code
90
10557953846
baralho = int(raw_input()) while baralho: vet = range(1, baralho+1) # for card in vet: # print(card) vet.reverse() popados = '' virgula = False while not (len(vet) == 1): if virgula: popados = popados + ', ' popados = popados + str(vet.pop()) vet.inser...
CaiqueMitsuoka/Fatec3
ed/1110.py
1110.py
py
475
python
en
code
0
github-code
90
42955186738
from encodings import utf_8 import logging import sys import html import re from wsgiref.util import request_uri from twisted.internet import reactor from twisted.internet import error from twisted.web.server import Site from twisted.web.resource import Resource, NoResource LOGGER = logging.getLogger(__name__) THIS_...
asterisk/testsuite
lib/python/asterisk/realtime_test_module.py
realtime_test_module.py
py
20,186
python
en
code
30
github-code
90
19683367358
import tkinter as tk from tkinter import font from functools import partial from tkinter.constants import COMMAND, TRUE from Province import Province """ interface TuristicPlace { name: string; image?: string; description: string; cost: number; includes: string[]; } """ class Place(tk.Frame): def __...
misaelvillaverde/parcial1_algoritmos
src/Place.py
Place.py
py
2,175
python
en
code
0
github-code
90
22249323386
#!/usr/bin/python # -*- coding: UTF-8 -*- from __future__ import division import pandas as pd import numpy as np import matplotlib.pyplot as plt def day_diff(ts, order=1): y=pd.Series(ts) for i in range(order): y=y.groupby(by=y.index.date).transform(pd.Series.diff) return y #get the 1-step fore...
PINGYANG-PY/bus_arrival_time_prediction
PartA/detrend.py
detrend.py
py
7,542
python
en
code
6
github-code
90
36573624501
""" This module provides an implementation of a filter strategy to sort products from highest to lowest price. """ import os import sys from typing import Dict, List, Any current_dir = os.path.dirname(os.path.realpath(__file__)) src = os.path.dirname(current_dir) sys.path.append(src) from strategy.FilterStrategyInte...
IvanZelenkov/Good-Buy
good-buy-backend/good-buy-filter-products-handler/src/strategy/PriceStrategy.py
PriceStrategy.py
py
1,995
python
en
code
3
github-code
90
72106031338
import numpy as np import pandas as pd from numpy import savetxt from sklearn import svm from sklearn.linear_model import Ridge from sklearn.linear_model import RidgeCV from sklearn.linear_model import LinearRegression from sklearn.linear_model import LogisticRegressionCV def linear_regression(xTr, yTr): # model ...
heming-zhang/MachineLearning-Projects
milestone1/linear_regression.py
linear_regression.py
py
1,331
python
en
code
0
github-code
90
21506617075
import yolov5 import matplotlib.pyplot as plt import torch import cv2 import numpy as np import time import random # pass these when calling the function areaArr = [[(430,67),(111,488),(962,478),(610,61)],[(626,246),(163,490),(731,487),(718,254)],[(362,145),(242,485),(927,485),(618,135)],[(608,209),(365,490),(775,495),...
rampantvoid/UHackathon-4.0
Code/main_edit.py
main_edit.py
py
9,010
python
en
code
1
github-code
90
26792394448
"""Unum unit definitions Add new units at end of file """ import importlib.util import sys from pathlib import Path # from rivt.unum.core import * # from rivt.unum.utils import * from rivt.unum.core import new_unit # from rivt.unum.utils import uarray from rivt.unum.core import Unum rvpath = importlib.util.find...
rholland/rivt
units.py
units.py
py
4,215
python
en
code
0
github-code
90
21335134881
import requests import re import sys #sys.path.insert(0, 'P:\\Project\\MyProject\\AvitoParser\\YearOfConstruction\\') #path_file_streets='P:\\Project\\MyProject\\AvitoParser\\YearOfConstruction\\' sys.path.insert(0, 'D:\\v.orlov\\Programm\\python\\2\\AvitoParser\\YearOfConstruction\\') path_file_streets='D:\\v.orlov\\P...
Bargota/AvitoParser
BaseParser.py
BaseParser.py
py
5,599
python
en
code
0
github-code
90
70805212137
# 8. Write a Python function that takes a list and returns a new list with unique # elements of the first list. # Sample List : [1,2,3,3,3,3,4,5] # Unique List : [1, 2, 3, 4, 5] def u_list(l): lst=[] for i in l: if i not in lst: lst.append(i) return lst print( u_list([1,2,3,3,3,3,4,5]))
bhatkrishna/assignment
assignment/problem8.py
problem8.py
py
320
python
en
code
0
github-code
90
33531422801
import json import time import message from typing import Tuple from scipy.stats import norm from datetime import datetime import settings class Photovoltaic: def __init__(self): self.results_file = settings.results_file self.sample_rate = settings.sample_rate @ staticmethod def powe...
jarednewell/Photovoltaic_and_Power_Meter_Simulator
photovoltaic.py
photovoltaic.py
py
3,042
python
en
code
0
github-code
90
18404358439
s = list(input()) a = int("".join(s[:2])) b = int("".join(s[2:])) c = 0 d = 0 if a and a <= 12: c = 1 if b and b <= 12: d = 1 if c and d: print("AMBIGUOUS") elif c: print("MMYY") elif d: print("YYMM") else: print("NA")
Aasthaengg/IBMdataset
Python_codes/p03042/s484720907.py
s484720907.py
py
242
python
en
code
0
github-code
90
14385974487
#!/usr/bin/python3 import re import nltk import sys import getopt import pickle import linkedlist def usage(): print("usage: " + sys.argv[0] + " -d dictionaryAttempt-file -p postingsAttempt-file -D dictionaryActual-file -P postingsActual-file") def getPostings(postings_file, dictionary): postings = {} wit...
over-fitted/cs3245-hw-2
test.py
test.py
py
2,837
python
en
code
0
github-code
90
4054367671
import copy from torch import load import logging from torchvision.models import resnet18, resnet34, resnet50, resnet101 def get_key(conv_type): dst_key = None if 'resnet' in conv_type : dst_key = "bn1." return dst_key def get_model(backbone_type, pretrained=False, pretrain_path=None, **kwargs): ...
GiantJun/balmoco
backbones/network.py
network.py
py
2,031
python
en
code
0
github-code
90
21473971155
# pygame demo 5 - drawing # 1 - Import packages import pygame from pygame.locals import * import sys # 2 - Define constants WINDOW_WIDTH = 640 WINDOW_HEIGHT = 480 FRAMES_PER_SECOND = 30 GRAY = (230, 230, 230) BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (...
IrvKalb/Object-Oriented-Python-Code
Chapter_5/PygameDemo5_DrawingShapes.py
PygameDemo5_DrawingShapes.py
py
2,811
python
en
code
207
github-code
90
21406570448
from torch import nn from transformers import BertModel, BertTokenizer from transformers import AdamW from tqdm import tqdm import torch num_class=2 device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") class BertClassificationModel(nn.Module): def __init__(self,hidden_size=768): # bert默认最后输出维度为...
nuaazs/BERT_Fraud
anti-fraud/SST/bert.py
bert.py
py
1,663
python
en
code
0
github-code
90
34999084105
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'wang.zhiqiang' class ListNode(object): def __init__(self, elem, next_=None): self.elem = elem self.next = next_ def __str__(self): if self is None: return 'None' return str(self.elem) + '-' + self.next.__...
Aixi1995/py-common-test
list_node.py
list_node.py
py
783
python
en
code
0
github-code
90
18469857249
#!/usr/bin/env python # coding: utf-8 # In[15]: N = int(input()) a = [] for _ in range(N): a += [int(input())] # In[16]: if all([x%2==0 for x in a]): print("second") else: print("first") # In[ ]:
Aasthaengg/IBMdataset
Python_codes/p03197/s659301005.py
s659301005.py
py
221
python
en
code
0
github-code
90
23424745636
""" Here lies the code for creating the df, feature pair that constitutes a model suite. It will also return the folder name. These models are called by user manually in create many model suites """ #%% from constants import UPDATED_TRAINING_DB, DROPBOX_PATH CENTURY = 20 from Oracle import train_model_suite from Oracl...
xflynx25/boring_uninteresting_repo
models.py
models.py
py
13,785
python
en
code
1
github-code
90
25759956153
import math #used for atan import time class kalmanFilter: #initialize def __init__(self): self.Q_angle = float(0.01) #this is a variance self.Q_gyro = float(0.0003) #this is a variance self.R_angle = float(0.01) #this is a variance self.x_bias = float(0) self.y_bias = float(0) self.z_bias = float(0)...
doomboss/ELEC650
old/kf.py
kf.py
py
5,052
python
en
code
0
github-code
90
18420904625
from fastapi import FastAPI, HTTPException, Query from pydantic import BaseModel from transformers import BertForSequenceClassification, BertTokenizerFast import torch app = FastAPI() model_path = "Model" model = BertForSequenceClassification.from_pretrained(model_path) tokenizer = BertTokenizerFast.from_pretrained(...
theomyway/FlaskAPI
app.py
app.py
py
1,064
python
en
code
0
github-code
90
43728112511
# Sirohi, Krishnakant Singh # 1001-668-969 # 2019-12_01 # Assignment-04-03 import tensorflow as tf from cnn import CNN batch_size = 64 num_classes = 10 epochs = 1 num_predictions = 20 (x_train, y_train),(x_test,y_test) = tf.keras.datasets.cifar10.load_data() y_train = tf.keras.utils.to_categorical(y_train, num_class...
krishnakantsirohi/Neural_Networks
Convolutional_Neural_Network/Sirohi-04-03.py
Sirohi-04-03.py
py
1,392
python
en
code
0
github-code
90
20493119144
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from comment_parser.comment_parser import extract_comments_from_str from lark import Lark, Transformer from lark.exceptions import UnexpectedCharacters, UnexpectedEOF, UnexpectedToken from ..components import State, Transiti...
codetent/project_momos
momos/parser/parse.py
parse.py
py
3,770
python
en
code
2
github-code
90
13268325219
__metaclass__ = type __all__ = [ '_b', '_u', 'advance_iterator', 'BytesIO', 'classtypes', 'istext', 'str_is_unicode', 'StringIO', 'reraise', 'unicode_output_stream', 'text_or_bytes', ] import codecs import io import locale import os import re import sys import traceback ...
fbla-competitive-events/coding-programming
2018/10th/bigsql/python2/Lib/site-packages/testtools/compat.py
compat.py
py
7,835
python
en
code
7
github-code
90
11619825966
# Fibonacci: 0 1 1 2 3 5 8 13 from typing import Generator, List # loop 1 fib_current = 0 fib_next = 1 for _ in range(5): # procedural syntax tmp = fib_next fib_next = fib_next + fib_current print(fib_current) fib_current = tmp # loop 2 fib_current = 0 fib_next = 1 fib_list = [] for _ in range(...
dbongartz/windmill_py_exp
fib/fib.py
fib.py
py
3,648
python
en
code
0
github-code
90
29616541979
import serial try: import smbus2 except: print("could not import smbus") class MCU: '''Generic class to represent a microcontroller. ''' def __init__(self, port='/dev/ttyAMA0', address=00, baud=115200, start_marker='<', end_marker='>'): try: self._serial_port = serial.Serial(po...
SeanTedesco/satellite-systems
src/satsystems/common/mcu.py
mcu.py
py
3,114
python
en
code
0
github-code
90