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
20422548222
import argparse import collections import getpass import hashlib import json import os import pickle import requests import time import uuid import urllib.parse from datetime import datetime, timedelta from email_validator import validate_email, EmailNotValidError from pandas import DataFrame, to_datetime from pytz im...
tedchou12/webull
webull/webull.py
webull.py
py
63,799
python
en
code
576
github-code
36
37775727462
# https://leetcode-cn.com/problems/reverse-string/ # 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 char[] 的形式给出。 # # 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 # # 你可以假设数组中的所有字符都是 ASCII 码表中的可打印字符。 # # 示例 1: # # 输入:["h","e","l","l","o"] # 输出:["o","l","l","e","h"] # 示例 2: # # 输入:["H","a","n","n","a","h"] # 输出:["h","a","n","n",...
cookie-rabbit/LeetCode_practice
专题/入门/字符串/344 反转字符串/1.py
1.py
py
1,403
python
en
code
1
github-code
36
19214969558
from twitter_sentiment import avg_sentiment, get_tweets from time import sleep import pickle import re import numpy as np # open the mappings mappingFile = open('mappings', 'rb') mappings:dict = pickle.load(mappingFile) mappingFile.close() def find_avg_sentiment(row): """ Find average sentiment of an item i...
ArjunAtlast/main-project
FINAL/helpers.py
helpers.py
py
1,411
python
en
code
0
github-code
36
4500680225
import abc import os import xml.etree.ElementTree as ET from abc import ABC from enum import Enum from typing import List from xbrl import XbrlParseException, LinkbaseNotFoundException from xbrl.cache import HttpCache from xbrl.helper.uri_helper import resolve_uri LINK_NS: str = "{http://www.xbrl.org/2003/linkbase}" ...
manusimidt/py-xbrl
xbrl/linkbase.py
linkbase.py
py
27,220
python
en
code
78
github-code
36
174132737
from datetime import datetime, timezone, timedelta from django.db.models import Q, Sum from django.core.management.base import BaseCommand from django.contrib.auth.models import User from django.conf import settings from django.template.loader import render_to_string from elasticsearch.helpers import bulk from api.inde...
batpad/go-api
api/management/commands/index_and_notify.py
index_and_notify.py
py
31,984
python
en
code
0
github-code
36
37738312088
# -*- coding: utf-8 -*- from collections import defaultdict import struct from sqlalchemy.sql.expression import text from ambry.orm.dataset import Dataset from ambry.library.search_backends.base import BaseDatasetIndex, BasePartitionIndex,\ BaseIdentifierIndex, BaseSearchBackend, IdentifierSearchResult,\ Da...
CivicSpleen/ambry
ambry/library/search_backends/sqlite_backend.py
sqlite_backend.py
py
20,150
python
en
code
5
github-code
36
42822681247
from math import dist, inf from typing import Optional from random import random, choice from aasd.vehicle import Vehicle, VehicleType class Environment: def __init__(self, width: int = 1280, height: int = 720, object_size: int = 10, chance_to_crash: float = 0.001): self.width = width self.height...
Pruxon/AASD
aasd/environment.py
environment.py
py
2,733
python
en
code
0
github-code
36
36173205593
import random import json import znc class slapanswer(znc.Module): description = 'Answer slaps' module_types = [znc.CModInfo.NetworkModule] def OnLoad(self, args, message): self.default_answers = [ '"Be kind whenever possible. It is always possible." - Dalai Lama', '"Where...
Thor77/SlapAnswer
slapanswer.py
slapanswer.py
py
3,958
python
en
code
4
github-code
36
32480112663
import sklearn import os import numpy as np import matplotlib.pyplot as plt import timeit current_dir = os.getcwd() from tensorflow.keras.datasets import mnist (X_train, Y_train), (X_test, Y_test) = mnist.load_data(path=current_dir + '/mnist.npz') # FLATTING TRAIN DATA X_train = X_train.reshape(60000, 78...
solmvz/MNIST-LogisticRegression
HW2_softmax.py
HW2_softmax.py
py
2,198
python
en
code
4
github-code
36
73694485864
import requests from bs4 import BeautifulSoup from bs4.element import ResultSet import json from telprefix.path import JSON_DATA_PATH def getHTMLText(result: ResultSet | None) -> str: if result is not None: result = result.text.strip() return result # URL Artikel # Sumber: https://www.pinhome.id URL ...
manoedinata/telprefix
telprefix/scrap.py
scrap.py
py
2,569
python
en
code
0
github-code
36
32673542433
import os import urllib.request WEIGHTS_URL = 'https://d17h27t6h515a5.cloudfront.net/topher/2016/October/580d880c_bvlc-alexnet/bvlc-alexnet.npy' TRAINING_URL = 'https://d17h27t6h515a5.cloudfront.net/topher/2016/October/580a829f_train/train.p' def download(url, filename): print('Downloading {}...'.format(filename)...
marcomarasca/SDCND-Feature-Extraction
get_data.py
get_data.py
py
777
python
en
code
0
github-code
36
6240147202
# # SAKARYA ÜNİVERSİTESİ BİLGİSAYAR VE BİLİŞİM BİLİMLERİ FAKÜLTESİ # BİLGİSAYAR MÜHENDİSLİĞİ BÖLÜMÜ # BİLGİSAYAR MÜHENDİSLİĞİ TASARIMI - 2. ÖĞRETİM P GRUBU # EDA NUR KARAMUK - G181210061 & ELİF RUMEYSA AYDIN - G181210031 # # from PyQt5 import QtCore, QtGui, Q...
EdaNurKaramuk/PlakaTanimaSistemi
CarPlateRecognitionSystem.py
CarPlateRecognitionSystem.py
py
9,785
python
en
code
7
github-code
36
10070249997
from django.shortcuts import render from.models import friends # Create your views here. def showindex(request): id=request.GET.get("update_id") if id==None: res=friends.objects.all() return render(request,"index.html",{"res":res}) else: id1=friends.objects.filter(entry=id).update()...
prasadnaidu1/django
sisco1/app1/views.py
views.py
py
993
python
en
code
0
github-code
36
6097122691
class Solution: def longestOnes(self, nums: List[int], k: int) -> int: start,end,maxOnes,noZeros=0,0,0,0 for end in range(len(nums)): if nums[end]==0: noZeros+=1 while noZeros >k: if nums[start]==0: noZeros-=1 ...
abeni505/Comp-programming
Max-Consecutive-Ones-III.py
Max-Consecutive-Ones-III.py
py
412
python
en
code
2
github-code
36
12829799852
import pygame as pg WIDTH = 700 HEIGHT = 500 WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255,0) BLUE = (0, 0, 255) up_key = False down_key = False left_key = False right_key = False CAR_WIDTH = 30 CAR_HEIGHT = 30 car_x = WIDTH / 2 car_y = HEIGHT / 2 car_x_vel = 0 car_y_vel = 0 max_vel...
oscarsangwin/pygame-platformer
car01.py
car01.py
py
2,614
python
en
code
0
github-code
36
34360597607
import audio_edit_utils import vid_utils # "C:\Program Files\VideoLAN\VLC\vlc.exe" --start-time=35 "C:\Users\Brandon\AppData\Roaming\I2P\i2psnark\Rick.and.Morty.S04E03.720p.WEBRip.x264-TBS[rarbg]\rick.and.morty.s04e03.720p.webrip.x264-tbs.mkv" # "C:\Program Files\VideoLAN\VLC\vlc.exe" --start-time=150 "C:\\Users\\Bra...
Brandon-Valley/my_movie_tools
find_first_speach.py
find_first_speach.py
py
4,625
python
en
code
0
github-code
36
3496632276
# importing pycairo import cairo # creating a SVG surface # here geek95 is file name & 700, 700 is dimension with cairo.SVGSurface("geek95.svg", 700, 700) as surface: # creating a cairo context object for SVG surface # using Context method context = cairo.Context(surface) # move the context to x,y position ...
Malgetany/ch2-part2
main.py
main.py
py
3,947
python
en
code
0
github-code
36
42629364234
#!/usr/bin/env python # coding=utf-8 import torch import torchvision.models as models #resnet169 = models.densenet169(pretrained=True).cuda() inception_v3 = models.inception_v3(pretrained=True).cuda() dummy_input = torch.randn(1, 3, 224, 224, device='cuda') input_names = ['data'] output_names = ['outputs'] torch.onnx...
YixinSong-e/onnx-tvm
torchmodel/torch_model.py
torch_model.py
py
528
python
en
code
0
github-code
36
32402600311
import json from falcon.status_codes import HTTP_404, HTTP_400 from marshmallow import ValidationError from utils.HTTPError import HTTPError class Serializer: """ This middleware gives us a possibility to validate data from request body. It also allows to set a separate schema (validator) for every HTTP ...
NomanGul/kanda-fullstack-test
server/middlewares/serializer.py
serializer.py
py
1,084
python
en
code
3
github-code
36
32065556859
import fileIO import view def menu(data): while True: answer = view.show_menu() if answer == 1: view.show_data(data) elif answer == 2: # fileIO.add_data(data) str_data = input('Enter your data delimited by tab> ') row = str_data.split('\t') ...
DanisYuma/Introduction-to-Python
Introdution/Homeworks/HW8/UI.py
UI.py
py
718
python
en
code
0
github-code
36
506670450
""" Merge, combine and mosaic """ def rsts_to_mosaic(inRasterS, o, api="grass", fformat='.tif', method=None): """ Create Mosaic of Raster """ if api == 'pygrass': """ The GRASS program r.patch allows the user to build a new raster map the size and resolution of the current regi...
jasp382/glass
glass/rst/mos.py
mos.py
py
6,840
python
en
code
2
github-code
36
11424826236
import logging from edera.exceptions import ExcusableError from edera.exceptions import ExcusableWorkflowExecutionError from edera.exceptions import WorkflowExecutionError from edera.queue import Queue from edera.routine import deferrable from edera.routine import routine from edera.workflow.executor import WorkflowEx...
thoughteer/edera
edera/workflow/executors/basic.py
basic.py
py
2,027
python
en
code
3
github-code
36
17523274197
#!/usr/bin/env python """ author: Jun Ding date: 2020-07-06 function: plot the expression of input gene copy and modification of this code is allowed for academic purposes. Please don NOT remove this author statement under any condition. """ import sys,os,pdb,argparse import anndata import scanpy as sc def plo...
phoenixding/scdiff2
utils/plotGene.py
plotGene.py
py
1,080
python
en
code
5
github-code
36
37724851331
# -*- coding: utf-8 -*- import numpy as np import math import matplotlib.pyplot as plt def option_pricing(s0, k, t, sigma, r, cp, american=False, n = 100): #cijena call opcije u T CT = max(ST-K, 0) #cijena put opcije u T PT = max(K-ST, 0) #s0 - pocetna cijena #k - strajk cijena #t - datum dos...
aldinabu/ou
option_pricing_dp.py
option_pricing_dp.py
py
2,225
python
en
code
0
github-code
36
37569450031
f = open('minfil.txt') def write_to_file(data): f = open('minfil.txt','w') #w spesifiserer at filen skal skrives til f.write(data) f.close() def read_from_file(filename): f = open(filename,'r') innhold = f.read() print(innhold) f.close() def main(): todo ='' while to...
jorul/ITGK
ITGK øvinger/Øving 9 uke 45/4 Generelt om filbehandling/a filbehandling.py
a filbehandling.py
py
668
python
en
code
0
github-code
36
70172359785
def list_sort(num_list): if len(num_list) <= 1: return num_list element = num_list[0] left = list(filter(lambda x : x < element, num_list)) center = [i for i in num_list if i == element] right = list(filter(lambda x : x > element, num_list)) return list_sort(left) + center + list_sort(right) def index_...
IgorRush/practice_17.9
sorting.py
sorting.py
py
1,891
python
ru
code
0
github-code
36
15972612873
#!/usr/bin/env python3 __doc__ = """Process a dump from the 'Charge Activity Report by Employee - Project Detail Information' report from Webwise. We only need the table view because we simply want to extract the fields. For this to work, we _must_ have the table headers. Those are used as the keys in the YAML forma...
kprussing/resume
projects-import.py
projects-import.py
py
6,217
python
en
code
0
github-code
36
74816953384
from django.urls import include, path from rest_framework import routers from . import views # def router robi za nas widoki generowane przez nasz viewset; tworzy do nich ścieżki router = routers.DefaultRouter() router.register('categories', views.CategoryViewSet) router.register('rooms', views.RoomViewSet) router.reg...
BParaszczak/plant_manager
plants/urls.py
urls.py
py
413
python
en
code
0
github-code
36
17602594229
from functools import wraps import json import os import requests import boto3 from sanic import Sanic, response from sanic.exceptions import NotFound from sanic.log import LOGGING_CONFIG_DEFAULTS from sanic_cors import CORS from sanic_limiter import Limiter, get_remote_address, RateLimitExceeded from botocore.excepti...
MichaelHDesigns/erebor
erebor/erebor.py
erebor.py
py
4,559
python
en
code
0
github-code
36
71117028264
import pprint import numpy as np import matplotlib.pyplot as plt import math #重量 m = 5 #ばね定数 k = 10 #ダンピング係数 c = 1 #速度 vn_list = [] #位置 xn_list = [] #制御入力 un = 0 #時間 t = 10 #刻み幅 h = 0.001 #要素数 n = int((t/h) + 1) #システムノイズのばらつき(分散) stdv_x = 15 Sigma_x = stdv_x **2 T_s = np.linspace(0,t,n)...
itolab2022/Altitude_Control
Kalman_spring/spring.py
spring.py
py
881
python
ja
code
0
github-code
36
37217205291
#!/usr/bin/env python # coding: utf-8 # In[2]: #1. Write a Python Program to Find the Factorial of a Number? def fact(n): if n == 1 or n == 0: return 1 else: return n * fact(n-1) fact(5) # In[7]: #2. Write a Python Program to Display the multiplication Table? number = int(input (...
16anshul/basic-programmin-in-python
basic 4.py
basic 4.py
py
2,344
python
en
code
0
github-code
36
35015230469
import importlib from sklearn.cluster import SpectralClustering import clusters_optimizer_base as co importlib.reload(co) class SpectralClusterOptimizer(co.ClustersOptimizerBase): # 100 initializations def optimize(self, data): obj = SpectralClustering( n_clusters=self.num_cl...
morganstanley/MSML
papers/Clustering_via_Dual_Divergence_Maximization/spectral_clusters_optimizer.py
spectral_clusters_optimizer.py
py
494
python
en
code
12
github-code
36
10501857645
import os from aiohttp import Fingerprint import cv2 from matplotlib import pyplot as plt from Matcher import * from random import * # Authentication class will serve as an authenticator for one person class Authentication: def __init__(self, probe_img, data_path, folder, threshold=0.6): self.probe_img = ...
Dorukozar/Fingerprint-Matcher-and-Evaluation
Authentication.py
Authentication.py
py
3,865
python
en
code
0
github-code
36
24730881807
from sklearn import tree import numpy as np X = np.array([[-1,-1],[-2,-1],[1,1],[2,1]]) y = np.array([1,1,2,2]) # # X = [[0, 0], [1, 1]] # Y = [0, 1] clf = tree.DecisionTreeClassifier() # clf = clf.fit(X, y) clf = clf.fit(X, y) print(clf) print(clf.predict([[-0.8,-1]])) print(clf.predict([[5,6]]))
11city/tianchi
algorithm/DecisionTree/DecisionTreeTest.py
DecisionTreeTest.py
py
304
python
en
code
0
github-code
36
12366342382
""" Created on 28 Feb 2013 @author: jmht """ import os import sys from ample.util import ample_util def mrbump_cmd(name, mtz, mr_sequence, keyword_file): """Return the command to run mrbump""" if sys.platform.startswith("win"): mrbump = os.path.join(os.environ["CCP4"], "bin", "mrbump" + ample_util.S...
rigdenlab/ample
ample/util/mrbump_cmd.py
mrbump_cmd.py
py
4,898
python
en
code
6
github-code
36
35132638275
import numpy as np import gin.tf @gin.configurable(whitelist=["use_entities_order"]) class ExistingEdgesFilter(object): def __init__(self, entities_count, graph_edges, use_entities_order=True): self.entities_count = entities_count self.set_of_graph_edges = set(graph_edges) self.use_entiti...
Dawidsoni/relation-embeddings
src/optimization/existing_edges_filter.py
existing_edges_filter.py
py
1,625
python
en
code
0
github-code
36
32282456781
import socket #创建一个socket对象 skfd=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #绑定IP和端口号 skfd.bind(('127.0.0.1',7777)) #将套接字变为监听套接字 skfd.listen(10) L=[] i=0 while True: print('waiting for connect...') #等待客户端请求 sk1,adr1=skfd.accept() print('i get address:',adr1) while True: #接收客户端的消息 ...
joiller/exercises
web1.py
web1.py
py
850
python
zh
code
0
github-code
36
6562172415
from django.shortcuts import render,redirect from .models import * from django.contrib.auth import login, authenticate, logout from django.contrib import messages from django.db.models import Q # Create your views here. def login_page(request): return render(request, "index.html") def init_login(request): us...
Ennyola/Search-System
searchSystem/searchApp/views.py
views.py
py
2,161
python
en
code
0
github-code
36
23682916986
import re import pandas as pd from bs4 import BeautifulSoup df = pd.DataFrame.from_csv("realtor.csv", sep="|", encoding="ISO-8859-1") print(df.head) print ("done") dftemp = df for i, (idx, ser) in enumerate(dftemp.iterrows()): html = ser["metaHTML"] bs = BeautifulSoup(html) for li in bs.fi...
jhmuller/real_estate
realtor2.py
realtor2.py
py
1,198
python
en
code
0
github-code
36
74611006504
# coding: utf-8 from __future__ import print_function import json from math import log10 import numpy as np def fit(x, y): x_mean = np.mean(x) y_mean = np.mean(y) cov = np.sum((x - x_mean) * (y - y_mean)) var = np.sum((x - x_mean)**2) a = cov / var b = y_mean - a * x_mean return lambda x1...
andreas-schmidt/tapetool
json2ds.py
json2ds.py
py
1,133
python
en
code
0
github-code
36
43160456317
import numpy as np import matplotlib.pyplot as plt def sigmoid(x): return 1 / (1 + np.exp(-x)) # 01. 기본 sigmoid x = np.arange(-5., 5., 0.1) y = sigmoid(x) plt.figure(0) plt.plot(x, y, 'g') plt.plot([0,0],[1.,0.], ':') plt.title('sigmoid func') # plt.show() # 02.sigmoid (ax) # a가 클수록 step function에 가까워진다. y1 = s...
minssoj/Learning_Pytorch
day2/01.sigmoidFunctionEX.py
01.sigmoidFunctionEX.py
py
741
python
en
code
0
github-code
36
32442603242
import sqlite3 conn = sqlite3.connect('bancodedados.db') cursor = conn.cursor() #variaveis gerais usuario_logado = "" #cria tabelas def modularTable():#Victor clear() tabela = int(input('\nBem vindo ao sistema Meditech\nPrimeiramente adicione os modulos com que deseja trabalhar\n\n1 - funcionarios\n2 - Veicul...
victorhnogueira/esof_sistema_gerencimento_hospitalar
setup.py
setup.py
py
21,575
python
pt
code
1
github-code
36
26361613449
from bme590_assignment02.ECG_Class import ECG_Class from flask import Flask, jsonify, request import numpy as np app = Flask(__name__) count_requests = 0 # Global variable @app.route('/heart_rate/summary', methods=['POST']) def get_data_for_summary(): """ Summary endpoint: Accepts user data and returns ins...
juliaross20/cloud_ecg
api_codes.py
api_codes.py
py
6,928
python
en
code
0
github-code
36
4253568754
def mergeLinkedLists(headOne, headTwo): head, tail = None, None while headOne or headTwo: curr = None if headOne and not headTwo: tail.next = headOne break if not headOne and headTwo: tail.next = headTwo break if headOne.value < he...
blhwong/algos_py
algo_exp/merge_linked_list/main.py
main.py
py
630
python
en
code
0
github-code
36
37635045680
# There are n cars on an infinitely long road. The cars are numbered from 0 to n - 1 from left to right and each car is present at a unique point. # You are given a 0-indexed string directions of length n. directions[i] can be either 'L', 'R', or 'S' denoting whether the ith car is moving towards the left, towards the...
sunnyyeti/Leetcode-solutions
2211 Cout Collisions on a Road.py
2211 Cout Collisions on a Road.py
py
2,787
python
en
code
0
github-code
36
7615554968
# -*- coding: utf-8 -*- import codecs import sys import re import h5py import numpy as np import tflearn from tflearn.data_utils import to_categorical, pad_sequences from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.embedding_ops import embedding from tflearn.layers.recurrent ...
kimwansu/autospacing_tf
bi_lstm.py
bi_lstm.py
py
9,163
python
en
code
0
github-code
36
9503023051
import os import os.path as osp import time import yaml import warnings import torch import torch.optim as optim from utils import get_world_size, get_rank from builder import build_train_dataloader, build_val_dataloader,build_model from utils import Logger,CosineDecayLR from torch import distributed as dist from to...
CxyZyr/face-recognition
runner.py
runner.py
py
13,847
python
en
code
0
github-code
36
5791291209
# intervalo de integracion a = 0 b = 3 # Numero de rectangulos entre a y b n = 5 # Tamano de rectangulo d = (b-a)/ (n *1.0) # Inicializamos la variable I = 0 #DEFINIR UNA FUNCION def f(x): return x**2 - 2*x + 4 #range (0,n) = range(n) # Recordatorio: La funcion range # range(3) = [0,1,2] # range(1,6,2) = [1,3,5] ...
IvonFis/Python-UAM
Ejercicios/Integral.py
Integral.py
py
734
python
es
code
2
github-code
36
13395835031
""" @author: gjorando """ import os import importlib from pypandoc import convert_file from setuptools import setup, find_packages def read(*tree): """ Read a file from the setup.py location. """ full_path = os.path.join(os.path.dirname(__file__), *tree) with open(full_path, encoding='utf-8') as...
gjorando/style-transfer
setup.py
setup.py
py
2,277
python
en
code
2
github-code
36
71696562344
# @keras-rl ''' Script for custom or modified noise processes ''' from __future__ import division import numpy as np #makes an instance of a noise process and returns it #defined by configuration nc #size is the number of parameters the noise is applied to #so far just one-dimensional vector (only action noi...
Frawak/squig-rl
source/noiseProcesses.py
noiseProcesses.py
py
6,718
python
en
code
1
github-code
36
20715650622
def solve(program): accumulator = 0 pointer = 0 executed = set() while pointer not in executed and pointer < len(program): instruction, argument = program[pointer] executed.add(pointer) pointer += 1 if instruction == 'acc': accumulator += argument ...
jonassjoh/AdventOfCode
2020/8/day8.py
day8.py
py
1,252
python
en
code
0
github-code
36
16009855981
#!/usr/bin/python3 import numpy as np from matplotlib import pyplot as plt lx = [] ly = [] with open("HailStoneNum.txt", "r") as f: for line in f: ls = line.split(",") lx.append(int(ls[0])) ly.append(int(ls[1])) x = np.array(lx) y = np.array(ly) plt.plot(x,y) plt.savefig("HailStone.jpg"...
Ukuer/rasp-pi
DSA/HailStone/HailStoneCount.py
HailStoneCount.py
py
322
python
en
code
0
github-code
36
16198615974
# Climate App # Now that you have completed your initial analysis, design a Flask api based on the queries that you have just developed. # - Use FLASK to create your routes. ################################################# # Import Flask & jsonify & the kitchen sink... ################################################...
JREwan/python-challenge
Homework11_SurfsUp/app.py
app.py
py
5,386
python
en
code
0
github-code
36
13289609625
# -*- coding: utf-8 -*- """ Created on Sat Jan 2 00:48:47 2021 @author: baris """ import pandas as pd import math import numpy as np import xlsxwriter xlxs_file = pd.read_excel("example.xlsx") # All columns have separeted into a list on their own. parsed_store = xlxs_file["store"].tolist() parsed_x = xlxs_file[...
barissoyer/FunProjects
X-Yl_Location based/xy_locations.py
xy_locations.py
py
1,579
python
en
code
0
github-code
36
20496563572
from typing import List from instructor import patch from pydantic import BaseModel, Field import openai patch() class Property(BaseModel): key: str value: str resolved_absolute_value: str class Entity(BaseModel): id: int = Field( ..., description="Unique identifier for the entity,...
realsrisri/jxnl-instructor
examples/reference-citation/run.py
run.py
py
5,705
python
en
code
null
github-code
36
13460588720
class Dice(): def __init__(self, x, y): self.side = int(random(1, 7)) self.x = x self.y = y self.status = 'stopped' # rolling self.last_rolled = millis() self.keep = False def roll(self): if self.status != 'rolling' and not self.keep: ...
kairess/yacht-dice
yacht/yacht.pyde
yacht.pyde
pyde
11,675
python
en
code
4
github-code
36
32115859766
from __future__ import annotations from typing import Iterable, Iterator, List, Literal, Optional, Type import frictionless as fl import marshmallow as mm from dimcat import DimcatConfig, get_class from dimcat.data.base import Data from dimcat.data.packages.base import Package, PackageSpecs from dimcat.data.resources...
DCMLab/dimcat
src/dimcat/data/catalogs/base.py
base.py
py
11,590
python
en
code
8
github-code
36
21536939801
import cv2 import numpy as np import os import random import torch from tqdm import tqdm def draw(prediction,dependency): img=np.full((256,256,3),220,dtype=np.uint8) for i,c in enumerate(prediction): if c==0 or c>9: if i not in dependency: cv2.rectangle(img,(10+i%9*26, 10+i//...
RalphHan/CASR
empirical/sudoku2.py
sudoku2.py
py
2,295
python
en
code
1
github-code
36
35396368561
#!/usr/bin/env python3 # coding=utf-8 import xml.dom.minidom as xmldom import os class Appconfig(object): AppCode="" #AppType="" Icon="" Version="" PathType="" Path="" Arguments="" AppStartupType="" def __init__(self,appCode,icon,version,pathType,path,arguments,appStartupTy...
LeeZhang1979/UniTools
conf/AppConfigure.py
AppConfigure.py
py
1,538
python
en
code
0
github-code
36
8982223007
# Packages import numpy as np import os # Path to txt files path_to_d1 = "" ######## # Data # ######## # Preallocation data = {} # Loading .txt files for i in range(1,1001): with open(path_to_d1 + 'Domain01/{0}.txt'.format(i)) as f: lines = f.readlines() # Retrieve domain, class and user ids dom = line...
gheroufosse/Dynamic_Time_Warping
dtw.py
dtw.py
py
9,861
python
en
code
0
github-code
36
37634308620
# Given two binary search trees root1 and root2. # Return a list containing all the integers from both trees sorted in ascending order. # Example 1: # Input: root1 = [2,1,4], root2 = [1,0,3] # Output: [0,1,1,2,3,4] # Example 2: # Input: root1 = [0,-10,10], root2 = [5,1,7,0,2] # Output: [-10,0,0,1,2,5,7,10] # Ex...
sunnyyeti/Leetcode-solutions
1305 All Elements in Two Binary Search Trees.py
1305 All Elements in Two Binary Search Trees.py
py
1,590
python
en
code
0
github-code
36
42154272648
# 예산 case = int(input()) lands = list(map(int, input().split())) lands.sort() max_t = int(input()) left = 0 right = lands[-1] ret = 0 while left <= right: mid = (left+right)//2 tmp = sum([min(i, mid) for i in lands]) if tmp <= max_t: left = mid+1 else: right = mid-1 print(right)
FeelingXD/algorithm
beakjoon/2512.py
2512.py
py
318
python
en
code
2
github-code
36
27868546226
"""Module for I/O related data parsing""" __author__ = "Copyright (c) 2016, Mac Xu <shinyxxn@hotmail.com>" __copyright__ = "Licensed under GPLv2 or later." import datetime import pprint import re from app.modules.lepd.LepDClient import LepDClient class IOProfiler: def __init__(self, server, config='release'...
linuxep/lepv
app/modules/profilers/io/IOProfiler.py
IOProfiler.py
py
5,872
python
en
code
20
github-code
36
41714169812
#hyperparameters feature_dim = 300 regularizer = 0.01 activation='relu' optimizer = 'adam' padding = 'valid' dropout_rate = 0.01 nb_epochs = 10 batch_size = 256 stop_epochs = 5 nb_neurons_dense = 100 #we use this only for lstm nb_neurons_lstm = 150 # only used for cnn nb_filter = 100 filter1_length = 3 filter2_length...
marinaangelovska/complementary_products_suggestions
complementary_products_suggestions/config.py
config.py
py
359
python
en
code
12
github-code
36
835315908
# assignment 1 # Name-Peyush Jindal # SID=21103092 # Question 1 number_1=input("Enter first number:") number_2=input("Enter first number:") number_3=input("Enter first number:") number_1=int(number_1) number_2=int(number_2) number_3=int(number_3) # average average=(number_1 + number_2 + number_3)/3 ...
Peyush3/Python-Assignments
asg1_source_code_CSE_21103092.py
asg1_source_code_CSE_21103092.py
py
1,902
python
en
code
0
github-code
36
37396630977
from regression_tests import * class Test(Test): settings = TestSettings( input='hello.exe' ) def test_main_addresses(self): assert self.out_c.contains('Address range: 0x407740 - 0x40775e') assert self.out_dsm.contains('function: main at 0x407740 -- 0x40775e')
avast/retdec-regression-tests
bugs/same-fnc-end-addr-in-c-and-dsm/test.py
test.py
py
299
python
en
code
11
github-code
36
43794443747
# Pobierz od użytkownika 10 liczb, wyświetl tylko te, które są nieparzyste. # Wprowadzanie n numerów na listę lista = [] print("Wprowadż 10 numerów") for number in range(0, 10): new_number = int(input(f'{number+1} ->')) lista.append(new_number) print("podane liczby to: ", lista) # Sprawdzenie czy numery są ...
TomekJJ/PythonCourse2022
04 Kolekcje/Homework/12 Listy - zad 2.py
12 Listy - zad 2.py
py
519
python
pl
code
0
github-code
36
6751661466
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QWidget, QTreeWidgetItem, QMenu from PyQt5.QtCore import pyqtSlot, QPoint from selfcheck.controllers.selfcheckcontroller import SelfCheckController from selfcheck.modules.editselfcheckitemmodule import EditSelfCheckItemModule from selfcheck.views.selfcheckitemlist i...
zxcvbnmz0x/gmpsystem
selfcheck/modules/selfcheckitemlistmodule.py
selfcheckitemlistmodule.py
py
3,415
python
en
code
0
github-code
36
36830593270
#!/usr/bin/python3 # 涉及对象的定义过程,不能交互式执行,需要放入.py代码文件中执行。 # 导入LCD数字,滑块,部件,Box布局,Q程序,网格布局 from PySide2.QtWidgets import QLCDNumber, QSlider, QWidget, QVBoxLayout, QApplication, QGridLayout # 导入Qt库 from PySide2.QtCore import Qt class MyLCDNumber(QWidget): # 创建LCD数字显示器类 def __init__(self, parent=None): ...
oca-john/Python3-xi
Pyside2/1.pyside2.4.widget.def.py
1.pyside2.4.widget.def.py
py
2,141
python
zh
code
0
github-code
36
24537790919
from pathlib import Path N, S = int(Path("day17.txt").read_text()), 50000000 l, pos, after2017, afterzero = [0], 0, 0, 0 for v in range(1, S+1): pos = (pos + N) % v + 1 if v == 2017: after2017 = l[pos] elif v > 2017: if pos == 1: afterzero = v continue l.insert(pos, v) print(after2017, afterzero...
AlexBlandin/Advent-of-Code
2017/day17.py
day17.py
py
322
python
en
code
0
github-code
36
38793739034
def DeBruijnKmer(kmers): graph=dict() for item in kmers: temp=item[:-1] if temp in graph: graph[temp].append(item[1:]) else: graph[temp]=[item[1:]] return graph def GenerateCycle(graph,start): unexplored_edges=graph route=[] lastnode=start now...
XueningHe/Rosalind_Genome_Sequencing
synthesis.py
synthesis.py
py
3,075
python
en
code
0
github-code
36
23269856572
# import os import sys import csv from matplotlib.patches import Ellipse import matplotlib.transforms as transforms # import pandas as pd # from pandas.plotting import lag_plot from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import random import matplotlib.pyplot as plt import numpy...
lukascao/GUI_vorlesung
GUI_example.py
GUI_example.py
py
54,545
python
en
code
0
github-code
36
37307336429
def test_cobaya(): from cosmoprimo.fiducial import DESI cosmo = DESI() for engine in ['class', 'camb', 'isitgr']: params = {'Omega_m': {'prior': {'min': 0.1, 'max': 1.}, 'ref': {'dist': 'norm', 'loc': 0.3, 'scale': 0.01}, 'latex': '\Omega_{m}'}...
cosmodesi/cosmoprimo
cosmoprimo/tests/test_bindings.py
test_bindings.py
py
2,073
python
en
code
12
github-code
36
29238296763
N, K = map(int, input().split(" ")) graph = [[] for i in range(N+1)] degree = [0 for i in range(N+1)] q = [] for _ in range(K): A, B = map(int, input().split(" ")) graph[A].append(B) degree[B] = degree[B] + 1 for i in range(1, N+1): if degree[i] == 0: q.append(i) while q: # ...
SketchAlgorithm/19_Choi-JinWoo
2252.py
2252.py
py
486
python
en
code
0
github-code
36
36445673009
"""remove subscriber Revision ID: f71f10afe911 Revises: 514826a76b2b Create Date: 2020-03-15 02:09:24.586462 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f71f10afe911' down_revision = '514826a76b2b' branch_labels = None depends_on = None def upgrade(): ...
mhelmetag/mammoth
alembic/versions/f71f10afe911_remove_subscriber.py
f71f10afe911_remove_subscriber.py
py
1,071
python
en
code
1
github-code
36
72294810025
import streamlit as st import pandas as pd import numpy as np # Wedding budget planner for the region of Southern France st.title("Wedding Budget Planner for the Region of Southern France") # Filter to allow the user to narrow down their options st.subheader("Filter") number_of_guests = st.slider("Number of guests"...
karlotimmerman/budget_heroku
hello.py
hello.py
py
1,545
python
en
code
0
github-code
36
4179808886
''' constants used throughout project ''' import numpy as np from astropy.cosmology import FlatLambdaCDM RERUN_ANALYSIS = False ## set cosmology to Planck 2018 Paper I Table 6 cosmo = FlatLambdaCDM(H0=67.32, Om0=0.3158, Ob0=0.03324) boss_h = 0.676 ## h that BOSS uses. h = 0.6732 ## planck 2018 h eta_star = cosmo.c...
kpardo/mg_bao
mg_bao/constants.py
constants.py
py
593
python
en
code
1
github-code
36
14525591993
from TDAs import grafo, ciudades import csv def LeerPJ(ruta): grafo_ciudades = grafo.Grafo() dicc = {} with open(ruta) as archivo: # Colocamos ciudades (vertices) contador = int(archivo.readline()) for _ in range(contador): nombre, x, y = archivo.readline().rstrip().spl...
juandelaHD/Planificador-de-Viaje---Qatar
lectura_archivos.py
lectura_archivos.py
py
1,317
python
es
code
0
github-code
36
2723494159
#!/usr/bin/python3 """tracking the iss using api.open-notify.org/astros.json | Alta3 Research""" # notice we no longer need to import urllib.request or json import requests ## Define URL MAJORTOM = 'http://api.open-notify.org/astros.json' def main(): """runtime code""" ## Call the webservice groundct...
chadkellum/mycode
iss/requests-ride_iss.py
requests-ride_iss.py
py
1,295
python
en
code
0
github-code
36
32179513329
import sys from PyQt5 import QtWidgets def Pencere(): app = QtWidgets.QApplication(sys.argv) okay = QtWidgets.QPushButton("Tamam") cancel = QtWidgets.QPushButton("İptal") h_box = QtWidgets.QHBoxLayout() h_box.addStretch() h_box.addWidget(okay) h_box.addWidget(cancel) ...
mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
PyQt5 - Arayüz Geliştirme/Videolarda Kullanılan Kodlar/horizontal ve vertical layout.py
horizontal ve vertical layout.py
py
643
python
en
code
1,816
github-code
36
7537206122
from django.test import TestCase, tag from djangoplicity.newsletters.models import NewsletterType, Newsletter from webb.tests import utils @tag('newsletters') class TestNewsletters(TestCase): fixtures = [ 'test/common', 'test/media', 'test/announcements', 'test/releases', ...
esawebb/esawebb
webb/tests/newsletters.py
newsletters.py
py
1,838
python
en
code
0
github-code
36
39069951023
# https://leetcode.com/problems/sqrtx/ class Solution: # Iterative Binary Search # Time: O(logn), Space: O(1) def mySqrt(self, x: int) -> int: if x <= 1: return x left, right = 2, x while left <= right: mid = (left + right) // 2 if mid * mid == x:...
grenkoff/leetcode
solutions/0069. Sqrt(x)/Sqrt(x).py
Sqrt(x).py
py
898
python
en
code
0
github-code
36
17885393929
from django.shortcuts import render from django.views import View from django.http.response import JsonResponse from django.template.loader import render_to_string from .models import Topic from .forms import TopicForm class BbsView(View): def get(self, request, *args, **kwargs): topics =...
inatai/super_tsp
posting/views.py
views.py
py
1,026
python
en
code
0
github-code
36
32473831452
from config import bot, chat_id from plugins.error import Error import requests from bs4 import BeautifulSoup import time from telebot import types from plugins.error import in_chat #________________________________________________________________________________________________________________ #Скриншот сайтов #_____...
evilcatsystem/telegram-bot
plugins/screenshot.py
screenshot.py
py
1,624
python
en
code
1
github-code
36
28068784452
# 2021-05-20 # 출처 : https://programmers.co.kr/learn/courses/30/lessons/17683 # 방금 그곡 m = "ABCDEFG" musicinfos = ["11:50,12:14,HELLO,CDEFGAB", "13:00,13:05,WORLD,ABCDEF"] # m='CC#BCC#BCC#BCC#B' # musicinfos=["03:00,03:30,FOO,CC#B", "04:00,04:08,BAR,CC#BCC#BCC#B"] # m='ABC' # musicinfos=["12:00,12:14,HELLO,C#DEFGAB"...
hwanginbeom/algorithm_study
2.algorithm_test/21.05.16/21.05.20_방금그곡_kyounglin.py
21.05.20_방금그곡_kyounglin.py
py
1,838
python
en
code
3
github-code
36
1941672558
#TGP 2018-01-12 #Snippet for adding images to cards import sys import os import re import math import json import subprocess as sub import sublime import sublime_plugin class UmbertoAddImage(sublime_plugin.TextCommand): def run(self, edit): # Location of the current project. ...
tgparton/Umberto
add_image.py
add_image.py
py
1,570
python
en
code
0
github-code
36
21671571550
import os import sys import torch import torch.nn as nn import torch.nn.functional as F torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import numpy as np class Basset(nn.Module): """ This model is also known to do well in transcription factor binding. This model is "sha...
wukevin/rnagps
rnagps/models/basset_family.py
basset_family.py
py
6,034
python
en
code
8
github-code
36
41974155562
#@ File (label = "Input directory", style = "directory") srcFile #@ String (label = "File extension", value=".dv") ext #@ Integer (label = "cell contour channel", value=2) contour #@ Integer (label = "GFP channel", value = 3) countchannel #@ Integer (label = "mCherry channel", value = 4) linechannel #@ Integer (lab...
erickmartins/ImageJ_Macros
katy_foci/count_cells_foci.py
count_cells_foci.py
py
16,326
python
en
code
0
github-code
36
17417433393
from rest_framework.serializers import ModelSerializer from tintoreria.empleados.models import Empleado class EmpleadoSerializer(ModelSerializer): def to_internal_value(self, data): obj = super(EmpleadoSerializer, self).to_internal_value(data) instance_id = data.get('id', None) if instance...
marco2v0/Tintoreria
site/tintoreria/empleados/serializers.py
serializers.py
py
587
python
es
code
0
github-code
36
28797419371
import yfinance as yf from matplotlib import pyplot as plt def load_ticker(symbol): ticker = yf.Ticker(symbol) hist = ticker.history(start="2020-03-01", end="2020-12-02") hist = hist.reset_index() for i in ['Open', 'High', 'Close', 'Low']: hist[i] = hist[i].astype('float64') return his...
Eric-Wonbin-Sang/CS110Manager
2020F_final_project_submissions/mcdonaldjillian/CSfinalproject.py
CSfinalproject.py
py
1,422
python
en
code
0
github-code
36
2892146403
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import phonenumber_field.modelfields class Migration(migrations.Migration): dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] operations = [ ...
abarto/learn_drf_with_images
learn_drf_with_images/user_profiles/migrations/0001_initial.py
0001_initial.py
py
1,052
python
en
code
21
github-code
36
34211305302
from flask import Flask, send_from_directory from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from .models import * db = SQLAlchemy() BASE_DIR = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'data.db') def model_exists(model_class): ...
wickes1/fullstack-react-flask-overview-backend
app/__init__.py
__init__.py
py
1,680
python
en
code
0
github-code
36
5179170859
#coding:utf-8 from django.shortcuts import render_to_response, get_object_or_404 from activity.dao import activityDao from django.template.context import RequestContext from collection.dao import collectionDao, select_collection_byReq,\ update_rightTime_byReq, update_wrongTime_byReq from django.http.response impor...
WarmerHu/subject
collection/views.py
views.py
py
3,516
python
en
code
0
github-code
36
25047209667
from rest_framework import status from rest_framework.generics import get_object_or_404 from rest_framework.views import APIView from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from .models import Profile, Subject, Lesson, Screenshot from .permissions import EditingF...
vnkrtv/screenshots-loader
backend/app/api/views.py
views.py
py
5,190
python
en
code
0
github-code
36
36426081739
from PIL import Image import math def invert(img): rgb_img = img.convert('RGB') width, height = rgb_img.size img2 = Image.new('RGB', (width, height)) for y in range(height): for x in range(width): r, g, b = rgb_img.getpixel((x, y)) r = 255 - r g = 255 - g b = 255 - b # print(f'(x:{x},y:{y} = ({r...
koyachi/sketches
2021-02-11-pythonista-image/image_processor.py
image_processor.py
py
3,591
python
en
code
2
github-code
36
72432170665
import numpy as np import cv2 STAGE_FIRST_FRAME = 0 STAGE_SECOND_FRAME = 1 STAGE_DEFAULT_FRAME = 2 kMinNumFeature = 1500 orb = cv2.ORB_create() lk_params = dict(winSize = (21, 21), #maxLevel = 3, criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 30, 0.01)) ############## Edit this porti...
aswinsbabu/visual-odometry
test_folder/odometry/sift_odometry.py
sift_odometry.py
py
5,990
python
en
code
1
github-code
36
27320663172
import lyricsgenius as lg import csv import re def clean(lyrics): s = re.split(" |\n", lyrics) tempLyrics = "" for i in range(1,len(s)): word = s[i] tempLyrics += " " + re.sub(r'\W+', '', word) return tempLyrics client_access_token = "T_JxSIu8YFUEi3rDYG_9dOuajcyPXDJV09C...
Ykelli/NLP
scraper.py
scraper.py
py
1,245
python
en
code
0
github-code
36
25317597548
#!/user/bin/python import configparser import requests import json import time #read config file for API key config = configparser.ConfigParser() config.sections() config.read('../TwitterScrape/credentials.ini') api = config.get("keys", 'urlapi') #Set headers and data for api usage headers = { 'Content-Type': 'appli...
monkeytail2002/TwitterURLChecker
Test Scripts/testrequest.py
testrequest.py
py
1,010
python
en
code
0
github-code
36
35132573715
import itertools from abc import ABCMeta import numpy as np import tensorflow as tf import gin.tf from datasets.raw_dataset import RawDataset from datasets import dataset_utils from layers.embeddings_layers import ObjectType class SamplingDataset(RawDataset, metaclass=ABCMeta): pass @gin.configurable(blacklist...
Dawidsoni/relation-embeddings
src/datasets/sampling_datasets.py
sampling_datasets.py
py
9,287
python
en
code
0
github-code
36
41037129028
import matplotlib.pyplot as plt import cv2 import os import random BASE_PATH = "testImages" CATEGORIES = ["flybuss", "neptuntaxi", "trondertaxi"] IMG_SIZE = 60 for category in CATEGORIES: path = os.path.join(BASE_PATH, category) for img in os.listdir(path): img_array = cv2.imread(os.path.join(path, im...
JoakimAa/Bachelor2021
ML/Cnn/viewtest.py
viewtest.py
py
474
python
en
code
0
github-code
36