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
40779260735
import magic import collections from pprint import pprint class cbmagic(magic.Magic): def __init__(self): magic.Magic.__init__(self) self.file_types=collections.OrderedDict() self.file_types['JPEG'] = 'jpg' self.file_types['PNG'] = 'png' self.file_types['PDF'] = 'pdf' de...
commerceblock/cb_idcheck
cb_idcheck/cbmagic.py
cbmagic.py
py
902
python
en
code
1
github-code
50
13156721245
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script cleans up the workspace after a full synthese (vasy, boom, boog, loon) run. """ __author__ = "Siegfried Kienzle" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Siegfried Kienzle" __email__ = "siegfried.kienzle@gmx.de" import os im...
sikienzl/FPGA_Alliance_Scripts
wrapper_synthese/cleanup.py
cleanup.py
py
1,927
python
en
code
0
github-code
50
18781204661
if '__file__' in globals(): import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import unittest import numpy as np from dezero import Variable def f(x): y = x ** 4 - 2 * x ** 2 return y class HighgradTest(unittest.TestCase): def test_backward(self): x = Variable(...
kanan4gh/my-dezero
tests/testStep33.py
testStep33.py
py
607
python
en
code
0
github-code
50
11932588404
import zipfile import tensorflow as tf from tensorflow.keras.layers import Input, Dense, Dropout, Conv2D, MaxPooling2D, Flatten from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image_dataset_from_directory from tensorflow.keras.applications import EfficientN...
salman-/small-codes-for-tensorflow-certificate-exam
classifications/image-classification/binary-image-classification-prediction.py
binary-image-classification-prediction.py
py
3,534
python
en
code
0
github-code
50
26636857394
from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * class MyWindow(QWidget): def __init__(self): super(MyWindow, self).__init__() self.resize(300,300) self.setWindowTitle('test geometry') self.setMinimumSize(300,300) self.setMaximumSize(600,60...
PeterZhangxing/codewars
gui_test/test_pyqt/test_geometry.py
test_geometry.py
py
1,478
python
en
code
0
github-code
50
33682023920
import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') import numpy as np fig = plt.figure() ax = plt.axes() ax = ax.set(xlabel='x', ylabel='f(x) = x^3 + x^2 - 10') x = np.linspace(-20, 20, 1000) plt.axis([-20, 20, -20, 20]) plt.plot(x, ((x * x * x) + (4 * x * x) - 10), color = '0.75') plt.plot(x, x-...
TheoDaix/TP_anum
Entrainements/matplotlib_test.py
matplotlib_test.py
py
392
python
en
code
0
github-code
50
34556117864
from bs4 import BeautifulSoup import requests import pandas as pd import numpy as np import matplotlib.pyplot as plt def get_burberry_df(): urls = [ "https://us.burberry.com/womens-new-arrivals-new-in/", "https://us.burberry.com/womens-new-arrivals-new-in/?start=2&pageSize=120&productsOffset=&cell...
adasegroup/FDS2020_seminars
Week 2/Day 2/Submissions/Sergei_Gostilovich/get_data_fun.py
get_data_fun.py
py
5,341
python
en
code
3
github-code
50
11342959263
import pickle import requests import string def get_keyword_xml(letter): r = requests.get(f'https://vocab.lternet.edu/vocab/vocab/services.php?task=letter&arg={letter}') return r.text def parse_keywords(txt): i = 0 keywords = [] while i >= 0: i = txt.find('<string><![CDATA[', i) ...
PASTAplus/ezEML
get_lter_keywords.py
get_lter_keywords.py
py
775
python
en
code
6
github-code
50
71244192794
def read(): numbers = [] with open("./files/numbers.txt", "r", encoding="utf-8") as data: for line in data: numbers.append(int(line)) print(numbers) def write(): names = ["Facundo", "Miguel", "Pepe", "Christian", "Fernández"] with open("./files/numbers.txt",...
defdzg/Platzi-Python-intermedio
archivos.py
archivos.py
py
675
python
en
code
0
github-code
50
15726376022
#!/usr/bin/env python # coding: utf-8 # In[39]: import pandas as pd from pandas_datareader import data as pdr import yfinance as yf import numpy as np import datetime as dt import matplotlib.pyplot as plt # In[117]: tickers = ['HD','DIS','WMT','VZ'] # In[118]: weights = np.array([.25, .3, .15, .3]) # In[11...
btobin0/Python-Hedging-Trading
Learning ValueAtRisk(VAR).py
Learning ValueAtRisk(VAR).py
py
3,246
python
en
code
2
github-code
50
27193442601
import numpy as np from tqdm import tqdm from tabulate import tabulate from torch.utils.data import DataLoader from scipy.special import softmax from sklearn import preprocessing from data.lmdb_dataset import LMDBDataset from models.models_dict import DATASET_MODELS_DICT from config import args from ds3_utils ...
indussky8/AS3
AS3_MM/test_ds3.py
test_ds3.py
py
5,247
python
en
code
0
github-code
50
23792607445
from copy import deepcopy n, m = map(int, input().split()) grid = [list(map(int, input().split())) for _ in range(n)] check = [[False for _ in range(m)] for _ in range(n)] answer = -99999999 def check_is_visited(check, r1, c1, r2, c2): return any( [any([check[i][j] for j in range(c1, c2 + 1)]) for i in r...
innjuun/Algorithm
LeeBros/2주차/겹쳐지지 않는 두 직사각형.py
겹쳐지지 않는 두 직사각형.py
py
1,515
python
en
code
2
github-code
50
16380363520
# Preprocessor - Alexander Liao # This will take dict input (JSON format) and assign each note a UUID # See /data-formats.md # `some input` -> `python3 chordgenerator.py` import json from sys import stdin, stdout from chordoffsets import C, D, E, F, G, A, B def snap(notes): sixteenthnote = notes["tempo"] / 4 ...
hyper-neutrino/hack-the-north-2017
acc-gen/preprocessor.py
preprocessor.py
py
1,192
python
en
code
0
github-code
50
9513492956
#!/usr/bin/env /usr/bin/python3 import numpy as np import os import subprocess as sp import multiprocessing as mp from pathlib import Path from timer import timer from make_initial import make_initial ################################################################################ #====================================...
HopyanLab/ConPT2D
hyperbolic_source/run_eigen.py
run_eigen.py
py
3,416
python
en
code
0
github-code
50
15341415584
import requests import datetime import pandas as pd import csv request_headers = { 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', 'Origin': 'https://grafcan1.maps.arcgis.com', 'Connection': 'keep-a...
nathanschepers/covid-canaries
scripts/update_canarias_cases.py
update_canarias_cases.py
py
2,880
python
en
code
2
github-code
50
6661385448
# --- # # Needs .csv tables to plot quantities # # --- from __future__ import division import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt plt.rc('text', usetex=True) plt.rc('font', family='serif') import numpy as np import pandas as pd import sys import os import copy import h5py import csv from s...
vsevolodnedora/prj_gw170817
scripts/legacy/plot_summary.py
plot_summary.py
py
63,511
python
en
code
0
github-code
50
18376053040
import numpy as np import matplotlib matplotlib.use("agg") from minivggnet import MiniVGGNet from sklearn.preprocessing import LabelBinarizer from sklearn.metrics import classification_report from sklearn.model_selection import train_test_split from keras.optimizers import SGD from keras.datasets import cifar10 import ...
SalahSoliman/VGGNet
trainvgg.py
trainvgg.py
py
2,028
python
en
code
0
github-code
50
38302844005
from flask import Blueprint, render_template, request, flash, redirect, url_for from flask_login import login_required, current_user from db_manager import db_manager from prep_stocks import put_into_db stock = Blueprint('stock', __name__) def render_stocks(): cur = db_manager.get_cursor() cur.execute("""...
jkw944/DIS_Project
MyWebApp/stocks.py
stocks.py
py
2,741
python
en
code
0
github-code
50
21833302791
import sys from sqlalchemy import create_engine import pandas as pd from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from sklearn.pipeline import Pipeline, FeatureUnion from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.multioutput import MultiOutpu...
gustavex/Udacity_Data_Scientist
04_disaster_response_pipeline/models/train_classifier.py
train_classifier.py
py
5,967
python
en
code
2
github-code
50
70085291677
import threading import ursina from calc import * from gui import Simulation from planet import Planet, Sky class Main: def __init__(self, app, planet_list=[]): # SET BASIC VARIABLES FOR ursina ------------------------------------------------------- self.app = app ursina.window.title =...
DerBerlinr/Planet-Simulation
main.py
main.py
py
1,620
python
en
code
2
github-code
50
30297363580
# tree with class class Node: def __init__(self, data): self.data = data self.right = None self.left = None class Tree: def __init__(self, root): self.r = root root = None # inorder traversal def inorder_wrapper_traversal(self): self.inorder_Traversal(self....
dynstat/DataStructuresInPython
kanchan/Tree/tree_with_class.py
tree_with_class.py
py
1,184
python
en
code
0
github-code
50
45239525528
#!/usr/bin/env python3 from flask import Flask, render_template, request, flash, redirect, url_for from services import* from services.service import create_people, get_peoples, get_people, delete_people, edit_people, get_courses, people_exist app = Flask(__name__) app.secret_key = "mysecretkey" @app.route('/') def ...
lordmaster11/Challege-Peoples
app.py
app.py
py
3,564
python
en
code
0
github-code
50
32786245734
# -*- coding: utf-8 -*- # @Author : wangtingyun # @Time : 2020/03/28 import sys from PyQt5.QtCore import QPropertyAnimation, Qt, QPoint, QEasingCurve, QTimer from PyQt5.QtWidgets import QWidget, QLabel, QApplication class MarqueeWidget(QWidget): """跑马灯控件""" def __init__(self, parent): super(Ma...
aiwangtingyun/PythonDemo
component/marquee_widget.py
marquee_widget.py
py
2,358
python
en
code
0
github-code
50
32218884493
import pygame class Guy(pygame.sprite.Sprite): def __init__(self, *groups): super().__init__(*groups) self.image = pygame.image.load("data/enzo.png") # 16x16s self.image = pygame.transform.scale(self.image, [100, 100]) self.rect = pygame.Rect(50, 50, 100, 100) ...
Ewertonalex/Jogo-Pygame-Enzo-vs-Zumbi
guy.py
guy.py
py
892
python
en
code
5
github-code
50
71116402715
#!/usr/bin/python import simplejson import urllib import urllib2 import sys apikey = "" url = "https://www.virustotal.com/vtapi/v2/file/report" parameters = {"resource": sys.argv[1], "apikey": apikey} data = urllib.urlencode(parameters) req = urllib2.Request(url, data) response = urllib2.urlopen(req) json = response...
FKilic/x-tier
X-TIER/scripts/virustotal/virustotal.py
virustotal.py
py
467
python
en
code
4
github-code
50
14591693671
def sum(a, b, c ): return a + b + c def printBoard(xState, oState): zero = 'X' if xState[0] else ('O' if oState[0] else 0) one = 'X' if xState[1] else ('O' if oState[1] else 1) two = 'X' if xState[2] else ('O' if oState[2] else 2) three = 'X' if xState[3] else ('O' if oState[3] else 3) ...
saadhussain01306/Tic_tak_toe
project[1].py
project[1].py
py
1,793
python
en
code
1
github-code
50
14762107866
from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from .models import Profile, MyUser import os """ @receiver(post_save, sender=MyUser) def create_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance.username) ...
armani24/gglocal
guido/users/signals.py
signals.py
py
1,186
python
en
code
0
github-code
50
31940036407
#!/usr/bin/env python #_*_ codig: utf8 _*_ import os, time, sqlite3 from watchdog.observers.polling import PollingObserver from watchdog.events import FileSystemEventHandler from Modules.constants import * def on_created(event): con=sqlite3.connect('data.db') cur=con.cursor() file_name=os.path.basename(eve...
mgarciasantamaria/uparoundv2
watchFolder.py
watchFolder.py
py
1,049
python
en
code
0
github-code
50
7252211669
#%% import os import pandas as pd from ecg_arrythmia_analysis.code.dataloader import * from ecg_arrythmia_analysis.code.architectures import * from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau from sklearn.metrics import f1_score, accuracy_score #%% MODEL_PATH = 'models/' DATA...
adrianomartinelli/machine-learning-for-health-care
ecg_arrythmia_analysis/code/functions.py
functions.py
py
8,081
python
en
code
0
github-code
50
29774578297
import torch import numpy as np # Blender is right hand system def dataset_loader(): data = np.load('../ganyu_150.npz') # data = np.load('../tiny_nerf_data.npz') images = data['images'] poses = data['poses'] # camera to world focal = data['focal'] return images, poses, focal
Pokerlishao/MyNeRF
datasets/make_dataset.py
make_dataset.py
py
300
python
en
code
0
github-code
50
4595634845
from django.http import HttpResponseServerError from rest_framework.viewsets import ViewSet from rest_framework.response import Response from rest_framework import serializers, status from iimproveapi.models import Tag, User class TagsView(ViewSet): """iimproveapi tags view""" def retrieve(self, request, pk):...
nishayaraj/I-Improve-Server
iimproveapi/views/tags.py
tags.py
py
2,411
python
en
code
0
github-code
50
20698870729
from pyo import * CHORD = { 'maj7': [-12, -8, -5, -1], 'm7': [-12, -9, -5, -2], 'x7': [-12, -8, -5, -2], 'half_dim': [-12, -9, -6, -2] } s = Server() s.setInputDevice(3) # Steinberg in s.setOutputDevice(3) # Steinberg out s.setMidiInputDevice(99) s.boot() mic = Input().play().out() notes = Notein(poly=10, s...
ancoopa/chords-machine
chord_machine.py
chord_machine.py
py
1,373
python
en
code
2
github-code
50
11069612230
import os import tempfile import unittest from unittest.mock import patch from click.testing import CliRunner from gramps.cli.clidbman import CLIDbManager from gramps.gen.dbstate import DbState from sqlalchemy.exc import IntegrityError from gramps_webapi.__main__ import cli from gramps_webapi.app import create_app fr...
windmark/gramps-webapi
tests/test_cli.py
test_cli.py
py
2,131
python
en
code
null
github-code
50
26382057896
import os import setuptools from tools import get_requirements, get_readme, get_version def main(): path = os.path.dirname(os.path.abspath(__file__)) version = get_version() open( os.path.join(path, "kara_storage", "version.py"), "w" ).write('version = "%s"' % version) setuptools.setup( name...
a710128/kara-storage
setup.py
setup.py
py
1,061
python
en
code
7
github-code
50
8454219258
from django.urls import path from .views import RegisterView, RetrieveUserView, LogoutView from . import views urlpatterns = [ path('register', RegisterView.as_view()), path('me', RetrieveUserView.as_view()), path('login', views.LoginView,name="login"), path('logout', LogoutView.as_view()), path('v...
NithinKrishna10/Django-Rest-Framework-JWT-authentication
accounts/urls.py
urls.py
py
935
python
en
code
0
github-code
50
45009242698
# Author: Sheikh Rabiul Islam # Date: 07/10/2019; updated: 07/15/2019 # Purpose: preprocess data using all features; resample minority class; # save the fully processed data as numpy array (binary: data/____.npy) #import modules import pandas as pd import numpy as np import time from sklearn.utils import shuffle...
SheikhRabiul/domain-knowledge-aided-explainable-ai-for-intrusion-detection-and-response
data_preprocess_all_features.py
data_preprocess_all_features.py
py
5,596
python
en
code
1
github-code
50
874748908
class RobotInAGrid: """ 8.2 Robot in a Grid: Imagine a robot sitting on the upper left corner of grid with r rows and c columns. The robot can only move in two directions, right and down, but certain cells are "off limits" such that the robot cannot step on them. Design an algorithm to find a path f...
DmitryPukhov/pyquiz
pyquiz/ctci/dynamic/RobotInAGrid.py
RobotInAGrid.py
py
1,849
python
en
code
0
github-code
50
25822728887
imdb_file = input("Enter the name of the IMDB file ==> ").strip() print(imdb_file) counts = dict() for line in open(imdb_file, encoding = "ISO-8859-1"): words = line.strip().split('|') movie = words[1].strip() if movie in counts: if words[0] in counts[movie]: continue counts[mov...
emilyvroth/cs1
lecture/lecture17/part2.py
part2.py
py
758
python
en
code
0
github-code
50
70644985755
from flask_app import app from flask import render_template, request, redirect from flask_app.models.user import User @app.route("/") def index(): return render_template("index.html") @app.route("/read_all") def read_all(): return render_template("read(all).html", all_users = User.retrieve_all()) @app.route(...
Diaz1620/user_crud_mod
flask_app/controllers/users.py
users.py
py
1,422
python
en
code
0
github-code
50
72087571675
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bbs', '0001_initial'), ] operations = [ migrations.AlterField( model_name='comment', name='parent_co...
triaquae/py_training
OldboyBBS2/bbs/migrations/0002_auto_20150909_0238.py
0002_auto_20150909_0238.py
py
449
python
en
code
85
github-code
50
6790715267
# -*- coding: utf-8 -*- """ Created on Tue Jul 10 22:30:13 2018 @author: Zhang Xiang """ import numpy as np def loadData(filename): """导入数据""" dataMat = [] fr = open(filename) for line in fr.readlines(): curline = line.split('\t') curline = list(map(float, curline)) ...
zhangxiangchn/Demo
Model Tree.py
Model Tree.py
py
3,132
python
en
code
3
github-code
50
10977899326
import logging import numpy as np from ibmfl.model.model_update import ModelUpdate from ibmfl.aggregator.fusion.iter_avg_fusion_handler import IterAvgFusionHandler logger = logging.getLogger(__name__) class PrejudiceRemoverFusionHandler(IterAvgFusionHandler): def fusion_collected_responses(self, lst_model_updat...
SEED-VT/FedDebug
debugging-constructs/ibmfl/aggregator/fusion/prej_remover_fusion_handler.py
prej_remover_fusion_handler.py
py
1,248
python
en
code
7
github-code
50
4815676842
#!/usr/bin/env python # -*- coding: utf-8 -*- import pickle # creamos/abrimos el archivo acces donde se guardará los datos de acceso menos la contraseña, lo leemos y cerramos el archivo def lee(nombre): try: # leemos los datos del archivo acces.txt fin=open(nombre,"rb") list=pick...
Carlostlr/Gestor-empresa
general/archivos.py
archivos.py
py
809
python
es
code
0
github-code
50
72148543514
import streamlit as st import io import pdfplumber import openai from keys import OPEN_API_KEY # Set your API key openai.api_key = OPEN_API_KEY # Define the model you want to use MODEL_NAME = "text-davinci-003" MAX_TOKENS = 100 # Page Configuration st.set_page_config(page_title="PDF Summarizer", page_icon=":arrow_up...
mazalkov/baag.ai
src/baag/app.py
app.py
py
1,707
python
en
code
0
github-code
50
28103079549
# Calculadora Python calc = True while calc: entrada = input('Pressione "Enter" para continuar ou "sair" para encerrar o programa: ').lower() if entrada != 'sair': num1 = input('Digite um número: ') int_num1 = int(num1) oper = input('Digite a operação (+, -, /, *) >> ') ...
marcelogabrielcn/udemy_python2023
aula27.py
aula27.py
py
983
python
pt
code
0
github-code
50
19873780444
#!/usr/bin/python from string import Template import stat import SCons def md5sum(filename): import hashlib f = file(filename,'rb') return hashlib.md5(f.read()).hexdigest() def md5sum_action(target, source, env): for i in range(len(source)): digest = md5sum(source[i].abspath) content ...
LolHacksRule/popcap
osframework/source/site_scons/site_tools/md5sum.py
md5sum.py
py
1,306
python
en
code
5
github-code
50
9148368381
# -*- coding: utf-8 -*- import os import yaml from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.exc import IntegrityError, SQLAlchemyError import pysite.models from pysite.authmgr.models import Principal, Role def check_site(sites_dir, sitename): """ Checks integrity of a site. A site is int...
dmdm/PySite
pysite/sitemgr/manager.py
manager.py
py
10,164
python
en
code
5
github-code
50
20334472449
import numpy as np def preprocess(dataset): data = np.array(dataset['data']) data = np.unique(data, axis=0) X = data[:, :-1] y = data[:, -1] X = X.astype(np.float64) y = y.astype(np.uint32) return X, y
MarioDudjak/OversamplingWorkflow
program/DatasetManagement/Preprocessing.py
Preprocessing.py
py
234
python
en
code
0
github-code
50
23534776330
import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import hiplot as hip import plotly.express as px #import altair as alt #sklearn from sklearn.preprocessing import MinMaxScaler from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassi...
faisalece/CMSE830_Midterm_Project
app.py
app.py
py
21,083
python
en
code
0
github-code
50
16139769924
# 2022.01.21 import faiss class ProductQuantizer(): def __init__(self, n_codes, code_size=1): self.log_n_codes = (int)(np.log2(n_codes-1))+1 self.n_codes = pow(2, self.log_n_codes) self.code_size = code_size self.dim = -1 self.codebook = None def fit(self, X): ...
yifan-fanyi/Func-Pool
ProductQuantizer.py
ProductQuantizer.py
py
1,291
python
en
code
2
github-code
50
32053161555
# pip3.10 install openpyxl import openpyxl import io # Ruta al archivo byte descargado archivo_byte = 'data2.net_7e80c8ad-b3b2-4fd9-90e6-35791b123e5e' # Abre el archivo byte with open(archivo_byte, 'rb') as f: contenido_byte = io.BytesIO(f.read()) # Carga el archivo byte en openpyxl libro_excel = openpyxl.load_w...
GerardoRosas-27/examplesPy
converteByteToExcel.py
converteByteToExcel.py
py
504
python
es
code
0
github-code
50
27351665750
import socket import psutil dsk = psutil.disk_usage('/') F = dsk.free #Fに空き容量を代入 FM = F/1000000 #1000000で割ってmbの値にして代入 with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s: s.connect(('192.168.0.57', 50007)) #メッセージ s.sendall(b'Sensor Connected') data = s.recv(1024) print(repr(data)) pr...
KanekoTW/Python
socket/clienthdd.py
clienthdd.py
py
397
python
ja
code
0
github-code
50
7422846475
import random # prompt the user to enter the maximum number that can be guessed max_num = int(input("Masukkan angka terbesar yang diinginkan: ")) # randomly choose a number to be guessed number = random.randint(1, max_num) # set the initial number of guesses to zero num_guesses = 0 # set the initial range of possib...
lunaticbugbear/guess-the-number
guess_computer.py
guess_computer.py
py
1,247
python
en
code
0
github-code
50
43161433239
from django.conf.urls import url from scouts.sub_tasks.api import views urlpatterns = ( # MoveOut Sub Tasks url(r'^move_out/remarks/$', views.MoveOutRemarkUpdateView.as_view()), url(r'^move_out/amenity_check/$', views.MoveOutAmenitiesCheckupRetrieveUpdateView.as_view()), # PropertyOnBoarding Sub Tas...
HalanxDev/Halanx-Scout-Backend
scouts/sub_tasks/urls.py
urls.py
py
852
python
en
code
0
github-code
50
11607558430
# ''' # Tema 1 _ Setup, Variabile, Tipuri de date # Exerciții Recomandate - grad de dificultate: Ușor . # 1. Revizualizează întâlnirea 1 și ia notițe în caz că ți-a scăpat ceva. # 2. Vizualizează din videoul ‘Primii pași în Programare’: # - Variabile și Tipuri; # - Operatori și Flow Control. # Astfel, la întâlnirea LIV...
GavrilaSergiuGVS/TESTGH
tema1.py
tema1.py
py
5,419
python
ro
code
0
github-code
50
23589033627
import telebot from django.shortcuts import render, redirect from django.http import HttpResponse from . import models # Create your views here. bot = telebot.TeleBot('5459935331:AAGVWpnqIK_bYMatPGDtqTWS8iPiWZgTJBc') def home_page(request): all_category = models.Category.objects.all() return render(request...
khurshid02/internet_magazin_django
main_page/views.py
views.py
py
3,801
python
en
code
0
github-code
50
8876495576
import click from flask import Flask from flask.cli import AppGroup # from .models.common import db # from flask_sqlalchemy import SQLAlchemy from app.models import ( db, Stock ) from app.logic.stock import stock_init_db stock_cli = AppGroup('stock') @stock_cli.command('init-db') def cmd_stock_init_db(): """ ...
jackalissimo/pipkoff
app/cli.py
cli.py
py
742
python
en
code
0
github-code
50
25588677373
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import codecs import datetime import hashlib import logging import os import shutil import stat import sys import tempfile import unicodedata import unittest from os.path import join as j import mock from io import S...
LibraryOfCongress/bagit-python
test.py
test.py
py
49,635
python
en
code
198
github-code
50
4682107697
from dal_select2.views import Select2QuerySetView from django.http import JsonResponse from django.utils import timezone from rest_framework.fields import IntegerField, DateField from rest_framework.serializers import Serializer from rest_framework.views import APIView from the_redhuman_is.models import Worker from th...
yaykarov/Gettask
the_redhuman_is/views/backoffice_app/delivery/requests_on_map.py
requests_on_map.py
py
3,040
python
en
code
0
github-code
50
34655456874
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/largest-rectangle-in-histogram/ # Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, # find the area of largest rectangle in the histogram. # For each bar, find the largest rectangle including...
jakehoare/leetcode
python_1_to_1000/084_Largest_Rectangle_in_Histogram.py
084_Largest_Rectangle_in_Histogram.py
py
1,437
python
en
code
49
github-code
50
34884768649
""" 输入某二叉树的前序遍历和中序遍历的结果,请重建该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。 """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def buildTree(self, preorder, inorder) -> TreeNode: # 1.根据前序遍历确树的根节点 # 2. 根据中序遍历顺序 找到两个子树的集合 if ...
Dong98-code/leetcode
codes/got-Offer/07.buildTree.py
07.buildTree.py
py
1,119
python
en
code
0
github-code
50
32570914038
import pyark.cva_client as cva_client from protocols.protocol_7_3.cva import ReportEventType, Transaction import logging import pandas as pd REPORT_EVENT_TYPES = [ReportEventType.genomics_england_tiering, ReportEventType.candidate, ReportEventType.reported, ReportEventType.questionnaire] class...
genomicsengland/pyark
pyark/subclients/cases_client.py
cases_client.py
py
11,220
python
en
code
1
github-code
50
3059198420
import numpy as np from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers import Dense, Conv2D, Dropout, BatchNormalization, MaxPooling2D, Flatten x_train = np.load('../data/image/brain/npy/keras66_train_x.npy') x_val = np...
SunghoonSeok/Study
keras2/keras66_4_load_npy_fit.py
keras66_4_load_npy_fit.py
py
2,463
python
en
code
2
github-code
50
32266419487
import requests import time from data import TOKEN API_URL: str = 'https://api.telegram.org/bot' BOT_TOKEN: str = TOKEN TEXT: str = 'Мы законектились!' MAX_COUNTER: int = 100 offset: int = -2 counter: int = 0 chat_id: int while counter < MAX_COUNTER: print('attempt =', counter) #Чтобы видеть в консоли, что ко...
geronda94/aiogram_learning
experiments_with_token/simle_requests.py
simle_requests.py
py
1,394
python
ru
code
0
github-code
50
37935322797
import scrapy import logging from scrapy.contrib.spiders import Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import HtmlXPathSelector class StackOverflowSpider(scrapy.Spider): name = 'stackoverflow' start_urls = ['http://www.mirrorkart.com/Buy-Designers-Mirrors-o...
amititash/hc_scrapy
tmp_spider.py
tmp_spider.py
py
966
python
en
code
0
github-code
50
44323507785
import pickle from typing import Any import numpy as np def load_pickle(filepath: str) -> Any: """Load a pickle file Args: filepath (str): path to pickle file """ with open(filepath, "rb") as pickle_file: data = pickle.load(pickle_file) return data def min_max_normalize(a: np....
AntoineRichard/LunarDiffusion
dem_zoomer/utils/data_utils.py
data_utils.py
py
900
python
en
code
0
github-code
50
25249220807
# -*- coding: utf-8 -*- """ Created on Wed Oct 6 10:29:13 2021 @author: Oscar """ """ # Calulate the sum of squares of however many natural numbers def squaresum(n): #Initiate a variable for holding the sums sm = 0 # Iterate the addition of each individual squares from 1 to n+1 number fo...
oliver779/Computational_Methods_Course
Sum of Squares.py
Sum of Squares.py
py
1,392
python
en
code
0
github-code
50
29362569826
# ************************************************************************************************* # quant_momentum_strategy # # The goal of this script is to delop a investing strategy that recommends an equal weight # portfolio of the 50 stocks with the highest price momentum. # # Following @nickmccullum Algorithmi...
Dialvive/Python-Algorithmic-Trading
quantitative-momentum-strategy/quant_momentum_strategy.py
quant_momentum_strategy.py
py
3,190
python
en
code
0
github-code
50
16751400524
n1=float(input("Ingresa el primer numero: ")) n2=float(input("Ingresa el segundo numero: ")) print("Son iguales?",n1==n2) print("Son iguales?",n1!=n2) ## cadena=input("Escribe una cadena") lon=len(cadena) print("es mayor que 3 y menor que 10?",3<lon<10) ## NumeroMagico=12345679 NumeroUsuario=int(input("ingresa un numer...
jesusRL96/python_curso
2.py
2.py
py
607
python
es
code
0
github-code
50
26241642628
# -*- coding: utf-8 -*- import logging import openai from modelcache.adapter.adapter_query import adapt_query from modelcache.adapter.adapter_insert import adapt_insert from modelcache.adapter.adapter_remove import adapt_remove class ChatCompletion(openai.ChatCompletion): """Openai ChatCompletion Wrapper""" ...
kpister/prompt-linter
data/scraping/repos/codefuse-ai~CodeFuse-ModelCache/modelcache~adapter~adapter.py
modelcache~adapter~adapter.py
py
1,417
python
en
code
0
github-code
50
73638395356
__author__ = 'Canon' from PIL import Image from StringIO import StringIO def crop_save_img(filename, data, x1, y1, x2, y2): imgIO = StringIO(data) img = Image.open(imgIO) croped_img = img.crop((x1, y1, x2, y2)) dot_pos = filename.rfind('.') absfilename = filename[:dot_pos] croped_img.save(absf...
silentcanon/Anya
service/photo.py
photo.py
py
344
python
en
code
0
github-code
50
25507326314
# Python program to identify the identifier # import re module # re module provides support # for regular expressions import re # Make a regular expression # for identify valid identifier regex = "^[A-Za-z_][A-Za-z0-9_]*" # Define a function for # identifying valid identifier def check(word): keywords = [ ...
roshanxshrestha/college-codes
4-TOC/5cidentifiers.py
5cidentifiers.py
py
1,249
python
en
code
0
github-code
50
7440046301
import cv2 import matplotlib.pyplot as plt def plt_imshow(title="image", img=None, figsize=(8, 5)): plt.figure(figsize=figsize) if type(img) == list: if type(title) == list: titles = title else: titles = [] for i in range(len(img)): titles....
lee-lou2/ocr
utils/image_show.py
image_show.py
py
1,001
python
en
code
2
github-code
50
12042695517
from sklearn.datasets import fetch_20newsgroups from collections import Counter import re import spacy from tqdm import tqdm import string import numpy as np def count_words(data): nlp = spacy.load('en_core_web_sm') counter = Counter() for sentence in tqdm(data.data): sentence = sentence.lower().t...
nviolante25/mva
neuroscience/project/src/preprocess.py
preprocess.py
py
2,460
python
en
code
0
github-code
50
3319870177
class LLQueue: class Node: def __init__(self, data=None, next=None, prev=None) -> None: self.data = data if data != None else None self.next = next if next != None else None self.prev = prev if prev != None else None def __init__(self, items=None) -> None: #...
erumtw/oods-in-practice
5_LinkedList/Untitled-1.py
Untitled-1.py
py
1,876
python
en
code
0
github-code
50
37454116649
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import re import time from pprint import pprint from warnings import warn from datetime import datetime import itertools import inspect from bidi import algorithm as bidi import matplotlib.dates as mdates import matplotlib.tick...
ido90/News
Analyzer/BasicAnalyzer.py
BasicAnalyzer.py
py
13,277
python
en
code
1
github-code
50
12272900226
import argparse def load(filepath): """Loads data from file to database""" try: with open(filepath) as file_: for line in file_: print(line) except FileNotFoundError as e: print(f"File not found {e}") def main(): parser = argparse.ArgumentParser( ...
brunoades/dundie-rewards
dundie/__main__.py
__main__.py
py
836
python
en
code
0
github-code
50
28609719527
import os from PyQt4 import QtGui, uic from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import QWebView from qgis.gui import * import plotly from plotly.graph_objs import Scatter, Box, Layout FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'ui/data_plot_dialog_bas...
mdouchin/DataPlot
data_plot_dialog.py
data_plot_dialog.py
py
3,341
python
en
code
0
github-code
50
20296661811
import logging from google.protobuf.json_format import MessageToDict, ParseDict from serving.core.error_code import ExistBackendError, RunTimeException, CreateAndLoadModelError, ListOneBackendError, \ ReloadModelOnBackendError, TerminateBackendError from serving.core import error_reply from ..core import backen...
JK-97/ai-serving
src/serving/handler/backend.py
backend.py
py
3,878
python
en
code
2
github-code
50
42015918298
import json import urllib from settings import SERVER_BASE_URL HEADERS = {'Content-Type': 'application/json'} def get_nodes(http_client, noun): noun = urllib.quote_plus(noun) result = http_client.get('''{0}/nodes?where={{"noun": "{1}"}}'''.format(SERVER_BASE_URL, noun), headers=HEADERS) items = result.js...
mpmenne/global-hack-II
gh2insertworker/nodes.py
nodes.py
py
635
python
en
code
0
github-code
50
42596275000
import numpy as np import dolfin from dolfin import * from mpi4py import MPI as pyMPI comm = pyMPI.COMM_WORLD mpi_comm = MPI.comm_world #load mesh,boundaries and coefficients from file mark = {"Internal":0, "wall": 1,"inlet": 2,"outlet": 3 } #read mesh and boundaries from file mesh = Mesh() hdf = HDF5File(mesh.mpi_...
BinWang0213/TemporaryProject
hdg_test/2d/cg_test.py
cg_test.py
py
2,253
python
en
code
1
github-code
50
24020092678
import os import mne import yaml import json import pickle import numpy as np import scipy as sp import pandas as pd import nibabel as nb import matplotlib.pyplot as plt from inspect import getsourcefile from .acquisition import Acquisition2kHz, Acquisition10kHz # quick function for coreg checking def plot_overlay...
spinoza-centre/prf-seeg
prfseeg/patient.py
patient.py
py
8,674
python
en
code
2
github-code
50
32115803578
import csv def setAmount(): data_string = [] with open('500_constituents_financial.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') check = False for row in csv_reader: if check: data_string.append(row) check = True return d...
MinTimmy/Data_Structure
First_semester/Demo1/all/test10.py
test10.py
py
1,176
python
en
code
0
github-code
50
38409639622
import boto3 import email import json import urllib.parse from datetime import datetime from sms_spam_classifier_utilities import one_hot_encode from sms_spam_classifier_utilities import vectorize_sequences region = 'us-east-1' s3_client = boto3.client('s3') sagemaker_client = boto3.client('runtime.sagemaker') ses_cl...
reganbragg/cloud-hw3-ML-spam-detector
Lambda/lambda_function.py
lambda_function.py
py
4,305
python
en
code
1
github-code
50
11017700567
"""Our main visual theme""" import os import serge.blocks.themes W, H = 800, 600 theme = serge.blocks.themes.Manager() theme.load({ 'main': ('', { # Main properties 'screen-height': H, 'screen-width': W, 'screen-title': 'bomberman', 'screen-icon-filename': 'icon.png', 'screenshot-size':...
IndexErrorCoders/PygamesCompilation
IE_games_2/bombr-0.3/game/theme.py
theme.py
py
14,528
python
en
code
2
github-code
50
19524836247
from urllib import request import http.cookiejar import re def getXsrf(data): cer = re.compile('name=\"_xsrf\" value=\"(.*)\"', flags=0) strlist = cer.findall(data) return strlist[0] def makeMyOpener(head={ 'Connection': 'Keep-Alive', 'Accept': 'text/html, application/xhtml+xml, */*', 'Accep...
minghzhang007/python-learn
pythondemo1/crawler/demo4.py
demo4.py
py
900
python
en
code
0
github-code
50
19942848799
from socket import MSG_CONFIRM from nonebot.adapters.onebot.v11 import Bot, MessageEvent, MessageSegment from nonebot import on_command from jmcomic import * from jmcomic.jm_option import * jm = on_command("jm", aliases={"JM"}, priority=2, block=True) search = on_command("search", priority=2, block=True) jm_option = c...
kyoshiki214/nonebot_kou
src/plugins/jm/__init__.py
__init__.py
py
3,410
python
en
code
0
github-code
50
27386022394
# sort() method = used with lists # sort() function = used with iterables student = ["Squidward", "Sandy", "Patrick", "Spongebob", "Mr. Krabs"] #Only works with lists not tuples student.sort() #alphabetical order. student.sort(reverse=True) will do reverse alphabetical order for i in student: print (i) pri...
18gwoo/Python-Practice
BroCode52_Python_Sort.py
BroCode52_Python_Sort.py
py
1,597
python
en
code
0
github-code
50
17403548098
#!/home/mark/phd/venv/bin/python # coding: utf-8 """Function to persist experiment results.""" from typing import Dict from typing import Any from typing import Optional import torch as th from hashlib import sha256 from base64 import b64encode from os import makedirs from os.path import isdir from os.path import ba...
MarkTuddenham/pytorch_research
pytorch_research/persist.py
persist.py
py
2,139
python
en
code
0
github-code
50
42577337398
def flatten(list): return aflatten(list, []) def aflatten(list, a): for i in list: print(i) try: if len(i)>1: a=aflatten(i,a) except: a.append(i) return a print(flatten([[1,1],2,[1,1]]))
RamonRomeroQro/ProgrammingPractice
code/FlattenNestedList.py
FlattenNestedList.py
py
265
python
en
code
1
github-code
50
40209166347
#! /usr/bin/env python import argparse import os import sys import json import math import pickle import torch import numpy as np from scipy.stats import entropy from datasets import load_dataset from transformers import AutoTokenizer, AutoModelForQuestionAnswering from models import ElectraQA parser = argparse.A...
VatsalRaina/question_answering_squad2
combo_electra/entropy_large.py
entropy_large.py
py
5,053
python
en
code
0
github-code
50
13194295159
""" You're given the root node of a Binary Tree. Write a function that returns true if this Binary Tree is height balanced and false if it isn't. A Binary Tree is height balanced if for each node in the tree, the difference between the height of its left subtree and the height of its right subtree is at most 1. Ea...
rageshn/AlgoExpert
BinaryTrees/height-balanced-binary-tree.py
height-balanced-binary-tree.py
py
2,620
python
en
code
0
github-code
50
12415513344
import numpy as np import os import turtle import time import random import pyaudio import sys import struct from datetime import datetime # Config INITIAL_TAP_THRESHOLD = 0.010 FORMAT = pyaudio.paInt16 SHORT_NORMALIZE = (1.0/32768.0) CHANNELS = 2 RATE = 44100 INPUT_BLOCK_TIME = 0.05 INPUT_FRAMES_PER_BLOCK = int(RA...
T4w51f/StadiumExperiment
module_4_experiment.py
module_4_experiment.py
py
5,645
python
en
code
0
github-code
50
72926904475
from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.scrollview import ScrollView from kivy.core.audio import SoundLoader import csv import math class RadioApp(App): def build(self): self.title = 'Offline Radio A...
Turyamureeba/radio
radio.py
radio.py
py
3,721
python
en
code
0
github-code
50
72087492955
def nb_voyelles(chaine): "Retourner le nombre de voyelles présentes dans une chaîne donnée" liste_voyelles = ["a", "A", "e", "E", "i","I", "o","O", "u","U", "y","Y"] # Liste qui contient les voyelles (en maj. et en min.) auxquelles seront comparés les caractères de la chaîne n_voyelles = 0 # Nombre de voye...
terenceithaque/stage-python-2022-2023
nb_voyelles.py
nb_voyelles.py
py
763
python
fr
code
0
github-code
50
21277287943
''' Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume NO duplicates in the array. Example [1,3,5,6], 5 → 2 [1,3,5,6], 2 → 1 [1,3,5,6], 7 → 4 [1,3,5,6], 0 → 0 Challenge O(log(n)) time ''' class S...
dragonforce2010/interview-algothims
lecture_basic/Lecture2.Binary_Search/60. Search Insert Position.py
60. Search Insert Position.py
py
782
python
en
code
19
github-code
50
15981818502
import pickle import pprint import time from selenium import webdriver def save_cookies(driver, location): pickle.dump(driver.get_cookies(), open(location, "wb")) def load_cookies(driver, location, url=None): cookies = pickle.load(open(location, "rb")) driver.delete_all_cookies() # have to be on ...
ArturSpirin/YouTube-WebDriver-Tutorials
Cookies.py
Cookies.py
py
2,582
python
en
code
44
github-code
50
74816851036
import argparse import txaio txaio.use_twisted() from autobahn.twisted.util import sleep from autobahn.wamp.types import PublishOptions from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner from autobahn.wamp.serializer import JsonSerializer, CBORSerializer, MsgPackSerializer class ClientSession(A...
crossbario/crossbar-examples
stats/client.py
client.py
py
2,951
python
en
code
169
github-code
50
11939063154
__all__ = ['unet_v', 'unet_v2', 'hourglass_wres', 'hourglass_wores', 'unet_v_synth', 'unet_v2_synth', 'hourglass_wres_synth', 'hourglass_wores_synth', 'unet_v_tr', 'hourglass_wres_tr', 'unet_v_k5', ...
shiveshc/NIDDL
cnn_archs/__init__.py
__init__.py
py
402
python
en
code
4
github-code
50
32826423573
import logging import logging.config from logging.handlers import RotatingFileHandler def init_service_logger(): logger = logging.getLogger('TRANSFER-LOGGER') logging.getLogger('TRANSFER-LOGGER').addHandler(logging.StreamHandler()) logger.setLevel(logging.INFO) fh = logging.FileHandler(f"/home/doc/Or...
Shamil-G/OraclePostgreTransfer
util/logger.py
logger.py
py
715
python
en
code
0
github-code
50