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
37067746847
import numpy as np import matplotlib.pyplot as plt from CGinv import C_Ginv from CGMRES import C_GMRES import time ########################### ## simulation parameters ## ########################### ################################## ## common simulation parameters ## ################################## state_d...
master-sato/C_Ginv
Compare_CGinv_CGMRES_Two-linkArm/Compare_CGinv_CGMRES_Two-linkArm.py
Compare_CGinv_CGMRES_Two-linkArm.py
py
16,617
python
en
code
0
github-code
54
479996985
'' '''Remote procedure call (RPC) To illustrate how an RPC service could be used we're going to create a simple client class. It's going to expose a method named call which sends an RPC request and blocks until the answer is received:''' '''远程过程调用(RPC) 为了说明如何使用RPC服务,我们将创建一个简单的客户端类。 它将公开一个名为call的方法,它发送一个RPC请求并阻塞,直到收到...
Teddy512/Teddy
pythonbase/daydemo/day11/queueRPC.py
queueRPC.py
py
3,486
python
en
code
0
github-code
54
6678883968
from sqlalchemy import create_engine from datetime import datetime import config from TablesClasses import Base, Product, ProductAvailability, WeightProduct, PieceProduct, Customer, Shop, Sale from tabulate import tabulate engine = create_engine(f"mysql+pymysql://{config.user}:{config.password}@localhost/{config.dbNam...
Mort3gar/ExamProject_v1
main.py
main.py
py
6,206
python
en
code
0
github-code
54
40308048153
r='' n=int(input()) val = list(map(int,input().split(','))) i=0 m=[] while(i<len(val)): while(val[i]>0): r=str(val[i]%6)+r val[i]//=6 m.append(r) i+=1 print(*m)
hemanthsoma/Coding-Practice
Base6Rep.py
Base6Rep.py
py
189
python
fa
code
2
github-code
54
9138700668
r""" Perform various m4db project related actions. """ import typer from typer import Option from typer import Argument import pandas as pd from tabulate import tabulate from m4db.orm.schema import Project from m4db.sessions import get_session from m4db.db.project.create import create_project app = typer.Typer()...
Lesleis-Nagy/m4db
lib/m4db/scripts/m4db_project/cmd_line_tool.py
cmd_line_tool.py
py
1,964
python
en
code
0
github-code
54
39093575092
import requests import json from time import sleep base_url = "https://playground.learnqa.ru/ajax/api/longtime_job" job_is_ok = 'Job is ready' job_is_not_ready = 'Job is NOT ready' response1 = requests.request('GET', base_url) answer_dict1 = json.loads(response1.text) payload = {'token': answer_dict1['token']} respon...
PavelMorozov75/LearnQA_Python_API
longtime_job.py
longtime_job.py
py
856
python
en
code
0
github-code
54
12987837942
s = lambda x: "" if x == 1 else "s" count = 1 print("{0} file{1} processed".format(count, s(count))) elements = [(2, 12, "Mg"), (1, 11, "Na"), (1, 3, "Li"), (2, 4, "Be")] def ignore0(e): return e[1], e[2] elements.sort(key = lambda e: (e[1], e[2])) print(elements) # =============================================...
Frederick-Hsu/Python3_Programming
Functions/Lambda_Functions.py
Lambda_Functions.py
py
928
python
en
code
0
github-code
54
29210471919
#mymodule.py ################################################################################################ ############ Mapping from Apple dataset to json structure ###################################### ################################################################################################ ''' { "id"...
joaovicentesouto/INE5454
mongoDB/datasets_to_json.py
datasets_to_json.py
py
21,318
python
en
code
0
github-code
54
72301498082
from django.shortcuts import render from .models import * from django.http import JsonResponse import json # Create your views here. def store(request): if request.user.is_authenticated: customer = request.user.customer order, created = Order.objects.get_or_create(customer=customer, complete=False)...
asherthisside/1130UI-DjangoBatch
python/Django/ecommerce/store/views.py
views.py
py
2,222
python
en
code
1
github-code
54
74765888800
import time from board import * import digitalio import usb_hid import adafruit_ble from adafruit_ble.advertising import Advertisement from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from adafruit_ble.services.standard.hid import HIDService from adafruit_hid.keyboard import Keyboard...
eos21/nrf52_pykey
code.py
code.py
py
4,646
python
en
code
0
github-code
54
8300695731
import os import requests import bs4 from bs4 import BeautifulSoup from triple_agent.constants.paths import ( ALL_EVENTS_FOLDER, ) SCL1_REPLAYS_URL = r"https://www.spypartyfans.com/calvin_is_cool.php?season=1" SCL2_REPLAYS_URL = r"https://www.spypartyfans.com/calvin_is_cool.php?season=2" SCL3_REPLAYS_URL = r"http...
andrewzwicky/TripleAgent
triple_agent/organization/fetch_old_scl_replays.py
fetch_old_scl_replays.py
py
2,063
python
en
code
3
github-code
54
13046504019
"""All minimum dependencies for quantile-forest.""" import argparse from collections import defaultdict CYTHON_MIN_VERSION = "3.0a4" NUMPY_MIN_VERSION = "1.23" SCIPY_MIN_VERSION = "1.4" SKLEARN_MIN_VERSION = "1.0" # 'build' and 'install' is included to have structured metadata for CI. # The values are (version_spec,...
zillow/quantile-forest
quantile_forest/_min_dependencies.py
_min_dependencies.py
py
1,167
python
en
code
60
github-code
54
36857334983
import os from os import system intNum = 4 longNum = 123456789765434567 floatNum = 2.54 stringSingle = 'My dog is a nice one => single quotes' stringDouble = "My dog is a nice one => single quotes" stringTriple = ''' My dog is a nice one ''' stringNum = "56 => still a string" isTrue = True isStudent = False print(f"Int...
JHussle/Python
Data Types/datatypes.py
datatypes.py
py
612
python
en
code
1
github-code
54
35488601117
# threading # multiple threads exist within a single interpreter # due to GIL, the interpreter only interprets code in one thread at a time, while I/O may run in parallel import threading import multiprocessing from time import sleep def thread_hello(): """Running function thread_say_hello in 2 threads.""" ot...
PlumpMath/note-cs61a-sicp
data-processing-parallel-computing.py
data-processing-parallel-computing.py
py
4,458
python
en
code
0
github-code
54
72537453921
import sqlite3 print(sqlite3.version) conn = sqlite3.connect('sqlite3/example.db') c= conn.cursor() c.execute(''' create table if not exists stocks( date text, trans text, symbol text, qty real, price real) ''') c.execute(''' insert into stocks(date,trans,symbol,qty,price) ...
koty08/Web_flask-mariadb
sqlite3/01.sqlite_test.py
01.sqlite_test.py
py
605
python
en
code
0
github-code
54
31758579931
import ujson as uj import os, random, io, joblib, ast import pandas as pd from PIL import ImageOps, Image, ImageDraw, ImageChops from itertools import chain from ast import literal_eval banned_cats = [ 'squiggle', 'line', 'circle', 'yoga' ] def render_single(data, resolution=256, magnification=4, invert_color=Fal...
SzaboKrisztian/aai-final-project
utils.py
utils.py
py
9,574
python
en
code
0
github-code
54
1219343491
from __future__ import annotations from enum import unique from typing import Optional from dl_api_commons.base_models import TenantDef from dl_api_connector.form_config.models.api_schema import ( FormActionApiSchema, FormApiSchema, FormFieldApiSchema, ) from dl_api_connector.form_config.models.base impor...
datalens-tech/datalens-backend
lib/dl_connector_bitrix_gds/dl_connector_bitrix_gds/api/connection_form/form_config.py
form_config.py
py
3,404
python
en
code
99
github-code
54
2509182285
# This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
sajedjalil/Data-Science-Pipeline-Detector
dataset/predicting-red-hat-business-value/Shruti Godbole/feature-selection.py
feature-selection.py
py
2,943
python
en
code
8
github-code
54
26204945748
import scipy.io import numpy as np import matplotlib.pyplot as plt path = '../datasets/ex3data1.mat' mat = scipy.io.loadmat(path) X_tr = mat['X'] # 5000 * 400 y_tr = mat['y'] # 5000 * 1 m = X_tr.shape[0] d = X_tr.shape[1] # print(m,d) # print(y_tr.shape) def predict(w): z = X_tr.dot(w) return 1./(1 + np.ex...
Tran-Nam/training-ARS
ex3/code/ex3-1.py
ex3-1.py
py
1,672
python
en
code
0
github-code
54
28533837391
import heapq def solution(jobs): answer = 0 request = -1 now = 0 cnt = 0 controller = [] while cnt != len(jobs): for job in jobs: if request < job[0] <= now: heapq.heappush(controller, (job[1], job[0])) if controller: job = heapq.heapp...
bbookng/Programmers
Heap/디스크 컨트롤러.py
디스크 컨트롤러.py
py
556
python
en
code
1
github-code
54
25385176312
myDict = { "fast" : "in a quick manner", "neeti" : "A developer", "marks" : [1,2,4], "myDict2" : { "neeti" : "gamer", "love" : "frienship" }, 1: 2 } # print(myDict["Fast"]) # print(myDict["Neeti"]) # print(myDict["marks"]) # print(myDict["myDict2"]) # print(myDict...
Neetis1/Python
01_dictionary.py
01_dictionary.py
py
1,139
python
en
code
0
github-code
54
9537477098
from graph import * from queue import PriorityQueue def aStarSearch(graph, inttoroom, roomtoxy, start, end, heur, pathHeur): q = PriorityQueue() q.put((heur(inttoroom, roomtoxy, start, end), [start])) explored = [] while(not q.empty()): (v, curr) = q.get() if (curr[0] == end): ...
Tectonius/gates6robots
astar.py
astar.py
py
669
python
en
code
0
github-code
54
45911458031
import os import time import shutil import math import torch import numpy as np from torch.optim import SGD, Adam from tensorboardX import SummaryWriter import PIL.Image class Averager(): def __init__(self): self.n = 0.0 self.v = 0.0 def add(self, v, n=1.0): self.v = (self.v * self.n...
mudimingquedeyinmoujia/styleLIIF
utils.py
utils.py
py
5,698
python
en
code
0
github-code
54
22600975137
""" Wimbledon Estimate: 30 minutes Actual: 1 hour 10 minutes """ FILENAME = "wimbledon.csv" INDEX_COUNTRY = 1 INDEX_CHAMPION = 2 def main(): """Read data file and print corresponding details""" records = get_records(FILENAME) champion_count, countries = process_records(records) display_results(cham...
Sathvika-7276/pythonProject8
wimbledon.py
wimbledon.py
py
1,432
python
en
code
1
github-code
54
42651070437
''' Модуль сервера ''' from flask import Flask from flask import request from controller import Controller TOTAL_NUM = 20 app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def index(): ''' Функция при переходе по корневому пути ''' if request.method == 'GET': num = request.args.get('nu...
AccumPlus/lab-1
server.py
server.py
py
472
python
en
code
0
github-code
54
36862445985
import numpy as np import aimgui import aimplot from . import Page class ShadedPlotPage(Page): def reset(self): self.a = np.random.rand(10) self.b = np.random.rand(10) def draw(self): aimgui.begin(self.title) if aimplot.begin_plot("My Plot"): aimplot.plot_shaded...
aimgui/aimgui
pkg/aimplotdemo/aimplotdemo/page/shaded.py
shaded.py
py
517
python
en
code
5
github-code
54
42195311738
import math i = 10 # start at 1 because any number below cannot contain a sum of digits def splitNum(n): digits = [] while n > 0: digits.insert(0, n % 10) # add ones digit to front of digits n = n // 10 return digits nums = [] # Upper limit is this while i <= 40585: digits = spli...
benslv/project-euler
34.py
34.py
py
430
python
en
code
0
github-code
54
17976558477
from utilsa.common import * from scipy import ndimage import numpy as np from torchvision import transforms as T import torch, os from torch.utils.data import Dataset, DataLoader from glob import glob import math import SimpleITK as sitk class Mini_DataSet(Dataset): def __init__(self, data_path, label_path): ...
justaswell/Soma_Unet
dataset/test_dataset.py
test_dataset.py
py
9,157
python
en
code
0
github-code
54
9603815122
from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup import requests import csv region = '관악구' browser = webdriver.Chrome('C:/chromedriver.exe') browser.get('https://map.kakao.com/') browser.implicitly_wait(30) search = browser.find_element_by_css_s...
drizzle0171/DataBase_TeamProject
웹크롤링/웹크롤링 찐최종.py
웹크롤링 찐최종.py
py
1,671
python
en
code
0
github-code
54
27369998260
import matplotlib.pyplot as plt # In die Liste xs packen wir die ganzzahligen Werte von -10 bis 10 xs = [] for x in range(-10, 11): xs.append(x) # In die Liste ys packen wir die Quadratzahlen zu jedem Wert aus der Liste xs ys = [] for x in xs: ys.append(x * x) # In die Liste ys packen wir die Kubikzahlen zu ...
bhb-boy/repo_2
33_grafiken_matplitlib_02.py
33_grafiken_matplitlib_02.py
py
569
python
de
code
0
github-code
54
42504242102
import socket import threading import json import sqlite3 bind_ip = '0.0.0.0' bind_port = 3000 API_HOST = 'http://127.0.0.1:8000/emergency/data' server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) # max backlog of connections headers = {'Accept': 'application/j...
jobbs/hue
hue/tcpsock_svr.py
tcpsock_svr.py
py
1,295
python
en
code
0
github-code
54
33636791659
from tkinter import Tk, ttk, Toplevel, TclError title_style = ('bold', 20) icon = __file__[:__file__.rfind('\\')] + '\\lock.ico' class main_window: def __init__(self): self.root = Tk() self.all_variables = {} def create(self): self.root.resizable(False, False) ...
opipoy/file-locker
locker_frontend.py
locker_frontend.py
py
3,465
python
en
code
1
github-code
54
42988393676
Hell=input(' inset you lang: ') lang=Hell def greets(lang): if lang=='es': return 'Hola' elif lang=='fr': return 'boujour' else : return'Hello' print(greets('en'),"Ali") print(greets('es'),"Sun") print(greets('fr'),"Bill") big = max('Hello World') print(big)
Asban90/Python
language.py
language.py
py
288
python
en
code
0
github-code
54
8550524166
# -*- coding: utf-8 -*- import json import os import re import sys import time import urllib import execjs import pandas as pd import requests from fake_useragent import UserAgent import openpyxl def checkNameValid(name=None): reg = re.compile(r'[\\/:*?"<>|\r\n]+') valid_name = reg.findall(name) if valid_...
garlicsoft/EasyScript
Stock/hsgtcg.py
hsgtcg.py
py
20,325
python
zh
code
0
github-code
54
72372371362
def solution(sequence): # # 3.095602526 # local_max = [[0] * (len(sequence)+1) for _ in range(2)] # pulse = 1 # for i, s in enumerate(sequence): # s *= pulse # local_max[0][i] = max(local_max[0][i-1] + s, s) # local_max[1][i] = max(local_max[1][i-1] + s * -1, s * -1) # pu...
daewoonglee/programmers
lev3/연속 펄스 부분 수열의 합.py
연속 펄스 부분 수열의 합.py
py
1,575
python
en
code
0
github-code
54
41507693942
""" Feature: BDD implementation Scenario: Navigate to iPrice , randomly choose one of the best Deals and claim promo code or voucher Given User choose one of the beast deals And navigating to Coupons Page And User choose a Coupon When User copy the coupon and sign in with Email Then User is successful...
amrifaezeh/iprice
iprice_tests/products/bdd_scenarios/test_claim_promo-code.py
test_claim_promo-code.py
py
4,122
python
en
code
0
github-code
54
34553957865
# https://www.hackerearth.com/practice/algorithms/searching/linear-search/practice-problems/algorithm/rest-in-peace-21-1/description/ y="The streak lives still in our heart!" no="The streak is broken!" for _ in range(int(input())): n=int(input()) if n%21==0: print(no) else: if '21' in str(n...
codingbird17/cp
linear_search/21_1.py
21_1.py
py
380
python
en
code
0
github-code
54
15214011869
import numpy as np import matplotlib.pyplot as plt # [Section 1.] Loading the data X_train = np.loadtxt("iris_train.data", delimiter=" ") # train data X_test = np.loadtxt("iris_test.data", delimiter=" ") # test data y_train = np.loadtxt("iris_train.labels", delimiter=" ") # train labels y_test = np.loadtxt("iris_te...
neuroady/Lib_ML
ML U 2020/[01] Intro/Asst. 1 [Q4].py
Asst. 1 [Q4].py
py
2,788
python
en
code
0
github-code
54
28928433490
from random import * words = ["calender", "book", "laptop", "pencil"] # 리스트 요소마다 "" 해주기 word = choice(words) print("answer : " + word) letters ="" # 사용자로부터 지금까지 받은 알파벳 count = 10 while True: succeed = True # succeed = True 라고 먼저 가정해 놓고 for w in word: ...
hskyblue22/small-projects_python
Hangman.py
Hangman.py
py
1,414
python
ko
code
0
github-code
54
72162105121
import os import pickle import yaml from frodo.modules.preprocess_and_plan.PreProcessor import PreProcessor from batchgenerators.utilities.file_and_folder_operations import * class PreProcessorYOLO5T1(PreProcessor): def __init__(self, preprocess_output_folder, model_config_dir, fed_config_dir, check_hyper_status)...
CaesarYangs/Frodo
frodo/modules/preprocess_and_plan/PreProcessorYOLO5T1.py
PreProcessorYOLO5T1.py
py
1,065
python
en
code
0
github-code
54
43253789144
# print("Gondolj egy számra 1 és 100 között, én kitalálom.") # interval_start = 1 # interval_end = 100 # bigger_or_lower = "a" # while bigger_or_lower != "E": # guess = int((interval_start+interval_end) / 2) # bigger_or_lower = input("A szám amire gondoltál Nagyobb [N] / Kisebb [K] / Egyenlő [E] mint " + str(gu...
Muromec1/python_training
Játék.py
Játék.py
py
1,204
python
hu
code
0
github-code
54
10928075348
# Author : Sanjeev Sapre # A program to find percentage of marks. try: marks = int(input( "Enter Marks Obtained: ")) total = int(input( "Enter Total Marks: ")) percent = marks / total * 100 print( f"You got {percent}% marks.") except (ZeroDivisionError, ValueError): print("Either y...
Sanjeev-Sapre/Python_Beginners_Course
exception_handling/exception_handling_01_C.py
exception_handling_01_C.py
py
417
python
en
code
0
github-code
54
70583362403
import circle import rectangle choice=0 ch="y" while(ch=="y"): print("MENU") print("1. Area of a Circle.") print("2. Circumference of a Circle.") print("3. Area of a Rectangle.") print("4. Perimeter of a Rectangle.") print("5. Quit.") choice=int(input("Enter your choice: ...
UTSAVS26/Python-Basics-1
Module_rec_cir.py
Module_rec_cir.py
py
1,211
python
en
code
0
github-code
54
9279277512
from ui import ui_constants from ui.screens import menu, ingame import pygame import sys from agents import SkeletonAgent, backgammon_ssbg player1 = backgammon_ssbg.BackgammonPlayer() player2 = SkeletonAgent.BackgammonPlayer() DETERMINISTIC = False # deterministic version: dice are loaded to give 1 and 6 # stochasti...
Bouaskaoun/Backgammon-game
main.py
main.py
py
2,019
python
en
code
0
github-code
54
74418344481
#!/usr/bin/env python3 # author: jorge.gil from pyhpeimc.objects import * from helpers.auth import * from helpers.alarms import * from helpers.object import * import sys, os from time import sleep import datetime # variables username = "" password = "" url = "" port = "" #Color Class class bcolors: HEADER = '\0...
j0ca/HPE_Scripts
HPE_alarmsPrint.py
HPE_alarmsPrint.py
py
2,119
python
en
code
0
github-code
54
13625397465
## Source kind of everything involving probabilities here: ## https://www.datascience.com/blog/introduction-to-bayesian-inference-learn-data-science-tutorials ## Imports import numpy as np import pymc3 as pm from scipy.stats import beta import sys ## Auxiliar functions # Likelihood function def likelihood(theta, n, x...
davidamorosmegabanner/mega_server
scripts/engine.py
engine.py
py
2,159
python
en
code
0
github-code
54
36141808429
# -*-coding:utf8 -*- import numpy as np import random import queue import matplotlib.pyplot as plt from quadTree import * import preprocess from knn import * import os outfilep2tra = r'./data-set/point2trajectory.npy' outfiletra2p = r'./data-set/trajectory2point.npy' #生成轨迹 def createTrajectories()->list: #数据集作为...
Weijun-Lin/IKNN-Experiment
createTrajectories.py
createTrajectories.py
py
5,310
python
en
code
0
github-code
54
73635218723
from pyglet import image from pyglet.sprite import Sprite from ButtonClass import Button from pyglet import text import Global_definitions class GameOverMenu: def __init__(self, parent): self._PlayAgain = Button(0, 0, image.load(Global_definitions.path('Resources/Buttons/restart01.png')), ...
Klin-0k/Snake_Game
GameOverMenuClass.py
GameOverMenuClass.py
py
4,272
python
en
code
0
github-code
54
27412241889
############################################################################### #### ORIGINAL CYCLEGAN #### IMPLEMENTATION ############################################################################### import torch from Generator import Generator from Discriminator import Discriminator import numpy as np import matpl...
ayberkydn/gan-implementations
cyclegan/main.py
main.py
py
5,856
python
en
code
0
github-code
54
70926805602
import collections class Solution: def findTheDifference(self, s: str, t: str) -> str: counter_t = collections.Counter(t) counter_s = collections.Counter(s) for key in counter_s.keys(): if counter_t[key] - counter_s[key]: return key del counter_t[key] ...
hogilkim/leetcode
389. Find the Difference.py
389. Find the Difference.py
py
375
python
en
code
0
github-code
54
4383232717
import base64 import json import threading from . import metrics from . import constant from .backlog import Backlog from .tdigest import TDigestStat, as_bytes from .utils import time_trunc_minute class QueryStat(TDigestStat): def __new__(cls, *, query="", method="", route="", function="", file...
airbrake/pybrake
src/pybrake/queries.py
queries.py
py
4,244
python
en
code
36
github-code
54
7705379966
import logging from pathlib import Path from typing import Dict, Tuple, Union from calvin_agent.datasets.utils.episode_utils import ( get_state_info_dict, process_actions, process_depth, process_language, process_rgb, process_state, ) import numpy as np from omegaconf import DictConfig import p...
mees/calvin
calvin_models/calvin_agent/datasets/base_dataset.py
base_dataset.py
py
10,735
python
en
code
184
github-code
54
72480823200
# Casting = dilakukan untuk menentukan tipe pada variabel # Python adalah bahasa berorientasi objek, dan karena itu menggunakan kelas untuk mendefinisikan tipe data # Casting dengan python dilakukan dengan menggunakan fungsi konstruktor: # int() - membangun bilangan bulat dari literal bilangan bulat, literal float (de...
irchamali/belajar-python
#2dataTypes/3-casting.py
3-casting.py
py
1,010
python
id
code
0
github-code
54
15610539451
""" 989. Add to Array-Form of Integer Easy The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1]. Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. Example 1: In...
yennanliu/CS_basics
leetcode_python/Array/add-to-array-form-of-integer.py
add-to-array-form-of-integer.py
py
2,519
python
en
code
69
github-code
54
13294140104
from datetime import datetime from src.credentials import credentials import gspread from discord.ext import commands, tasks class SendCog(commands.Cog, name="Send"): def __init__(self, bot): self.bot = bot self.records = [] self.check.start() self.update.start() self.gc =...
codeday/discord-maechapman
src/cogs/send.py
send.py
py
1,537
python
en
code
0
github-code
54
2422055875
# GA CUSTOMER REVENUE COMPETITION # Updated kernel (11/11) with v2 files # Read and preprocess all columns, except hits. import gc import os import numpy as np import pandas as pd from pandas.io.json import json_normalize import json import time from ast import literal_eval def load_df(file_name = 'train_v2.csv', nr...
sajedjalil/Data-Science-Pipeline-Detector
dataset/ga-customer-revenue-prediction/Aguiar/parse-json-v2-without-hits-column.py
parse-json-v2-without-hits-column.py
py
2,743
python
en
code
8
github-code
54
2838992491
from django.urls import include, path from users.views import MyObtainTokenPairView, RegisterView from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, ) urlpatterns = [ path('login/', MyObtainTokenPairView.as_view(), name='token_obtain_pair'), path('register/', RegisterV...
Tymotheus/Hacknarok2022WaleczneKaszkiety
backend/citizenly/users/urls.py
urls.py
py
359
python
en
code
0
github-code
54
28182257077
from sys import stdin input = stdin.readline n,m,l = map(int, input().split()) locations = [0] if n > 0: locations.extend(list(map(int, input().split()))) locations.sort() locations.append(l) def solv(): left = 1 right = l-1 while left <= right: mid = (left+right)//2 if is_possible(...
alsgh9948/Problem-Solving
baekjoon/1477.py
1477.py
py
558
python
en
code
0
github-code
54
10705076976
#!/usr/bin/env python #coding=utf-8 import tensorflow as tf from tensorflow.python.client import device_lib def get_available_gpus(): """Returns a list of available GPU devices names. """ local_device_protos = device_lib.list_local_devices() return [x.name for x in local_device_protos if x.device_type...
JohnRabbbit/TF2Fluid
04_rnnlm_data_parallelism/rnnlm_tensorflow.py
rnnlm_tensorflow.py
py
3,676
python
en
code
31
github-code
54
17920229947
from django.contrib import admin from django.urls import path, include #Общий URL для все приложений проекта Blog urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), #Авторизация пользователей path('accounts/', include('accounts.urls')), #Считывание все...
hailMeh/Django_BLOG-CRUD
blog/urls.py
urls.py
py
555
python
ru
code
0
github-code
54
10924632146
from poker_card import Card from poker_hand import * from get_card_deck import getSortedDeck import random from get_prob_hand import getPartialDeck from get_best_hand import getBestHand import sys inputList = sys.argv deck = getSortedDeck() # print deck def getProbMonte(incomplete_hand): counts = [0,0,0,0,0,0,0,0,0] ...
codetogamble/poker_monte
poker_back_algo/fill_excel_prob.py
fill_excel_prob.py
py
2,176
python
en
code
0
github-code
54
19784260128
from bs4 import BeautifulSoup as bs4 import urllib.request as request import re import os base_addr = 'https://en.wikibooks.org' java_filter = '/wiki/Java_Programming' output_folder = os.path.join(os.path.dirname(__file__), "..", "input") def write_to_file(link, text, fileid): text_file = open(os.path.abspath(os.pa...
san-rs/Java-EE-app---Indexing-with-Lucene
WebContent/WEB-INF/crawler/crawl.py
crawl.py
py
1,216
python
en
code
0
github-code
54
2544112000
# Created by me import os from django.http import HttpResponse from django.shortcuts import render def index(request): return render(request,'index.html') # return HttpResponse("Hello there...") def analyzer(request): # Get text from HTML get_text = request.POST.get('text','default') # Create ...
icurious/textutils_django
textutils/views.py
views.py
py
2,674
python
en
code
0
github-code
54
33986061198
import os import pandas as pd def load_fk_dataset(data_path): """Load Facial Keypoints dataset as df, add path to file column""" train_labels_df = pd.read_csv(os.path.join(data_path, "training_frames_keypoints.csv")) test_labels_df = pd.read_csv(os.path.join(data_path, "test_frames_keypoints.csv")) t...
cicheck/find-the-nose
utills/load_data.py
load_data.py
py
1,039
python
en
code
1
github-code
54
18259568128
"""Fast API based iter8 analytics service. """ # core python dependencies import logging # external dependencies from fastapi import FastAPI, Body import uvicorn # iter8 dependencies import iter8_analytics.constants as constants import iter8_analytics.config as config # v2 imports from iter8_analytics.api.v2.types i...
iter8-tools/iter8-analytics
iter8_analytics/fastapi_app.py
fastapi_app.py
py
4,527
python
en
code
16
github-code
54
32712561460
# a. The string begins with an 'a' # b. Each 'a' is followed by nothing or an 'a' or "bb" # c. Each "bb" is followed by nothing or an 'a' def Check_AB(str,n=0): # print("--------------") # print("str : ", str) output="true" if n>=len(str): output="true" if n==0: if str[0]!="a": ...
ashisharora24/learning_tutorials_practice
Data Structures and Algorithms in Python/3_Recursion_3/8_Check_AB.py
8_Check_AB.py
py
769
python
en
code
0
github-code
54
6805822447
import networkx as nx import pandas as pd # ------------------------------------------------------------------------------------------- # read files user_fields = ['id'] fake_user_df = pd.read_csv(r'C:\Users\Sara\Desktop\twitterProject\data\cresci-2015\FSF\users.csv', usecols=user_fields) fake_follower_df =...
S-Asghari/Complex-Network-Analysis-of-Twitter-Accounts
FollowerFriendGraph.py
FollowerFriendGraph.py
py
2,302
python
en
code
3
github-code
54
9143193102
from __future__ import annotations from typing import TYPE_CHECKING, Optional, Dict from dataclasses import dataclass import subprocess import shutil import shlex import os from .action import Action from . import builtin if TYPE_CHECKING: import transilience.system @builtin.action(name="systemd") @dataclass cla...
spanezz/transilience
transilience/actions/systemd.py
systemd.py
py
6,314
python
en
code
24
github-code
54
36936020178
with open('input.txt') as f: data = [(idx[0], idx[2]) for idx in f] # choice (Loss, Draw, Win, Score) rps = { 'R':('P','R','S', 1), 'P':('S','P','R', 2), 'S':('R','S','P', 3), } conversion = { 'A':'R', 'X':'R', 'B':'P', 'Y':'P', 'C':'S', 'Z':'S', } win_draw_loss = ['Z', 'Y', 'X'] # Part 1 score = 0 for ...
samheadleand/advent-of-code-2022
02/main.py
main.py
py
627
python
en
code
0
github-code
54
43410583864
from django.contrib.auth import get_user_model from django.db.models import Prefetch, Q, Avg from django.urls import reverse_lazy from django.http import JsonResponse from django.shortcuts import render, redirect from django.views.generic import TemplateView, View, DetailView from coreaccounts.forms import UserLoginFor...
psgpyc/kitabalaya
core/views.py
views.py
py
7,889
python
en
code
2
github-code
54
3972639188
import json from pyexpat.errors import messages from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from student_management_app import serializers from student_management_app.models import * from django.views.decorators.csrf import csrf_exempt from django.http import HttpRes...
Sanathnavada/RNSPORTAL
student_management_app/StaffViews.py
StaffViews.py
py
12,440
python
en
code
0
github-code
54
11182637993
import os import platform import sys, getopt import time from selenium import webdriver from pathlib import Path def ultima_modifica(path_file): # funziona solo in windows return os.path.getmtime(path_file) def main(argv): print('script in esecuzione!') print('per terminare CTRL + C') ...
giuseppe17ita/asciidoc-auto-reload
asciidocreload.py
asciidocreload.py
py
2,088
python
it
code
0
github-code
54
31803613219
import pandas as pd import pickle from sklearn.preprocessing import StandardScaler # Como no disponemos de nuevos datos para este ejemplo vamos a usar los mismos datos # que usamos para entrenar el modelo. # También se asume que los datos vienen en el mismo formato que los datos originales, # Por lo que habrá ...
PabloMoran23/Regression-and-time-series
Regression/model_production.py
model_production.py
py
3,577
python
es
code
0
github-code
54
28129347537
import numpy as np import control as ctl import plotly.graph_objects as go from plotly.subplots import make_subplots from .utils import get_T, nichols_grid color_list = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#EF553B", "brown"] # Utility Function def default_layout(xlabel,ylabel,name): la...
nils-van-zuijlen/ENIB_S6_ASN
ENIB_control/plot.py
plot.py
py
5,313
python
en
code
0
github-code
54
32906599230
from rgbhistogram import RGBHistogram from sklearn.ensemble import IsolationForest from sklearn.neighbors import LocalOutlierFactor import argparse import pickle import cv2 if __name__ == '__main__': ap = argparse.ArgumentParser() ap.add_argument("--dataset", required=False, default='./intro-anomaly-detection...
youngsoul/pyimagesearch-intro-anomoly-detection
train_forest_anomaly_detector.py
train_forest_anomaly_detector.py
py
1,098
python
en
code
0
github-code
54
27025885321
from django.contrib.auth import authenticate, login, logout from django.db import IntegrityError from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.contrib.auth.decorators import login_required from .models import User, Listing, Watchlist, Bid, ...
medaminefh/cs50W-commerce
auctions/views.py
views.py
py
7,905
python
en
code
1
github-code
54
40192617625
#1 def number_of_food_groups(): return 5 print(number_of_food_groups()) # Output 5 #2 def number_of_military_branches(): return 5 print(number_of_days_in_a_week_silicon_or_triangle_sides() + number_of_military_branches()) # trasbak error #3 def number_of_books_on_hold(): return 5 return 10 print(numbe...
Itserge1/Coding_Dojo_Python
pratice_assigment/functions_basic_i/functions_basic_i.py
functions_basic_i.py
py
2,357
python
en
code
0
github-code
54
44821104130
# 3-Задайте список из вещественных чисел. # Напишите программу, которая найдёт разницу между максимальным и # минимальным значением дробной части элементов. # Пример: # [1.1, 1.2, 3.1, 5.17, 10.02] => 0.18 или 18 # [4.07, 5.1, 8.2444, 6.9814] - 0.9114 или 9114 def diff_max_min(list_number:list): '''Разница межд...
Vivlgud/PyHWork3
Task3.py
Task3.py
py
1,067
python
ru
code
0
github-code
54
7856353522
import torch import torch.distributed as dist from torch.optim.optimizer import Optimizer, required from comm_helpers import communicate, flatten_tensors, unflatten_tensors import threading class SGD(Optimizer): r"""Implements stochastic gradient descent (optionally with momentum). Nesterov momentum is based...
jhcknzzm/SSFL-Benchmarking-Semi-supervised-Federated-Learning
LocalSGD.py
LocalSGD.py
py
10,097
python
en
code
51
github-code
54
2991504663
### Selection sort import random def selection_sort(array): #O(n^2) time, O(1) space n = len(array) for i in range(n): minimum = 10000000 pos = -1 for j in range(i,n): if minimum > array[j]: minimum = array[j] pos = j if pos != -1: #swap temp = array[i] array[i] = minimum array[pos] = tem...
n5596/Cracking-the-Coding-Interview
Chapter 10: Sorting and Searching/selection_sort.py
selection_sort.py
py
556
python
en
code
0
github-code
54
38032485632
import scrapy import camelot import tempfile import logging logging.getLogger("pdfminer").setLevel(logging.WARNING) logging.getLogger("camelot").setLevel(logging.WARNING) class ILRBSpider(scrapy.Spider): name = 'ilrbspider' start_urls = ['https://www2.illinois.gov/ilrb/decisions/bargainingcertifications/Pag...
labordata/state-labor-boards
ilrb.py
ilrb.py
py
1,580
python
en
code
0
github-code
54
29763336865
from sqlalchemy.engine import Engine from config import EtlDbConfig from util.sql_helpers import read_table table_columns = [ 'ID_MOTIVO', 'DESCRIPCION_MOTIVO', ] def transform_motivos(db_con: Engine, etl_process_id: int) -> None: # Read from extract table motivos_ext = read_table( table_name...
jorgeandrespadilla/ProyectoFinal-UDLAICBS0003
etl/transform/tra_motivos.py
tra_motivos.py
py
723
python
en
code
0
github-code
54
9843617986
from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By import pandas as pd # Makes sure Chrome webdriver is downloaded, up to date, and in right path and open. driver = webdriver.Chrome(se...
alewilliam789/data-projects
Smoking Rate V Life Expectancy/Python Scripts/grab_life_expectancy.py
grab_life_expectancy.py
py
1,539
python
en
code
0
github-code
54
15515426432
""" Fully-connected residual network as a single deep learner. """ import torch.nn as nn import torch class ResidualBlock(nn.Module): """ A residual block. """ def __init__(self, linear_size, p_dropout=0.5, kaiming=False, leaky=False): super(ResidualBlock, self).__init__() self.l_size ...
Nicholasli1995/EvoSkeleton
libs/model/model.py
model.py
py
5,272
python
en
code
319
github-code
54
2517174275
import gensim, time import pandas as pd import numpy as np fd = pd.read_csv(r'../input/train.csv', encoding="Latin-1") fd.replace(to_replace=[np.inf, -np.inf], value=np.nan, inplace=True) indices_with_nan_or_inf = pd.isnull(fd).any(1).nonzero()[0] if indices_with_nan_or_inf.any(): print('call the ambul...
sajedjalil/Data-Science-Pipeline-Detector
dataset/quora-question-pairs/KardoPaska/fast-gensim-word2vec-w-googlenews.py
fast-gensim-word2vec-w-googlenews.py
py
2,647
python
en
code
8
github-code
54
73532142881
import allure import pytest from back_tests.checker import PetstoreChecker from back_tests.client import PetstoreClient from back_tests.consts import PET_ONLY_ID, PET_FULL create_params = [ {'pet': PET_ONLY_ID, 'type': 'only id'}, {'pet': PET_FULL, 'type': 'full data'} ] @pytest.fixture(params=create_params...
bladeray/InsTestTask
back_tests/tests/conftest.py
conftest.py
py
1,077
python
en
code
0
github-code
54
29132733613
def bubble_sort(array): n = len(array) for i in range(n): already_sorted = True for j in range(n - i - 1): if array[j] > array[j + 1]: array[j], array[j + 1] = array[j + 1], array[j] already_sorted = False #if already_sorted: # break...
wkusmirek/pytest-benchmark
src/sort.py
sort.py
py
1,441
python
en
code
0
github-code
54
33822530725
###Titulo: Palindromo ###Função: Este programa identifica se determinado número é um palíndromo ###Autor: Valmor Mantelli Jr. ###Data: 27/12/2018 ###Versão: 0.0.2 ### Declaração de variáve p = 0 u = 0 n = 0 ### Atribuição de valor n = input ("Digite o número que deseja verificar: ") ### Processamento u = len(...
profnssorg/valmorMantelli1
exer527.py
exer527.py
py
499
python
pt
code
0
github-code
54
39095974500
from pygame import * import random import snake from food import * WIN_WIDTH = 1250 # wigth of window WIN_HEIGHT = 650 # height of window SIZE_OF_CELL = 50 COLOUR_OF_FIELD = (200, 240, 200) DEFEAT = False FPS = 8 FIELD = [] init() mainSurface = display.set_mode((WIN_WIDTH, WIN_HEIGHT)) # main window clock = time.C...
koala911/Python-review-project-1
game.py
game.py
py
15,038
python
en
code
0
github-code
54
16018733565
from sklearn.ensemble import RandomForestClassifier from sklearn.cross_validation import train_test_split import pandas as pd import os class pre: def __init__(self): #初始化读取操作 self.PATH = os.path.dirname(__file__) +"\\" self.df = pd.read_csv(self.PATH + 'iris data', names=["sep...
nbPeterWang/flower_analysis
pre.py
pre.py
py
854
python
en
code
0
github-code
54
70182155361
from city_scrapers_core.constants import NOT_CLASSIFIED from city_scrapers_core.items import Meeting from city_scrapers_core.spiders import CityScrapersSpider from dateutil.parser import parser class FreKingsBosSpider(CityScrapersSpider): name = "fre_kings_bos" agency = "Kings County Board of Supervisors" ...
City-Bureau/city-scrapers-fresno
city_scrapers/spiders/fre_kings_bos.py
fre_kings_bos.py
py
3,615
python
en
code
2
github-code
54
32969004477
import copy import numpy as np import matplotlib.pyplot as plt import numpy.linalg as LA def f(x, mu): x1 = x[0] x2 = x[1] return (x1+x2)**2 - 10*(x1+x2)+ mu/2 *((3*x1+x2-6)**2)+ mu/2 *(max(x1**2 + x2**2 -5, 0)**2) + mu/2* (max(-1*x1, 0)**2) def gradf(x, mu): x1 = x[0] x2 = x[1] ineq1_x1 = ...
amitsr4/opt4
2d.py
2d.py
py
1,969
python
en
code
0
github-code
54
38401690952
import tkinter win = tkinter.Tk() win.title("GUI") win.geometry("400x400+600+20") def func(): message = "" if result1.get(): message += "小红\n" if result2.get(): message += "小军\n" if result3.get(): message += "小黑\n" text.delete(0.0, tkinter.END) text.insert(tkinter.INS...
huangshaoqi/programming_python
XDL/python/Part_1/Day15/5.py
5.py
py
1,006
python
en
code
1
github-code
54
72187188963
import cv2 import numpy as np import os from tracking_single.base import BaseCF from tracking_multiple.mot_tracking.kcf_mot.base_tracking import Base_Tracking from tracking_multiple.mot_helpers import utils class ParticleTracker(Base_Tracking): def __init__(self): self.max_patch_size = 256 super(Pa...
ElnuraMusaoglu/MultiPedestrianTracking
mot_tracking/kcf_mot/trackers/particle_filter_tracker.py
particle_filter_tracker.py
py
6,115
python
en
code
0
github-code
54
39384614190
# Typecast GUI # Use threading for audio output # Simple input boxes will suffice (tkinter) from tkinter import * import PIL from PIL import ImageTk, Image import client from threading import * class TypeCastApp(): # class var count = 0 lock = Lock() # constructor, init, root is the GUI def __init__(self): s...
wncjs96/TTS-API-manual-requests
src/gui.py
gui.py
py
3,456
python
en
code
0
github-code
54
28182590637
from sys import stdin import heapq input = stdin.readline n,m,k,x = map(int, input().split()) adj_list = [[] for _ in range(n+1)] for _ in range(m): a,b = map(int, input().split()) adj_list[a].append(b) def solv(): pq = [] visited = [False]*(n+1) ans = [] heapq.heappush(pq,(0,x)) visit...
alsgh9948/Problem-Solving
baekjoon/18352.py
18352.py
py
711
python
en
code
0
github-code
54
22672698676
import torch import torch.nn.functional from tqdm import tqdm import numpy as np from numpy.random import default_rng import torch.utils.data import time def train(model_generator, model_discriminator, Goptimizer, Doptimizer, train_loader, epochs, cost_function,latent_size): #currently no validation loader (para...
puschb/gan-emnist-rep
gan-emnist-python-files/training.py
training.py
py
2,549
python
en
code
0
github-code
54
10184080530
# -*- coding: utf-8 -*- # @Time : 2018/9/8 上午11:24 # @Author : jaelyn # @FileName: 657.py # @Software: PyCharm class Solution: def judgeCircle(self, moves): """ :type moves: str :rtype: bool """ return moves.count("U") == moves.count("D") and moves.count("L") == moves.co...
Jaelyn-Lim/leetcode
2018-9/657.py
657.py
py
482
python
en
code
1
github-code
54
41845598292
import numpy as np import re from io import StringIO import matplotlib.pyplot as plt import os import pandas as pd from tqdm import tqdm import argparse from utilities import PlotPatternSpectrum plt.rcParams.update({'font.size': 16}) ######################################## argparse setup ############################...
jaschers/psnet
main/pattern_spectra/python/create_pattern_spectra.py
create_pattern_spectra.py
py
13,823
python
en
code
0
github-code
54
2581648195
import pandas as pd df_cities = pd.read_csv('../input/cities.csv') df_submit = pd.read_csv('../input/sample_submission.csv') xy = df_cities[['X', 'Y']].values li = df_submit['Path'].values.tolist() def primes(N): f = [True] * (N+1) f[0] = False f[1] = False for p in range(2, int(N**0.5)+1): ...
sajedjalil/Data-Science-Pipeline-Detector
dataset/traveling-santa-2018-prime-paths/kambarakun/scoring-script.py
scoring-script.py
py
762
python
en
code
8
github-code
54