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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
36002387905 | from time import time
from tkinter import *
from tkinter.ttk import *
from tkinter.messagebox import showinfo
from tkinter import scrolledtext
import classpip
import time
import os
import sys
import webbrowser,json
from csv import reader
from PIL import Image, ImageTk
def gpl3(event):
webbrowser.op... | lidongxun967/PIP-GUI | main.pyw | main.pyw | pyw | 6,113 | python | en | code | 2 | github-code | 36 |
73744223785 | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import logging
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
VERSION = "1.0"
# Application definition
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'... | lingdb/CoBL-public | ielex/settings.py | settings.py | py | 5,555 | python | en | code | 3 | github-code | 36 |
31530031563 | # A. 입력 예시
# ['eat','tea','tan','ate','nat','bat']
# B. 출력 예시
# [ ['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat'] ]
word_list = ['eat','tea','tan','ate','nat','bat']
alphabet = {'a' : 1, 'b' : 2, 'e' : 3, 'n' : 4, 't' : 5}
reverse_alphabet = {1 : 'a', 2 : 'b', 3 : 'e', 4 : 'n', 5 : 't',}
lst = []
for i in ... | Ikthegreat/TIL | Homework/0118/nogada1.py | nogada1.py | py | 3,767 | python | en | code | 0 | github-code | 36 |
42932594486 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Output, Input
import dash_bootstrap_components as dbc
import pandas as pd
import plotly.express as px
from plotly.graph_objs import *
def run_dash(bales_graph_file_path, pie_chart_file_path, bar_... | Tijzz/ComptencyAnalysisTool | Dash.py | Dash.py | py | 6,994 | python | en | code | 0 | github-code | 36 |
17079399924 | from operator import itemgetter
from typing import Dict, Iterable, List, Optional, Tuple
import typer
from lib.legiscan import BillDescriptor, download_and_extract
from lib.util import load_json
def wrangle_metadata(metadata: Dict) -> Tuple[BillDescriptor, Optional[str]]:
"""Get the stuff from a metadata blob th... | amy-langley/tracking-trans-hate-bills | lib/tasks/legiscan/retrieve_legislation.py | retrieve_legislation.py | py | 1,373 | python | en | code | 2 | github-code | 36 |
23452187462 | # coding=utf-8
import datetime
from OnlineClassroom.app.ext.plugins import db
from .curriculums import *
from .account import *
from .catalog import *
"""
购买记录
CREATE TABLE `shopping_carts` (
`aid` int DEFAULT NULL COMMENT '外键 用户id',
`cid` int DEFAULT NULL COMMENT '外键 课程id',
`number` int DEFAULT '1' COMMENT '课程... | z1421012325/flask_online_classroom | app/models/shopping_carts.py | shopping_carts.py | py | 5,125 | python | en | code | 0 | github-code | 36 |
24398919509 | import requests
from bs4 import BeautifulSoup
import config
## setup
url = 'https://eu4.paradoxwikis.com/Achievements'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
table = soup.find('table')
def scrape():
table_dict = {}
headers = config.headers
url = 'https://e... | CarsenKennedy/EU4-flask-api | webscraper.py | webscraper.py | py | 1,608 | python | en | code | 0 | github-code | 36 |
73191374183 | import os
import re
RULE_REGEX = re.compile(r'(.+): (\d+)-(\d+) or (\d+)-(\d+)')
DEPARTURE_REGEX = re.compile(r'^departure')
def is_valid(value, rule1, rule2):
return (rule1[0] <= value <= rule1[1]) or (rule2[0] <= value <= rule2[1])
def filter_tickets(tickets, rules):
error_rate = 0
valid_tickets = []... | jawang35/advent-of-code | 2020/day16.py | day16.py | py | 4,112 | python | en | code | 0 | github-code | 36 |
20174508535 | import os
from peptoid_tools import assembler
### Assembling a peptoid sheet
# First initialize a builder object and build a single peptoid (available res
# can be found in res_lib. We'll be looking at BTM_perp and BTM_par for
# the perpendicular and parallel arrangements
builder = assembler.Builder()
builder.assembl... | oriondollar/peptoid-tools | example.py | example.py | py | 1,374 | python | en | code | 0 | github-code | 36 |
37084421510 | import tkinter
COORDINATS=(100,100,350,350)
class DrawArc:
def __init__(self):
#создадим главное окно
self.__main_window=tkinter.Tk()
#создадим холст
self.__holst=tkinter.Canvas(self.__main_window,
width=500,
he... | Sautenko-Andrey/OOP-and-other | draw_arc.py | draw_arc.py | py | 1,217 | python | ru | code | 0 | github-code | 36 |
27819397243 | import networkx as nx
import numpy as np
from params import args
class JobDAG(object):
def __init__(self, nodes, adj_mat, name):
# nodes: list of N nodes
# adj_mat: N by N 0-1 adjacency matrix, e_ij = 1 -> edge from i to j
assert len(nodes) == adj_mat.shape[0]
assert adj_mat.shap... | SpeedSchedulerProject/MDPA | spark_env/job_dag.py | job_dag.py | py | 3,725 | python | en | code | 0 | github-code | 36 |
42843762688 | import pytest
import time
import json
import logging
from error_code.error_status import SignatureStatus
from automation_framework.utilities.workflow import submit_request
from automation_framework.work_order_get_result.work_order_get_result_params \
import WorkOrderGetResult
import avalon_client_sdk.worker.worker... | manojsalunke85/avalon0.6_automaiton | tests/validation_suite/automation_framework/work_order_get_result/work_order_get_result_utility.py | work_order_get_result_utility.py | py | 2,938 | python | en | code | 0 | github-code | 36 |
17096750487 | #aula 2Estudo de caso, 50 alunos verificado idade, curso, semestre = verificado mais velho e que curso, media de idade e quantidade de alunos no 5° semestre
import random
somaIdades = 0
cursoMaisVelho = ""
idadeMaisVelho = 0
qtdAlunos5oSem = 0
for cont in range(50):
#Sorteio
idade = random.randint(18, 60)
... | pedroivoadv/Pucrs | logicaprogramacao01/aula05/exercicioal10.py | exercicioal10.py | py | 1,022 | python | pt | code | 0 | github-code | 36 |
28145554362 | from flask import Flask, request, jsonify
from urllib.request import urlopen
import json
app = Flask(__name__, static_folder='static')
@app.route('/')
def index():
return app.send_static_file('index.html')
@app.route('/api/submit', methods=['POST'])
def submit():
data = request.get_json()
message = data.... | coconnor07/WebsiteTest | __main__.py | __main__.py | py | 1,807 | python | en | code | 0 | github-code | 36 |
74840516263 | import glob
import os, shutil
import numpy as np
import xml.etree.ElementTree as ET
from skimage import io, transform
from PIL import Image
import cv2
class BatchPcik():
'''
批量判断图片维度,并挑出不符合的文件至error文件夹
!!!error文件夹如果没有可以新建功能!!!
'''
def __init__(self):
self.imgdir_path = "F:/Fruit_dataset/... | CGump/dataset-tools | pick_img.py | pick_img.py | py | 11,355 | python | en | code | 0 | github-code | 36 |
4107423837 | import sys
input = sys.stdin.readline
goBefore = {1: [2], 2: [], 3: [], 4: [1, 3], 5: [3], 6: [], 7: [1]}
count = []
while True:
x = int(input())
y = int(input())
if x == y == 0:
break
goBefore[y].append(x)
while True:
keys = list(goBefore.keys())
values = list(goBefore.values())
t... | AAZZAZRON/DMOJ-Solutions | ccc06j4.py | ccc06j4.py | py | 728 | python | en | code | 1 | github-code | 36 |
1441200587 | from random import choice
from CGSserver.Player import TrainingPlayer
from .Constants import EAST, NORTH, SOUTH, WEST, Ddx, Ddy
class SuperPlayer(TrainingPlayer):
"""
class SuperPlayer
Inherits from TrainingPlayer
"""
def __init__(self, **options):
"""
Initialize the Training Player
There is no options
... | thilaire/CodingGameServer | games/Snake/server/SuperPlayer.py | SuperPlayer.py | py | 2,303 | python | en | code | 0 | github-code | 36 |
15194990517 | from app import app
from util import download
# @app.route("/util/download/")
def download_view():
fns = [download.download_event_teams]
s = []
for fn in fns:
fn()
s.append(fn.__name__)
return f'Called: {", ".join(s)}'
| tervay/tervay | routing/util.py | util.py | py | 255 | python | en | code | 0 | github-code | 36 |
7582763868 | import urllib.request, urllib.parse, urllib.error
import twurl
import json
import ssl
# https://apps.twitter.com/
# Create App and get the four strings, put them in hidden.py
TWITTER_URL = 'https://api.twitter.com/1.1/friends/list.json'
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hos... | soliashuptar/LAB3 | twitter2.py | twitter2.py | py | 1,574 | python | en | code | 0 | github-code | 36 |
24916190530 | #encoding:utf-8
import os
import requests
class MyRequests():
def get_url(self, url, headers):
re = self.request(url, headers)
return re
def request(self, url, headers):
re = requests.get(url, headers=headers)
return re
def main():
url = "https://www.baidu.com"
he... | fanpengcs/python | my_requests.py | my_requests.py | py | 1,750 | python | en | code | 0 | github-code | 36 |
5198912697 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Completer:
def __init__(self, env):
"""Create a new completer for the command line."""
self.env = env
def complete(self, text, state):
"""Return the next possible completion for 'text'.
This is called successively with state... | rm-hull/yalix | python/yalix/completer.py | completer.py | py | 1,016 | python | en | code | 5 | github-code | 36 |
35512038562 | import json
import shutil
import unittest
from src import SDF3dData, train_sdf
from src.train_utils import *
class SDFTrainTest(unittest.TestCase):
@staticmethod
def get_abs_path():
path = os.path.abspath(__file__)
parent_dir = os.path.split(path)[0]
return parent_dir
def get_data... | amaleki2/graph_sdf | test/test_train.py | test_train.py | py | 2,349 | python | en | code | 2 | github-code | 36 |
41636716649 | import argparse
def create_parser():
parser = argparse.ArgumentParser(description='HR invetory software')
parser.add_argument('path', help='Path to file to be exported')
parser.add_argument('--export', action='store_true', help='Export current settings to json file')
return parser
def main():
from hr import use... | hamakohako/hr_inventory_test | src/hr/cli.py | cli.py | py | 510 | python | en | code | 0 | github-code | 36 |
9588027057 | """
A Jarvis plugin for listening music according
to your mood through Spotify's Web Player!
Jarvis asks for your mood and based on your choice it
opens a specific playlist of Spotify that fits
your mood.
"""
import webbrowser
from plugin import plugin
from plugin import require
from colorama import Fore
@require(n... | sukeesh/Jarvis | jarviscli/plugins/mood_music.py | mood_music.py | py | 3,509 | python | en | code | 2,765 | github-code | 36 |
3383143931 | class Solution:
def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
ROWS, COLS = len(matrix), len(matrix[0])
dp = {} # (r, c) -> LIP
def dfs(r, c, prevVal):
if r < 0 or r == ROWS or c < 0 or c == COLS or matrix[r][c] <= prevVal:
return 0
... | neetcode-gh/leetcode | python/0329-longest-increasing-path-in-a-matrix.py | 0329-longest-increasing-path-in-a-matrix.py | py | 812 | python | en | code | 4,208 | github-code | 36 |
39924563926 | from django.db import models
from django.utils import timezone
from . import Season
class SeasonPlayerManager(models.Manager):
def update_active(self, player, elo, wins, losses):
"""Update or create the season player instance for the active season."""
active_season = Season.objects.get_active()
... | dannymilsom/poolbot-server | src/core/models/season_player.py | season_player.py | py | 1,847 | python | en | code | 4 | github-code | 36 |
16551248169 | import torch
import torch.nn as nn
class NegativeLabelLoss(nn.Module):
"""
https://www.desmos.com/calculator/9oaqcjayrw
"""
def __init__(self, ignore_index=-100, reduction='mean',alpha=1.0,beta=0.8):
super(NegativeLabelLoss, self).__init__()
self.softmax = nn.Softmax(dim=1)
self... | p208p2002/qgg-utils | qgg_utils/__init__.py | __init__.py | py | 897 | python | en | code | 2 | github-code | 36 |
33215612402 | import os
import torch
import cflearn
import numpy as np
# for reproduction
np.random.seed(142857)
torch.manual_seed(142857)
# preparation
data_config = {"label_name": "Survived"}
file_folder = os.path.dirname(__file__)
train_file = os.path.join(file_folder, "train.csv")
test_file = os.path.join(file_folder, "test.c... | TrendingTechnology/carefree-learn | examples/titanic/titanic.py | titanic.py | py | 1,421 | python | en | code | null | github-code | 36 |
13998551053 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from os import path, listdir, curdir, remove
import uproot as ur
from astropy.io import fits
from km3net_testdata import data_path
from km3irf import build_irf
class TestBuild_IRF(unittest.TestCase):
def setUp(self):
self.testdata = data_path... | KM3NeT/km3irf | tests/test_main.py | test_main.py | py | 2,400 | python | en | code | 0 | github-code | 36 |
3458891647 | import sys
class Solution(object):
def minArray(self, numbers):
"""
:type numbers: List[int]
:rtype: int
"""
min_num = sys.maxsize
left = 0
right = len(numbers) - 1
while left <= right:
if numbers[left] < min_num:
min_num = ... | pi408637535/Algorithm | com/study/algorithm/offer/剑指 Offer 11. 旋转数组的最小数字.py | 剑指 Offer 11. 旋转数组的最小数字.py | py | 631 | python | en | code | 1 | github-code | 36 |
24369652375 | from django.shortcuts import render, HttpResponseRedirect
from django.contrib.auth import login, authenticate
from .forms import SignUpForm, LoginForm, PostForm
from django.contrib.auth import authenticate, login, logout
from .models import Post
# Create your views here.
def Home(request):
return render(request,... | SurajLodh/TaskProduct | User/views.py | views.py | py | 2,617 | python | en | code | 0 | github-code | 36 |
14381362201 | # 1099
from typing import List
def twoSumLessThanK(nums: List[int], k: int) -> int:
nums = sorted(nums)
ans = -1
i = 0
j = len(nums) - 1
while i < j:
if nums[i] + nums[j] >= k:
j -= 1
else:
ans = max(ans, nums[i] + nums[j])
... | jithindmathew/LeetCode | two-sum-less-than-k.py | two-sum-less-than-k.py | py | 455 | python | en | code | 0 | github-code | 36 |
3026797044 | # -*- coding: utf-8 -*-
from Basic_Tools import *
import arcpy,math
import pandas as pd
import numpy as np
import uuid,json,datetime,sys,csv,os
from scipy.spatial import distance_matrix
arcpy.env.overwriteOutPut = True
class Layer_Engine():
def __init__(self,layer,columns = 'all'):
i... | medad-hoze/EM_3 | Old/Engine_class.py | Engine_class.py | py | 9,913 | python | en | code | 0 | github-code | 36 |
40926602467 | from discord.ext.commands import bot, has_permissions
import discord.ext
from discord.ext import commands
from config import *
import asyncio
import random
# noinspection PyPackageRequirements
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix=PREFIX, intents=intents, ... | Juilfsjc/SeniorDesign | main.py | main.py | py | 16,345 | python | en | code | 0 | github-code | 36 |
4979766627 | # Sorteador Mega Sena
from random import randint
from time import sleep
print('-=-' * 20)
print('Gerador de Jogo da Mega-Sena'.center(57))
print('-=-'*20)
palpites = []
jogo = []
jogos = int(input('Quantos jogos você deseja gerar?'))
for i in range(0, jogos):
jogo = []
while len(jogo) < 6:
sorte =... | SloBruno/Curso_Em_Video_Python_Exercicios | ex088.py | ex088.py | py | 668 | python | pt | code | 0 | github-code | 36 |
39332540750 | from django.shortcuts import render
from abb.models import visitors
from abb.forms import visitorform
# Create your views here.
def show_data(request):
form=visitorform()
if request.method=='POST':
form=visitorform(request.POST)
if form.is_valid():
name=form.cleaned_data['name']
... | dhokanerahul13/4-11-22 | hotel/abb/views.py | views.py | py | 610 | python | en | code | 0 | github-code | 36 |
73683946025 | import random
class LinearLayer:
def __init__(self, input_size, output_size):
# input_size is the number of columns in the weights matrix
# output_size is the number of rows in the weights matrix
weights = []
# create randomized weights
for _ in range(output_size):
row_weights = []
f... | dashedstripes/shipnet | layers.py | layers.py | py | 1,251 | python | en | code | 0 | github-code | 36 |
29380312688 | # Anastasiya Zhukova
# Wednesday -- Problem Set 7
####################################################
# Question 1
####################################################
import pandas as pd
obesity_df = pd.read_csv('CDC_Obesity_Data.csv')
A = obesity_df.Question.unique()
print(A)
# What does A equal in the express... | INFO3401/problem-set-7-a-zhukova | Wednesday problem set 7.py | Wednesday problem set 7.py | py | 1,236 | python | en | code | 0 | github-code | 36 |
37493968630 | ''' Elabore um programa em Python que declare uma matriz quadrada de 10 linhas por 10
colunas e verifique se a matriz é simétrica em relação à diagonal principal.
1 2 3 4
2 1 5 6
3 5 1 7
4 6 7 1
'''
print("Informe os números da matriz")
A = [0] * 4
for i in range(4):
A[i] = [0] * 4
for j ... | danibassetto/Python | pythonProjectListasExercicio/Lista7/L7_E9.py | L7_E9.py | py | 794 | python | pt | code | 0 | github-code | 36 |
26284760310 | def common_sub_seq(s1, s2):
T = [[0 for _ in range(len(s1)+1)] for _ in range(len(s2)+1)]
for i in range(1, len(s2)+1):
for j in range(1, len(s1)+1):
if s2[i-1] == s1[j-1]:
T[i][j] = T[i-1][j-1] + 1
else:
T[i][j] = max(T[i-1][j], T[i][j-1])
... | deveshaggrawal19/projects | Algorithms/Dynamic/Longest_Common_Subsequence.py | Longest_Common_Subsequence.py | py | 838 | python | en | code | 0 | github-code | 36 |
43082790642 | import numpy as np
from matplotlib import pyplot as plt
def smooth(data, box_pts):
box = np.ones(box_pts)/box_pts
data_smooth = np.convolve(data, box, mode='same')
return data_smooth
filename = 'limited'
ignore_lines = True
x_min = np.inf
x_max = -np.inf
y_min = np.inf
y_max = -np.inf
z_min =... | dlech97/master-thesis | process_log.py | process_log.py | py | 3,749 | python | en | code | 0 | github-code | 36 |
70947903785 | """
stack, if set maxlen,
then push an element into a full stack
will lose one element at the bottom of the stack
"""
class Empty(Exception): pass
class ArrayStackWithLength:
"""LIFO stack, with max length, lose element during push to a full stack"""
def __init__(self, maxlen=None):
if max... | luke-mao/Data-Structures-and-Algorithms-in-Python | chapter6/q35.py | q35.py | py | 2,596 | python | en | code | 1 | github-code | 36 |
11677498007 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
... | blender-for-science/blendmsh | __init__.py | __init__.py | py | 2,626 | python | en | code | 28 | github-code | 36 |
15921581040 | # -*- coding: utf-8 -*-
#!pip install sportsreference
from sportsreference.ncaab.teams import Teams
'''
for team in Teams():
print(team.abbreviation, team.games_played)
'''
def find_teams():
a = str(input("Enter worse seed team: "))
b = str(input("Enter better seed team: "))
for team in Teams():
if tea... | yeshasn/mm-predictor-with-stats | marchmadness.py | marchmadness.py | py | 3,201 | python | en | code | 0 | github-code | 36 |
4927368022 | from numsubop import Array,Builder
import math
def haversine(lat2, lon2):
miles_constant = 3959.0
lat1 = 0.70984286
lon1 = 1.2389197
dlat = lat2.sub_const(lat1)
dlon = lon2.sub_const(lon1)
a = dlat.div_const(2).sin().square().add(
lat2.cos().mul_const(math.cos(lat1)).mul(dlon.div_const(2... | lingo-db/subop-vldb-2023-reproducibility | haversine-subop.py | haversine-subop.py | py | 956 | python | en | code | 2 | github-code | 36 |
36557590390 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'staircase' function below.
#
# The function accepts INTEGER n as parameter.
#
def staircase(n):
# Write your code here
ls=[]
for i in range(n):
ls2=[]
for j in range(n-1-i):
ls2.append(" ... | inderpreet1390/programs | Hackerrank prolem-solving/right-aligned-staircase.py | right-aligned-staircase.py | py | 539 | python | en | code | 0 | github-code | 36 |
35420476348 | from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
path_gotowe = "kolos_1/obrazy/"
path = "kolos_1/"
def szary(w, h):
t = (h, w)
tab = np.zeros(t, dtype=np.uint8)
for i in range(0, h, 1):
for j in range(0, w, 1):
tab[i, j] = (i + 3*j) % 256
return tab
obraz... | AdrianAlbrecht/WdGM | kolos_1/zad7.py | zad7.py | py | 910 | python | en | code | 0 | github-code | 36 |
3964423280 | from . import app
from .database import db
def init_db():
cursor = db.cursor()
with app.open_resource('schema.sql') as file:
for query in file.read().decode('utf-8').split(';'):
cursor.execute(query)
db.commit()
@app.cli.command('init-db')
def init_db_command():
init_db()
| RCFB/Master1_Bancaire | bancaire_app/command_line_interface.py | command_line_interface.py | py | 316 | python | en | code | 0 | github-code | 36 |
27894964557 | from lists.delete_from_list import print_list
from lists.node import Node
def add_lists(head1, head2):
new_tail = Node(0)
head = new_tail
carry = 0
while head1 and head2:
new_tail.val = (head1.val + head2.val + carry) % 10
carry = (head1.val + head2.val) // 10
new_tail.next = ... | stgleb/algorithms-and-datastructures | lists/add_list_numbers.py | add_list_numbers.py | py | 1,199 | python | en | code | 0 | github-code | 36 |
1408966477 |
from krules_core.base_functions import *
from krules_core import RuleConst as Const
rulename = Const.RULENAME
subscribe_to = Const.SUBSCRIBE_TO
ruledata = Const.RULEDATA
filters = Const.FILTERS
processing = Const.PROCESSING
from krules_core.route.router import DispatchPolicyConst
from krules_env import RULE_PROC_EVE... | airspot-dev/iot-demo | rulesets/procevents/procevents-got-errors-reply/ruleset.py | ruleset.py | py | 1,143 | python | en | code | 1 | github-code | 36 |
43100905257 | import csv
with open("starbucks_response.txt") as file:
list_string = file.read()
location_dicts_list = eval(list_string)
lat_longs = list(map(lambda x: (
x['latitude'], x['longitude'], x['address']), location_dicts_list))
header = ['Latitude', 'Longitude', "Address"]
with open('starbucks_latlong1.csv', 'w... | ShreyanshBardia/Geospatial-Analysis-for-Stores | scraping_stores_location/scrape_starbucks.py | scrape_starbucks.py | py | 463 | python | en | code | 0 | github-code | 36 |
29610488013 | #! /usr/bin/env python
# Version: 0.1.2
import glob
import os
def get_recursive_files_from_extensions(directory, ext_list, regex_filename):
filename_list = []
for ext in ext_list:
filename_list += glob.glob(directory + regex_filename + ext)
sub_folders = next(os.walk(directory))[1]
if len(su... | davikawasaki/python-misc-module-library | pythonmisc/folder_manipulation.py | folder_manipulation.py | py | 568 | python | en | code | 0 | github-code | 36 |
38875856666 | import sys
sys.path.append('.')
from contextlib import contextmanager
import time
import torch
import graphnet as GNN
num_iters = 100000
NN = 128*1024
D = 128
DT = torch.float16
dev = torch.device('cuda:0')
is_cuda = dev.type == 'cuda'
#net = GNN.Mlp(3 * D, [D, D, D], layernorm=False).to(DT).to(dev)
net = torch.... | medav/meshgraphnets-torch | test/test_torch_mlp.py | test_torch_mlp.py | py | 555 | python | en | code | 6 | github-code | 36 |
9195540013 | import argparse
import pickle
import lmdb
import torch
from tqdm import tqdm
from torch.utils.data import DataLoader
from vq_text_gan.datasets import BPEDataset
from vq_text_gan.utils import get_default_device
def extract_codes(args):
device = get_default_device(args.device)
print('Loading model')
mode... | kklemon/text-gan-experiments | legacy/vq_text_gan/extract_latents.py | extract_latents.py | py | 1,643 | python | en | code | 0 | github-code | 36 |
17930873755 | #!/usr/bin/python
import os
import sys
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(myPath))
import pytest
import src.pre_commit as pre_commit
import subprocess
from mock import patch
commit_is_ready_params = [
(["test/foo.py"], []),
(["test/clean.c"], []),
("... | aws/amazon-freertos | tools/git/hooks/test/test_pre_commit.py | test_pre_commit.py | py | 5,105 | python | en | code | 2,543 | github-code | 36 |
19417305890 | import requests
class Player:
def __init__(self, dict):
self.name = dict['name']
self.nationality = dict['nationality']
self.team = dict['team']
self.goals = dict['goals']
self.assists = dict['assists']
self.points = self.goals + self.assists
def __str__(self):... | alannesanni/palautusrepositorio | viikko2/nhl-reader/src/player.py | player.py | py | 1,119 | python | en | code | 0 | github-code | 36 |
4511356839 | import openpyxl
from collections import Counter
from difflib import SequenceMatcher
from collections import OrderedDict
import time
import numpy
import sys
path = "F:\\Book1.xlsx"
wb_obj = openpyxl.load_workbook(path)
sheet_base = wb_obj.worksheets[0]
sheet_area_1 = wb_obj.worksheets[1]
sheet_area_2 = wb_obj.workshe... | ChinhTheHugger/vscode_python | excel.py | excel.py | py | 1,448 | python | en | code | 0 | github-code | 36 |
42910999236 | #CIS_312_Week6_PythonProject2_Jaramillo
posole_servings=20
print("Every year for the Winter Holidays I make Chicken Tomatillo Posole. The recipe calls for \
1 lb small tomatillos, 1 lb Pasilla Chiles, one 5lb can of mexican style hominy, 3 garlic cloves, 1 tsp salt, \
1/2 gallon of water, 1 tsp of black ground ... | FPU-CIS03/CIS312-Project2 | CIS312_Week6_Mini-Project2_Jaramillo.py | CIS312_Week6_Mini-Project2_Jaramillo.py | py | 3,222 | python | en | code | 0 | github-code | 36 |
38875732926 |
import torch
import torch.nn as nn
from torch.utils.cpp_extension import load
import os
import time
import random
import math
cur_path = os.path.dirname(os.path.realpath(__file__))
if torch.cuda.is_available():
scatter_concat_cuda = load('scatter_concat_cuda',
[f'{cur_path}/scatter_concat.cu'],
ex... | medav/meshgraphnets-torch | kernels/scatter_concat/kernel.py | kernel.py | py | 1,699 | python | en | code | 6 | github-code | 36 |
30781006442 | # -*- coding: utf-8 -*-
import oss2
from oss2.credentials import EnvironmentVariableCredentialsProvider
import os
# 这里填写你的 OSS_ACCESS_KEY_ID 和 OSS_ACCESS_KEY_SECRET
os.environ['OSS_ACCESS_KEY_ID'] = ''
os.environ['OSS_ACCESS_KEY_SECRET'] = ''
auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider())
# 这里改成你... | source-dream/AliyunOSS-DownloadTool | main.py | main.py | py | 1,190 | python | zh | code | 0 | github-code | 36 |
11841445530 | import torch
from torch import nn
from spdnet.spd import Normalize
class GBMS_RNN(nn.Module):
def __init__(self, bandwidth=0.1, normalize=True):
super(GBMS_RNN, self).__init__()
self.bandwidth = nn.Parameter(torch.tensor(bandwidth))
self.normalize = None
if normalize:
... | Dandy5721/CPD-Net | MICCAI-2021/mean_shift/mean_shift.py | mean_shift.py | py | 1,419 | python | en | code | 1 | github-code | 36 |
40806324496 | """
Problem 20: Factorial digit sum
https://projecteuler.net/problem=20
n! means n × (n − 1) × ... × 3 × 2 × 1
For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits in the number 100!
"""
def test_get_sum_of_... | FranzDiebold/project-euler-solutions | test/test_p020_factorial_digit_sum.py | test_p020_factorial_digit_sum.py | py | 562 | python | en | code | 1 | github-code | 36 |
24985603198 | import pygame
from settings import BOSSTELEPORTINGSOUND, ENEMYHITSOUND, importFolder, bossPositions
from random import randint
from os import path
class Boss(pygame.sprite.Sprite):
def __init__(self, pos, surface, level):
super().__init__()
#animation
self.displaySurface = surface
s... | Maltoros/Project-Pygame | boss.py | boss.py | py | 8,327 | python | en | code | 0 | github-code | 36 |
36901679046 | import logging
from math import sqrt
from typing import Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
from tqdm import trange
from ..common import HistoricalData, get_device
from ..exceptions import SimulationException
from . import Simulations
log... | ethanlee928/pyfmc | pyfmc/simulations/gbm.py | gbm.py | py | 5,015 | python | en | code | 1 | github-code | 36 |
3699910265 | import random
from random import seed
seed(1)
import time
def random_list_generator(N, NMAX):
lst=[]
for i in range(N):
lst.append(random.randint(0,NMAX))
return lst
def reverse_sorted_list_generator(N,NMAX):
lst=[]
i=random.randint(N,NMAX)
j=N-1
whil... | alexoporanu/tema-sortari | Sortări.py | Sortări.py | py | 9,176 | python | en | code | 0 | github-code | 36 |
8272041392 | """
Test the OOD DiscDist2 scorer. It disentangle the feature into discriminative space and the residual space
"""
import pdb
import numpy as np
import matplotlib.pyplot as plt
import os
import argparse
import torch
from tqdm import tqdm
import torch.backends.cudnn as cudnn
from ood_scores.get_scorers ... | ivalab/WDiscOOD | test_feat_disc.py | test_feat_disc.py | py | 5,166 | python | en | code | 4 | github-code | 36 |
10759107890 | import unittest
import sys
import time
sys.path.append("..")
from deltarest import DeltaRESTAdapter, DeltaRESTService
from pyspark.sql import SparkSession
class Test(unittest.TestCase):
root_dir: str = f"/tmp/delta_rest_test_{int(time.time())}"
spark: SparkSession = None
dra: DeltaRESTAdapter
@... | bonnal-enzo/delta-rest | test/test.py | test.py | py | 3,975 | python | en | code | 0 | github-code | 36 |
1408815837 | import requests
from krules_core.base_functions import *
from krules_core import RuleConst as Const, event_types
from krules_core.providers import proc_events_rx_factory
from krules_env import publish_proc_events_errors, publish_proc_events_all #, publish_proc_events_filtered
from app_functions.slack import SlackMes... | airspot-dev/iot-demo | rulesets/apps/class-b/on-location-change-notifier-slack/ruleset.py | ruleset.py | py | 2,396 | python | en | code | 1 | github-code | 36 |
29394478322 | # -*- coding: utf-8 -*-
"""Bottle web-server."""
from bottle import Bottle
from bottle import template, static_file
from os.path import dirname, abspath
from datetime import date, timedelta
app = Bottle()
BASE_DIR = dirname(abspath(__file__))
@app.route('/static/<filename:path>')
def server_static(filename):
"... | AnotherProksY/MyPage | src/mypage.py | mypage.py | py | 701 | python | en | code | 0 | github-code | 36 |
70631383784 | from unittest import TestCase
from three_sum_closest import Solution
class TestSolution(TestCase):
def test_three_sum_closest(self):
inputs = (
([-1, 2, 1, -4], 1),
)
outs = (2,)
for inp, out in zip(inputs, outs):
self.assertEqual(out, Solution().threeSumClo... | sswest/leetcode | 16_three_sum_closest/test_three_sum_closest.py | test_three_sum_closest.py | py | 332 | python | en | code | 0 | github-code | 36 |
22355151722 | # coding: utf-8
import tkinter as tk
from tkinter import messagebox, filedialog
import os
from PIL import Image, ImageTk
from detector import PlateDetector
from util import resized_size
class LPRGUI:
max_image_width = 600
max_image_height = 600
def __init__(self):
self.detector = PlateDetector(... | QQQQQby/Car-Plate-Recognition | start_gui.py | start_gui.py | py | 3,908 | python | en | code | 1 | github-code | 36 |
42155262568 | # JadenCase란 모든 단어의 첫 문자가 대문자이고, 그 외의 알파벳은 소문자인 문자열입니다. 단, 첫 문자가 알파벳이 아닐 때에는 이어지는 알파벳은 소문자로 쓰면 됩니다. (첫 번째 입출력 예 참고)
# 문자열 s가 주어졌을 때, s를 JadenCase로 바꾼 문자열을 리턴하는 함수, solution을 완성해주세요.
# #s는 알파벳과 숫자, 공백문자(" ")로 이루어져 있습니다.
# 숫자는 단어의 첫 문자로만 나옵니다.
# 숫자로만 이루어진 단어는 없습니다.
# 공백문자가 연속해서 나올 수 있습니다. => split을 사용할수없음
def solution(... | FeelingXD/algorithm | programers/p12951.py | p12951.py | py | 868 | python | ko | code | 2 | github-code | 36 |
30466787477 | # Given a string of numbers and operators, return all possible results from computing all the different
# possible ways to group numbers and operators. The valid operators are +, - and *.
#
#
# Example 1
# Input: "2-1-1".
#
# ((2-1)-1) = 0
# (2-(1-1)) = 2
# Output: [0, 2]
#
#
# Example 2
# Input: "2*3-4*5"
#
# (2*(3-(4... | dundunmao/LeetCode2019 | 241. Different Ways to Add Parentheses.py | 241. Different Ways to Add Parentheses.py | py | 1,309 | python | en | code | 0 | github-code | 36 |
23876943909 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
import tensorflow as tf
import pandas as pd
import model
from data_reader import load_data, DataReader, DataReaderFastText, FasttextModel
FLAGS = tf.flags.FLAGS
def r... | oshToy/Character-Aware-LM | evaluate.py | evaluate.py | py | 5,481 | python | en | code | 0 | github-code | 36 |
73903159785 |
import random
def game(num):
pregunta = input("Hazme una pregunta: ")
if num ==1:
return "Chancla"
elif num==2:
return "Nel papi"
elif num==3:
return "Simon carnal"
elif num==4:
return "Concentrate y pregunta otravez"
elif num==5:
return "N... | marcosdayanm/Pensamiento_Computacional_Ingenieria_TEC | Exercises/Magic Ball con función.py | Magic Ball con función.py | py | 584 | python | es | code | 0 | github-code | 36 |
506681210 | """
Resample Raster Files
"""
def match_cellsize_and_clip(rstBands, refRaster, outFolder,
clipgeo=None, isint=None, ws=None):
"""
Resample images to make them with the same resolution and clip
Good to resample Sentinel bands with more than 10 meters.
Dependencies:... | jasp382/glass | glass/rst/rmp.py | rmp.py | py | 4,165 | python | en | code | 2 | github-code | 36 |
2315899887 | # w mode=>it will overwrite the existing content if previously written
# D:\\python\\fileh\\write.txt
# it will create or open file bcoz we are using w mode
obj = open("D:\\python\\fileh\\write.txt", "w")
# obj.write("This is 1st line written using writefile.py")
obj.write("This is 2nd line written using writefile.py"... | sudeepsawant10/python-development | fileh/5_writefile.py | 5_writefile.py | py | 400 | python | en | code | 0 | github-code | 36 |
25969718175 | # -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.template import RequestContext, Template
from django.views.decorators.csrf import csrf_exempt
from django.utils.encoding import smart_str, smart_unicode
import xml.etree.ElementTree as ET
import urllib, urllib2, time, hashlib
@csrf_exempt
def ... | wqh872081365/weixin0324 | weixin0324/views1.py | views1.py | py | 2,306 | python | en | code | 0 | github-code | 36 |
28257627671 | import re
path = r"C:\Users\nicoa\Documents\Programacion\UCEMA_Fundamentos_de_informatica-master\Python_intro\manipulacion_archivos.txt"
lista = []
lista2 = []
with open(path,"r") as file:
for lineas in file:
lista.extend(lineas.split())
print("Hay", len(lista), "palabras")
for i in range(len(lista)... | nicoaizen/Fundamentos_de_informatica_Aizen | Práctica_Manipulación_de_archivos/ej7.py | ej7.py | py | 455 | python | pt | code | 0 | github-code | 36 |
2875137371 | import re
import operator
filename = 'aoc201608_input.txt'
# filename = 'testinput.txt'
f = open(filename,"r")
#read lines into one string
data = [x.strip() for x in f.readlines()]
# build rectangles or initital grid
def buildrect(x,y,lightson = 0):
grid = {}
state = ''
if lightson == 1:
... | GregtheMurray/AOC2016 | aoc201608.py | aoc201608.py | py | 2,382 | python | en | code | 0 | github-code | 36 |
4810151279 | from __future__ import (absolute_import, division,
print_function, unicode_literals)
import sys
import os
sys.path.append(os.path.join("..", ".."))
from ds_drawer.generators.lists import create_linked_list
from ds_drawer.shapes.cross import Cross
from ds_drawer.shapes.arrow import Arrow
from d... | JoaoFelipe/Data-Structures-Drawer | examples/linked_list_add_bol_mol/linked_list_add_eol.py | linked_list_add_eol.py | py | 1,339 | python | en | code | 0 | github-code | 36 |
20166887835 | def get_population(data):
population_dict = {
'2022' : int(data['2022 Population']),
'2020' : int(data['2020 Population']),
'2015' : int(data['2015 Population']),
'2010' : int(data['2010 Population']),
'2000' : int(data['2000 Population']),
'1990' : int(data['1990 Population']),
'1980' : i... | Jhoel-ibarra/python | pkg/util.py | util.py | py | 939 | python | en | code | 0 | github-code | 36 |
70578997545 | #!/usr/bin/env pybricks-micropython
from constants import(VERY_HIGH_SPEED,
MEDIUM_SPEED,HIGH_SPEED,ROTATION_GEAR_RATIO,
MIN_ROTATION_ANGLE,MAX_ROTATION_ANGLE,
CHECK_INTERVAL_IN_MILLISECONDS,
CRANE_GEAR_RATIO,
CRANE_RESTI... | JLukasSamby/pa1473project | io.py | io.py | py | 4,915 | python | en | code | 0 | github-code | 36 |
37326026549 | from zipline.pipeline.factors import CustomFactor
from zipline.pipeline.data import USEquityPricing
import numpy as np
import warnings
def recurs_sum(arr):
arr_sum = np.zeros(arr.shape)
arr_sum[0] = arr[0]
for i in range(1, len(arr)):
arr_sum[i] = arr_sum[i-1]+arr[i]
return arr_sum
class A... | ahmad-emanuel/quant_trading_system | Indicators/chaikin_oscilator.py | chaikin_oscilator.py | py | 1,745 | python | en | code | 1 | github-code | 36 |
18252823651 | import bisect
from typing import List
class Solution:
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
items = sorted(envelopes, key=lambda x: (x[0], -x[1]))
piles = []
for item in items:
v = item[1]
i = bisect.bisect_left(piles, v)
if i == len... | hujienan/Jet-Algorithm | leetcode/354. Russian Doll Envelopes/index.py | index.py | py | 554 | python | en | code | 0 | github-code | 36 |
10840945598 | import os
import requests
from bs4 import BeautifulSoup
#os.system("clear")
def crawl():
url = "https://www.iban.com/currency-codes"
iban_result = requests.get(url)
iban_soup = BeautifulSoup(iban_result.text, "html.parser")
table = iban_soup.find("table", {"class": "table table-bordered downloads t... | cheonjiwan/python_challenge | assignment/Day5.py | Day5.py | py | 1,568 | python | en | code | 0 | github-code | 36 |
71102837544 | num = int(input())
count = 0
def check(string):
alph = [1 for i in range(26)]
global count
# 문자열 길이만큼 반복
for i in range(len(string) - 1):
text = string[i]
if (text == string[i+1]):
continue
if(alph[ord(text) - 97] == 0):
return
alph[ord(text) - 97] = 0
if(alph[ord(string[i+1]) -... | Gukss/algorithm | baekjoon/1316/1316.py | 1316.py | py | 448 | python | en | code | 0 | github-code | 36 |
17190663769 | import PySimpleGUI as sg
class GameGui:
def __init__(self,
box_size=15,
title = 'Japanese Crossword Puzzle!',
puzzle_size=500,
coor_sys_height=130
):
self.box_size = box_size
self.rows = 8
self.... | chengcj-upenn/jp_crossword_puzzle | frontend.py | frontend.py | py | 7,549 | python | en | code | 0 | github-code | 36 |
41202660931 | import enum
import logging
import os
import subprocess
import sys
import tempfile
from pathlib import Path
from typing import Iterable, List, Tuple, Union
from pprint import pprint
import commentjson
import config
import resume.sections as sections
def create_resume_(data: dict, output_filename: str):
class SECT... | ankan-ekansh/JSON-Resume-LaTeX | script/create.py | create.py | py | 8,191 | python | en | code | 0 | github-code | 36 |
31772755575 | # coding=utf-8
import os
import logging
from bs4 import UnicodeDammit
from subliminal.api import io, defaultdict
from subliminal_patch.patch_provider_pool import PatchedProviderPool
logger = logging.getLogger(__name__)
def download_subtitles(subtitles, **kwargs):
"""Download :attr:`~subliminal.subtitl... | luboslavgerliczy/SubZero | Contents/Libraries/Shared/subliminal_patch/patch_api.py | patch_api.py | py | 5,965 | python | en | code | 0 | github-code | 36 |
18253181418 | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from .KITConfig import KITConfig
from .kitdata import KITData
from .kitlodger import KITLodger
from collections import OrderedDict
from .Utils import kitutils
import itertools
import logging
class KITMatplotlib(object):
def __init__(self, ... | SchellDa/KITPlot | kitmatplotlib.py | kitmatplotlib.py | py | 19,336 | python | en | code | 0 | github-code | 36 |
74852906022 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 12 00:20:31 2017
@author: loljkpro
"""
import os, sys, re, shutil
# load directory name
dir = os.getcwd()
if len(sys.argv) >= 2:
dir = (sys.argv[1])
for F in os.listdir(dir):
s = re.search(r'.wav', F)
if s:
subdir = re.split(r'_... | Ungaminga/TES-L-Localizated-Sounds | ru_portrait_shout/portait_sort.py | portait_sort.py | py | 464 | python | en | code | 1 | github-code | 36 |
69815035624 | import os
from pyspark.sql import DataFrame
from pyspark.sql import types as t, functions as f
from pyspark.sql import SparkSession
from consts import COVID_DATE_FORMAT
def get_dataframe(name: str, session: SparkSession,
cols: list[str], type_mapping: dict,
date_format: str = COV... | volodymyrkir/pyspark_ml | utils.py | utils.py | py | 2,410 | python | en | code | 0 | github-code | 36 |
28422223385 | # -*- coding: utf-8 -*-
# Import dependencies
import uuid
import logging
import bcrypt # https://github.com/pyca/bcrypt/, https://pypi.python.org/pypi/bcrypt/2.0.0
#from Crypto.Hash import SHA512
#from Crypto.Random.random import StrongRandom
from random import randint
# Import flask dependencies
from flask import B... | enzosav/mydata-sdk | Account/app/mod_account/controllers.py | controllers.py | py | 3,547 | python | en | code | null | github-code | 36 |
8863752563 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.family'] = 'cmu serif'
# use latex for font rendering
matplotlib.rcParams['text.usetex'] = True
SMALL_SIZE = 12
MEDIUM_SIZE = 14
BIGGER_SIZE = 16
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc... | marco-rosso-m/SAP2000-python-for-structural-optimization | Parallel_processing_optimization/Optimization_Parallel_sez_diverse_fixed.py | Optimization_Parallel_sez_diverse_fixed.py | py | 15,571 | python | en | code | 0 | github-code | 36 |
73491948585 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from utils.models import BaseModel, models
from utils import constants as Constants, get_choices, get_kyc_upload_path
from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import post_save
from django.utils.timezone imp... | anjali-rao/backend-app-1 | crm/models.py | models.py | py | 8,059 | python | en | code | 0 | github-code | 36 |
25777794741 | class RouterList:
{...}
def refresh_routes(self):
deletion_list = []
for ipaddr, route in self.__routes.items():
if ipaddr not in self.__links:
if route.updated_since > self.__max_life:
deletion_list.append(ipaddr)
for ipaddr in deletion_list:
del self.__routes[ipaddr] | vrjuliao/BCC | redes-de-computadores/tp3/doc/codes/refresh_routes.py | refresh_routes.py | py | 316 | python | en | code | 0 | github-code | 36 |
16723311170 | import json
import threading
import cv2
import PySimpleGUI as sg
import trt_pose.coco
import trt_pose.models
from flask import Flask
from flask_restful import Api, Resource
from trt_pose.parse_objects import ParseObjects
from camera import Camera
from exercise import LeftBicepCurl, RightBicepCurl, Shoulde... | CashMemory/SeniorProject | tasks/human_pose/get_video.py | get_video.py | py | 5,493 | python | en | code | 2 | github-code | 36 |
20382572134 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
... | ramamoorthyluxman/SurfaceAdaptiveRTI | __init__.py | __init__.py | py | 40,570 | python | en | code | 0 | github-code | 36 |
30579767477 | import os
import numpy as np
import torch
import transformers
import torch.nn as nn
from transformers import AutoModel, BertTokenizer
import nltk
nltk.download("stopwords")
from nltk.corpus import stopwords
from string import punctuation
russian_stopwords = stopwords.words("russian")
'''import keras
import numpy as ... | FenixFly/Neimark-hack-FSC | backend/MLmodels.py | MLmodels.py | py | 8,042 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.