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
20606152072
import psutil from influxdb import InfluxDBClient import time client = InfluxDBClient(host='localhost', port=8086) client.create_database('system') measurement_name = 'system_data' data_end_time = int(time.time() * 1000) data = [] cpu_p, mem_p, disk_read, disk_write, net_sent_now, net_recv_now, temp, \ boot_time,...
rishabh-22/influxdb-scripts
system_data_insert.py
system_data_insert.py
py
2,150
python
en
code
1
github-code
6
1993996230
import pandas as pd import seaborn as sns pd.set_option('display.max_columns', None) df = sns.load_dataset("titanic") df.head() # ? iloc: integer based selection df.iloc[0:3] # ! select the first three elements 0 1 2 indexes df.iloc[0,0] # select element in row zero column zero #? loc: label based selection df.lo...
queciaa/Miuul_PythonProgrammingForDataScience
Pandas/007_loc_iloc.py
007_loc_iloc.py
py
535
python
en
code
0
github-code
6
38454000752
from collections import defaultdict def factorize(n): if n == 1: return 0 factor = defaultdict(int) while True: isPrime = True for i in range(2, int(n**0.5)+1): if n % i == 0: factor[i] += 1 n = n // i isPrime = False ...
LightPotato99/baekjoon
math/prime/primeland.py
primeland.py
py
766
python
en
code
0
github-code
6
70766859707
from .base import ( ConfMeta, UrlParse, FileRealPath, Integer, Boolean, String, ) class WorkerConf( name='worker', file='conf/worker.ini', metaclass=ConfMeta ): max_concurrent: Integer( tag='TextField', title='最大并发量', desc='限制载荷的最大并发量。inf表示不做限制。' ) ...
ZSAIm/VideoCrawlerEngine
helper/conf/worker.py
worker.py
py
862
python
zh
code
420
github-code
6
19194200622
k, n = map(int, input().split()) arr = [] for i in range(k): arr.append(int(input())) start = 0 end = max(arr) result = 0 while start <= end: total = 0 mid = (start + end) // 2 for i in arr: if i >= mid: total += i // mid if total < n: end = mid - 1 else: ...
Sangmyung-ICPC-Team/YunJu
Baekjoon/1654.py
1654.py
py
372
python
en
code
0
github-code
6
6399955298
# welcome to tweet-yeet – lets yeet those tweets! from datetime import datetime, timedelta import tweepy if __name__ == "__main__": # options delete_tweets = True deletes_favs = False censor= True days_to_keep = 7 censor_word = "word" # api info consumer_key = 'XXXXXXXX' consumer_s...
Malcolmms/tweet_yeet
main.py
main.py
py
1,769
python
en
code
0
github-code
6
36849894613
import tensorflow.compat.v1 as tf print(tf.__version__) import matplotlib.pyplot as plt import numpy as np from datetime import datetime from graphnnSiamese import graphnn from utils import * import os import argparse import json parser = argparse.ArgumentParser() parser.add_argument('--device', type=str, default='0,1...
DeepSoftwareAnalytics/LibDB
main/torch/get_threshold.py
get_threshold.py
py
5,724
python
en
code
31
github-code
6
31452710852
# from typing_extensions import Self class Dog: species = "Canis familiaris" def __init__(self, name, age, breed): self.name = name self.age = age self.breed = breed miles = Dog("Miles", 4, "Jack Russell Terrier") buddy = Dog("Buddy", 9, "Dachshund") jack = Dog("Jack", 3, "Bulldog") ...
hiral2011/Pythonwork
dog.py
dog.py
py
459
python
en
code
0
github-code
6
9766345042
# Run this app with `python app.py` and # visit http://127.0.0.1:8050/ in your web browser. """ Dashboard that shows user groups with percentages and recommended books """ from dash import dcc, html import plotly.express as px import pandas as pd from dash.exceptions import PreventUpdate from dash.dependencies import I...
Johan-Ortegon-1/uaque
Dashboard/apps/dashboard_pertenencia.py
dashboard_pertenencia.py
py
5,360
python
es
code
0
github-code
6
44426747556
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import connect_nodes_bi, wait_until class MagicBytes(BitcoinTestFramework): def set_test_params(self): self._magicbyte='0a0b0c0d' self.num_nodes = 2 self._extra_args_same = [['-magicbytes={}'.format(sel...
bitcoin-sv/bitcoin-sv
test/functional/bsv-magicbytes.py
bsv-magicbytes.py
py
1,466
python
en
code
597
github-code
6
1848378529
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.action_chains import ActionChains import pyperclip import time def copy_input(driver, xpath, input) : pyperclip.copy(input) driver.find_element_b...
SLT-DJH/selenium-test
test.py
test.py
py
1,484
python
en
code
0
github-code
6
261136007
#Crie uma função que receba o nome e o sobrenome de uma pessoa e retorne os dois nomes # concatenados (nome completo) #Ex.: envio André e envio Santana e a função retorna André Santana def concatenarNome(nome : str, sobrenome : str): return nome + " " + sobrenome def main(): name = input("Digite o seu nome: ...
ALMSantana/Tecnicas-de-Programacao
2021_2/221/Lista4/ex5.py
ex5.py
py
575
python
pt
code
8
github-code
6
20362021082
from rest_framework.decorators import api_view from rest_framework.response import Response from account.models import User from store.models import Product from django.contrib.auth.decorators import login_required from account.authentication import create_access_token, create_refresh_token, decode_access_token, decode...
MTrungNghia/Gundam_web
BackEnd/GundamMTN/Orders/views.py
views.py
py
4,330
python
en
code
0
github-code
6
74222296187
#!/usr/bin/env python # coding: utf-8 import pandas as pd import matplotlib.pyplot as plt import geopandas as gpd import requests # For storing png files in memory import io # For generating GIF import imageio ########################################################### ########## Globals.... ######################...
mulroony/SDCovidGIFMap
CovidMapFullMinimal.py
CovidMapFullMinimal.py
py
6,244
python
en
code
0
github-code
6
14950903206
# author: detoX import glob import numpy as np import torch import nibabel as nib from PIL import Image import nii_dataset def main(): train_path = glob.glob("D:\\xuexi\\post-graduate\\py_projects\\ResNet-PET\\datasets\\Brain-PET\\Train\\*\\*") test_path = glob.glob("D:\\xuexi\\post-graduate\\py_projects\\R...
Rah1m2/ResNet-PET
display_nii.py
display_nii.py
py
2,266
python
en
code
0
github-code
6
34391533201
f = open("命运.txt", "r", encoding="utf-8") txt = f.read() f.close() d = {} #sym = ",。、?:‘’”“!" #for i in sym: # if i in txt: # txt = txt.replace(i, '') txt = txt.replace("\n", "") for i in txt: d[i] = d.get(i, 0) + 1 ls = list(d.items()) ls.sort(key=lambda x:x[1], reverse=True) for i in range(...
Mr-Liu-CUG/python-NCRE2
1命运三问-问题2.py
1命运三问-问题2.py
py
389
python
en
code
1
github-code
6
12050806024
"""Setup the tilemap and the camera""" import pygame as pg from settings import TILESIZE, MAPSIZE, VIEWSIZE from tile import Tile class Camera(): """A camera like""" def __init__(self, width, height): self.camera = pg.Rect(0, 0, width, height) self.width = width self.height = height ...
Barbapapazes/dungeons-dragons
map_editor/tilemap.py
tilemap.py
py
1,448
python
en
code
1
github-code
6
724197866
from time import time from flask import render_template, redirect, url_for, flash, make_response, current_app, request, abort from flask.json import jsonify from flask.ext.login import login_required, current_user from etherpad_lite import EtherpadLiteClient from . import main from .forms import UserDefaultRoom from...
compeit-open-source/dashboard
app/main/views.py
views.py
py
4,544
python
en
code
1
github-code
6
43248987614
import os import itertools import scipy.io import scipy.stats as stt import numpy as np import matplotlib.pyplot as plt from mou_model import MOU _RES_DIR = 'model_parameter/' _I_REST_RUN = 0 _I_NBACK_RUN = 1 _I_NO_TIMESHIFT = 0 _I_ONE_TIMESHIFT = 1 _SUBJECT_AXIS = 0 plt.close('all') ## Create a local folder to stor...
bjoernkoehn21/Reproduce-results-from-Senden-paper
mou_ec_estimation.py
mou_ec_estimation.py
py
12,115
python
en
code
0
github-code
6
26625562386
"""A Mailman newsletter subscription interface. To use this plugin, enable the newsletter module and set the newsletter module and name settings in the admin settings page. """ from django.utils.translation import ugettext as _ from Mailman import MailList, Errors from models import Subscription from livesettings imp...
dokterbob/satchmo
satchmo/apps/satchmo_ext/newsletter/mailman.py
mailman.py
py
5,119
python
en
code
30
github-code
6
35852151981
#SERVO MOTOR import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) servo1 = GPIO.PWM(12, 50) servo1.start(0) print("2 seconds") time.sleep(2) print("rotating 180") duty = 12 time.sleep(2) print("turn back 90") servo1.ChangeDutyCycle(7) time.sleep(2) print("turn back to 0") servo1.C...
aceyed/Automated-Pet-Feeder
servoMotorTest.py
servoMotorTest.py
py
422
python
en
code
0
github-code
6
41767569580
import numpy as np from scipy.stats import norm import matplotlib.pyplot as plt class LinearDynamicSystem: def __init__(self, gamma, sigma): self.gamma = gamma self.sigma = sigma self.log_p_x_history = [] self.pred_mu_history = [] self.mu_history = [] self.pred_mu_...
faabl/class_seq
seq4-2.py
seq4-2.py
py
3,796
python
en
code
1
github-code
6
12978124343
import sys from pymongo import MongoClient,DESCENDING,ASCENDING def get_rank(user_id): client =MongoClient() db = client.shiyanlou contests = db.contests #计算用户 user_id 的排名,总分数以及花费的总时间 #排名的计算方法: # 1.找到user_id所对应的信息总和,即得分总数,用时总数 # 2.根据得到的得分与用时,对应排名规则,筛选出排名在该用户前的所有用户 # 3.对筛选结果进行计数,...
JockerMa/syl_challenge3
getrank.py
getrank.py
py
2,282
python
zh
code
0
github-code
6
25493333313
import pandas as pd import numpy as np from card import Card from enums import AttackType, Role, Element class CardBridge: """Wraps a DataFrame of card records, returns Card instances""" dic = { np.nan: AttackType.NONE, 'none':AttackType.NONE, 'melee': AttackType.MELEE, 'range...
GuitarMusashi616/SplinterlandsAI
card_bridge.py
card_bridge.py
py
2,564
python
en
code
5
github-code
6
7092756844
#!/usr/bin/env python3 import ast import astor expr_l = """ for e in g.Edges(): e.dst["sum1"] += e.data123 for e in g.Edges(): e["data1"] = e.data2 / e.dst.sum1 """ expr_l_ast = ast.parse(expr_l) print(ast.dump(expr_l_ast)) def is_call_edges(call): if isinstance(call, ast.Call): f_func = call.fun...
K-Wu/python_and_bash_playground
pyctor/astor_edge_loop_to_node_loop.py
astor_edge_loop_to_node_loop.py
py
4,511
python
en
code
0
github-code
6
650674857
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python import os import json import luigi from cluster_tools import MulticutSegmentationWorkflow def initial_mc(max_jobs, max_threads, tmp_folder, target='slurm'): n_scales = 1 input_path = '/g/kreshuk/data/FIB25/cutout.n5' exp_pa...
constantinpape/cluster_tools
publications/leveraging_domain_knowledge/5_lifted_solver/initial_multicut.py
initial_multicut.py
py
4,330
python
en
code
32
github-code
6
10423097781
#-*- coding: utf-8 -*- """Provides functions for styling output in CLI applications. .. moduleauthor:: Martí Congost <marti.congost@whads.com> """ import sys from warnings import warn from time import time supported_platforms = ["linux"] foreground_codes = { "default": 39, "white": 37, "black": 30, "...
marticongost/cocktail
cocktail/styled.py
styled.py
py
5,595
python
en
code
0
github-code
6
33558200684
'''https://www.practicepython.org/exercise/2014/03/05/05-list-overlap.html''' # Take two lists, say for example these two: # a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] # b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] # and write a program that returns a list that contains only the elements that are common between t...
daneofmanythings/python_practice
5_exercise.py
5_exercise.py
py
2,097
python
en
code
0
github-code
6
36689632480
from __future__ import division import re import sys import threading import pyautogui import pyperclip import os import speech_recognition as sr from pywinauto import Application import time import openai import win32com.client as wincl #발급 받은 API 키 설정 OPENAI_API_KEY = "..." # openai API 키 인증 op...
quswjdgns399/air_command
voicecommand_final.py
voicecommand_final.py
py
13,739
python
en
code
0
github-code
6
26310660224
from alarmageddon.publishing.hipchat import HipChatPublisher from alarmageddon.result import Failure from alarmageddon.result import Success from alarmageddon.publishing.exceptions import PublishFailure from alarmageddon.validations.validation import Validation, Priority import pytest #Successes aren't sent, so monke...
PearsonEducation/Alarmageddon
tests/publishing/test_hipchat.py
test_hipchat.py
py
2,640
python
en
code
15
github-code
6
27089945038
#=============================================================================================================# # HOW TO RUN? # # python3 chop_segments.py ...
STEELISI/Youtube-PG
chop_segments.py
chop_segments.py
py
3,488
python
en
code
0
github-code
6
15619190553
import numpy as np import os from PIL import Image from PIL import ImageFont, ImageDraw import time import core.utils as utils import core.v_detection as detect import cv2 import argparse parser = argparse.ArgumentParser() parser.add_argument('-i', type=str, default="./1.mp4", help="input video") parser.add_argument('...
byq-luo/vehicle_detection-1
video_clients.py
video_clients.py
py
1,122
python
en
code
0
github-code
6
24594203458
from database import db_setup from pdf_parser import PdfParser def main(): pdf_path = '/Users/mak/WebstormProjects/front/halykTEST/pdf_docs/attachment-2.pdf' pdf_parser = PdfParser() database = db_setup() parsed_text = pdf_parser.parse_pdf(pdf_path) database.save_pdf_data(pdf_path, parsed_text) ...
Danialkb/halyk_test
main.py
main.py
py
360
python
en
code
0
github-code
6
34660089311
import requests from bs4 import BeautifulSoup import csv import os URL = 'https://citaty.info/book/quotes' HEADERS = {'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0', 'accept': '*/*'} FILE_CSV = 'quotations_csv.csv' def get_html(url, params=None...
isorokina012/course_work
course_paper.py
course_paper.py
py
1,737
python
en
code
0
github-code
6
72947594108
__author__ = "Balaji Sriram" __version__ = "0.0.1" __copyright__ = "Copyright 2018" __license__ = "GPL" __version__ = "1.0.1" __maintainer__ = "Balaji Sriram" __email__ = "balajisriram@gmail.com" __status__ = "Production" from .BehaviorProtocols import get_behavior_protocol_biogen from .PhysiologyProtocols import get_...
balajisriram/bcore
bcore/Users/Biogen/__init__.py
__init__.py
py
884
python
en
code
1
github-code
6
20660791350
from franz.openrdf.connect import ag_connect from franz.openrdf.query.query import QueryLanguage from franz.openrdf.rio.rdfformat import RDFFormat import os.path #https://franz.com/agraph/support/documentation/current/python/tutorial/example003.html# with ag_connect('Mythologie', host='localhost', port='10035', ...
MarcALieber/rdf_mythology
agMyth.py
agMyth.py
py
2,845
python
en
code
1
github-code
6
70465798267
import sys from cx_Freeze import setup, Executable target = Executable(script="Main_Program_Design.py", base = "Win32GUI", icon="Meat_Icon.ico") setup(name="Meat Shop Management System", version = "1.0", description="A simple program that helps the owner compute the...
zEuS0390/python-meat-shop-management-system
setup.py
setup.py
py
375
python
en
code
1
github-code
6
22083607555
#recursion for quick sort we take last element as pivot def partionOfArray(lst,low,high): print("\n") print("partition array ",lst) i = low - 1 lastIndex = lst[high] for j in range(low,high): if lst[j] < lastIndex: i += 1 temp = lst[i] lst[i]...
vamshipv/code-repo
1 Daily Algo/quickSort.py
quickSort.py
py
968
python
en
code
0
github-code
6
40411446541
#!/usr/bin/env python3 """ Name: example_ndfc_device_info.py Description: Retrieve various information about a device, given its fabric_name and ip_address """ from ndfc_python.log import log from ndfc_python.ndfc import NDFC from ndfc_python.ndfc_credentials import NdfcCredentials from ndfc_python.ndfc_device_info im...
allenrobel/ndfc-python
examples/device_info.py
device_info.py
py
1,219
python
en
code
0
github-code
6
4785274840
h,w = map(int,input().split()) l1 = [] for i in range(h): l1.append(list(input())) l2 = [] for i in range(h): l2.append(list(input())) l1 = list(map(list,zip(*l1))) l2 = list(map(list,zip(*l2))) l1.sort() l2.sort() if l1 == l2: print("Yes") else: print("No")
K5h1n0/compe_prog_new
VirtualContest/adt_all_20231017_2/e (過去のabcのc問題から出題)/main.py
main.py
py
274
python
en
code
0
github-code
6
11036108434
import wx import PropToolPanel import CollisionToolPanel import POIToolPanel class ToolBrowser(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) self.notebook = wx.Notebook(self, -1) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onPageChanged, self.notebook) ...
sdetwiler/pammo
editor/source/ToolBrowser.py
ToolBrowser.py
py
1,872
python
en
code
0
github-code
6
4403084906
import unittest from pyunitreport import HTMLTestRunner import parse_api_test_cases import os import time from api_test_case import ApiTestCase from parse_api_test_cases import TestCaseParser import argparse import logging if __name__ == '__main__': # Argument Parse parser = argparse.ArgumentParser( de...
PengDongCd/ApiTestAssitant
api_test_assistant_main.py
api_test_assistant_main.py
py
2,481
python
en
code
0
github-code
6
32584237829
# # import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) card = dbc.Card( [dbc.CardHeader("Header"), dbc.CardBody("Body", style={"height": 250})], className="h-100", ) ...
thigbee/dashBootstrapThemeExplorer
gallery/layout_template_1.py
layout_template_1.py
py
890
python
en
code
0
github-code
6
72487367548
from tkinter import * from tkinter import messagebox print("hello world"); print("hello world"); print("hello world"); print("hello world"); root = Tk() root.title("Simple Calculator") root.geometry("350x300") root.resizeable(0,0) root.configure(bg="#77526b") equa = "" equation = StringVar() Calculation = Label(root...
arshiaor/simpleCalculator
simpleCalculator.py
simpleCalculator.py
py
4,195
python
en
code
1
github-code
6
35063056732
from json import JSONDecoder, dumps from rest_framework.generics import get_object_or_404 from rest_framework.response import Response from rest_framework.views import APIView from django.db.models import ObjectDoesNotExist from api.models import Record, KeysToken, ChildRecord, User, UnregisteredRecord from api.seri...
cann1neof/mrecord
backend/api/views/view_edit.py
view_edit.py
py
6,173
python
en
code
1
github-code
6
27466136159
# List transports = ["airplane", "car", "ferry"] modes = ["air", "ground", "water"] # Lists contain simple data (index based item) and can be edited after being assigned. # E.g. as transport types are not as limited as in this list, it can be updated by adding or removing. # Let's create a couple of functions for add...
00009115/CSF.CW1.00009115
lists/lists.py
lists.py
py
4,519
python
en
code
1
github-code
6
38020552913
# -*- coding: utf-8 -*- """ Created on Sun May 9 23:54:21 2021 @author: zacha """ import Customer import Department def main(): #Testing Customer class with inputs nam = input("Enter Name: ") stre = input("Enter Street: ") cit = input("Enter City: ") zipc = input("Enter Zip Code: ") ...
Bryan-Tuck/Shopping-System
ShoppingSystem/Tests/CustomerDeptIntegration.py
CustomerDeptIntegration.py
py
932
python
en
code
0
github-code
6
22185534420
import numpy as np import pandas as pd from collections import defaultdict import matplotlib.pyplot as plt from datetime import datetime import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader import torch.optim as optim import os, sys class SDAE(nn.Module)...
yeonjun-in/GNN_Recsys_paper
rec/CDL/model.py
model.py
py
6,259
python
en
code
1
github-code
6
31209322270
from src.mappers.event_mapper import EventMapper from src.domain.entities.event import Event from src.mappers.person_mapper import PersonMapper from src.repositories.entities.event import Event as DataEvent from src.repositories.entities.participation import Participation as DataParticipation class EventRepository(ob...
GDGPetropolis/backend-event-checkin
src/repositories/event_repository.py
event_repository.py
py
1,989
python
en
code
0
github-code
6
21835729444
''' (c) 2008 by the GunGame Coding Team Title: gg_elimination Version: 5.0.498 Description: Players respawn after their killer is killed. Originally for ES1.3 created by ichthys: http://addons.eventscripts.com/addons/view/3972 ''' # ==============================================...
GunGame-Dev-Team/GunGame-Python
addons/eventscripts/gungame/included_addons/gg_elimination/gg_elimination.py
gg_elimination.py
py
7,149
python
en
code
1
github-code
6
71994778748
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Bernoulli from torch.autograd import Variable import torch.optim as optim import numpy as np import random import math import sys import os torch.manual_seed(0) class armax_model(nn.Module): def __init__(self, no_of...
kaustubhsridhar/Constrained_Models
AP/armax_model_on_reformatted_data.py
armax_model_on_reformatted_data.py
py
6,454
python
en
code
15
github-code
6
19541081496
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestRegressor df = pd.read_csv('Franchise_Dataset.csv') df.head() X =df.iloc[:, 1:2].values y =df.iloc[:, 2].values model = RandomForestRegressor(n_estimators = 10, random_state = 0) model.fit(X, y) y_pred =m...
flawlesscode254/Linear-Regression-Assignment
three.py
three.py
py
657
python
en
code
0
github-code
6
45017283256
try: import sys import os.path sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) import os, errno import logging # http://www.onlamp.com/pub/a/python/2005/06/02/logging.html from logging import handlers import argparse #sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pysunspec')) f...
phgachoud/sty-pub-raspi-modbus-drivers
lib/sit_json_conf.py
sit_json_conf.py
py
5,275
python
en
code
0
github-code
6
26774631311
import pygame from sys import exit import numpy as np import copy as cp import math import random as rd import time class GameState: def __init__(self, board): self.board = board self.end=-1 self.children = [] self.parent = None self.parentPlay = None # (play, ...
ToniCardosooo/EIACD-Artificial-Intelligence-Project
ataxx.py
ataxx.py
py
26,079
python
en
code
0
github-code
6
71477184508
import sys sys.stdin = open('input.txt') def make_number(i, j, depth, ans): global visited if depth == 6: if (depth, i, j, ans) not in visited: visited[(depth, i, j, ans)] = 1 result.append(ans) return if (depth, i, j, ans) in visited: return else: ...
YOONJAHYUN/Python
SWEA/14035_격자판의숫자이어붙이기/sol2.py
sol2.py
py
948
python
en
code
2
github-code
6
14696724987
import math import sys from typing import Iterable, Optional import torch from timm.data import Mixup from timm.utils import accuracy import util.misc as misc import util.lr_sched as lr_sched import numpy as np from scipy.stats import spearmanr, pearsonr def train_koniq_epoch(model: torch.nn.Module, criterion: tor...
wang3702/retina_mae
koniq/train_koniq_epoch.py
train_koniq_epoch.py
py
5,602
python
en
code
1
github-code
6
36561155390
from src.Util.GeneralConfig import GeneralConfig from src.FaceRecognition.FaceRecognition import FaceRecognition from src.Camera.Camera import Camera from src.TelegramBot.Bot import Bot import threading enviroment = "Development" #Iniciando Las configuraciones generales generalConfig = GeneralConfig(enviroment) bot ...
portisk8/smartbell-python
SmartBell/main.py
main.py
py
1,273
python
en
code
0
github-code
6
810754112
from scipy import sparse import time import gradient import vector_fields def enforce_boundaries(phi, img_shape, dim): # make sure we are inside the image phi[:, 1] = phi[:, 1].clip(0, img_shape[1]) phi[:, 0] = phi[:, 0].clip(0, img_shape[0]) # 3d case if dim == 3: phi[:, 2] = phi[:, 2].cl...
polaschwoebel/NonLinearDataAugmentation
forward_euler.py
forward_euler.py
py
2,149
python
en
code
2
github-code
6
5832109821
""" Implementation based on: https://www.kaggle.com/c/quora-question-pairs/discussion/33371 """ import networkx as nx import pandas as pd def magic_feature_3_with_load(): train = pd.read_csv('../data/train.csv', encoding='utf-8') test = pd.read_csv('../data/test.csv', encoding='utf-8') return magic_featur...
ahara/kaggle_quora_question_pairs
magic_feature_3.py
magic_feature_3.py
py
4,136
python
en
code
0
github-code
6
28879203989
from Position import Position from random import randint from Animal import Animal from copy import copy class Turtle(Animal): def __init__(self, world, position, strength=2): super().__init__(world, position, 'dark green', 'Turtle', 1, strength, -1, 1) def action(self): chance_to_move = ran...
krzysztofzajaczkowski/world-simulator-python
Turtle.py
Turtle.py
py
1,622
python
en
code
0
github-code
6
22702565799
import logging import random import asyncio import websockets import pandas as pd import numpy as np import plotly.express as px import traits from alleles import * pd.options.plotting.backend = "plotly" #Fix population crash issue #Work on save function, produce population/world snapshots #Improve data visualizati...
Adrian-Grey/EvoProject
evoBackend.py
evoBackend.py
py
15,553
python
en
code
1
github-code
6
16326125244
from typing import Dict import json as _json import datetime as _dt def get_all_events() -> Dict: with open("events.json", encoding='utf-8') as events_file: data = _json.load(events_file) return data def get_all_month_events(month: str) -> Dict: events = get_all_events() month = month...
mysterious-shailendr/Web-Scraping-and-Fast-API
services.py
services.py
py
948
python
en
code
2
github-code
6
74031521788
from matplotlib import pyplot as plt import numpy as np import random import utils features = np.array([1,2,3,5,6,7]) labels = np.array([155, 197, 244, 356,407,448]) print(features) print(labels) utils.plot_points(features, labels) # Feature cross / synthetic feature def feature_cross(num_rooms, population): ro...
sithu/cmpe255-spring21
lecture/regression/home-price.py
home-price.py
py
3,939
python
en
code
1
github-code
6
3706334563
from cgitb import reset from flask import Flask, jsonify, request, render_template import Crypto import Crypto.Random from Crypto.PublicKey import RSA import binascii from collections import OrderedDict from Crypto.Signature import PKCS1_v1_5 from Crypto.Hash import SHA import webbrowser class Transaction: def _...
LoneCannibal/Netherite2
blockchain_client/client.py
client.py
py
3,109
python
en
code
0
github-code
6
72166387389
file = open('./3/3.txt', 'r') input = file.readlines() def get_letter_value(letter): letter_value = ord(letter) if letter_value < 97: return letter_value - 38 return letter_value - 96 def get_matching_letter(): found_items = [] for rucksack in input: item_count = len(rucksack) ...
Haustgeirr/aoc-2022
3.py
3.py
py
569
python
en
code
0
github-code
6
27679932090
"""This module allows to interact with the user via the command line and processes the input information. """ import os import re from inspect import getsourcefile import numpy as np import yaml class CommandLineParser(): """See documentation of the init method. """ def __init__(self) -> None: "...
COMCIFS/instrument-geometry-info
Tools/imgCIF_Creator/imgCIF_Creator/command_line_interfaces/parser.py
parser.py
py
19,777
python
en
code
0
github-code
6
2015306414
import re from pyspark import SparkConf, SparkContext def normalizeWords(text): return re.compile(r'\W+', re.UNICODE).split(text.lower()) conf = SparkConf().setMaster("local").setAppName("WordCount") sc = SparkContext(conf = conf) input = sc.textFile("file:///sparkcourse/book.txt") words = input.flatMa...
gdhruv80/Spark
word-count-better.py
word-count-better.py
py
654
python
en
code
0
github-code
6
43943174399
# M0_C9 - Sudoku Validator import sys import os from typing import List def validate(grid: List[List[int]]) -> bool: """Validates a given 2D list representing a completed Sudoku puzzle""" # Write your code here pass ########################################## ### DO NOT MODIFY CODE BELOW THIS LINE ### ####...
Static-Void-Academy/M0_C9
sudoku_validator.py
sudoku_validator.py
py
1,112
python
en
code
0
github-code
6
25354209094
#!/bin/python3 import math import os import random import re import sys # Complete the countingSort function below. def countingSort(arr): m=max(arr) res=[0]*(m+1) for i in range(len(arr)): res[arr[i]]+=1 ans=[] for i in range(len(res)): if res[i]>0: temp=[i]*res[i] ...
nikjohn7/Coding-Challenges
Hackerrank/Python/38.py
38.py
py
535
python
en
code
4
github-code
6
30536133746
import importlib.util import shutil from pathlib import Path from typing import List import pandas as pd import plotly.express as px from bot_game import Bot EXAMPLES_FOLDER = Path("examples") DOWNLOAD_FOLDER = Path("downloads") DOWNLOAD_FOLDER.mkdir(exist_ok=True) def save_code_to_file(code: str, filename: str): ...
gabrielecalvo/bot_game
util.py
util.py
py
2,208
python
en
code
0
github-code
6
32146044826
# # @lc app=leetcode id=682 lang=python3 # # [682] Baseball Game # # @lc code=start class Solution: def calPoints(self, ops: List[str]) -> int: res = [] for i in ops: if i == '+': res.append(res[-1] + res[-2]) elif i == 'D': res.append(res[-1]...
rsvarma95/Leetcode
682.baseball-game.py
682.baseball-game.py
py
471
python
en
code
0
github-code
6
7176843439
from eth.exceptions import ( ReservedBytesInCode, ) from eth.vm.forks.berlin.computation import ( BerlinComputation, ) from ..london.constants import ( EIP3541_RESERVED_STARTING_BYTE, ) from .opcodes import ( LONDON_OPCODES, ) class LondonComputation(BerlinComputation): """ A class for all ex...
ethereum/py-evm
eth/vm/forks/london/computation.py
computation.py
py
810
python
en
code
2,109
github-code
6
25225726686
from read_the_maxfilename_for_sort import max_number import requests i = 1 temp_number = max_number() def download(url): global i global temp_number print('Processing {0} url:{1}'.format(i,url)) img = open('{}.jpg'.format(temp_number),'wb') respone = requests.get(url, stream=True).content img....
HawkingLaugh/FC-Photo-Download
image_batch_download.py
image_batch_download.py
py
382
python
en
code
0
github-code
6
13575734742
import os import numpy as np import matplotlib matplotlib.use('agg') import xrt.runner as xrtrun import xrt.plotter as xrtplot import xrt.backends.raycing as raycing from SKIF_NSTU_SCW import SKIFNSTU from utilits.xrt_tools import crystal_focus resol='mat' E0 = 30000 subdir=rf"C:\Users\synchrotron\PycharmProjects\SKI...
Kutkin-Oleg/SKIF
SKIF_NSTU_SCW/scans.py
scans.py
py
3,966
python
en
code
0
github-code
6
14117180742
# First we'll import the os module # This will allow us to create file paths across operating systems import os # Module for reading CSV files import csv # Specify the path where the file is residing csvpath = os.path.join('Resources', 'election_data.csv') # Declare variables and intialize total_votes = 0 charles_vo...
Dailyneed/python-challenge
PyPoll/main.py
main.py
py
3,426
python
en
code
0
github-code
6
27516283256
import random from discord.ext import commands class Hive(commands.Cog): def __init__(self, bot): self.bot = bot self._last_member = None @commands.command(name='roll_dice', help='<min> <max>') async def roll_dice(self, ctx, min: int, max: int): await ctx.se...
tintin10q/hive-discord-bot
commands/roll_dice.py
roll_dice.py
py
394
python
en
code
0
github-code
6
21033229877
""" All together Demonstrate how you can build a quick and dirty framework with a bottle like API. Chick is the main application frame. CapitalizeResponse is a middleware which you can use to wrap your application. It stores session information, and it capitalizes all responses. """ def request_factory(env): ""...
oz123/advanced-python
examples/all_together/chick_w_request_response.py
chick_w_request_response.py
py
3,678
python
en
code
9
github-code
6
28156175074
import argparse import sys from pathlib import Path from typing import List import numpy as np import torch from thre3d_atom.modules.volumetric_model.volumetric_model import ( VolumetricModel, VolumetricModelRenderingParameters, ) from thre3d_atom.rendering.volumetric.voxels import ( GridLocation, Fea...
akanimax/3inGAN
projects/thre3ingan/experimental/create_vol_mod_from_npy.py
create_vol_mod_from_npy.py
py
2,878
python
en
code
3
github-code
6
73017760828
from rb_api.dto.two_mode_graph.article_keyword_dto import ArticleKeywordDTO from rb_api.json_serialize import JsonSerialize import json class TopicEvolutionDTO(JsonSerialize): def __init__(self): self.wordList = [] self.yearList = [] def add_year(self, year: int) -> None: self.yearL...
rwth-acis/readerbenchpyapi
rb_api/dto/two_mode_graph/topic_evolution_dto.py
topic_evolution_dto.py
py
1,146
python
en
code
1
github-code
6
29585592655
from fastapi import FastAPI, Depends from sqlalchemy import create_engine from sqlalchemy.dialects.sqlite import * from sqlalchemy.orm import sessionmaker, Session from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String from typing import List from pydantic import BaseMode...
vdtheone/crud_fastapi
main.py
main.py
py
2,199
python
en
code
0
github-code
6
23553579650
import numpy as np import pandas as pd from scipy.io import loadmat def glf( mz: np.ndarray, intens: np.ndarray, delta_cts: float = 0.1, delta_mz: float = 2000.0, k: float = 7.0 ) -> np.ndarray: y1 = np.max(intens) * 0.02 y2 = (np.max(intens) - y1) * delta_cts res = y1 + y2 / (1 + ...
Wimplex/AIJourney_AI4Bio_4th
source/utils/pkf.py
pkf.py
py
1,351
python
en
code
0
github-code
6
22734703340
# -*- coding: utf-8 -*- import json import os import sys import xbmc import xbmcvfs import xbmcaddon import xbmcgui import xbmcplugin import pyxbmct import requests import io import unicodedata import re import ast import sqlite3 import shutil import time from medias import Media, TMDB import medias import zipfile impo...
osmoze06/repo.weebox
repo/plugin.video.sendtokodiU2P/service.py
service.py
py
291,195
python
en
code
2
github-code
6
20827068322
""" ---------------- | [bini-tek] \\ ---------------- By: [bini-tek]\\ Email: binitek.baltimore@gmail.com Discord: Home of bini-tek (https://discord.gg/4GqDrH) ---------------- Version #: 001. DATE: Jan/-3-2021. ---------------- --------------- | EXPLANATION | --------------- The Nubian Di...
bini-tek/nubian-dictionary-v001
nd_final.py
nd_final.py
py
9,571
python
en
code
2
github-code
6
39674044871
from kucoin.client import Trade from kucoin.client import Market import pandas as pd from time import sleep api_key = '60491b8da682810006e2f600' api_secret = 'a79226df-55ce-43d0-b771-20746e338b67' api_passphrase = 'algotrading101' m_client = Market(url='https://api.kucoin.com') client = Trade(api_key, api_secret, api...
briansegs/Kucoin-api-example-
example-2.py
example-2.py
py
1,725
python
en
code
0
github-code
6
71452823867
import os import pandas as pd import numpy as np from keras.models import load_model sample_submission = pd.read_csv('submissions/sample_submission.csv') print(sample_submission['Class']) band = '' def preproc(X_all): X_all[X_all == -np.inf] = -10 X_all[X_all > 1000] = 1000 X_all = np.swapaxes(X_all, 1, ...
Anmol6/kaggle-seizure-competition
make_sub.py
make_sub.py
py
1,618
python
en
code
0
github-code
6
27374563291
"""Terrascript module example based on https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws/""" import terrascript import terrascript.provider config = terrascript.Terrascript() # AWS provider config += terrascript.provider.aws(region="us-east-1") # AWS EC2 module config += terrascript.Modul...
starhawking/python-terrascript
docs/tutorials/module1.py
module1.py
py
638
python
en
code
511
github-code
6
74907691708
# 2-D plot function for SODA TEMPERATURE # YUE WANG # Nov. 12st 2013 import numpy as np import netCDF4 from mpl_toolkits.basemap import Basemap,cm import matplotlib.pyplot as plt def soda_plot(url,variable,llat, ulat, llon, rlon): nc = netCDF4.Dataset(url) var = nc.variables[variable][0,0,:,:] lon ...
yueewang/Python_Digitizer
soda_plot_function_2.py
soda_plot_function_2.py
py
1,539
python
en
code
0
github-code
6
20844889575
import tensorflow.compat.v1 as tf import numpy as np class Detector: def __init__(self, model_path, gpu_memory_fraction=0.25, visible_device_list='0'): """ Arguments: model_path: a string, path to a pb file. gpu_memory_fraction: a float number. visible_device_li...
TropComplique/MultiPoseNet
inference/detector.py
detector.py
py
2,270
python
en
code
9
github-code
6
4691442147
from attrdict import AttrDict from flask import Flask, request, jsonify, make_response from semantic_selector.model.one_to_one import NNFullyConnectedModel from semantic_selector.adapter.one_to_one import JSONInferenceAdapter app = Flask(__name__) model = None @app.before_first_request def startup(): global mod...
cuhavp/semantic_selector
projects/bin/api.py
api.py
py
1,079
python
en
code
null
github-code
6
16116517818
import tools as t import json import requests def get_wikipedia(title): base_url = "https://de.wikipedia.org/w/api.php" params = { "action": "query", "format": "json", "prop": "extracts", "exintro": True, "titles": title } response = requests.get(base_url, para...
Paul-Tru/PyAssistant2
api.py
api.py
py
1,369
python
en
code
0
github-code
6
32019692905
from subprocess import run from pathlib import Path import os from rich.console import Console from rich.markup import escape from builtins import print as builtin_print import shutil if __name__ == "__main__": console = Console(emoji=False) def print(msg): console.print(msg) here = Path(__file__...
Analog-Devices-MSDK/refdes
.github/workflows/scripts/build.py
build.py
py
1,733
python
en
code
14
github-code
6
26529440503
from random import randint, seed # returns best score and the best move of the board #depth is a terminating condition def alphabeta(newGame, game, alpha, beta,depth): emp = newGame.getEmp() if newGame.checkForWinner() == game.curPlayer: return -1, 100 elif newGame.checkForWinner() == gam...
rashigupta37/tic_tac_toe
playerAlphaBeta.py
playerAlphaBeta.py
py
2,814
python
en
code
0
github-code
6
8939054368
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Map-related url(r'^/?$', direct_to_template, {'template': 'p...
epkugelmass/USG-srv-dev
tigerapps/pom/urls.py
urls.py
py
1,045
python
en
code
null
github-code
6
18015924174
import cv2 import sys import PyQt5.QtCore as QtCore from PyQt5.QtCore import QTimer # Import QTimer from PyQt5 from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QLabel, QFileDialog, QInputDialog from PyQt5.QtGui import QImage, QPixmap class TrackingApp(QWidget): def __init__(self): ...
kio7/smart_tech
Submission 2/Task_6/trackingGUI.py
trackingGUI.py
py
3,282
python
en
code
0
github-code
6
19933423422
import requests, zipfile, os, json, sqlite3 def get_manifest(): manifest_url = 'http://www.bungie.net/Platform/Destiny2/Manifest/' print("Downloading Manifest from http://www.bungie.net/Platform/Destiny2/Manifest/...") r = requests.get(manifest_url) manifest = r.json() mani_url = 'http://www.bungi...
RyanGrant/RyanGrant.github.io
Python/Manifest.py
Manifest.py
py
5,969
python
en
code
0
github-code
6
72302702267
# Set the url configurations of address_book app # # (c) 2021 Dip Bhakta, Uttara, Dhaka # email bhaktadip@gmail.com # phone +8801725652782 from django.urls import path app_name='address_book' urlpatterns = [ ]
Dipbhakta007/ZSRecruitment
address_book/urls.py
urls.py
py
219
python
en
code
0
github-code
6
29626198089
import pygame import pathlib import random img_path = pathlib.Path(__file__).parent / 'img' class Locators(object): BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) screen_width = 800 screen_height = 600 random_speed = [1, -1] rect_width = 40 rect_...
aksaule-bagytzhanova/game
Objects.py
Objects.py
py
2,501
python
en
code
0
github-code
6
38589291607
import os from django.conf import settings from django.core.mail import EmailMessage from .models import STATUS_TYPES from smtplib import SMTPException from django.core.mail import BadHeaderError from python_http_client import exceptions import logging logger = logging.getLogger("django") # admin emails (add more her...
NimbusInformatics/bdcat-data-tracker
api/tracker/mail.py
mail.py
py
4,796
python
en
code
3
github-code
6
23456341457
class Stack: def __init__(self): self.stack = [] def push_s(self, data): if data not in self.stack: self.stack.append(data) else: pass def pop_s(self): if len(self.stack) <= 0: print("The stack is empty") else: self.s...
vifirsanova/100-days-of-code
day8/stack.py
stack.py
py
727
python
en
code
1
github-code
6
20516636897
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient import sys import time import json import getopt # Import SPI library (for hardware SPI) and MCP3008 library. import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 # Hardware SPI configuration: SPI_PORT = 0 SPI_DEVICE = 0 mcp = Adafruit_MCP3008.MCP3008(sp...
chls84/TCC
Código Python/medidor-aws-iot.py
medidor-aws-iot.py
py
6,262
python
en
code
0
github-code
6