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
16521320986
import os import json import discord from discord.ext import commands import asyncio import time class ShopCog(commands.Cog): def __init__(self, bot): self.bot = bot # Load money from money.json with open("money.json", "r") as f: self.money = json.load(f) ...
frozuu/Python-Discord-bot-w-cogs
cogs/ShopCog.py
ShopCog.py
py
6,063
python
en
code
0
github-code
13
41993329289
import argparse def textToBed(input_text_file, output_bed_file, chromosome_number): data = open(input_text_file, 'r') data = data.readlines() f = open(output_bed_file, "w") adjust = 1 #adjust for quadron to bed conversion: bed file is zero-based for i in range(0, len(data)): crit = data[i].split() ...
kxk302/Quadron_Docker
scripts/quadron_txt2bed.py
quadron_txt2bed.py
py
988
python
en
code
0
github-code
13
70632726738
from sklearn.neighbors import KNeighborsClassifier import lvq_common as lvqc import numpy as np e = 1e-12 def gen_prototypes(x, y, num_protos): protos_x, protos_y = lvqc.get_random_prototypes(x, y, num_protos) classifier = KNeighborsClassifier(n_neighbors=2) classifier.fit(protos_x, protos_y) neighbo...
augustoolucas/IF699-Machine-Learning
lista2/lvq31.py
lvq31.py
py
1,680
python
en
code
0
github-code
13
74292553937
# Kutay Cinar # V00****** # CSC 361: Assingment 3 import sys import struct class GlobalHeader: magic_number = None # uint32 version_minor = None # uint16 version_major = None # uint16 thiszone = None # int32 sigfigs = None # uint32 snaplen = None # uint32 network = None # uint32 ...
kutaycinar/CSC-361
Assignment 3/TraceRouteAnalyzer.py
TraceRouteAnalyzer.py
py
12,281
python
en
code
0
github-code
13
31878434243
import subprocess import re import pandas as pd import numpy as np from path_configure import * def run_subprocess(command,quiet=False,dry=False): print("------{}-----".format("RUN")) print(command) if dry: return process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subpr...
chanwkimlab/MHC_Kor_Assoc
basic_tools.py
basic_tools.py
py
1,977
python
en
code
1
github-code
13
29902532303
def transformaEmLista(str1): #Transforma uma string em uma lista lista = [] for x in str1: lista.append(x) return lista def transformaEmString(lista): str1 = '' for i in lista: if(i!=' ' and i!=',' and i!='[' and i!=']' and i!="'"): i = str(i) str1 = str1+ i ...
PabloAbreu95/ProcessadorRISC
manip_strings_listas.py
manip_strings_listas.py
py
1,388
python
pt
code
0
github-code
13
34888165041
import os import pickle import re # check to see if the file exists, then load the file, else return the empty dictionary def load(): """ load student information from file""" info = {} if os.path.exists("student.txt"): with open("student.txt", "rb") as input_char: info = pickle.load(...
aberu78/pythonclass
main.py
main.py
py
4,299
python
en
code
0
github-code
13
40928153658
from flask import Flask, request app = Flask(__name__) @app.route('/hello', methods=["POST"]) def index(): username= request.form.get('username') print('username=', username) # 逻辑判断 msg = {"code": 200, 'msg': 'success'} return msg if __name__ == '__main__': app.run(host='0.0.0.0', port=...
EpitomM/yolov5
server_test.py
server_test.py
py
351
python
en
code
0
github-code
13
26159378660
#!/usr/bin/python3 def find_duplicate(chars): for char in chars: if chars.count(char) > 1: return True def find_start(input_string): a=0 start_char = 0 length = 14 while a < len(input_string): sub_string = input_string[a:length+a] print(sub_string) if fi...
maartenstorm/AdventOfCode
day06/day06b.py
day06b.py
py
913
python
en
code
0
github-code
13
23713579360
from django.shortcuts import render,redirect from .models import Task from .forms import TaskForm from django.utils.text import slugify # Create your views here. def home(request): task_form = TaskForm() tasks = Task.objects.all() if request.method == "POST": task_form = TaskForm(data=request.POST)...
HanZawNyine/WebDevelopment2022182
Project-for-Django-Lessons/todoproject/todo/views.py
views.py
py
1,348
python
en
code
0
github-code
13
19714942887
# ************* function based views******************* from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from django.template import loader,RequestContext from . models import * from .form import BookForm from django.shortcuts import render, redirect from django.contrib import...
ekshams/my_libra
library/views_t.py
views_t.py
py
2,459
python
en
code
0
github-code
13
35317322076
#code to show only skin color trial and error import cv2 import numpy as np cap=cv2.VideoCapture(0) while True: ret,frame=cap.read() hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) low_skin=np.array([0,30,60]) up_skin=np.array([20,150,255]) mask=cv2.inRange(hsv,low_skin,up_skin) result=cv2.bitwise...
htgdokania/hand_gesture_masking
hand.py
hand.py
py
613
python
en
code
0
github-code
13
22270259859
from xml.dom import ValidationErr import pygame import settings import time import random pygame.init() blue = (0,0,255) black = (0,0,0) red = (255,0,0) white = (255,255,255) dis = pygame.display.set_mode((settings.WIDTH, settings.HEIGHT)) pygame.display.set_caption("Snake Game JRY62") x1 = sett...
jry62/snake_game
snake.py
snake.py
py
3,560
python
en
code
0
github-code
13
6979191684
import csv from myapp.models import KnowledgeBase # Replace 'myapp' with the name of your Django app def import_data_from_csv(file_path): with open(file_path, 'r') as csv_file: csv_reader = csv.reader(csv_file) next(csv_reader) # Skip the header row if it exists in your CSV file ...
devdattatemgire/StressAdaptiveReading2
portfolio/knowledegebase_init.py
knowledegebase_init.py
py
1,007
python
en
code
0
github-code
13
29287369648
# -------------- #Importing header files import pandas as pd import matplotlib.pyplot as plt import seaborn as sns #Code starts here data = pd.read_csv(path) data =data[data['Rating'] <=5] print(data.head()) print(data.shape) plt.hist(data['Rating']) #Code ends here # -------------- # code starts here total_...
Suchitra-Majumdar/ga-learner-dsmp-repo
High-Rated-Games-on-Google-Playstore/code.py
code.py
py
3,382
python
en
code
0
github-code
13
35805777753
# Описати клас "Банківський рахунок", атрибути якого: # # - ім'я облікового запису - str # - унікальний id (uuid) # - баланс float (чи Decimal) # - транзакції (список) # Методи # # депозит коштів # виведення коштів # отримати баланс # # # При зміні балансу записувати в транзакції (сума,...
KiraGol/hillel_python_basic
homework_9/bank_acc.py
bank_acc.py
py
2,258
python
uk
code
0
github-code
13
71773490258
import numpy as np from matplotlib import pyplot as plt from tqdm import tqdm import imageio import os import argparse def make_gif(): args = getArgs() path = args.input_path filenames = os.listdir(path) print(filenames[0:5]) images = [] for filename in tqdm(filenames): images.append(i...
Kaczmarekrr/2022L-Computer-modeling-of-physical-phenomena
04-25/make_gif.py
make_gif.py
py
809
python
en
code
0
github-code
13
46383974104
from itertools import count from collections import OrderedDict from bs4 import BeautifulSoup import requests import urllib.request as req def get_url(): url = "https://search.naver.com/search.naver" hrd = {'User-Agent' : 'Mozilla/5.0', 'referer' : 'http://naver.com'} post_dict = OrderedDict() cnt = 1 query = ...
sieun-Bae/electronic-cars_PJT
final_url.py
final_url.py
py
1,709
python
en
code
0
github-code
13
14191673482
import cv2 face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') video = cv2.VideoCapture(0) # address = "https://192.168.1.5:8080/video" # video.open(address) while True: check, frame = video.read() # frame = cv2.flip(frame ,1) gray = cv2.cvtColor(frame, cv...
MOHAMMED-NASSER22/PycharmProjects
funStuff/ip wepcam.py
ip wepcam.py
py
634
python
en
code
0
github-code
13
4825959562
""" Startup main window """ import os import platform from distutils.dir_util import copy_tree import uuid from Qt import QtCore, QtWidgets, QtGui from core import definitions from core import resource from core import path_maker import utilsa logging = utilsa.Logger('armada') USER, WORKSPACE = ('user', 'workspace...
Knufflebeast/armada-pipeline
packages/startup/gui/login_flow.py
login_flow.py
py
9,607
python
en
code
27
github-code
13
28350623073
import heapq from collections import Counter class Solution: def repeatLimitedString(self, s: str, repeatLimit: int) -> str: ans="" dic=Counter(s) size=0 heap=[] for i in dic: heapq.heappush(heap,(-ord(i),i)) size+=1 while heap: if ...
saurabhjain17/leetcode-coding-questions
2182-construct-string-with-repeat-limit/2182-construct-string-with-repeat-limit.py
2182-construct-string-with-repeat-limit.py
py
1,093
python
en
code
1
github-code
13
1943447211
import hashlib import json import os from time import time COIN_DIR = os.curdir + '/coins/' def check_coin(index): current_index = str(index) previous_index = str(int(index) - 1) current_proof = -1 current_hash = 0 previous_hash = 0 temp = {'coin' : '', 'result' : '', 'proof': ''} try...
dnl2612/coin
coin.py
coin.py
py
3,240
python
en
code
0
github-code
13
28457502066
import random import numpy as np class QAgent(): def __init__(self, actions, epsilon=0.1, alpha=0.2, gamma=0.9): self.q = {} self.epsilon = epsilon self.alpha = alpha self.gamma = gamma self.actions = actions def getQ(self, state, action): return self.q.get((st...
TheRealDrDre/CompCogNeuro
Part2_ReinforcementLearning/rl/qagent.py
qagent.py
py
3,398
python
en
code
3
github-code
13
36297423570
from flask import render_template, redirect, request, session from flask_app.config.mysqlconnection import connectToMySQL from flask_app.models.dojo import Dojo from flask_app import app @app.route("/") def index(): return redirect("/dojos") @app.route("/dojos") def dojos(): dojos = Dojo.get_all() return ...
Matthew-Luk/Python-Bootcamp
Flask_MySQL/CRUD/dojos_and_ninjas/flask_app/controllers/dojos.py
dojos.py
py
816
python
en
code
0
github-code
13
17051969404
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.PayUserInfoDTO import PayUserInfoDTO from alipay.aop.api.domain.PayUserInfoDTO import PayUserInfoDTO class FdsPayFundItemDTO(object): def __init__(self): self._amount...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/FdsPayFundItemDTO.py
FdsPayFundItemDTO.py
py
4,760
python
en
code
241
github-code
13
16982591527
import PySimpleGUI as sg import networkx as nx import matplotlib.pyplot as plt import kruskal as k def cria_graf(): sg.theme_background_color('#1C1C1C') sg.theme_text_color('#FFD700') sg.theme_button_color(('#273755', '#fad029')) layout1 = [ [sg.Text('Árvore Geradora Mínima', background_color=...
roberio3620/arvore-geradora-minima
main.py
main.py
py
2,832
python
en
code
0
github-code
13
4697178607
import pyautogui from src import movearrow import time import clipboard def VerifyStatus(): global itemID global status if pyautogui.locateOnScreen(image=".\images\pausadostatus.png"): status = True movearrow.MoveArrow(times=18, side="left") img = pyautogui.locateCenterOnScreen(imag...
carlynxd/automaticbacklog
src/verifystatus.py
verifystatus.py
py
835
python
en
code
0
github-code
13
17174829686
import argparse import pandas as pd def parse_args(): parser=argparse.ArgumentParser(description="use gencode annotation to get gene coordinates; add flanks of specified length with a stride of specific size") parser.add_argument("-gene_list") parser.add_argument("-gencode_gtf",default="/mnt/data/annotatio...
ENCODE-AWG/locusselect_applications
expression/get_expression_for_gene_list_ENCODE.py
get_expression_for_gene_list_ENCODE.py
py
1,839
python
en
code
0
github-code
13
16393535327
import boto import boto.s3.connection import os import secret access_key = secret.access_key secret_key = secret.secret_key conn = boto.connect_s3( aws_access_key_id=access_key, aws_secret_access_key=secret_key, host=secret.host, port=secret.port, is_secure=False, # uncomment if you are not using...
MinistrBob/MyPythonTools
S3/s3get.py
s3get.py
py
717
python
en
code
0
github-code
13
3725389290
"""Tools for running experiments with Garage.""" import base64 import collections import datetime import enum import functools import gc import inspect import json import os import os.path as osp import pathlib import pickle import re import subprocess import warnings import cloudpickle import dateutil.tz import dowel...
jaekyeom/IBOL
garaged/src/garage/experiment/experiment.py
experiment.py
py
30,422
python
en
code
28
github-code
13
20839368163
from django.conf.urls import url from . import views urlpatterns = [ url(r'^update/stock_info$', views.update_stock_info, name='update_stock_info'), url(r'^update/history$', views.update_history, name='update_history'), url(r'^update/tick_data$', views.update_tick_data, name='update_tick_data'), url(r...
flychensc/orange
storage/urls.py
urls.py
py
471
python
en
code
1
github-code
13
1693497793
__author__ = 'kwheelerj' # Show how to implement a queue using two stacks. Analyze the running time of the queue operations. class Queue: def __init__(self, length): self.length = length self.enqueue_stack = Stack(length) self.dequeue_stack = Stack(length) def enqueue(self, value): self.transfer_to_enqu...
kwheelerj/IntroToAlgorithms
Chapter10_ElementaryDataStructures/section_1/Exc_10.1-6.py
Exc_10.1-6.py
py
2,243
python
en
code
0
github-code
13
71201508817
from django.contrib.auth.models import Permission from django.test import TestCase, Client from django.urls import reverse from accounts.models import Account from .models import Lesson class LessonTestCase(TestCase): def setUp(self): perm = Permission.objects.get(name='Can see hidden lesson') ...
bugulin/gymgeek-web
lessons/tests.py
tests.py
py
1,706
python
en
code
0
github-code
13
35951180326
from python import * from python.cellfft import * import sys, os, shutil import subprocess OUT_DIR='out' CPP_DIR=os.path.join('test', 'twiddle') ARCH="gfx908" def run_cmd(cmd): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr = subprocess.STDOUT) try: (out, _) = p.communicate() if p.re...
ROCmSoftwarePlatform/MISA
test/twiddle/twiddle_test.py
twiddle_test.py
py
6,689
python
en
code
29
github-code
13
37984860572
#!/usr/bin/env python3 from threading import Condition import time from dr_hardware_tests.flight_predicate import is_offboard_mode from dr_hardware_tests.flight_helpers import enter_offboard_mode import rospy from dr_hardware_tests import Drone, SensorSynchronizer, SensorData, flight_helpers, sleep from dr_hardware_te...
DroneResponse/hardware-tests
nodes/arm.py
arm.py
py
1,918
python
en
code
0
github-code
13
38089302508
from drawer_v1 import Drawer from vec_v1 import Vec, Vec3 from line_v1 import Line, vec_prod from utils import read_points, prepare_points, add_prepare_args, init_tk_drawer import argparse import math DESCRIPTION = ''' Program to draw wurfs for contours ''' def parse_args(): parser = argparse.ArgumentParser( ...
savfod/contours_correspondence
code/draw_wurfs.py
draw_wurfs.py
py
21,982
python
en
code
0
github-code
13
21786353070
from volux import VoluxDemo class DemoAudio(VoluxDemo): def __init__(self, *args, **kwargs): super().__init__( demo_name="Demo Audio", demo_method=self.run_demo, alias="audio", requirements=["voluxaudio"], *args, **kwargs ) ...
DrTexx/Volux
volux/demos/audio.py
audio.py
py
1,077
python
en
code
7
github-code
13
26790084131
class Solution: def jump(self, nums: List[int]) -> int: n = len(nums) dp = [-1] * len(nums) dp[n-1] = 0 for i in range(n-1,-1,-1): reachables = [i + j for j in range(1,nums[i]+1) if i + j < n] if len(reachables) == 0: continue ...
forestphilosophy/LeetCode_solutions
Interview Questions/jump_game_ii.py
jump_game_ii.py
py
455
python
en
code
0
github-code
13
34512084211
import sys import sqlite3 from sqlite3 import Error class Database: def create_connection(db_file): """ create a database connection to a SQLite database """ try: conn = sqlite3.connect(db_file) return conn except Error as e: print(e) return None...
ohnoanarrow/Senior_Thesis
src/analysis/top_cards_db.py
top_cards_db.py
py
1,443
python
en
code
1
github-code
13
72337482257
""" """ # Native import os import time # 3rd-Party from flask import Flask, request, jsonify, send_from_directory # Proprietary app = Flask(__name__) UPLOAD_DIRECTORY = '/files' if not os.path.exists(UPLOAD_DIRECTORY): os.makedirs(UPLOAD_DIRECTORY) @app.route('/') def hello(): """ """ retu...
m3talstorm/flask-http-store
FHS-API/app/app.py
app.py
py
1,355
python
en
code
1
github-code
13
18711583543
from collections import defaultdict # class collections.defaultdict([default_factory[, ...]]) # 返回一个新的类似字典的对象。 defaultdict 是内置 dict 类的子类。 # 它重载了一个方法并添加了一个可写的实例变量。其余的功能与 dict 类相同,此处不再重复说明。 # 本对象包含一个名为 default_factory 的属性,构造时,第一个参数用于为该属性提供初始值,默认为 None。 # 所有其他参数(包括关键字参数)都相当于传递给 dict 的构造函数。 # __missing__(key) # 如果 d...
russellgao/algorithm
ProgrammingLanuage/python/collecttions/collections_defaultdict.py
collections_defaultdict.py
py
2,458
python
zh
code
3
github-code
13
35543126242
#!/usr/bin/python from helper import * from config import * display_header() ticket = '' def handle_claims_gathering_response(): global ticket if is_ticket_in_url(): arguments = cgi.FieldStorage() ticket = arguments['ticket'].value # Here is my PCT token! # Client attempts t...
aleclaws/gg-demo-fpx
index.py
index.py
py
1,401
python
en
code
0
github-code
13
44464473391
import tensorflow as tf import time import numpy as np from reader import * import os import warnings import metric try: import neptune except ImportError: warnings.warn('neptune module is not installed (used for logging)', ImportWarning) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' def get_angles(pos, i, d_mo...
pixelneo/dialogue-transformer-e2e
implementation/tf/transformer.py
transformer.py
py
29,573
python
en
code
5
github-code
13
10273618549
from protocolo import * MAX_SEQ = 7 # Define una constante para el número máximo de secuencia. # Función que determina si un número se encuentra en un rango circular. def between(a, b, c): # Los números son tratados como si estuvieran en un círculo, y esta función determina si b está entre a y c en ese círculo. ...
johanec/Proyecto1-Redes
backend/go_back_n.py
go_back_n.py
py
3,999
python
es
code
0
github-code
13
16276353444
import json import numpy as np from utils import * def prepare_data(): vec = DictVectorizer() data = pd.read_csv('蘑菇分类数据集.csv') data_array = np.hstack([data['class'].values.reshape(-1, 1), vec.fit_transform(data.drop(['class', 'odor', 'stalk-color-below-ring'], axis=1).to_dic...
MosRat/BnuMcLab
MCExp5/dataset.py
dataset.py
py
4,215
python
en
code
1
github-code
13
8208917014
"""CP1404 Practical 2 - Files""" # 1. Write code that asks the user for their name, then opens a file called "name.txt" and writes that name to it. name = input("What is your name: ") out_file = open('name.txt', 'w') print(name, file=out_file) out_file.close() # 2. Write code that opens "name.txt" and reads the name ...
McTenshi/cp1404practicals
prac_02/files.py
files.py
py
1,153
python
en
code
0
github-code
13
30583928238
# -*- coding: utf-8 -*- from ge.bpmc import MAX_BUSINESS_TASK_RETRIES, business from ge.bpmc.app.injection import Contexts, Core, Factories, Services from ge.bpmc.utilities.sqlalchemy import transaction app = Factories.celery_factory() @transaction(Core.logger, Contexts.em) def wrapped_match_procedure_images(proced...
dbenlopers/SANDBOX
misc/bpm_cloud/ge.bpmc/ge/bpmc/tasks/matching.py
matching.py
py
1,156
python
en
code
0
github-code
13
42747451874
#%% # # Project 1, starter code part b # import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import math import pandas as pd tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) def ffn(x, feature_size, neuron_size, weight_decay_beta, layers=3, dropout=False): """Feedforward net ...
eddylim95/CZ4042_NeuralNet_project
Assignment_1/start_project_1b.py
start_project_1b.py
py
12,200
python
en
code
1
github-code
13
26781712662
""" :Module: shopify_crawler.py :Author: Peter Hyl :Description: This module contains web crawler and other necessary function which from input csv file load shopify urls to crawl. Collecting emails, facebook, twitter and first N products, then save this data to ...
peterhyl/codes
Python/shopify_crawler.py
shopify_crawler.py
py
9,845
python
en
code
0
github-code
13
31006637522
import numpy as np import argparse import cv2 ap = argparse.ArgumentParser() ap.add_argument("-v", "--video", help="path to the video file") ap.add_argument("-a", "--min-area", type=int, default=500, help="minimum area size") args = vars(ap.parse_args()) cap = cv2.VideoCapture(args["video"]) #while(cap.isOpened()): ...
eric-macdonald/opencv
play_video.py
play_video.py
py
781
python
en
code
2
github-code
13
71257258899
import openpyxl # Buka file Excel workbook = openpyxl.load_workbook("file.xlsx") # Dapatkan sheet pertama sheet = workbook.worksheets[0] # Cetak nama kolom for column in sheet.columns: print(column[0].value) # Cetak data dari baris pertama for row in sheet.rows: for cell in row: print(cell.value, en...
ugunNet21/learn-python
advanced/readexcel.py
readexcel.py
py
340
python
en
code
1
github-code
13
37952889918
############################################################### # # Job options file to read charge interpolation constants from # text file and output a new pool file and sqlite file # #============================================================== if 'WRITEDB' in dir() and WRITEDB: dowrite=TRUE doread=FALSE co...
rushioda/PIXELVALID_athena
athena/InnerDetector/InDetConditions/PixelConditionsTools/share/PixelOfflineCalibDbInteraction.py
PixelOfflineCalibDbInteraction.py
py
3,475
python
en
code
1
github-code
13
10328771617
def is_palindromic(number: int) -> bool: number_as_list = list(str(number)) reversed_number_list = number_as_list[::-1] reversed_number_str = ''.join(reversed_number_list) reversed_number = int(reversed_number_str) if reversed_number == number: return True return False def solution(num...
Irench1k/ProjectEuler
problems/problem4/p4.py
p4.py
py
872
python
en
code
0
github-code
13
26473998288
from optimization.src.TSPOptimizerStrategy import TSPOptimizerStrategy class TSPOptimizerClosestCityStrategy(TSPOptimizerStrategy): def __init__(self, origin_city, cities): TSPOptimizerStrategy.__init__(self, origin_city, cities) self.visited_cities = {} for city in self.cities: ...
marianoo-andres/EasyTripServer
optimization/src/TSPOptimizerClosestCityStrategy.py
TSPOptimizerClosestCityStrategy.py
py
1,378
python
en
code
0
github-code
13
22478702775
''' 1. 从wiki_crop里面按一些条件筛选图片 2. 将人脸部分裁剪出来 3. 文件名包含性别和年龄 4. 放入images-<dataset-size>文件夹 ''' import scipy.io as sio import cv2 import os face_cascade = cv2.CascadeClassifier('H:/venvs/pytorch-cpu/Lib/site-packages/cv2/data/haarcascade_frontalface_default.xml') root = "./wiki_crop/" path = "wiki.mat" data = sio.loadmat(...
NICE-FUTURE/predict-gender-and-age-from-camera
data/process_wiki_data.py
process_wiki_data.py
py
2,650
python
en
code
33
github-code
13
2867260268
import os import numpy as np import torch import pdb import cleaner import load_args import utils # Parse the commandline arguments args = load_args.load_args() # Create the config dictionary cfg = utils.load_config(args) # Get the class IDs for the novel set of classes novel_class_ids = utils.get_novel_class_ids...
google-research/noisy-fewshot-learning
run.py
run.py
py
1,981
python
en
code
23
github-code
13
29604103889
import socket from time import sleep, time HOST = '127.0.0.1' PORT = 50007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() print('working') def listen(): # produces encoder values for the wheels. returns right wheel value, left wheel value. ...
shimonfiddler/1420
encodedbotmover.py
encodedbotmover.py
py
1,430
python
en
code
0
github-code
13
31075988506
import numpy as np from utils import wrapToPi def ctrl_pose(x,y,th,x_g,y_g,th_g): # (x,y,th): current state # (x_g,y_g,th_g): desired final state # Code pose controller k = np.array([0.5, 0.5, 1.2]) # (k1,k2,k3) > 0 # Incremental change in state dx = x_g - x dy = y_g - y # Convert to...
anqif/AA274_HW1
P3_pose_stabilization.py
P3_pose_stabilization.py
py
742
python
en
code
1
github-code
13
24384537992
import matplotlib.pyplot as plt import sys # import numpy as np # plt.rcParams['font.sas-serig']=['SimHei'] #用来正常显示中文标签 # plt.rcParams['axes.unicode_minus']=False #用来正常显示负号 # data=np.loadtxt('loss.txt',delimiter='\t') # print(data) # x = [row[0] for row in data] # y = [row[3] for row in data] # z = [row[4] for row in ...
Linzmin1927/darknet_chs
python/loss_display.py
loss_display.py
py
983
python
en
code
2
github-code
13
32456364693
"""Utils for tracking graph homophily and heterophily""" # pylint: disable=W0611 from . import function as fn, to_bidirected try: import torch except ImportError: HAS_TORCH = False else: HAS_TORCH = True __all__ = [ "node_homophily", "edge_homophily", "linkx_homophily", "adjusted_homophily...
keli-wen/dgl
python/dgl/homophily.py
homophily.py
py
8,309
python
en
code
null
github-code
13
34337338932
class Universal: data_type = 'Universal' data_types = set() data_keys = [] instances = {} def __init__(self, datas=None): self.__datas = datas def __repr__(self): return f'{self.__datas}' def get_data(self, key): return self.__datas[key] def set...
JJeKJJeKeee/Python_study
Universal_v1.py
Universal_v1.py
py
2,122
python
en
code
0
github-code
13
72304573139
from entry_task.models import User, EventInfo, Event, EventLike, EventParticipation, EventComment, Image from entry_task.helpers import event_helpers from entry_task.exceptions import InsertError,NotFoundError def get_event(event_id): try: event_info = EventInfo.objects.get(event_id=event_id) part...
hvloc15/Entry-Task
EntryTask/entry_task/services/event_services.py
event_services.py
py
1,687
python
en
code
0
github-code
13
37948249668
from AthenaCommon import Logging from .non_blocking_stream_reader import NonBlockingStreamReader import subprocess ## Get handle to Athena logging logger = Logging.logging.getLogger("PowhegControl") class ProcessManager(object): """! Wrapper to handle multiple Powheg subprocesses. @author James Robinson <j...
rushioda/PIXELVALID_athena
athena/Generators/PowhegControl/python/utility/process_handling.py
process_handling.py
py
5,409
python
en
code
1
github-code
13
2355049493
''' This module contains all of the !commands that the users can call upon for execution. ''' from functions import chat as _chat from functions import queryAPI as _queryAPI from functions import getXMLAttributes as _getXMLAttributes from functions import isOp as _isOp from functions import printv as _printv from func...
matty-jones/blaskbot
commands.py
commands.py
py
29,017
python
en
code
3
github-code
13
14914759023
import numpy as np import multiprocessing as mp import time, os import numpy.linalg as LA import subprocess as sp from random import random import Model_Miller_3 as model def getGlobalParams(): global dtE, dtI, NSteps, NTraj, NStates, M, windowtype global adjustedgamma, NCPUS, initstate, dirName, NSkip d...
bradenmweight/QuantumDynamicsMethodsSuite
MQC/SQC.py
SQC.py
py
7,401
python
en
code
2
github-code
13
71347649618
from django.shortcuts import render, get_object_or_404 from django.contrib.auth.decorators import login_required from .models import Products, Distributor @login_required def index(request): products = Products.objects.all() template = 'products/index.html' context = { 'products': products, } return render(req...
diego-lucas/system-d
system/products/views.py
views.py
py
748
python
en
code
0
github-code
13
70102289939
import tkinter as tk # if you are still working under a Python 2 version, # comment out the previous line and uncomment the following line # import Tkinter as tk # root = tk.Tk() # # w = tk.Label(root, text="Hello Tkinter!") # w.pack() # # root.mainloop() root = tk.Tk() logo = tk.PhotoImage(file="logo64.gif") w1 = ...
cyoukaikai/ahc_ete
smrc/utils/test/test_tk.py
test_tk.py
py
669
python
en
code
2
github-code
13
72349882258
import logging import threading from articleRec import handler as articleRecHandler from topicModeling import handler as topicModelingHandler from mdsModel.handler import * from datetime import datetime from idl import * from userPreferences import handler as upHandler from topicFeed import handler as topicFeedHandler ...
aiswaryasankar/dbrief
homeFeed/handler.py
handler.py
py
5,798
python
en
code
1
github-code
13
20999094983
from sklearn.decomposition import PCA from scipy.cluster.vq import kmeans2 import numpy as np def calculate_pca(embeddings, dim=16): print("Calculating PCA") pca = PCA(n_components=dim) pca_embeddings = pca.fit_transform(embeddings.squeeze()) print("PCA calculating done!") return pca_embeddings ...
cobanov/image-clustering
clustering.py
clustering.py
py
547
python
en
code
8
github-code
13
9838513736
import argparse import numpy as np import matplotlib.pyplot as plt import gym import time from environments.swingup import CartPoleSwingUp from environments.pongwrapper import PongWrapper plt.style.use("dark_background") def demo_cartpole(): cartpole = gym.make('CartPole-v1') cartpole.reset() cartpole...
amtoine/dqn
src/demo.py
demo.py
py
1,809
python
en
code
0
github-code
13
1397428241
#Libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd import tkinter as tk import sys import time import os from PIL import Image, ImageOps from collections import defaultdict #Set File file = sys.argv[1] with open(file) as myfile: head = [next(myfile) for x in range(5)] if (head[0][0:...
RiceAllDay22/Hele-Shaw-Model
MainHeleCode.py
MainHeleCode.py
py
4,683
python
en
code
0
github-code
13
5411171947
import os import numpy as np from pylab import mpl import matplotlib.pyplot as plt import coordinate_transformation as ct ref = [] data_allday = [[], [], [], [], [], [], [], [], [], [], [], []] x = [] y = [] z = [] X = [] Y = [] Z = [] result_XYZ = [[], [], []] result_ENU = [[], [], []] plot_ENU = [...
FLAGLEE/My_Python_Code
two_hour_solution.py
two_hour_solution.py
py
3,495
python
en
code
0
github-code
13
31048041906
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import asyncio import os import pickle from pprint import pprint import structlog import aiohttp import arrow import ujson class Verisure: log = structlog.get_logger(__name__) def __init__(self, mfa: bool, username, password, cookieFileName='~/.verisure_mfa_c...
Soleg06/Verisure_API
verisureGrafqlAPI_async.py
verisureGrafqlAPI_async.py
py
39,369
python
en
code
1
github-code
13
3721332770
''' Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. ''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left...
JaeEon-Ryu/Coding_test
LeetCode/0199_ Binary Tree Right Side View.py
0199_ Binary Tree Right Side View.py
py
794
python
en
code
1
github-code
13
46200892704
#!/usr/bin/env python3 """LAN monitor stock notifications handler """ __version__ = "3.1" #========================================================== # # Chris Nelson, Copyright 2021-2023 # # 3.1 230320 - Debug mode status dump # 3.0 230301 - Packaged # V2.0 221130 Dropped --once, added --service. Added on-dema...
cjnaz/lanmonitor
src/lanmonitor/stock_notif.py
stock_notif.py
py
9,608
python
en
code
2
github-code
13
71031628817
from flask import Flask, render_template, url_for, request app = Flask(__name__) import pyshorteners import pyperclip def shortenit(longurl): s = pyshorteners.Shortener() url = longurl; shorturl= s.tinyurl.short(url) return shorturl def convert(longurl): if ' ' in longurl: return "Remove...
priyanshuv-raw/CodeClauseInternship_URLShortner
run.py
run.py
py
863
python
en
code
0
github-code
13
38320405981
import datetime from django.db.models import Q from django.http import Http404 from rest_framework import status from rest_framework import generics from rest_framework.response import Response from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.views import APIView from rest_framewor...
tanmaypardeshi/Loan-Management-System
backend/user/views.py
views.py
py
7,044
python
en
code
6
github-code
13
31126770234
import pandas as pd path = "/Users/davidaxelrod/Documents/solarcities/census.csv" # Make a row iterator (this will go row by row) from app import models head = True escapes = ''.join([chr(char) for char in range(1, 32)]) with open(path, 'rb') as f: for line in f: if not head: data=str(line).split("...
daxaxelrod/solarcities
app/census_creation.py
census_creation.py
py
507
python
en
code
0
github-code
13
13377921481
import pandas as pd import matplotlib.pyplot as plt csv_file='sherry.csv' data = pd.read_csv(csv_file) likes = list(data["likes"])[:50][::-1] timestamp = list(data["time"])[:50][::-1] x= timestamp y= likes plt.scatter(x,y) plt.xlabel('timestamp->') plt.ylabel('likes->') plt.title('Insta') plt.show()
tlylt/Social-Media-Dashboard
read_insta.py
read_insta.py
py
301
python
en
code
1
github-code
13
12349416124
import pygame, sys, os from pygame.locals import * from mainWindow import Window # Attempting to recreate a Snake clone BLACK = (0, 0, 0) window_width = 500 window_height = 500 pygame.init() fps = 30 fpsClock = pygame.time.Clock() main_surface = pygame.display.set_mode((window_width, window_height)) # Creating blo...
AlbertoEngineersEverything/pygaming
Chapter_16/Snake.py
Snake.py
py
764
python
en
code
0
github-code
13
18889537906
from django.urls import path from . import views urlpatterns = [ path('categories', views.product_categories, name='product_categories'), path('categories/products', views.all_products, name='products'), path('<int:product_id>/', views.design_product, name='design_product'), path('add/', views.add_prod...
natalijabujevic0708/DesignYourCrafts
products/urls.py
urls.py
py
507
python
en
code
0
github-code
13
31112195902
#Abrir uma sequência de imagens coloridas, transformar para tom de cinza cada imagem e obtenha os momentos centrais de todas estas imagens. Imprima os resultados de cada imagem em um arquivo e na tela do prompt de comandos. Cada linha do arquivo gerado deve representar os atributos obtidos em uma imagem. import cv2 im...
VivianeSouza923/ComputerVisionPy_Lapisco
47/questão47.py
questão47.py
py
1,389
python
pt
code
0
github-code
13
19219089807
n = int(input()) answer = 0 saving = {} values = [] num = 9 for _ in range(n): word = input() for s in range(len(word)): if word[s] in saving: saving[word[s]] += 10 ** (len(word) - 1 - s) else: saving[word[s]] = 10 ** (len(word) - 1 - s) # print(saving) ...
Choi-Jiwon-38/WINK-algorithm-study
week 7/단어 수학.py
단어 수학.py
py
491
python
en
code
0
github-code
13
33627649681
from django.urls import path from . import views app_name = "staking" urlpatterns = [ path("", views.IndexView, name="index"), path("stake/", views.StakeView, name="stake"), path("stake/metamask/", views.StakeWithMView, name="stake_metamask"), path("stake/metamask/pay/", views.StakeWithM2View, name="stake_meta...
lurdray/aibra.io-version2-
stake/urls.py
urls.py
py
668
python
en
code
0
github-code
13
35205361689
from util import aoc def look_and_say(model): last = model[0] n = 1 result = [] for c in model[1:]: if last == c: n += 1 else: result += str(n), last last = c n = 1 result += str(n), last return "".join(result) def part_one(mode...
barneyb/aoc-2023
python/aoc2015/day10/elves_look_elves_say.py
elves_look_elves_say.py
py
629
python
en
code
0
github-code
13
1378175911
# Import the required libraries from tkinter import * from tkinter import messagebox # Create an instance of tkinter frame or window win=Tk() # Set the size of the tkinter window win.geometry("700x350") def cal_sum(): t1=int(a.get()) t2=int(b.get()) sum=t1+t2 label.config(text=sum) # messagebox.showi...
Parth9780/Backend_12-SEP
Python 12_Sep/Practis/Tkinter/TTk.py
TTk.py
py
1,784
python
en
code
0
github-code
13
33626996203
from importlib import metadata # NOTE: importing to have the types registered import h5pyckle.interop_builtins import h5pyckle.interop_numpy # noqa: F401 from h5pyckle.base import ( PickleGroup, dump, dump_sequence_to_group, dump_to_attribute, dump_to_group, dumper, load, load_by_patte...
alexfikl/h5pyckle
h5pyckle/__init__.py
__init__.py
py
815
python
en
code
0
github-code
13
11192471439
from PIL import Image, ImageFilter, ImageOps img = Image.open('./cat.jpg') # cropping the body area of the cat img = img.crop((200, 125, 420, 310)) # Blurring the image img = img.filter(ImageFilter.GaussianBlur(6)) # then mirroring the image img = ImageOps.mirror(img) # and converting the image into black and white i...
AshuAhlawat/Python
Modules/Pillow/multiple.py
multiple.py
py
370
python
en
code
1
github-code
13
20280063552
import os import pandas as pd import numpy as np import xlrd from django.http import HttpResponse from django.shortcuts import render from openpyxl import load_workbook from elucidata import models # Create your views here. def ques1(request): context_dict = {} if request.method == 'POST': try: my_file = mod...
saket9000/Elucidata
elucidata/views.py
views.py
py
3,692
python
en
code
0
github-code
13
33586549169
import numpy as np import tensorflow as tf from tensorflow.python.keras import Sequential from tensorflow.python.keras.layers import Bidirectional from tensorflow.python.keras.layers import Dense from tensorflow.python.keras.layers import Embedding from tensorflow.python.keras.layers import GlobalAveragePooling1D fro...
vahedq/rumors
models/dl.py
dl.py
py
1,994
python
en
code
6
github-code
13
42148509924
# -*- coding: utf-8 -*- from setuptools import setup, find_packages try: long_description = open("README.md").read() except IOError: long_description = "" setup( name="openwhisk_docker_action", version="0.1.7", description="A class to make writing openwhisk docker actions easier to write in python...
kognate/openwhisk_docker_action
setup.py
setup.py
py
692
python
en
code
0
github-code
13
37197156044
import pymongo, time import sys # import scrapyd_api # from scrapyd_api import ScrapydAPI # import scrapyd_api # start = time.time() # client = pymongo.MongoClient("mongodb://zhubo:zb52971552@101.132.117.61:27017/admin") # Alice # client = pymongo.MongoClient("mongodb://zhubo:zb52971552@203.195.224.50:27017/a...
Mew97/atoz
mongo_db.py
mongo_db.py
py
2,715
python
en
code
0
github-code
13
40256619374
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 1 14:03:09 2022 @author: jonwinkelman """ import pysam import os import pd filepath = '/Users/jonwinkelman/Dropbox/Trestle_projects/Eustaquio_lab/Epigenetics_Project/RNAseq_bam_files/BAN-1.bam' def get_bam_pairs(filename): samfile = pysam.Align...
jtwinkel/eustaquio_epigenetics
Eustaquio_epigenetics/jw_utils/RNAseq_utils.py
RNAseq_utils.py
py
4,757
python
en
code
0
github-code
13
14277583916
import bpy, subprocess,ast, re from bpy.app.handlers import persistent from bpy.types import Operator import datetime class RENTASKLIST_OT_probar_modaltimer(Operator): bl_idname = "rentask.probar_modal_timer" bl_label = "Modal Timer Operator" _timer = None def modal(self, context, event): sc = bpy.context.scen...
Tilapiatsu/blender-custom_config
scripts/addon_library/local/render_task_list/rentask/op_rentask_probar.py
op_rentask_probar.py
py
1,221
python
en
code
5
github-code
13
2718481941
num_oper = input().split("-") nums = [] for i in range(len(num_oper)): nums.append(num_oper[i].split("+")) # print(nums) first = 0 minus = 0 for i in range(0, len(nums)): for j in range(len(nums[i])): if i == 0: first = first + int(nums[i][j]) else: minus = minus + int(...
jinlee9270/algo
InJungle/week04/1514.py
1514.py
py
354
python
en
code
0
github-code
13
27075850819
import os from dotenv import load_dotenv from langchain.llms import LlamaCpp import logging import spacy load_dotenv() class Configuration: _instance = None def __new__(cls): if not cls._instance: cls._instance = super(Configuration, cls).__new__(cls) cls._inst...
innermost47/autogenius-daily
config.py
config.py
py
2,197
python
en
code
5
github-code
13
24582992745
import numpy as np import pandas as pd import scipy.ndimage as nd from imageio import imsave as imsave2d from timagetk.components import SpatialImage from timagetk.io import imsave from timagetk.algorithms.trsf import allocate_c_bal_matrix, apply_trsf, create_trsf from timagetk.algorithms.reconstruction import pts2...
elifesciences-publications/sam_spaghetti
src/sam_spaghetti/signal_image_slices.py
signal_image_slices.py
py
29,239
python
en
code
0
github-code
13
71270841937
import os dir_path = os.path.dirname(os.path.realpath(__file__)) from collections import defaultdict CL = { '(': ')', '[': ']', '{': '}', '<': '>' } def part1(inp): global CL wrong = defaultdict(int) for line in inp: s = [] for c in line: if c in ['(', '<', '...
Lammatian/AdventOfCode
2021/src/day10/main.py
main.py
py
1,812
python
en
code
1
github-code
13
71645328019
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('seedbank', '0008_auto_20141206_1245'), ] operations = [ migrations.AlterField( model_name='seed', na...
briandant/echo-seeds
echo_seeds/seedbank/migrations/0009_auto_20141206_1307.py
0009_auto_20141206_1307.py
py
471
python
en
code
0
github-code
13
30313101620
import logging import signal import threading from flask_babel import lazy_gettext as l_ from xivo import plugin_helpers from .http_server import Server from wazo_ui.helpers.destination import register_destination_form from wazo_ui.helpers.error import ( ErrorExtractor, ErrorTranslator, ConfdErrorExtracto...
wazo-platform/wazo-ui
wazo_ui/controller.py
controller.py
py
3,275
python
en
code
4
github-code
13