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
1133751286
#!/usr/bin/env python # encoding: utf-8 """ @file: keylogger.py @time: 2022/5/25 13:56 @project: black-hat-python-2ed @desc: P151 键盘记录 在Windows下运行时,需要将venv/Lib/site-packages/pywin32_system32目录下的pythoncom38.dll、pywintypes38.dll复制到C:\Windows\System32里面 """ import sys import time from ctypes import windll, c_ulong, byref,...
Relph1119/black-hat-python-2nd
codes/ch08/keylogger.py
keylogger.py
py
2,937
python
en
code
23
github-code
90
18388202298
import os # cross site request forgery WTF_CSRF_ENABLED = True # validatation token SECRET_KEY = 'you-will-never-guess' basedir = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_MIGRATE_REPO = os.path...
apex-omontgomery/CapeeshV2
config.py
config.py
py
345
python
en
code
0
github-code
90
38733021997
""" Client side operation, using Tkinter for the GUI """ from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter def receiveMessage(): while True: try: msg = client_socket.recv(BUFSIZ).decode("utf8") msgList.insert(tikinter.END, msg) except OSError: #If the client leav...
AliShahram/Python-Chatbot
client.py
client.py
py
2,051
python
en
code
3
github-code
90
6951018925
import math class Solution: def next(self, x0, x): return x0 - (x0 * x0 - x) / 2 / x0 def mySqrt(self, x): """ :type x: int :rtype: int """ ret = 1 tmp = self.next(ret, x) for _ in range(100): ret = tmp tm...
Nov11/punchcarding
69. Sqrt(x).py
69. Sqrt(x).py
py
453
python
en
code
0
github-code
90
18275749539
#Macで実行する時 import sys import os if sys.platform=="darwin": base = os.path.dirname(os.path.abspath(__file__)) name = os.path.normpath(os.path.join(base, '../atcoder/input.txt')) #print(name) sys.stdin = open(name) a, b = map(int,input().split()) c = int(a/b) if a%b!=0: c+=1 print(c)
Aasthaengg/IBMdataset
Python_codes/p02783/s092152393.py
s092152393.py
py
308
python
en
code
0
github-code
90
10400217628
# -*- coding: utf-8 -*- """ Created on Mon Jul 8 16:09:43 2019 @author: admin """ ''' 编写一个程序,通过已填充的空格来解决数独问题。 一个数独的解法需遵循如下规则: 数字 1-9 在每一行只能出现一次。 数字 1-9 在每一列只能出现一次。 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。 空白格用 '.' 表示。 一个数独。 答案被标成红色。 Note: 给定的数独序列只包含数字 1-9 和字符 '.' 。 你可以假设给定的数独只有唯一解。 给定数独永远是 9x9 形式的。 ''' class Sol...
k8godzilla/-Leetcode
1-100/L037.py
L037.py
py
3,819
python
en
code
0
github-code
90
6768152730
vehicles = { 'dream': 'Honda 250T', 'er5': 'Kawasaki ER5', 'can-am': 'Bombardier Can-Am 250', 'virago': 'Yamaha XV250', 'tenere': 'Yamaha XT650', 'jimny': 'Suzuki Jimny 1.5', 'fiesta': 'Ford Fiesta Ghia 1.4', 'roadster': 'Triumph Street Triple' } # my_car = vehicles['Fiesta'] # print(my...
ZhaoyangChen101/Python-Course
DictAndSet/dict_intro.py
dict_intro.py
py
1,699
python
zh
code
0
github-code
90
19369261282
# -*- coding: utf-8 -*- from cjson import decode as json_decode, encode as json_encode import unittest2 import psycopg2 import urllib2 import os def url_access(url, data="", method="GET"): opener = urllib2.build_opener(urllib2.HTTPHandler) request = urllib2.Request(url, data) request.get_method = lambda: ...
jianingy/minitree
test/test_update.py
test_update.py
py
3,276
python
en
code
1
github-code
90
73842401576
import numpy as np np.random.seed(222) NUM_ROWS = NUM_COLS = 9 MIN_VAL = 1 MAX_VAL = 9 # sum automaton class class Candidate: def __init__(self, board): self.board = board.copy() self.fixed_board = board.copy() # save the fixed cells of the board self.fitness = 0 self.prob = 0 ...
IdanAchituve/sudoku_solver_with_genetic_algorithm
game_board.py
game_board.py
py
3,608
python
en
code
0
github-code
90
18106198839
import sys ERROR_INPUT = 'input is invalid' def main(): n = get_length() arr = get_array(length=n) sourtLi, count = selectionSort(li=arr, length=n) print(*sourtLi) print(count) return 0 def get_length(): n = int(input()) if n < 0 or n > 100: print(ERROR_INPUT) sys.e...
Aasthaengg/IBMdataset
Python_codes/p02260/s000626618.py
s000626618.py
py
941
python
en
code
0
github-code
90
36334295047
from aws_cdk import Stack, aws_s3 as s3 from constructs import Construct from multilens.constructs.image_convert import ImageConvert from multilens.constructs.line_api import LineApi, LineApiCredential class MultilensStack(Stack): def __init__( self, scope: Construct, construct_id: str, ...
hrfmtzk/multilens-backend
multilens/stacks/multilens_stack.py
multilens_stack.py
py
890
python
en
code
0
github-code
90
36687129051
import argparse import sys from argparse import ArgumentParser from .cmds import CMDS, make_parser def main() -> None: parser = make_parser() args = parser.parse_args() if args.action in CMDS: CMDS[args.action].execute(args) else: parser.print_help(sys.stderr) sys.exit(1) i...
browsermt/bergamot-translator
bindings/python/__main__.py
__main__.py
py
357
python
en
code
263
github-code
90
39820720653
import json import streamlit as st def create_apikey(): private_key_id = st.secrets["private_key_id"] private_key = st.secrets["private_key"] client_id = st.secrets["client_id"] dictionary = { "type": "service_account", "project_id": "ai-learning-text-to-speech", "private_key_id": private...
arjunprakash027/voicy_website
credentials.py
credentials.py
py
1,046
python
en
code
0
github-code
90
43676456365
import logging from subprocess import Popen, PIPE from settings.testu01 import TestU01Settings from settings.general import GeneralSettings from results.testu01 import TestU01Result, TestU01ResultFactory class TestU01Execution: def __init__(self, testu01_settings: TestU01Settings, general_setting...
pvavercak/rtt-py
src/executions/testu01.py
testu01.py
py
3,757
python
en
code
0
github-code
90
23430010115
""" ------------------------------------------------------- test_sorts_array.py Tests various array-based sorting functions. ------------------------------------------------------- Author: Ross Malcolm ID: 170514930 Email: malc4930@mylaurier.ca __updated__ = "2017-08-20" ----------------------------------------...
RossMalcolm/Data-Structures
malc4930_data_structures/src/test_sorts_array.py
test_sorts_array.py
py
4,005
python
en
code
0
github-code
90
73578450217
# Type casting type_str = 'hello world' type_int = 109 type_float = 10.5 type_bool = True a = 10 converted_a = str(a) converted_a_float = float(a) # print(converted_a_float) # print(type(converted_a)) b = 15.9 converted_b = str(b) converted_b_int = int(b) # print(converted_b_int) c = False converted_c = int(c) con...
algork-io/PythonBootcamp
2022-12-03-operators-and-conditional-statements.py
2022-12-03-operators-and-conditional-statements.py
py
1,410
python
en
code
0
github-code
90
20240606162
from torch import nn from torchlibrosa import SpecAugmentation class BasicBlock(nn.Module): def __init__(self, in_channel, out_channel, stride=1, downsample=None, **kwargs): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels=in_channel, out_channels=out_channel, ...
ruwenda/ResNet-based-Bio-acoustics-Presence-Detection-Technology-of-Hainan-Gibbon-Calls
model/BPDnet.py
BPDnet.py
py
3,272
python
en
code
0
github-code
90
18398448509
import bisect import sys input=sys.stdin.readline N,Q=map(int,input().split()) STX=[list(map(int,input().split())) for i in range(N)] STX.sort(key=lambda x:x[2]) ans=[-1]*Q jump=[-1]*Q D=[int(input()) for i in range(Q)] for s,t,x in STX: l=bisect.bisect_left(D,s-x) r=bisect.bisect_left(D,t-x) while(l<r): ...
Aasthaengg/IBMdataset
Python_codes/p03033/s188112598.py
s188112598.py
py
481
python
en
code
0
github-code
90
38305016020
# this function return a string where the last three chars are now in upper case # if the string has lees than 3 chars, uppercase whatever is there def end_up(str): s = "" if len(str) < 3: s = str.upper() else: last3 = str[-3:].upper() s = str[:len(str) - 3] + last3 return s print(end_up("hello")) print(e...
jemtca/CodingBat
Python/Warmup-1/end_up.py
end_up.py
py
359
python
en
code
0
github-code
90
8970592846
from __future__ import absolute_import, division, print_function, unicode_literals from datetime import date, datetime from dateutil import parser from decimal import Decimal from amaascore.assets.asset import Asset class Derivative(Asset): def __init__(self, asset_manager_id, asset_id, asset_issuer_id=None, ...
amaas-fintech/amaas-core-sdk-python
amaascore/assets/derivative.py
derivative.py
py
1,358
python
en
code
0
github-code
90
71207193576
import json import csv books = [] def percentage(category): return (category * 100) / len(books) with open("books.json") as file: for jsonObj in file: booksDict = json.loads(jsonObj) books.append(booksDict) categories = { "Python": 0, "Java": 0, "PHP": 0, } for book in books: ...
lucasportella/Trybe
exercises/module4/python-read-write-files/exercicio4.py
exercicio4.py
py
815
python
en
code
0
github-code
90
11844567326
from django.db import models from django_celery_results.models import TaskResult from lib import utils from django.contrib.auth.models import User class Project(models.Model): BLOCK = 0 NORMAL = 1 STATUS_CHOICES = ( (BLOCK, '停用'), (NORMAL, '正常'), ) name = models.CharField(max_len...
chenzejian/seagull
app/models.py
models.py
py
2,671
python
en
code
1
github-code
90
39244783657
""" Monitors """ import numpy as np class Monitor(object): def __init__(self, experiment, group_cells_name, state_name, duration=None) -> None: """ Monitor constructor. A monitor saves the state of a group of cells as a Numpy array. Parameters ---------- experiment : object Experime...
SocratesNFR/EvoDynamic
evodynamic/experiment/monitor.py
monitor.py
py
2,557
python
en
code
19
github-code
90
72764001897
# -*- coding: utf-8 -*- from __future__ import division, print_function from keras.layers import Input from keras.layers.core import Dense from keras.models import Model from sklearn.preprocessing import StandardScaler import numpy as np import os import pandas as pd import matplotlib.pyplot as plt DATA_DIR = "data" ...
PacktPublishing/Deep-Learning-with-Keras
Chapter07/air-quality-regression.py
air-quality-regression.py
py
2,235
python
en
code
1,049
github-code
90
73640764456
import logging import random import numpy as np import torch import gc import os from collections import Counter import seaborn as sns import wandb import time import matplotlib.pyplot as plt from sklearn.metrics import classification_report from transformers import BertTokenizer, BertTokenizerFast, XLMTokenizer, XLM...
pauli31/srl-aspect-based-sentiment
fine_tuning/fine_tuning_torch.py
fine_tuning_torch.py
py
34,298
python
en
code
1
github-code
90
32643784670
from django import forms from budgeted_hours.models import Categories from django.core.exceptions import ValidationError class CategoriesForm(forms.ModelForm): class Meta: model = Categories fields = ('category',) labels = { 'category': 'Nombre' } # def clean(sel...
SantiagoChaparro23/PHC
budgeted_hours/forms/categories_form.py
categories_form.py
py
644
python
en
code
0
github-code
90
5145197717
from qqbot import QQBotSlot as qqbotslot, RunBot import random @qqbotslot def onQQMessage(bot, contact, member, content): if content == "help": bot.SendTo(contact, '输入.help查找帮助,使用.r空格后输入骰子,再空格后输入判定名称~\n' '加减法的运算为.add空格后接加法,.sub空格后接减法\n' '这个bot写得时间很短而且...
JosukeCrazyDiamond/diceBot
botS.py
botS.py
py
1,529
python
en
code
0
github-code
90
18208644799
N = int(input()) A = list(map(int, input().split())) cap = [[0, 0] for _ in range(N+1)] cap[-1] = [A[-1], A[-1]] for i in range(N-1,-1,-1): cap[i][0] = (cap[i+1][0] + 2 - 1)//2 cap[i][1] = cap[i+1][1] + A[i] ans = 1 nodes = 1 failed = nodes < cap[0][0] for i in range(N): nodes = min((nodes - A[i])*2, cap[i+...
Aasthaengg/IBMdataset
Python_codes/p02665/s970241278.py
s970241278.py
py
437
python
en
code
0
github-code
90
18464455729
import sys sys.setrecursionlimit(10**5) #print(sys.getrecursionlimit()) n,m=map(int,input().split()) dp=[-1]*n E=[ [] for i in range(n) ] for i in range(m): x,y=map(int,input().split()) x-=1 y-=1 E[x].append(y) def rec(v): if dp[v]!=-1:return dp[v] res=0 for nv in E[v]: res=max(res,rec(nv)+1) dp[v...
Aasthaengg/IBMdataset
Python_codes/p03166/s935819047.py
s935819047.py
py
397
python
en
code
0
github-code
90
35577646463
#This code imports the necessary modules. import random import os from collections import defaultdict import datetime import re from unidecode import unidecode #this code retrieves the date and time from the computer, to create the timestamp right_now = datetime.datetime.now().isoformat() list = [] for i in right_n...
Mystified131/Rachel
PoetryByRandomness.py
PoetryByRandomness.py
py
2,582
python
en
code
2
github-code
90
7943499805
import os from setuptools import setup def _package_files(directory: str, suffix: str) -> list: """ Get all of the file paths in the directory specified by suffix. :param directory: :return: """ paths = [] for (path, directories, filenames) in os.walk(directory): fo...
sensepost/sensecon_bot
setup.py
setup.py
py
1,379
python
en
code
0
github-code
90
17953237369
def solve(V, G): ans = 0 for i in range(V - 1): for j in range(i + 1, V): direct = G[i][j] for k in range(V): if k == i or k == j: continue ind = G[i][k] + G[k][j] if direct > ind: return -1 ...
Aasthaengg/IBMdataset
Python_codes/p03600/s559858274.py
s559858274.py
py
603
python
en
code
0
github-code
90
3833099109
import pandas as pd from nltk.corpus import stopwords from collections import Counter import matplotlib.pyplot as plt import nltk nltk.download('stopwords') def load_and_preprocess_data(file_path): df = pd.read_csv(file_path) stop_words = set(stopwords.words('english')) all_comments = ' '.join(df['...
vkakash1108/FODS
14.py
14.py
py
1,253
python
en
code
0
github-code
90
40466742983
# this example is used to make the animation in the readme. # It is also set up to accept any geometry and the mesh tally will adapt to the geometry dimensions import openmc from matplotlib.colors import LogNorm from openmc_regular_mesh_plotter import plot_mesh_tally from matplotlib import cm import matplotlib.pyplot...
fusion-energy/openmc_regular_mesh_plotter
examples/plot_with_custom_color_map.py
plot_with_custom_color_map.py
py
7,850
python
en
code
4
github-code
90
19797191934
#!/usr/bin/python # -*-coding:utf8-*- """ @author: LieOnMe @time: 2019/8/1 23:06 """ import glob import os import numpy as np import tensorflow as tf from PIL import Image from model.gan import Generator, Discriminator from utils import conf from utils.dataset import make_anime_dataset tf.random.set_seed(22) np.ra...
kaisayi/bordercollie
src/model/gan_train.py
gan_train.py
py
5,046
python
en
code
0
github-code
90
17178514676
import argparse import pandas as pd import numpy as np import torch from GPTDecoder import GPTDecoder from Train import train from Data import get_data import random label_list = ['org:member_of', 'per:schools_attended', 'per:charges', 'org:city_of_headquarters', 'org:country_of_headquarter...
whnhch/positional_embedding
GPT_positional_embedding/main.py
main.py
py
4,548
python
en
code
0
github-code
90
13907622631
import csv from geopy.geocoders import Nominatim import simplekml import pandas as pd import argparse def read_csv(file): """Reads addresses from input CSV""" locations_list = [] locations_file = csv.reader(open(file, 'r')) for row in locations_file: locations_list.append(row) return lo...
nixintel/Add2Coords
coords.py
coords.py
py
2,430
python
en
code
5
github-code
90
40651239324
from typing import Generator from torch import Tensor from torchvision.datasets import MNIST from sequoia.utils.logging_utils import log_calls from .environment import ActiveEnvironment class ActiveMnistEnvironment(ActiveEnvironment[Tensor, Tensor, Tensor]): """An Mnist environment which will keep showing the ...
lebrice/Sequoia
sequoia/settings/rl/environment_test.py
environment_test.py
py
3,190
python
en
code
185
github-code
90
74198366056
#By considering terms in Fibonacci sequence whose value do not exceed four million,find the sum of even-valued terms first_term=0 second_term=1 total_sum=0 for i in range(1,11): third_term=first_term+second_term first_term=second_term second_term=third_term if(third_term<4000000 and third_term%2==0): total_sum+=...
GunarajKhatri/python-challanges
projecteuler.net _problems/problem2.py
problem2.py
py
348
python
en
code
0
github-code
90
10150036798
import tensorflow as tf import mnist_inference import mnist_train import numpy as np import os import linecache import os.path rootdir="H:/deep_learning/stripe_surface/deep_learning/Covnet/data/" os.chdir(rootdir) test_size = len(os.listdir("testColloction/")) def readData(filename,labellen,datalen): lines=lineca...
SagacitySucura/Machine_Learning
CNN/mnist_eval.py
mnist_eval.py
py
2,593
python
en
code
0
github-code
90
18436460899
A,B,K = map(int, input().split()) lim = min(A,B) count = 0 for i in range(lim,0,-1): if A%i == 0 and B%i == 0: count += 1 if count == K: print(i) break
Aasthaengg/IBMdataset
Python_codes/p03106/s244664671.py
s244664671.py
py
175
python
en
code
0
github-code
90
5797304909
import os import json import argparse parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, default='nuscenes') parser.add_argument('--step', type=int, default='-1') parser.add_argument('--metric', type=str, default='mean_dist_aps') parser.add_argument('--thresh', type=str, default="") args = p...
peiyunh/wysiwyg
second/utils/print_test.py
print_test.py
py
1,161
python
en
code
110
github-code
90
26447482494
from indicators.SingleValueIndicator import SingleValueIndicator from indicators.SMA import SMA class AO(SingleValueIndicator): def __init__(self, periodFast, periodSlow, timeSeries = None): super(AO, self).__init__() self.periodFast = periodFast self.periodSlow = periodSlow self.smaFast = SMA(periodFast) ...
nardew/creten
creten/indicators/AO.py
AO.py
py
903
python
en
code
10
github-code
90
2356200336
from twisted.cred import credentials, error from xcap.web.auth.interfaces import ICredentialFactory from zope.interface import implements class BasicCredentialFactory(object): """ Credential Factory for HTTP Basic Authentication """ implements(ICredentialFactory) scheme = 'basic' def __ini...
AGProjects/openxcap
xcap/web/auth/basic.py
basic.py
py
817
python
en
code
15
github-code
90
21956904170
import numpy as np from scipy import signal from skimage.util import view_as_blocks def optical_flow_fast(I1g, I2g, window_size, tau=1e-2): assert I1g.shape == I2g.shape assert I1g.shape[0] % window_size == 0 and I1g.shape[1] % window_size == 0 kernel_x = np.array([[-1., 1.], [-1....
MaratZakirov/demos
lukas_kanade_batched.py
lukas_kanade_batched.py
py
1,776
python
en
code
0
github-code
90
5166647705
# This code is for the server # Lets import the libraries import socket, cv2, threading import screeninfo #pip install screeninfo # #width = 1920 #height = 1080 cap = cv2.VideoCapture('mon1.mp4') screen_id = 0 screen = screeninfo.get_monitors()[screen_id] width, height = screen.width, screen.height dim = ...
kwgarylam/Sockets
server.py
server.py
py
3,786
python
en
code
0
github-code
90
18566040889
lis = [] for _ in range(3): lis.append(list(map(int, input().split()))) flag1 = 0 flag2 = 0 for a1 in range(101): b1 = lis[0][0] - a1 b2 = lis[0][1] - a1 b3 = lis[0][2] - a1 for a2 in range(101): if a2 + b1 == lis[1][0] and a2 + b2 == lis[1][1] and a2 + b3 == lis[1][2]: fla...
Aasthaengg/IBMdataset
Python_codes/p03435/s836124710.py
s836124710.py
py
673
python
en
code
0
github-code
90
38217335395
def define_targets(rules): rules.cc_library( name = "TypeCast", srcs = ["TypeCast.cpp"], hdrs = ["TypeCast.h"], linkstatic = True, local_defines = ["C10_BUILD_MAIN_LIB"], visibility = ["//visibility:public"], deps = [ ":base", "//c10/co...
fengbingchun/PyTorch_Test
src/pytorch/c10/util/build.bzl
build.bzl
bzl
1,884
python
en
code
14
github-code
90
11207898276
""" In this simple RPG game, the hero fights the goblin. He has the options to: 1. fight goblin 2. do nothing - in which case the goblin will attack him anyway 3. flee """ from random import randint class Character: def __init__(self): self.health = 0 self.power = 0 self.name = "" ...
cmkemp52/rpg-starter
rpg-2.py
rpg-2.py
py
4,284
python
en
code
null
github-code
90
70193317736
title = "Combo boxes" description = """ The ComboBox widget allows to select one option out of a list. The ComboBoxEntry additionally allows the user to enter a value that is not in the list of options. How the options are displayed is controlled by cell renderers. """ from gi.repository import Gtk, Gdk, GdkPixbuf,...
GNOME/pygobject
examples/demo/demos/combobox.py
combobox.py
py
10,189
python
en
code
144
github-code
90
35275780039
#!/usr/bin/env python # coding: utf-8 # In[1]: # Ques 1) Create a function that takes a number as an argument and returns True or False depending on whether the number is # symmetrical or not. A number is symmetrical when it is the same as its reverse. # In[2]: def is_symmetrical(number): number_str = str(n...
SameerSingh2901/Python-Basic-Assignments-ineuron
Python-Programming-Assignments/23. Python Programming 23 ineuron.py
23. Python Programming 23 ineuron.py
py
1,749
python
en
code
0
github-code
90
70537756777
# -*- coding: utf-8 -*- """ Created on Mon Feb 3 15:50:05 2020 @author: israe """ import os import numpy as np import matplotlib.pyplot as plt os.chdir('D:\\Bibliotecas_Usuario\\Documentos\\Documentos\\UFS\\Estudo_de_Computação\\python_matlab\python_ML\data') data = np.genfromtxt("web_traffic.tsv", delimiter = "\...
israeljsf95/python_matlab
python_ML/ex3.py
ex3.py
py
1,797
python
en
code
0
github-code
90
7983822838
import pytest import time from collections import Counter class Solution(object): def product_of_array_except_self_SS(self, nums:list)-> list: answer = {} temp_multiplication = 1 for idx in range(len(nums)): answer[idx] = answer.get(idx,0) + temp_multiplication ...
SahandSomi/algorithms-exercise
Array & Hashing/Product of Array Except Self/product_of_array_except_self.py
product_of_array_except_self.py
py
1,445
python
en
code
0
github-code
90
13002644758
def solution(progresses, speeds): answer = [] while progresses: # 진행 for i in range(len(progresses)): progresses += speeds[i] # 개수세기 cnt = 0 while progresses[0] >= 100: progresses.pop(0) speeds.pop(0) cnt += 1 answ...
hyeinkim1305/Algorithm
Programmers/Level2/Programmers_Level2_기능개발.py
Programmers_Level2_기능개발.py
py
403
python
en
code
0
github-code
90
19760965637
from typing import List class Solution: def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]: potions.sort() ans, n = [], len(potions) def counterNumbers(targetNumber) -> int: i = 0 if targetNumber < potions[0]: ...
Akshay-Savad/data-strutures-practise
LeetCode_75/LT_2300.PY
LT_2300.PY
py
898
python
en
code
1
github-code
90
16038051522
import functools from json import JSONDecodeError from aiohttp import web from cerberus import DocumentError, Validator from opening_hours.handlers.util.validator_schema import ValidationSchema def view_validator(schema_name: str): """ Validates post parameters :param schema_name: """ def wrapp...
Kalanamith/Oppettider
opening_hours/handlers/util/decorators.py
decorators.py
py
1,639
python
en
code
0
github-code
90
41329046850
import os, torch import numpy as np import matplotlib.pyplot as plt import pandas as pd from itertools import product from utils.args import PROPOSED_PARSER from task.proposed import Trainer import gc gc.collect() torch.cuda.empty_cache() def plot_evaluation_metircs(pth: str,save_type: str,trains: list,...
sejin-sim/SpecRegMatch
main_proposed.py
main_proposed.py
py
2,612
python
en
code
0
github-code
90
18523318309
n=int(input()) a=list(map(int,input().split())) count=0 for i in range(len(a)): counter=0 while 1: if a[i]%2==0: counter+=1 a[i]=a[i]//2 else: break count+=counter print(count)
Aasthaengg/IBMdataset
Python_codes/p03325/s890844536.py
s890844536.py
py
213
python
en
code
0
github-code
90
26157191300
import matplotlib as mpl import numpy as np import matplotlib.pyplot as plt import pandas as pd from tkinter import filedialog as fld import os savefig = 'Figures\\' saveDFLoc = 'DataFrames\\' def getLinks(Files=None): if Files: new = list(fld.askopenfilenames()) for newfile in new: ...
Uchihasummer/RamanPreProcessing
Tools.py
Tools.py
py
3,427
python
en
code
1
github-code
90
18402254859
import sys import heapq N, M = map(int, input().split()) A = list(map(int, input().split())) origin = sum(A) heapq.heapify(A) BC = [list(map(int, input().split())) for _ in range(M)] BC = sorted(BC, reverse=True, key=lambda x: x[1]) count = 0 for i in range(M): b = BC[i][0] c = BC[i][1] for _ in range(b...
Aasthaengg/IBMdataset
Python_codes/p03038/s850337672.py
s850337672.py
py
660
python
en
code
0
github-code
90
4706386167
from DataAnalysis import TimeSerieDC data_folder = '/home/Fiore/Documents/Dyncode/Datasets/2018_E1_28/Data_Files/' data_folder ='/home/fabris/Documents/Dyncode/low_res_datasets/2018_E1_28/Data_Files/' save_folder = '/home/Fiore/Documents/Dyncode/Datasets/2018_E1_28/Sup_Figs/' save_folder ='/home/fabris/Documents/Dync...
fiorefabris/DynCode
examples/DataAnalysisPipeline/2018_E1_28_experiment/coding/supfig_alltraces.py
supfig_alltraces.py
py
980
python
en
code
0
github-code
90
22352377209
# © Jason (Seojoon) Yeon 2018 October 17 ~ # statistical import random import math import numpy as np # import game environment and logging tool import env import log # machine learning from keras.optimizers import Adam from keras.models import Sequential from keras.layers import Dense, Dropout from keras.models import...
Tornadee/personal_project
python/q.py
q.py
py
3,682
python
en
code
0
github-code
90
43441482327
months = { 'January': 1, 'February': 2, 'April': 4, 'May': 5, 'March': 3, 'October': 10, 'July': 7, 'August': 8, 'June': 6, 'September': 9, 'November': 11, 'December': 12 } #Remove all the items from months dict with value greater then 6 def trim_by_six(dictionary): for keys in list(dictionary.keys()): ...
tohhhi/it_school_2022
Sesiunea 10/practice.py
practice.py
py
499
python
en
code
0
github-code
90
22030938273
# -*- coding: UTF-8 -*- __license__ = """ Copyright (C) 2011 Avencall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any la...
Eyepea/xivo-confgen
xivo-confgen/xivo_confgen/generators/voicemail.py
voicemail.py
py
3,901
python
en
code
1
github-code
90
14116718937
from torchvision import transforms from torch.utils.data import Dataset from torchvision.transforms.functional import InterpolationMode from torch.utils.data import DataLoader class ImagesDataset(Dataset): def __init__(self, imgs_dict, configs): image_size = configs["dataset"]["image_size"] self.t...
hungnt14/image_captioning_demo
api/captioning/loader.py
loader.py
py
1,454
python
en
code
0
github-code
90
35490538953
import cv2, os import numpy as np import mtcnn from architecture import * from train_v2 import normalize, l2_normalizer from scipy.spatial.distance import cosine from tensorflow.keras.models import load_model from attendance_tracker import AttendanceTracker import pickle import time from datetime import datetime, timed...
FransOnMobile/Research-Attendance-Tracking-through-Face-Recognition
detect.py
detect.py
py
3,801
python
en
code
0
github-code
90
7597038564
from django.contrib import admin from django.urls import path , include from . import views urlpatterns = [ path('', views.fdashboard,name='fdashboard'), path('semesterschedule', views.semesterschedule,name='semesterschedule'), path('formguidline', views.formguidline,name='formguidline'), path('library...
shakeebanwar/Learning-managment-python--anywhere
faculty/urls.py
urls.py
py
4,448
python
en
code
0
github-code
90
5304478001
from multiprocessing import Queue import Milter from utils import log_config from services.s3_milter import S3Milter from services.log_manager import LogManager from services.postgre_manager import PostgreManager from milter_config import postgresql_creds from milter_config import milter_params log_config.init() log_...
jokismo/S3-Milter
attachments_milter.py
attachments_milter.py
py
1,511
python
en
code
2
github-code
90
21617367068
class Solution: def fourSum(self, arr: List[int], l: int) -> List[List[int]]: re = set() arr = sorted(arr) for i in range(len(arr)): num = l - arr[i] for j in range(i+1, len(arr)): num1 = num - arr[j] set_ = set() for k ...
sgowdaks/CP_Problems
LeetCode/prob18.py
prob18.py
py
592
python
en
code
0
github-code
90
18072791729
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 H, W, A, B = list(map(int, sys.stdin.readline().split())) # dp = np.ones(W, dtype=int) # for h in range(1, H - A): # dp = dp.cumsum() % MOD # f...
Aasthaengg/IBMdataset
Python_codes/p04046/s772888529.py
s772888529.py
py
1,468
python
en
code
0
github-code
90
11271325709
from string import digits # digits = "1234567890" instructions = input() # string input output = "" split = False # go to new line when this is true for char in instructions: # char is short for character if char == "+": output += " tighten " elif char == "-": output += " loosen " elif ch...
SSSCodingClub/CCC-Solutions
2022/Junior/J3.py
J3.py
py
520
python
en
code
0
github-code
90
23003451283
import pygame, os class Car(pygame.sprite.Sprite): def __init__ (self, screen): pygame.sprite.Sprite.__init__(self) self.screen = screen self.img_car = pygame.image.load('./need_py_speed_game/Game/imagens' + os.sep + 'car.png') #self.img_carro = pygame.transform.scale(self.img_carro, (...
VeselaCindy/Bitalino
need_py_speed_game/Game/car.py
car.py
py
1,075
python
en
code
0
github-code
90
8952572607
#-*- coding:utf-8 -*- import os import sys from _winreg import * def getFunshionInstallPath(): path = 'SOFTWARE\\Wow6432Node\\Funshion\\Funshion' funshion=OpenKey(HKEY_LOCAL_MACHINE, path) path,type=QueryValueEx(funshion,"Install Path") return path if __name__ == "__main__": installpath=...
hugecabbage/dump_analysis
get_funshion_install_path.py
get_funshion_install_path.py
py
544
python
en
code
1
github-code
90
24722716367
# -*- coding: utf-8 -*- """ Created on Tue Jun 2 20:22:48 2020 @author: suchith """ from imutils.video import VideoStream from imutils.video import FPS import face_recognition import argparse import imutils import pickle import time import cv2 import yagmail import os import requests import datetime...
suchith1012/raspberrypifacerecognition
videodetection.py
videodetection.py
py
3,897
python
en
code
0
github-code
90
24395321919
# Alberto Ruiz Biestro -- A01707550 # # N_SPHERE volume # # Para más información revisar: https://en.wikipedia.org/wiki/N-sphere # ToDo: initialize arrays # Last revision: 7/03/2022 ########################### IMPORT ################################### import numpy as np import scipy.special as sp import matplotlib....
ModifiedBear/Computational-Physics-I
extras/n_sphere.py
n_sphere.py
py
5,873
python
es
code
0
github-code
90
16253512297
#!/usr/bin/env python # pylint: disable=wrong-import-position import os import time import traceback from argparse import ArgumentParser import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np from tqdm import trange import tensorflow as tf from evaluation import Evaluation from u...
furgerf/GAN-for-dermatologic-imaging
src/generate_samples.py
generate_samples.py
py
4,462
python
en
code
0
github-code
90
41413515460
import sys import math import random # Function that takes in command line arguments and # parses it while assertin that they are correct def variable_assertions(argv): assert(len(argv) == 4) forbes_val = float(argv[0]) num_reads_a = int(argv[1]) num_reads_b = int(argv[2]) read_length = int(argv[3]...
gautam-prab/HLL-similarity
Random_Generators/Rangen_forbes.py
Rangen_forbes.py
py
3,297
python
en
code
0
github-code
90
72619418218
from flask import Flask, redirect, url_for, render_template from flask import request from flask import session from flask import jsonify import mysql.connector app = Flask(__name__) app.secret_key = '123' def interact_db(query, query_type: str): return_value = False connection = mysql.connector.connect(host...
Arseni1919/WEB_Course_2020_A_examples_flask
app.py
app.py
py
9,845
python
en
code
0
github-code
90
18568426919
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(readline()) a = list(map(int, readline().split())) b = list(map(int, readline().split())) cnt = 0 for x, y in zip(a, b): diff = x - y if diff < 0: ...
Aasthaengg/IBMdataset
Python_codes/p03438/s767029162.py
s767029162.py
py
553
python
en
code
0
github-code
90
41444808158
''' Inception Pretrained_model http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz ''' import os import json import tensorflow as tf import numpy as np from gevent.pywsgi import WSGIServer from scipy import spatial import random, json, glob, os, codecs, random from annoy import AnnoyIndex...
jageshmaharjan/ExperimentalProjects
imageSearch/image_vectorizer.py
image_vectorizer.py
py
3,579
python
en
code
0
github-code
90
28982952751
from collections import Counter from typing import List from build_homepage_md import * def save_lines(lines, output_dir, output_name): full_path = os.path.join(output_dir, output_name) with open(full_path, "w") as f: f.writelines(lines) print("".join(lines)) print(f"Save at {full_pat...
jyscardioid/jyscardioid.github.io
_build_contents/build_cv_tex.py
build_cv_tex.py
py
8,280
python
en
code
null
github-code
90
29544207807
# -*- coding: utf-8 -*- # @Time : 2022/4/24 10:23 # @Author : 模拟卷 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 6042AC. 统计圆内格点数目.py # @Software: PyCharm # =================================== """ """ from leetcode_python.utils import * class Solution: def ...
monijuan/leetcode_python
code/competition/2022/20220424/6042AC. 统计圆内格点数目.py
6042AC. 统计圆内格点数目.py
py
1,412
python
en
code
0
github-code
90
7394441221
from src.index import build_store from src.boards import Board class Player: def __init__(self, store, user, player_x = False, player_o = False): if player_x: self.player = 'x' if player_o: self.player = 'o' # self.state = state self.user_id = user.id ...
dinhcnt/tic_tac_toe
tic_tac_toe/src/player.py
player.py
py
622
python
en
code
0
github-code
90
6102176055
# coding=utf-8 import os from prodtools.reports import validation_status try: from PIL import Image IMG_CONVERTER = True except Exception as e: IMG_CONVERTER = False from prodtools.utils import svg_conversion from prodtools import _ IMDEBUGGING = False MIN_IMG_DPI = 300 MIN_IMG_WIDTH = 789 MAX_IMG_WI...
scieloorg/PC-Programs
src/scielo/bin/xml/prodtools/utils/img_utils.py
img_utils.py
py
3,794
python
en
code
7
github-code
90
18063669939
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, A, *X = map(int, read().split()) M = sum(X) dp = [[0] * (M + 1) for j in range(N + 1)] dp[0][0] = 1 for i in range(N): ...
Aasthaengg/IBMdataset
Python_codes/p04013/s426729495.py
s426729495.py
py
590
python
en
code
0
github-code
90
9314146270
import cv2 as cv import glob import numpy as np import os from .homography import get_homographies from .intrinsics import get_camera_intrinsics from .extrinsics import get_extrinsics from .distortion import estimate_lens_distortion from .refinement import refine_all def find_chessboard_corners(root_path='./chessboa...
luckykk273/Camera-Calibration
utils/calibration.py
calibration.py
py
3,644
python
en
code
1
github-code
90
74879707495
import pandas as pd import tushare as ts import numpy as np import matplotlib.pyplot as plt """ Step 1 Download data from tushare """ # Tushare.Pro Token pro = ts.pro_api('00d803b166f55fc30c178d74c158985136010d6bd19271b182059eef') # Reserch time period start at 2016 start_date = '20160101' end_date = '20220224' # 农业银行 ...
daniel620/Quant
Tasks/Task1 Daily trading based on rules/task1.py
task1.py
py
3,789
python
en
code
0
github-code
90
18572580279
from collections import deque N, M = map(int, input().split()) G = [[] for _ in range(N)] for i in range(M): L, R, D = map(int, input().split()) G[L-1].append((R-1, D)) G[R-1].append((L-1, -D)) visited = [False] * N xs = [0] * N xs[0] = 0 x = 0 for i in range(N): if visited[i]: continue stack = deque...
Aasthaengg/IBMdataset
Python_codes/p03450/s913149024.py
s913149024.py
py
689
python
en
code
0
github-code
90
72207848938
""" 找出数组中重复的数字 在一个长度为n的数组里的所有数字都在0~n+1的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请不改变原数组,找出数组中任意一个重复的数字并返回。 输入:【2,3,1,0,2,5,3】 输出: 2或3 请以数组【1,4,6,2,4,3,8,6,1】开始解题 """ from typing import List class Solution: def findRepeatNumber(self, nums: List[int]) -> int: counts = dict() for num in nums: ...
Asunqingwen/LeetCode
AC组/找出数组中重复的数字.py
找出数组中重复的数字.py
py
844
python
zh
code
0
github-code
90
74385734055
# -*- coding: utf-8 -*- import logging from openerp.osv import osv, fields from openerp.tools.translate import _ _logger = logging.getLogger(__name__) class email_template(osv.osv): "Templates for sending email" _inherit = "email.template" def send_mail(self, cr, uid, template_id, res_id, force_send=Fal...
dkubiak789/dkubiak_odoo_module
email_template.py
email_template.py
py
3,538
python
en
code
0
github-code
90
74706336937
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from scipy.optimize import minimize from visualization import visualization class GPR: def __init__(self, optimize=True, kernel='squared_exp'): self.is_fit = False self.train_X, self...
yuzhTHU/SP-Project-GPR
GPR.py
GPR.py
py
6,442
python
en
code
0
github-code
90
72208001578
# -*- coding: utf-8 -*- # @Time : 2019/10/28 0028 10:45 # @Author : 没有蜡笔的小新 # @E-mail : sqw123az@sina.com # @FileName: Remove Zero Sum Consecutive Nodes from Linked List.py # @Software: PyCharm # @Blog :https://blog.csdn.net/Asunqingwen # @GitHub :https://github.com/Asunqingwen """ Given the head of a linked l...
Asunqingwen/LeetCode
medium/Remove Zero Sum Consecutive Nodes from Linked List.py
Remove Zero Sum Consecutive Nodes from Linked List.py
py
2,153
python
en
code
0
github-code
90
18020371613
# -*- coding: utf-8 -*- """ In the previous program, I create two lists to store my time of del operator on dictionary and list. We can see that Dict < List is true, so that the time for del operator on dictionary is smaller than time we need on list. From running the code above, we can see that the time of delete fro...
kwu19/Runtime-Analysis
run_time_analysis_del.py
run_time_analysis_del.py
py
2,380
python
en
code
0
github-code
90
40468424233
class NestedSphere: def __init__(self, materials, radius1=10, radius2=5): self.radius1 = radius1 self.radius2 = radius2 self.materials = materials def csg_model(self): import openmc surface1 = openmc.Sphere(r=self.radius1) surface2 = openmc.Sphere(r=sel...
fusion-energy/model_benchmark_zoo
src/model_benchmark_zoo/nestedsphere.py
nestedsphere.py
py
1,993
python
en
code
2
github-code
90
20367843081
class Solution: def shortestPathBinaryMatrix(self, grid: List[List[int]]) -> int: if grid[0][0] == 1: return -1 q = deque([[0,0,1]]) ex, ey = len(grid)-1, len(grid)-1 self.res = float('inf') while len(q) > 0: cx, cy, dt = q.popleft()...
RishabhSinha07/Competitive_Problems_Daily
1091-shortest-path-in-binary-matrix/1091-shortest-path-in-binary-matrix.py
1091-shortest-path-in-binary-matrix.py
py
845
python
en
code
1
github-code
90
18188768389
N, M, K = map(int, input().split()) A_list=list(map(int, input().split())) B_list=list(map(int, input().split())) import itertools A_acum=list(itertools.accumulate(A_list)) B_acum=list(itertools.accumulate(B_list)) A_acum.insert(0, 0) B_acum.insert(0, 0) """ A_acum=[0] B_acum=[0] for i in range(1, N+1): A_acum[i]=...
Aasthaengg/IBMdataset
Python_codes/p02623/s316834146.py
s316834146.py
py
607
python
en
code
0
github-code
90
44856677800
""" Module for database related stuff to keep the main.py clean """ from os import environ # pylint: disable=unused-import #for dev env from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker # SQLALCHEMY_DATABASE_URL = # "postgresql://<...
HungrySquad/back_python
app/database.py
database.py
py
802
python
en
code
0
github-code
90
11628350576
import datetime from airflow import DAG from airflow.providers.postgres.operators.postgres import PostgresOperator from airflow.utils.dates import days_ago default_args = {'owner': 'Dylan Bragdon'} with DAG( dag_id = 'create_postgres_tables', start_date = days_ago(2), schedule_interval = None, default...
dbragdon1/hn_airflow
dags/create_tables.py
create_tables.py
py
541
python
en
code
0
github-code
90
33707684890
'''Calculation functionality for 2D vectors and points.''' import math from game_common.twodee.geometry import vector def multiplyVectorAndScalar(vector, scalar): (x, y) = vector return (x * scalar, y * scalar) def addVectors(*vectors): totalx, totaly = (0, 0) for (vecto...
krieghan/game_common
game_common/twodee/geometry/calculate.py
calculate.py
py
3,195
python
en
code
1
github-code
90
17945807435
# converts fnf json files for quick and dirty tracks for testing from math import inf import json with open('fresh.json') as file: fnf = json.load(file) print(fnf) with open('fresh.oron', 'w') as file: file.write('bpm={}\n'.format(float(fnf['bpm']))) used_times = set() obstacles = [] for sectio...
spazzylemons/openribbon
tools/fnf_converter.py
fnf_converter.py
py
953
python
en
code
0
github-code
90