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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
25037468288 | from ..db import db_client
from ..schemas.profile_schema import Profile
table = db_client.client.table("chats")
def create_new_chat(uuid: str, member_uuid: str):
return table.insert({
"member_a": uuid,
"member_b": member_uuid,
}).execute()
def get_user_chats(uuid: str):
member_a = tabl... | konn1ehuang/Backend | app/db/chat_crud.py | chat_crud.py | py | 492 | python | en | code | null | github-code | 1 |
25893932108 | import cards
import games
class BJ_Card(cards.Card):
ACE_VALUE = 1
@property
def value(self):
if self.is_face_up:
v = BJ_Card.RANKS.index(self.rank) + 1
if v > 10:
v = 10
else:
v = None
return v
class BJ_Deck(cards.Deck):
... | wessware/python_quick_learn_tutorial | black_jack_game/BJ_modularized/main_bj.py | main_bj.py | py | 4,196 | python | en | code | 1 | github-code | 1 |
37022580542 | SEED = 1988
DATATYPE_DICT = {
'count' : 'uint32',
'nunique' : 'uint32',
'cumcount' : 'uint32',
'var' : 'float32',
'std' : 'float32',
'confRate' : 'float32',
'nextclick' : 'int64',
'mean' : 'float32'
}
NAMEMAP_DICT = {
'item_id' : 'iid',
'user_id' : ... | vuhoangminh/Kaggle-Avito | codes/lib/configs.py | configs.py | py | 2,850 | python | hi | code | 0 | github-code | 1 |
45888664352 | from starlette.endpoints import HTTPEndpoint
from starlette.responses import UJSONResponse
from api.utils import is_admin
from db.conn import get_conn
from db.replica import Replica
from db.replica_files import ReplicaFiles
class ReplicasHandlers(HTTPEndpoint):
async def post(self, request):
is_admin(req... | wooque/openpacs | backend/api/replicas.py | replicas.py | py | 1,811 | python | en | code | 4 | github-code | 1 |
14991617651 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##############################################
# Hardware
# - Windows 11
# - NI USB-6008
# Erst NI-DAQmx 19.5 installiert
# (aktuelle Version 2023 Q2 zeigt die Karte nicht an)
# (Die Unterstützung für Net Framework und C++ nicht installieren... | alexwohlers/ni_daq | scripts/ni_read_voltage_buffered.py | ni_read_voltage_buffered.py | py | 2,120 | python | de | code | 0 | github-code | 1 |
26839905654 | # before use run in command shell:
# pip install pipenv
# pipenv install requests
# pipenv install BeautifulSoup
# pipenv install lxml
# pip install BeautifulSoup
# pip install beautifulsoup4
# pip install lxml
import requests
import re
from bs4 import BeautifulSoup
import json
# r = requests.get('http://immunet.cn... | lightweave/CRISPR-dynamics | crawler/hmmcas.py | hmmcas.py | py | 2,986 | python | en | code | 0 | github-code | 1 |
39994314829 | from GQA.functions.peaks import Peaks
from GQA.functions.rastrigin import Rastrigin
from GQA.functions.eggholder import Eggholder
from GQA.quantum.gqa_function import GQA_function
from GQA.utils.plotutils import plotList,average_evals
from tqdm import tqdm
# r = Rastrigin(-5.12,5.12,-5.12,5.12)
# r.plot_()
# e = Eggh... | simonetome/QuantumGeneticAlgorithm | experiments.py | experiments.py | py | 1,209 | python | en | code | 3 | github-code | 1 |
10599399107 | import praw
import pause
posts = []
url_set = set()
message_user = 'VirtualLeak'
reddit = praw.Reddit('user')
subreddit = reddit.subreddit('friends')
# Output post data in markdown table format
def output():
format_title = '|'.join(['title', 'author', 'subreddit', 'url', '# of comments\n'])
format_columns = ... | shaneavila/reddit-alert | reddit_scraper.py | reddit_scraper.py | py | 1,274 | python | en | code | 0 | github-code | 1 |
44912301952 | import sys
from rdkit import Chem
from rdkit.Chem import AllChem
import glob
import shutil
import os
import multiprocessing as mp
nprocs = 4
except_dir_path = os.path.abspath(os.path.dirname(__file__)) + "\except_mol"
def optimize(mol_file):
try:
m = Chem.MolFromMolFile(mol_file)
m = Chem.AddHs(m)
AllChem.Em... | miya-dai/system_design | scripts/rdk.py | rdk.py | py | 829 | python | en | code | 0 | github-code | 1 |
24765487770 | import matplotlib.pyplot as plt
import cv2
import numpy as np
from os.path import join, basename
from collections import deque
from utils import grayscale, canny, gaussian_blur, hough_lines, get_slope, get_bias, draw_lines, weighted_img
# region of interest
def region_of_interest(image):
height = image.shape[0]
... | namigaliyev/road-lane-tracking | lane_detection.py | lane_detection.py | py | 4,915 | python | en | code | 4 | github-code | 1 |
24015031746 | # -*- coding: utf-8 -*-
from eteamin.tests import TestController
class TestPost(TestController):
def test_tag(self):
"""Testing Posing Tag"""
payload = {
'title': 'this is a title',
}
post_resp = self.app.post_json('/api/tags', params=payload).json
get_resp = ... | eteamin/eteamin | eteamin/tests/functional/tag/test_post.py | test_post.py | py | 661 | python | en | code | 0 | github-code | 1 |
18242727345 | # %%
import pandas as pd
import os
# %%
files = [f for f in os.listdir("results/")]
# %%
files
# %%
n_dict = {}
for data_t in ["u", "w", "s"]:
for ep in [100, 250, 500]:
n_dict[data_t + str(ep)] = []
# %%
for f in files:
params = f.split("-")
n_dict[params[0][0] + str(params[1])].append(f)
... | wwolny/evolutionary-knapsack-problem | results2csv.py | results2csv.py | py | 2,158 | python | en | code | 0 | github-code | 1 |
26485465703 | # Modify the previous program such that only multiples of three or five
# are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17
a = 1
value = 0
while(a == 1):
value = input("What do you want to count to?")
try:
my_int = int(value)
print(my_int)
a = 0
except:
... | mageoffat/Elementary_Python | Count_From_3_to_n_by_3_or_5.py | Count_From_3_to_n_by_3_or_5.py | py | 599 | python | en | code | 0 | github-code | 1 |
18439923269 | import sys
x = [2,3,5,7,11,13,17,19,23,29,31,37]
lst = []
for i in sys.argv[1]:
lst.append(i)
def recursion(a):
prime = []
count = 0
if a % 2 == 0:
prime.append(2)
a == a//2
return recursion(a)
return prime
for i in range(len(lst)):
print(recursion(lst[i]))
| BeratKARATAS53/Python | Quiz-7/quiz7.py | quiz7.py | py | 310 | python | en | code | 1 | github-code | 1 |
71992176033 | # -*- coding: utf-8 -*-
"""
Package: iads
File: utils.py
Année: LU3IN026 - semestre 2 - 2021-2022, Sorbonne Université
"""
# Fonctions utiles pour les TDTME de LU3IN026
# Version de départ : Février 2022
# import externe
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
import seabo... | samynhl/Data-Science-Project | iads/utils.py | utils.py | py | 11,437 | python | fr | code | 0 | github-code | 1 |
6899169608 | # %%
# Shi-TOmasi角点检测(一种适应追踪的角点检测方式)
import numpy as np
import cv2
from matplotlib import pyplot as plt
# %%
img = cv2.imread('data/calibresult.png')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
"""goodFeaturesToTrack函数:
参数: (1)gray:输入灰度图
(2) 25:想要检测的角点数量
(3) 0:角点最低水平 (0到1)
(4) 10:两... | vvgoder/opencv_learning_chinese | opencv学习文件/9.Shi-Tomas角点检测.py | 9.Shi-Tomas角点检测.py | py | 747 | python | zh | code | 2 | github-code | 1 |
8985294273 | from pycocotools.coco import COCO
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
import cv2 as cv
# =======================================
# =======================================
obj_class = 255
dataDir='E:/00_graduation project/DataSet/COCO/' # 数据集根目录
dataType='val2017' # 选择图像类型
annFile='... | Gao-Jinlong/Graduation-Project | U-Net/utils/coco_to_voc.py | coco_to_voc.py | py | 3,911 | python | en | code | 0 | github-code | 1 |
71276797475 | # Python standard libraries
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import json
import sqlite3
# Third-party libraries
from flask import Flask, redirect, request, url_for, render_template
from flask_login import (
LoginManager,
cu... | ColtAllen/codex_vitae_app | codex_vitae/app.py | app.py | py | 4,766 | python | en | code | 0 | github-code | 1 |
18796523121 | #!/usr/bin/python3
'''
Module 11. Student to disk and reload
'''
class Student():
'''
Write a class Student that defines a student by
'''
def __init__(self, first_name, last_name, age):
'''
Instantiation with first_name, last_name and age
'''
self.first_name = first_nam... | ezesilva95/holbertonschool-higher_level_programming | 0x0B-python-input_output/11-student.py | 11-student.py | py | 988 | python | en | code | 0 | github-code | 1 |
14331983923 | import math
n = int(input())
dp = [0] * (n + 1)
try:
dp[1] = 0
dp[2] = 1
dp[3] = 1
except:
pass
for i in range(4, n + 1):
num1 = math.inf
num2 = math.inf
num3 = math.inf
if i % 3 == 0:
num1 = dp[i // 3] + 1
if i % 2 == 0:
num2 = dp[i // 2] + 1
... | kimnoca/Coding_Test | 백준/Silver/1463. 1로 만들기/1로 만들기.py | 1로 만들기.py | py | 398 | python | en | code | 0 | github-code | 1 |
28010970080 | '''
Sorting a string
'''
def strsort (word):
'''
Simply sort a string. Trivial, but essential to remember
'''
return ''.join(sorted(word))
#---
if __name__ == '__main__':
user_in = 'ok'
while len(user_in) > 0:
user_in = input('Enter a string to sort: ')
if len(user_in) > 0:
... | bgppa/python_workout | ch2_strings/ex8.py | ex8.py | py | 354 | python | en | code | 0 | github-code | 1 |
6763130828 | """1) Дополните класс Группа (задание Лекции 2) возможностью поддержки итерационного протокола. """
class Human: # Оставлен для проверки группы
def __init__(self, last_name, first_name, patronymic, gender, age, height, weight):
self.last_name = last_name
self.first_name = first_name
... | YevhenMix/courses | Python Pro/Лекция 6. Итераторы и итерационный протокол/Lection_6_tsk_1.py | Lection_6_tsk_1.py | py | 5,178 | python | en | code | 0 | github-code | 1 |
34305147841 | import random as rn
import os
from art import logo2
def clear():
'''this clears the terminal'''
os.system('cls')
def number_game():
'''This is a number guessing game function'''
print(logo2)
print("Welcome to the number guessing game \nI am thinking of a number between 1 and 100")
numbers = ... | Samthesurf/Practice-and-Learn | guessing_game.py | guessing_game.py | py | 2,677 | python | en | code | 0 | github-code | 1 |
19842239008 | import cv2
img = cv2.imread("aircraft.jpg")
img = cv2.resize(img, (512, 512))
img1 = cv2.imread("aircraft1.jpg")
img1 = cv2.resize(img1, (512, 512))
img1 = cv2.medianBlur(img1, 101)
img2 = cv2.imread("polygons.png")
img2 = cv2.medianBlur(img2, 25)
img2 = cv2.resize(img2, (512, 512))
if img.shape == img... | REISOGLU53/OpenCV-Python | 06_Alistirma/09_Resim_Karsilastirma.py | 09_Resim_Karsilastirma.py | py | 685 | python | en | code | 3 | github-code | 1 |
3018927991 | # -*- coding: utf-8 -*-
"""
Performance test of cnn architectures on various degradation models.
Created on Thu May 24 11:00:00 2018
Author: Prasun Roy | CVPRU-ISICAL (http://www.isical.ac.in/~cvpr)
GitHub: https://github.com/prasunroy/cnn-on-degraded-images
"""
# imports
from __future__ import division
from __futur... | prasunroy/cnn-on-degraded-images | test.py | test.py | py | 20,147 | python | en | code | 14 | github-code | 1 |
12316864652 | import matplotlib.pyplot as plt
x_list = []
y_list = []
def process(line):
### transformation matix 로 궤적 얻기 ##############################################################
pose = line.strip().split()
x_list.append(float(pose[3])) # position
y_list.append(float(pose[11]))
######... | owl-d/Visual_Odometry_Basic | 05_trajectory_visualization/kitti_odom_visual.py | kitti_odom_visual.py | py | 823 | python | en | code | 0 | github-code | 1 |
18068084482 | import numpy as np
import random
import sys
import math
import time
class Network():
weights_matrices = [] # saves all the weight-matrices as list of matrices
bias_matrices = [] # saves all bias vectors as list of vectors
activation_vectors = []
conf_list = 0 # what is this used for?
layers_c... | noloyxc/seminar_nn | neuralnetwork/simplenn/old_stuff/network_robert.py | network_robert.py | py | 9,099 | python | en | code | 0 | github-code | 1 |
45737636994 | from data_manager import DataManager, put_data
from flight_search import iata_code
from flight_data import FlightData
from notification_manager import notify_me
data = DataManager()
sheet_data = data.flight_data
flight_data = FlightData()
for item in sheet_data['prices']:
if item['iataCode'] == '':
iata_... | LJW92/PythonProjects | API Projects/flight-deals-start/flight-deals-start/main.py | main.py | py | 847 | python | en | code | 0 | github-code | 1 |
19046607125 | from iqoptionapi.stable_api import IQ_Option
import iqoptionapi.country_id as Pais
import time, logging, json, configparser
from datetime import datetime, date, timedelta
from dateutil import tz
import sys
#CODIGO PARA DESATIVAR DEBUG OU logging.ERROR
#logging.disable(level=(logging.DEBUG))
# Credenciais
API = IQ_Op... | Cleoir-Dev/iqoptionapi | tests/bot_CopyTrade.py | bot_CopyTrade.py | py | 8,285 | python | pt | code | 0 | github-code | 1 |
42327230 | # important: process ids are global, i. e. are preserved (same pid for each instance) ==> <> os-managed pid
import itertools
import json
from datetime import timedelta, datetime
from typing import Sequence, Tuple, Dict
import os
import locale
import sys
import argparse
root, filename = os.path.split(__file__)
proj_roo... | raffaelfoidl/ProvCaptPyEnvs | instances/large/inst_l.py | inst_l.py | py | 10,789 | python | en | code | 0 | github-code | 1 |
4752869794 | #!/usr/bin/env python
""" This module has api-key-specific methods """
import argparse
from api_request.request import *
class UNIQUE_ID():
def __init__(self, director_url):
self.base_url = director_url + "/v3" + "/settings/websocketproxy.unique.identity"
requestobj = Data('', '')
self.... | mayadata-io/oep-e2e | api_testing/unique-id/unique-id.py | unique-id.py | py | 964 | python | en | code | 6 | github-code | 1 |
8533855613 | import getopt
import sys
from prisma.calibrate import main_loop
# parse arguments
try:
opts, args = getopt.getopt(sys.argv[1:], "d:", ["days_to_sync="])
except getopt.GetoptError:
print("Please provide proper arguments.")
print("Usage: $python3 sync_fripon.py --d=<days>")
sys.exit(2)
for opt, arg in ... | Matteo04052017/PRISMA_automation | src/run_calibration.py | run_calibration.py | py | 441 | python | en | code | 0 | github-code | 1 |
21692068618 | import discord
from discord.ext import commands
import random
from discord.ext.commands.core import command
import datetime
from discord.utils import get
class Utility(commands.Cog):
"""Utility commands for setting up the environment"""
def __init__(self,bot):
self.bot = bot
self.c... | Navneety007/DoppleGanger | cogs/utility.py | utility.py | py | 8,130 | python | en | code | 1 | github-code | 1 |
20146470118 | """
Author: Henry, henrylu518@gmail.com
Date: May 9, 2015
Problem: Anagrams
Difficulty: Easy
Source: http://leetcode.com/onlinejudge#question_49
Notes:
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
Solution: Sort the string ... | henrylu518/LeetCode | Anagrams.py | Anagrams.py | py | 727 | python | en | code | 0 | github-code | 1 |
24842981463 | import math
import numpy as np
""" Helper Functions Module
This module includes all the methods used for repeating calculations.
@authors: RonyHirsch, AbdoSharaf98
"""
def deg2pix(view_distance, degrees, cm_per_pixel):
"""
converts degrees to pixels
:param view_distance: viewer distance from the displ... | Cogitate-consortium/cogitate-msp1 | coglib/beh_et/eyetracking/AnalysisHelpers.py | AnalysisHelpers.py | py | 3,108 | python | en | code | 0 | github-code | 1 |
36698448915 | from visual import *
from visual.graph import * # graphing capability
import math
from matplotlib import pyplot as plt
import random
from random import randint
import numpy as np
from scipy.special import gamma # usando gamma
import pylab
from scipy.stats import beta
import panda as pd
from matplotlib.ticke... | lucassolanoc/UFRN | Roboteam/E-greedy/Algoritmos/ThompsonLearning.py | ThompsonLearning.py | py | 14,821 | python | en | code | 0 | github-code | 1 |
14869634304 | '''
ENTITY SENTIMENT
This file contains various functions that, given a text and word within the text, estimates sentiment towards the particular word.
When a sentence and entity come up within a sentence it become a contrastive conjunction or negation.
Split method: sentence is split on commas and comparison words. Se... | tosi-n/Sentinel-prime | contrastive_sent.py | contrastive_sent.py | py | 4,102 | python | en | code | 1 | github-code | 1 |
72365330914 | import numpy as np
def initialize_params(layers_dims):
L = len(layers_dims)
parameters = {}
for l in range(1, L):
parameters[f'W{l}'] = np.random.randn(layers_dims[l], layers_dims[l - 1]) * np.sqrt(2 / layers_dims[l - 1])
parameters[f'b{l}'] = np.zeros((layers_dims[l], 1))
return paramet... | CabdiraxiimAxmed/hand_writing | initialize_params.py | initialize_params.py | py | 627 | python | en | code | 0 | github-code | 1 |
36192451748 | import logging
from time import sleep
from collections import namedtuple
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.common.keys import Keys
from selenium.common.e... | louisabraham/paybybot | paybybot/bot.py | bot.py | py | 9,890 | python | en | code | 3 | github-code | 1 |
30500422685 | import os
import click
import numpy as np
import pandas as pd
import os.path as op
import nibabel as nib
from tqdm import tqdm
from glob import glob
from joblib import Parallel, delayed
from nilearn import masking, image
from nistats.design_matrix import make_first_level_design_matrix
from nistats.first_level_model imp... | NILAB-UvA/AOMIC-common-scripts | misc_qc/run_task_fmri_models.py | run_task_fmri_models.py | py | 7,579 | python | en | code | 8 | github-code | 1 |
44258172133 | import altair as alt
import pandas as pd
import streamlit as st
import aws
import driver
import requests
import json
import os
from textblob import TextBlob
import datetime
import time
credentials_path = "credentials.json"
auth_dict = {
"CONSUMER_KEY": "",
"CONSUMER_SECRET": "",
"ACCESS_TOKEN": "",
"A... | enpuyou/aws-fastapi-streamlit | src/visualization.py | visualization.py | py | 13,343 | python | en | code | 2 | github-code | 1 |
28691637016 | from PIL import Image
import numpy as np
from libtiff import TIFF
import time
import glob
import os
import PySpin
# import Camera
######## TODO: MAKE SURE TO CHANGE PULLDOWN RESISTOR ON GPIO 12 TO DOWN
open('Data/rawData.txt', 'w').close()
open('Data/processedData.txt', 'w').close()
timeStart = 0
previousTime = 0
ON =... | JamesBousquet/PortableBiosensorUI | processing.py | processing.py | py | 5,496 | python | en | code | 1 | github-code | 1 |
1911947262 | from typing import List
from core.point import POINT_AT_INFINITY, Point
from utils.int_operations import is_prime
from utils.mod_operations import divide, is_square, square_root
class EllipticCurve:
def __init__(self, a, b, p) -> None:
# if self.is_non_singular():
self.__a = a
self.__b = b... | duycao2001/elliptic_curve | elliptic-curve-python/core/elliptic_curve.py | elliptic_curve.py | py | 3,694 | python | en | code | 0 | github-code | 1 |
40087934997 | import sys
n = int(sys.stdin.readline())
stack = []
data = []
result = ""
flag = True
count = 1
for _ in range(n):
data = int(sys.stdin.readline())
while count <= data: # 첫번째 숫자까지 스택에 먼저 넣기
result += "+"
stack.append(count)
count += 1
if stack[-1] == data:
result += "-"
... | hyee0715/Algorithm | BAEKJOON/python/BOJ_1874.py | BOJ_1874.py | py | 510 | python | en | code | 0 | github-code | 1 |
72482401633 |
import sys
from ..format import Layout
from .core import HTMLRuleBuilder, HTMLNode, make_joiner
from ..rulesets import basic
html_boxy = Layout()
html_boxy.layout = dict(
# Note: the classes "scalar", "sequence" and "empty" are added by
# rules in descr.ruleset.basic, so make sure to include that
# rul... | breuleux/descr | descr/html/boxy.py | boxy.py | py | 12,878 | python | en | code | 1 | github-code | 1 |
916189966 | # -*- coding : UTF-8 -*-
from urllib import request
from urllib import parse
import json
if __name__ == "__main__":
Request_URL = "http://fanyi.baidu.com/v2transapi"
Form_Data = {}
Form_Data['from'] = 'en'
Form_Data['to'] = 'zh'
Form_Data['query'] = 'Android'
Form_Data['transtype'] = 'realtime'... | NotMyYida/AndroidBookNote | pycharmWS/webcrawler/translate.py | translate.py | py | 2,579 | python | en | code | 0 | github-code | 1 |
27663467805 | # coding: utf-8
from flask import url_for
from wtforms.widgets import html_params, HTMLString
from cgi import escape
from wtforms.compat import text_type
class VerifyCode(object):
html_params = staticmethod(html_params)
def __call__(self, field, **kwargs):
if field.hidden == True:
html = '<input %s>' % self.... | endsh/haoku-open | simin/simin/web/forms/widgets.py | widgets.py | py | 1,490 | python | en | code | 6 | github-code | 1 |
42938740587 | import argparse
import getpass
import json
import difflib
import sys
import requests
import colorama
from colorama import Fore
from zjusess import zjusess
from scorenotification import scorenotification
# 用于中文对齐输出
def pad_len(string, length):
return length - len(string.encode('GBK')) + len(string)
class LOG:
... | PeiPei233/ZJUScoreAssistant | zjuscore.py | zjuscore.py | py | 12,488 | python | en | code | 7 | github-code | 1 |
30890389119 | """Draft List application."""
import requests, random
import pdb, os
from flask import Flask, request, render_template, redirect, flash, session, jsonify
from flask_debugtoolbar import DebugToolbarExtension
from models import db, connect_db, User, List, PlayerList, Player
from forms import RegisterForm, LoginForm, Comp... | cshellen1/fantasy-draft-list | app.py | app.py | py | 9,165 | python | en | code | 0 | github-code | 1 |
18822635033 | '''Ingresar 2 números e informar si son números amigos
Son números amigos aquellos números cuya suma de divisores de uno, sin el propio número, es igual al otro, y viceversa .
Ej 220 y 284 son amigos'''
suma=0
sumb=0
num1=int(input('Ingrese un valor:'))
num2=int(input('Ingrese otro valor:'))
for i in r... | julianzucho/Introduccion-algoritmia | Simulacroparcial/Ej4.py | Ej4.py | py | 626 | python | es | code | 0 | github-code | 1 |
14656769144 | import warnings
warnings.filterwarnings("ignore")
from jax_sandbox.common import *
from jax_sandbox.imitation import *
from jax_sandbox.actor_critic import *
from jax_sandbox.policy_gradient import *
from jax_sandbox.value_based_methods import *
import hydra
import envs.dmc as dmc
from utils import *
def make_env(en... | dhruvsreenivas/jax_sandbox | main.py | main.py | py | 2,384 | python | en | code | 1 | github-code | 1 |
15554629273 | from django.contrib import admin
from .models import Faq
class FaqAdmin(admin.ModelAdmin):
list_display = (
'title',
'writer',
'hits',
'registered_date',
)
search_fields = ('title', 'content', 'writer__user_id',)
admin.site.register(Faq, FaqAdmin)
| SangjunDev/ROHDE-SCHWARZ_Local | faq/admin.py | admin.py | py | 302 | python | en | code | 0 | github-code | 1 |
27805897926 | import fire
import pandas as pd
from src import INPUT_DATA_PATH, TRAIN_DATA_PATH, VAL_DATA_PATH
def create_spilts(
train_val_split: float = 0.1,
path_input_data: str = INPUT_DATA_PATH,
path_train_data: str = TRAIN_DATA_PATH,
path_val_data: str = VAL_DATA_PATH,
):
df = pd.read_csv(path_input_data)... | karthikrangasai/sturdy-eureka | src/create_splits.py | create_splits.py | py | 1,194 | python | en | code | 0 | github-code | 1 |
42310547395 | #!/usr/bin/env python
import numpy as np
import os
import pytest
import requests # noqa: F401
from src.data_collection.Poloniex import poloniex_data
def test_init():
with pytest.raises(TypeError):
poloniex_data.PoloniexDataManager()
@pytest.fixture(scope='function')
def mock_retry_request(monkeypatch... | tobiasraabe/crypto | src/data_collection/Poloniex/test_poloniex_data.py | test_poloniex_data.py | py | 2,125 | python | en | code | 0 | github-code | 1 |
3056397082 | from cmath import e
import tkinter as tk
import sqlite3 as sl
from numpy import isin
from participant import Participant
import tkinter.messagebox
from logged import logged_run
def createAccount(ws):
ws.destroy()
from register import register_run
register_run()
def submit(ws, uname, pwd):
u = uname.g... | brunoferreira/GUI-Lab | login.py | login.py | py | 2,548 | python | en | code | 0 | github-code | 1 |
26162270266 | from django.urls import path
from .views import *
app_name = 'pagecrud'
urlpatterns = [
path('index/', index, name='index'),
path('catalog/', CatalogView.as_view(), name='catalogcrud'),
path('catalogDelete/<int:delete_id>/', catalogDelete, name='catalogdelete'),
path('catalogUpdate/<int:id_catalog>/', ... | muhzulfik/project-library | crudPage/urls.py | urls.py | py | 845 | python | en | code | 0 | github-code | 1 |
74064928034 | import torch.nn as nn
class stack_conv_layer(nn.Module):
def __init__(self, filter):
super(stack_conv_layer, self).__init__()
self.activation = nn.ReLU(inplace=True)
self.conv1 = nn.Conv2d(filter[0], filter[1], kernel_size=3, padding=1, bias=True)
self.conv2 = nn.Conv2d(filter[1], ... | Cli98/tep-repo | Networks/customer_module.py | customer_module.py | py | 2,042 | python | en | code | 0 | github-code | 1 |
5866244481 | from pip import main
import numpy as np
import pandas as pd
import sklearn
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.impute import SimpleImputer, MissingIndicator
from sklearn.preprocessing import FunctionTransformer, LabelEncoder, Normalizer, StandardScaler, OneHotEncoder
from sklearn.base impo... | woshicqy/CS598PSL_Project1 | mymain_test.py | mymain_test.py | py | 10,484 | python | en | code | 0 | github-code | 1 |
441466835 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
print (1174083%3)
#No.1
print(" ** ** ******** ***** ****** ****** ********")
print("**** **** ******** ****** *** *** ******** ********")
print(" *** *** *** ** ** *** *** *** *** ***")
print(" *** *** **... | duktek/praktikum_2c | src/1174083.py | 1174083.py | py | 6,448 | python | en | code | 1 | github-code | 1 |
23983268226 | import pygame
from MENU.Application import Application
class Versus(Application):
def __init__(self, game):
Application.__init__(self, game)
#self.state will give the start
self.state = "1 VS 1"
#all this will give the positions of the different texts that will be displayed... | SlyLeoX/Cyber-Puck | Cyberpuck_ReleaseDirectory/MENU/Versus.py | Versus.py | py | 4,897 | python | en | code | 1 | github-code | 1 |
1704316828 | import sys
input = sys.stdin.readline
N = int(int(input()))
counts = list(map(int, input().split()))
answer = [-1] * N
for i in range(N):
bigger = (N) - (i+1)
tmp = 0
for j in range(N):
if tmp == counts[i] and answer[j] == -1:
answer[j] = i+1
break
elif answer[j] =... | SunghunKim98/Algorithm_Study | sprint05/KDH/02/BOJ_1138.py | BOJ_1138.py | py | 363 | python | en | code | 0 | github-code | 1 |
73152367715 | from aws_cdk import Stack, Duration
from constructs import Construct
import aws_cdk.aws_lambda as _lambda
import aws_cdk.aws_iam as iam
import aws_cdk.aws_stepfunctions_tasks as tasks
import aws_cdk.aws_stepfunctions as sfn
import aws_cdk.aws_sns as sns
from aws_cdk.aws_dynamodb import Table
class PostProcessStack(... | donkz/rtcwprostats | stacks/postprocess.py | postprocess.py | py | 5,841 | python | en | code | 2 | github-code | 1 |
15497281069 | from .abstract_contact_generator import AbstractContactGenerator
import time
class HRP2ContactGenerator(AbstractContactGenerator):
def __init__(self, path_planner):
super().__init__(path_planner)
self.robustness = 1
self.robot_node_name = "hrp2_14"
def load_fullbody(self):
fro... | humanoid-path-planner/hpp-rbprm-corba | src/hpp/corbaserver/rbprm/scenarios/hrp2_contact_generator.py | hrp2_contact_generator.py | py | 1,067 | python | en | code | 3 | github-code | 1 |
11562007612 | # 2015-05-07 Runtime: 103 ms
class Solution:
# @param s, a list of 1 length strings, e.g., s = ['h','e','l','l','o']
# @return nothing
def reverseWords(self, s):
# reverse the entire s
for i in xrange(len(s) / 2):
s[i], s[len(s) - 1 - i] = s[len(s) - 1 - i], s[i]
# then... | chaor/LeetCode_Python_Accepted | 186_Reverse_Words_in_a_String_II.py | 186_Reverse_Words_in_a_String_II.py | py | 723 | python | en | code | 49 | github-code | 1 |
34270129331 | def mcd(a,b):
div = min(a,b) # retorna el minimo entre a y b
while div > 1 and (a%div!=0 or b%div!=0):
div = div - 1
return div
class fraccion:
def __init__(self,numerador=0,denominador=1):
den=abs(denominador)
num=abs(numerador)
MCD=mcd(num,den)
self.denominador... | jabaier/iic1103.20152.s4 | fracciones.py | fracciones.py | py | 1,163 | python | es | code | 0 | github-code | 1 |
16965598918 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on %(date)s
@author: Yuanyuan Shi
"""
import pandas as pd
import numpy as np
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import mean_squared_error... | Yuanyuan-Shi/PowerOutagePredictor | PowerOutagePredictor/NeuralNetwork/nn_sandbox.py | nn_sandbox.py | py | 2,878 | python | en | code | 6 | github-code | 1 |
682547229 | import sys
import pygame
from pygame import gfxdraw
from utils.mathhelper import clamp, is_inside_radius
from utils.curves import Bezier
class GUI:
def __init__(self, width, height, offset_x=0, offset_y=0):
pygame.init()
self.offset_x = offset_x
self.offset_y = offset_y
self.size =... | burkap/osu-replay-analyzer | utils/gui.py | gui.py | py | 16,562 | python | en | code | 0 | github-code | 1 |
73628109475 |
from detector import *
from recorder import Record
from sys import exit, argv
if len(argv) != 2:
print("No output name selected")
exit(1)
else:
output_name = argv[1]
if output_name[-4:] != ".avi":
print("Filname must be .avi")
exit(1)
info = [["src/left.mp4", "left stream"], ["src/right.mp4", "... | jakob-lj/video-merger-for-basketball | main.py | main.py | py | 1,527 | python | en | code | 5 | github-code | 1 |
6328911031 | # -*- coding: utf-8 -*-
from __future__ import annotations
import json
import os
import typing as tp
from PySide2.QtWidgets import QLineEdit, QSpinBox
class model(object):
def __init__(self, *args, **kwargs):
super(model, self).__init__(*args, **kwargs)
def debug(self):
print("debug")
... | RyotaUnzai/pairpro | renamer/renamerModel.py | renamerModel.py | py | 4,117 | python | en | code | 0 | github-code | 1 |
72521554913 | """
utils.py
Manejo de ciertos utilitarios como:
- Cargado de configuración
"""
import configparser
import os
import logging
import hashlib
from logging.handlers import RotatingFileHandler
#SETTINGS_FILENAME = 'settings.ini'
# De esta manera se ubica sobre el root del proyecto y no sobre /app
SETTINGS_... | jpablochaves/filter_api | app/shared/utils.py | utils.py | py | 5,559 | python | es | code | 0 | github-code | 1 |
7007622331 | import operator
def answer(xs):
try:
if len(xs) == 0 and len(xs) > 50:
raise Exception
positive_values = []
negative_values = []
maxPower = 999
if xs[0] == 0:
maxPower = 0
else:
for index, value in enumerate(xs):
... | raghavpatnecha/Foobar | Power Hungry/power_hungry.py | power_hungry.py | py | 1,726 | python | en | code | 3 | github-code | 1 |
18030830671 | #%%
# Analysis example
import glob
import os
import sys
from importlib import reload
sys.path.append('/data/git_repositories_py/SCRAPC/')
sys.path.append('/data/git_repositories_py/fUS_pytools/')
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as signal
import scrapc_analysis as scana
import s... | fluongo/fUS_pyTools | analysis_scripts/09_12_19_Shapiro_lab_meeting.py | 09_12_19_Shapiro_lab_meeting.py | py | 13,271 | python | en | code | 4 | github-code | 1 |
11637400068 | import re
import math
import pandas as pd
import datetime
import itertools as it
import plotly.express as px
import plotly.graph_objects as go
from textwrap import wrap
from collections import ChainMap, OrderedDict
from .downloader import download
from more_itertools import partition
pd.set_option("mode.chained_assig... | brasil-em-numeros/brasil-em-numeros | dashboard/provedores/pdt/despesas_publicas.py | despesas_publicas.py | py | 8,234 | python | pt | code | 1 | github-code | 1 |
75068479392 | import bilby
import numpy as np
import matplotlib.pyplot as plt
from bilby.core.utils import logger
import scipy.special
import matplotlib
import json
from distutils.version import LooseVersion
import os
import copy
from ..PE.prior import Conditional_Dl2_prior_from_mu_rel_prior, condition_function
def MakeLensedParams... | lemnis12/golum | golum/Tools/utils.py | utils.py | py | 16,015 | python | en | code | 1 | github-code | 1 |
24272814361 | #有效的括号
# 给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效。
# 有效字符串需满足:
# 左括号必须用相同类型的右括号闭合。
# 左括号必须以正确的顺序闭合。
# 示例 1:
# 输入:s = "()"
# 输出:true
# 示例 2:
# 输入:s = "()[]{}"
# 输出:true
# 示例 3:
# 输入:s = "(]"
# 输出:false
# 示例 4:
# 输入:s = "([)]"
# 输出:false
# 示例 5:
# 输入:s = "{[]}"
# 输出:true
#
# 提示:
# 1 <= s.length <= 104... | wuyfer365/python | test20_1.py | test20_1.py | py | 1,229 | python | zh | code | 0 | github-code | 1 |
15925034208 | import copy
import sys
def main():
# test_game_board = [
# ['Y', 'E', 'E', 'E', 'E'],
# ['E', 'Y', 'E', 'E', 'E'],
# ['E', 'E', 'Y', 'E', 'E'],
# ['E', 'E', 'E', 'Y', 'E'],
# ['E', 'E', 'E', 'Y', 'E'],
# ['E', 'E', 'E', 'E', 'E'],
# ['E', 'E', 'E', 'E', 'E']... | townsag/MiniMax_Connect_4 | MiniMax.py | MiniMax.py | py | 24,252 | python | en | code | 0 | github-code | 1 |
26928070232 | import PyQt5.QtCore as QtCore
from imperialism_remake import start
from imperialism_remake.base import constants, network
from imperialism_remake.server import server
def client_connect():
"""
Client tries to connect.
"""
client.connect_to_host(constants.NETWORK_PORT)
def send_shutdown():
"""
... | sumpfralle/imperialism-remake | test/network_process_start_shutdown_stresstest.py | network_process_start_shutdown_stresstest.py | py | 988 | python | en | code | null | github-code | 1 |
37202277848 | """
0x Web3 Utilities
author: officialcryptomaster@gmail.com
"""
from decimal import Decimal
from enum import Enum
from typing import Optional, Union
from eth_utils import keccak, to_checksum_address
from hexbytes import HexBytes
from zero_ex.json_schemas import assert_valid
from zero_ex.contract_artifacts import abi... | officialcryptomaster/pyveil | src/utils/zeroexutils.py | zeroexutils.py | py | 30,368 | python | en | code | 6 | github-code | 1 |
30562257637 | from collections import OrderedDict
import random
from string import ascii_uppercase
def rand_chars(length):
return ''.join(
random.choice(ascii_uppercase)
for i in xrange(length)
)
def is_int_in_range(val, low, high):
# inclusive, None is ok
if val is None:
return True
... | justecorruptio/snatch_v3 | src/utils.py | utils.py | py | 1,513 | python | en | code | 0 | github-code | 1 |
39329032276 | import os.path
import pathlib
import subprocess
import setuptools
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# get module version from git tag
client_version = subprocess.run(['git', 'describe', '--tags'],
stdout=subprocess.P... | xrgarcia/alphavantage_api_client | setup.py | setup.py | py | 1,427 | python | en | code | 10 | github-code | 1 |
32521435646 | from flask import Flask, request, render_template
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
from io import BytesIO
app = Flask(__name__)
model = load_model('brain_tumor_model.h5')
@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'P... | alfalfs/Cancer_Detection_using_CCN | app.py | app.py | py | 1,086 | python | en | code | 0 | github-code | 1 |
17137250502 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
with open('boardgamelinks.txt', 'r') as links_file, open('boardgametime.txt', 'w') as file:
... | YKawesome/Python-Projects | Projects/Board Game Scraper/Times/boardgametimes.py | boardgametimes.py | py | 1,203 | python | en | code | 1 | github-code | 1 |
24655058065 | from flask import Blueprint
from . import views
bp = Blueprint(
name="public",
import_name=__name__,
static_folder=None,
template_folder=None,
url_prefix="/",
)
bp.add_url_rule(
rule="/",
endpoint="index",
view_func=views.index,
methods=["GET"],
)
| harrelchris/template-flask | app/public/urls.py | urls.py | py | 287 | python | en | code | 0 | github-code | 1 |
10988878904 | import unittest
import torch
from torch import nn
from towhee.models.lightning_dot.bi_encoder import BiEncoder
class MockUniterEncoder(nn.Module):
"""
A Mock UniterEncoder
"""
@classmethod
def init_encoder(cls, config, checkpoint_path=None, project_dim=8):
print(
f"UniterEncod... | towhee-io/towhee | tests/unittests/models/lightning_dot/test_lightning_dot.py | test_lightning_dot.py | py | 3,401 | python | en | code | 2,843 | github-code | 1 |
27272290696 | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(a, b):
g = gcd(a, b)
return g * (a/g) * (b/g)
for _ in range(int(input())):
a, b = map(int, input().split())
print(int(lcm(a, b)))
| honggom/TIL | problem-solving/baekjoon/math/1934.py | 1934.py | py | 247 | python | en | code | 0 | github-code | 1 |
17959723308 | # 사각형 출력하기 2(print quadrangle)
# 길이 n이 입력되면 다음과 같은 사각형을 출력한다.
# method 1
n = int(input())
for i in range(1, n+1):
if i == 1 or i == n:
for j in range(n):
print('*', end='')
else:
for k in range(1, n+1):
if k == 1 or k == n:
print('*', end='')
e... | junes7/python_algorithm | CodeUp/nested loop statement/1356.py | 1356.py | py | 425 | python | ko | code | 1 | github-code | 1 |
71103767073 | # coding: utf-8
import pygame as pg
import numpy as np
class GameOfLife():
def __init__(self, width=640, height=480, cell_size=20, FPS=30):
self.width = width
self.height = height
self.cell_size = cell_size
self.screen = pg.display.set_mode((width, height))
self.Ncol = self.width // self.cell_size
se... | astro-kaba4ek/Python_5 | DZ4/game_of_life.py | game_of_life.py | py | 3,257 | python | en | code | 0 | github-code | 1 |
13110419856 | from urllib.request import urlopen
from re import findall, compile
'''
Crawls McGill faculty (bio) course page for information about prerequisites, corequisites, and restrictions on courses offered.
The information gathered is only course codes - the course page should still be consulted to view any other textual inf... | RolandRiachi/PrerequisitesGraph | courseData/coursePages/crawler/bio_prereqs.py | bio_prereqs.py | py | 2,480 | python | en | code | 0 | github-code | 1 |
17087660357 | from nornir import InitNornir
from nornir.plugins.tasks import networking, text
from nornir.plugins.functions.text import print_result
from nornir.core.filter import F
from nornir.core.task import Result
from ciscoconfparse import CiscoConfParse
from pathlib import Path
import ipdb
import re
import time
CONFIG_PATH =... | bfernando1/nornir-automation | week8/bgp_tool.py | bgp_tool.py | py | 10,822 | python | en | code | 1 | github-code | 1 |
21340483022 | from collections import defaultdict
from typing import List
class Node:
def __init__(self, val):
self.val = val
self.dfn = -1
self.low_dfn = -1
self.children = []
class ArticulationFinder:
def __init__(self):
self.nodes = defaultdict(list)
self.ap ... | kannanParamasivam/datastructures_and_algorithm | graph/problems/find_articulation_points.py | find_articulation_points.py | py | 1,991 | python | en | code | 1 | github-code | 1 |
2764211799 | # Importing necessary libraries...
import collections
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import train_test_split
from math import *
class GaussianNaiveBayes:
total_prob = None
mean, variance, n_class = None, None, None
y_dict = None
... | zhuyuecai/Comp551Group53 | Yuecai/integration/mlModels/naive_bayes.py | naive_bayes.py | py | 3,375 | python | en | code | 0 | github-code | 1 |
32903456096 | #!/usr/bin/python
# encoding: utf-8
#主要是对爬取39健康网的相关方法的封装相关操作的封装
import requests
from pyquery import PyQuery as pq
class health39util(object):
def __init__(self):
pass
def parse_disease(self, url):
'''
解析疾病页面
'''
headers = {'user-agent': 'Mozilla/5.0 (Win... | mayi140611/crawl | requestProj/39jiankang/health39util.py | health39util.py | py | 2,018 | python | en | code | 1 | github-code | 1 |
75168963873 | """This module includes api endpoints for auth."""
from fastapi import APIRouter, status, Depends
from dependencies import verify_api_key
from repositories.user import UserRepository
from schemas.base import ResponseSchema
from schemas.auth import (
LoginRequestSchema,
TokenRequestSchema,
DecodeResponseS... | Monoboard/monoboard.api.auth | src/api/auth.py | auth.py | py | 4,661 | python | en | code | 0 | github-code | 1 |
9569632216 | import requests
from datetime import datetime
import config
import time
MY_LAT = 46.482525 # Your latitude
MY_LONG = 30.723309 # Your longitude
# Function to check if ISS is overhead
def is_iss_overhead():
response = requests.get(url="http://api.open-notify.org/iss-now.json")
response.raise_for_status()
... | sined277/30_API_REQUESTS_iss_over_head | main.py | main.py | py | 1,310 | python | en | code | 0 | github-code | 1 |
24459511031 | # Write your code here
from random import choice
print("H A N G M A N")
words = ['python', 'java', 'kotlin', 'javascript']
chosen_word = choice(words)
hidden_word = ["-" for letter in chosen_word]
left_tries = 8
uncovered_letters = set()
typed_letters = set()
win = False
while left_tries > 0 and not win:
print(... | snakelover/hangman | Hangman/Hangman.py | Hangman.py | py | 1,176 | python | en | code | 0 | github-code | 1 |
24000790808 | # reference 1 - https://www.youtube.com/watch?v=Dhc_fq5iCnU&list=PLpdmBGJ6ELULEfPWvvks0HtwzCvQo1zu0&index=5
# reference 2 - https://www.youtube.com/watch?v=9TxEQQyv9cE&list=PLpdmBGJ6ELULEfPWvvks0HtwzCvQo1zu0&index=8
# reference 3 - https://www.youtube.com/watch?v=MlK6SIjcjE8&t=322s
from llama_index import LangchainEmb... | hastinmodi/Ramayana_GPT | streamlit_app.py | streamlit_app.py | py | 2,898 | python | en | code | 0 | github-code | 1 |
11173345483 | from hw05_easy import make_dir, remove_dir
import sys
import os
# Задача-1:
# Напишите небольшую консольную утилиту,
# позволяющую работать с папками текущей директории.
# Утилита должна иметь меню выбора действия, в котором будут пункты:
# 1. Перейти в папку
# 2. Просмотреть содержимое текущей папки
# 3. Удалить пап... | DashaVasyaeva/python | hw05_normal.py | hw05_normal.py | py | 2,329 | python | ru | code | 0 | github-code | 1 |
74090940833 | import os
import sys
import leveldb
import logging
import fileinput
from wikiref.util import flush_dict_to_ldb
from wikiref.settings import LDB_ARRAY_DELIM
from wikiref.settings import INDEX_TAXONOMY_REL
from wikiref.settings import INDEX_YAGO_TSV_DELIM
from wikiref.settings import INDEX_YAGO_TAXONOMY_DIRNAME
loggi... | zaycev/wikiref | scripts/run_index_taxonomy.py | run_index_taxonomy.py | py | 1,343 | python | en | code | 0 | github-code | 1 |
72550547235 | from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.svm import SVC
# 파일 load
df = pd.read_excel('C:/BCI Data/ratio file/trainset588.xlsx')
x = df[df.columns[1,4]] # ratio_mu, ratio_theta, ratio_beta
y = df['ClickorNot'] # y label (0 or 1)
X_train, X_test, y_train, y_test = train_tes... | seungcholcho/gazetracker | src/SVM_Classifier.py | SVM_Classifier.py | py | 622 | python | en | code | 0 | github-code | 1 |
27414524625 | # 判断奇偶数
def fun(num):
odd = [] # 存放奇数
even = [] # 偶数
for i in num:
if i % 2 == 0:
odd.append(i)
else:
even.append(i)
return odd, even
list1 = [10, 29, 34, 23, 44, 53, 55]
print(fun(list1))
| Byzhazha/python- | 第十章/return.py | return.py | py | 274 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.