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
764637712
def tux_say(to_print): print(f""" {to_print} \\ .--. |o_o | |:_/ | // \\ \\ (| | ) /'\\_ _/`\\ \\___)=(___/ """) while(True): inp = input("Enter expression : ") for keyword in ['eval', 'exec', 'import', 'open', 'os', 'read', 'system', 'writ...
CSecIITB/module-1-python
pyjail/jail2.py
jail2.py
py
486
python
en
code
1
github-code
90
26754244866
#coding=utf-8 import rsa pubkey, privkey = rsa.newkeys(1024) # 公钥 pub = pubkey.save_pkcs1() with open('public.pem', 'wb') as w_pub: w_pub.write(pub) # 私钥 pri = privkey.save_pkcs1() with open('private.pem', 'wb') as w_pri: w_pri.write(pri) with open('public.pem', mode='rb') as f, open('private.p...
rongfengyu/Data_Structure_and_Algorithm
Coding Progress/codeset/test_cert/test_cert.py
test_cert.py
py
611
python
en
code
0
github-code
90
18018870679
import sys input = sys.stdin.buffer.readline def main(): N,M = map(int,input().split()) if 2*N >= M: print(M//2) else: rest = M-2*N print(N+rest//4) if __name__ == "__main__": main()
Aasthaengg/IBMdataset
Python_codes/p03797/s913045470.py
s913045470.py
py
224
python
en
code
0
github-code
90
23800431038
N, K = map(int, input().split()) def factorial(a): if a == 0 : return 1 elif a == 1 : return 1 else: return factorial(a-1) * a b = factorial(N) / (factorial(K) * factorial(N-K)) print(int(b))
723poil/boj
백준/Bronze/11050. 이항 계수 1/이항 계수 1.py
이항 계수 1.py
py
242
python
en
code
0
github-code
90
29653680121
# Input: number of iterations L # number of labels k # matrix X of features, with n rows (samples), d columns (features) # X[i,j] is the j-th feature of the i-th sample # vector y of labels, with n rows (samples), 1 column # y[i] is the label (1 or 2 ... or k) of the i-th samp...
miguel-mzbi/MachineLearning-DataMining
HW3/ratingprank.py
ratingprank.py
py
1,176
python
en
code
0
github-code
90
29960001107
import sys class Stack(object): """ A stack uses LIFO (last-in first-out) ordering. That is, as in a stack of dinner plates, the most recent item added to the stack is the first item to be removed. It uses the following operations: pop() : Remove the top item from the stack. push(item) : Add ...
NonsoAmadi10/Cracking-The-Coding-Interview
stacks_queues/stacks_queues.py
stacks_queues.py
py
6,613
python
en
code
0
github-code
90
24778055195
import datetime import os import time from capturadio.util import slugify class Entity(object): def __init__(self, id, name=None): self.id = id self.name = name self.logo_url = None self.link_url = None self.slug = None self.language = "en" self.endurance ...
DirkR/capturadio
capturadio/entities.py
entities.py
py
3,651
python
en
code
28
github-code
90
29323942609
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('re_user', '0002_auto_20180115_1501'), ] operations = [ migrations.AlterField( model_name='reuserinfo', ...
linyi0604/SmartDish_server
SmartDish/re_user/migrations/0003_auto_20180118_1055.py
0003_auto_20180118_1055.py
py
453
python
en
code
0
github-code
90
40296374594
import os import time from typing import Optional import constants import logger import numpy as np import oldagents import torch from torch import nn CHECKPOINT_FILE = "out/model_checkpoint" class NatureCNN(nn.Module): def __init__(self, input_shape, n_actions) -> None: super(NatureCNN, self).__init__(...
dougli/curvy-ai
agent/nature_cnn.py
nature_cnn.py
py
3,104
python
en
code
0
github-code
90
32409348396
import json import os from collections import defaultdict import numpy as np from copy import deepcopy from library.json_tools import make_json_head from convert_tools import convert_coco_format_for_whole, convert_coco_format_for_crop # mediapipe_full-vedio-coco_id.json, average_pseudo_labels_update-coco_id.json gt_j...
Daming-TF/HandData
scripts/Data_Interface/test_data/eval/eval_crop_image_for_test/select_specific_object_image_from_whole.py
select_specific_object_image_from_whole.py
py
4,195
python
en
code
1
github-code
90
15835335808
from fastapi import HTTPException from SharedInterfaces.ProvenanceAPI import * from SharedInterfaces.RegistryAPI import * from SharedInterfaces.SharedTypes import Status from config import Config from helpers.validate_model_run_record import validate_model_run_record, validate_model_run_workflow_template, RequestStyle ...
provena/provena
prov-api/helpers/admin_helpers.py
admin_helpers.py
py
7,966
python
en
code
3
github-code
90
11331062540
#!/usr/bin/env python """ ScreenyPy - A CLI tool to take websites' screenshots. """ # imports import sys, os, argparse from selenium import webdriver from selenium.webdriver.firefox.options import Options import time, requests, json # Browser Binary locations CHROME_BIN = "/bin/chromium-browser" FIREFOX_BIN = "/bin/...
errnair/ScreenyPy
screeny.py
screeny.py
py
3,893
python
en
code
0
github-code
90
31009843618
from skimage import io from keras.models import Sequential, Model from keras.layers import Reshape, Activation, Conv3D, Input, MaxPooling3D, BatchNormalization, Flatten, Dense, Lambda from keras.layers.advanced_activations import LeakyReLU from keras.callbacks import EarlyStopping, ModelCheckpoint, TensorBoard from ker...
rankofootball/3DYolo2
test_image.py
test_image.py
py
11,046
python
en
code
2
github-code
90
31779137818
from ...models import Course from typing import List, NamedTuple, Dict, Optional, Iterable from dataclasses import dataclass from ._pages import PageStruct @dataclass class SectionStruct: pk: int | None name: str parent_index: Optional[int] class SectionEdit(NamedTuple): index: int name: Optional[str] = None ...
Topliyak/teach-service
server/apps/courses/services/course/_sections.py
_sections.py
py
4,293
python
en
code
0
github-code
90
31217210260
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 import random import time import json dbname = 'cit-7.db' # 1.データベースに接続 conn = sqlite3.connect(dbname) i = 0 while i < 500: # 2.sqliteを操作するカーソルオブジェクトを作成 cur = conn.cursor() #cur.execute('.mode json') cur.execute('select * from player inner join ch...
RuoAndo/cit
DB/11/code_11/loop_join_json.py
loop_join_json.py
py
1,641
python
en
code
0
github-code
90
34137452895
""" ============ Pixhawk node ============ Communication node for pixhawk auto pilot module (APM). The APM requires communication in two directions, inputs and outputs. The APM receives inputs of desired motor commands as RC controlls, and outputs various instrument readings. Currently the APM is responsible for provid...
nedlrichards/fish_hawk
fish_hawk/pixhawk_node.py
pixhawk_node.py
py
8,862
python
en
code
2
github-code
90
19483002709
import os import pickle from edgetpu.learn.backprop import ops from edgetpu.learn.utils import AppendFullyConnectedAndSoftmaxLayerToModel import numpy as np # Default names for weights and label map checkpoint. _WEIGHTS_NAME = 'weights.pickle' _LABEL_MAP_NAME = 'label_map.pickle' class SoftmaxRegression(object): ...
google-coral/edgetpu
edgetpu/learn/backprop/softmax_regression.py
softmax_regression.py
py
10,330
python
en
code
378
github-code
90
1469982610
from django.urls import path from watchlist_app.api import views urlpatterns = [ path('list/',views.WatchlistGV.as_view()), path('platform/', views.StreamingPlatformGV.as_view()), path('list/<int:pk>/', views.WatchDetails.as_view()), path('platform/<int:pk>/', views.StreamingPlatformDetails.as_view()),...
TUSHAR-VERMA-star/IMDb-clone
watchlist/watchlist_app/api/urls.py
urls.py
py
518
python
en
code
0
github-code
90
69799561256
import copy from sqlalchemy import create_engine from sqlalchemy.orm import Session from student import Student class StudentManager: """ A class for student manager, which manages the student stored in a database. """ def __init__(self, path=":memory:"): """ Connect to the database...
lewch/ProgLab_LibSys
libsys/student_manager.py
student_manager.py
py
2,358
python
en
code
0
github-code
90
21814197062
#!/usr/bin/env python3 import subprocess import re import time from multiprocessing import Pool import sqlite3 from icmplib import multiping import netifaces class ArpScan: """ Scans for devices in the network using system command arp-scan """ def __init__(self, interface): self.hos...
bkbilly/mqtt-network-scanner
scanner.py
scanner.py
py
5,617
python
en
code
8
github-code
90
4126696471
import numpy as np import heapq """ ############# #...........# ###B#C#B#D### #A#D#C#A# ######### Positions 0 1 2 3 4 5 6 7 9 11 13 8 10 12 14 State Empty = 0 A1 = 1, A2 = 2, B1 = 3, B2 = 4, C1 = 5, C2 = 6, D1 = 7, D2 = 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [0 0 0 0 0 0 0 3 1 5 ...
butakun/AoC2021
23/23_1.py
23_1.py
py
6,891
python
en
code
0
github-code
90
18394962269
import sys sys.setrecursionlimit(10**6) N=int(input()) A=[[]for i in range(N)] X=[list(map(int, input().split())) for _ in range(N-1)] for i in range(N-1): a=X[i][0] b=X[i][1] a-=1 b-=1 A[a].append(b) A[b].append(a) D=list(map(int, input().split())) D=sorted(D)[::-1] from collections import deque d=deque(D...
Aasthaengg/IBMdataset
Python_codes/p03026/s812395893.py
s812395893.py
py
484
python
en
code
0
github-code
90
8217777515
import datetime from yourmeals.data_access.data_access_module import DataAccessModule as DAM from yourmeals.controllers.recommendation_controller import RecommendationController from yourmeals.exceptions.does_not_exist import DishDoesNotExistError, UserDoesNotExistError import yourmeals.data_access.model as models imp...
tunsmm/yourmeals
yourmeals/controllers/main_controller.py
main_controller.py
py
7,417
python
en
code
0
github-code
90
18515103049
import sys from collections import deque def input(): return sys.stdin.readline().strip() def main(): N, M = map(int, input().split()) dislike = [] for _ in range(M): a, b = map(int, input().split()) dislike.append((a, b)) """ aについて昇順に貪欲法を考えて破綻しました。。。 (その後aの昇順にdpすることも考えたけど同じく行...
Aasthaengg/IBMdataset
Python_codes/p03295/s742213387.py
s742213387.py
py
838
python
ja
code
0
github-code
90
33671267827
from typing import List """ @author: Merlin 2019.06.23 189.Rotate Array 思路: 将数组nums的最后一个元素放在数组nums索引为0的位置,循环k次,每次循环都会消耗O(n)去将数组元素往后退 time: O(k*n) space: O(1) """ class Solution_1: def rotate(self, nums: List[int], k: int) -> None: """ Do not return anything, modify nums in-place in...
algorithm003/algorithm
Week_01/id_2/LeetCode_189_2.py
LeetCode_189_2.py
py
1,673
python
en
code
17
github-code
90
17929293679
import collections s = str(input()) c = list(collections.Counter(s).values()) c.sort(reverse=True) #print(c) if len(c) <= 2: if c[0] >= 2: print('NO') else: print('YES') else: if abs(c[0]-c[1]) >= 2 or abs(c[1]-c[2]) >= 2 or abs(c[2]-c[0]) >= 2: print('NO') else: print...
Aasthaengg/IBMdataset
Python_codes/p03524/s915321033.py
s915321033.py
py
329
python
en
code
0
github-code
90
17923044655
import pandas as pd import os import win32com.client as win32 import pywinauto import shutil import subprocess import pyperclip from string import Template import pywinauto from pywinauto import * from time import sleep from app_gen import * from client_data import * def get_dict(): global df ...
spbeck/applicationGeneratorSCCF
dentimax.py
dentimax.py
py
2,977
python
en
code
0
github-code
90
37834892865
# -*- coding: utf-8 -*- """ Created on Tue Oct 30 18:48:38 2018 @author: 李立宗 lilizong@gmail.com 《OpenCV图穷匕见——Python实现》 电子工业出版社 """ img=cv2.imread("lenacolor.png") bgra = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA) b,g,r,a=cv2.split(bgra) a[:,:]=125 bgra125=cv2.merge([b,g,r,a]) a[:,:]=0 bgra0=cv2.merge([b,g,r,a]) cv2.imsh...
taochangwan/learnOpencv
源代码及图像/chapter4/例4.13.py
例4.13.py
py
589
python
en
code
1
github-code
90
12705286781
class Solution: def numBusesToDestination(self, routes: List[List[int]], source: int, target: int) -> int: if source == target: return 0 stops = defaultdict(list) for i, j in enumerate(routes): for stop in j: stops[stop].append(i) visited = set...
FevenBelay23/competitive-programming
0815-bus-routes/0815-bus-routes.py
0815-bus-routes.py
py
748
python
en
code
0
github-code
90
13282124914
from array import * arr = [3,1,5,6,9,2,4,7,8,0] first = arr[0] second = arr[1] third = arr[2] i = 3 while(i < len(arr)): if (arr[i] > first): third = second second = first first = arr[i] elif (arr[i] > second): third = second second = arr[i] elif (arr[i] > th...
kRituraj/python-programming
first-second-and-third-largest-element-in-an-array.py
first-second-and-third-largest-element-in-an-array.py
py
427
python
en
code
0
github-code
90
18455054179
n = int(input()) h = list(map(int,input().split(" "))) cnt = 0 minNum = 0 tmp = 0 while True: for i in range(h.count(0)): if h.index(0) == 0: h.pop(0) elif h.index(0) > 0: tmp = h.index(0) break else: tmp = len(h) if not h: break if...
Aasthaengg/IBMdataset
Python_codes/p03147/s286025974.py
s286025974.py
py
498
python
en
code
0
github-code
90
34602064236
from bs4 import BeautifulSoup import requests import pandas as pd import string import json from time import sleep def get_json_listings(url): response = requests.get(url) if not response.ok: print(f'Code: {response.status_code}, url: {url}') return response.json() def main(): # For any manual verificatio...
tobiedesgreniers/training
etl_pipeline/app/tsx_listings.py
tsx_listings.py
py
1,056
python
en
code
0
github-code
90
3570291487
import Functions import os import json import shutil os.chdir(os.path.dirname(os.path.realpath(__file__))) def save(data, name, users): if not os.path.exists("Saves"): os.mkdir("Saves") if os.path.exists("Saves/{}".format(name)): print("Please enter a name that has not already been used.") ...
dragmine149/Python_Battleships
save.py
save.py
py
2,001
python
en
code
0
github-code
90
18410997359
n=int(input()) def divisore(n): divisors=[] for i in range(1,int(n**0.5)+1): if n%i==0: divisors.append(i) if i!=n//i: divisors.append(n//i) divisors.sort() return divisors d=divisore(n) ans=0 for i in d[1:]: cand=i-1 if n//cand==n%cand: ans+=ca...
Aasthaengg/IBMdataset
Python_codes/p03050/s684108041.py
s684108041.py
py
334
python
en
code
0
github-code
90
23986054639
class Solution: def removeDuplicateLetters(self, s: str) -> str: cnt = Counter(s) ms = [] dst = set() for ch in s: cnt[ch] -= 1 if ch not in dst: while ms and ms[-1] > ch and cnt[ms[-1]]: ch2 = ms.pop() d...
birsnot/A2SV_Programming
remove-duplicate-letters.py
remove-duplicate-letters.py
py
423
python
en
code
0
github-code
90
17949796859
from collections import defaultdict H, W = map(int, input().split()) cnt = defaultdict(int) for _ in range(H): a = list(input()) for ai in a: cnt[ai] += 1 four = 0 odd = 0 for v in cnt.values(): four += v//4 odd += v%2 if four>=H//2*(W//2) and odd<=1: print('Yes') else: pri...
Aasthaengg/IBMdataset
Python_codes/p03593/s352748602.py
s352748602.py
py
328
python
en
code
0
github-code
90
15081092091
from ptb_large_ref import (vocab_size, layer_size, drop_prob, weight_init, decay_epoch, decay_rate, optimizer, train_set, valid_set, test_set, epochs) from model import List from layers import * # model model = List([ Embed(vocab_size, layer_size, weight_init=weight_init), Dropout(dr...
kastnerkyle/norm-rnn
experiments/ptb_large_norm.py
ptb_large_norm.py
py
765
python
en
code
0
github-code
90
18622159585
import os import numpy as np class MetaImage(): def __init__(self, mhd_file): self.mhd_file = mhd_file self._metadata = None self._image = None self.type_map = { 'MET_SHORT': np.int16, 'MET_USHORT': np.uint16, 'MET_INT': np.int32, 'MET...
AllenInstitute/datacube
services/locator/classes/metaimage.py
metaimage.py
py
3,117
python
en
code
0
github-code
90
18398580319
import sys input = sys.stdin.readline N, Q = [int(_) for _ in input().split()] STX = [[int(_) for _ in input().split()] for _ in range(N)] D = [int(input()) for _ in range(Q)] events = [] for stx in STX: s, t, x = stx events += [[s - x, 1, x], [t - x, 0, x]] for i in range(Q): events += [[D[i], 2, i]] event...
Aasthaengg/IBMdataset
Python_codes/p03033/s311666361.py
s311666361.py
py
795
python
en
code
0
github-code
90
18267265279
n,a,b=map(int,input().split()) mod=10**9+7 sum=(pow(2,n,mod)-1)%mod nume_a=1 deno_a=1 for i in range(n-a+1,n+1): nume_a=(nume_a*(i%mod))%mod deno_a=(deno_a*(i-(n-a+1)+1)%mod)%mod ans_a=(nume_a*(pow(deno_a,mod-2,mod)))%mod nume_b=1 deno_b=1 for i in range(n-b+1,n+1): nume_b=(nume_b*(i%mod))%mod deno_b=(d...
Aasthaengg/IBMdataset
Python_codes/p02768/s625659020.py
s625659020.py
py
421
python
ro
code
0
github-code
90
17863052352
from cnn import CNN import matplotlib.pyplot as plt import numpy as np cnn = CNN([(5, 5, 1, 20), (5, 5, 20, 20)], [(500, 300)], [300, 7]) def getData(balance_ones=True): # images are 48x48 = 2304 size vectors # N = 35887 Y = [] X = [] first = True for line in open('data/fer2013.csv'): ...
Alyndre/DeepLearningPython
CNN/main.py
main.py
py
1,495
python
en
code
0
github-code
90
14060116035
import os os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' import unittest from HTMLTestRunner import HTMLTestRunner import time from .api_test import UbitAdminApiTest, UbitFrontApiTest import pandas as pd from random import randint, random from time import sleep report_path = 'C:/Users/Peter/Documents/Django...
peter53041993/Django_Server
tutorial/ubit_test/ubit_tests/api_unittest.py
api_unittest.py
py
20,920
python
en
code
0
github-code
90
7424198077
#匯入模組 #import python windows COM object module import win32com.client as win32 #import python modules(匯入較容易執行命令的模組) import subprocess from subprocess import CREATE_NEW_CONSOLE #匯入os:檔案操作、psutil:記憶體資料和暫存 等模組 import os import psutil import datetime import string #import global varibles for value pass through(匯入廣域參數) impo...
C107104224/pythonProject1
open_program.py
open_program.py
py
2,173
python
en
code
0
github-code
90
439857872
from __future__ import annotations from typing import Optional, Awaitable, List from ..schemas import ( ParseMode, Message, MessageEntity, InlineKeyboardMarkup, ChatAction, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, ) from .group import CallsGroup, UseRetort class ChatCallG...
slonogram/slonogram
slonogram/call_groups/chat.py
chat.py
py
5,595
python
en
code
4
github-code
90
7219499687
import yaml from py_data_converter.jsonparser import * from py_data_converter.common import * def Parse_input(source): allthekeys = [*get_keys(source)] alltheValues = [glom(source, item) for item in allthekeys] listofRefitem = [item for item in alltheValues if item.find('#') != -1] for item in listof...
app-generator/devtool-python-converter
py_data_converter/converter_openapi.py
converter_openapi.py
py
1,953
python
en
code
12
github-code
90
16503023247
import asyncio from multidoc.util import jsonl_writer from .config import cmkb_keywords,cmkb_doc_file from .webrequest import CMKBRequest event_loop = asyncio.get_event_loop() def collect_data_by_keywords(): keywords = cmkb_keywords l = [] req = CMKBRequest(event_loop) for keyword in keywor...
kumiko-oreyome/hqa_project
server/cmkb_data_collect.py
cmkb_data_collect.py
py
473
python
en
code
0
github-code
90
13999819611
"""Collection of unit tests to verify the correct function of the Image Conversion tool. Authors ------- - Keira Brooks - Lauren Chambers - Shannon Osborne Use --- :: pytest test_convert_image.py Notes ----- At this moment, convert image can take in a NIRCam or FGS image either created with ...
spacetelescope/jwst_magic
jwst_magic/tests/test_convert_image.py
test_convert_image.py
py
12,890
python
en
code
0
github-code
90
73201497896
import gpxpy import pandas as pd import geopandas as gpd import os print('Place 1 GPX file in the desired directory') print('File location example: \'/home/user/Documents/\', the final slash is important...') print() gpxLoc = input('Directory of GPX file: ') for file in os.listdir(gpxLoc): if file.endswith('.gpx'...
frozenbanana97/aerial-mapping
GCP_GPX_Convert.py
GCP_GPX_Convert.py
py
1,274
python
en
code
0
github-code
90
18421969869
import copy a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) m = [a, b, c, d, e] ans = 10 ** 10 def order(t, mr): global ans if len(mr) == 0: ans = min(ans, t) return if t % 10 != 0: t = t - (t % 10) + 10 for i in range(len(mr)): nextt = t + mr[i] ne...
Aasthaengg/IBMdataset
Python_codes/p03076/s278533195.py
s278533195.py
py
410
python
en
code
0
github-code
90
44056685173
import tkinter as tk from tkinter import ttk from tkinter.filedialog import askdirectory def tkinter_input(): win = tk.Tk() win.title("Validation GUI") # Add title win.geometry('480x300') lm = 2 normal_wide = 10 style = ttk.Style() style.configure("test.TButton", background=...
feilab-hust/ID-Net
configs/config_test.py
config_test.py
py
12,336
python
en
code
7
github-code
90
14477558226
from flask_app.config.mysqlconnection import connectToMySQL import re from flask import flash db = "cookie_orders" class Cookie: def __init__(self, data): self.id = data['id'] self.first_name = data['first_name'] self.cookie_type = data['cookie_type'] self.num_boxes = data['num_bo...
ttoews6/Codingdojo-Assignments
Python/flask_mysql/cookie_orders/flask_app/models/models_order.py
models_order.py
py
2,035
python
en
code
0
github-code
90
24800277137
#Ovo radim proceduralno jer nema smisla ovo u klase/funkcije jer se samo jednom mora izvrtit import numpy as np import matplotlib.pyplot as plt #Inicijalizacija G= 6.67408*10**-11 year=365.242*24*60*60 r_Earth=[np.array((1.486*10**11,0))] v_Earth=[np.array((0,29783))] a_Earth=[] x_Earth=[] y_Earth=[] r_Sun=[np.array...
KloDragun/PAF
Vjezbe/Vjezbe_9/zadatak.py
zadatak.py
py
1,271
python
sr
code
0
github-code
90
16623225967
from concurrent.futures import thread import functools import importlib import os from typing import Any, Mapping, Sequence, Tuple from absl import app from absl import flags from absl import logging # Set Linen to add profiling information when constructing Modules. # Must be set before flax imports. # pylint:disabl...
disi-unibo-nlp/bio-ee-egv
src/utils/t5x/train.py
train.py
py
29,370
python
en
code
11
github-code
90
12187224906
import sys from PyQt5.QtWidgets import (QApplication, QWidget, QGroupBox, QRadioButton, QPushButton, QGridLayout, QVBoxLayout, QHBoxLayout, QLineEdit) class MyApp(QWidget): def __init__(self): super().__init__() grid = QGridLayout() grid.addWidget(self.create...
gwangqq/python_exercise
python_ui_test.py
python_ui_test.py
py
1,756
python
en
code
0
github-code
90
73614758377
# cost models for different dev environments from datetime import datetime from math import ceil from pricing import get_price_for_instance models_ec2 = { 'ocp-dev-3': [ (1, 't2.large'), (1, 'm5.large'), (1, 'm5.2xlarge'), (3, 'm5.xlarge'), (3, 'm5.large') ], 'ocp-d...
fusor/misc-env-scripts
aws/reporting/costmodel.py
costmodel.py
py
2,542
python
en
code
1
github-code
90
26257318482
import math from datetime import datetime import sympy as sp from sympy.utilities.lambdify import lambdify x = sp.symbols('x') my_f = (sp.sin((2 * x ** 3) + (5 * x ** 2) - 6)) / (2 * sp.exp((-2) * x)) def SecantMethodInRangeIterations(f, check_range, epsilon=0.0000001): roots = [] iterCounter = 0 f...
tairmazuz20/Numerical-analysis
secant-method.py
secant-method.py
py
2,612
python
en
code
1
github-code
90
9441765176
from django.urls import path from bridgeUS import views urlpatterns = [ path('signup/', views.signup, name='signup'), path('token/', views.token, name='token'), path('signin/', views.signin, name='signin'), path('signout/', views.signout, name='signout'), path('user/', views.userlist, name='userlis...
SungwonShim/swppfall2022-team16
backend/bridgeUS/urls.py
urls.py
py
1,077
python
en
code
0
github-code
90
34176196967
def create_ae_model(input_dim, enc_dim, latent_dim): input_layer = Input(shape=(input_dim, )) encoder = Dense(enc_dim, activation="tanh", activity_regularizer=regularizers.l1(10e-5))(input_layer) encoder = Dense(latent_dim, activation="relu")(encoder) decoder = Dense(enc_dim, activ...
mikusmi/Utilizing-AI-ML-Methods-For-Measuring-DQ
Thesis/codes/Autoencoder-model.py
Autoencoder-model.py
py
456
python
en
code
1
github-code
90
7621652069
""" Flat-field a science image """ from ..stpipe import RomanStep from . import flat_field import roman_datamodels as rdm __all__ = ["FlatFieldStep"] class FlatFieldStep(RomanStep): """Flat-field a science image using a flatfield reference image. """ reference_file_types = ["flat"] def process(sel...
kmacdonald-stsci/romancal
romancal/flatfield/flat_field_step.py
flat_field_step.py
py
1,526
python
en
code
null
github-code
90
34747695382
import os import unittest from pysecretary import pysecretary, InvalidPrefixError, UnsupportedPrefixError from pysecretary.exceptions import NotFoundError class TestPysecretary(unittest.TestCase): def test_env_get(self): os.environ["PYSECRETARY"] = "test" t = pysecretary.get("env://PYSECRETARY") ...
spennymac/pysecretary
tests/test_pysecretary.py
test_pysecretary.py
py
1,222
python
en
code
1
github-code
90
25571968344
import logging import threading import time import unittest import grpc from tests.unit import thread_pool from tests.unit.framework.common import test_constants def _ready_in_connectivities(connectivities): return grpc.ChannelConnectivity.READY in connectivities def _last_connectivity_is_not_ready(connectivi...
grpc/grpc
src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py
_channel_connectivity_test.py
py
5,869
python
en
code
39,468
github-code
90
28151376911
import numpy import PyDelFEM2 as dfm2 import PyDelFEM2.gl.glfw def make_mesh(): sdf0 = dfm2.CppSDF3_Sphere(0.55,[-0.5,0,0],True) sdf1 = dfm2.CppSDF3_Sphere(0.55,[+0.5,0,0],True) np_xyz,np_tet = dfm2.isosurface([sdf0,sdf1]) print(np_xyz.shape,np_tet.shape) msh = dfm2.Mesh(np_xyz,np_tet,dfm2.TET) return msh ...
nobuyuki83/pydelfem2
examples_py/51_fem3d.py
51_fem3d.py
py
2,107
python
en
code
10
github-code
90
2442699975
class Solution: # @param {string} s the IP string # @return {string[]} All possible valid IP addresses def isValid(self, subs): if len(subs) > 1 and subs[0] == '0': return False num = int(subs) return num >= 0 and num < 256 def backtrack(self, s, pos, vec, veclist): if pos =...
sangreal/PyLintcode
py/RestoreIPAddresses.py
RestoreIPAddresses.py
py
800
python
en
code
0
github-code
90
71380388138
"""User input structures.""" from dataclasses import dataclass from enum import IntEnum, auto from typing import Union class InputMode(IntEnum): """Enum defining input modes.""" NORMAL = auto() LAYOUT = auto() COMMAND = auto() EXIT = auto() @dataclass class InputMess: """Input message class...
GabrielWechta/cans
client/src/cans_client/user_interface/input.py
input.py
py
381
python
en
code
0
github-code
90
22910681324
import requests from bs4 import BeautifulSoup import csv URL = 'https://developers.google.com/public-data/docs/canonical/countries_csv' page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') table = soup.find('table') with open('data/countries_geodata.csv', 'w', newline='') as f: writer = cs...
adamichelle/himalayas-analytics-dash-app
scrapper.py
scrapper.py
py
503
python
en
code
0
github-code
90
18323873639
def main(): import sys n,*d=map(int,sys.stdin.buffer.read().split()) e=[0]*n for i in d: e[i]+=1 a=1 if d[0]<1 else 0 for i in d[1:]:a=a*e[i-1]%998244353 print(a) main()
Aasthaengg/IBMdataset
Python_codes/p02866/s776450579.py
s776450579.py
py
206
python
en
code
0
github-code
90
18407833919
import sys input = sys.stdin.readline # Editorial AC def main(): M, K = map(int, input().split()) if K >= 2 ** M: print(-1) exit() if M == 1: if K == 0: print(0, 0, 1, 1) else: print(-1) exit() A = list(range(2 ** M)) B = list(rev...
Aasthaengg/IBMdataset
Python_codes/p03046/s798843460.py
s798843460.py
py
478
python
en
code
0
github-code
90
22830016294
from kivy.app import App from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from kivy.clock import Clock from player import SingleStepAutoPlayer from board import Board BLACK = [0, 0, 0, 0] RED = [1, 0, 0, 1] GREEN = [0, 1, 0, 1] BLUE = [0, 0, 1, 1] PURPLE = [1, 0, 1, 1] GRAY = [1, 1, 1, 1...
untergunter/ConnectFour
src/main.py
main.py
py
2,544
python
en
code
0
github-code
90
18169376179
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = ...
Aasthaengg/IBMdataset
Python_codes/p02585/s314487910.py
s314487910.py
py
1,784
python
en
code
0
github-code
90
14412470910
from typing import Any, Dict, Type, TypeVar, Union import attr from ..types import UNSET, Unset T = TypeVar("T", bound="PostArticleStorageProperties") @attr.s(auto_attribs=True) class PostArticleStorageProperties: """ Attributes: is_obsolete (Union[Unset, None, bool]): is_serial_number_arti...
Undefined-Stories-AB/ongoing_wms_rest_api_client
ongoing_wms_rest_api_client/models/post_article_storage_properties.py
post_article_storage_properties.py
py
2,164
python
en
code
1
github-code
90
29070488202
#891345: Nikita Overchuk import string; class Alphabet: def __init__(self, start: str, end: str): alphabet = string.ascii_lowercase self.__length: int = len(alphabet) self.__alphabet_codes: dict = {alphabet[i]: i + 1 for i in range(self.__length)} self.execute(start, end) def _...
Fomaka/LetsLearnGit
Alphabet_Overchuk.py
Alphabet_Overchuk.py
py
1,440
python
en
code
0
github-code
90
32002329961
import discord from datetime import datetime from discord import Embed from discord.ext.commands import when_mentioned_or, Bot, MissingPermissions, Context from discord.ext.commands import CommandNotFound, BadArgument, CommandOnCooldown, MissingRequiredArgument from discord.errors import Forbidden from apscheduler.sc...
weibolu-rm/weibolu-bot
weibolu.py
weibolu.py
py
6,913
python
en
code
0
github-code
90
37440918001
# - * - coding: utf-8 - * - import sys import numpy as np import matplotlib.pyplot as plt import wave import math import librosa import scipy plt.figure(dpi=100) # 将显示的所有图分辨率调高 class MyWave: def __init__(self, wavpath: str) -> None: self.wavpath = wavpath self.wav_fp = open(wavpath, "rb") ...
fulincao/fulincao.github.io
src/audio/wave/test_wav.py
test_wav.py
py
6,294
python
en
code
2
github-code
90
42300182577
import os from typing import Optional from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict from typing_extensions import deprecated from qianfan.consts import DefaultValue, Env class GlobalConfig(BaseSettings): """ The global config of whole qianfan sdk """ mode...
baidubce/bce-qianfan-sdk
src/qianfan/config.py
config.py
py
7,393
python
en
code
109
github-code
90
36275755417
# coding: utf-8 #import tensorflow as tf import random import numpy as np from cs231n.data_utils import load_CIFAR10 from cs231n.classifiers import KNearestNeighbor from cs231n.classifiers.linear_svm import svm_loss_naive from cs231n.classifiers.linear_svm import svm_loss_vectorized from cs231n.gradient_chec...
hccho2/cs231n-Assignment
assignment1/test-svm.py
test-svm.py
py
2,726
python
en
code
0
github-code
90
25604678598
from io import open import json import logging import os import sys import torch import torch.nn.functional as F import torch.nn as nn import torch.distributed as dist from torch.utils.data import DataLoader, Dataset, RandomSampler from torch.utils.data.distributed import DistributedSampler logger = logging.getLogger...
JHPrk/MRC_CSK_pretraining
model/task_utils.py
task_utils.py
py
8,600
python
en
code
1
github-code
90
25300740946
# # @lc app=leetcode.cn id=461 lang=python3 # # [P317] 程序员代码面试指南:不用额外变量交换两个整数 # # @lc code=start class Solution: def exchangeInt(self, x: int, y: int): x = x ^ y y = x ^ y x = x ^ y
HughTang/Leetcode-Python
Bit Manipulation/不用额外变量交换两个整数.py
不用额外变量交换两个整数.py
py
267
python
en
code
0
github-code
90
18426058669
b = input() def tog(s): if s=="A": return "T" elif s=="T": return "A" elif s=="C": return "G" elif s=="G": return "C" else: return None print(tog(b))
Aasthaengg/IBMdataset
Python_codes/p03085/s399945069.py
s399945069.py
py
211
python
en
code
0
github-code
90
16507020735
from bluetooth.ble import DiscoveryService import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(2, GPIO.OUT) GPIO.setup(3, GPIO.OUT) GPIO.setup(4, GPIO.OUT) GPIO.setup(14, GPIO.OUT) GPIO.setup(20, GPIO.OUT) def turn_off_devices(): GPIO.output(2, GPIO.LOW) GPIO.output(3, GPIO.LOW) GPIO.output(14, GP...
aakashbajaj/Raspberry-Pi-Alexa-Home-Control
web-server/blecontrol.py
blecontrol.py
py
1,212
python
en
code
0
github-code
90
33605142094
import sys import itertools as it def parse(s): return [int(line) for line in s.splitlines()] def solve(data): freq = 0 seen = set([freq]) for n in it.cycle(data): freq += n if freq in seen: return freq seen.add(freq) if __name__ == '__main__': data = open(s...
sponster-au/advent2018
advent02.py
advent02.py
py
385
python
en
code
0
github-code
90
20905808110
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import numpy as np from PIL import Image, ImageDraw from maprop.decorators import input_to_numpy from maprop.blackbox.dijkstra import dijkstra from maprop.utils import concat_2d from tqdm import tqdm @input_to_numpy def draw_paths_on_image(image, ...
nec-research/tf-imle
WARCRAFT/cli/visualize-cli.py
visualize-cli.py
py
4,536
python
en
code
69
github-code
90
25741338668
import sys import os import re import time from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * def resource_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath...
BlueGoldfield/001Notes
notes.py
notes.py
py
22,795
python
en
code
0
github-code
90
13266382962
#!/usr/bin/env python # -*- coding:utf-8 -*- n = 11 while True: a = n - (n / 2 + 1 / 2) # 卖出第一次剩余 b = a - (a / 3 + 1 / 3) # 卖出第二次剩余 c = b - (b / 4 + 1 / 4) # 卖出第三次剩余 d = c - (c / 5 + 1 / 5) # 卖出第四次剩余 if d == 11: print(n) break else: n += 1
feiyu7348/python-Learning
算法作业/2-28出售金鱼.py
2-28出售金鱼.py
py
350
python
en
code
0
github-code
90
33698428599
import cv2 import time import datetime import numpy as np from sys import exit display = True i = 0 arr = [0, 0] def diffImg(t0, t1, t2): #חישוב טווח בין שתי נקודות d1 = cv2.absdiff(t2, t1) d2 = cv2.absdiff(t1, t0) #מחשבת את הצירוף לכל חיבור של שני משתנים return cv2.bitwise_and(d1, d2) def mar...
batiaZinger/Posture-Perfect-Project
python-19-06/workDetection/movment2.py
movment2.py
py
1,272
python
en
code
0
github-code
90
22728414924
# -*- coding: utf-8 -*- """ Created on Fri Dec 7 10:03:41 2018 @author: gaoha """ import random import requests import telnetlib from random import choice from bs4 import BeautifulSoup from fake_useragent import UserAgent userAgent = [ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50...
VincentGaoHJ/Spyder-Mafengwo
proxy.py
proxy.py
py
3,495
python
en
code
0
github-code
90
11784690765
import logging import numpy as np import os from osgeo import gdal, osr import random from RasterWrapper import Raster def raster_bounds(raster_obj): ''' GDAL only version of getting bounds for a single raster. ''' # src = raster_obj.data_src gt = raster_obj.geotransform ulx = gt[0] uly = ...
jeff-diz/ms-code-all
RMSE_array_2.py
RMSE_array_2.py
py
2,789
python
en
code
0
github-code
90
18535985519
S=input() K=int(input()) L=[""] for s in range(len(S)): for e in range(s,len(S)): #print(S[s:e+1]) if S[s:e+1] in L: continue if len(L)>K: if S[s:e+1]>L[K]: break if S[s:e+1] not in L: if len(L)<=K: L.append(S[s:e+1]...
Aasthaengg/IBMdataset
Python_codes/p03353/s579004688.py
s579004688.py
py
489
python
en
code
0
github-code
90
18927926591
import random import numpy as np import torch import os from options import opt import data import train import test print(opt) if opt.random_seed != 0: random.seed(opt.random_seed) np.random.seed(opt.random_seed) torch.manual_seed(opt.random_seed) torch.cuda.manual_seed_all(opt.random_seed) d = da...
foxlf823/deid
main.py
main.py
py
1,336
python
en
code
0
github-code
90
74098541098
import json import urllib2 import sys from flask import Flask, render_template from flask_socketio import SocketIO import time #cue support #from cue_sdk import * foods = ["Restaurant", "Fast Food", "Alcohol & Bars",] ents = ["Shopping", "Entertainment", "Electronics & Software"] #"Travel", necs = ["Groceries", "H...
darrentu/asdfinance
enterprise/Controllers/backend-no-corsair.py
backend-no-corsair.py
py
2,369
python
en
code
1
github-code
90
4419414194
# Import libraries # set up variables le = 30 # length wi = 20 # width hi = 5 # height ma = 0 # room space blocked (cubic) def calc_room_temp(le, wi, hi, ma, warmth, cool, temp): """ Calculating the temperature of a room given the diameter. :param le: length of the room :param wi: width of the...
Gradwanderer/digital_twin
Room_temperature.py
Room_temperature.py
py
831
python
en
code
1
github-code
90
71295829098
import random, sys print('Roca, Papel, Tijera') victorias = 0 perdidas = 0 empates = 0 while True: print('%s Victorias, %s Perdidas, %s Empates' % (victorias, perdidas, empates)) while True: print('Ingrese su movimiento: (r)oca (p)apel (t)ijeras or (s)alir ') playerMove = input() if p...
davidgg090/rpsGame
rpsGame.py
rpsGame.py
py
1,611
python
en
code
1
github-code
90
23488006437
import requests,hashlib from requests.adapters import HTTPAdapter headers = { 'Referer': 'https://www.cls.cn/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36', } s = requests.Session() s.mount('http://', HTTPAdapter(max_retries...
hl1227/cls_spider
cls_plate.py
cls_plate.py
py
1,543
python
en
code
2
github-code
90
42642049297
import torch from ..inference import RPNPostProcessor from ..utils import permute_and_flatten from maskrcnn_benchmark.modeling.box_coder import BoxCoder from maskrcnn_benchmark.modeling.utils import cat from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.boxlist_ops impor...
houweidong/FCOS
maskrcnn_benchmark/modeling/rpn/lof/display.py
display.py
py
5,371
python
en
code
0
github-code
90
5237440586
class Solution: # @param A : list of integers # @param B : list of integers # @param C : integer # @return an integer def solve(self, A, B, C): n = len(B) # number of items dp = [0] * (C + 1) # value at C j Space(C) items = set() # B contribute to dpJnWi > dp[j] ...
PrinceSinghhub/InterviewBit-Dynamic-Programming
Interview Bit Dynamic Programming/0-1 Knapsack.py
0-1 Knapsack.py
py
912
python
en
code
1
github-code
90
43679800107
"""Zaptec component sensors.""" from __future__ import annotations import logging from dataclasses import dataclass from homeassistant import const from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.config_entr...
Gyran/zaptec
custom_components/zaptec/sensor.py
sensor.py
py
6,623
python
en
code
null
github-code
90
17958956154
from queue import Queue import time from unittest.mock import Mock from oscduplicator.osc_receiver import OSCMessage from oscduplicator.osc_transmitter import OSCTransmitter from oscduplicator.transmit_port_setting import TransmitPortSetting def test_init(): queue = Queue() transmitter = OSCTransmitter(queue...
aruma256/OSCDuplicator
tests/test_osc_transmitter.py
test_osc_transmitter.py
py
1,535
python
en
code
1
github-code
90
19252189794
import requests import json if __name__ == '__main__': url = 'https://httpbin.org/post' payload = { 'nombre':'David', 'nivel':'intermedio' } response = requests.post(url , data=json.dumps(payload)) # print(response.url) if response.status_code == 200: print(response.co...
santiagoDmora/testScripts
APIs/APIsPost.py
APIsPost.py
py
327
python
en
code
0
github-code
90
24685083419
# Built-in imports from typing import List, Optional, Union from ufl.tensors import ListTensor # Third-party imports import numpy as np from fenics import * def f2n( var: Union[Function, List[Function], ListTensor], W: Optional[FunctionSpace] = None, ) -> np.ndarray: """ Fenics to Numpy Returns a...
LukasDeutz/minimal-worm
minimal_worm/util.py
util.py
py
3,495
python
en
code
0
github-code
90
63685575
import argparse import functools as ft import itertools as it import os from datetime import datetime from multiprocessing import Pool from typing import * import h5py # %%% Functions # %%%% Iterator Tools def split_every(n: int, iterable: Iterable) -> Iterable[list]: """Return an iterator that splits the itera...
mcmanusef/vmi-analysis
uncluster_v3.py
uncluster_v3.py
py
10,108
python
en
code
0
github-code
90
22565384787
import sqlite3 import numpy as np import pandas as pd from behave import * import data.LoadDatabase from src import Models CSV_FILE_PATH = 'test/resources/test.csv' DB_FILE_PATH = 'test/resources/test.sqlite3' # --- GIVENs --- @given('a CSV file containing historical stock data') def step_impl(context): histo...
cwcowell/haircuts-and-oatmeal
test/features/steps/simulation_steps.py
simulation_steps.py
py
7,927
python
en
code
0
github-code
90