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
36581229522
# Script Name : git_repo_creator.py # Author : Harish Tiwari # Created : 2nd October 2020 # Last Modified : - # Version : 1.0.0 # Modifications : # Description : This python script will create a github repo from command line. import requests import json user_name = input("Enter your github us...
hastagAB/Awesome-Python-Scripts
Git_repo_creator/git_repo_creator.py
git_repo_creator.py
py
1,065
python
en
code
1,776
github-code
13
73476233617
def buildTriangle(h): ''' Draws a triangle out of numbers with height h ''' count = 1 count1 = 0 for i in range(h): count1 += 1 if (i < h/2): for j in range(i): print(count, end="") count += 1 print("\n") else...
bsneeb/Interview-Practice-Problems
draw_number_triangle.py
draw_number_triangle.py
py
570
python
en
code
0
github-code
13
35742780546
import pygame import settings as s def partition(array, lowestIndex, highestIndex): i = (lowestIndex - 1) pivotNum = array[highestIndex] s.numColor[highestIndex] = 1 ##pivot s.drawScreen() for j in range(lowestIndex, highestIndex): s.numColor[j] = 2 ##checked num ...
Mayank808/Pygames-Sorting-Visualizers-
VisualizerProgram/quickSort.py
quickSort.py
py
1,116
python
en
code
0
github-code
13
2974096500
from collections.abc import Iterator class Company(): def __init__(self, employee_list): self.employee = employee_list def __iter__(self): # 自己定义迭代器时,一般不自己实现next函数,而是采用这种方法。 return MyIterator(self.employee) def __getitem__(self, item): return self.employee[item] class MyIterator(It...
sangjianshun/Master-School
python_high_level/chapter09/iterable_iterator.py
iterable_iterator.py
py
906
python
en
code
34
github-code
13
15217556092
""" Author :Birhan Tesfaye Last Edit :May 23 """ from pdf import font from pdf import natural_order import json SortBlocks=natural_order.SortBlocks SortLines=natural_order.SortLines SortSpans=natural_order.SortSpans heading_name=["chapter","unit","part"] heading_lvl=["zero","one","two","three","fo...
Birhant/PDF-summarizer
PDF Summarizer/PDF Summarizer (user edition)/pdf/extract.py
extract.py
py
2,536
python
en
code
0
github-code
13
8546033382
#-*- coding: utf-8 -*- from tornado.gen import coroutine from tornado.web import (authenticated, asynchronous) from ..tools import (route, BaseHandler) from pony.orm import (db_session,) from ..entities import (Prestacion,) from ..criterias import capabilityCrt from json import dumps, loads @route('/prestacio...
enlacescomunitarios/enlaces
app/views/prestaciones.py
prestaciones.py
py
2,116
python
en
code
0
github-code
13
30160417328
# -*- mode: python -*- a = Analysis(['pyfanfou.py'], pathex=['D:\\mcxiaoke\\pyfanfou'], hiddenimports=[], hookspath=None, runtime_hooks=None) pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, exclude_binaries=True, name='pyfanfou.exe'...
mcxiaoke/pyfanfou
pyfanfou.spec
pyfanfou.spec
spec
607
python
en
code
50
github-code
13
71366111057
from benchopt import BaseDataset, safe_import_context from sklearn.preprocessing import StandardScaler import numpy as np with safe_import_context() as import_ctx: from benchopt.datasets import make_correlated_data class Dataset(BaseDataset): name = "reg_sim" parameters = { 'n_samples, n_feature...
softmin/ReHLine-benchmark
benchmark_QR/datasets/reg_sim.py
reg_sim.py
py
969
python
en
code
2
github-code
13
73539302738
from urllib.request import urlopen from lab_01.perceptron import * __author__ = 'adkozlov' def load_data(positive=1, negative=-1): result = [] file = urlopen("http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/wdbc.data") for line in file.readlines(): array = line.d...
anton-bannykh/ml-2013
andrew.kozlov/lab_01/main.py
main.py
py
1,476
python
en
code
4
github-code
13
31266967552
from utils import euler_lib def main(): n = 10000 amicables = [] for a in range(1, n): a_sum = sum(euler_lib.get_proper_factors(a)) # only add pair once [220, 284] not [220, 284, 284, 220] b = a_sum if a > b: continue b_sum = sum(euler_lib.get_prope...
stephendwillson/ProjectEuler
solutions/python/problem_21.py
problem_21.py
py
522
python
en
code
0
github-code
13
26843007191
import logging import sys from pathlib import Path from http.server import HTTPServer, BaseHTTPRequestHandler # Add repo root to path to make config_composer importable repo_root = str(Path(__file__).absolute().parent.parent.parent) sys.path.append(repo_root) from config_composer.core import Config, Spec # noqa: E4...
tomdottom/config-composer
examples/simple_http/server.py
server.py
py
1,153
python
en
code
0
github-code
13
6226696465
import numpy as np def tobits(s): result = [] for c in s: bits = bin(ord(c))[2:] bits = '00000000'[len(bits):] + bits result.extend([int(b) for b in bits]) return result def frombits(bits): chars = [] for b in range(len(bits) // 8): byte = bits[b*8:(b+1)*8] c...
AlexGlz/Queztal-Copiler
Código/Steganography.py
Steganography.py
py
2,339
python
es
code
0
github-code
13
28105217059
#!/usr/bin/env python3 class Day01: def __init__(self, file): self.numbers = [int(line) for line in open(file).readlines()] def run_part1(self): return sum(self.numbers) def run_part2(self): sums = set() freq = 0 while True: for number in self.numbers: ...
danschaffer/aoc
2018/day01.py
day01.py
py
873
python
en
code
0
github-code
13
73605357138
# !/usr/bin/python3 # -*- coding: utf-8 -*- from collections import Counter # @Author: 花菜 # @File: 424替换后的最长重复字符.py # @Time : 2023/5/17 17:02 # @Email: lihuacai168@gmail.com # 给你一个字符串 # s # 和一个整数 # k 。你可以选择字符串中的任一字符,并将其更改为任何其他大写英文字符。该操作最多可执行 # k # 次。 # # 在执行上述操作后,返回包含相同字母的最长子字符串的长度。 # # # # 示例 # 1: # # 输入:s = "ABAB"...
lihuacai168/LeetCode
字符串/424替换后的最长重复字符.py
424替换后的最长重复字符.py
py
2,578
python
zh
code
4
github-code
13
8276196702
#num is a identifer and 10 is the value c_name="luminarTechnolagy" location="kakande" print("company",c_name,"is_located",location) name="ajay" age="29" print(name,"is",age,"years old")
deepak368/luminarpython
LanguageFundamentals/Identifiers.py
Identifiers.py
py
189
python
en
code
0
github-code
13
22249702886
""" calculate BIC and WBIC """ from __future__ import print_function import argparse import glob import os import pickle import pandas as pd from _information_criterion import get_n_injections, get_n_params from _information_criterion import load_model, get_values_from_trace_files from _information_criterion import...
nguyentrunghai/bayesian_itc_racemic
scripts/run_cal_information_criterion.py
run_cal_information_criterion.py
py
5,861
python
en
code
0
github-code
13
34511433150
#!/usr/bin/python # -*- coding: utf8 -*- # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Luis F. Simoes # Joerg H. Mueller import numpy as np from .util import * ...
neXyon/k-subsets
ksubsets/algorithms.py
algorithms.py
py
13,268
python
en
code
0
github-code
13
34795623659
#!/usr/bin/env python3 # File name : move.py # Description : Control Motor # Product : PiCar-C # Website : www.adeept.com # Author : William # Date : 2019/11/21 import time import RPi.GPIO as GPIO # motor_EN_A: Pin7 | motor_EN_B: Pin11 # motor_A: Pin8,Pin10 | motor_B: Pin13,Pin12 Motor_A_...
adeept/adeept_picar-b
server/GUImove.py
GUImove.py
py
2,408
python
en
code
21
github-code
13
72543473299
from gspread import Client as GSpreadClient import requests import json import openai from oauth2client.service_account import ServiceAccountCredentials # from dotenv import load_dotenv # load_dotenv() def write_expense_to_spreadsheet(Product_Codes, Price, Client, Client_Code, Orders, Total): scope = ['htt...
tarikkaoutar/OPENAI_Function
cold_email.py
cold_email.py
py
4,504
python
en
code
0
github-code
13
20771771152
import cx_Freeze executables = [cx_Freeze.Executable( script="game_principal.py", icon="assets/pikachu.ico")] cx_Freeze.setup( name="Pokémon Dodge", options={"build_exe": {"packages": ["pygame"], "include_files": ["assets"] }}, executables=executabl...
DolAndi/game_Imed2d-
setup.py
setup.py
py
325
python
en
code
0
github-code
13
16883639774
import os import cv2 import glob import numpy as np import pandas as pd participants = next(os.walk('/home/ausmanpa/gp/VEGA/experiments/E01/data/.'))[1] participants = [part for part in participants if len(glob.glob('/home/ausmanpa/gp/VEGA/experiments/E01/data/'+part+'/*.jpg'))==34] partInts = [int(x) for x in parti...
pjrice/VEGA
experiments/E01/numberStimImages.py
numberStimImages.py
py
1,349
python
en
code
0
github-code
13
34129714162
from tkinter import * import math class Main_menu(Frame): def __init__(self,master,db,admin_access): super(Main_menu,self).__init__(master) self.grid(sticky=N+S+W+E) self.master=master self.admin_access=admin_access self.db=db self.create_widgets() ...
SohailChamadia/Digital-Assets
src/dependencies/Main_menu.py
Main_menu.py
py
5,597
python
en
code
1
github-code
13
39194903379
"""Script for Tkinter GUI chat client.""" # https://medium.com/swlh/lets-write-a-chat-app-in-python-f6783a9ac170 from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter import time global py try: import pygame py=True except: print('WARNING, could not load pygame, so sy...
hermann74/listictac
client2.py
client2.py
py
2,848
python
en
code
0
github-code
13
965417010
import codecs import sys sys.path.append("..") from utils.data_helper import load_attr_data, load_w2v, load_ab_test, load_abp_data, parse_json, load_abp_raw import polarity_level_aspect.networks as networks import utils.train_single as train_single from utils.Data import Data, Data2, Data3 from utils.evaluate import ...
yilifzf/BDCI_Car_2018
polarity_level_aspect/ab_polarity.py
ab_polarity.py
py
26,637
python
en
code
421
github-code
13
17698153049
from Functions import calculate, enter_operation, enter_number valid_operations = ('+', '-', '*', '/', '**') try: first_numb = enter_number() first_operation = enter_operation(valid_operations) second_numb = enter_number() second_operation = enter_operation(valid_operations) third_numb = enter_num...
oshevelo/feb_py
Calculator/Calculator2.py
Calculator2.py
py
560
python
en
code
0
github-code
13
6282325666
# Demonstration of splitting up a program # Demonstration of working with program files from classes import ingredients from classes.ingredients import Ingredient class Inventory(object): """ Class for Inventory. A Dictionary with item names as key and quantity as values. """ def __init__(self, i...
shuvo2109/one-moon-restaurant
classes/inventory.py
inventory.py
py
4,109
python
en
code
0
github-code
13
20680499448
import os import argparse import rlcard from rlcard.agents import DQNAgent, RandomAgent from rlcard.utils import get_device, set_seed, tournament, reorganize, Logger def load_model(model_path, env=None, position=None, device=None): if os.path.isfile(model_path): # Torch model import torch agent =...
Derrc/UnoRL
UnoRL/evaluate.py
evaluate.py
py
2,320
python
en
code
1
github-code
13
12596099984
import sys import tensorflow as tf from PIL import Image import numpy as np # Load the pre-trained MobileNetV2 model model = tf.keras.applications.MobileNetV2(weights='imagenet') # Prepare the image def prepare_image(image_path): img = Image.open(image_path).resize((224, 224)) img_array = np.array(img) / 255....
InsideousBot/Cats-and-Dogs-AI
Cats and Dogs AI.py
Cats and Dogs AI.py
py
1,245
python
en
code
0
github-code
13
7972500983
from test.db import TEST_DB_NAME import pytest from pytest_mock import MockerFixture import app.meal as meal @pytest.fixture(autouse=True) def use_test_db(db_connection, mocker: MockerFixture): mocker.patch.object(meal, "DB_NAME", TEST_DB_NAME) def test_it_deletes_meal(): # given weekday = "teisipäev"...
e1004/toiduplaneerija
test/test_meal_delete.py
test_meal_delete.py
py
717
python
en
code
0
github-code
13
7958830406
import os import sys operations = ["help", "create table", "delete table", "add data", "delete data", "run", "quit"] source = "to_do.sql" # I'm using a variable as it will save time def add_to_file(source, text): with open(source, "r") as read: lines = read.readlines() lines.append(text + "\n") with...
JohnyNich/Python-MySQL-Interface
mysql_interface.py
mysql_interface.py
py
4,864
python
en
code
0
github-code
13
35129175589
class Solution: def totalNQueens(self, n: int) -> int: # based on solution used in N-Queens board = [['.'] * n for _ in range(n)] cols = set() posDiag = set() # (r + c) negDiag = set() # (r - c) def backtrack(r): if r == n: return 1 ...
aakanksha-j/LeetCode
Backtracking/52. N-Queens II/backtracking_1.py
backtracking_1.py
py
859
python
en
code
0
github-code
13
37949285318
# example MC11 jO file that shows how to use PythiaResMod class # PythiaResMod class: # * for W',Z' [ISUB 141,142]: # * - take out Breit-Wigner dependence + # * - supress low mass events from parton luminosities # implementation: PythiaModified/pysgex.F from AthenaCommon.AlgSequence import AlgSequence topAlg = AlgSequ...
rushioda/PIXELVALID_athena
athena/Generators/PythiaExo_i/share/PythiaResModZprime.py
PythiaResModZprime.py
py
2,017
python
en
code
1
github-code
13
27302884025
import re class Paragraph(object): def __init__(self, source_string): self.str = source_string self._paragraph_re = re.compile(r"""^(?!\s|#\. |\* |- |\.\. ).*?(?=\n^\s*$)""", flags=re.MULTILINE + re.DOTALL) @staticmethod def _paragraph(matchobj): ...
codio/book-converter
converter/rst/paragraph.py
paragraph.py
py
559
python
en
code
2
github-code
13
74675210256
from mstk.topology import Topology from mstk.trajectory import Frame from mstk.trajectory.handler import TrjHandler class Gro(TrjHandler): ''' Read and write cell, atomic positions and optionally velocities from/to GRO file. ''' def __init__(self, file, mode='r'): super().__init__() i...
z-gong/mstk
mstk/trajectory/io/gro.py
gro.py
py
4,476
python
en
code
7
github-code
13
19468864461
import pygame RED = (255, 0, 0) WHITE = (255, 255, 255) BLUE = (0, 0, 255) BLACK = (0, 0, 0) class QUI: def __init__(self, game_display): self.game_display = game_display self.font = pygame.font.SysFont('arial', 36) def get_coordinates_for_frame(self, cell, indices, shifts): """ ...
LeraTrubetskikh/hex
game/gui.py
gui.py
py
3,081
python
en
code
0
github-code
13
73271467216
#For the following practice question you will need to write code in Python in the workspace below. This will allow you to practice the concepts discussed in the Scripting lesson, such as reading and writing files. You will see some older concepts too, but again, we have them there to review and reinforce your understan...
Babawale/WeJapaInternship
Labs/Wave_4_labs/Scripting labs/match_flower_name.py
match_flower_name.py
py
2,262
python
en
code
0
github-code
13
25505961432
from keras.callbacks import TensorBoard, ModelCheckpoint from net import AutoEncoder from return_corpus import ReutersMuscleCorpus from functions import get_logger, load_vectors from config import LOGDIR, JAWIKI_MODEL, MUSCLE_CORPUS, MUSCLE_MODEL seq_size = 15 batch_size = 4 n_epoch = 20 latent_size = 512 def main(...
trtd56/MuscleQA
src/ae_train.py
ae_train.py
py
1,539
python
en
code
0
github-code
13
31543203840
# -*- coding: utf-8 -*- # encoding = utf8 import re import time from math import floor # from background_task import background from django.db.models import F from django.template.loader import get_template from django.utils.datastructures import MultiValueDictKeyError from django.views.decorators.csrf import csrf_exe...
wahabaa/keystroke-web-MFA
keys/views.py
views.py
py
84,010
python
en
code
1
github-code
13
41106121476
from mrjob.job import MRJob from mrjob.step import MRStep class partB(MRJob): def mapperB1(self, _, line): fields = line.split(',') try: if len(fields) == 7: address = fields[2] value = int(fields[3]) yield address, (1,value) elif len(fields) == 5: address1 = fields[0] yield address1, (2...
SoniaKoplickat13/Ethereum-Analysis
partB.py
partB.py
py
904
python
en
code
0
github-code
13
20406170559
from abc import abstractmethod from datetime import datetime from dateutil import parser import importlib import json import os import six import threading import time import etcd from tendrl.commons.event import Event from tendrl.commons.message import ExceptionMessage from tendrl.notifier.utils.central_store_util i...
Tendrl/notifier
tendrl/notifier/notification/__init__.py
__init__.py
py
5,813
python
en
code
2
github-code
13
41341725019
import sys with open('day2.txt') as f: line = f.readline() splitted = line.split(',') data = [int(x) for x in splitted] def run_program(arg1, arg2): program = data.copy() program[1] = arg1 program[2] = arg2 iptr = 0 while program[iptr] != 99: op, load1, load2, store = program[i...
mfep/advent-of-code
2019/2/day2.py
day2.py
py
805
python
en
code
2
github-code
13
36983933283
import os from datetime import datetime import pandas as pd import pytz from project_path import * users = User.objects.all().order_by("?") user_excel_file_path = "/home/dubsy/Desktop/Data Analysis/user.xlsx" user_csv_file_path = "/home/dubsy/Desktop/Data Analysis/user.csv" def user_date_module(): user_join...
Suboms/data_analysis
order/export/export_user_data.py
export_user_data.py
py
1,977
python
en
code
1
github-code
13
31963064421
reg = [0,0] ip = 0 p = [line for line in open('23.txt')] def run(a,b): reg = [a,b] ip = 0 while 0 <= ip < len(p): ins = p[ip].split(" ") #print(ip, ins, reg, end=" -> ") if ins[0]=='hlf': r = 0 if ins[1][0]=='a' else 1 reg[r] /= 2 ip += 1 elif ins[0]=='tpl': r = ...
sgdavies/aoc2015
23.py
23.py
py
989
python
en
code
0
github-code
13
28560510322
from bzrlib import ( errors, inventory, osutils, ) from bzrlib.inventory import ( InventoryDirectory, InventoryEntry, InventoryFile, InventoryLink, TreeReference, ) from bzrlib.tests.per_inventory import TestCaseWithInventory from bzrlib...
ag1455/OpenPLi-PC
pre/python/lib/python2.7/dist-packages/bzrlib/tests/per_inventory/basics.py
basics.py
py
12,017
python
en
code
19
github-code
13
26717026338
# 0. 配合 EasyGui,给“下载一只猫“的代码增加互动: # 让用户输入尺寸; # 如果用户不输入尺寸,那么按默认宽400,高600下载喵; # 让用户指定保存位置。 import easygui as Eg import urllib.request as Ur import os import time def user_in(): e = Eg.multenterbox(msg='请输入要下载的图片尺寸', title='下载一只喵', fields=('宽:', '高:'), values=(400, 600)) # 返回的e是一个宽高的list return e ...
HimriZngz/Code
小甲鱼练习/习题054-0.py
习题054-0.py
py
1,499
python
zh
code
0
github-code
13
21131063796
#-*- coding:utf-8 -*- from detectron2.utils.logger import setup_logger from detectron2.data import MetadataCatalog, DatasetCatalog from detectron2.data.datasets import register_coco_instances from detectron2.engine import default_setup from adet.config import get_cfg import detectron2.utils.comm as comm def custom_ar...
hanjianwei92/capture_and_train
train/custom_setting.py
custom_setting.py
py
3,428
python
en
code
0
github-code
13
24856482348
import RPi.GPIO as GPIO # Import GPIO library import time # Import time library import threading import logging GPIO.setmode(GPIO.BCM) # Set GPIO pin numbering TRIG = 24 # Associate pin 23 to TRIG ECHO = 23 # Associate pin 24 to ECHO logging.info("Distance measurement in progress") GPIO.setup(TRIG, GPIO.OUT) ...
Naurislv/self-driving-RCcar
ultrasonic_sensor_HCSR04/SonicSensor.py
SonicSensor.py
py
2,079
python
en
code
4
github-code
13
42050661068
K = int(input()) def search(d, digits, count): if d == 1: return (digits if count == 1 else None), (count-1) s = digits[-1] for i in range(max(s-1, 0), min(s+2, 10)): answer, count = search(d-1, digits + [i], count) if answer: return answer, count return None, count...
keijak/comp-pub
atcoder/abc161/d.py
d.py
py
595
python
en
code
0
github-code
13
12803846081
def make_range_list(start, end, prefix='net_', suffix=''): rlist = [] for x in xrange(start, end + 1): rlist.append(prefix + str(x) + suffix) return rlist SSH_PASS = 'hpvse1' admin_credentials = {'userName': 'Administrator', 'password': 'wpsthpvse1'} admin_credentials_TB = {'userName': 'Administr...
richa92/Jenkin_Regression_Testing
robo4.2/fusion/tests/wpst_crm/feature_tests/C7000/F861_API/data_variables.py
data_variables.py
py
36,858
python
en
code
0
github-code
13
31037473082
from Nguoi import Nguoi class HoGiaDinh: family_list = [] def __init__(self): self.address = None self.number_of_member = 0 self.member_list = [] def input_info(self): self.address = input("Nhập địa chỉ hộ gia đình: ") while True: option = input("Bạn có m...
nhatelecom/practice_python
19-06hogiadinh/HoGiaDinh.py
HoGiaDinh.py
py
781
python
vi
code
0
github-code
13
73111217617
import pandas as pd import get_raw_data import geocoder import numpy as np import datetime from dateutil.relativedelta import relativedelta import streamlit as st import json import requests def get_semestral_dates(start_last_month=True): """ return a dict with the dates from the imediate previous and the sec...
arturlunardi/orion_dp
create_dataset.py
create_dataset.py
py
17,730
python
pt
code
0
github-code
13
12135504633
''' 拟合轮廓的最小包围圆 ''' import cv2 import numpy as np img = cv2.imread('../data/cloud.png') cv2.imshow('img', img) # 灰度化 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 二值化 t, binary = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY) cv2.imshow('binary', binary) # 查找轮廓 cnts, hie = cv2.findContours(binary, ...
15149295552/Code
Month08/day14/12_minEnclosingCircle.py
12_minEnclosingCircle.py
py
761
python
en
code
1
github-code
13
36674636889
import requests import csv import os import json from mysklearn.mypytable import MyPyTable OMDB_API_URL = "http://www.omdbapi.com/?apikey=60a1d5e4&" FIELDS = ['title', 'year', 'rated', 'release_date', 'runtime', 'genre', 'director', 'writer', 'actors', 'plot', 'language', 'country', 'awards', 'post...
tbech12/CPSC322-Final-Project
get_omdb_data.py
get_omdb_data.py
py
3,300
python
en
code
0
github-code
13
25137345360
### ### GPAW benchmark: Carbon Nanotube ### from __future__ import print_function from gpaw.mpi import size, rank from gpaw import GPAW, Mixer, PoissonSolver, ConvergenceError from gpaw.occupations import FermiDirac try: from ase.build import nanotube except ImportError: from ase.structure import nanotube # d...
mlouhivu/gpaw-benchmarks
carbon-nanotube/input.py
input.py
py
1,713
python
en
code
1
github-code
13
73729678738
from django.shortcuts import render, get_object_or_404 from .models import Post, Comment from django.views.decorators.http import require_POST from django.contrib.auth.decorators import login_required from django.http import JsonResponse #======================LIST VIEW======================== def list(request)...
khanshoaib3/newsWebsite
project/newsBlog/views.py
views.py
py
1,891
python
en
code
1
github-code
13
74875911376
import os import warnings import shutil import pandas as pd import numpy as np from itertools import cycle import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score from sklearn.model_selection import train_test_split from sklearn.linear_model import ElasticNet from ...
banuatav/mlflow_serve_model
train.py
train.py
py
4,517
python
en
code
0
github-code
13
8841855178
from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from product.models.product import Product from product.models.review import ProductReview from product.serializers.review import...
vasilistotskas/grooveshop-django-api
tests/integration/product/review/test_view_product_review.py
test_view_product_review.py
py
7,509
python
en
code
4
github-code
13
24956822149
import cv2 import numpy as np class ImageTransform(object): def rotateImage(self,img_main,contour): # Rotate Image------------------------------------------------------------------------- approximation = cv2.approxPolyDP(contour, 0.02 * cv2.arcLength(contour, True), True) h1 = np.sqrt(np....
chamil-prabodha/Opencv_Voting_System
ImageTransform.py
ImageTransform.py
py
2,737
python
en
code
0
github-code
13
21236156712
""" This script demonstrates how to read holding current from ABF files. You may need to install pyABF using the command "pip install pyabf" """ import pyabf import numpy as np # the R before the string tells Python to ignore backslashes abfFilePath = R"C:\Users\scott\Documents\GitHub\pyABF\data\abfs\2019_05_02_DIC2_...
shengwanhui/Lab-Analysis-2019-2021-
dev/abf-files/holding-current.py
holding-current.py
py
723
python
en
code
2
github-code
13
12002287866
import MeCab import collections R=[] q1 = defaultdict(int) mecab = MeCab.Tagger() co=0 from collections import defaultdict d = defaultdict(int) n="" with open('/Users/takeidaichi/Library/Mobile Documents/com~apple~CloudDocs/大学院 授业/自然言语処理/neko.txt', 'r') as fin: for line in fin.readlines(): r = mecab.parse(l...
tk-q/-
NLP/Kadai4/-3.py
-3.py
py
1,727
python
zh
code
0
github-code
13
16063940387
# Noel Wafuko # nww010 # 11308656 # For Instructor Jeff Long def hasMajority ( ls ): """ Determines if the input list " ls " includes the majority element or not . : param ls : an arbitrary list with comparable elements : return : True if the input list has a majority element ; False otherwise . ’’...
collinskoech11/BlackBoxTestPy
a9q3.py
a9q3.py
py
852
python
en
code
0
github-code
13
18757746735
import numpy as np import h5py import os def print_size(file_name): try: st = os.stat(file_name) print(str(st.st_size) + ' bytes') except OSError as e: print(e) # create dataset without compression matrix1 = [['abcde'] * 1000] * 1000 matrix2 = [['abcde'] * 1000] * 1000 matrix3 = [['abcde'] * 1000] ...
MohamedAboBakr/HDF5
Data_compression.py
Data_compression.py
py
1,567
python
en
code
0
github-code
13
46201298894
import os from typing import List, Union, Type from yapim import Task, DependencyInput class KofamscanExecAnnotation(Task): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.output = { "kegg": self.wdir.joinpath(self.record_id + ".kegg.txt") } @s...
cjneely10/EukMetaSanity
EukMetaSanity/src/dependencies/kofamscan/kofamscan.py
kofamscan.py
py
939
python
en
code
17
github-code
13
24814370595
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0,resolution=None,framerate=30): # initialize the variable used to indicate if the thread should # be stopped self.stopped = False self.src = src self.reso...
MinervaBots/Trekking
firmware/pi/videoStream/WebcamVideoStream.py
WebcamVideoStream.py
py
1,874
python
en
code
1
github-code
13
41432703513
import requests # import json class BankRate: def __init__(self, balance=5000, term=12, rate=1.50, compounded=12): self.term = term self.rate = rate self.monthly_rate = None self.balance = balance self.compounded = compounded self.month_return = (se...
ausward/Treasury-vs-Bank-Account
advise.py
advise.py
py
5,501
python
en
code
9
github-code
13
3103119660
# 4. Sorted insert in a Link list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def insert(self, head, value): dummy = ListNode(-1) dummy.next = head cur = dummy while cur.next and cur.next.val <= value: ...
jsong0727/Fall2022_DataStructuresAlgo
Midterm/p4.py
p4.py
py
742
python
en
code
0
github-code
13
31195615301
import refnx.util.general as general import refnx import numpy as np from pathlib import Path from numpy.testing import assert_almost_equal, assert_, assert_allclose def test_version(): # check that we can retrieve a version string refnx.__version__ class TestGeneral: def setup_method(self): sel...
refnx/refnx
refnx/util/test/test_general.py
test_general.py
py
2,006
python
en
code
31
github-code
13
33630595332
import os,json,yaml from datetime import datetime def _create_json(): now = datetime.now() json_file= { "dt":str(now.year)+"-"+str(now.month)+"-"+str(now.day) } json_object = json.dumps(json_file, indent=4) filename = f"/opt/airflow/include/db/{str(now.year)}/{str(now.month)}/{str(now.day)...
yusufgzb/AirFlow-example
scripts/proje3.1_create_json.py
proje3.1_create_json.py
py
575
python
en
code
0
github-code
13
38407954636
from rest_framework.decorators import api_view from rest_framework.response import Response from book.models import Book from book.serializers import BookSerializer from rest_framework import status @api_view(['GET']) def api_overview(request): api_roots = { 'List view': 'api/v1/get_books/', 'Deta...
daniltop3309/drf_books
book/views.py
views.py
py
1,517
python
en
code
0
github-code
13
15952025521
import torch import numpy as np def partition_data_based_on_labels(dataset, n_clients=3, random_seed=1, alpha=0.1): y_s = torch.tensor([dataset.__getitem__(i)[1] for i in range(len(dataset))]) labels = torch.unique(y_s) n_classes = len(labels) np.random.seed(random_seed) dist = np.random.dirichl...
SamuelHorvath/Simple_FL_Simulator
fl_sim/data_funcs/utils.py
utils.py
py
1,076
python
en
code
7
github-code
13
2194362347
from django.db import models from model_utils.models import TimeStampedModel from products.models import ProductColor,Product from .order import Order class OrderItemManager(models.Manager): def create(self, **obj_data): instance = super().create(**obj_data) instance.item_cost = instance.product.pr...
aahmadsaleem95/tarzkarX
backend/orders/models/order_item.py
order_item.py
py
1,264
python
en
code
0
github-code
13
26454732503
def bubble_sort(arr): # 3 2 1 count = 0 for i in range(len(arr)): # 0 1 2 -> 0 for j in range(len(arr)-1): # 0 1 -> 0 if arr[j] > arr[j+1]: # 3 > 2 -> 3 > 1 count = count + 1 ...
Eyakub/Problem-solving
HackerRank/30DaysOfCode/Python/day_20_sorting.py
day_20_sorting.py
py
671
python
en
code
3
github-code
13
34419908590
while True: ch=int(input("Enter your choice: (Press 1 to continue and 0 to close):-")) if ch==1: email=input("Enter your E-Mail Address: ") k,j,d = 0,0,0 # print(email) if len(email)>=6: #checking condintion length should be more than 6 char if email[...
GauravGurv/Python_Program
Email_Validation.py
Email_Validation.py
py
2,169
python
en
code
0
github-code
13
30063959206
input_list = [] while True: try: num = int(input("Enter an integer (or any non-integer to finish): ")) input_list.append(num) except ValueError: break print("Integers in reverse order:") for num in reversed(input_list): print(num) print("Without reversed function ") #w...
amrutahabbu/python_programs
reverse_integers.py
reverse_integers.py
py
419
python
en
code
0
github-code
13
6977645020
from bogof_rule import BogofRule from bulk_discount import BulkDiscount from storage import Storage class Checkout: def __init__(self, pricing_rules=[]): self.pricing_rules = pricing_rules self.basket = [] self.products = Storage().products def scan(self, product_code): for pro...
Davidslv/checkout.py
checkout.py
checkout.py
py
614
python
en
code
0
github-code
13
4786470467
# coding=utf-8 from main import log import model from config import key_state as default_key def judge_phase(content,Express_Company): guess = [] if default_key.get(Express_Company): key_state = default_key.get(Express_Company) # print(key_state,Express_Company) else: key_state ...
SmallPotY/request_express
helper.py
helper.py
py
3,930
python
en
code
0
github-code
13
31625878304
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 9 11:34:19 2017 @author: ajaver """ import glob import os import pymysql import pandas as pd from calculate_features import exec_parallel from check_real_data import read_feat_summary training_dir = '/Volumes/behavgenom$/Kezhi/Classifier_DL/trai...
ver228/work-in-progress
work_in_progress/kezhi_paper/training_basenames.py
training_basenames.py
py
1,043
python
en
code
0
github-code
13
12695998410
from db import * from math import ceil from random import choice import functions bjplayers = {} cards = ('A', 'K', 'Q', 'J', 10, 9, 8, 7, 6, 5, 4, 3, 2) class blackjack(): def __init__(self, author, bet=0): self.id = author.id self.name = str(author.name) self.mention = author.mention ...
SpaceProjects/nedobotapp
blackjack.py
blackjack.py
py
4,778
python
en
code
0
github-code
13
18322806016
import pydub import pytube output_path = "C:/Users/epics/Music" segments = [] playlist = pytube.Playlist("https://youtube.com/playlist?list=PL3PHwew8KnCl2ImlXd9TQ6UnYveqK_5MC") for i in range(0,16): segments.append(pydub.AudioSegment.from_file(f"{output_path}/.ytmp3_cache/{i}.mp3",format="mp4")) sum(segments).ex...
epicshepich/Grimoire-Lazulum
temp.py
temp.py
py
397
python
en
code
1
github-code
13
27253342479
import pandas as pd import matplotlib.pyplot as plt import numpy as np from statsmodels.tsa import stattools from arch import arch_model SHret = pd.read_table('TRD_IndexSum.txt', index_col='Trddt', sep='\t') SHret.index = pd.to_datetime(SHret.index) SHret = SHret.sort_index() plt.subplot(211) plt.plot(SHret**2) plt.xt...
FunkyungJz/Some-thing-interesting-for-me
量化投资书/量化投资以Python为工具/ch25/01.py
01.py
py
634
python
en
code
null
github-code
13
11154402642
from django.shortcuts import render from Web.models import * from util.Pagination import * from django.http import * from datetime import datetime # Create your views here. def validate(request): try: request.session["adminid"] except KeyError: try: userid = request.session["userid...
jinbaizhe/DjangoProject
Admin/views.py
views.py
py
10,884
python
en
code
0
github-code
13
41507805619
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import division from collections import OrderedDict from collections import namedtuple import os import socket import threading import time def tcplink(sock, addr): def memory_stat(): mem = {} f...
Shapooo/linux-remote
getinfo-srv.py
getinfo-srv.py
py
4,495
python
en
code
1
github-code
13
9521394917
from inspect import isclass from django.contrib.admin.utils import model_format_dict from django.contrib.contenttypes.models import ContentType from django.urls import reverse from django.utils.html import escape as html_escape from django.utils.safestring import mark_safe def get_admin_url(django_entity, anchored=T...
silverapp/silver
silver/utils/admin.py
admin.py
py
1,464
python
en
code
292
github-code
13
26854057525
import tornado.web import tornado.ioloop import os from tornado.options import define, options from common.url_router import include, url_wrapper from common.models import init_db from conf.base import ( SERVER_PORT, SERVER_HEADER ) from views.questioners.questioners_views import LoginHandler class Applica...
xiaoyuerova/questionnaireServer
main.py
main.py
py
1,409
python
en
code
0
github-code
13
44040793016
import cv2 import cv2 video = cv2.VideoCapture(0) while True: status, frame = video .read() #resize #print(frame.shape) #frame=cv2.resize(frame,(frame.shape[1]//2, frame.shape[0]//2)) cv2.rectangle(frame, (100,100), (200,200), (0,255,0),2) cv2.putText(frame,'Live', (150,80), ...
itzzyashpandey/python-data-science
DataScience/webcam_annotated.py
webcam_annotated.py
py
508
python
en
code
0
github-code
13
14411527274
import unittest from CardSet import * from Grid import * class GridTest(unittest.TestCase): def setUp(self): self.grid = Grid() self.grid.init_crazy_turtle_game() def test_exception_grid_card(self): self.assertRaises(GridCardNotFound, self.grid.set_card, Card("TJTBTVCJ"), 1, 1) ...
mrcanard/CrazyTurtleSolver
GridTest.py
GridTest.py
py
4,808
python
en
code
0
github-code
13
6571333975
from bs4 import BeautifulSoup import requests response = requests.get("https://www.empireonline.com/movies/features/best-movies-2/") soup = BeautifulSoup(response.text, "html.parser") film_href_tags = soup.find_all(name="a") films = reversed([film_href.text.split("Read Empire's review of ")[1] for film_href in film_h...
YofiTofi/beautifulsoup_films
main.py
main.py
py
556
python
en
code
0
github-code
13
15523831323
from itertools import chain, tee def build_matrix(s, t, m, n): M = [[[] for x in range(n + 1)] for y in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 or j == 0: M[i][j] = 0 elif s[i - 1] == t[j - 1]: M[i][j] = M[i - 1][j ...
neumann-mlucas/rosalind
src/rosalind_lcsq.py
rosalind_lcsq.py
py
1,603
python
en
code
0
github-code
13
2510550323
from .exceptions import SchemaConflictException from .exceptions import StopConsumer from .exceptions import UnhandledMessage from .exceptions import UnregisteredSchemaException from .kafka import KafkaTopicManager from .utils import resolve_dotted_name from functools import partial from pydantic import BaseModel from ...
dmanchon/kafkaesk
kafkaesk/app.py
app.py
py
17,955
python
en
code
null
github-code
13
9063398303
import sys input = sys.stdin.readline from collections import deque # 상하좌우 dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] # n, m을 입력받음 n, m = map(int, input().split()) # 미로정보를 입력받음 maze = [] for _ in range(n): maze.append(list(input().rstrip())) # bfs를 위한 visited 리스트 생성 visited = [[False] * m for _ in range(n)] # 큐 생성하...
yudh1232/Baekjoon-Online-Judge-Algorithm
2178 미로 탐색.py
2178 미로 탐색.py
py
1,173
python
ko
code
0
github-code
13
2292560709
from test_class import TestClass from test_sample import TestClass1 def main(): t = TestClass() t.test_one() t.test_two() t = TestClass1() t.test_one1() t.test_two2() if __name__ == "__main__": main()
sneha203406/pytestProject1
tests/main.py
main.py
py
235
python
en
code
0
github-code
13
43114260172
import sys import heapq input = sys.stdin.readline INF = int(1e9) n, m = map(int, input().split()) start = int(input()) graph = [[] for _ in range(n + 1)] # 인접 노드 그래프 distance = [INF] * (n + 1) # 최소 거리 정보 (시작점에서부터 각 노드 까지) for _ in range(m): u, v, w = map(int, input().split()) graph[u].append((v, w)) # i[0]은 목적...
jinhyungrhee/Problem-Solving
BOJ/BOJ_1753_최단경로.py
BOJ_1753_최단경로.py
py
1,251
python
ko
code
0
github-code
13
10409651744
import torch import torch.nn as nn class TimeDistributed(nn.Module): """ A layer that could be nested to apply sub operation to every timestep of sequence input. """ def __init__(self, module, batch_first=True): super(TimeDistributed, self).__init__() self.module = module self.b...
Adamink/EventBasedAction
src/model/utils.py
utils.py
py
1,390
python
en
code
0
github-code
13
73469392656
import torch from torch.autograd import Variable from torch.nn import Linear, ReLU, CrossEntropyLoss, Sequential, Conv2d, MaxPool2d, Module, Softmax, BatchNorm2d, Dropout from torch.optim import Adam, SGD from load_data import mask from torch.utils.data import DataLoader import csv import pandas as pd import numpy as n...
AugustusXie-rgb/mask_PUF
Resnet_prediction.py
Resnet_prediction.py
py
6,023
python
en
code
0
github-code
13
72320803537
from .cloud import S3 , GS from .db import DB import time import sys bucket_name = "towercrane-projects" class Config(): def __init__(self): self.db = DB() self.db.setupDB() self.mother_config = self.db.get_mother_config() self.set_mother_config = self.db.set_mother_config ...
ashtianicode/towercrane
towercrane/config.py
config.py
py
2,827
python
en
code
0
github-code
13
12946655299
def jiujiu(): xx = 9 for i in range(1, xx + 1): for j in range(1, i + 1): print('%d*%d=%d' % (i, j, i * j), end='\t') print() jiujiu() def xiaoxiao(): print('luoluo') xiaoxiao() print(xiaoxiao()) #没有返回值默认返回None def fib(): a = [0, 1] b = 8 for i in range(b-2): ...
HLQ1102/MyPython
base-python/py03/hanshu.py
hanshu.py
py
618
python
en
code
0
github-code
13
72995643219
#!/usr/bin/python3 from sys import argv if __name__ == "__main__": length = len(argv) if length < 2: print('0 arguments.') elif length == 2: print('1 argument:') else: print('{:d} arguments:'.format(length - 1)) for i in range(1, length): print('{:d}: {}'.format(i, ar...
HeimerR/holbertonschool-higher_level_programming
0x02-python-import_modules/2-args.py
2-args.py
py
328
python
en
code
1
github-code
13
43147099696
""" Traffic Light >> YOLOv5m Stop Line and Lane line >> TwinLite 模型串行 """ import os import sys from collections import deque from pathlib import Path import cv2 import numpy as np import tritonclient.grpc as grpcclient import torch from sklearn.cluster import DBSCAN from models import TwinLite as net ...
bg-szy/iav
Perception_with_TritonServer.py
Perception_with_TritonServer.py
py
20,201
python
en
code
0
github-code
13
33089224766
# from botXsrc.botXexport import botXexport from botXsrc.peanut_arm_api.arm_component import ArmComponent """ botXexport is a dictionary containing all the reusable components you developed for the project, and you will use them in the main program. """ def main(): print('starting app ...') ac = ArmComponent...
superbotx/PeanutHacks
botXapp.py
botXapp.py
py
810
python
en
code
0
github-code
13
17048749474
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class ApprovedInfo(object): def __init__(self): self._application_no = None self._approval_letter_url = None self._imm_code = None self._imm_fullname = None self...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/ApprovedInfo.py
ApprovedInfo.py
py
7,079
python
en
code
241
github-code
13