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
14472646619
from datetime import datetime, timedelta #Local imports import dictionaries as D import date_compute as Date from markup import CC, exact_length, remove_chars #Common objects def_song_dict = D.default_song_dict #Dictionary for song data. class Editable(): """An abstract object that allows you to give it any ini...
Shaunticlair/Singsong
song_class.py
song_class.py
py
13,195
python
en
code
0
github-code
1
2359544342
"""Blackcap job POST route.""" from http import HTTPStatus import json from flask import make_response, request, Response from pydantic import parse_obj_as, ValidationError from sqlalchemy.exc import SQLAlchemyError from blackcap.blocs.cluster import create_cluster from blackcap.routes.cluster import cluster_bp from...
EBI-Metagenomics/orchestra
blackcap/src/blackcap/routes/cluster/post.py
post.py
py
2,203
python
en
code
4
github-code
1
837913650
import os import glob from copy import copy Import ('env') test_env = env.Clone() test_env['LIBS'] = [env['MAPNIK_NAME']] test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS'])) test_env.AppendUnique(LIBS='mapnik-wkt') test_env.AppendUnique(LIBS='sqlite3') if env['PLATFORM'] == 'Linux': test_env.AppendUnique(LIB...
mapnik/mapnik
benchmark/build.py
build.py
py
1,285
python
en
code
3,476
github-code
1
1134873417
#coding:utf-8 ''' 各进程的变量是独立的,而线程的是共享的,如果不处理这个问题会导致出错. 由于线程的调度是由操作系统决定的,当t1、t2交替执行时,只要循环次数足够多,balance的结果就不一定是0了 给change_it 加上一个锁 ''' from threading import Thread, Lock import time #实例化一个锁对象 lock = Lock() balance = 0 def change_it(n): #先存后取,结果应该为0 global balance balance += n balance -= n def run_thread...
Chiens/learnPy
Process&Thread/Thread_Lock1.py
Thread_Lock1.py
py
979
python
zh
code
0
github-code
1
31740308073
import socket import sys import struct import csv from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_PSS from Crypto.Cipher import PKCS1_OAEP from Crypto.Hash import SHA256 # Sign message with private key def sign_message(private_key, message): h = SHA256.new(message) signer = PKCS1_PSS.new(pr...
brdofparadise/SDM_project
Key-Distribution/test.py
test.py
py
1,650
python
en
code
0
github-code
1
3738371268
import pandas as pd def getSample(act, pred): sample = sum(2 * abs(pred - act)/(pred + act)) / pred.size return sample def getMonoScore(test_df, preds): test_sample_df = test_df[['广告id', '曝光广告出价bid']] test_sample_df['预测曝光量'] = preds test_sample_df.sort_values(by=["广告id", "曝光广告出价bid"], inplace=T...
hancyran/tencent_ad_competition_2019
src/eval/metric.py
metric.py
py
1,336
python
en
code
0
github-code
1
24881461739
from downloader.config import AllowDelete from downloader.constants import K_BASE_PATH, K_ALLOW_DELETE from downloader.db_entity import DbEntity, DbEntityValidationException class OfflineImporter: def __init__(self, file_system_factory, file_downloader_factory, logger): self._file_system_factory = file_sy...
theypsilon-test/downloader
src/downloader/offline_importer.py
offline_importer.py
py
5,862
python
en
code
0
github-code
1
74631711073
#### Origin : https://www.topcoder.com/thrive/articles/web-crawler-in-python import requests import lxml from bs4 import BeautifulSoup from xlwt import * url = "https://www.manchester.ac.uk/study/international/study-abroad-programmes/study-abroad/course-units/subject-list/" headers = { 'User-Agent': 'Mozilla/5.0 ...
FreeX2020/Simple-Crawler
manchester - origin.py
manchester - origin.py
py
1,126
python
en
code
0
github-code
1
74878932514
import time import wrap from wrap import sprite import tank,brick wrap.world.create_world(800, 653,) wrap.world.set_back_color(0,0,0) lazer=tank.add_lazer() lazer1=tank.add_lazer() tank1 = sprite.add('battle_city_tanks', 400, 300, 'tank_player_size1_green1') tank2 = sprite.add('battle_city_tanks', 300, 400, 'tank_en...
forses12/tanks
tanks.py
tanks.py
py
2,998
python
en
code
0
github-code
1
70506294434
#!/usr/bin/python3 if __name__ == "__main__": from sys import argv result = 0 argc = len(argv) if argc > 1: for i in range(1, argc): result = result + int(argv[i]) print("{}".format(result))
Slimake/alx-higher_level_programming
0x02-python-import_modules/3-infinite_add.py
3-infinite_add.py
py
232
python
en
code
0
github-code
1
13585925779
from pprint import pprint from riko.bado import coroutine from riko.collections import SyncPipe, AsyncPipe p385_conf = {"type": "date"} p385_in = {"content": "12/2/2014"} p405_conf = {"format": "%B %d, %Y"} p393_conf = { "attrs": [ {"value": {"terminal": "date", "path": "dateformat"}, "key": "date"}, ...
nerevu/riko
examples/split.py
split.py
py
1,188
python
en
code
1,605
github-code
1
73527888354
from nmigen import * from nmigen_stdio.serial import * class TestUartTx(Elaboratable): """ Test of RX peripheral that receives data from the host """ def __init__(self, pkt_size=16): # Parameters self.pkt_size = pkt_size # Inputs self.i_pkt = Signal(self.pkt_size * 8) ...
lawrie/qspi_periph
gateware/old_periph/test_uart_tx.py
test_uart_tx.py
py
1,320
python
en
code
1
github-code
1
11825587184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 14 12:39:12 2020 @author: petrapoklukar """ import numpy as np import torch import torch.nn as nn import torch.nn.init as init class Downsample(nn.Module): def __init__(self, in_channels, out_channels, kernel_size): super(Downsamp...
Francescoes/visual_planning
lsr_ltl/architectures/EncoderAPN_ConvNetMlp.py
EncoderAPN_ConvNetMlp.py
py
11,416
python
en
code
0
github-code
1
41440405122
# 소가 길을 건너간 이유 ''' 들어온 시간 순으로 정렬 queue에서 빨리 들어온 순으로 처리 가능한 케이스 아직 소가 입장하지 않았다면, 소가 입장하자마자 검사를 받을 수 있음 시간 = 소의 입장시간 + 검진에 걸리는 시간 소가 기다리는 상황이라면 (시간이 입장시간을 넘김 상황) 시간 = 시간 + 검진에 걸리는 시간 ''' from collections import deque def solution(arr): arr.sort()...
aszxvcb/TIL
BOJ/boj14469.py
boj14469.py
py
938
python
ko
code
0
github-code
1
35021750476
import requests import json from bs4 import BeautifulSoup as bs import pandas as pd from icalendar import Calendar, Event, vCalAddress, vText import pytz from datetime import date, datetime, timedelta import os from pathlib import Path from dateutil.parser import parse from dateutil import parser from dateutil.relative...
amandakreider/Concert-Calendars
scripts/bowery.py
bowery.py
py
4,033
python
en
code
2
github-code
1
33006988898
# String formátozás, és f stringek # régi mód szoveg1 = "A te neved %s, és %d éves vagy." % ("Andi", 17) print(szoveg1) # nem olyan régi mód szoveg2 = "A te neved {}, és {} éves vagy.".format("Ildi", 28) print(szoveg2) # új mód (f strings) nev = "Enikő" kor = 35 szoveg3 = f"A te neved {nev}, és {kor} éves vagy." ...
sumegizoltan73/python_kezdo_training
38_f_strings.py
38_f_strings.py
py
523
python
hu
code
0
github-code
1
29439933222
# -*- coding: utf-8 -*- from PyQt5 import QtCore, QtGui, QtWidgets import pymongo import pandas as pd myserver = "mongodb+srv://admin:1234@cluster0.7voii.gcp.mongodb.net/<dbname>?retryWrites=true&w=majority" class Ui_Dialog(object): def __init__(self): self.login = False def setupUi(self, Dialog):...
phongsmm/Revenue_Reporter
FirstPage.py
FirstPage.py
py
12,026
python
en
code
0
github-code
1
32296661935
import socket port = 3000 CHUNK = 65535 s= socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #for creating socket hostname = '127.0.0.1' while True: s.connect((hostname,port)) message = input("You: ") data = message.encode('ascii') s.send(data) data = s.recv(CHUNK) text = data.decode('ascii') print(f"server: {t...
Nikhilgupta18/Python-ChatApp-SocketProgram
client.py
client.py
py
327
python
en
code
0
github-code
1
25893337615
###아메바가 분열하여 두개체가 되는데 1분소모됨 ###분열한 아메바의 기존개체는 사라지고 분열후에 하나는 바로분열시작하지만 하나는 1분후에 분열시작 ###분열중엔 개체가 남아있는 것으로 하였을떄 ## 아메바가 생겨날떄마다 이름을 짓는다면 몇개의 이름을 지어야할까? def child(lst,count): count+=lst[0]*2 ready=lst[0] lst[0]+=lst[1] lst[1]=ready return lst,count lst=[1,0]##[분열하는 아메바,휴식중인아메바수] count=1##처음에...
Ojin0104/MyCode
Algorithmtest/FastCampus/ameba.py
ameba.py
py
682
python
ko
code
0
github-code
1
73655715235
import numpy as np def count_points(hand, flip): suits = [card[-1] for card in hand] ranks = [card[:-1] for card in hand] rank_dict = {'J':11, 'Q':12, 'K':13} nums= [] values = [] for i in range(len(ranks)): if ranks[i] in rank_dict: nums.append(rank_dict[ranks[i]]) ...
Daniel-Hannon/Personal-Projects
cribbage_counter.py
cribbage_counter.py
py
5,096
python
en
code
0
github-code
1
4409617727
"""Plot graph out of given data.""" import matplotlib.pyplot as plt def initGraph(x_axis, temperature, rainfall, title="Plot"): """Initialize graph to plot temperature and rainfall values.""" figure, temperature_axis = plt.subplots() figure.canvas.set_window_title(title) # axis for temperature data ...
rkleee/aragonit
weather/PlotGraph.py
PlotGraph.py
py
1,104
python
en
code
0
github-code
1
33010878632
import threading import socket import json import logging import traceback from json import JSONDecodeError """Object Request Broker This module implements the infrastructure needed to transparently create objects that communicate via networks. This infrastructure consists of: -- Stub :: Represents the imag...
seth-russell/Distributed-Lab4
modules/Common/orb.py
orb.py
py
8,712
python
en
code
0
github-code
1
73495741153
import glob import os import sys urls = set() _base_dir = os.path.dirname(__file__) def _ensure_url(path): url = path path = _base_dir + '/' + path return ('file://'+ os.path.realpath(path)) if os.path.isfile(path) else url for fn in glob.glob(os.path.dirname(__file__) + '/urls[0-9]*'): with open(fn...
CTSRD-CHERI/memory-alloc-tracing
workload/chromium/urls.py
urls.py
py
424
python
en
code
2
github-code
1
23197876912
rocks = [['####'], ['.#.', '###', '.#.'], ['###', '..#', '..#'], ['#', '#', '#', '#'], ['##', '##']] jetDir = {'<': -1, '>': 1} width = 7 gap = 3 class Flow(): def __init__(self, file): self.jets = list(open('17/' + file).readline().strip()) self.jetPointer = 0 self.chamber = [[True] * wid...
paullickman/2022
17/rocks.py
rocks.py
py
4,045
python
en
code
0
github-code
1
3978633911
#!/usr/bin/env python3 import json import os import sys import re from collections import defaultdict def load_channel_history(basedir): messages = defaultdict(list) for root, dirs, files in os.walk(basedir): _, dirname = os.path.split(root) for fname in [fname for fname in files if fname.ends...
bruntonspall/slack-export-tools
find_message.py
find_message.py
py
3,570
python
en
code
1
github-code
1
12060604494
""" Hi, here's your problem today. This problem was recently asked by Microsoft: You 2 integers n and m representing an n by m grid, determine the number of ways you can get from the top-left to the bottom-right of the matrix y going only right or down. Example: n = 2, m = 2 This should return 2, since the only poss...
winkitee/coding-interview-problems
11-20/20_ways_to_traverse_a_grid.py
20_ways_to_traverse_a_grid.py
py
760
python
en
code
0
github-code
1
26422490288
import random import time cChoices = ["Arizona","Racecar", "Tower"] name = input("Whats your name? ") print("Hello " +name, ",Welcome to Hangman!!") mysteryWord = random.choice(cChoices) print(mysteryWord) Guesslist = [] for letter in mysteryWord: Guesslist.append("_") print(Guesslist) misses = 0 w...
WarrumDn2124/Lessons-and-notes-Semester-1
Hangman.py
Hangman.py
py
645
python
en
code
0
github-code
1
41541696976
from django.conf.urls import url, include from django.contrib import admin from materias.views import criarUsuario admin.autodiscover() urlpatterns = [ url('admin/', admin.site.urls), #Django Oauth Toolkit urls #Urls do DOT para as operacoes de autenticacao e aplicacoes url('o/', include('oauth2_prov...
LucasSSales/TestesDjango
apirest_v2/apirest_v2/urls.py
urls.py
py
725
python
pt
code
0
github-code
1
16950486496
def nextUser(room): # Libraries from sys import path path.append("/home/pi/autoBooker/") import RGBreader import selectDay import sheets import scan import time import random import csv from time import sleep import pynput from pynput.mouse import Button, Controller ...
eidetech/autoBooker
dualUserBooking.py
dualUserBooking.py
py
7,068
python
en
code
1
github-code
1
40508293126
import openpyxl import word_extractor import sys # from googletrans import Translator class OutputExtractedWordToExcel (word_extractor.WordExtractorFromFolder): # translator = Translator() def __init__(self, src_folder, language, wb_output="", wb_reference=""): super().__init__(src_folder, language) ...
acannie/word_extractor
output_to_excel.py
output_to_excel.py
py
4,502
python
en
code
0
github-code
1
35365131579
a = [5,3,4,6,21,41,661,3,3,3,3,3,3,21,1,1,6,7,8,9,0,5,3,288] right = len(a)-1 left = 0 while left<right: while a[left]%2==0 and left<right : left += 1 while a[right]%2==1 and left<right : right = right-1 if left < right: a[left],a[right] = a[right],a[left] print(a)
fuadsami/leetcode
Array/custom-sorted-array/custom sorted array.py
custom sorted array.py
py
317
python
en
code
2
github-code
1
29995455881
import os import click import pandas as pd from sklearn.model_selection import train_test_split @click.command("split_dataset") @click.option("--input-dir") @click.option("--output-dir") @click.option("--val_size", default=0.2, help="share of validation dataset") @click.option("--seed", default=42, help="random seed...
made-ml-in-prod-2021/garistvlad
airflow-dags/images/airflow-split-dataset/split_dataset.py
split_dataset.py
py
1,546
python
en
code
0
github-code
1
7526738537
def readinput(): n=int(input()) a=list(map(int,input().split())) return n,a def main(n,a): sump=0 summ=0 minm=-10**9 minp=10**9 countm=0 for i in range(n): if a[i]>=0: sump+=a[i] minp=min(minp,a[i]) else: countm+=1 summ...
bokukko7/AOJ_AtCoder
AtCoder/ABC125/D.py
D.py
py
584
python
en
code
0
github-code
1
43177763226
import uuid import allure import pytest from base.api.base import BaseAPI from base.api.users.mail_messages.mail_messages import get_mail_messages, get_mail_message, get_mail_messages_query from models.users.mail_message import MailMessages from parameters.api.users.mail_messages import mail_messages_methods from set...
Nikita-Filonov/demo_auto_tests
tests/api/users/mail_messages/test_mail_messages.py
test_mail_messages.py
py
3,423
python
en
code
3
github-code
1
14830489425
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 8/15/18 4:51 PM # @Author : bai yang # @Site : # @File : upload_view.py # @Software: PyCharm import hashlib import os from sanic.response import json from sanic.views import HTTPMethodView from article.settings import baseDir, imge_url from PIL import I...
B9527/sannic_demo_objk
article/views/upload_view.py
upload_view.py
py
2,445
python
en
code
0
github-code
1
36284436295
import sys from collections import deque # sys.setrecursionlimit(10**6) # sys.stdin = open("bj-solve\input.txt", 'r') input = sys.stdin.readline def bfs(start): q = deque([start]) while q: node = q.popleft() visited[node] = 1 for i in edge[node]: if not visit...
kyeong8/Algorithm
백준/Gold/16940. BFS 스페셜 저지/BFS 스페셜 저지.py
BFS 스페셜 저지.py
py
986
python
en
code
0
github-code
1
26363657121
import cv2 import mediapipe from datetime import datetime cap = cv2.VideoCapture(0) mp_hands = mediapipe.solutions.hands hands = mp_hands.Hands() mp_draw = mediapipe.solutions.drawing_utils while True: previous_timestamp = datetime.now() iterate_index = 1 counter = 0 break if not cap.isOpened(): pri...
WillCaton2350/Gesture-Tracking-opencv-python
hand_tracking/htm_import/main.py
main.py
py
2,213
python
en
code
0
github-code
1
71942638433
from torch import nn from torchvision.transforms import ToTensor import torch class LFIClassification(nn.Module): def __init__(self): super(LFIClassification, self).__init__() self.linear_stack = nn.Sequential( nn.Flatten(), nn.Unflatten(1, torch.Size([3, 8*8, 376, 541])), ...
Zhicheng-Lu/LFI_classification
LFI_classification_model.py
LFI_classification_model.py
py
1,345
python
en
code
0
github-code
1
71224197793
import numpy as np import sys import random import pprint import copy # ########################## CLASS DEFINITION ########################## # class FormNewPopulation(object): def __init__(self, chromosomes_map): """ :param chromosomes_map: """ # initial chromosome self.c...
NightRunner7/Computer-modeling-in-physcial-phenomena
Classes-5/offspring_chromosomes.py
offspring_chromosomes.py
py
15,921
python
en
code
0
github-code
1
15834305969
"""Classes for object detection.""" from __future__ import division from __future__ import print_function from collections import deque import cv2 import numpy as np from .utils import hsv_mask class FieldFinder(object): """Finds the contour of the field.""" def __init__(self, hsv_lower, hsv_upper): ...
ltskv/kick-it
pykick/finders.py
finders.py
py
10,452
python
en
code
1
github-code
1
5099777492
import json import logging import random import time from threading import Thread, Event from core.models import Module class ModuleEmulator(object): def __init__(self, mac, app, mqtt_client): self.mqtt_client = mqtt_client self.mac = mac self.app = app self.module_thread = None ...
brewmajsters/brewmaster-backend
mqtt/emulator/module_emulator.py
module_emulator.py
py
3,575
python
en
code
1
github-code
1
20192999046
from operator import truediv import sys import requests from datetime import datetime from formatting import format_msg from send_mail import send_mail def send(name, website=None, to_email=None, verbose = False): assert to_email!= None if website==None: msg = format_msg(my_name=name) else: ...
eavf/30-days
Day9/send.py
send.py
py
935
python
en
code
0
github-code
1
15405511813
#!/usr/bin/env python3 """ https://adventofcode.com/2015/day/17 """ from itertools import combinations import aoc PUZZLE = aoc.Puzzle(day=17, year=2015) TARGET = 150 def solve(part='a'): """Solve puzzle""" containers = list(map(int, PUZZLE.input.splitlines())) valid = [] for count in range(1, len(con...
trosine/advent-of-code
2015/day17.py
day17.py
py
634
python
en
code
0
github-code
1
585691265
class Solution(object): def ladderLength(self, beginWord, endWord, wordList): """ :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int """ if endWord not in wordList: return 0 wordList = set(wordList) nodes ...
JSantosha/LeetCode-Python
Breadth-first Search/127 - Word Ladder.py
127 - Word Ladder.py
py
965
python
en
code
0
github-code
1
23328438834
from face_shape_prediction import * import os from flask import Flask, request, render_template UPLOAD_FOLDER = './upload' app = Flask(__name__) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER @app.route('/', methods=['GET', 'POST']) def upload_file(): if request.method == 'POST': if 'file1' not in request....
ACardenasSil/BarberRater
face_classifier/api.py
api.py
py
692
python
en
code
3
github-code
1
4797701157
def read_file(filename): stacks = [[] for _ in range(9)] procedures = [] with open(filename) as f: # Read the stacks for line in f: if line[1] == "1": # print("Found column labels") break index = 0 while line: ...
john-petrangelo/AdventOfCode
2022/Day05/Day05.py
Day05.py
py
2,936
python
en
code
0
github-code
1
8493661627
import time from globals import OPEN_COURSE_URL from pages import BaseHandler class ListCoursesHandler(BaseHandler): template = "courses/list.html" def myget(self): return dict( my_courses=self.user.courses(), taught_courses=list(self.user.courses_taught()) # lists we can do ...
matts1/MajorWork-appengine
pages/courses/list.py
list.py
py
1,101
python
en
code
0
github-code
1
6604506908
import os import sys import obonet import numpy as np import networkx as nx from functools import reduce from tempfile import gettempdir from sklearn.preprocessing import MultiLabelBinarizer from gensim.models.poincare import PoincareModel, PoincareKeyedVectors go_graph = None mfo, cco, bpo = None, None, None dim...
yotamfr/prot2vec
src/python/geneontology.py
geneontology.py
py
6,304
python
en
code
10
github-code
1
17411958599
import pandas as pd import yfinance as yf import plotly.graph_objects as go stock = yf.Ticker('MSFT') data = stock.history(period="100d") data.to_csv('yahoo.csv') df = pd.read_csv('yahoo.csv') candlestick = go.Candlestick(x=df['Date'], open=df['Open'], high=df['High'], low=df['Low'], close=df['Close']) fig = go.Figur...
keshavdalmia10/stonks_bot
chart.py
chart.py
py
387
python
en
code
0
github-code
1
10465751834
import asyncio from typing import List, Optional from nonebot_plugin_datastore.db import get_engine from sqlalchemy import ForeignKey, UniqueConstraint, select from sqlalchemy.orm import Mapped, mapped_column, relationship, joinedload from .user_sql import create_session, db class Group(db.Model): id: Mapped[in...
canxin121/nonebot_plugin_bind
nonebot_plugin_bind/group_sql.py
group_sql.py
py
4,781
python
en
code
6
github-code
1
16005290351
import subprocess import struct, datetime from subprocess import PIPE,Popen # used in screenSize and issueCMD def convertBytes(inBytes): """ Routine to convert a given number of bytes into a more human readable form Input : number of bytes Output : returns a MB / GB / TB value for bytes """ bytes = ...
pcuzner/gluster-monitor
gtop_utils.py
gtop_utils.py
py
2,297
python
en
code
21
github-code
1
25266546091
import heapq def kruskal(n, m): H = [] total = 0 for j in range(m): a, b, c = tuple(map(int, input().split())) total += c heapq.heappush(H, (c, a, b)) C = [[] * n for i in range(n)] for i in range(n): C[i].append(i) S = [] for i in range(n): S.app...
jacksoncl7/uri_solutions
accepted/uri_1152.py
uri_1152.py
py
853
python
en
code
0
github-code
1
2440411216
#Churn analysis of bank leaving customer and we will calssify them # Artificial Neural Network # Installing Theano (Numerical based library (runs on cpu aswellas gpu)) # !pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow () # !Install Tensorflow from the website: https://...
awaisajaz1/Machine-Learning-Learning-Path
Machine Learning A-Z/Part 8 - Deep Learning/Section 39 - Artificial Neural Networks (ANN)/Artificial Neural Network.py
Artificial Neural Network.py
py
5,678
python
en
code
0
github-code
1
31541062637
import deck as deck_of_cards import poker_hand NUM_OF_HANDS_IN_TABLE = 10000 CARDS_IN_ONE_HAND = 5 IS_PAIR = 1 IS_TWO_PAIRS = 2 def main_program(): """ :return: the table output """ res = { 'Pair': 0, 'Two-pairs': 0, 'Flush': 0, 'High-card': 0, } header = ['...
vuminhdiep/CSC120
CSC 120/workspace/diepvu_emma_project1/main.py
main.py
py
2,040
python
en
code
0
github-code
1
28102311716
# -*- coding:utf-8 -*- # @Time: 2020/4/28 14:12 # @Author: wenqin_zhu # @File: table_list.py # @Software: PyCharm import time from selenium.webdriver.common.by import By from guard.pages.classes.basepage import BasePage from guard.pages.components.dialog import DialogPage from selenium.webdriver.support.wait import We...
qinwenzhu/real_project_for_web
guard/pages/components/table_list.py
table_list.py
py
4,265
python
en
code
0
github-code
1
11875042834
import os import sys from time import gmtime, strftime from keras.models import load_model from sklearn.metrics import precision_recall_fscore_support, mean_squared_error, average_precision_score from math import sqrt import numpy as np import pandas as pd import math import keras.backend as K dir_path = os.path.dirn...
tjcdev/sci-autoencoder
src/experiments/run_pop_test.py
run_pop_test.py
py
3,038
python
en
code
2
github-code
1
11867056225
#! /usr/bin/env python from kivy.app import App from kivy.lang import Builder import re import os from kivy.uix.screenmanager import ScreenManager import bcitp.screens.templates.settings_template from bcitp.utils.session_info import SessionHeader from bcitp.screens.start_screen import StartScreen from bcitp.scree...
rafaelmendes/BCItp
main.py
main.py
py
3,255
python
en
code
4
github-code
1
15926540509
from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render from .models import Swell, Tide, SurfSession, SurfSpot from datetime import datetime, timedelta, timezone from .forms import AddSessionForm, AddSurfSpot, SessionMatchesConditions, SessionMatchesTimeAndPlace # adding a ses...
kremerica/surfiq
surfinfo/views.py
views.py
py
8,550
python
en
code
0
github-code
1
38885564257
''' @author: alec_host ''' import sys import uuid import logging import pytz import datetime from sqlalchemy import or_,desc from sqlalchemy.orm import Session from register_schema import CreateAndUpdateCustomerEntries from register_model import CustomerEntriesDescription import conn.config sys.path.insert(0,conn.c...
alec-host/air_draw
register/register_crud.py
register_crud.py
py
3,780
python
en
code
0
github-code
1
5232865246
from rest_framework.test import APITestCase from django.urls import reverse from faker import Faker class TestSetup(APITestCase): def setUp(self): self.register_url = reverse('register') self.login_url = reverse('login') self.fake = Faker() self.user_data = { 'titl...
bbrighttaer/adplisttest
authentication/tests/test_setup.py
test_setup.py
py
840
python
en
code
0
github-code
1
26406716123
from fastapi import APIRouter, Query from app.database import player_helper, team_helper, team_info_helper, MONGO_DETAILS, client, players_table, player_images_table,teams_table, team_info_table from motor import motor_asyncio from motor.motor_asyncio import AsyncIOMotorCursor router = APIRouter() @router.get('/playe...
julianjohnson10/fast_api_project
backend/app/views.py
views.py
py
2,214
python
en
code
0
github-code
1
10935719042
#coding=utf-8 from urllib import request import re import json import time #基本思路:使用regx处理request方式获取的页面context,然后将相关信息采用json dump/load的方式存取和读取,最后使用send_SMS发送到自己手机 #http://www.bjjtgl.gov.cn/zhuanti/10weihao/index.html #todo refer to http://www.cnblogs.com/Lands-ljk/p/5467236.html ,and multi-thread etc... #todo ,metho...
salanhess/interview
XianhaoRemind/0_regx_method.py
0_regx_method.py
py
4,108
python
en
code
0
github-code
1
30405433404
# 1046. Last Stone Weight # Easy # You are given an array of integers stones where stones[i] is the weight of the ith stone. # We are playing a game with the stones. On each turn, we choose the heaviest two stones and smash them together. Suppose the heaviest two stones have weights x and y with x <= y. The result of...
akarsh1995/advent-of-code
src/leetcode/lc_1046.py
lc_1046.py
py
1,650
python
en
code
0
github-code
1
39763685082
from django.conf.urls import url, include from Bo_yuan import api urlpatterns = [ # API # 对接微信登陆 返回openid session_key url(r'^code2session$', api.Code2SessionAPIView.as_view()), # 用户信息 url(r'^users$', api.UsersAPIView.as_view()), url(r'^users/(?P<pk>\d+)/$', api.UserAPIView.as_view()), #...
peikaiy/SecondCar
Bo_yuan/urls.py
urls.py
py
2,664
python
en
code
0
github-code
1
37899609315
from statannot import add_stat_annotation def add_wilcoxon_value( df=None, x_var=None, y_var=None, hue=None, order_list=None, ax=None, box_pairs=None, test_type=None, text_format=None, loc=None, fontsize=20, verbose=0, ) -> None: add_stat_annotation( ax, ...
UTAustin-SwarmLab/Swarm-Visualization
swarm_visualizer/utility/statistics_utils.py
statistics_utils.py
py
572
python
en
code
1
github-code
1
41120373132
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.runner import force_fp32, BaseModule, auto_fp16 from mmdet.models.builder import HEADS from model import build_model import math class SiLogLoss(nn.Module): def __init__(self, lambd=0.5): super().__init__() self.lambd = ...
paperwave/AiT
ait/code/model/depth/depth_head.py
depth_head.py
py
3,729
python
en
code
null
github-code
1
25434017419
import sys input=sys.stdin.readline inf=4*(10**9)+7 for _ in range(int(input())): n=int(input()) if n <= 2: print(2) else: for i in range(n, inf+1): for j in range(2, int(n**0.5)+2): if i%j==0: break else: print(i) ...
reddevilmidzy/baekjoonsolve
백준/Silver/4134. 다음 소수/다음 소수.py
다음 소수.py
py
340
python
en
code
3
github-code
1
9857187758
'''random num creat''' from random import choice class Randomwalk(): def __init__(self, walk_num = 5000): self.walk_num = walk_num self.walk_num = walk_num self.x_values = [0] self.y_values = [0] def fill_walk(self): while len(self.x_values) < self.walk_num: x_direction = choice([-1,1]) x_distanc...
isyefeng/python-test
section15/plot/random_walk.py
random_walk.py
py
693
python
en
code
1
github-code
1
32159493636
import sys import uio def pformat(obj, indent=1, width=80, depth=None): buf = uio.StringIO() _pprint(obj, buf, indent, width, depth) return buf.getvalue() def _pprint(obj, stream=None, indent=1, width=80, depth=None): if stream is None: stream = sys.stdout if isinstance(obj, dict): ...
pfalcon/pycopy-lib
pprint/pprint.py
pprint.py
py
793
python
en
code
229
github-code
1
23992825622
from .piece import * class Knight(Piece): def __init__(self, board, start_x, start_y, color='black'): super().__init__(board, start_x, start_y, color) self.letter = 'Kn' self.draw() def move_is_valid(self, move_x, move_y): return self.check_move(move_x, move_y) def move_i...
KyleWardle/Python-Projects
chess/pieces/knight.py
knight.py
py
1,076
python
en
code
0
github-code
1
24939097772
''' 7 - Escreva uma função recursiva que determine quantas vezes um dígito k ocorre em um número natural N. Exemplo, o dígito 2 ocorre 2 vezes em 824562. ''' import math def tam(numero): #funcao auxiliar numero = abs(int(numero)) return (1 if numero == 0 else math.floor(math.log10(numero)) + 1) def k...
Lixipluv/Code-Cool-Things
PythonCodes/pythonCodes/kTimes.py
kTimes.py
py
604
python
pt
code
0
github-code
1
73572770594
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Sep 29 08:44:31 2017 @author: alef1 """ import math as m ################################################ #### rede RBF para comparar com a mlp #### #### camada oculta u = ||Xi - Ti|| #### #### camada saida u = S(Wi*Thei||Xi - Ti||## ...
alef123vinicius/MultiLayerIris
brf.py
brf.py
py
2,417
python
pt
code
0
github-code
1
72425394593
#!/usr/bin/python from pyliferisk import Actuarial, Axn from pyliferisk.mortalitytables import GKM95 mt = Actuarial(nt=GKM95, i=0.03) x = 40 #age n = 20 #horizon C = 10000 #capital print(Axn(mt, x, n) * C)
franciscogarate/pyliferisk
Examples/Example_2_2_2.py
Example_2_2_2.py
py
212
python
en
code
93
github-code
1
74540625312
from ipywidgets import DOMWidget from robotframework_interpreter import init_suite, execute, complete from robotframework_interpreter.robot_version import ROBOT_MAJOR_VERSION CELL1 = """\ *** Settings *** Library Collections """ CELL2 = """\ *** Variables *** ${VARNAME} Hello """ CELL3 = """\ *** Keywords *** ...
jupyter-xeus/robotframework-interpreter
tests/test_interpreter.py
test_interpreter.py
py
1,980
python
en
code
3
github-code
1
27287325113
""" Helper method to train AutoML model for image classification. """ from typing import Dict, Any import cleanlab from gluoncv.auto.data.dataset import ImageClassificationDataset from autogluon.multimodal import MultiModalPredictor def train( dataset, out_folder: str = "./model_training_run/", hyperpara...
cleanlab/examples
active_learning_single_annotator/utils/model_training_autogluon.py
model_training_autogluon.py
py
1,490
python
en
code
78
github-code
1
35875462150
import re file_name = r'D:\WORK\11 класс\Макиевский Кирилл\Материалы\24data\24-181.txt' with open(file_name, 'r') as f: s = f.readline() gap = 1 lens = list(map(lambda x: len(x), s.split('.'))) ans = list() for i in range(len(lens) - gap): ans.append(sum(lens[i:i + gap + 1]) + gap) print(max(ans))
Kalenghil/School_Work
Классная работа/Декабрь/15.12.2021/24/181.py
181.py
py
334
python
en
code
0
github-code
1
6193431968
#!/usr/bin/env python # coding: utf-8 import sys from PySide2.QtWidgets import QApplication, QVBoxLayout, QWidget from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar import matplotlib.pyplot as plt im...
bitwalk123/PySide2_sample
qt_matplotlib.py
qt_matplotlib.py
py
3,583
python
en
code
1
github-code
1
73545450914
import discord import asyncio import crawl_rss as cr from tokens import Token client = discord.Client() token = Token.discord_token async def my_background_task(): await client.wait_until_ready() channel = client.get_channel(Token.discord_channel) await channel.send(cr.messageFormat()) while not cli...
klsw725/YWAM-CMSE-contemplation-bot
discord_bot.py
discord_bot.py
py
670
python
en
code
0
github-code
1
33458559016
from soundrts.mapfile import Map from soundrts.world import World from soundrts.worldclient import DummyClient tiny_map = b""" square_width 12 nb_columns 2 nb_lines 1 nb_meadows_by_square 9 west_east_paths a1 nb_players_min 1 nb_players_max 1 player 10 10 a1 guardtower b1 peasant """ def test_enter_building_from_...
soundmud/soundrts
soundrts/tests/test_order.py
test_order.py
py
794
python
en
code
37
github-code
1
23908190149
#!/usr/local/bin/python3 # # Authors: Bobby Rathore (brathore), Neha Supe (nehasupe), Kelly Wheeler (kellwhee) # # Mountain ridge finder # Based on skeleton code by D. Crandall, Oct 2019 from PIL import Image import numpy as np from scipy.ndimage import filters import sys import os import imageio class HMM: def ...
bobbyrathoree/expectiminimax-board-game--finding-horizons
part2/mountain.py
mountain.py
py
12,646
python
en
code
0
github-code
1
30792750190
from tkinter import * import os import ntpath from pywidgets.tk.func import bind_all_childes from pywidgets.tk.Lables.__origen import _EXPLORE from pywidgets.tk.Verticle_Frame import VerticalScrolledFrame from PIL import ImageTk,Image FILE_PATH=os.path.dirname(__file__) RIGHTARROW=Image.open(os.path.join(FILE_PATH,"i...
Emam546/pywidgets
pywidgets/tk/Lables/custom_viewer.py
custom_viewer.py
py
6,951
python
en
code
1
github-code
1
34525437319
""" get_top_bottom_movies.py Usage: get_top_bottom_movies Return top and bottom 10 movies, by ratings. """ import sys import imdb i = imdb.IMDb() top250 = i.get_top250_movies() bottom100 = i.get_bottom100_movies() out_encoding = sys.stdout.encoding or sys.getdefaultencoding() for label, ml in [('top 10', top250[:10]...
oanadonose/ChatBot
get_top_bottom_movies.py
get_top_bottom_movies.py
py
637
python
en
code
0
github-code
1
71419817633
import numpy as np import math import h5py import openpyxl from scipy import signal as signal import matplotlib.pyplot as plt from sklearn.svm import SVC from sklearn.metrics import confusion_matrix from sklearn.metrics import precision_score, recall_score from sklearn.externals import joblib import joblib ...
axk19970225/-old-version-
13.svm预测炮,并分析.py
13.svm预测炮,并分析.py
py
11,295
python
en
code
0
github-code
1
33243552872
from celery.result import AsyncResult from django.shortcuts import render from django.views.decorators.http import require_GET, require_http_methods from dnaStrings.forms import dnaStringSubmission from dnaStrings.models import Tasks from dnaStrings.tasks import findProtein from django.contrib import messages @requi...
chanana/gnkg
dnaStrings/views.py
views.py
py
2,410
python
en
code
0
github-code
1
26465524725
''' 出现最多次的整数,输入多个逗号分隔的整数,输出出现最多次的整数的值以及对应的出现次数 1,1,3,4,5,7,11,3,3,3,4,6,8,9,2 ''' #输入 try: a=input('请输入整数,用“,”分割')#用中文,怎么办 intlist=[] if ',' not in a: print(f'出现最多的数字是{int(a)},出现次数为1次') exit() else: list = a.split(',') intlist = [int(i) for i in list] except ValueError: ...
lingboyouli/Ly_autotest
SecondClass/findinteger.py
findinteger.py
py
1,384
python
zh
code
0
github-code
1
74520864673
from django.shortcuts import render, redirect import random, datetime # Create your views here. def index(request): if 'activities' not in request.session: request.session['activities'] = [] if 'gold_count' not in request.session: request.session['gold_count'] = 0 return render(request, 'gold/index.html') def ...
CodingDojoOnline-Nov2016/wesHarper
python_stack/django/level1/ninja_gold/apps/gold/views.py
views.py
py
1,547
python
en
code
1
github-code
1
27730473116
import sys sys.path.append('../') from src.luscioustwitch import * from src.luscioustwitch.events import * import json import unittest class TestTwitchAPI(unittest.TestCase): @classmethod def setUpClass(self): with open('../secrets.json', 'r') as f: cred_json = json.load(f) f.close() self.api =...
charlie-coleman/luscioustwitch
test/twitch_api_test.py
twitch_api_test.py
py
1,689
python
en
code
0
github-code
1
41735858585
#algorithm responsible for interpreting the hints def sasta_ai(data:dict): c=[] for index,j in data.items(): val=j[1] if j[0]=="slate": test=False for k in data.values(): if k[1]==val and k[0]!="slate": test=True ...
AniketWithPython/Mathler-Solver
sasta_ai.py
sasta_ai.py
py
1,039
python
en
code
3
github-code
1
41592148020
from rest_framework.views import APIView from dj_rest_auth.views import AllowAny from django.http import FileResponse, HttpRequest, HttpResponse, JsonResponse from rest_framework.decorators import api_view from rest_framework.request import Request from tempfile import NamedTemporaryFile from docxtpl import DocxTemplat...
joshUAC7/rubrica
core/views.py
views.py
py
2,945
python
en
code
0
github-code
1
24047276596
#!/usr/bin/python3 from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from datetime import datetime import weasyprint import sh...
ebecz/NF-Errr
nfe.py
nfe.py
py
4,614
python
en
code
0
github-code
1
71112251874
from AIPUBuilder.Optimizer.utils import * from AIPUBuilder.Optimizer.framework import * from AIPUBuilder.Optimizer.ops.rnn import * from AIPUBuilder.Optimizer.ops.conv import clear_lower_bits_for_bias from AIPUBuilder.Optimizer.logger import * import torch.nn as nn split_weights_name = ['wx_gk', 'wh_gk', 'wx_ck', 'wh...
Arm-China/Compass_Optimizer
AIPUBuilder/Optimizer/ops/gruv3.py
gruv3.py
py
28,357
python
en
code
18
github-code
1
6930040041
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('main', views.main, name='main'), path('resources', views.resources, name='resources'), path('room', views.room, name='room'), path('select-custom', views.select_custom, name='select_custom')...
david0han/fitting-room
finalproject/fittingroom/urls.py
urls.py
py
464
python
en
code
1
github-code
1
30334769798
#!/usr/bin/env python3 import requests import sys from bs4 import BeautifulSoup class WrongNumberOfArgsError(Exception): pass class InfiniteLoopError(Exception): pass def to_snake_case(string): return string \ .replace(',', '_') \ .replace('.', '_') \ .replace(' ', ...
RickBadKan/42-mini-piscina
list03/ex03/roads_to_philosophy.py
roads_to_philosophy.py
py
2,141
python
en
code
2
github-code
1
16813683773
#!/usr/bin/env python from random import randint from typing import Union import tcod.color from pyrl.components import Equipment, Inventory, Level, Player, Stairs from pyrl.components.equippable import Equippable, Slot from pyrl.components.item import Item from pyrl.components.visual import RenderOrder from pyrl.com...
abesto/pyrl
pyrl/mapgen.py
mapgen.py
py
9,324
python
en
code
15
github-code
1
28325791633
# coding=utf-8 import os import requests from tqdm import tqdm from mindsearch.utils.logger import Logger logger = Logger(__name__).get_logger() def download_url(url, save_path): """ Download file from remote `url` to local directory, the file will be named `path` locally. """ if os.path.dirname(save...
mindspore-lab/mindsearch
mindsearch/utils/data_utils.py
data_utils.py
py
1,173
python
en
code
19
github-code
1
24423443513
import keras from keras.models import Sequential, Input, Model from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras.layers.normalization import BatchNormalization from keras.layers.advanced_activations import LeakyReLU width = 256 train_X = train_X.reshape(-1, widt...
Dos98/Detecting-Malware-using-Ensemble-Method-based-on-DNN
CNN-with-dropout.py
CNN-with-dropout.py
py
1,801
python
en
code
6
github-code
1
35706320325
import os import warnings from abc import ABCMeta from collections import namedtuple import re from .base import Operation, Bank, Account, Historic, Entity class AxaBank(Bank): def __init__(self): super().__init__("Axa", "AXABBE22") def __repr__(self): return "{}()".format(self.__class__.__...
jm-begon/bank_analysis
bank_analysis/axa.py
axa.py
py
6,722
python
en
code
0
github-code
1
72340295714
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import jsonfield.fields from django.conf import settings import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ...
zakvan2022/Betasmartz
notifications/migrations/0001_initial.py
0001_initial.py
py
2,234
python
en
code
1
github-code
1
3710535145
import cv2 import numpy as np from threading import Thread import time import argparse #from gui import onmouse, updateGUI from gui import gui, getPath from VideoStream import VideoStream#, VideoSave parser = argparse.ArgumentParser() parser.add_argument('--resolution', help='Desired webcam resolution in WxH. If the w...
WilliamLin43/VideoSaveGUI
VideoSaveGUI_v1/camerasave2.py
camerasave2.py
py
2,673
python
en
code
0
github-code
1
1601795546
from urllib import request, parse import ssl, re ssl._create_default_https_context = ssl._create_stdlib_context def get_img(num): url = 'http://langlang2017.com/img/banner%s.png' % num res = request.urlopen(url).read() print(res) # with open('banner%s.png' % num, 'wb') as f: # f.write(res) ...
Lousm/Python
04_爬虫/week1/day02/langlang.py
langlang.py
py
398
python
en
code
0
github-code
1