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
3947171528
from django.http import HttpResponse # from django.conf import settings from api.nfl.NflDataScraper import NflDataScraper from api.nfl.NflScoreBoard import NflScoreBoard from api.nfl.NflTeams import NflTeams from api.nfl.NflSchedule import NflSchedule from api.nfl.NflStanding import NflStanding from api.nfl.BeautifulTe...
shaponpal6/Python-Django-Selenium-web-scraper
views.py
views.py
py
3,647
python
en
code
1
github-code
13
33809383581
import torch import copy import numpy as np from .base import ParallelCollector import torch.multiprocessing as mp import torchrl.policies as policies class SingleTaskParallelCollectorBase(ParallelCollector): def __init__(self, reset_idx = False, **kwargs): self.reset_idx = re...
RchalYang/Soft-Module
torchrl/collector/para/mt.py
mt.py
py
3,822
python
en
code
90
github-code
13
16820486640
from django import forms, template register = template.Library() @register.filter def cvtmem(mem): if mem=='':return '' mem = int(mem) units = ['KB','MB','GB'] unit_index = 0 while mem>1024: unit_index += 1 mem/=1024 return '%.2f%s'%(mem,units[unit_index])
ryanrain2016/FreeEye
FreeEye/HostManage/templatetags/cvtmem.py
cvtmem.py
py
301
python
en
code
5
github-code
13
17574448107
# from cgi import print_directory # a=int(input("Enter number of rows you wanna print the star pattern")) # b=bool(int(input("Enter 1 for normal pattern of star pattern \n Enter 0 for inverted star pattern "))) # if b==True: # for i in range(1,a+1,2): # print(i*"*") # if i==a: # ...
Raunakjha00/Python
ununderstandable2.py
ununderstandable2.py
py
902
python
en
code
0
github-code
13
71842979859
# -*- coding: utf-8 -*- """ This file manages the post-processing and plotting of the graph @author: Jan Straub """ # Imports from networkx import Graph from networkx import get_node_attributes, shortest_path, draw, draw_networkx_nodes, draw_networkx_labels from scipy.interpolate import BPoly, splprep, splev from num...
JanMStraub/Local-Iterative-Optimization-for-Graph-Bundling
code/output.py
output.py
py
14,075
python
en
code
1
github-code
13
3298959736
import wx import cv2 import os import numpy as np from contour import * from PIL import Image from model.dbconnect import * from props.InputProp import * from props.FormField import * class EditForm(wx.Frame): def __init__(self, parent, title, id = 0): wx.Frame.__init__(self, parent, title=title, size=(...
saitama09x/pythoncv
form/EditForm.py
EditForm.py
py
14,957
python
en
code
0
github-code
13
9585866242
import logging import pygame import math from typing import List from pygame.math import Vector2 from pygame.sprite import Sprite, Group from pygame.mask import from_surface from plat.core.utils import * from plat.core.components import BaseComponent class MoverMixin: """ Call self.calculate_newpos() on child ...
manuelpepe/PLAT
plat/core/mixins.py
mixins.py
py
6,167
python
en
code
0
github-code
13
12376488285
#!/usr/bin/env python import vlc from tkinter import * from tkinter import filedialog import json from tkinter import messagebox class VideoFrameLabeler: def __init__(self): self._init_root_window() self._init_media_player() self._bind_keyboard_events() main_pane = PanedWindow(sel...
UdaraWanasinghe/VideoFrameLabeler
main.py
main.py
py
10,573
python
en
code
1
github-code
13
26885299285
#!/usr/bin/env python3 import os, sys import json import numpy as np import matplotlib.pyplot as plt import colorcet as cc import sklearn.gaussian_process as gp import utils import opt.objective as objective BAYES_LOG_PATH = '../opt/bayes/data/expDecay4.json' N_SAMPLES = (100, 115, 130, 200) NX, NY = 40, 40 XMIN,...
peterhalldestam/exjobb
py/figs/plotProcession.py
plotProcession.py
py
3,688
python
en
code
2
github-code
13
10927229368
import glob import os import struct class Debug(): global_log_level = 1 def __init__(self, level=None): self.level = level if level else 0 def __call__(self, wrapped_function): def wrapper_function(*args, **kwargs): if Debug.global_log_level <= self.level: prin...
porvik/python-training-b1
code/module_1/src/binary_reader/inp/__init__.py
__init__.py
py
2,837
python
en
code
0
github-code
13
24694458376
import pickle a=open('Menu_A_C.dat','wb') list_shop={'Coffee':[['Kohi Americano','100','110'], ['Tokyo Cappucino','110','120'], ['Caffe Latte','110','120']], 'Tea':[['Hakone Jasmine Tea','75','80'], ['Chamomile Tea','80','85'], ...
KiranEaswar/Cafe-Machine
Cafe_startup.py
Cafe_startup.py
py
840
python
en
code
0
github-code
13
17198907774
import argparse import pandas as pd from tqdm import tqdm def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-f', '--files', nargs='+', help='The path to the files containing extractions \ per review and item.') parser.add_argumen...
sampoauthors/Sampo
scripts/extraction_space_analysis.py
extraction_space_analysis.py
py
1,366
python
en
code
2
github-code
13
26431722331
from collections import deque with open("./input.txt") as f: hands = f.read().strip().split("\n\n") p1 = deque([int(line.strip()) for line in hands[0].strip().splitlines()[1:]]) p2 = deque([int(line.strip()) for line in hands[1].strip().splitlines()[1:]]) while len(p1) != 0 and len(p2) != 0: c1 = p1....
korylprince/adventofcode
2020/22/main.py
main.py
py
1,560
python
en
code
1
github-code
13
16760889794
import pandas as pd import numpy as np import gc from sklearn.preprocessing import LabelEncoder from utils import categorical_mode as mode from lightgbm import LGBMClassifier class prev_applications: def preprocess(self, df): df.replace("NXA", np.nan, inplace=True) df.replace("XAP", np.nan, inplac...
swarupa29/Data-Analytics-Project
Version1/prev_appl.py
prev_appl.py
py
4,984
python
en
code
0
github-code
13
19436032927
def solution(want, number, discount): possibleDays = 0 wishCart = [] for i in range(len(want)): wishCart.extend([want[i]] * number[i]) wishCart.sort() for i in range(len(discount) - 9): dList = discount[i:i+10] dList.sort() if wishCart == dList: ...
Youmi-Kim/problem-solved
프로그래머스/2/131127. 할인 행사/할인 행사.py
할인 행사.py
py
374
python
en
code
0
github-code
13
74829038096
from django.shortcuts import render, redirect from .forms import RatingForm from .models import Rating from .filters import RatingFilter def home(request): if request.method == "POST": form = RatingForm(request.POST) if form.is_valid(): form.save(commit=True) return redirect('search')...
abhishekzgithub/djangoFilterApp
core/views.py
views.py
py
646
python
en
code
0
github-code
13
4675424577
import time import RPi.GPIO as GPIO from socket import * # Squash warnings GPIO.setwarnings(False) # GPIO Mode (BOARD / BCM) GPIO.setmode(GPIO.BCM) # GPIO Pins GPIO_TRIGGER = 18 GPIO_ECHO = 24 # Set GPIO direciton (IN/OUT) GPIO.setup(GPIO_TRIGGER, GPIO.OUT) GPIO.setup(GPIO_ECHO, GPIO.IN) def measure_distance(): ...
hkanumilli/Autonomous-RC-Vehicle
RC_Car/ultrasonic.py
ultrasonic.py
py
1,237
python
en
code
0
github-code
13
32071352978
#!/usr/bin/env python import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.model_selection import GridSearchCV def load_npz(path): data = np.load(path) X = data["X"] y = data["Y"] return X, ...
PeterJackNaylor/knockoff-MMD-HSIC
src/templates/rf.py
rf.py
py
1,924
python
en
code
1
github-code
13
2355587497
# 977 - Squares of Sorted Array # https://leetcode.com/problems/squares-of-a-sorted-array/ class Solution: # list the methods to be run against the test cases implementations = ["get_sorted_squares"] def get_sorted_squares(self, nums: list) -> list: """ Use two pointers to calculate the ...
andrewt110216/algorithms-and-data-structures
leetcode/p0977_solution.py
p0977_solution.py
py
2,212
python
en
code
0
github-code
13
73860137617
import numpy as np import keras from keras.models import Sequential, Model as K_Model, save_model, load_model from keras.layers import (Input, Dense, Dropout, Flatten, Concatenate, Reshape, GRU, LSTM, RepeatVector, Permute, concatenate, multiply, maximum, add) from keras.optimizers import SGD, Adam from keras.layer...
christiansprecher/sequential_skip_prediction_challenge
code/neural_nets/models.py
models.py
py
16,331
python
en
code
2
github-code
13
70352949138
class Solution: """ Approaches: Approach 1: Top Down State: - hval - currentHouse * (value you are changing) Base Cases: - if there are no houses: can't pick anything - if there is 1 houses: pick it - if there is 2...
eriktoor/interview-practice
dp/houseRobber.py
houseRobber.py
py
3,776
python
en
code
0
github-code
13
42340417219
#用静态方法抓取静态网页 import scrapy import pandas as pd from selenium import webdriver from lxml import etree from scrapy.http.response.html import HtmlResponse from scrapy.selector.unified import SelectorList from zh.items import ZhItem class EastmoneySpider(scrapy.Spider): name = 'Eastmoney' allowed_domains = ['grou...
Devil-zhao/Eastmoney
zh/zh/spiders/Eastmoney.py
Eastmoney.py
py
2,331
python
en
code
0
github-code
13
31941539040
from typing import List class Solution: def findDuplicate(self, nums: List[int]) -> int: left, right = 1, len(nums) - 1 while left < right: mid = (left + right) // 2 cnt = 0 for num in nums: if num <= mid: cnt += 1 ...
wylu/leetcodecn
src/python/explore/binarysearch/exercise/寻找重复数.py
寻找重复数.py
py
578
python
en
code
3
github-code
13
9642579408
from setuptools import find_packages, setup package_name = 'hi_connect' setup( name=package_name, version='0.0.0', packages=find_packages(exclude=['test']), data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, [...
KeioRoboticsAssociation/hi_connect
setup.py
setup.py
py
880
python
en
code
1
github-code
13
70457620177
import requests import os.path import cv2 import numpy as np def get(year=2021, month=11, day=6, hour=10, minute=0): url = "https://img1.kachelmannwetter.com/images/data/cache/wwanalyze/wwanalyze_%04d_%02d_%02d_262_%02d%02d.png" % (year,month,day,hour, minute) headers = {'User-Agent': 'Mozilla/5.0 (X11; Linu...
codeispoetry/sea_of_fog
kachelmann.py
kachelmann.py
py
1,591
python
en
code
0
github-code
13
9333213375
import json import re import pandas as pd import plotly.offline as py import plotly.graph_objs as go import matplotlib.pyplot as plt from wordcloud import WordCloud from Tweet import Tweet def parse_json(): list_all_tweet = [] with open('../resources/EGC_tweets.json', 'r', encoding="utf8") as f: tw...
TaoGrolleau/Bigdata-project
src/Tweet_Analyser.py
Tweet_Analyser.py
py
4,772
python
en
code
0
github-code
13
35962564491
import os import sys import joblib import numpy as np import torch from copy import deepcopy import gym from .wrappers import ObjectiveWrapper, ObservationDictWrapper, WarpFrame, get_objective_wrapper from .crafter_wrappers import CrafterRenderWrapper, ImageToPyTorch, CrafterMonitorWrapper CRAFTER_KWARGS = dict( ...
pairlab/iclr-23-sea
torchbeast/env/env.py
env.py
py
4,535
python
en
code
4
github-code
13
15016747598
class Ass2: def __init__(self,string): self.s = string def reverse(self): j1 = self.s.split() j2 = j1[::-1] j3 = " ".join(j2) return j3 a = Ass2("I love my india") print(a.reverse())
harshtheking100/Python
OOP/Ass2.py
Ass2.py
py
251
python
en
code
0
github-code
13
15190389790
#!/usr/bin/env python3.4 # coding: latin-1 # (c) Massachusetts Institute of Technology 2015-2018 # (c) Brian Teague 2018-2019 # # 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 2 ...
kkiwimagi/cytoflow-microscopy-kiwi
cytoflowgui/op_plugins/color_translation.py
color_translation.py
py
13,411
python
en
code
0
github-code
13
17128026268
from csv import DictReader from actores.models import Organizacion, Institucion import logging consola = logging.getLogger("consola") def run(file_path): reader = DictReader(file(file_path), delimiter=',') for i , linea in enumerate(reader, 1): procesarLinea(i,linea) def procesarLinea(num,linea): ...
martinfr/ara
ara/scripts/cargar_instituciones.py
cargar_instituciones.py
py
1,653
python
es
code
0
github-code
13
31942625800
from typing import List # @lc code=start class Solution: def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int: ans, m = min(baseCosts), len(toppingCosts) def dfs(c: int, i: int) -> None: nonlocal ans if c - target > ...
wylu/leetcodecn
src/python/p1700to1799/1774.最接近目标价格的甜点成本.py
1774.最接近目标价格的甜点成本.py
py
1,216
python
zh
code
3
github-code
13
14323098709
from django.db import models from django.shortcuts import get_object_or_404 from django.contrib.auth.models import User from kpbt.accounts.models import BowlerProfile from kpbt.centers.models import BowlingCenter from kpbt.teams.models import Team, TeamRoster from kpbt.games.models import Series from django.core.except...
cjtrombley/KPTracker
kptracker_serv/kpbt/leagues/models.py
models.py
py
15,579
python
en
code
0
github-code
13
5144705836
#!/user/bin/python3 # -*- codeing:utf-8 -*- # Time : 2019/10/16 10:31 # Author : LiuShiHua # Desc : # 导入机器学习linear_model库 from sklearn import linear_model # 导入交叉验证库 from sklearn.model_selection import train_test_split # 导入数值计算库 import numpy as np # 导入科学计算库 import pandas as pd # 导入图表库 import matplotlib.pyplot as plt # ...
yingtian648/my_test
module/machine_learn/20191016.py
20191016.py
py
2,120
python
zh
code
0
github-code
13
34629021012
#!/usr/bin/python3 #Importowanie potrzebnych bibliotek, pika - komunikacja miedzy Rasp a brokerem, subprocess - umozliwia pobranie danych wyjściowych innego skryptu import pika import subprocess import time ###Tutaj jest przyklad sposobu na pobranie zmiennych podczas wywolania kodu ###potrzebny jest import sys #sens...
xyanteos/Skrypty-RaspberryPI
SKRYPTmqtt.py
SKRYPTmqtt.py
py
3,542
python
pl
code
1
github-code
13
15666186317
""" Script to put most recent letterboxd reviews into JSON file. """ from datetime import datetime from feedparser import parse from json import dump from sys import argv RSS_URL = "https://letterboxd.com/g30rg3/rss/" # Get output path or default if len(argv) < 2: output_filepath = "films.json" else: outp...
Ge0rg3/georgeom.net
scripts/update_films.py
update_films.py
py
1,005
python
en
code
3
github-code
13
4787858508
import re text = input() matched = re.findall(r"([=|\/])([A-Z][A-Za-z]{2,})\1", text) result = [] numbers = [] if matched: for match in matched: result.append(match[1]) numbers.append(len(match[1])) print(f"Destinations: {', '.join(result)}") print(f"Travel Points: {sum(numbers)}")
Iskren-Dimitrov/SoftUni_Python_Fundamentals
final_exam_fundamentals_practise/destination_mapper.py
destination_mapper.py
py
305
python
en
code
0
github-code
13
14957188207
import pymysql from crawler.tools import contentFix class SQLHandler(object): def __init__(self): self.__conn = pymysql.connect(host='127.0.0.1', user='root', password='0000', db='crawler', charset='utf8', autocommit=True) self.cursor = self.__conn.cursor() ...
money666-sxy/crawler_backend
crawler/db_handle/sql_handler.py
sql_handler.py
py
3,208
python
en
code
0
github-code
13
39890564366
from tkinter import * from tkinter.ttk import Treeview from tkinter import messagebox import tkinter as tk import sys import PIL from PIL import ImageTk from PIL import Image import tkinter.ttk as ttk from tkinter.ttk import Combobox from datetime import datetime import mysql.connector def quit(ekran): ekran.destr...
oguzcanuzunoner/python-tkinter
catering_siparis_bilgi_yonetim_sistemi/catering.py
catering.py
py
31,212
python
tr
code
1
github-code
13
20346904673
from __future__ import annotations from typing import TYPE_CHECKING, Protocol from sdc11073 import loghelper from .alarmprovider import GenericAlarmProvider from .audiopauseprovider import AudioPauseProvider from .clockprovider import GenericSDCClockProvider from .componentprovider import GenericSetComponentStateOpe...
Draegerwerk/sdc11073
src/sdc11073/roles/product.py
product.py
py
9,839
python
en
code
27
github-code
13
39714334198
#Practice #function: """def printme(str): "this prints a passed string into this function" print(str) return; printme(str = "My string")""" """def printinfo(name, age): "this prints a passed info into this function" print ("Name: ", name) print ("Age: ", age) return; printi...
johnranyer13/CPE-105
function.py
function.py
py
1,143
python
en
code
0
github-code
13
24622777942
#!/usr/bin/env python # coding=utf-8 import re import os import sys import time import codecs import numpy as np import pandas as pd import pickle from tqdm import tqdm from itertools import chain def _read_file(filename = "../data/train"): file = codecs.open(filename + ".txt", encoding='utf-8') file_pos = c...
rohithkodali/pos_blstm
data_utils/gen_ner_file.py
gen_ner_file.py
py
2,284
python
en
code
1
github-code
13
42530557177
# 2048 Adaptation : Jake Levi : May 2018 # 5 hours (5/11/18 1:00) # 3 hours (5/11/18 16:18) FINISHED ENGINE # 4.5 hours (5/12/18 2:16) FINISHED GAME import pygame import copy import random from roundrects import aa_round_rect, round_rect # World State class Game2048: def __init__(self, width, height...
towrofterra/2048
game_2048.py
game_2048.py
py
11,871
python
en
code
0
github-code
13
21859634160
import numpy as np import pretty_midi import librosa import scipy.io.wavfile as wavfile import torch from torch.utils.data import Dataset, DataLoader import torch.nn as nn import torch.nn.functional as F from torch.optim import Adam from tqdm import tqdm import os # viz import matplotlib.pyplot as plt import js...
no-lineal/mir_project
train.py
train.py
py
6,230
python
en
code
0
github-code
13
38714896986
import sys import config as cfg import data ## Inputs: # PathToData: Training Data # Num: Number of training samples # StartNum: Start processing from this sample number ## Outputs: # voxels_preprocessed.vtu dataPath = cfg.Data_path_ps num = cfg.num_simulations_ps startNum = cfg.startNum_simulations_ps + 1 valid = 0...
Gaurav1302/contour2reg
Generate/preprocessData.py
preprocessData.py
py
508
python
en
code
0
github-code
13
1199807385
# 给你二叉树的根节点 root ,返回它节点值的 前序 遍历。 # # 示例 1: # 输入:root = [1,null,2,3] # 输出:[1,2,3] # # 示例 2: # 输入:root = [] # 输出:[] # # 示例 3: # 输入:root = [1] # 输出:[1] # # 示例 4: # 输入:root = [1,2] # 输出:[1,2] # # 示例 5: # 输入:root = [1,null,2] # 输出:[1,2] # # 提示: # 树中节点数目在范围 [0, 100] 内 # -100 <= Node.val <= 100 # Definition for a binary tre...
Lemonstars/algorithm
leetcode/144. 二叉树的前序遍历/solution1.py
solution1.py
py
1,183
python
en
code
0
github-code
13
32859313048
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools from ...lib.tools import get_terminal_size, lookahead class HexViewerMixin: def hexviewer_interface(self, argp): from ...lib.argformats import number argp.add_argument('-A', '--no-addr', dest='hexaddr', action='store_false', ...
chubbymaggie/refinery
refinery/units/sinks/__init__.py
__init__.py
py
2,530
python
en
code
null
github-code
13
35173678764
#!/usr/bin/python3 """Test module definition for Amenity class""" import unittest import json import pep8 import datetime from models.amenity import Amenity from models.base_model import BaseModel class TestAmenity(unittest.TestCase): """Check implemementation for State class""" def test_doc_module(self): ...
faithnekesa/AirBnB_clone
tests/test_models/test_amenity.py
test_amenity.py
py
1,288
python
en
code
0
github-code
13
73998243219
import ast import dis import typing import asyncio import os # Default values for block syntax # One-time block that is called during .init() call before template is rendered ONE_TIME_BLOCK_START = '{1{!' """ One-time expression that is evaluated during .init() call before template is rendered. This block has no res...
bitrate16/yatplt
yatplt.py
yatplt.py
py
35,892
python
en
code
0
github-code
13
27517027041
from takecommand import takecommand from temperaturefile import temp from remember import rememberfunciton from translator import translator from speak import speak from rememberit import rememberit from pronounce import pronounce from spell import spell from screenshot import screen import pyaudio from youtube import ...
pranavthakur0-0/Beginner-Python-Assistant
main.py
main.py
py
3,562
python
en
code
0
github-code
13
3345399803
import ptypes from ptypes import * @pbinary.littleendian class selector(pbinary.struct): _fields_ = [(13, 'Index'), (1, 'TI'), (2, 'RPL')] class systemtable(pstruct.type): _fields_ = [(pint.uint32_t, 'base'), (pint.uint16_t, 'limit')] class systemsegment(pstruct.type): _fields_ = [(selector, 'selector'), (...
arizvisa/syringe
lib/ndk/cpu.py
cpu.py
py
11,099
python
en
code
35
github-code
13
3076440241
import logging import subprocess import sys from .bitwarden import * logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class GitSetup(): """ GitHub setup with SSH https://docs.github.com/en/authentication/connecting-to-github-with-ssh """ @staticmethod def get_us...
marcellbarsony/arch-post
src/post/git_setup.py
git_setup.py
py
2,683
python
en
code
0
github-code
13
27205013859
from loader import dp from aiogram import types from models import models from keyboards.inline.user_settings_keyboards import settings_search_keyboard @dp.message_handler(commands=['settings']) @dp.message_handler(regexp="^(⚙ Настройки)$") async def settings_handler(message: types.Message): user = await mo...
Kyle-krn/DatingBotDubai
handlers/search_settings/view_settings_handler.py
view_settings_handler.py
py
2,132
python
en
code
0
github-code
13
39814453420
"""Run with a subset of benchmark glaciers""" from __future__ import division # Before everythin els for the logger setting import oggm # Logger import logging log = logging.getLogger(__name__) # Python imports import os import salem import zipfile # Libs import matplotlib.pyplot as plt # Locals import oggm.cfg as c...
Chris35Wills/oggm
oggm/sandbox/run_benchmark.py
run_benchmark.py
py
3,436
python
en
code
null
github-code
13
42595792363
import numpy as np import matplotlib.pyplot as plt import ipywidgets as widgets import os import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.colors import Normalize def visualize_volume_SAM(data_dict, show_widget=False, show_tkinter=False, save_path="", axis='z'): ...
AxDante/SAAMI
saami/visualizer.py
visualizer.py
py
4,523
python
en
code
11
github-code
13
2324074141
#Вычисление индекса максимального элемента итерационным методом #Бондаренко Даниил 122В #функция для вычисления индекса максимального элемента def max_idx(arr, n): #инициализация переменных для значений индекса max_i = 0 max_j = 0 #проходим по всему массиву for i in range(0, n): for j in ra...
dzzgnr/lab10
1.3.3.py
1.3.3.py
py
1,553
python
ru
code
0
github-code
13
31190757165
import os from typing import List import yaml languages = {} commands = {} def get_command(value: str) -> List: return commands["command"][value] def get_string(lang: str): return languages[lang] for filename in os.listdir(r"./strings"): if filename.endswith(".yml"): language_name = filename...
Ozlembener/AasthaTGMusicBot
strings/__init__.py
__init__.py
py
695
python
en
code
1
github-code
13
9373458555
from logging import Logger from cloudshell.cp.core.cancellation_manager import CancellationContextManager from cloudshell.cp.core.flows.vm_details import AbstractVMDetailsFlow from cloudshell.cp.core.request_actions.models import VmDetailsData from cloudshell.cp.openstack.models import OSNovaImgDeployedApp from cloud...
QualiSystems/cloudshell-cp-openstack
cloudshell/cp/openstack/flows/vm_details.py
vm_details.py
py
1,420
python
en
code
0
github-code
13
23780111134
import random def generar_punto(): x = random.random() y = random.random() return x,y def dentro_de_circulo(xy): x = xy[0] y = xy[1] return (x**2 + y**2) <= 1 N = 10000 G = sum([dentro_de_circulo(generar_punto()) for i in range(N)]) prob = G/N *4 print(f'Pi es más o menos: {prob:.6f}.'...
romanripari/UNSAMPython
Clase05/estimar_pi.py
estimar_pi.py
py
324
python
es
code
0
github-code
13
15733737510
# ============ IsBranch: 0 -> pc + 4, 1 -> BranchTargetAddress, 2 -> ALUResult ============== import decode as de import memory_access as ma import instruction_fetch as fi # ===========GLOBAL VARIABLES=============== aluResult: int = None isBranch: int = None def srl(a: int, b: int) -> int: if a >= 0: re...
Karanraj06/riscv-32i-simulator
single_cycle/execute.py
execute.py
py
3,577
python
en
code
5
github-code
13
5499368972
import pytest from queryset_serializer.db.models import SerializerPrefetch from queryset_serializer.serializers import (DefaultMetaQuerySetSerializer, QuerySetMetaSerializer, QuerySetSerializer, get_meta, ...
MauriceBenink/python_queryset_serializer
tests/serializer/test_queryset_serializer.py
test_queryset_serializer.py
py
6,986
python
en
code
2
github-code
13
11960896730
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import re import nltk from nltk.corpus import stopwords from nltk.sentiment.vader import SentimentIntensityAnalyzer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_sele...
robelhossain783/Online_Cyberbullying_Detection
ClassificationAndPrediction.py
ClassificationAndPrediction.py
py
5,547
python
en
code
0
github-code
13
6601744229
# -*- coding: utf-8 -*- from odoo import fields, models, api, _ from odoo.exceptions import ValidationError TYPE_SELECTION = [ ('fabric', 'Fabric'), ('jeans', 'Jeans'), ('cotton', 'Cotton') ] class Supplier(models.Model): _name = 'supplier.supplier' _description = 'Supplier Infor...
muhardiansyah15/material_listing
material_listing/models/material_listing.py
material_listing.py
py
1,270
python
en
code
0
github-code
13
3250163042
import socket import struct import dpkt from threading import Thread, Lock mutex = Lock() ##GUARDING OUR THREADS PORT = 25565 HOST = socket.gethostbyname(socket.gethostname()) ##GETTING IP socketInf = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) ##IPV4 socketInf.bind((HOST,PORT)) socketInf.i...
Asquardian/snifferWithLogs
kurs.py
kurs.py
py
1,929
python
en
code
0
github-code
13
3192457058
import argparse from os import mkdir from os.path import isdir, isfile, join import matplotlib.patches as patches import matplotlib.pyplot as plt import numpy as np from matplotlib.collections import LineCollection from mpl_toolkits.axes_grid1 import make_axes_locatable from cooperative_transport.gym_table.envs.utils...
eleyng/traj_vis_lib
plot_inter_f.py
plot_inter_f.py
py
13,420
python
en
code
0
github-code
13
71480475538
melysegek=[] db=0 with open("melyseg.txt","r") as bemenet: for sor in bemenet: melysegek.append(int(sor.strip())) db+=1 print("1. feladat") print("A fájl adatainak száma: ",len(melysegek)) print("2. feladat") hely=int(input("Adjon meg egy távolságértéket! ")) print("Ezen a helyen a felszín",melysege...
Froxy555/informatika-erettsegi-python
2021majus/godor.py
godor.py
py
1,815
python
hu
code
1
github-code
13
18704204977
""" Vamos agora retirar a concatenção e separar completamente as bases """ import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder, StandardScaler from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense from sklearn.metrics...
accolombini/PROSPECACAO
TESTE_PY/teste29.py
teste29.py
py
2,881
python
pt
code
0
github-code
13
36594566453
from train import Cartoon, DataLoader, T, classification_report, initialize_model, load_model import torch from tqdm import tqdm def get_loader(image_dir, attr_path, selected_attrs, crop_size=378, image_size=224, batch_size=16): """Build and return a data loader.""" dataloader = {} transfo...
KungHao/Image-Classification-pytorch
test.py
test.py
py
2,786
python
en
code
0
github-code
13
5145789909
# Runtime: Aim for linear def two_sum(srt_lst, target): low = 0 high = len(srt_lst)-1 while low <= high: if srt_lst[low] + srt_lst[high] == target: #if they add to target result = (low, high) return result elif srt_lst[low] + srt_lst[high] > target: #if too ...
faithvillarr/CS-UY1134-Data-Structures-and-Algorithms
HW2/fmv8970_hw2_q6.py
fmv8970_hw2_q6.py
py
418
python
en
code
0
github-code
13
13313184047
import weakref from . attributes import AttributeHandler from . exception import GameObjectException class GameObject: core = None __slots__ = ["name", "objid", "tags", "attributes", "initial_data", "aliases", "asset", 'relations', 'namespace'] def __init__(self, objid: str, name: str, initial_data=None,...
volundmush/shinma
shinma/modules/core/gamedb/objects.py
objects.py
py
1,591
python
en
code
0
github-code
13
1581408183
import numpy as np import scipy.ndimage as ndi def seedGrowingSeg(I,sigma,seed_x,seed_y,thresh,n_rows,n_cols,slice_num): # seedGrowingSeg segments a 2D image using region growing algorithm # FUNCTION DESCRIPTION: # 1) Receives 2D slice and performs pre-processing Gaussian blurring # ...
edggjames/RegionGrowingSegmentation
seedGrowingSeg.py
seedGrowingSeg.py
py
5,257
python
en
code
2
github-code
13
3219811863
from django.conf.urls import url from . import views app_name='search' urlpatterns=[ url(r'^$',views.index,name='index'), url(r'^result/$',views.search_result,name='search_result'), url(r'^upload/$',views.upload,name='upload'), url(r'^add_to_favorite/(?P<image_address>[0-9a-zA-Z\_]+)/$'\ ,views.add_to_favorite,...
zehuichen123/Django_practice
HCI_lab3/search/urls.py
urls.py
py
414
python
en
code
0
github-code
13
72966438739
import numpy as np from deLavalNozzleModel import rocketEngine_deLaval from perfectlyExpandedNozzleModel import rocketEngine_perfectlyExpanded from aerospikeNozzleModel import rocketEngine_aerospike from atmosphericModels import atmosPress_earth # Propellant Generation keroLox = { 'T_1': 4000, # combustion temp ...
grahambell92/launcherModel_gBell
rocketLab_params.py
rocketLab_params.py
py
6,217
python
en
code
0
github-code
13
14646571315
from sqlalchemy import Column, ForeignKey, Identity, Integer, Table from . import metadata PortalFeaturesJson = Table( "portal_featuresjson", metadata, Column("customer_update", PortalCustomerUpdate, ForeignKey("PortalCustomerUpdate")), Column("invoice_history", PortalInvoiceList, ForeignKey("PortalIn...
offscale/stripe-sql
stripe_openapi/portal_features.py
portal_features.py
py
972
python
en
code
1
github-code
13
39772747654
import re email1 = 'mir.moheuddin$student.sgh.waw.pl' email2 = 'mir.moheuddin@' email3 = 'mm120110@student.sgh.waw.pl' email4 = '@student.sgh.waw.pl' email5 = 'mir.moheuddin@.pl' email6 = 'mir@moheuddin@.pl' def check_email(email): path = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' if re.match(path,...
mirmoheuddin22/Python_Winter_2022_3
Email Checking.py
Email Checking.py
py
1,143
python
en
code
2
github-code
13
74370842898
# Adapted from https://github.com/BichenWuUCB/SqueezeSeg from typing import Dict import torch import torch.nn as nn import torch.nn.functional as F class Fire(nn.Module): def __init__(self, inplanes: int, squeeze_planes: int, expand1x1_planes: int, expan...
Gorilla-Lab-SCUT/gorilla-3d
projects/SalsaNext/salsa/backbone/squeezenet.py
squeezenet.py
py
5,754
python
en
code
7
github-code
13
35785557113
import time import matplotlib.pyplot as plt import matplotlib.animation as animation import threading import random from scipy import interpolate import numpy as np import csv from DigitalFilter import * #Global variable WINDOWSIZE = 10 PERIOD = 0.125 Colour = {"SCR":"k","RR":"b", "HR":"r", "SST":"g"} GRAPHWIDTH = 3...
0xsuu/Pi_Polygraph
PlotGraph.py
PlotGraph.py
py
14,362
python
en
code
0
github-code
13
9524359393
# 导包 from typing import List import sortingx # 测试 class Reverser: def __init__(self, genre: str, method: List[str], part: List[bool]=None, ret: List[bool]=None): ''' genre: 类型名称; method: 方法列表; part: 方法是否含参数l与r; ret: 函数是否有返回值 ''' if part != None: assert len(part) == len(m...
linjing-lab/sorting-algorithms
test_reverse.py
test_reverse.py
py
3,585
python
en
code
4
github-code
13
41256124036
n = 0 cont = 0 soma = 0 # quando as variáveis são iguais pode colocar tudo na mesma linha # n = cont = soma = 0 n = int(input('Digite um número [999 para parar] :')) #flag while n != 999: soma += n cont += 1 n = int(input('Digite um número [999 para parar] :'))#flag. não entra na soma print('Vc digitou {} n...
pfontaneda/Exercicios-Python
ex python/pythonProject1/ex064.py
ex064.py
py
369
python
pt
code
0
github-code
13
74319488659
import httpx from ..exceptions import InfoGatherError class PagureClient: def __init__(self, baseurl): self.baseurl = f"{baseurl}/api/0/" async def _get(self, endpoint, **kwargs): async with httpx.AsyncClient() as client: response = await client.get(self.baseurl + endpoint, **kwa...
fedora-infra/maubot-fedora
fedora/clients/pagure.py
pagure.py
py
1,272
python
en
code
0
github-code
13
17034002894
from __future__ import print_function import functools import json import os import sys from os.path import expanduser from typing import Any import six from pathlib2 import Path from pyparsing import ( ParseFatalException, ParseException, RecursiveGrammarException, ParseSyntaxException, ) from clear...
allegroai/clearml-agent
clearml_agent/backend_config/config.py
config.py
py
12,445
python
en
code
205
github-code
13
3659583629
with open("input1.txt") as f: lines = f.readlines(); lo = 1 hi = 4 chars = lines[0] d = {chars[0]: 1, chars[1]: 2,chars[2]: 1} while hi < len(chars): if chars[hi] in d: d[chars[hi]] += 1 else: d[chars[hi]] = 1 if chars[lo - 1] in d: d[c...
felixab/AoC2022
day_6/p_1.py
p_1.py
py
553
python
en
code
0
github-code
13
2692692723
import os import requests import dicttoxml from collections import OrderedDict from xml.dom.minidom import parseString from bs4 import BeautifulSoup from operator import itemgetter from msedge.selenium_tools import Edge, EdgeOptions from selenium.webdriver.support.ui import WebDriverWait from selenium.webdrive...
kingIzi/Syllabus_001
SyllabusWebSampleData/universities_data.py
universities_data.py
py
5,851
python
en
code
0
github-code
13
72397736657
import pandas as pd import numpy as np from sklearn.preprocessing import MinMaxScaler import math from typing import List class DataScaler(): model = None scaler: MinMaxScaler = None scaled_data = None train_data = None train_data_len = 0 dataset: pd.Series = None x_train = [] y_train =...
bjorger/master-thesis
Models/helper/DataScaler.py
DataScaler.py
py
1,862
python
en
code
0
github-code
13
72014395859
from rest_framework import generics, status from rest_framework.response import Response from .serializers import SignUpSerializer from .utils import get_user_token class SignUpApiView(generics.GenericAPIView): serializer_class = SignUpSerializer __doc__ = """ SignUp Api view this api is used...
viprathore/Python
mail_service/service/core/views.py
views.py
py
1,188
python
en
code
0
github-code
13
31910934829
import streamlit as st import pandas st.set_page_config(layout="wide") col1, empty_col, col2 = st.columns([1.5,.5,1.5]) with col1: st.image("images/profile_photo.png", width=450) with col2: st.title("Scott Caruso") content = """ One of my greatest passions lies in the realm of technology and softw...
ScottCharlie/app2-portfolio
Home.py
Home.py
py
1,332
python
en
code
0
github-code
13
40439149325
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Tree(object): """二叉树""" def __init__(self): self.root = None def add(self, item): node = TreeNode(item) if self.root...
parkerdu/leetcode
173.py
173.py
py
2,874
python
en
code
0
github-code
13
4374278969
import RPi.GPIO as GPIO import time from threading import Timer # ピンの設定 GPIO.setwarnings(False) # 警告を無視 GPIO.setmode(GPIO.BOARD) # ピンの番号は物理ピンの番号を使う GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # 10番ピンをプルダウンかつ入力に設定 GPIO.setup(8,GPIO.OUT, initial=GPIO.HIGH) # ピン番号8番を出力に設定する.初期値はHIGH # LEDをOFFにする処理 def led_of...
nmiri-nagoya-nsaito/iot_training_20181113
gpio_event.py
gpio_event.py
py
1,087
python
ja
code
0
github-code
13
22118250648
""" HOME-MADE TIGHT-BINDING CODE FOR TWISTED BILAYER GRAPHENE Contains all relevant constants, functions and classes. Is meant to be imported as a module in other python scripts. """ import numpy as np #arrays import matplotlib.pyplot as plt #plotting import matplotlib #plot settings from numba import jit #just-in...
vgmduarte/twisted_graphene_TG
twisted_graphene.py
twisted_graphene.py
py
17,517
python
en
code
1
github-code
13
4022717687
import cv2 import numpy as np # 이미지 불러오기 image = cv2.imread('images/5.jpg', cv2.IMREAD_GRAYSCALE) # 가우시안 블러 적용 # 이미지에 가우시안 블러를 적용하여 잡음을 제거 blurred = cv2.GaussianBlur(image, (5, 5), 0) # 캐니 윤곽선 검출 # 최소 및 최대 임계값을 인자로 받으며, 이 임계값 범위 내의 경계값을 가진 픽셀을 윤곽선으로 간주 edges = cv2.Canny(blurred, 50, 150) # 검출된 윤곽선 출력 cv2.imshow('E...
DeveloperSeJin/StudyImageProcessing
ProjectYYJ.py
ProjectYYJ.py
py
1,763
python
ko
code
1
github-code
13
1797366577
from pydantic import BaseModel, validator from pathfinder_network.datamodel.company_id import CompanyId class CompanyIdSet(BaseModel): """ A set of CompanyIds of size 1 or larger. Attributes: company_ids (list[CompanyId | str]): A list of CompanyIds or strings representing CompanyIds ...
JohnVonNeumann/pathfinder_network
pathfinder_network/datamodel/company_id_set.py
company_id_set.py
py
1,564
python
en
code
2
github-code
13
13140009811
import sys import time import multiprocessing from tradingkit.data.feed.feeder import Feeder from tradingkit.pubsub.core.event import Event from tradingkit.pubsub.core.publisher import Publisher from tradingkit.pubsub.core.subscriber import Subscriber from tradingkit.pubsub.event.book import Book from tradingkit.pubsu...
logictraders/tradingkit
src/tradingkit/data/feed/aggregator_feeder.py
aggregator_feeder.py
py
1,771
python
en
code
3
github-code
13
3129863640
from django.shortcuts import redirect, render, get_object_or_404 from . import models from .forms import UploadImageForm # Create your views here. def SubirImage(request): if request.method == 'POST': form = UploadImageForm(request.POST, request.FILES) if form.is_valid(): form.save() ...
JsonAndrx/archinonproyecto
imagenes/views.py
views.py
py
858
python
en
code
0
github-code
13
26377015608
#!python from utils import * def _f(x, y, z): return x & y | ~x & z def _g(x, y, z): return x & y | x & z | y & z def _h(x, y, z): return x ^ y ^ z def _f1(a, b, c, d, k, s, X): return rol(a + _f(b, c, d) + X[k], s, 32) def _f2(a, b, c, d, k, s, X): return rol(a + _g(b, c, d) + X[k] + 0x5a827999, s, 32) def _f3(a, b,...
MarkLuk/cryptopals
MD4.py
MD4.py
py
3,961
python
en
code
0
github-code
13
43084011122
# # @lc app=leetcode.cn id=2124 lang=python3 # # [2124] 检查是否所有 A 都在 B 之前 # # @lc code=start class Solution: def checkString(self, s: str) -> bool: a_status = False b_status = False for i in range(len(s)): if s[i] == "a": if b_status: return Fa...
Guo-xuejian/leetcode-practice
2124.检查是否所有A都在B之前.py
2124.检查是否所有A都在B之前.py
py
536
python
en
code
1
github-code
13
13603790025
from sprite_object import * #108 from npc import * from player import * #remove class ObjectHandler: #108 def __init__(self, game): self.game = game self.player = Player(self) #remove self.sprite_list = [] self.npc_list = [] self.npc_sprite_path = 'resources/sprites/npc/' ...
mnothman/pygameHackathon
object_handler.py
object_handler.py
py
4,139
python
en
code
0
github-code
13
43238688912
import subprocess from path import path from datetime import datetime import json import bson from pyquery import PyQuery from urlparse import urlparse import logging from sensitive import grab, UPLOAD_COMMAND from db import DB FRONT_PAGE = 'http://news.ycombinator.com/' SECOND_PAGE = 'http://news.ycombinator.com/news...
doda-zz/rewindhn
scrape.py
scrape.py
py
3,480
python
en
code
61
github-code
13
22386997979
import pickle from os import listdir import os from os.path import isfile, join import seaborn as sns import matplotlib.pyplot as plt import numpy as np import re def smooth(x, N): x = np.insert(x, len(x), x[len(x) - 1] * (np.ones(N - 1) + 0.05 * (np.random.rand(N - 1) - 0.5))) cumsum = np.cumsum(np.insert(x,...
OscarLigthart/RL-Project
Project/plot.py
plot.py
py
3,282
python
en
code
0
github-code
13
40397852445
family = {"rick": 43, 'beth': 13, 'morty': 5, 'summer': 8} def movie_tickets(family): cost = 0 for age in family.values(): if age < 3: cost += 0 elif age <= 12: cost += 10 else: cost += 15 return cost final_cost = movie_tickets(family) print(f"Fa...
Lidkin/DI_Bootcamp
Week2/Day3/Exercises_XP/exercise2.py
exercise2.py
py
803
python
en
code
0
github-code
13
17499090249
n = int(input()) y = 0 list_keys = [] k = 0 max_val = 0 d1 = dict() for i in range (n): s = input().split() x = s[0] y = int(s[1]) if x not in d1: d1[x]=y else: d1[x]+=y max_val = max(d1.values()) list_keys = list(d1.keys()) list_keys.sort() for i in list_keys: if max_val == d...
21B030702/PP2
lab 2/6.py
6.py
py
447
python
ko
code
0
github-code
13
277075411
import catalog import schedule def update(update_courses=True, update_degrees=True, update_schedule=True): if update_courses: catalog.courses.update_db() if update_degrees: catalog.degrees.update_db() if update_schedule: schedule.update_db(newest_terms=2)
CDavantzis/SSW690-Project
src/app/db/__init__.py
__init__.py
py
296
python
fa
code
1
github-code
13