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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
31676609044 | import time
import pyautogui
import cv2
import numpy as np
import datetime
import win32api
import win32con
import find_box
import log_message
import role_loc
import role_move
import send_message
map_in_store = cv2.imread('img/map_in_store.png')
open_map_btn = cv2.imread('img/open_map.png')
map_title = cv2.imread('img... | fushenghuanyu/GJ | role_action.py | role_action.py | py | 12,490 | python | en | code | 0 | github-code | 1 |
727279415 | from torchvision import models
import torch.nn.functional as nnf
import torch.nn as nn
import utilities
import config
import torch
import time
import sys
import os
class Classify():
def __init__(self, logs):
self.logs = logs
self.modelPath = os.path.join(config.ROOT_DIRECTORY,config.MODEL_ROOT_DIR)... | p4z1/NN-anomaly-detection-system | centrala/netServer.py | netServer.py | py | 3,955 | python | en | code | 1 | github-code | 1 |
33931087105 | # 괄호 변환
# <https://programmers.co.kr/learn/courses/30/lessons/60058>
def chk_balance(data):
cnt = 0
for idx, item in enumerate(data):
cnt = cnt+1 if item=='(' else cnt-1
if cnt == 0:
return data[:idx+1], data[idx+1:]
def chk_right(data):
stack = []
for d in data:
if... | progjs/coding_test | programmers/괄호변환.py | 괄호변환.py | py | 736 | python | en | code | 0 | github-code | 1 |
72457648034 | import torch
from mmdet.core.bbox import BaseBBoxCoder
from mmdet.core.bbox.builder import BBOX_CODERS
@BBOX_CODERS.register_module()
class CameraBBoxCoder(BaseBBoxCoder):
def __init__(self, code_size=8):
self.code_size = code_size
def encode(self, dst_boxes):
targets = torch.zer... | yichen928/SparseFusion | mmdet3d/core/bbox/coders/camera_bbox_coder.py | camera_bbox_coder.py | py | 2,909 | python | en | code | 116 | github-code | 1 |
11939597532 | from __future__ import absolute_import, division, print_function
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
print('tensorflow version:', tf.__version__)
# 1) get data
boston_housing = keras.datasets.boston_housing
(train_data, train_la... | halazila/pythonLearn | tfLearn/houseprice_reg.py | houseprice_reg.py | py | 3,037 | python | en | code | 0 | github-code | 1 |
26345201031 | ## read params
## process
## return dataframe
import os
import yaml
import pandas as pd
import argparse
#read the params from the config path and it will return a dictionary(yaml file)
def read_params(config_path):
with open(config_path) as yaml_file:
config = yaml.safe_load(yaml_file)
return config
#... | SrinivasGuntupalli/simple_dvc_demo | src/get_data.py | get_data.py | py | 1,015 | python | en | code | 0 | github-code | 1 |
27639072195 | import csv
import datetime
import logging
from sme_ptrf_apps.core.models import Associacao, Periodo
from sme_ptrf_apps.core.models.arquivo import (
DELIMITADOR_PONTO_VIRGULA,
DELIMITADOR_VIRGULA,
ERRO,
PROCESSADO_COM_ERRO,
SUCESSO,
)
logger = logging.getLogger(__name__)
CODIGO_EOL = 0
PERIODO = 1
... | rochalet/SME-PTRF-BackEnd | sme_ptrf_apps/core/services/periodo_inicial.py | periodo_inicial.py | py | 3,373 | python | pt | code | 0 | github-code | 1 |
15252889283 | import sys
sys.path.insert(0, '../..')
import generatorUtils as gu
import random
import numpy as np
from base import Decision, ReusableDecision
class ExtraCommand(ReusableDecision):
def registerChoices(self):
self.addChoice(self.getKey(), {
'turn': 100,
'move': 100,
})
... | malik-ali/generative-grading | src/rubricsampling/grammars/codeorg9/extraCommand.py | extraCommand.py | py | 1,217 | python | en | code | 5 | github-code | 1 |
11731959047 | import argparse
import numpy as np
from keras.layers import Conv1D, BatchNormalization, Activation, MaxPool1D
from keras.layers import Dense, Dropout, GlobalMaxPool1D
from keras.models import Input, Model
from keras.utils import to_categorical
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.optimi... | hungchingliu/ML2018SPRING | final/src/method2/train_raw.py | train_raw.py | py | 4,676 | python | en | code | 0 | github-code | 1 |
41331514007 | from datetime import datetime, timedelta
from functools import partial
from itertools import groupby
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools.misc import formatLang
from odoo.osv import expression
from odoo.tools import float_is_zero, ... | sanlin-isgm/starglobal-dev | starglobal/models/sales_ext.py | sales_ext.py | py | 9,730 | python | en | code | 0 | github-code | 1 |
74455165473 | from reportlab.pdfgen.canvas import Canvas
from PollyReports import *
from testdata import data
import sqlite3
import os
from tkinter import messagebox
import webbrowser as vb
# ================== Variables=======
Qty_list = []
Price_list = []
Qty_sum=0
Price_sum=0
# ==========SQL connection============
con=sqlite3.con... | QurbanGujjar/ims | Stock_Report.py | Stock_Report.py | py | 3,580 | python | en | code | 0 | github-code | 1 |
29638027337 | from datetime import datetime
import time
import os
import time
import psutil
import subprocess
from config.configSetup import *
from databaseSendMSG import handle_error, handle_info
def is_vcgencmd_available():
try:
subprocess.check_output(['vcgencmd'], stderr=subprocess.DEVNULL)
return True
... | SoufianeElkha/trading_talib_ccxt_bitmex_XBTUSD | affichage/display.py | display.py | py | 5,203 | python | en | code | 0 | github-code | 1 |
14513270999 | from human import Human
from computer import Computer
class Game():
def __init__(self):
self.player_one = Human()
self.player_two = None
def run_game(self):
print('Welcome to a game of Rock, Paper, Scissors, Lizzard, Spock!')
print('Rule Key is as follows: Rock crushes ... | shaunson4/InheritanceRPSLSproject | game.py | game.py | py | 2,940 | python | en | code | 0 | github-code | 1 |
8503620014 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pathlib import Path
Path("../Docs/graphs").mkdir(parents=True, exist_ok=True)
#Overhead Experiment
W = [25, 50, 100, 200, 400, 800]
L = ['p', 'a']
overhead_data = pd.read_csv("exp_data/overhead.csv")
fig = plt.figure(figsize = (10,10))
ax = ... | amiller68/CMSC-23010 | amiller68-cs23010-spr-21/HW3a/hw3a/analyze.py | analyze.py | py | 2,204 | python | en | code | 0 | github-code | 1 |
32771578748 | from flask import (
Blueprint,
Flask,
abort,
jsonify,
redirect,
render_template,
request,
url_for,
)
from flask_jwt_extended import jwt_required
from flask_simplelogin import get_username, login_required
from api.auth import create_user
from api.controller import (
add_new_category,... | joseevilasio/my-videos-lib | api/views.py | views.py | py | 4,498 | python | en | code | 6 | github-code | 1 |
4441106692 | from flask import Flask, render_template, request, send_file, Response
import nltk
from gtts import gTTS
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
import pyttsx3
import os
import tempfile
from io import BytesIO
imp... | Santho-osh/flaskProject | app.py | app.py | py | 2,872 | python | en | code | 1 | github-code | 1 |
71109775394 | """
Endpoints for management of arkOS Applications.
arkOS Kraken
(c) 2016 CitizenWeb
Written by Jacob Cook
Licensed under GPLv3, see LICENSE.md
"""
import os
from flask import Blueprint, abort, jsonify, request, send_from_directory
from flask.views import MethodView
from arkos import applications
from arkos.message... | arkOScloud/kraken | kraken/frameworks/apps.py | apps.py | py | 3,413 | python | en | code | 5 | github-code | 1 |
28456291602 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 11 06:26:48 2020
@author: Lokeshwar
"""
# In this, the test dataset points are assigned to KMEANS clusters and DBSCAN clusters based on KNN Classifer.
import pandas as pd
from train import features
from sklearn.neighbors import KNeighborsClassifier
file_name = input ('E... | Lokeshwar0304/Data-Mining-CGM-System-Data | Meal data clusters/test.py | test.py | py | 1,453 | python | en | code | 0 | github-code | 1 |
21841342195 | import sys
input = sys.stdin.readline
def team(cur, sta):
global ans
if len(selected) == N // 2:
start = 0
link = 0
non = list(set(num) - set(selected))
for i in range(N // 2):
for j in range(i + 1, N // 2):
start += S[selected[i]][selected... | pearl313/BOJ | 백준/Silver/14889. 스타트와 링크/스타트와 링크.py | 스타트와 링크.py | py | 849 | python | en | code | 0 | github-code | 1 |
5834626397 | import webapp2
import jinja2
import os
import model
import functions
##==============================================================================##
## CreateNewTeam.py Creates a new Team ##
##==============================================================================##
... | PureIso/PythonWebApp | Google App Engine - PlayerTag App/createnewteam.py | createnewteam.py | py | 3,212 | python | en | code | 0 | github-code | 1 |
2144573080 | import requests
from bs4 import BeautifulSoup
from headers import HEADERS
from brainportindustries.hrefFinder import HrefFinder
from csvImporter import CsvImporter
class InfoFinder:
def __init__(self):
self.finder = HrefFinder()
self.url_list = self.finder.get_href_list()
self.importer = C... | redvox27/innovatiespotter | brainportindustries/infoFinder.py | infoFinder.py | py | 991 | python | en | code | 0 | github-code | 1 |
4046943676 | import os
import threading
import common.Api_pb2 as oap_api
from common.Client import Client, ClientEventHandler
from gpiozero import CPUTemperature
# Define cpu threshold (*C)
CPU_THRESHOLD = 60
cpu = CPUTemperature()
class EventHandler(ClientEventHandler):
def __init__(self):
self._notification_chann... | tigattack/CarPi | pi/scripts/cpu_temp_monitor.py | cpu_temp_monitor.py | py | 3,828 | python | en | code | 0 | github-code | 1 |
15128466102 | # O(2n + 2(n*log(n))) -> O(2*n*log(n)) time | O(1) space
# if arrays are different lengths, O(n*log(n) + m*log(m)) time
# if we could not mutate input arrays, space would be O(n + m)
def smallestDifference(arrayOne, arrayTwo):
arrayOne.sort()
arrayTwo.sort()
diff = float('inf')
idxOne, idxTwo = 0, 0
... | mmichalak-swe/Algo_Expert_Python | Smallest_Difference/attempt_3.py | attempt_3.py | py | 777 | python | en | code | 3 | github-code | 1 |
25129705704 | import os
import pandas as pd
import numpy as np
import time
import sys
sys.path.append('E:\\workspace\\work\\Correct\\CorrectClass\\')
from get_now_time import GetNowTime
from ftp_load import FtpLoad
np.set_printoptions(suppress=True)
if __name__ == '__main__':
timeStart = time.time()
print('【开始运行上传报文程序】')
... | xianyu94wo/Correct | FinalCode24/S8FTP_upload.py | S8FTP_upload.py | py | 2,988 | python | en | code | 1 | github-code | 1 |
6829450262 | # coding: utf-8
import csv
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
all_time_series = []
for i in range(15):
file_name = './timeseries_data/timeseries_' + str(i) + '.csv'
f = open(file_name, 'r')
dataReader = csv.reader(f)
for row in dataReader:
... | kozenumezawa/causalviz | python/three-dim-test.py | three-dim-test.py | py | 740 | python | en | code | 1 | github-code | 1 |
11078081992 | import os
from datetime import datetime
def setnum():
pass
# 图片命名格式化
if __name__ == '__main__':
time1 = datetime.now()
PATH = "Datalast_CUT"
SAVE_PATH = "Datalast"
if not os.path.isdir(SAVE_PATH):
os.mkdir(SAVE_PATH)
NUM_init = 9135 #自定义编号
num = NUM_init
for (dirpath, dirnam... | ChangMQ267/VOC2COCO | PhotoSetNum.py | PhotoSetNum.py | py | 858 | python | en | code | 1 | github-code | 1 |
34015117419 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# 1. Import the dataset using Pandas from the given URL
url = 'https://raw.githubusercontent.com/SR1608/Datasets/main/covid-data.csv'
df = pd.read_csv(url)
# 2. High Level Data Understanding
# a. Find no. of rows & columns in the datas... | Kempraju/santhosh | final project.py | final project.py | py | 4,311 | python | en | code | 0 | github-code | 1 |
30830730394 | # Feature 2: Date
from datetime import date
import pyttsx3 as speak
# Get the date
today = date.today()
strdate = today.strftime("%B %d, %Y")
# Create the statement to be spoken
statement2 = "Today is " + strdate + ", have a great day"
# Speak the statement
engine = speak.init()
engine.say(statement2)
engine.runAn... | YouCantTouchThis/Thanos | Date.py | Date.py | py | 328 | python | en | code | 0 | github-code | 1 |
5153499389 | import matplotlib.pyplot as plt
import numpy as np
fp = open('/home/zt/Maillage/sibson/errors.txt', 'r')
errors = fp.readline().split(' ')[:-1]
fp.close()
errors = np.array(errors).reshape((-1, 3)).T
plt.figure(figsize=(15, 8))
plt.plot(errors[0, :-10], color = 'red')
plt.plot(errors[1, :-10], color = 'green')
plt.pl... | Tong-ZHAO/sibson_interpolation | draw_figure.py | draw_figure.py | py | 448 | python | en | code | 0 | github-code | 1 |
11025228790 | #! /usr/bin/env python3
import socket
import sys
import os
from daemonize import Daemonize
if __name__ == "__main__":
# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = '/tmp/accelerator_socket'... | tshaffe1/python-accelerator | old_work/accelerator_client.py | accelerator_client.py | py | 1,122 | python | en | code | 0 | github-code | 1 |
18518116189 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20140919_2201'),
]
operations = [
migrations.AddField(
model_name='todo',
name='ca... | joshgachnang/djangle | example/todo/migrations/0004_auto_20140920_0016.py | 0004_auto_20140920_0016.py | py | 710 | python | en | code | 1 | github-code | 1 |
39415421623 | import xml.etree.ElementTree as ET
from ..track import Track
def parser(
file_path,
*,
require_title=True,
require_duration=False,
require_year=False,
require_bpm=False,
require_fp=False,
default_artist="",
verbose=False,
):
"""
Traktor supports:
- title
- artist
... | slipmatio/playlistparser | src/playlistparser/parsers/traktor.py | traktor.py | py | 1,862 | python | en | code | 2 | github-code | 1 |
29366515053 | import numpy as np
import tools
import matplotlib.pyplot as plt
from importlib import reload
from time import sleep
from tqdm import tqdm
import pickle
import sys
def load_obj(name ):
with open('obj/' + name + '.pkl', 'rb') as f:
return pickle.load(f)
during = int(sys.argv[1]) # Define the simulation time... | mathias77515/Galaxy | continue_sim.py | continue_sim.py | py | 4,963 | python | en | code | 0 | github-code | 1 |
7215287728 | import sys
sys.stdin = open('팰린드롬_input.txt')
# n = int(input())
# arr = list(map(int,input().split()))
# m = int(input())
#
# for tc in range(m) :
# newarr = []
# flag = 0
# s, e= map(int,input().split())
# for i in range(s-1,e) :
#
# newarr.append(arr[i])
# for j in range(len(newarr)) :
#... | HyunSeok0328/Algo | 팰린드롬.py | 팰린드롬.py | py | 1,557 | python | ko | code | 0 | github-code | 1 |
74461736353 | # Refaça o desafio 051, lendo o primeiro termo e a razão de uma PA,
# mostrando os 10 primeiros termos da progressão usando a estrutura while.
# An = a1 +(n-1) *r
#a1 é o primeiro termo
#n é o limite da PA
#r é a razão
cont = 0
termo = int(input('Digite o termo: '))
razao = int(input('Digite a razão: '))
print(f'Sua p... | LuanGermano/Mundo-2-Curso-em-Video-Python | exercicios2/ex061.py | ex061.py | py | 505 | python | pt | code | 0 | github-code | 1 |
38959673751 | from PyQt5.QtWidgets import QWidget,QLineEdit,QHBoxLayout, QVBoxLayout
from UI.Components.button_container import ButtonContainer #buttonClickNoise
from UI.KeyboardPage.completer import suggestWords
groupedChars = ['abc | def | ghi',
'jkl | mno | pqr',
'stu | vwx | yz0',
... | WATOLINK/mind-speech-interface-ssvep | SSVEP-Interface/UI/KeyboardPage/KeyboardWidget.py | KeyboardWidget.py | py | 6,719 | python | en | code | 21 | github-code | 1 |
7728542412 | import xarray as xa
from data import eisc
from data import zc
from data import dcm
test_run = True
input_dir = "/discover/nobackup/projects/eis_freshwater/swang9/OL_1km/OUTPUT.RST.2013"
month = "201303" if test_run else "*"
eisc( cache = "/gpfsm/dnb43/projects/p151/zarr", mode = "eis.freshwater.swang9" )
input = f"{i... | nasa-nccs-cds/eis_smce | workflows/input_info.py | input_info.py | py | 654 | python | en | code | 0 | github-code | 1 |
75201417632 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Created on 2017/12/16
__author__ = "Jianguo Jin (jinjianguosky@hotmail.com)"
"""
Description:
"""
import unittest
from selenium import webdriver
class SearchTest(unittest.TestCase):
"""【天猫产品搜索】单元测试版本 """
def test_search_by_name(self):
... | skyaiolos/SeleniumWithPython | sec26_unittestWithselenium/search_test.py | search_test.py | py | 803 | python | en | code | 1 | github-code | 1 |
28415635027 | import copy
import unittest
# Local stuff:
from game_board import GameBoard
import solvers
# A constant valid board. I absolutely did not copy this by hand from an example online.
valid_board = [
[5, 3, 4, 6, 7, 8, 9, 1, 2],
[6, 7, 2, 1, 9, 5, 3, 4, 8],
[1, 9, 8, 3, 4, 2, 5, 6, 7],
[8, 5, 9, 7, 6, 1, ... | gondsm/sudoku | unit_tests.py | unit_tests.py | py | 9,896 | python | en | code | 0 | github-code | 1 |
2234470277 | from django.urls import path
from django.http import HttpResponse
from django.template import Template, Context
def index(request):
return HttpResponse('''
<h1>Welcome to my homepage</h1>
<a href="/my-favorite-characters">My favorite Game of Thrones characters</a> <br />
<a href="/about-me... | errinmarie/FeedBack | Documents/BACKEND/week5/5.3-heroku/activities/1-django/manage.py | manage.py | py | 1,391 | python | en | code | 0 | github-code | 1 |
2122531309 | #Program to prove the Collatz conjecture
n = int(input("Enter a positive integer: "))
#Keep looping until we reach 1
while n!= 1:
#Print the current value of n
print(n)
#If n is even, divide by 2
if n % 2 == 0:
n = n//2
#If n is odd, multiply by 3 and add 1
else:
n = (3*n) +1
... | BarryClarke/Collatz | Collatz.py | Collatz.py | py | 351 | python | en | code | 0 | github-code | 1 |
2561956080 | from django.db import models
from django.contrib.auth.models import User
from final.settings import AUTH_USER_MODEL as User
# 질문란
class Question(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
subject = models.CharField(max_length=200)
content = models.TextField()
create_date =... | zzoall/EmoAI | QnA/models.py | models.py | py | 826 | python | en | code | 0 | github-code | 1 |
2566862636 | # Jan Faryad
# 2. 7. 2017
#
# conversion of the onto IDs to udapi nodes
class Onto_word_conversion:
def __init__( self, list_of_corefs_clusters, list_of_corresponding_words):
"""
list of clusters, cluster have list of coreferents of type Onto_coreferent
correspondence ... pairs ( onto id, n... | Jankus1994/Coreference | Coreference/OntoNotes/onto_word_conversion.py | onto_word_conversion.py | py | 2,607 | python | en | code | 0 | github-code | 1 |
71530148513 | import random
import requests
import time
class LED_manager:
def __new__(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(LED_manager, cls).__new__(cls)
return cls.instance
def __init__(self) -> None:
self.leds = []
self.create_leds()
def c... | hackaton-ssipf/backend | WLED/main.py | main.py | py | 2,278 | python | en | code | 0 | github-code | 1 |
41973095065 | from .transformer import Transformer
from musikla.core import Voice
from musikla.core.events import MusicEvent, NoteEvent, RestEvent, ChordEvent
from typing import List, Optional
class SlidingAverage():
def __init__ ( self, capacity : int = 0 ):
self.history : List[float] = []
self.capacity = capac... | pedromsilvapt/miei-dissertation | code/musikla/musikla/core/events/transformers/voice_identifier.py | voice_identifier.py | py | 7,553 | python | en | code | 0 | github-code | 1 |
72858868514 | import random
user_wins = 0
computer_wins = 0
options = ['r', 'p', 's']
while True:
user_input = input("Type Rock[r]/Paper[p]/Scissors[s] or q to quit: ").lower()
if user_input == 'q':
break
if user_input not in options:
continue
random_number = random.randint(0, 2)
# rock: 0, pa... | dev-kani/5_mini_python_projects | rock_paper_scissors.py | rock_paper_scissors.py | py | 908 | python | en | code | 1 | github-code | 1 |
21004978153 | from streamer.database import StreamerDB
from pymongo.errors import WriteError
class StreamerUsers:
def __init__(self):
"""
BookdlUsers is the mongo collection for the documents that holds the details of the users.
Functions:
insert_user: insert new documents, that contains t... | Samfun75/SamfunStreamerBot | streamer/database/users.py | users.py | py | 2,611 | python | en | code | 2 | github-code | 1 |
72065337954 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 2 14:31:00 2019
@author: andrew
"""
import numpy as np
from pyDOE import lhs as LHS
import subprocess
import os
import time
from scipy.special import erf as ERF
#import sys
from os.path import expanduser
import IscaOpt
# home directory
home = e... | en9apr/M_penalised_funtions | forrester_BO_search.py | forrester_BO_search.py | py | 38,867 | python | en | code | 0 | github-code | 1 |
145946204 | import sys
import os
import argparse
from spinalcordtoolbox.utils import Metavar, SmartFormatter, init_sct, display_viewer_syntax, printv
from spinalcordtoolbox.image import Image
from spinalcordtoolbox.qmri.mt import compute_mtr
def get_parser():
parser = argparse.ArgumentParser(
description='Compute ma... | jem0101/BigSwag-SQA2022-AUBURN | TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/neuropoly@spinalcordtoolbox/scripts/sct_compute_mtr.py | sct_compute_mtr.py | py | 2,243 | python | en | code | 2 | github-code | 1 |
31936896058 | from __future__ import print_function
import sys
from operator import add
from pyspark import SparkContext
def splitWith(rowString, rowIndex):
colValue = list(map(int, rowString.split(',')))
retValue = []
for colIndex,item in enumerate(colValue):
retValue.append((colIndex,(rowIndex,item)))
... | alokparmesh/csep524 | hw4/matrixVectorMultiply.py | matrixVectorMultiply.py | py | 1,345 | python | en | code | 0 | github-code | 1 |
40420564164 | from pathlib import Path
import string
data_folder = Path(".").resolve()
type_to_priority = dict(zip(string.ascii_letters, range(1, 53)))
def parse_data(data):
rucksacks = [[type_to_priority[l] for l in line] for line in data.split("\n")]
return rucksacks
def find_common_type(rucksack):
comp_size = len... | eirikhoe/advent-of-code | 2022/03/sol.py | sol.py | py | 1,365 | python | en | code | 0 | github-code | 1 |
2733118265 | import io
from pathlib import Path
import flask
import numpy as np
import pandas as pd
from .utils import list_dir
from .model import define_model
class ServeConfig:
OPT_ML_DIR = Path("/opt/ml")
MODELS_DIR = OPT_ML_DIR / "models"
ASSETS_PATH = Path("./assets")
ASSETS_PATH.mkdir(parents=True, exist_... | tungbui198/sm-safe-deployment-aishield | container/code/predictor.py | predictor.py | py | 3,086 | python | en | code | 0 | github-code | 1 |
18209204664 | from const import *
import sys
from datetime import datetime
import numpy as np
import cv2
import os
from time import sleep
from threading import *
from utils import *
def removeTxt(txtBuffer):
import os
txtFileList = os.listdir(txtBuffer)
for item in txtFileList:
if item.endswith(".txt"):
... | navilo314hku/FYP | txtToJpg.py | txtToJpg.py | py | 4,636 | python | en | code | 0 | github-code | 1 |
16437971384 | # 풀이 참조
from sys import *
input = stdin.readline
from collections import *
def bfs(x, y):
q = deque()
q.append((x, y))
visit[x][y] = 1
while q:
x, y = q.popleft()
for dx, dy in [(-1, 0), (0, 1), (1, 0), (0, -1)]:
nx, ny = x + dx, y + dy
if nx < 0 or ny < 0 or ... | ttppggnnss/CodingNote | 2002/0226/bj 2573-10.py | bj 2573-10.py | py | 974 | python | en | code | 0 | github-code | 1 |
17418909566 | import collections
import math
from collections import deque
class Graph:
def __init__(self):
self.vertices = set()
# makes the default value for all vertices an empty list
self.edges = collections.defaultdict(list)
self.weights = {}
def add_vertex(self, value):
self.v... | nzavarinsky/Algorhitms | LABA4(dijkstra-algo)/dijkstra-v3.py | dijkstra-v3.py | py | 3,072 | python | en | code | 1 | github-code | 1 |
6504127042 | from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_cdnendpoint
version_added: "2.8"
short_description... | testormoo/ansible-azure-complete | modules/library/azure_rm_cdnendpoint.py | azure_rm_cdnendpoint.py | py | 21,277 | python | en | code | 0 | github-code | 1 |
74065867873 | import torch
import numpy as np
import pickle
from tqdm import tqdm
import pandas as pd
import math
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, log_loss
from sentence_transformers import SentenceTransformer, models
from transformers import AutoModel, AutoTokenizer
import os
os.... | bavik022/thesis-ambiguity_detection | bert_finetune_cuda_test.py | bert_finetune_cuda_test.py | py | 7,314 | python | en | code | 0 | github-code | 1 |
38639095519 | """
Need to consider the switching on and off of physics schemes with reduced
precision. Show the active/deactive points as a function of precision for
selected physics schemes (Vertical Diffusion/Surface Fluxes/Convection)
"""
import numpy as np
import matplotlib.pyplot as plt
import iris.plot as iplt
from myscripts... | leosaffin/scripts | myscripts/projects/ithaca/rp_physics/fig5_physics_activation.py | fig5_physics_activation.py | py | 3,054 | python | en | code | 2 | github-code | 1 |
38488304977 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Load the cleaned data
data = pd.read_csv("C:\\Users\\wamm1\\Desktop\\midterm\\clean_pop.csv")
# List of countries for visualization
countries = ['Canada', 'India', 'Kenya', 'Brazil', 'Ukraine']
# Filter data for these countries
selected_coun... | TRAP33ZOID/Global-Population-Trends | statistical_modelling/infant_mortality_rates.py | infant_mortality_rates.py | py | 636 | python | en | code | 0 | github-code | 1 |
40419644184 | from pathlib import Path
import numpy as np
import copy
from itertools import permutations
import re
data_folder = Path(__file__).parent.resolve()
reg = re.compile(
r"(\w+) would (lose|gain) (\d+) happiness units by sitting next to (\w+)."
)
class Table:
def __init__(self, data):
happiness = []
... | eirikhoe/advent-of-code | 2015/13/sol.py | sol.py | py | 2,381 | python | en | code | 0 | github-code | 1 |
18808337505 | """
plot_model.py
Code to plot an HII region model fit and data
Based on IDL code by A.A. Kepley
Trey Wenger June 2016
dsb 21Jun2016 - Use linecolor to distinguish models instead of linestyle
dsb 02Sep2016 - Modify units labels in plots
dsb 14Sep2016 - Add spontaneous emission model; GBT data point
dsb 26Sep2016 - Cr... | tvwenger/HII-Region-Models | plot_model.py | plot_model.py | py | 11,647 | python | en | code | 1 | github-code | 1 |
74339324514 | import os
import sys
import requests
from pymongo import MongoClient
from apscheduler.schedulers.blocking import BlockingScheduler
# For simplicity, we are hardcoding the GitHub URL here.
GITHUB_URL = "https://github.com/akto-api-security/pii-types/blob/master/general.json"
# We can also pass the GitHub URL as an envi... | rabilrbl/Akto-Assessment | script.py | script.py | py | 2,073 | python | en | code | 0 | github-code | 1 |
40420182184 | from pathlib import Path
import numpy as np
data_folder = Path(".")
class IntCodeProgram:
"""A Class for the state of an IntCode program"""
def __init__(self, instr):
self.instructions = dict(zip(list(range(len(instrs))), instrs))
self.rel_base = 0
self.instr_ptr = 0
self.inp... | eirikhoe/advent-of-code | 2019/11/sol.py | sol.py | py | 7,361 | python | en | code | 0 | github-code | 1 |
14093676725 | # The Polymorphism is the provision of a single interface for all class which was inherited it
# Like the example in previous session
# So, I'll create the base class with the base method (but cannot implement)
# When the child class inherits this class, they will implement this methods
# Depend on the child class, the... | ntlinh8/python-basic | python.oop/Topic_15_Polymorphism.py | Topic_15_Polymorphism.py | py | 991 | python | en | code | 0 | github-code | 1 |
18556723155 | import torch
import torch.nn
from collections import OrderedDict
from deep_learning.architectures.Resnet3D.model import get_pretrained_resnet
from deep_learning.architectures.ClinicalNet import ClinicalNet
def load_trained_model(model, weights_path):
print('loading pretrained model {}'.format(weights_path))
... | lukasfolle/MRI-Classification-RA-PsA | deep_learning/architectures/Resnet3D/ensemble.py | ensemble.py | py | 4,060 | python | en | code | 2 | github-code | 1 |
35023402134 | def solution(babbling):
answer = 0
cap = ["aya", "ye", "woo", "ma"]
d_cap = ['ayaaya','yeye','woowoo','mama']
b = []
b2 = []
for i in babbling:
if i in cap:
answer += 1
else:
b.append(i)
for i in b:
count = 0
for e in d_cap:
... | JinEunPark/solveAlgo | algo/new8.py | new8.py | py | 792 | python | en | code | 0 | github-code | 1 |
28010157790 | """This is the utils module.
Module for storing information to the file between program launches.
"""
from os import path
import json
# '/your_absolute_path_here/notes.json'
JSON_FILE = path.abspath('notes.json')
def save_to_file(notes: list) -> None:
"""
Save the list with notes to a file.
:param not... | allwdesign/notes | utils.py | utils.py | py | 936 | python | en | code | 0 | github-code | 1 |
15288174099 | from django.shortcuts import get_object_or_404
from services.models import Services
from decimal import Decimal
def get_cart_items_and_total(cart):
cart_items = []
total = 0
for item_id, item_quantity in cart.items():
this_service = get_object_or_404(Services, pk=item_id)
this_total = this_... | wolfenchic/djvalet | cart/utils.py | utils.py | py | 700 | python | en | code | 0 | github-code | 1 |
32685523051 | class Sort:
def bubble_sort(self,list):
for i in range(0,len(list)-1):
for j in range(0,len(list)-1-i):
if list[j] > list[j+1]:
list[j] , list[j+1] = list[j+1] , list[j]
else:
list[j]
return list
def insertionSort(self,arr):
for i in range(1, len(arr)):
key = ar... | Bencybaby1234/DSprac | practical6.py | practical6.py | py | 989 | python | en | code | 0 | github-code | 1 |
14287230397 | import logging
from smtplib import SMTPException
from django.contrib import messages
from django.core.mail import EmailMultiAlternatives
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_laz... | senyehor/energokodros_website | utils/common/email.py | email.py | py | 1,377 | python | en | code | 0 | github-code | 1 |
21870337610 | from collections import OrderedDict
from six.moves.urllib.parse import urlencode
def joined_or_null(arr):
return "null" if len(arr) == 0 else ','.join(arr)
def build_url(path, includes=None, fields=None):
connector = '&' if '?' in path else '?'
params = {}
if includes:
params.update({'inclu... | Patreon/patreon-python | patreon/jsonapi/url_util.py | url_util.py | py | 787 | python | en | code | 109 | github-code | 1 |
5644139426 | # import matplotlib.pyplot as plt
# import numpy as np
#
# # Sample data for clustered columns
# categories = ['Category A', 'Category B', 'Category C']
# values1 = [15, 25, 30]
# values2 = [10, 20, 25]
#
# # Create an array for the x-axis positions
# x = np.arange(len(categories))
#
# # Set the width of each bar
# bar... | sonyavalo/statistics_paper_sofya_23 | test.py | test.py | py | 1,565 | python | en | code | 0 | github-code | 1 |
42614751433 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Bertrand256
# Created on: 2021-04
from __future__ import annotations
import hashlib
import logging
import re
import sys
import threading
import time
from datetime import datetime
from enum import Enum
from typing import Callable, Optional, List, Dict, Any, Tuple
... | Bertrand256/dash-masternode-tool | src/app_main_view_wdg.py | app_main_view_wdg.py | py | 123,464 | python | en | code | 69 | github-code | 1 |
9512087556 | from pathlib import Path
import pendulum
from airflow.models import Variable
from docker.types import Mount
class AppConst:
DOCKER_USER = Variable.get("DOCKER_USER", "thangphan")
PROJECT = "real_estate"
IMAGE_NAME = "model_serving"
TAG = "latest"
class AppPath:
ROOT_DIR = Path(Variable.g... | Thangphan0102/RealEstateProject | code/model_serving/dags/utils.py | utils.py | py | 1,943 | python | en | code | 0 | github-code | 1 |
34007644605 | # https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=ja
N, W = map(int, input().split())
VW = [list(map(int, input().split())) for _ in range(N)]
# N, W = 100, 10000
# VW = [[i, 1] for i in range(N)]
VW = [None] + VW
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(1, N+1):
... | yojiyama7/python_competitive_programming | not_contested/blue_100_problems/035_0_1_knapsack_problem.py | 035_0_1_knapsack_problem.py | py | 571 | python | en | code | 0 | github-code | 1 |
17397569699 | import pygame
from time import *
pygame.init()
win=pygame.display.set_mode((300,300))
sleep(5)
pygame.mixer.music.load("1.mp3")
pygame.mixer.music.play(0,0,800)
run=True
click=[0,0,0]
def check_events():
global run,keys,mouse_pos,mouse_down,click
for event in pygame.event.get():
if event.typ... | makazis/School-Project-23.04.2023 | Music/Beat_Syncer.py | Beat_Syncer.py | py | 754 | python | en | code | 0 | github-code | 1 |
16675614140 | import json
from mitmproxy import ctx
from habdel_mongo import mongo_info
def response(flow):
if "https://aweme.snssdk.com/aweme/v2/feed" in flow.request.url: #原视频链接获取
info = ctx.log.info
info(flow.response.text)
# print(flow.response.text,"888888888"*10)
# print(flow.request.url)
... | luopeixiong/python-test | 爬虫项目/app爬虫/抖音抓取/decode_douyin.py | decode_douyin.py | py | 1,101 | python | en | code | null | github-code | 1 |
3977143656 | import pygame
import random
import os
from enum import Enum
pygame.init()
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
class GameObject(pygame.sprite.Sprite):
def __init__(self, image_file, position):
super(GameObject, self).__init__()
self._image = pygame.image.load(image_file)
self.rect ... | praveensvsrk/CatchEmAll | CatchEmAll.py | CatchEmAll.py | py | 8,375 | python | en | code | 0 | github-code | 1 |
18216174452 | import os
import tkinter as tk
import sys
from tkinter import filedialog
from tkinter import ttk
from openslide import open_slide
from openslide.deepzoom import DeepZoomGenerator
from modules.recorder import Recorder
class FileSelection:
def __init__(self, master):
self.master = master
self.frame... | UmarJ/lsiv-python3 | interface_recorder.py | interface_recorder.py | py | 2,510 | python | en | code | 2 | github-code | 1 |
8669162789 | #!/usr/bin/env python3
# coding:utf8
import sys
import re
import requests
from bs4 import BeautifulSoup
import json
import random
from django.http import HttpResponse
from requests.packages.urllib3.exceptions import InsecureRequestWarning
reload(sys)
sys.setdefaultencoding('utf8')
requests.packages.urllib3.disable_w... | songkuixi/JapaneseWordBook-Server | search/WordSearchNew.py | WordSearchNew.py | py | 5,204 | python | en | code | 0 | github-code | 1 |
73033755553 | # -*- coding: utf-8 -*-
'''
Beacon to monitor disk usage.
.. versionadded:: 2015.5.0
'''
# Import Python libs
from __future__ import absolute_import
import logging
import psutil
import re
# Import Salt libs
import salt.utils
log = logging.getLogger(__name__)
__virtualname__ = 'diskusage'
def __virtual__():
i... | shineforever/ops | salt/salt/beacons/diskusage.py | diskusage.py | py | 1,359 | python | en | code | 9 | github-code | 1 |
17094280444 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from decimal import Decimal
class Migration(migrations.Migration):
dependencies = [
('gas', '0005_auto_20150827_0116'),
]
operations = [
migrations.AddField(
model_name='... | stpyang/downtowndivers | gas/migrations/0006_gas_other_percentage.py | 0006_gas_other_percentage.py | py | 509 | python | en | code | 2 | github-code | 1 |
38843635225 | import pandas as pd
import datetime as dt
import os
from difflib import SequenceMatcher
# This module takes downloaded golf score data and parses from said data
# round scores for individual golfers and course data. This information is
# written to CSVs
# NOTES
# Data is curated such that certain events are excluded
... | mtdiedrich/Golf | Collection/html_parser.py | html_parser.py | py | 6,395 | python | en | code | 8 | github-code | 1 |
44958344082 | # coding=utf-8
#
# created by kpe on 04.11.2019 at 2:07 PM
#
from __future__ import division, absolute_import, print_function
import unittest
import os
import tempfile
import numpy as np
import tensorflow as tf
import bert
from .test_common import AbstractBertTest, MiniBertFactory
class TestExtendSegmentVocab(A... | kpe/bert-for-tf2 | tests/test_extend_tokens.py | test_extend_tokens.py | py | 1,556 | python | en | code | 802 | github-code | 1 |
8285329290 | import requests
import pyqrcode
import traceback, ctypes, msvcrt, time, os
from bs4 import BeautifulSoup
from datetime import datetime
from dateutil import parser as dateutil_parser
def wait_any_key(prompt):
print(prompt, end = "", flush = True)
msvcrt.getch()
print()
# Negatives: infinite retries; others... | apkipa/NuaaFTRecorder | 飞天云课堂录播工具.py | 飞天云课堂录播工具.py | py | 8,680 | python | en | code | 0 | github-code | 1 |
16515322325 | import sys
from nurpg.document import load_document_yaml, load_character
from nurpg.format import *
def read_character(path, model):
with open(path, 'r') as fin:
return load_character(fin, model)
def main():
target = 'document'
if len(sys.argv) > 1:
target = sys.argv[1]
# Run defau... | zinic/crawl | nurpg/main.py | main.py | py | 853 | python | en | code | 1 | github-code | 1 |
28138936168 | from unittest import TestCase, mock
from ..data_sources.postgres.default import PostgresDataSource
TESTED_MODULE_PATH = 'longitude.core.data_sources.postgres.default.%s'
class TestSQLAlchemyDataSource(TestCase):
def setUp(self):
# We mock the calls to the internal engine creation for all tests
p... | GeographicaGS/Longitude | longitude/core/tests/test_data_source_postgres.py | test_data_source_postgres.py | py | 2,223 | python | en | code | 1 | github-code | 1 |
15252690223 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.models.attention import SelfAttention
class DirectInferenceNet(nn.Module):
# DEPRECATED
r"""No autoregre... | malik-ali/generative-grading | src/models/inference_net.py | inference_net.py | py | 13,330 | python | en | code | 5 | github-code | 1 |
3052862341 | '''
lcbci_lab.py is a serial UI interface
The program is adapted from ZetCode's tutorial
on Tkinter's layout management. The tutorial can
be found here: http://zetcode.com/tkinter/layout/
@author : Chanha Kim
@date : 07/06/2020
'''
import tkinter as tk
from tkinter import W, N, E, S, ttk
class lcbci_lab(ttk.Frame... | chanhakim/mbci | guis/tkinter/lcbci_lab_tkinter_prototype.py | lcbci_lab_tkinter_prototype.py | py | 2,482 | python | en | code | 0 | github-code | 1 |
11827553484 | # Project Euler
# Problem 6: Sum square difference
# The sum of the squares of the first ten natural numbers is:
# 1^2 + 2^2 + 3^2 + ... + 10^2 = 3025
# The square of the sum of the first ten natural numbers is:
# (1 + 2 + 3 + ... + 10)^2 = 55^2 = 385
# Hence the difference between the sum of the squares of the first ... | zerot69/Project-Euler | Problem 001-050/problem_006.py | problem_006.py | py | 871 | python | en | code | 0 | github-code | 1 |
11702648802 | import json
import csv
AUTHORS_JSON_PATH = '/Users/AB/Dropbox/Dev/CWP/authors.json'
NARRATIVES_JSON_PATH = '/Users/AB/Dropbox/Dev/CWP/narratives.json'
with open(AUTHORS_JSON_PATH, 'r') as f:
authors = json.load(f)
with open(NARRATIVES_JSON_PATH, 'r') as f:
narratives = json.load(f)
with open('narratives.csv... | bakera81/cwp-literacynarratives | json_to_csv.py | json_to_csv.py | py | 1,033 | python | en | code | 0 | github-code | 1 |
8403487450 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Объект цифрового LED индикатора.
"""
import wx
from ic.components import icwidget
from ic.utils import util
from ic.PropertyEditor import icDefInf
from ic.log import log
from ic.bitmap import bmpfunc
import wx.lib.gizmos as parentModule
LED_NUMBER_CTRL_STYLE = {'... | XHermitOne/defis3 | SCADA/SCADA/usercomponents/led_number_ctrl.py | led_number_ctrl.py | py | 7,716 | python | ru | code | 0 | github-code | 1 |
15471707418 | from functools import reduce
def my_lambda(acc,val):
res, max = acc
if(val>max):
max = val
res+=1
return res,max
myList = [1,2,3,4,5,1]
skyscraper = reduce(my_lambda, myList, (0,0))
print(myList, "Il max cambia " ,skyscraper[0], " volte") | FilippoBotti/linguaggi-Paradigmi | python/fold_skyscraper.py | fold_skyscraper.py | py | 269 | python | en | code | 0 | github-code | 1 |
30516352863 | #此处笛卡尔积的计算实现过程如下:
#加入你需要一个列表,表里是3种不同尺寸的T恤衫,每个尺寸有两个颜色,列表推导写法为:
colors = ['black', 'white']
sizes = ['S', 'M', 'L']
Tshitr = [(color,size) for color in colors for size in sizes] #这里得到的是先以颜色排列,再以尺码排列顺序
print(Tshitr)
#迭代写法为:
for color in colors:
for size in sizes:
print((color,size))
'''
则第一章中的纸牌可以写为:
class... | 15963064649/-Fluent-Python-NOTE | 第二章/2.1.2计算笛卡尔积.py | 2.1.2计算笛卡尔积.py | py | 621 | python | zh | code | 1 | github-code | 1 |
38182352525 | from types import NoneType
import pandas as pd
import matplotlib.pyplot as plt
import streamlit as st
import functions as func
import eda
def info_input(data):
##########################################################################################
###Prediction value input
#############################... | HAL9044/IronHack-s-Final-Project | files/ml.py | ml.py | py | 10,675 | python | en | code | 0 | github-code | 1 |
21058207959 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 11 16:12:35 2018
@author: yangchg
"""
import requests, json, time, sys
from bs4 import BeautifulSoup
from contextlib import closing
import pandas as pd
class lianjiaDownloader():
def __init__(self, url):
self.server = 'http://sh.lianjia.com'
sel... | ycg860102/crawing | 链家/lianjia.py | lianjia.py | py | 4,603 | python | en | code | 0 | github-code | 1 |
41055406846 | import json
import logging
import smtplib
import ssl
import boto3
from botocore.exceptions import ClientError, WaiterError
from ses_identities import SesIdentity
from ses_templates import SesTemplate
from ses_generate_smtp_credentials import calculate_key
logger = logging.getLogger(__name__)
# snippet-start:[python.... | awsdocs/aws-doc-sdk-examples | python/example_code/ses/ses_email.py | ses_email.py | py | 9,394 | python | en | code | 8,378 | github-code | 1 |
1833646743 | import requests
from bs4 import BeautifulSoup
from collections import Counter
from models.autor import Autor
from models.cancion import Cancion
from models.cantante import Cantante
def obtener_letra(url):
# Realizo una solicitud para obtener el contenido de la página
response = requests.get(url)
# Parseo ... | JGaratL/ejercicio-python | populate_data.py | populate_data.py | py | 4,432 | python | es | code | 0 | github-code | 1 |
18364517190 | #!/usr/bin/env python
import unittest
import random
import os
import numpy as np
import fseq
def discoverSubclasses(cls):
"""Returns a list of all classes derived from the the supplied base
class.
Implementation based on ubuntu's answer to related question on
StackOverflow [1]_.
Parameters
... | local-minimum/fseq | fseq/tests/test_seq_encoder.py | test_seq_encoder.py | py | 14,102 | python | en | code | 0 | github-code | 1 |
35361793296 | from setuptools import setup, find_packages
from pathlib import Path
this_directory = Path(__file__).parent
# long_description = (this_directory / "README.md").read_text()
with open(this_directory / "README.md", encoding="utf8") as file:
long_description = file.read()
VERSION = '0.1.10'
DESCRIPTION = 'Python g... | eduardogpg/pygenerate | setup.py | setup.py | py | 1,150 | python | en | code | 3 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.