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
23407226022
import config import json from tqdm import tqdm from inspect_wikidump import init_inspect from urllib.parse import unquote from lxml import etree from collections import Counter from sqlitedict import SqliteDict def iterative_checking(check_func_dict, debug_num=None, verbose=False): total_doc_num = init_inspect.T...
easonnie/semanticRetrievalMRS
src/inspect_wikidump/inspect_abs_file.py
inspect_abs_file.py
py
3,998
python
en
code
59
github-code
13
14392500820
import copy import urllib import datetime import os import types from django.http import Http404 from django.conf import settings from django.utils import translation from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from haystack.utils import Highlighter def first...
sejarah-nusantara/site
apps/dasa/utils.py
utils.py
py
7,105
python
en
code
1
github-code
13
19902468067
import math import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import art3d import numpy as np def cos(theta): return np.cos(theta) def sin(theta): return np.sin(theta) def rotation(phi, theta, psi): R_x = np.array([[1, 0, 0], [0, cos(phi), -sin(phi)], [0, sin(phi), cos(phi)]]) R_y = np.a...
kimsooyoung/robotics_python
lec16_3D_rotations/rotation_of_a_box_321_euler.py
rotation_of_a_box_321_euler.py
py
3,202
python
en
code
18
github-code
13
213995105
# standard modules import traceback import decimal, datetime # 3rd party modules import pyodbc from fastapi import HTTPException, Request from fastapi.responses import ORJSONResponse # application modules from src.config import config def get_db_cursor(): conn = pyodbc.connect(config.db_connection_string) r...
nareshh74/voicegen_admin
src/utils.py
utils.py
py
1,675
python
en
code
0
github-code
13
34030442399
# Filename: q4_sum_digits.py # Author: Justin Leow # Created: 24/1/2013 # Modified: 24/1/2013 # Description: reads an integer between 0 and 1000 and adds all the digits in the integer. def newString(inputString): tempInput = input([inputString + "; or 'quit' to quit program"]) if(tempInput=="quit"): qu...
JLtheking/cpy5python
practical01/q4_sum_digits.py
q4_sum_digits.py
py
865
python
en
code
0
github-code
13
32276511103
# exercise 143: Anagrams # solution through function which has one parameter and is invoked on two strings (logic in main function) def histogram(s): s = s.upper() h = {} for c in s: if c not in h: h[c] = 1 else: h[c] += 1 return h def main(): word1 = inp...
sara-kassani/1000_Python_example
books/Python Workbook/dictionaries/ex143.py
ex143.py
py
749
python
en
code
1
github-code
13
45931553764
from discord import app_commands, Attachment, Message, Interaction from discord.ext import commands import os class Files(commands.Cog): def __init__(self, bot): self.bot = bot @app_commands.command(name="upload", description="Upload a file.") async def upload(self, inter: Interaction, file: Atta...
Mudpuppy12/grue
cogs/files.py
files.py
py
736
python
en
code
0
github-code
13
31041268483
# -*- coding: utf-8 -*- """ Created on Sun Sep 6 11:22:49 2020 @author: likeufo_ah """ import matplotlib.pyplot as plt import numpy as np from numpy import linalg as la import operator import sys def load_data(filename): with open(filename, "r") as f: data=f.readlines() new_dat...
ShangGao-forever/Shang_Gao
DATA7703/assignment2.py
assignment2.py
py
5,074
python
en
code
0
github-code
13
35924431056
from abc import ABC, abstractmethod from board import Board from playeragentinterface import PlayerAgentFactoryInterface class Game: def __init__(self, player_x, player_o): self.player_x = player_x self.player_o = player_o def play(self): mark = 'x' current_player = self.play...
cfeyer/tictactoe
server.py
server.py
py
1,786
python
en
code
0
github-code
13
73302333779
import math import matplotlib.pyplot as plt proba = [] X= [] Y = [] print("ok") # la formule renvoie le resulat multiplié par types^tirées def formuleInt(types, tirées): somme = 0 signe = 1 for k in range(types): # la fonction choose s'appelle "comb" dans python somme += signe * math.comb...
Aymco/mathenjeans
main2.py
main2.py
py
2,208
python
fr
code
1
github-code
13
32391659347
import numpy as np execfile("trustRegionMethod.py") execfile("doglegMethod.py") f = lambda x: (x[0]**2 + x[1] - 11)**2 + (x[0] + x[1]**2 - 7)**2 def gradf(x): dx0 = 4*(x[0]**3 + x[0]*(x[1] - 11)) + 2*(x[0] + x[1]**2 - 7) dx1 = 2*(x[0]**2 + x[1] - 11) + 4*(x[1]**3 + x[1]*(x[0] - 7)) return np.array([dx0, dx...
caleblogemann/MATH565ContinuousOptimization
Homework/midtermExam_2.py
midtermExam_2.py
py
1,962
python
en
code
0
github-code
13
3093715229
from ...constants import * def draw(chart, canvas): text_width = canvas.stringWidth(chart['title'], "Helvetica", 24) text_height = 24 * 1.2 left = CHART_WIDTH/2 - text_width/2 bottom = CHART_HEIGHT - TITLE_HEIGHT/2 + text_height/2 canvas.setFont("Helveti...
chiraag-kakar/ckstats
build/lib/ckstats/renderers/pdf/title.py
title.py
py
427
python
en
code
2
github-code
13
35658564815
#!/usr/bin/python3 import sys import requests if len(sys.argv) < 2: print(sys.argv[0] + ": <url>") sys.exit(1) headers = {'Referer': 'http://www.peter-lustig.com'} r = requests.get(sys.argv[1], data=headers) print(r.content)
balle/python-network-hacks
referer-spoofing.py
referer-spoofing.py
py
237
python
en
code
135
github-code
13
74468147857
''' This class serves as a third class to create a dataset for the neural network to train on. ''' import numpy as np import os from angle_utils import get_angles from openpose_data_for_single_image import get_single_image_data import cv2 #Creates the two files (train input / labels) that will be used def create_tra...
AnshKetchum/gesture-classifier
gesture-by-angle-classifier/input_creator.py
input_creator.py
py
1,321
python
en
code
0
github-code
13
71351745618
import asyncio import aiohttp import pickle import csv from bs4 import BeautifulSoup import re import argparse import sys import getpass import time def parse_arguments(): parser = argparse.ArgumentParser( description=( 'Descarga las paginas [START, FINISH) del foro de la facultad.\n' 'El tamanno def...
cc5212/2019-ustalker
intento-de-scrapper/scraper.py
scraper.py
py
7,788
python
es
code
3
github-code
13
15508700180
''' Created on Mar 17, 2014 @author: corwin ''' import sys #from PyQt4.QtCore import Qt, QSize #from PyQt4.QtGui import QApplication, QMainWindow, QWidget, QPainter, QImage, QColor import PIL.Image from collections import namedtuple import math class BoxGeometry(namedtuple('BoxGeometry', ['x', 'y', 'w', 'h'])): ...
corwin-of-amber/Web.Crossword
src/cropper/squares.py
squares.py
py
5,659
python
en
code
0
github-code
13
251361701
from dolfin import * import numpy as np import sympy as sm import matplotlib.pyplot as plt class MMS: """ Class for calculating source terms of the KNP-EMI system for given exact solutions """ def __init__(self): # define symbolic variables self.x, self.y, self.t = sm.symbols('x[0] ...
cdaversin/mixed-dimensional-examples
KNPEMI/KNPEMI_MMS.py
KNPEMI_MMS.py
py
11,362
python
en
code
3
github-code
13
71304613137
from pacotes.Contato import Contato from pacotes.ListaEncadeada import ListaEncadeada from pacotes.Fila import Fila from pacotes.Pilha import Pilha l1 = ListaEncadeada() l2 = Fila() l3 = Pilha() c1 = Contato() c1.nome = "Kelvin" l1.adicionar(c1) l2.adicionar(c1) l3.adicionar(c1) c2 = Contato() c2.nome = "Richardson"...
rich4rds0n/EstruturaDeDados
main.py
main.py
py
556
python
pt
code
0
github-code
13
3131238145
import pandas as pd import numpy as np import time import re import sys def clean(p1, p2): """ CARGA DE DATOS Si los datos los obtuviésemos de un recurso remoto, podríamos leerlos con wget con las siguientes órdenes: import wget url = 'https://path/to/file' filename = wget.download(url) ...
Ludvins/MCD_Practicas_GD
limpieza.py
limpieza.py
py
1,592
python
es
code
0
github-code
13
74443902736
#Implementing a stack class Stack: def __init__(self): self.stack = list() def push(self, data): #Checking if entry exists if data not in self.stack: self.stack.append(data) return True else: print("Duplicate Entry") ...
hashbanger/Python_Advance_and_DS
DataStructures/Traditional/Stack.py
Stack.py
py
930
python
en
code
0
github-code
13
30073013846
from plyer import notification import requests from bs4 import BeautifulSoup import time def notifyMe(title, message): notification.notify( title=title, message=message, app_icon="C:\\Users\\dhira\\Desktop\\notification\\corona.ico", timeout=10 ) def getData(url): r = req...
dexzter07/notification-on-covid-19
main.py
main.py
py
1,287
python
en
code
0
github-code
13
12918622920
import os from numericalFunctions import pointwiseXY_C if( 'CHECKOPTIONS' in os.environ ) : options = os.environ['CHECKOPTIONS'].split( ) if( '-e' in options ) : print( __file__ ) CPATH = '../../../../Test/UnitTesting/integrate' os.system( 'cd %s; make -s clean; ./integrationXY -v > v' % CPATH ) def skipBl...
LLNL/gidiplus
numericalFunctions/ptwXY/Python/Test/UnitTesting/integrate/integrationXY.py
integrationXY.py
py
3,023
python
en
code
10
github-code
13
5409590029
# -*- coding: utf-8 -*- import http.server import threading import webbrowser import os HOST = "0.0.0.0" PORT = 8000 def run_server(): # Only share app folder web_dir = os.path.join(os.path.dirname(__file__), 'app') #print(web_dir) os.chdir(web_dir) Handler = http.server.SimpleHTTPRequestHandle...
threemonkeybits/geometry-combat
Geometry_Combat.py
Geometry_Combat.py
py
815
python
en
code
0
github-code
13
6565243813
import os import re import time import tensorflow as tf from tensorflow.python.framework.ops import EagerTensor from src.decoder import CaptionDecoder from src.utils import prepare_image_for_model class ModelManager: """ Class that orchestrates the usage of a model. """ def __init__(self, encoder, ...
Michalweg/Image_captioning
src/model_manager.py
model_manager.py
py
10,854
python
en
code
0
github-code
13
7782261596
import os import unittest import tempfile import clustermgr from clustermgr.models import LDAPServer class ViewFunctionsTestCase(unittest.TestCase): @classmethod def setUpClass(self): clustermgr.app.config.from_object('clustermgr.config.TestingConfig') self.db_fd, clustermgr.app.config['DATAB...
GuillaumeSmaha/cluster-mgr
tests/test_views.py
test_views.py
py
1,174
python
en
code
0
github-code
13
27328732338
import socket import time import GameWorld as gw import tiles import Player_Class as pc from Screen import Screen from MenuHandler import MenuHandler import json import threading class Server(): def __init__(self, ip, port): self.ip = ip self.port = port self.clients = [] self.mainSocket = socket.socket(socke...
synctax/Ascii-Arenas
Game Code/Server.py
Server.py
py
1,237
python
en
code
0
github-code
13
28580254735
#!/bin/python3 import subprocess from queue import Queue import time from .pipelistener import PipeListener ''' Interface EngineInterface: une instance de EngineInterface encapsule une instance réelle du programme de go Engine avec des pipe Unix pour écrire à son stdin et lire de son stdout et son stderr. La class...
PhilippeCarphin/leela_interface
src/gtpwrapper.py
gtpwrapper.py
py
2,782
python
fr
code
2
github-code
13
71137865938
import pandas as pd cars=pd.read_csv('cars.csv') #Problem 2A odd=cars.iloc[0:5,0::2] print(odd) #Problem 2B MazdaRow=cars.loc[[0]] print(MazdaRow) #Problem 2C cyl=cars.loc[[23],['cyl']] print(cyl) #Problem 2D z=cars.loc[[1,28,18],['Model','cyl','gear']] print(z)
maricarr/Pandas
temp.py
temp.py
py
283
python
en
code
0
github-code
13
28105391909
#!/usr/bin/env python import sys from intcode import Intcode class Game: def __init__(self, data, input): self.intcode = Intcode(data, input) self.screen = {} self.rounds = 0 def find_obj(self, obj): for coord in self.screen.keys(): if self.screen[coord] == obj: ...
danschaffer/aoc
2019/day13.py
day13.py
py
3,626
python
en
code
0
github-code
13
10943821289
from transformers import ( CamembertModel, CamembertTokenizer, CamembertConfig, ) import torch from torch import nn from .config import CFG class TextEncoder(nn.Module): def __init__(self, model_name=CFG.text_encoder_model, pretrained=CFG.pretrained, trainable=CFG.trainable): super().__init__()...
vikimark/Thai-Cross-CLIP
source/model.py
model.py
py
2,773
python
en
code
3
github-code
13
16498501816
from django.shortcuts import render,redirect,HttpResponse from django.contrib.auth.models import User from django.contrib import messages from .models import * def index(request): title = "Select Location" country = Country.objects.all() d = {'country': country} if request.method == "POST"...
palakshivlani-11/django-dropdown-task
dropdown/views.py
views.py
py
2,194
python
en
code
0
github-code
13
3273557877
import numpy as np import cv2 import time cap = cv2.VideoCapture(0) def make_1080p(): cap.set(3, 1920) cap.set(4, 1080) def make_720p(): cap.set(3, 1280) cap.set(4, 720) def make_480p(): cap.set(3, 640) cap.set(4, 480) def change_res(width, height): cap.set(3, width) ...
CyberrGhostt/PyFacialRecognition
tut2/res-change.py
res-change.py
py
889
python
en
code
1
github-code
13
383545803
from __future__ import absolute_import, unicode_literals import subprocess import sys import six if six.PY2 and sys.platform == "win32": from . import _win_subprocess Popen = _win_subprocess.Popen else: Popen = subprocess.Popen def run_cmd(cmd): try: process = Popen( cmd, unive...
alexnathanson/solar-protocol
backend/createHTML/venv-bk/lib/python3.7/site-packages/virtualenv/util/subprocess/__init__.py
__init__.py
py
696
python
en
code
207
github-code
13
24245561939
from microbit import * """ while True: """""" """ ball_pos = [2, 0] bar_pos = [2, 3] # isGameOver = False speed = [0, 1] dt = 1000 #1000ミリ秒[ms] = 1秒 start = running_time() while not isGameOver: time = running_time() - start # ループが始まってからの時間 # ループ処理の最初に描画してもよい # set_pixel(x座標, y座...
irinaka-robodone/master-lesson08-2022
sample/exception.py
exception.py
py
1,857
python
ja
code
0
github-code
13
24653070122
class Animal: def __init__(self, domestic, eatsGrass,legs): self.domestic = domestic self.eatsGrass = eatsGrass self.legs = legs def displayAnimal(self): if self.eatsGrass: return self.domestic + " has " + str(self.legs) + " legs and eats the grass." else: ...
albinafrolova/pythonProgramming
animalclass.py
animalclass.py
py
912
python
en
code
0
github-code
13
9974864355
""" Sequential Search vs Binary Search: ----------------------------------- - Sequential Search: O(n) - Binary Search: O(log(n)) - Binary Search requires a sorted list - Binary Search is faster than Sequential Search Search Codes: ------------- - Sequential Search: - Search for a...
reepNao/PythonProgress
LiveCodingExamples/Sequential_Binary.py
Sequential_Binary.py
py
7,450
python
en
code
0
github-code
13
38644865522
import torch.nn as nn class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.layer1 = nn.Sequential( nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=2), nn.BatchNorm2d(16), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2)) ...
fengziyue/CU-Computing-Autonomy
Homework1/models.py
models.py
py
2,473
python
en
code
5
github-code
13
36603782394
import datetime def solution(n, customers): answer = 0 e_time = [datetime.datetime(2020,1,1,0,0,0) for _ in range(n)] # 업무 완료시간 key_c = [0 for _ in range(n)] # 키오스크 별 사용 횟수 match_key = 0 for custom_info in customers: a_date, a_time, s_time = map(str, custom_info.split()) mon, day =...
majung2/CTpractice
python/2020하반기/2020쿠팡테크캠퍼스리쿠르팅/02.py
02.py
py
1,063
python
ko
code
0
github-code
13
72299603218
closure_map = { 'UBERON:0001434PHENOTYPE': 'Skeletal system', 'UBERON:0002101PHENOTYPE': 'Limbs', 'UBERON:0001016PHENOTYPE': 'Nervous system', 'UBERON:0007811PHENOTYPE': 'Head or neck', 'MP:0005376': 'Metabolism/homeostasis', 'UBERON:0004535PHENOTYPE': 'Cardiovascular system', 'UBERON:00024...
monarch-initiative/biolink-api
biolink/api/bio/closure_bins.py
closure_bins.py
py
2,105
python
en
code
61
github-code
13
19343690694
from socket import * from threading import Thread import time from sys import getsizeof from os import _exit import os import sys port = 10080 bufferSize = 1400 headerSize = 48 SR_G_AV = [0, 0, 0] # opens file with file name and type, and returns 0 when file open is failed def getfile(filename, type): try: ...
sinclairr08/university-courses
2018-2-computer-networks/HW5/sender.py
sender.py
py
6,638
python
en
code
0
github-code
13
71157402898
def maxProfit(prices): n = len(prices) buy = 0 dp = [[-1]*2 for i in range(n+1)] (dp[n])[0] = (dp[n])[0] = 0 for ind in range(n-1, -1, -1): for buy in range(0, 2): if buy == 0: (dp[ind])[buy] = max((-prices[ind]+(dp[ind+1])[1]),(dp[ind+1])[0]) else: ...
Fragman228/Algoritmi2
Дз_26.10/Ефыл_4.py
Ефыл_4.py
py
459
python
en
code
0
github-code
13
38156423491
import json import pandas as pd from datetime import datetime import requests def json2dfConversion(jsonText, intervals): p = json.loads(jsonText) ohlc_json = p['chart']['result'][0]['indicators']['quote'][0] dates = p['chart']['result'][0]['timestamp'] ohlc_df = pd.DataFrame.from_dict(ohlc_json) ...
cmskzhan/helloworld
concepts/python/dockerfile/streamlit1/yahooData.py
yahooData.py
py
1,462
python
en
code
0
github-code
13
10660373295
from django import forms from crispy_forms.helper import * from crispy_forms.bootstrap import * from crispy_forms.layout import * from .models import Welder from .models import PerformanceQualification from .models import WelderHistory from core.models import WelderStampLov class WelderCreateForm(forms.ModelForm): ...
rsombach/btm419_demo
cessco/welderlist/forms.py
forms.py
py
4,038
python
en
code
0
github-code
13
11622968171
#!/usr/bin/env python3 import csv import os import math from tqdm import tqdm from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument("-d", "--directory", dest="directory", help="directory path to /Photos/", metavar="DIR") parser.add_argument("-c", "--convert-HEIC-to-JPG...
rgeirhos/linux-sort-iCloud-photos
sort_photos.py
sort_photos.py
py
3,908
python
en
code
5
github-code
13
41470231893
import cv2 # # define a video capture object # vid = cv2.VideoCapture(0) # while(True): # # Capture the video frame # # by frame # ret, frame = vid.read() # # Display the resulting frame # cv2.imshow('frame', frame) # cv2.waitKey(1)#waits for 1 ms cam = cv2.Vid...
kunal118/Edge-ai
cameraFeed.py
cameraFeed.py
py
631
python
en
code
0
github-code
13
23989363539
""" Script calculates Eurasian snow area index for October-November following the methods of Peings et al. 2017 in ERA-Interim (land) Notes ----- Author : Zachary Labe Date : 24 July 2019 """ ### Import modules import datetime import numpy as np import matplotlib.pyplot as plt import scipy.stats as sts imp...
zmlabe/AMIP_Simu
Scripts/calc_SNA_Data_Eurasia_Reanalysis.py
calc_SNA_Data_Eurasia_Reanalysis.py
py
3,368
python
en
code
1
github-code
13
11708171337
import tensorflow.keras.backend as K # from tensorflow.keras.backend import _to_tensor from tensorflow.keras.losses import binary_crossentropy, mean_squared_error, mean_absolute_error import tensorflow as tf def angle_rmse(pred, labels): # calculate mask pred = tf.cast(tf.argmax(pred, axis=-1), tf.float32) ...
Justdjent/agrivision_challenge
research_code/losses.py
losses.py
py
12,121
python
en
code
0
github-code
13
34030622629
def decToRoman(num): ans = "" while num >= 10: ans += "X" num = num - 10 if num == 9: ans += "IX" return ans while num >= 5: ans += "V" num = num - 5 if num == 4: ans += "IV" return ans while num > 0: ans += "I" num = num - 1 return ans def romanToDec(num): ans = 0 for i in...
JLtheking/cpy5python
promopractice/4.3.py
4.3.py
py
1,204
python
en
code
0
github-code
13
43358829783
import sys n = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) operater = list(map(int, sys.stdin.readline().split())) numberOfOperater = n - 1 maxSolution = -1000000001 minSolution = 1000000001 check = [0] * 4 solution = [0] * n solution[0] = A[0] def operate(a, b, x): if x == 0: r...
W00SUNGLEE/baekjoon
baekjoon/14888/14888_backtracking.py
14888_backtracking.py
py
943
python
en
code
0
github-code
13
8539924394
import base64 import logging import re from datetime import datetime, timedelta from html import escape from pathlib import Path from time import sleep from phpserialize import serialize, unserialize from slugify import slugify from _db import database from helper import helper from settings import CONFIG logging.ba...
KiritoU/french-stream_dootheme
dootheme.py
dootheme.py
py
29,976
python
en
code
0
github-code
13
29816188789
#!/usr/bin/env python3 """Coefficient for noise sensitivity evaluation.""" import argparse import math import os import sys import numpy as np from scipy.stats import linregress def load_file(path): with open(path) as f: return np.array([float(line.strip()) for line in f]) def main(): parser = ar...
jlibovicky/char-nmt
noisy_slope.py
noisy_slope.py
py
1,308
python
en
code
1
github-code
13
17849486958
from sys import argv def main(): if len(argv) < 2: print("Error: Too few arguments. Expected 1, found {}".format(len(argv))) exit(1) elif len(argv) > 2: print("Error: Too many arguments. Expected 1, found {}".format(len(argv))) exit(1) # Exactly one CLI input try: ...
Jmgiacone/CS5401
hw2c/src/parse_log_file.py
parse_log_file.py
py
1,851
python
en
code
0
github-code
13
72603332497
from pyspark import SparkConf, SparkContext, RDD from pyspark.mllib.recommendation import ALS, MatrixFactorizationModel, Rating import math conf = SparkConf().setAppName("Recommender").set("spark.executor.memory", "7g") conf = SparkConf().setAppName("Recommender").set("spark.storage.memoryFraction", "0.1") sc = SparkC...
jjones203/SalesPredictions
RecommenderRangeAvg.py
RecommenderRangeAvg.py
py
4,700
python
en
code
2
github-code
13
15125041514
class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ ind = 0 l = len(nums) while ind<l: if nums[ind]==val: ind1 = ind while ind1<l-1:nums[ind1],...
My-name-is-Jamshidbek/malumotlar_tuzilmasi_va_algoritmlash
leetcode_learn/learn_array/lissen_3/remove_element.py
remove_element.py
py
422
python
en
code
1
github-code
13
23213279900
import math import os import librosa import warnings import numpy as np import pandas as pd from datasets import Dataset from transformers.file_utils import filename_to_url def speech_file_to_array(x): global longest_audio with warnings.catch_warnings(): warnings.simplefilter('ignore') speech_...
timherzig/asr_dysarthria
script/import_ds/import_torgo.py
import_torgo.py
py
5,766
python
en
code
1
github-code
13
28187711205
from PyQt4 import QtGui,QtCore class FaderWidget(QtGui.QWidget): def __init__(self,newWidget): QtGui.QWidget.__init__(self, newWidget) self.newWidget = newWidget # self.new_pix = QtGui.QPixmap(self.newWidget.size()) self.new_pix = QtGui.QPixmap(1000,200) self.pix_opacity =...
brownharryb/webtydesk
custom_widgets/custom_notify.py
custom_notify.py
py
950
python
en
code
0
github-code
13
7760757820
import platform windows = platform.system() == 'Windows' try: from setuptools import setup except ImportError: has_setuptools = False from distutils.core import setup else: has_setuptools = True version_string = '0.5.0' setup_kwargs = { 'name': 'gittle', 'description': 'A high level pure pytho...
FriendCode/gittle
setup.py
setup.py
py
2,087
python
en
code
732
github-code
13
31466466022
# Follow up for problem "Populating Next Right Pointers in Each Node". # What if the given tree could be any binary tree? Would your previous solution still work? # Note: # You may only use constant extra space. # For example, # Given the following binary tree, # 1 # / \ # 2 3 # / \ ...
han8909227/leetcode
tree/sibliing_pointer_ii_lc117.py
sibliing_pointer_ii_lc117.py
py
2,563
python
en
code
3
github-code
13
39216727434
import cv2 import pyzbar.pyzbar as pyzbar import time cap = cv2.VideoCapture(0) fob = open('atendence.txt','w+') names = [] def enterDate(z): if z in names: pass else: names.append(z) z = ''.join(str(z)) fob.write(z+'\n') return names print('二维码读取中...') def checkData(data): ...
cerebrumWeaver/python-example
摄像头识别二维码2.py
摄像头识别二维码2.py
py
483
python
en
code
0
github-code
13
25196503734
from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn port = 8084 address = '0.0.0.0' class Hendler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-type','text/html') self.end_headers() conte...
pedrobolfe/Redes
server_threads/http_server_lib_threads.py
http_server_lib_threads.py
py
1,026
python
en
code
0
github-code
13
9783336458
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np from common import * import PIL from pix_select import PixSelect """ The cost function is defined as fi = Dt(C(x)pt_i) - tz(x)pr_i where: pt_i: The point i observed by ref camera C(x) = K*T(x): Camera projection matrix K: intrinsics matrix T(x):...
scomup/VisualLidar
photometric_error.py
photometric_error.py
py
8,025
python
en
code
0
github-code
13
28326017557
from odoo import api, fields, models class CreateAmendmentWizard(models.TransientModel): _name = "hr.contract.amendment.wizard" _description = "Create Contract Amendment" contract_id = fields.Many2one( comodel_name="hr.contract", string="Amendment of" ) type_id = fields.Many2one( ...
odoo-cae/odoo-addons-hr-incubator
hr_cae_contract/wizard/create_amendment_wizard.py
create_amendment_wizard.py
py
871
python
en
code
0
github-code
13
14646969435
from sqlalchemy import Boolean, Column, ForeignKey, Identity, Integer, Table from . import metadata TerminalReaderReaderResourceProcessConfigJson = Table( "terminal_reader_reader_resource_process_configjson", metadata, Column( "skip_tipping", Boolean, comment="Override showing a ti...
offscale/stripe-sql
stripe_openapi/terminal_reader_reader_resource_process_config.py
terminal_reader_reader_resource_process_config.py
py
712
python
en
code
1
github-code
13
3079573899
import numpy as np from numpy import ndarray from errors_namedtuple import SurveillanceErrors from surveillance_data import SurveillanceData from target import Target from trace_ import Trace class MultiFunctionalRadar: """Класс, описывающий работу МФР""" __slots__ = ("start_tick", "tick", ...
Igor9rov/TrackingAndIdentificationModel
Model/ModelMFR/multi_functional_radar.py
multi_functional_radar.py
py
9,286
python
ru
code
0
github-code
13
14430871065
''' Write a script that takes a sentence from the user and returns: - the number of lower case letters - the number of uppercase letters - the number of punctuations characters - the total number of characters Use a dictionary to store the count of each of the above. Note: ignore all spaces. Example input: I lov...
lauramayol/laura_python_core
week_03/labs/09_dictionaries/09_03_count_cases.py
09_03_count_cases.py
py
1,160
python
en
code
0
github-code
13
15021678370
#!/usr/bin/env python3 """thread.py: The threading manager file for the CarSoft project.""" __author__ = "Rhys Read" __copyright__ = "Copyright 2019, Rhys Read" import logging import threading class ThreadManager(object): instance = None def __init__(self): if ThreadManager.instance is not None: ...
RhysRead/CarSoft
src/thread.py
thread.py
py
1,052
python
en
code
0
github-code
13
72941958098
''' /* We are working on a security system for a badged-access room in our company's building. We want to find employees who badged into our secured room unusually often. We have an unordered list of names and entry times over a single day. Access times are given as numbers up to four digits in length using 24-hour...
isabellakqq/Alogorithm
twoPointers/slidingWindow/robinhood.py
robinhood.py
py
3,405
python
en
code
2
github-code
13
43114959572
from preprocessor import * import time def main(): s = time.time() #grab data from files actor_data,director_data,genre_data,tags_data,user_tag_data,train_data,test_data = get_dataframes() #generate movie and user objects movies,users = get_movies(actor_data,director_data,genre_data,tags_data,user_tag_data,train...
jtouma1/CS484_HW4
src/recommender.py
recommender.py
py
1,542
python
en
code
0
github-code
13
41890264439
""" Пользователь вводит две даты в формате ДД.ММ.ГГГГ ЧЧ:ММ. Пользователь вводит третью дату в формате ДД.ММ.ГГГГ ЧЧ:ММ. Определить, лежит ли дата внутри временного интервала, образованного первыми двумя датами. """ from task_3 import date_check def date_occurrence(checked_date, checked_date_2, checked_date_3): i...
Dkodsy/Practical-minimum
task_5.py
task_5.py
py
1,264
python
ru
code
0
github-code
13
31830369222
def vowel_count(phrase): """Return frequency map of vowels, case-insensitive. >>> vowel_count('rithm school') {'i': 1, 'o': 2} >>> vowel_count('HOW ARE YOU? i am great!') {'o': 2, 'a': 3, 'e': 2, 'u': 1, 'i': 1} """ vowels = {'a', 'e', 'i', 'o', 'u'} dict ...
jasonscotch/python-data-structure-practice
26_vowel_count/vowel_count.py
vowel_count.py
py
518
python
en
code
0
github-code
13
21872634930
""" This script is a module called by cwreport.py, it creates the csv file """ import yaml import numpy # Open the metrics configuration file metrics.yaml and retrive settings with open("metrics.yaml", 'r') as f: metrics = yaml.load(f, Loader=yaml.FullLoader) # Function to determine the statistic type the user is...
k-guo/collect-aws-vpc-cloudwatch-stats
csvconfig.py
csvconfig.py
py
5,387
python
en
code
0
github-code
13
69905804498
from setuptools import setup, find_packages with open('README.rst') as f: description = f.read() setup( name='eelale', url='http://github.com/emulbreh/eelale/', version='0.3.0-dev', packages=find_packages(), license='MIT License', author='', maintainer='Johannes Dollinger', mainta...
emulbreh/eelale
setup.py
setup.py
py
878
python
en
code
0
github-code
13
72161269779
from sqlalchemy.engine import Engine from sqlmodel import Session, SQLModel, create_engine, select from .models import Category, Entry class Service: engine: Engine def __init__(self, connection_string: str = "sqlite://") -> None: self.engine = create_engine(connection_string) def init(self): ...
humrochagf/midas
backend/midas/service.py
service.py
py
1,274
python
en
code
0
github-code
13
12345254692
import streamlit as st def app(): st.title('Profitability Index') colPVNetAnnualCashFlow, colInitialInvestment = st.columns(2) with colPVNetAnnualCashFlow: PVNetAnnualCashFlow = st.number_input("Enter the present value of net annual cash flows($): ", min_value=0.0, format='%f') ...
andrewdwallo/AccountingCalculator
AccountingCalculator/apps/profitability_index.py
profitability_index.py
py
742
python
en
code
0
github-code
13
42994498679
# # custom_board.py # # - For build.address replace VECT_TAB_ADDR to relocate the firmware # - For build.ldscript use one of the linker scripts in buildroot/share/PlatformIO/ldscripts # import pioutil if pioutil.is_pio_build(): import marlin board = marlin.env.BoardConfig() address = board.get("build.addre...
MarlinFirmware/Marlin
buildroot/share/PlatformIO/scripts/custom_board.py
custom_board.py
py
494
python
en
code
15,422
github-code
13
14218463195
import re from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F #from module.attention import ChannelAttention, SpatialAttention class DenseLayer(nn.Sequential): """Dense Layer""" def __init__(self, num_input_features, growth_rate, bn_size, drop_rate): ...
ljarabek/CSN_chexpert
network_base/densenet.py
densenet.py
py
9,930
python
en
code
1
github-code
13
21268487718
import sys,json with open("/home/fux/fux/miRNASNP3/map_utr3_snp/map_utr_02/freq/truncate_altutr_03.key.json","a") as out: temp_json={} with open("/home/fux/fux/miRNASNP3/map_utr3_snp/map_utr_02/freq/truncate_altutr_03.key") as infile: for line in infile: nline=line.strip().split('#') ...
chunjie-sam-liu/miRNASNP-v3
scr/predict_result/altutr/B-00-truncate-key2json.py
B-00-truncate-key2json.py
py
460
python
en
code
3
github-code
13
33936141677
from pathlib import Path from typing import Union def load_graph(file: Union[Path, str], fmt="auto", ignore_vp=None, ignore_ep=None, ignore_gp=None, directed=True, **kwargs): import warnings from graph_tool import load_graph_from_csv with warnings.catch_warnings(): warnings.filterw...
NetworkDismantling/review
network_dismantling/common/loaders.py
loaders.py
py
1,837
python
en
code
6
github-code
13
17055108634
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class KoubeiSalesLeadsShopleadsCreateModel(object): def __init__(self): self._address = None self._branch_name = None self._brand_id = None self._category_id = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/KoubeiSalesLeadsShopleadsCreateModel.py
KoubeiSalesLeadsShopleadsCreateModel.py
py
9,382
python
en
code
241
github-code
13
39740101817
import re import os import sys import locale import datetime import xlsxwriter from django.utils.translation import gettext_lazy as _ from . import utils from . import scramble from . import minimal_intervals from .models import * from .add_excel_info import add_excel_info data_headers = ( 'Bib#', 'LastName', 'Firs...
esitarski/RaceDB
core/get_crossmgr_excel.py
get_crossmgr_excel.py
py
12,298
python
en
code
12
github-code
13
8954184310
# Import dependencies. import numpy as np import datetime as dt import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify ############################################################ # Set up database...
EdSpiezio-Runyon/UTSA_10_SQLalchemy-Challenge
app.py
app.py
py
5,866
python
en
code
0
github-code
13
32765580189
# Config functions for toggling ui status values in config.json # TODO: Consider refactoring toggle functions into individual on/off functions import json def toggle_weather_ui(): """Change boolean value for 'weather_ui_on' in config.json""" # Open config file, load as dictionary with open("config.json"...
FellowshipOfThePing/Jarvis
config.py
config.py
py
2,745
python
en
code
2
github-code
13
72263972818
from Crypto.PublicKey import DSA from Crypto.Signature import DSS from Crypto.Hash import SHA256 # Typing from Crypto.Hash.SHA256 import SHA256Hash from Crypto.PublicKey.DSA import DsaKey from Crypto.Signature.DSS import FipsDsaSigScheme from typing import List def verify(hashed_message_1: SHA256Hash, hashed_message...
CrisDgrnu/DSA-sign-verifier
DSA.py
DSA.py
py
2,821
python
en
code
0
github-code
13
41833344235
import torch from torch import nn, optim from torch.utils.data import DataLoader, Dataset from torch.utils.data.dataset import random_split import torch.nn.functional as F import torchsummary from basicblock import BasicBlock import os import cv2 import numpy as np import time from datetime import timedelta class Img...
Emcyz/alpha_dl
img2heatmap_train.py
img2heatmap_train.py
py
8,097
python
en
code
0
github-code
13
39722670617
inp = open('input.txt', 'r') out = open('output.txt', 'w') n, k = map(int, inp.readline().split(' ')[0:2]) l = inp.readline().strip() h = set() answer = "NO" for i in range(n-k+1): s = l[i:i+k] if s in h: answer = "YES" break else: h.add(s) print(answer) out.write(answer)
esix/competitive-programming
acmp/page-01/0034/main.py
main.py
py
313
python
en
code
15
github-code
13
11351385961
''' 要求:将一个有序的数组存入到二叉树中,(该二叉树也是有序) 思路: 1. 找出数组的中间元素,设为根节点。 2. 再将左右部分填入二叉树的左右子树中 ''' class BTree: def __init__(self): self.data = None self.lchild = None self.rchild = None def arrToTree(arr, startIndex, endIndex): # 二叉树 = 根节点的data + 左子树结点 + 右子树结点 # 找到中间元素设为根节点之后,再递归调用本函数将剩余部分填入左右子树 if...
DaToo-J/NotesForBookAboutPython
ch3 二叉树/2-arrToTree.py
2-arrToTree.py
py
1,355
python
zh
code
0
github-code
13
20751192648
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def __str__(self): return str(self.val) class Solution: def invertTree(self, root: TreeNode) -> TreeNode: if root ...
nezlobnaya/leetcode_solutions
invert_binary_tree.py
invert_binary_tree.py
py
1,190
python
en
code
0
github-code
13
39789266842
import logging import os from collections.abc import Iterable import numpy as np from unicore.data import ( Dictionary, NestedDictionaryDataset, AppendTokenDataset, PrependTokenDataset, RightPadDataset, TokenizeDataset, RightPadDataset2D, RawArrayDataset, FromNumpyDataset, Epoch...
dptech-corp/Uni-Mol
unimol/unimol/tasks/docking_pose.py
docking_pose.py
py
11,158
python
en
code
453
github-code
13
493736085
import tornado.web from tornado.httpclient import HTTPRequest from emoji_proxy.interfaces import Interfaces class ProxyHandler(tornado.web.RequestHandler): def initialize(self, ifaces: Interfaces) -> None: self.http_client = ifaces.http_client self.content_filter = ifaces.content_filter asyn...
i-zhivetiev/emoji-proxy
emoji_proxy/proxy_handler.py
proxy_handler.py
py
573
python
en
code
0
github-code
13
39722447347
from math import * inp = open('input.txt', 'r') out = open('output.txt', 'w') a, b = inp.readline().split(' ')[0:2] x, y = 0, 0 for i in range(4): if a[i] == b[i]: x += 1 else: if a[i] in b: y += 1 print(x,y) out.write(str(x) + " " + str(y))
esix/competitive-programming
acmp/page-01/0013/main.py
main.py
py
273
python
en
code
15
github-code
13
40034551993
""" 服务器讯息打印 """ from datetime import datetime, timezone, timedelta from pyrogram import filters from bot import bot, emby_line, tz_id from bot.func_helper.emby import emby from bot.func_helper.filters import user_in_group_on_filter from bot.sql_helper.sql_emby import sql_get_emby from bot.func_helper.fix_bottons impo...
mdnoyanred/Sakura_embyboss
bot/modules/panel/server_panel.py
server_panel.py
py
1,810
python
en
code
null
github-code
13
41488981191
from django.conf.urls import patterns, include, url from django.contrib import admin from app01 import views urlpatterns = patterns('', # Examples: # url(r'^$', 'django_08bbs.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^login/...
zhangjinsi/django_08bbs
django_08bbs/urls.py
urls.py
py
667
python
en
code
0
github-code
13
13628468079
from shop.models import Cart, CartItem def cartProcessor(request): if request.user.is_authenticated: cart, created = Cart.objects.get_or_create(user=request.user) cartItems = CartItem.objects.filter(cart=cart) qty = 0 total = 0.0 for items in cartItems: qty += i...
dev-agarwal-keshav/shoppingly
shopify/context_processors.py
context_processors.py
py
472
python
en
code
0
github-code
13
74662663696
import pygame.font class Button(): def __init__(self,screen,msg): #initialize button attributes self.screen=screen self.screen_rect=screen.get_rect() #set dimensions/properties of the button self.width,self.height=200,50 self.button_color=(0,255,0) ...
Muchiri-cmd/learningpython
Alien Invasion/Alien Invasion/button.py
button.py
py
1,277
python
en
code
1
github-code
13
15009931138
import os import pickle import paddle import paddlenlp from paddle.io import Dataset, DataLoader import paddle.nn as nn from conf import MODELNAME class BanfoDataset(Dataset): def __init__(self, data, tokenizer): super().__init__() self.data = data self.tokenizer = tokenizer def __g...
WithHades/banfoStyle
train.py
train.py
py
3,471
python
en
code
164
github-code
13
73210238418
import unittest from caninehotel_backend.database import connect_to_mongodb from caninehotel_backend.modules import room connect_to_mongodb() class TestRoomOperations(unittest.TestCase): def test_add(self): data = dict( number = 1, type_room = 'CLASICA', cost = 17.2 ) self.assertTrue(bool(room.ope...
HeinerAlejandro/caninehotel
caninehotel_backend/caninehotel_backend/tests/odm/room_operations_test.py
room_operations_test.py
py
380
python
en
code
0
github-code
13
21253942996
class Solution: def isMatch(self, s: str, p: str) -> bool: n = len(s) m = len(p) cache = {} def dfs(i, j): if i >= n and j >= m: return True if j >= m: return False if (i, j) in cache: return ca...
sundar91/dsa
DP/regex-1.py
regex-1.py
py
728
python
en
code
0
github-code
13
24501859839
import time import numpy as np import tensorflow as tf def get_train_data(n): x = np.random.random((n, 3)) w = np.array([[0.1], [0.2], [0.3]]) y = np.dot(x, w) return x, y def get_w(shape, lumbda): ''' lumbda 其实就是lambda ''' w = tf.Variable(tf.random_normal(shape, seed=1), dtype=tf.fl...
yunsonbai/tensorflow_example
l2Collection.py
l2Collection.py
py
1,567
python
en
code
1
github-code
13
5145461626
""" Checks if all source and test files were analyzed by infer. Run this script in the same directory with ./infer-out and all src/test dirs. """ import re import os import sys from os.path import join def add_arr_and_dict_to_list(files_list, array, dictionary): """ Populates an empty list with an array a...
ucd-plse/Static-Bug-Detectors-ASE-Artifact
scripts/util/infer-coverage.py
infer-coverage.py
py
11,799
python
en
code
5
github-code
13
43341769717
''' -find how many digits are in a given number -find a digit --raise number to the power -Find some of the powered digits -Compare final number to input number ''' def is_armstrong(number): print(number) strnumber = str(number) numberofdigits = len(strnumber) sum = 0 for strdigit in strnumber: digit = int(str...
JBoas/python
armstrong.py
armstrong.py
py
641
python
en
code
0
github-code
13