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
34477681751
import rpyc from rpyc.utils.server import OneShotServer import unittest class MyService(rpyc.Service): def exposed_foo(self): return "bar" class Test_OneShotServer(unittest.TestCase): def setUp(self): self.server = OneShotServer(MyService, port=18878, auto_register=False) self.serv...
tomerfiliba-org/rpyc
tests/test_oneshot_server.py
test_oneshot_server.py
py
886
python
en
code
1,454
github-code
1
72484824354
from django.db import models from geoposition.fields import GeopositionField from django import forms class Clinic(models.Model): """ A clinic providing health services. """ name = models.CharField( 'Name of the clinic', max_length = 255, unique = True, ) location = Geoposit...
RHoKSoton/jipange
clinics/models.py
models.py
py
3,855
python
en
code
1
github-code
1
2738928489
from collections import defaultdict, deque def solve(path): #只能解决小数据集 border = 10 ** 9 w = h = 0 dictionary = defaultdict(int) d = {'N': 0, "S": 1, "E": 2, "W": 3} stack = deque() N = len(path) tmp = '' for i in range(N): if tmp=='': tmp+=path[i] elif path[i...
huangketsudou/algorithms
kickstart/B2020RobotPathDecoding.py
B2020RobotPathDecoding.py
py
1,916
python
en
code
0
github-code
1
17329286738
# update_data.py # Author : Irfan TOOR <email@irfantoor.com> # # imports import os import numpy as np import pandas as pd # ----------------------------------------------------------------------------------------- # data paths -- adjust these paths and PCA parameters globo_source = "../data/source/news-portal-user-i...
irfantoor/azure-scripts
update_data.py
update_data.py
py
8,097
python
en
code
0
github-code
1
17845242283
from zope.interface import implements from twisted.internet import defer from axiom.store import Store from axiom.item import Item from axiom import attributes from axiom.dependency import installOn from nevow.testutil import renderLivePage, FragmentWrapper, AccumulatingFakeRequest from nevow import loaders from nev...
rcarmo/divmod.org
Mantissa/xmantissa/test/test_search.py
test_search.py
py
5,267
python
en
code
10
github-code
1
73722968675
import data_handler as dh_temp import display as display import os import data_handler as dh import experimental_figs as exp def playing_with_data(): #folder_data = '/home/maja/PhDProject/human_data/data/' folder_data = '/home/maja/PhDProject/data/' folder_data='/home/maja/PhDProject/human_data/data/' ...
maikia/human
human/main.py
main.py
py
2,759
python
en
code
0
github-code
1
19503487404
from openerp import fields, models, api from datetime import datetime from openerp.osv import osv from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx from dateutil.relativedelta import relativedelta from dateutil import tz from pytz import timezone class AccountsReportWizard(models.TransientModel): ...
hosterp/BUREAU_GREEN_20_06_23
hiworth_construction/wizard/accounts_report_wizard.py
accounts_report_wizard.py
py
5,150
python
en
code
0
github-code
1
3049317006
#!/usr/bin/env python import sys import argparse from pascal.program import Program from printer import OutputBuffer arg_parser = argparse.ArgumentParser(prog='Pascal Compiler') arg_parser.add_argument('-p', '--pascal', required=True, dest='filename', help='location ...
TheLampshady/pascompiler
compiler.py
compiler.py
py
716
python
en
code
0
github-code
1
71721936675
""" Helper functions and class to calculate Average Precisions for 3D object detection. Modified from: https://github.com/facebookresearch/votenet/blob/master/models/ap_helper.py """ import os import sys import numpy as np from benchmark.box_util import extract_pc_in_box3d from benchmark.eval_det import eval_det, ge...
daveredrum/Scan2Cap
benchmark/ap_helper.py
ap_helper.py
py
6,608
python
en
code
89
github-code
1
35630298336
import os import torch import torch.nn as nn from torch.nn import functional as F # Initialize some hyperparameters # Hyperparameters control various aspects of training, such as the batch size, # learning rate, dropout ratio, etc. batch_size = 132 # Number of sequences to process in parallel. block_size = 16 # Maxim...
ManzilS/Bigram_Language_Model_ABC_Notation
Create_model.py
Create_model.py
py
9,203
python
en
code
0
github-code
1
18024310114
import os import logging import begin from tqdm import tqdm import numpy as np from skimage.transform import resize as sk_resize @begin.start(auto_convert=True) @begin.logging def main(in_file: 'Input npz file containing the dataset'='.', out_folder: 'Output folder for the npz file'='.', imagenet_size: 'IF ...
roboticslab-uc3m/textiles-hanging
textiles_hanging/rescale_dataset.py
rescale_dataset.py
py
1,463
python
en
code
0
github-code
1
11940791720
from celery import shared_task from django.conf import settings from django.db import transaction from .models import Project, Reference, VAF from .serializers import MetadataSerializer import maptide import time import math def entropy(probabilities, normalised=False): ent = sum([-(x * math.log2(x)) if x != 0 el...
CLIMB-COVID/vafdb
vafdb/data/tasks.py
tasks.py
py
7,957
python
en
code
0
github-code
1
963031018
import numpy as np class ValueIteration: def __init__(self, env): """ :param env: gym environment """ self._env = env self._N_STATES = env.env.nS self._N_ACTIONS = env.env.nA self._trans_probs = env.env.P self._final_policy = None def value_ite...
TrellixVulnTeam/reinforcement_learning_frozen4x4_samples_QC4P
AlgorithmImplementation/value_iteration.py
value_iteration.py
py
2,560
python
en
code
0
github-code
1
12733905938
import os from internetofmoney.tests.test_base import BaseTestCase from internetofmoney.utils.ingkeypair import INGKeyPair class TestINGKeyPair(BaseTestCase): """ This class contains tests for the ING key pair """ def test_encrypt_decrypt(self): """ Test encryption/decryption of some...
devos50/ipv8-android-app
app/src/main/jni/lib/python2.7/site-packages/internetofmoney/tests/test_ing_keypair.py
test_ing_keypair.py
py
710
python
en
code
0
github-code
1
17755684015
from .utils import Split from . import config as config_lib from . import dataset_spec as dataset_spec_lib from . import pipeline from .utils import worker_init_fn_ def get_metadataset(args, datasets=["ilsvrc_2012"], split=Split["TRAIN"]): # Recovering configurations data_config = config_lib.DataConfig(args) ...
hushell/pmf_cvpr22
datasets/meta_dataset/__init__.py
__init__.py
py
2,060
python
en
code
137
github-code
1
4358448468
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 import praw import re from imgurpython import ImgurClient import requests import time import os import urllib.request import config #TODO fix for reddit images redd.it/###.jpg # max number of submissions to check LIMIT = 200 # subreddit being checked #...
Maxed/Scraper
pictures.py
pictures.py
py
4,757
python
en
code
1
github-code
1
70705474593
import torch class Single_net(torch.nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Single_net, self).__init__() self.hidden = torch.nn.Linear(n_feature, n_hidden) # hidden layer self.predict = torch.nn.Linear(n_hidden, n_output) # output layer def forward(sel...
GaneshVShinde/Recombinat_DeepQ
network.py
network.py
py
2,588
python
en
code
0
github-code
1
17809201566
from libcfcg import cf, helper import numpy as np import random as r import sys def iteration(point: cf.Point, transforms: np.ndarray, col: cf.Color) -> cf.Point: """ Führt eine Iteration des Iterated Function Systems (IFS) durch. Parameters: - point (cf.Point): Der aktuelle Punkt im Koordinatensystem...
MaxUhl98/CuF
Prak02/aufgabe 1.py
aufgabe 1.py
py
2,456
python
de
code
0
github-code
1
35715802575
from openpyxl import load_workbook from extractor import read_agenda # setting up testing files wb1 = load_workbook('test_example_1.xlsx', data_only=True) worksheet_1 = wb1.worksheets[0] wb2 = load_workbook('test_example_2.xlsx', data_only=True) worksheet_2 = wb2.worksheets[0] wb3 = load_workbook('test_example_3.x...
luaroncrew/university_agenda_to_apple_calendar
test_extractor.py
test_extractor.py
py
733
python
en
code
1
github-code
1
19035107378
import streamlit as st import numpy as np import pandas as pd from googletrans import Translator from transformers import T5Tokenizer, MT5ForConditionalGeneration import torch from torch import optim import pandas as pd import numpy as np "# Generating Natural Language Text from RDF" def get_model(language,model_...
goku80903/IRE-Major-Project
demo.py
demo.py
py
2,910
python
en
code
0
github-code
1
31994340913
import json import jsonschema from datetime import datetime from models.models import Order, Customer, Driver from django.db import connection from django.core import serializers from django.http import JsonResponse, HttpRequest from django.views.decorators.http import require_http_methods @require_http_methods(["GET"...
omni2k23/OrderAPI
views/orders.py
orders.py
py
2,934
python
en
code
0
github-code
1
41034422334
from __future__ import annotations from decimal import Decimal from enum import IntEnum import itertools import operator import re import typing from typing import AbstractSet from typing import Any from typing import Callable from typing import cast from typing import Dict from typing import FrozenSet from typing imp...
sqlalchemy/sqlalchemy
lib/sqlalchemy/sql/elements.py
elements.py
py
170,781
python
en
code
8,024
github-code
1
365947772
import abc import binascii import os import sys import warnings from hashlib import sha384 from typing import Dict, Iterable from hypothesis.configuration import mkdir_p, storage_directory from hypothesis.errors import HypothesisException, HypothesisWarning from hypothesis.utils.conventions import not_set __all__ = [...
webanck/GigaVoxels
lib/python3.8/site-packages/hypothesis/database.py
database.py
py
11,325
python
en
code
23
github-code
1
71222862435
# coding=utf-8 import os import json import decimal from os import urandom import multiprocessing import pymysql import MySQLdb import MySQLdb.cursors import codecs from enum import Enum, unique DEFAULT_MAX_SIZE_OF_CSV = 2 * 1024 * 1024 RANDOM_STR = "RANDOM_STR_SUFFIX" MAX_EXECUTION_TIME = 9999000 def...
FYPYTHON/PathOfStudy
component/openGauss/pg_chameleon/just_file/mysql_read.py
mysql_read.py
py
27,217
python
en
code
0
github-code
1
26195873926
n, m = map(int, input().split()) moneys = [] for _ in range(n): moneys.append(int(input())) dp = [10001] * (m + 1) dp[0] = 0 for i in moneys: for j in range(i, m + 1): dp[j] = min(dp[j], dp[j - i] + 1) if dp[m] == 10001: print(-1) else: print(dp[m])
sinryuji/algorithm
이취코/다이나믹 프로그래밍/8-4. 효율적인 화폐 구성.py
8-4. 효율적인 화폐 구성.py
py
274
python
en
code
0
github-code
1
31821099628
import pandas as pd import json import datetime from bdd import get_database from fetch_air_quality_datas import fetch_air_quality_datas # Fonction permettant de convertir les données au format csv en format json qui sera plus adapté pour structurer notre # MongoDB. def convert_air_quality_datas_to_json() : #Récup...
mercierju/DSIA_4301B-DataEngineerToolsProject_MERCIER_LEFEVRE
Back/insert_datas_db.py
insert_datas_db.py
py
2,953
python
en
code
0
github-code
1
24330660208
import time from reportlab.lib.enums import TA_JUSTIFY from reportlab.lib.enums import TA_LEFT from reportlab.lib.enums import * from reportlab.lib.pagesizes import * from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from repo...
mmejia/systra
accidentes/GenerateFrontalPdf.py
GenerateFrontalPdf.py
py
7,610
python
es
code
0
github-code
1
35841067811
#! /bin/python3 # Write a function in Python which accepts a nested list and print all the values present at the main diagonal position in the form of a matrix def print_diagonal(n): for i in range(len(n)): for j in range(len(n[i])): if i == j: print(n[i][j], end=" ") print(...
AmanxUpadhyay/CSIT232-Python-Programming
Lab 5/Question_6.py
Question_6.py
py
581
python
en
code
0
github-code
1
73139091555
def isInteger(char): try: int(char) return True except ValueError: return False result = [] while True: try: low, up, num, space = 0, 0, 0, 0 # 입력 string = input() for char in string: if char.islower(): low += 1 ...
kluge121/study-algorithms
SsangWoo/python/10820.py
10820.py
py
664
python
en
code
0
github-code
1
20496516954
import numpy as np from parakeet.testing_helpers import expect_allpairs, run_local_tests bool_vec = np.array([True, False, True, ]) int_vec = np.array([1,2,3,]) float_vec = np.array([10.0, 20.0, 30.0 ]) vectors = [bool_vec, int_vec, float_vec] def loop_dot(x,y): n = x.shape[0] result = x[0] * y[0] i = 1 whi...
iskandr/parakeet
test/algorithms/test_dot.py
test_dot.py
py
614
python
en
code
232
github-code
1
22633275583
from http.client import HTTPException from urllib import response from fastapi import FastAPI from typing import List, Optional from pydantic import BaseModel import threading from time import sleep import numpy as np from fastapi_mqtt import FastMQTT, MQQTConfig import json f = open('./data.json', "r") data = json.lo...
palulconst1/MonkeyBusiness
proiect-mds/app.py
app.py
py
7,464
python
en
code
1
github-code
1
27054053864
import logging from typing import Any, Dict, List, Optional from datasets import Array2D, Array3D, ClassLabel, Features, Sequence, Value from transformers import LayoutLMv2Processor, LayoutLMv3Processor, LayoutXLMProcessor logger = logging.getLogger(__name__) class BaseEncoder: """BaseEncoder is the base class ...
deeptools-ai/document-tools
document_tools/encoders/encoders.py
encoders.py
py
5,617
python
en
code
6
github-code
1
26394976882
"""Write an algorithm to print and count the multiples of 3 from 1 to a number that we enter by keyboard""" def count_mult_three(): n = int(input("Please, insert a number: ")) count = 0 number = 0 while number < n: number = number + 1 if (number % 3) == 0: count = count + 1 print(f"Between 1 and {n}...
AmandaArenales/ComIT_Exercises_Python
Practice_2/multiplies_of_three.py
multiplies_of_three.py
py
395
python
en
code
0
github-code
1
36507577180
from utilities import Course import requests from lxml import html import json headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Connection": "keep-alive", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gec...
Jsbbvk/BoilermakeIX
data_parsing/multidis.py
multidis.py
py
1,225
python
en
code
1
github-code
1
7019485319
import os from sys import * def Directory_Watcher(Dir_Name): print("Inside directory watcher method") print("Name of input directory : ",Dir_Name) flag = os.path.isabs(Dir_Name) if flag == False: Dir_Name = os.path.abspath(Dir_Name) else: return for fo...
Nikhil-kolhe/Automation_With_Python
DirectoryWatcherrr.py
DirectoryWatcherrr.py
py
1,403
python
en
code
0
github-code
1
9245438713
import numpy as np import numpy.linalg as LA import sys #牛顿法 def NtM(df,ddf,x0): x = x0 e = 10**-8 while(1): dfx = df(x) ddfx = ddf(x) s = ddfx.I * (-dfx) x = x + s if LA.norm(s,2) < e: break return x if __name__ == '__main__': def f(x): ...
RAmenLch/UnconstrainedOptimizationMethod
NdNewtonMethod.py
NdNewtonMethod.py
py
868
python
en
code
2
github-code
1
6204724490
#!/usr/bin/env python """ simutils.py -- useful utilities for the simulation module in strobemod """ import sys import os import numpy as np import pandas as pd def sample_sphere(N, d=3): """ Sample *N* points from the surface of the unit sphere, returning the result as a Cartesian set of points. ...
alecheckert/strobemodels
strobemodels/simulate/simutils.py
simutils.py
py
7,466
python
en
code
0
github-code
1
7163854747
#!/usr/bin/env python3 """PLINK to preform PCA: plink --vcf BYxRM_segs_saccer3.bam.simplified.vcf --pca 2 --allow-extra-chr --allow-no-sex --mind used plink.eigenvec file for this plot""" import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt eigenvec= open(sys.argv[1]) #plink.eigenvec fi...
hhaller1/qbb2019-answers
week4/week4-1.py
week4-1.py
py
667
python
en
code
0
github-code
1
70974282275
class C: _i = 4 __j = 10 def __init__(self): self.__k = 10 def info(self): return self._i, self.__j, self.__k x = C() print(x.info()) print(x._i) #okay, no mangling with _ # print(x.__j) # Error, mangled x._i = 1000 # no mangling with single _ x._C__j = 7 # with two _, name is ma...
3k1m/python
math3343_autumn2022/nov22.py
nov22.py
py
471
python
en
code
0
github-code
1
25366369307
import os import re # ------------------------------------------ # Functions for reading CGGTTS files # # ------------------------------------------ # Calculate the checksum for a string, as defined by the CGTTS specification # ------------------------------------------ def CheckSum(l): cksum = 0 for c in l: cksu...
openttp/openttp
software/system/src/cggttslib.py
cggttslib.py
py
9,906
python
en
code
7
github-code
1
34468818200
# 오고가는데 가장 많은 시간을 소비하는 학생 # X마을에 모여 파티를 연다 # 오고가는데 가장 많은 시간을 소비하는 학생 import heapq import sys INF = sys.maxsize n, m, x = map(int, input().split()) graph = [[] for _ in range(n+1)] distance = [[INF for _ in range(n+1)] for _ in range(n+1)] for _ in range(m): a, b, d = map(int, input().split()) graph[a].app...
yeafla530/algorithms
백준/다익스트라/파티.py
파티.py
py
1,144
python
en
code
0
github-code
1
26048176784
# -*- coding: utf-8 -*- from imtools import * import numpy as np import numpy.fft as fft import matplotlib as mpl import matplotlib.pyplot as plt from math import * from cmath import * ##Exercice 1: visualisation de fonctions de Sobolev ##1.a Sobolev 1d ##On suppose une décroissance des coefficients de Fourier en (1...
pjbenard/EDP_TP_2
sobolev.py
sobolev.py
py
4,233
python
fr
code
0
github-code
1
8095555076
""" URL configuration for gestorDocumental project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, n...
Gabugueado/gestor-documento-backend
gestorDocumental/urls.py
urls.py
py
1,394
python
en
code
0
github-code
1
17635080654
import struct from io import BytesIO from typing import List from hash import double_sha256 from serialize import read_var_int class BlockHeader: FORMAT = '< i 32s 32s I I I' FORMAT_MESSAGE = FORMAT + 'x' def __init__(self, version: int, prev_block: bytes, ...
EyeOfPython/pyspv
headers_message.py
headers_message.py
py
2,456
python
en
code
0
github-code
1
2144675300
import re def reggex(string): match = re.search(r'[A-Z]{1}[a-z]+\s\d+', string) if match : print(match.group()) else: print('no result found') reggex("Kampakkers 52") reggex("5503 LL Veldhoven")
redvox27/innovatiespotter
hightechNL/reggex.py
reggex.py
py
224
python
en
code
0
github-code
1
4340562652
import logging import math import re import pandas from datetime import datetime, timezone from jal.constants import DividendSubtype from jal.widgets.helpers import g_tr from jal.db.update import JalDB # -----------------------------------------------------------------------------------------------------------------...
iliakan/jal
jal/data_import/statement_quik.py
statement_quik.py
py
4,544
python
en
code
null
github-code
1
28541107308
import random import math import turtle random.seed(100) # create grpphic window, get a reference to this window window = turtle.Screen() # set window dimensions window.setup(600 , 400) # set window title window.title("Rinkis") # 1. izveidot sarakstus ar x un y koordinatem n = 10 x = [] y = [] #[0;9] for i in range...
aquarios77/python
2021-03-11/rinkis.py
rinkis.py
py
2,047
python
en
code
0
github-code
1
5379349193
from tkinter import * from tkinter.font import Font root = Tk() root.title("Calculator GUI") root.iconbitmap('icon.ico') root.config(bg='#1F1F1F') root.geometry('322x390') root.resizable(False, False) myFont = Font(family="Bahnschrift SemiBold", size=14) enterFont = Font(family="Bahnschrift SemiBold", size=3...
melvinchia3636/Clean-Calculator-GUI
Calculator v2.pyw
Calculator v2.pyw
pyw
7,031
python
en
code
0
github-code
1
13918538896
from amaranth import * from amaranth.sim import Simulator from amaranth.build import * from amaranth.cli import main import numpy as np import unittest class CDR(Elaboratable): """ Data recovery Take 4x oversampled input and return the recovered data stream. Returns 0, 1 or 2 valid bits on each cycle ...
miek/scorzonera
gateware/cdr.py
cdr.py
py
10,291
python
en
code
5
github-code
1
1531425243
import copy import geopandas as gpd import numpy as np from nuscenes import NuScenes from nuscenes.can_bus.can_bus_api import NuScenesCanBus from nuscenes.eval.common.utils import quaternion_yaw from nuscenes.map_expansion.arcline_path_utils import discretize_lane from nuscenes.map_expansion.map_api import NuScenesMap...
metadriverse/metadrive
metadrive/utils/nuscenes/utils.py
utils.py
py
16,889
python
en
code
471
github-code
1
69808023073
from matplotlib import pyplot as plt import random #注意,matplotlib默认不支持中文,需要使用rc来设置一下 import matplotlib #方法一 font = {'family': 'SimHei', 'weight': 'bold', 'size': 14} matplotlib.rc('font',**font) #这里**的作用是把字典的每一个key:value变为key=value的形式依次传递进来 #方法二 # plt.rcParams["font.sans-serif"]=["...
kennycaiguo/kenny-learn-python-dataAnalysis
matplotlib-study/matplotlibdemo4.py
matplotlibdemo4.py
py
1,878
python
zh
code
0
github-code
1
11554341119
#!/usr/bin/env python3 ''' Author: Xingw Xiong Data: 2018/11/16 Description: KNN-Scipy ''' import numpy as np import pandas as pd from sklearn.neighbors import NearestNeighbors import time, logging logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)...
XingwXiong/NewsRS
src/knn/knn-doc2vec.py
knn-doc2vec.py
py
2,836
python
en
code
4
github-code
1
32017679353
"""Library Base Table""" from peewee import ForeignKeyField from database.scraper.tvshow.cast import ScraperTVShowCast from database.scraper.tvshow.episode import ScraperTVShowEpisode class ScraperTVShowGuestStars(ScraperTVShowCast): """Library Base TV Show Cast""" episode = ForeignKeyField(ScraperTVShowEpi...
GaryTheBrown/Tackem
database/scraper/tvshow/guest_stars.py
guest_stars.py
py
1,148
python
en
code
0
github-code
1
35563750428
import pandas as pd from sklearn.ensemble import RandomForestClassifier import pickle data = pd.read_csv('churn_data.csv') X = data[['item_status','on_time','feedback']] y = data['churn'] model = RandomForestClassifier(n_estimators=100, random_state=42) model.fit(X, y) with open('churn.pkl', 'wb') as model_file: ...
udithanayanajith/predeepMlAPI
churnTrain.py
churnTrain.py
py
353
python
en
code
0
github-code
1
35873103024
class Solution(object): def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ # Solution 1 - Time Limit Exceeded ''' for i, numi in enumerate(numbers): for j, numj in enumerate(numbers): ...
petermartens98/LeetCode-Algorithms-Roadmap
Python/TwoPointers/TwoSumInputArrayIsSorted.py
TwoSumInputArrayIsSorted.py
py
746
python
en
code
2
github-code
1
35470197682
#Input: command = "G()(al)" #Output: "Goal" #Explanation: The Goal Parser interprets the command as follows: #https://leetcode.com/problems/goal-parser-interpretation/ def func(s): output='' word='' for i in s: word=word+i if word =='G': output+='G' word='' if...
vshkodin/problem-solving-with-algorithms-and-data-structures-using-python
GoalParserInterpretation.py
GoalParserInterpretation.py
py
583
python
en
code
0
github-code
1
25265340971
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 7 11:23:08 2023 @author: jparedes """ import pandas as pd import pickle import numpy as np from urllib import request import shutil import os #%% year of measurements and url # dataset obtained from Ministry of Environment_National Air Quality Te...
japareds/SensorPlacement-HeterogeneousNetwork
Scripts/download_Taiwan_dataset.py
download_Taiwan_dataset.py
py
12,535
python
en
code
1
github-code
1
42426806603
import sys from collections import deque input = sys.stdin.readline n = int(input()) board = [[0 for _ in range(n+2)] for _ in range(n+2)] for x in range(n+2): for y in range(n+2): if x == 0 or x == n+1 or y == 0 or y == n+1 or (x == 1 and y == 1): board[x][y] = -1 for _ in range(int(input()))...
jhchoy00/baekjoon
3190.py
3190.py
py
1,248
python
en
code
0
github-code
1
33052651566
""" PyCSP3 Model (see pycsp.org) Data can come: - either directly from a JSON file - or from an intermediate parser Examples: python Rehearsal.py -data=rehearsalSmith.json python Rehearsal.py -data=rehearsalSmith.json -variant=bis """ from pycsp3 import * durations, playing = data nPieces, nPlayers = len(dura...
csplib/csplib
Problems/prob039/models/Rehearsal.py
Rehearsal.py
py
2,268
python
en
code
79
github-code
1
30603250626
import datetime import random import pandas as pd from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware dataframe = pd.read_csv("domande.csv") topics = list(dataframe["topic"].unique()) app = FastAPI() origins = [ # "http://localhost:3000", # "localhost:3000" '*' ] app.add_mid...
FedeAi/app-domande-backend
main.py
main.py
py
1,587
python
en
code
0
github-code
1
11631105468
from imap_tools import ( AND, NOT, MailBox, MailboxTaggedResponseError ) import datetime import logging import requests class MailBoxHandler: def __init__(self, host, user, passwd, folder, filter): self.host = host self.user = user self.passwd = passwd self.folder =...
titulebolide/email-to-discord-bot
email_to_discord/bot.py
bot.py
py
3,019
python
en
code
0
github-code
1
28892927025
#첫번째 풀이 (효율성 테스트 시간초과) def solution1(s): answer = 0 prev = "" i = 0 while i < len(s): temp = s[i : i + 1] if prev == temp: s = s[: i - 1] + s[i + 1 :] i -= 1 prev = s[i - 1 : i] else : # 앞뒤가 다를 때 prev = temp i += 1 ...
m0mt/Algorithm-practice
python/programmers/lv2/12973.py
12973.py
py
815
python
en
code
0
github-code
1
20260262410
def print_card(pp,score,name,pos,rank,isgrayed=False,mini=False): if not rank<=0: if isgrayed: tmp=70,70,100 tmpt=150,150,150 else: tmp=50,50,100 tmpt=forepallete #if not pos[0]+300>w: dim=25 cao=len(name)*20+45 if not m...
pxkidoescoding/Qlute
data/modules/card.py
card.py
py
1,217
python
en
code
0
github-code
1
20650371673
from flask import render_template, redirect, url_for,flash, abort from . import main from .forms import SubscriberForm, BlogPostForm, CommentForm from ..models import User, Subscribers, BlogPost, Comment from ..email import mail_message from .. import db from flask_login import login_required, current_user @main.route...
MichelAtieno/Personal-Blog
app/main/views.py
views.py
py
3,347
python
en
code
0
github-code
1
70577931874
import re class Composition: def __init__(self, item_name, item_price, quantity): self.item_name = item_name self.item_price = item_price self.quantity = quantity @property def item_name(self): return self.__item_name @property def item_price(self): return...
YaroslavaShytKPI/Python_KPI
LR-3.1/task2.py
task2.py
py
3,962
python
en
code
0
github-code
1
2887970807
from pprint import pprint as pp from collections import defaultdict import sys sys.setrecursionlimit(10 ** 7) readlines = sys.stdin.buffer.readlines map_readlines = lambda: map(int, readlines()) readline = sys.stdin.buffer.readline map_readline = lambda: map(int, readline().split()) sreadline = lambda: readline().decod...
Kumamoto-Hamachi/atcoder_pr
abc_contest/abc154/c/c.py
c.py
py
652
python
en
code
1
github-code
1
21064502552
import torch INFERENCE_SIZE = (244, 244) import sys def get_model_graph(model): OLD_RECURSION_LIMIT = sys.getrecursionlimit() sys.setrecursionlimit(1500) dummy_input = torch.randn(1, 3, INFERENCE_SIZE[0], INFERENCE_SIZE[1]) dummy_output = model(dummy_input) params = model.state_dict() param_ma...
aljo242/nn_benching
modelstats.py
modelstats.py
py
3,110
python
en
code
2
github-code
1
38788788733
import requests from time import sleep def get_river(river_num, year_start, year_end, discharge=False): # Download a river # Build the url print('Building the url for request.') url = ( "http://realtimedata.water.nsw.gov.au/cgi/webhyd.pl?co={river}" "&t=rscf_org&v=100.00_100.00_CP{dis...
andrew-houghton/river_predict
new_dataset_acquisition/15_min_dl.py
15_min_dl.py
py
3,042
python
en
code
0
github-code
1
40287562580
import simplegui # define global variables countTenthOfSec = 0 successStops = 0 totStops = 0 # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def format(t): #get the tenth of the second digit D = t % 10 #get the total seconds t = t / 10 #conver...
rehmanis/Coursera
Fundamentals of Computing Specialization/Interactive Programming in Python (Part 1)/Mini-Project3 Stopwatch The Game/stop_watch.py
stop_watch.py
py
1,830
python
en
code
1
github-code
1
71015850915
class Solution: def trap(self, height): if len(height) < 3: return 0 water = 0 level = height[0] last_index = 0 last_water = 0 for i in range(1, len(height)): if height[i] < level: water += level - height[i] else: ...
yskang/AlgorithmPractice
leetCode/trapping_rain_water.py
trapping_rain_water.py
py
777
python
en
code
1
github-code
1
19234977069
import os import pandas as pd import torch from kgformula.utils import simulation_object_rule_new import pickle import random import numpy as np import argparse parser = argparse.ArgumentParser() parser.add_argument('--idx', type=int, default=0, help='cdim') parser.add_argument('--ngpu', type=int, default=4, help='cdim...
MrHuff/kgformula
run_covid.py
run_covid.py
py
4,167
python
en
code
0
github-code
1
7505401532
from django.shortcuts import render, get_object_or_404, redirect, Http404 from django.http import HttpResponse from django.views.generic import TemplateView, View from django.contrib.auth.decorators import login_required from django.contrib.auth.views import LoginView, LogoutView from django.contrib.auth import login, ...
kutipense/restaurant_automation_system
onlinerestaurant/views.py
views.py
py
8,676
python
en
code
0
github-code
1
5927778407
#! /usr/bin/env python # -*- coding: utf-8 -*- # # data reference : R. A. Fisher (1936). "The use of multiple measurements # in taxonomic problems" from distance_builder import * from distance import * if __name__ == '__main__': builder = DistanceBuilder() builder.load_points(r'../data/data_iris_flower/iris....
jasonwbw/DensityPeakCluster
distance/distance_builder_data_iris_flower.py
distance_builder_data_iris_flower.py
py
444
python
en
code
290
github-code
1
5274000630
from vector import Vector def setcolor(colorrange): #darkblues db1 = color(40, 70, 140) db2 = color(52, 86, 163) db3 = color(70, 130, 180) db4 = color(65, 105, 225) db = [db1, db2, db3, db4] #lightblues lb1 = color(94, 184, 219) lb2 = color(93, 153, 187) lb3 = color(72, 92, 151...
rosieswj/StarryNight
vfield.py
vfield.py
py
2,137
python
en
code
1
github-code
1
14060468681
import unittest __LICENSE__ = """ Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
FunkySayu/discord-event-manager
api/mod_wow/realm_test.py
realm_test.py
py
2,735
python
en
code
4
github-code
1
41636256032
from zeep import Client import xml def loadFile(file_name): return open(file_name,"r").read() client = Client('https://svn.apache.org/repos/asf/airavata/sandbox/xbaya-web/test/Calculator.wsdl') prt = client.wsdl.services.get('Calculator').ports print(prt) print(dir(prt)) #print(prt.Add(1,2)) file = ...
qxZap/College
L3/ILN/ceeasta.py
ceeasta.py
py
746
python
en
code
0
github-code
1
39600864672
import re import glob import pandas as pd import nltk from nltk.tokenize import WordPunctTokenizer from nltk.stem import WordNetLemmatizer all_files = glob.glob(r"other_textos\*") i= 0 subject_ = [] owner_ = [] winner_ = [] price_ = [] compititors_ = [] price_comp = [] for file in all_files: i += 1...
AnasAar/big_data_analysis
data_extraction.py
data_extraction.py
py
3,722
python
en
code
0
github-code
1
18163028124
from itertools import combinations from math import prod def factors(x, limit=-1): if limit == -1: limit = x return [i for i in range(1, limit + 1) if not x % i] def calc_hatoslotto(digits_sum, digits_product): digits = factors(digits_product, limit=45) for combination in combinations(range(len(digits)), 6): ...
navima/szkript
10h/feladat3.py
feladat3.py
py
1,124
python
en
code
0
github-code
1
43439863372
import tests_suite import unittest from cpu import CPU from rom import ROM class tests_jpc(unittest.TestCase): def test_jp_c_jumps_if_CFlag_is_set(self): rom = b'\x00' * 0x480+b'\x38\x00' cpu = CPU(ROM(rom)) cpu.PC = 0x480 cpu.CFlag = True cpu.readOp() self.assert...
pawlos/Timex.Emu
tests/tests_jpc.py
tests_jpc.py
py
1,297
python
en
code
5
github-code
1
70431605795
import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') def L2norm(X1, X2): #Function to calculate L2 Norm distance = 0 for i in range(len(X1)): distance += (X1[i] - X2[i])**2 distance = distance**0.5 return distance def centroid(X): #Function to calculate...
divyanshugit/representation_learning
models/classificaton/kNN.py
kNN.py
py
2,733
python
en
code
2
github-code
1
36544578130
# 力扣第106题,从中序与后序遍历序列构造二叉树 """ 根据一棵树的中序遍历和后续遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 """ class TreeNode: def __init__(self, x) -> None: self.val = x self.left = None self.right = None class Solution: def buildTree(self, inorder, postorder) -> TreeNode: if not inorder: return [...
buxucixingztx/cpp_learning
leetcode/leetcode_p106/code_106.py
code_106.py
py
1,813
python
en
code
0
github-code
1
44622543396
from flask import jsonify from model.reservation import ReservationDAO from model.members import MembersDAO from model.user_schedule import UserScheduleDAO from model.room_schedule import RoomScheduleDAO from model.time_slot import TimeSlotDAO from controller.time_slot import BaseTimeSlot from model.reservation_schedul...
bermed28/Booking-System
backend/controller/reservation.py
reservation.py
py
14,154
python
en
code
5
github-code
1
35923836420
import sip sip.setapi('QString', 2) from PyQt4 import QtCore , QtGui _toUtf8 = lambda s: s.decode('utf8') _fromUtf8 = lambda s : s.encode('utf8') fromUtf8 = _fromUtf8 toUtf8 = _toUtf8 stdIcon = QtGui.QIcon.fromTheme
xiaomailong/szarp
pyipk/qtipk/utils.py
utils.py
py
221
python
en
code
null
github-code
1
73207289314
def lcs(seq_1: str, seq_2: str) -> int: table = [[0] * (len(seq_1)+1) for _ in range(len(seq_2)+1)] seq_1_padded, seq_2_padded = f' {seq_1}', f' {seq_2}' for s1_idx in range(1, len(seq_1)+1): for s2_idx in range(1, len(seq_2)+1): # print(f's1_idx: {s1_idx}, s2_idx: {s2_idx}, table:') ...
etture/algorithms_practice
leetcode/google_prep/dynamic_programming/longest_common_subsequence.py
longest_common_subsequence.py
py
889
python
en
code
0
github-code
1
19978807
# -*- coding: utf-8 -*- """ test_skeeter_notifier.py This is a Python script to test the skeeter program. It will call pg_notify in the database so the subscriber can report """ import logging import random import signal import sys from threading import Event import psycopg2 from test.config import load_config _lo...
SpiderOak/skeeter
test/test_skeeter_notifyer.py
test_skeeter_notifyer.py
py
2,347
python
en
code
33
github-code
1
8761897844
from Device import Device from datetime import datetime import Adafruit_DHT #library for the the DHT sensor. class DHT(Device): dhtsensors = { '11': Adafruit_DHT.DHT11, '22': Adafruit_DHT.DHT22, '2302': Adafruit_DHT.AM2302 } dhtsensortype = None temperature = None ...
flipsee/rpicenter
sandbox/internal_recipe/DHT.py
DHT.py
py
1,137
python
en
code
0
github-code
1
30842214004
#__iter__() and iter() """ Iterator objet is a special object that represents a stream of data that we can operate on. To acomplish this, it uses a built in function called iter() """ #iterable dog_foods = { "Great Dane Foods": 4, "Min Pin Pup Foods": 10, "Pawsome Pups Foods": 8 } #iteration for food_brand...
yshim1/pythonprac
intermediate/iterables_iterators.py
iterables_iterators.py
py
8,844
python
en
code
0
github-code
1
70647012833
#!/usr/bin/python3 # -*- coding: utf-8 -*- # script runCosmo.py ''' **runCosmo** run Data Aquisition with Picoscpe (modified version of runDAQ from picoDAQ project) Relies on python drivers by Colin O'Flynn and Mark Harfouche, see https://github.com/colinoflynn/pico-python and on package *picodaqa*, se...
GuenterQuast/picoCosmo_dev
runCosmo.py
runCosmo.py
py
6,287
python
en
code
0
github-code
1
40034683838
from flask import Flask, jsonify, render_template, redirect, make_response, json, request import os from joblib import load import subprocess # Tools to remove stopwords from tweets import nltk from nltk.corpus import stopwords nltk.download('stopwords') from nltk.tokenize import word_tokenize nltk.download('punkt') f...
michaelpkuhn/mediabias
app/app.py
app.py
py
5,474
python
en
code
2
github-code
1
4953358013
DEPS = [ 'chromium', 'chromium_tests', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/step', 'test_utils', ] def RunSteps(api): api.chromium.set_config('chromium') test = api.chromium_tests.steps.ScriptTest( 'sc...
mithro/chromium-build
scripts/slave/recipe_modules/chromium_tests/tests/steps/script_test.py
script_test.py
py
955
python
en
code
0
github-code
1
11558833419
from matplotlib import pyplot as plt from matplotlib import font_manager # 选用一个图表通用字体存为my_font,为显示中文 my_font = font_manager.FontProperties(fname="字体文件所在目录") # 数据 x = range(11) y = [1, 5, 6, 2, 11, 8, 9, 23, 5, 6, 8] # 绘制折线图 plt.plot(x, y, label="图例名", color="折线颜色") # 设置图形大小 plt.figure(figsize=(20,8),dpi=80) # 设置坐标 ...
xiang59915/Fresh
matplotlib绘图基础.py
matplotlib绘图基础.py
py
592
python
zh
code
0
github-code
1
38066112165
class Solution: def countSubstrings(self, s: str) -> int: cache = [[0]*len(s) for _ in range(len(s))] count = len(s) ## Base case for i in range(len(s)): cache[i][i] = 1 for dist in range(1, len(s)): for start in rang...
HongyuHe/leetcode-new-round
dp/647_bottomup_dp.py
647_bottomup_dp.py
py
570
python
en
code
6
github-code
1
35636025251
import os import sys dir=os.getcwd() dir_list=dir.split("/") loc=[i for i in range(0, len(dir_list)) if dir_list[i]=="General_electrochemistry"] source_list=dir_list[:loc[0]+1] + ["src"] source_loc=("/").join(source_list) sys.path.append(source_loc) from pints import plot from harmonics_plotter import harmonics import ...
HOLL95/General_electrochemistry
Theory/Numerics/sf_MCMC.py
sf_MCMC.py
py
9,043
python
en
code
2
github-code
1
13390723416
from __future__ import with_statement import sys import argparse from subprocess import Popen, PIPE def parse_arguments(): parser = argparse.ArgumentParser(description="Create a Spark Cluster on " "Docker Host.", epilog="Example Usage: " ...
ezhaar/spark-docker-deploy
spark_deploy.py
spark_deploy.py
py
4,833
python
en
code
1
github-code
1
25672862522
# coding:utf-8 """ create by wayne on Dec.16 2016 """ import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) dial = QDial() dial.setNotchesVisible(True) spinbox = QSpinBox() layout=QHBoxLayout() layout.addWi...
52ai/load2python
PythonGUI学习/PyQt4/HelloGUI/signals_and_slots.py
signals_and_slots.py
py
1,204
python
en
code
8
github-code
1
40056348918
import math import csv file = open("data.csv",newline="") reader = csv.reader(file) data = list(reader) newData = data[0] def mean(data): n = len(data) total = 0 for x in data : total += int(x) mean = total/n return mean sqauredList = [] for number in newData: a = int(...
vevanonarain/Standar-Dev.
Standard dev/standard_dev.py
standard_dev.py
py
509
python
en
code
0
github-code
1
39381247788
import requests import json from fastapi import FastAPI, Response, APIRouter from fastapi_versioning import VersionedFastAPI, version from pydantic import BaseModel app = FastAPI() router = APIRouter() all_routes =[] def get_routes(): reserved_routes = ["/openapi.json", "/docs", "/docs/oauth2-red...
dhiraj-v/CineStream
movie_rent_management/rent_movie.py
rent_movie.py
py
2,798
python
en
code
0
github-code
1
9436934432
file_name = str(input("Enter the file name: ")) file_name += ".sublime-snippet" cdata = "" isFile = (input("DO you want to snippet from a file:(Y/N) ")) if isFile == 'Y' or isFile == 'y': s_fileName = str(input("Enter the file name with it's extension: ")) _a = open(s_fileName, "r") if _a.mode == 'r': ...
pvcodes-zz/sublime-snippet-file-maker
main.py
main.py
py
1,046
python
en
code
2
github-code
1
24442276296
#403. Frog Jump #a from can jump 1/2 step forword or backword list1=[0,1,2,4,6,8,9,11,12,13] lst=0 flag=False for i in range(len(list1)-1): print(list1[i],list1[i+1]) if abs(list1[i+1]-list1[i])>2: flag=False break else: flag=True if flag: print("the frog can reach the end")...
karthik-28github/test
_19_1_22/leetcode/_403. Frog Jump.py
_403. Frog Jump.py
py
369
python
en
code
0
github-code
1
74132449952
# Manage status of system: # APP_AVAILABLE: True with system is not available. Normally, just means db is being updated, but # could be something more drastic. import os from datetime import datetime, timedelta from time import time import redis redis_url = os.environ.get("REDIS_URL") if redis_url is None: redi...
cvickery/transfer_app
system_status.py
system_status.py
py
4,072
python
en
code
1
github-code
1