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
37708551559
import hashlib as hasher import datetime as date class Block: def __init__(self, index, timestamp, data, previous_hash): self.index = index self.timestamp = timestamp self.data = data self.previous_hash = previous_hash self.hash = self.hash_block() def hash_block(self)...
FollowJack/Blockchain
__old__/models.py
models.py
py
757
python
en
code
0
github-code
90
70991569576
import numpy as np import cv2 from os import listdir from os.path import isfile, join from tqdm import tqdm paths = {"train": "data/train", "val": "data/val"} def process(path): img = cv2.imread(path) if img is not None: # Create new tuple with new width and height newDim = (150, 150) ...
gabr444/xray
data.py
data.py
py
1,736
python
en
code
0
github-code
90
39294672394
from dagster import * # When partiton X of `a_first` is materialized, it will trigger the # materialization of X for `a_second` and `a_third` # # When multiple partitions of `a_first` are materialized by triggering a # backfill, only the latest partition will automatically be materialized for # `a_second` and `a_thi...
meyer1994/minidagster
minidagster/linear_with_partitions.py
linear_with_partitions.py
py
1,279
python
en
code
0
github-code
90
18531299536
from aiogram import types from tgbot.data.strings import user_info from tgbot.service.repo.repository import SQLAlchemyRepos from tgbot.service.repo.user_repo import UserRepo async def my_cabinet(message: types.Message, repo: SQLAlchemyRepos): user = repo.get_repo(UserRepo) u = await user.get_user(user_id=me...
uicodee/contestmaker
tgbot/handlers/buttons/cabinet.py
cabinet.py
py
612
python
en
code
1
github-code
90
18444705749
n, m = list(map(int, input().split(' '))) l = list(map(int, input().split(' '))) d = {} # key=match, val=num d[2] = [1] d[3] = [7] d[4] = [4] d[5] = [5, 3, 2] d[6] = [9, 6] d[7] = [8] enable = [False] * 10 for a in l: enable[a] = True # マッチをk(=2..7)本使う場合の一番大きい値を総当たり def f(nokori, current): if nokori == 0: retu...
Aasthaengg/IBMdataset
Python_codes/p03128/s476249797.py
s476249797.py
py
1,236
python
en
code
0
github-code
90
40581294096
""" 516. Longest Palindromic Subsequence Given a string s, find the longest palindromic subsequence's length in s. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. Example 1: Input: s = "bbbab" Output: 4 Ex...
venkatsvpr/Problems_Solved
LC_Longest_Palindromic_Subsequence.py
LC_Longest_Palindromic_Subsequence.py
py
1,617
python
en
code
3
github-code
90
32664505661
import torch import torch.nn.parallel import numpy as np import torch.nn as nn import torch.nn.functional as F class AntiAliasDownsampleLayer(nn.Module): def __init__(self, remove_model_jit: bool = False, filt_size: int = 3, stride: int = 2, channels: int = 0): super(AntiAliasDownsampleLa...
Alibaba-MIIL/ImageNet21K
src_files/models/tresnet/layers/anti_aliasing.py
anti_aliasing.py
py
2,035
python
en
code
665
github-code
90
19128525267
import RPi.GPIO as GPIO import time class HR8825: def __init__(self, dir_pin, step_pin, enable_pin, mode_pins): self.dir_pin = dir_pin self.step_pin = step_pin self.enable_pin = enable_pin self.mode_pins = mode_pins GPIO.setup(self.dir_pin, GPIO.OUT) GPIO.setup(self...
RM220507/XYZ-Gantry
code/gantrycontrol/HR8825.py
HR8825.py
py
1,734
python
en
code
0
github-code
90
19012317271
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 22 15:12:11 2022 @author: lidor """ import numpy as np from ccg import * import create_feat_tsc as tsc import sort_shank as MC from loading_data import * from noise_classifier import get_preds def getX(item): x = X1[:,item].float().unsqueeze(0)...
ayalab1/neurocode
spikeSorting/AutomatedCuration/Automated-curation/runig_AI_pipeline.py
runig_AI_pipeline.py
py
1,721
python
en
code
8
github-code
90
18048772719
S = input() c, f = -1, -1 for i, s in enumerate(S): if s == 'C': c = i break for i, s in enumerate(S[::-1]): if s == 'F': f = len(S)-i-1 break if c >= 0 and f >= 0 and c < f: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p03957/s980800459.py
s980800459.py
py
253
python
en
code
0
github-code
90
28528958761
from AgentState import AgentState from AgentAction import AgentAction def test_agent_moves_when_action_happens(): # Arrange state = AgentState(0, 0) sut = AgentAction("RIGHT") # Act new_state = sut.result(state) # Assert assert new_state.x == 1
guillermoSb/ia_lab01
tests/test_action.py
test_action.py
py
276
python
en
code
0
github-code
90
14825138435
from enum import Enum from typing import List from schemas.common import AVAILABLE_SCHEMAS from schemas.signature import Ed25519Signature from typedefs.datatype import UInt16, UInt8 from typedefs.field import ComplexField, Field, Schema, SimpleField from schemas.address import MAX_MULTI_ADDRESSES, MIN_MULTI_ADDRESSES ...
iotaledger/tip-tools
schema-tool/schemas/unlock.py
unlock.py
py
5,338
python
en
code
0
github-code
90
41873825494
#!/usr/bin/env python # coding: utf-8 # ## Histogram plot # # When visualising one dimensional data without relating it to other information an option would be histograms. # Histograms are used when describing distributions in your data, it is not the values itself you are visualising, rather the counts/frequencies o...
LorenzF/data-science-practical-approach
src/_build/jupyter_execute/c4_data_visualisation/histogram.py
histogram.py
py
2,344
python
en
code
0
github-code
90
4128477251
import sys import logging import warnings from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from datetime import timedelta from itertools import groupby from collections import OrderedDict import numpy as np import pandas as pd import scipy.signal from .iaga2hdf import read_hdf, write_hdf from .filte...
butala/pyrsss
pyrsss/mag/process_hdf.py
process_hdf.py
py
9,491
python
en
code
6
github-code
90
31398021308
from django.urls import path, include from . import views urlpatterns = [ path('', views.index, name='index'), path('reports/', views.report_index, name='report_index'), path('reports/pptp/', views.report_index_pptp, name='report_index_pptp'), path('reports/pptp/<int:fromd...
wirrja/squidward
squidward/urls.py
urls.py
py
849
python
en
code
0
github-code
90
73211777898
# # @lc app=leetcode id=84 lang=python # # [84] Largest Rectangle in Histogram # # @lc code=start class Solution(object): def largestRectangleArea(self, heights): """ :type heights: List[int] :rtype: int """ # O(n) Stack Solution # Stores (index, height) stac...
ashshekhar/leetcode-problems-solutions
84.largest-rectangle-in-histogram.py
84.largest-rectangle-in-histogram.py
py
1,967
python
en
code
0
github-code
90
5345548844
from logging import makeLogRecord import pytest from cryptologging.algorithms.hash import MD5HashEncryptor from cryptologging.formatter import CryptoFormatter # @pytest.mark.parametrize( # ('value', 'value_hash', 'result'), # [ # pytest.param( # 'string', # 'b45cffe084dd3d20d...
NotFunnyMan/cryptologging
tests/formatters/test_hash.py
test_hash.py
py
4,313
python
en
code
0
github-code
90
8998297156
# Problem #6: Sum square difference # https://projecteuler.net/problem=6 # # The sum of the squares of the first ten natural numbers is: # # (1^2 + 2^2 + ... + 10^2) = 385 # # The square of the sum of the first ten natural numbers is: # # (1 + 2 + ... + 10)^2 = 55^2 = 3025 # # Hence the difference between the sum o...
ravyne/projecteuler
python/src/p0006.py
p0006.py
py
2,167
python
en
code
0
github-code
90
18494997989
N,x=input().split() X=int(x) n=int(N) y=0 A = [int(i) for i in input().split()] A.sort() for z in range(n): y+=A[z] if y>=X: if y==X: print(z+1) else: print(z) break else: print(n-1)
Aasthaengg/IBMdataset
Python_codes/p03254/s772039889.py
s772039889.py
py
212
python
en
code
0
github-code
90
1438695218
import csv dicts = { 'A':1, 'B':2, 'C':3, 'D':4, 'E':5, 'F':6, 'G':7, 'H':8, 'I':9, 'J':10, 'K':11, 'L':12, 'M':13, 'N':14, 'O':15, 'P':16, 'Q':17, 'R':18, 'S':19, ...
okadaakihito/ProjectEuler
Problem_42.py
Problem_42.py
py
1,343
python
en
code
0
github-code
90
5359553136
import os import sys import glob import json import scipy.signal as signal import numpy.ma as ma import numpy as np import matplotlib import matplotlib.pylab as plt import matplotlib.dates as mdates import datetime import statsmodels.api as sm lowess = sm.nonparametric.lowess def savitzky_golay(y, window_size, order,...
openearth/eo-reservoir
time_series_scripts/tasks_generate_thumbs.py
tasks_generate_thumbs.py
py
7,073
python
en
code
0
github-code
90
14276157930
def heart_rate_calculation(): RestingHR = int (input('RestingHR:')) Age = int (input('Age:')) print("Intensity| Rate") print("---------|------") for i in range(55,100,5): TargetHeartRate = ((220 - Age) - RestingHR) * i / 100 + RestingHR print('{}% |{}bpm'.format(i,i...
Skkii1003/2019-SE1
homework03/201-karvonenheartratecalculation/src/heart_rate_cal.py
heart_rate_cal.py
py
341
python
en
code
0
github-code
90
72571934697
import logging from logging.handlers import SMTPHandler, RotatingFileHandler import os from flask import Flask, request, current_app from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_login import LoginManager from flask_mail import Mail from flask_bootstrap import Bootstrap from confi...
eileenjwang/protocols
container/app/__init__.py
__init__.py
py
3,902
python
en
code
1
github-code
90
18183178569
def trans(l): return [list(x) for x in list(zip(*l))] from itertools import product import copy h, w, k = map(int, input().split()) c = [] for _ in range(h): c.append([c for c in input()]) A = [i for i in product([1,0], repeat=h)] B = [i for i in product([1,0], repeat=w)] ans = 0 for a in A: temp1 = cop...
Aasthaengg/IBMdataset
Python_codes/p02614/s418370444.py
s418370444.py
py
686
python
en
code
0
github-code
90
30932963348
from typing import Any, Dict, List, Type, TypeVar, Union import attr from ..types import UNSET, Unset T = TypeVar("T", bound="CPF") @attr.s(auto_attribs=True) class CPF: """ Attributes: ni (Union[Unset, str]): Número de Inscrição do contribuinte Example: 99999999999. nome (Union[Unset, str]...
paulo-raca/python-serpro
serpro/consulta_cpf/models/cpf.py
cpf.py
py
2,603
python
pt
code
0
github-code
90
74763835176
import timeit import matplotlib.pyplot as plt import numpy as np import pandas as pd from keras.layers.core import Dense, Activation, Dropout from keras.layers.recurrent import LSTM from keras.layers import BatchNormalization from keras.models import Sequential from keras.utils import plot_model from sklearn import pre...
lux-coder/lstm-on-forex
lstm.py
lstm.py
py
5,321
python
en
code
1
github-code
90
12334938187
import RPi.GPIO as GPIO import time import sys GPIO.setmode(GPIO.BCM) class Button: but = [0]*8 but[0] = 21 but[1] = 20 but[2] = 16 but[3] = 12 but[4] = 7 but[5] = 24 but[6] = 23 but[7] = 18 for i in range(8): GPIO.setup(but[i], GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button...
parvindar/E-Rickshaw
proStand/modules/button/Button.py
Button.py
py
570
python
en
code
0
github-code
90
7711506066
from django.test import TestCase from .models import Product # Create your tests here. class TestProductViews(TestCase): def test_all_products_view(self): page = self.client.get('/products/') self.assertEqual(page.status_code, 200) self.assertTemplateUsed(page, 'allproducts.html') de...
Sarani1612/truebrew
products/test_views.py
test_views.py
py
755
python
en
code
0
github-code
90
19048193714
import math import pygame import sys import random import socket import threading from ball import Ball from player import Player class Game: def __init__(self): self.screen = pygame.display.set_mode((900,500)) pygame.display.set_caption("Ultimate Pong: 2P") self.run = True self.cl...
YaelDonat/pythpong3
client.py
client.py
py
4,048
python
en
code
0
github-code
90
833286354
from os.path import dirname, join import pytest import mosaik_csv DATA_FILE = join(dirname(__file__), 'data', 'test.csv') def test_init_create(): sim = mosaik_csv.CSV() meta = sim.init('sid', 1., sim_start='2014-01-01 00:00:00', datafile=DATA_FILE) assert meta['models...
RhysM95/SIT723-RESEARCH-PROJECT
mosaik-csv/tests/test_mosaik.py
test_mosaik.py
py
2,605
python
en
code
0
github-code
90
38625319623
#------------------------------------------------------------------------------- # Name: NCSS_LabDatabase_Geoprocessing_Service.py # Purpose: # # Author: Adolfo.Diaz # e-mail: adolfo.diaz@usda.gov # phone: 608.662.4422 ext. 216 # # Author: Jerry.Monhaupt # e-mail: jerry.monhaput@usda.gov # # Created: 9/16/2021 #--...
ncss-tech/NCSS-Pedons
NCSS_LabDatabase_Geoprocessing_Service.py
NCSS_LabDatabase_Geoprocessing_Service.py
py
15,261
python
en
code
2
github-code
90
12397596430
import os import utilities.api_clients.api_call as ApiCallUtil class GoalifyClient: apiUrl = "https://g2.goalifyapp.com/api/1.0.1" headers = {} apiClient = None def __init__(self): self.headers['Authorization'] = "Bearer " + os.getenv("GOALIFY_ACCESS_TOKEN") self.apiClient = ApiCallU...
YansenChristian/automation
utilities/api_clients/goalify_client.py
goalify_client.py
py
1,269
python
en
code
0
github-code
90
33419593962
import torch BATCH_SIZE = 4 # 一个batch的样本数,需根据GPU内存大小更改此值 RESIZE_TO = 512 # 缩放训练图片到此大小 NUM_EPOCHS = 100 # 训练多少epochs DEVICE = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') #DEVICE = torch.device('cpu') # training data directory TRAIN_DIR = '../Microcontroller Detection/train' # validat...
yolyyin/fasterrcnn_study
fine_tune_sample/src/config.py
config.py
py
803
python
en
code
0
github-code
90
30494700545
VERBOSE_LOGGING = False import random import os def logv(string): if VERBOSE_LOGGING: print(string) def log(string): print(string) def fileadd(path,string): try: file = open(path,"a") file.write(string) x = True except: x = False finally: file.close() return x def fileoverwrite(path,lines): tr...
swipswaps/surselva
serverutil.py
serverutil.py
py
2,749
python
en
code
null
github-code
90
70379116458
class constants: """Class of constants for each component of detector """ class bgsub: """Background subtraction/segmentation mod [str] the segmentation model (MOG2, KNN, GMG) """ mod = 'MOG2' class HSV: """HSV inRange filtering maximum values and init...
julzerinos/python-opencv-leaf-detection
constants.py
constants.py
py
2,173
python
en
code
19
github-code
90
8965775127
# -*- coding: utf-8 -* import threading class Account: def __init__(self): self.balance = 0 def add(self, lock): # 获得锁 print("获得锁add") lock.acquire() for i in range(0, 100000): self.balance += 1 # 释放锁 print("add balance %s" % self.balance)...
hug123456/python_train
Train/test_进程_线程_协程/线程01.py
线程01.py
py
1,252
python
en
code
0
github-code
90
8197769295
from werkzeug.datastructures import FileStorage from flask_restplus.reqparse import RequestParser def setup_parser(parser: RequestParser) -> RequestParser: """ Setup request arguments parser. :param parser: app arguments parser :return: customized parser """ parser.add_argument('file', locati...
viconstel/hse_test_task
bin/parser.py
parser.py
py
1,455
python
en
code
0
github-code
90
37930780453
''' utility for parsing fund_code.xml Get FundClear Fund code and Fund name ''' from lxml import etree import logging, pickle from fundclear.models import dFundCodeModel FUND_CODE_FILE = 'fundclear/fund_code.xml' def get_name_with_fundcode_list(p_code,p_fundcode_list=None): t_fundcode_list = p_fu...
slee124565/philcop
fundclear/fcreader.py
fcreader.py
py
5,175
python
en
code
1
github-code
90
18483312629
#!/usr/bin/python3 # -*- coding:utf-8 -*- from copy import deepcopy def main(): n = int(input()) la = sorted([int(input()) for _ in range(n)]) lo = deepcopy(la) ind = 0 def f(la, ind): lx = [] while len(la) > 0: lx.append(la.pop(ind)) ind = -1 if ind == 0 else 0 ls = ([abs(lx[i]...
Aasthaengg/IBMdataset
Python_codes/p03229/s271242172.py
s271242172.py
py
478
python
en
code
0
github-code
90
19143107755
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2020/1/16 11:49 @Author : duanpy001 @File : 6.py @Link : https://leetcode-cn.com/problems/zigzag-conversion/ """ class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s ...
sevenzero/daily-study
LeetCode/6.py
6.py
py
2,431
python
en
code
0
github-code
90
70904593257
import math from collections import deque progresses = [95, 95, 95, 95] speeds = [4, 3, 2, 1] def solution(progresses, speeds): queue = deque([math.ceil((100 - progress) / speed) for speed, progress in zip(speeds, progresses)]) result = [1] now_data = queue.popleft() while queue: if now_data >...
dohun31/algorithm
2021/week_02/210716/기능개발.py
기능개발.py
py
524
python
en
code
1
github-code
90
21554816340
import time from shutil import copyfile import pandas as pd import tracemalloc import numpy as np import pickle import os from stable_baselines3.common.monitor import Monitor class SB_Experiment(object): def __init__(self, env, model, dict): ''' A simple class to run a MDP Experiment with a stabl...
maxsolberg/ORSuite
or_suite/experiment/sb_experiment.py
sb_experiment.py
py
4,202
python
en
code
0
github-code
90
9879713317
#!/usr/bin/env python from __future__ import annotations import os.path from unittest import mock import pytest from gcsfs import GCSFileSystem from cdp_backend.file_store import functions ############################################################################### FILENAME = "file.txt" BUCKET = "bucket" FILEP...
CouncilDataProject/cdp-backend
cdp_backend/tests/file_store/test_functions.py
test_functions.py
py
4,430
python
en
code
19
github-code
90
39013215004
import os from utils.enums import DeployStrategy DEBUG = False INSTANCE_NAME = '' # Server primary configuration SERVER_CONFIG = { # Port of service "PORT": 7722, # Mongo Section "MONGO_HOST": "192.168.100.1", "MONGO_PORT": 27017, "MONGO_USER": "superuser", "MONGO_PWD": "******", #...
11dimension/niner
config/example.py
example.py
py
5,131
python
en
code
2
github-code
90
27552970347
#-*- coding: utf-8 -*- import os import sys import time import ConfigParser from Tkinter import * class TkinterMessage(): def __init__(self): self._get_config() self.phrase_window = Tk() self.frame = Frame(self.phrase_window) self.phrase_label = Label(self.frame) def _get_confi...
MasterSergius/Frazer
src/show_tkinter_message.py
show_tkinter_message.py
py
2,856
python
en
code
0
github-code
90
7780873245
# -*- coding: utf-8 -*- if __name__ == "__main__": N = int(input()) tag_dict = {} for i in range(N): No = int(input()) M, S = list(map(int, input().split())) tags = input().split() for tag in tags: if tag in tag_dict: tag_dict[tag] +...
taketakeyyy/yukicoder
q628/main.py
main.py
py
756
python
en
code
0
github-code
90
18485044989
import math import sys n, m = map(int, input().split()) s = list(input()) t = list(input()) a = (n*m)//math.gcd(n, m) b0 = [i*(a//n)+1 for i in range(n)] b1 = [i*(a//m)+1 for i in range(m)] b2 = set(b0) b3 = set(b1) for j, i in enumerate(b0): if i in b3: if s[j] != t[b1.index(i)]: print(-1) ...
Aasthaengg/IBMdataset
Python_codes/p03231/s407382103.py
s407382103.py
py
485
python
en
code
0
github-code
90
40189807482
#!/usr/bin/env python # coding: utf-8 import numpy as np from sklearn.model_selection import train_test_split import Preprocessing from keras.models import Sequential from keras.layers import Dense def neuralNetwork(datadict, nbneurons, epochs) : """ Author: Karel Kedemos\n Train and execute a neural netwo...
imomayiz/Binary-classification-using-Python
neuralNetwork.py
neuralNetwork.py
py
3,335
python
en
code
0
github-code
90
30754654073
def merge(li, low, mid, high): """ 归并两个列表,从小到大排列 """ i = low j = mid + 1 ltmp = [] while i <= mid and j <= high: #只要左右两边都有数 if li[i] < li[j]: ltmp.append(li[i]) i += 1 else: ltmp.append(li[j]) j += 1 #while执行完毕,有一组没数,一组还有数 while i <= mid: ltmp.append(li[i]) i += 1 whil...
BruceStallone/Python_algorithm
merge_sort.py
merge_sort.py
py
771
python
en
code
0
github-code
90
5563508860
from __future__ import annotations from threading import Thread from builder import Pizzaiolo, PizzaBuilder from pizza import Flour, Product def _test_pizzaiolo(builder): pizzaiolo = Pizzaiolo(builder) print(pizzaiolo.builder) if __name__ == "__main__": pizza_builder = PizzaBuilder() pizza_builder...
kristyko/SoftwareDesignPatterns
Builder + Singleton/main.py
main.py
py
1,150
python
en
code
0
github-code
90
31942168027
from dgl.nn.pytorch import GINConv import torch.nn as nn import torch from models.utils import get_mask class GTShapelet(nn.Module): def __init__(self, k, embed_dim=128, num_heads=4): super(GTShapelet, self).__init__() self.embed_dim = embed_dim self.num_nodes = 1 << 2 * k self.emb...
zhouxuxian/gShapeLnoc
models/GTShapelet.py
GTShapelet.py
py
2,190
python
en
code
0
github-code
90
74099221418
""" Given a start word, an end word, and a dictionary of valid words, find the shortest transformation sequence from start to end such that only one letter is changed at each step of the sequence, and each transformed word exists in the dictionary. If there is no possible transformation, return null. Each word in t...
danny-hunt/Problems
doublets/doublets.py
doublets.py
py
2,383
python
en
code
2
github-code
90
32408428421
#!/usr/bin/env python3 # -*- coding: utf-8 -* """ Description : Author : Cirun Zhang Contact : cirun.zhang@envision-digital.com Time : 2020/7/8 Software : PyCharm """ from PyQt5.QtWidgets import * from src.item_window import ItemWindow class Window(QMainWindow): item_list = [] def __init...
zhangcirun/labelMe
tests/test.py
test.py
py
1,812
python
en
code
0
github-code
90
34093745625
num = 4 count = 0 for i in range(1, num+1): x = 0 p = str(i) for j in range(len(p)): x += int(p[j]) if x % 2 == 0: count += 1 print(count)
Hotheadthing/leetcode.py
Count integers with even digit sum.py
Count integers with even digit sum.py
py
173
python
en
code
2
github-code
90
18101865249
import collections N = int(input()) M = [] for i in range(N): a = list(map(int,input().strip().split())) b = [int(i+1 in a[2:]) for i in range(N)] M.append(b) D = [-1 for _ in range(N)] D[0] = 0 # 始点への距離は 0, 他の距離は-1 Q = collections.deque() Q.append(0) # 始点 while len(Q) > 0: #print("bfs", Q) # 各ステップでの ...
Aasthaengg/IBMdataset
Python_codes/p02239/s584859976.py
s584859976.py
py
669
python
ja
code
0
github-code
90
6101347535
# coding=utf-8 import os import csv import codecs import shutil import tkinter as tk from tkinter import ttk from prodtools.db import ws_journals from prodtools.config import config from prodtools import BIN_MARKUP_PATH from prodtools import ICON from prodtools import _ ROW_MSG = 9 ROW_SELECT_A_COL...
scieloorg/PC-Programs
src/scielo/bin/xml/prodtools/download_markup_journals.py
download_markup_journals.py
py
7,270
python
en
code
7
github-code
90
29462905313
import shutil import os import time from tkinter import * import tkinter as tk from tkinter import messagebox import programgui import main Seconds_In_Day = 24 * 60 * 60 now = time.time() before = now - Seconds_In_Day def last_mod_time(files): #function to return modification time of file return os.path.getmti...
taekionic/Python_Projects
Learning Files/file transfer assignment/programcontrol.py
programcontrol.py
py
2,404
python
en
code
0
github-code
90
14939702918
print("Hello World!") print(200) print(3.14) type("hello World!") type(200) type(3.14) ############## # pseudocode # ############## # non-polymorphism designing shapes = [trl, sql, crl] for a_shape in shapes: if type(a_shape) == "Triangle": a_shape.draw_triangle() if type(a_sha...
ewan-zhiqing-li/PYTK
exercise/book_the_self_taught_programmer/code_20210113_object_oriented/c_polymorphism.py
c_polymorphism.py
py
595
python
en
code
0
github-code
90
72977845098
# -*- coding: utf-8 -*- # by Elias Showk <elias@showk.me> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # T...
elishowk/django-webpush-demo
webpush/push.py
push.py
py
1,635
python
en
code
4
github-code
90
17986668689
N = int(input()) A = list(map(int,input().split())) c = [0] * 9 for i in A: if i < 3200: c[i//400]+=1 else: c[8]+=1 cnt = 0 for i in range(8): if c[i] != 0: cnt += 1 mini = max(1,cnt) maxi = cnt+c[8] print(mini,maxi)
Aasthaengg/IBMdataset
Python_codes/p03695/s013754541.py
s013754541.py
py
253
python
en
code
0
github-code
90
21911687962
from qaoa import * def cost_function_den_4pts(G): C = 0 #PreferTimes_3 if G.nodes["Event18"]['color'] != 0: C += 1 #PreferTimes_4 if G.nodes["Event19"]['color'] != 2: C += 1 #PreferTimes_5 if G.nodes["Event20"]['color'] != 1: C += 1 #PreferTimes_6 if G.nodes[...
OttoMP/qaoa-school-timetable
den.py
den.py
py
3,436
python
en
code
0
github-code
90
34132664540
COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] NUM_CARS = 20 STARTING_MOVE_DISTANCE = 0.5 MOVE_INCREMENT = 10 from turtle import Turtle from random import randint, choice class CarManager: def __init__(self) -> None: self.cars = [] self.create_cars() def create_cars(...
ajaythumala/100-Days-of-Code
100/day_23/car_manager.py
car_manager.py
py
1,210
python
en
code
0
github-code
90
72115928618
def main(): def check_letters(word, correct_letters, letter_guessed): correct_guess = False for index, letter in enumerate(word): if letter_guessed == letter: correct_letters[index] = letter correct_guess = True return correct_guess word = '...
BrandtRobert/PythonCrashCourse
Day1/TicTacToe.py
TicTacToe.py
py
1,024
python
en
code
0
github-code
90
4195232288
import unittest from propnet.core.registry import Registry class RegistryTest(unittest.TestCase): def test_basic_registry(self): test_reg = Registry("test") test_reg2 = Registry("test") test_reg3 = Registry("test2") self.assertIsInstance(test_reg, dict) self.assertTrue(te...
materialsintelligence/propnet
propnet/core/tests/test_registry.py
test_registry.py
py
823
python
en
code
66
github-code
90
18540405189
#!/usr/bin/env python import sys from collections import Counter from itertools import permutations, combinations from fractions import gcd #from math import gcd from math import ceil, floor import bisect sys.setrecursionlimit(10 ** 6) inf = float("inf") def input(): return sys.stdin.readline()[:-1] def main(): ...
Aasthaengg/IBMdataset
Python_codes/p03363/s027965201.py
s027965201.py
py
633
python
en
code
0
github-code
90
19420433153
import re import os def add_discourse_start_end(discourse_df, cfg, datatype="train"): idx = discourse_df.essay_id.values[0] filename = os.path.join(cfg.data.train_txt_path, idx + ".txt") with open(filename, "r", encoding='utf-8') as f: text = f.read() min_idx = 0 starts = [] e...
inabakaiso/template
src/preprocess.py
preprocess.py
py
1,438
python
en
code
0
github-code
90
13589269200
import requests n = input('회차를 입력하세요: ') url = f'https://dhlottery.co.kr/common.do?method=getLottoNumber&drwNo={n}' response = requests.get(url) # response.text #=> string lotto = response.json() #=> dict # winner = [] # for i in range(1, 7): # winner.append(lotto[f'drwtNo{i}']) winner = [lotto[f'drwtNo{i}'] fo...
4th5-deep-a/web
python/lotto.py
lotto.py
py
437
python
en
code
4
github-code
90
39071181897
import json def json_for_dashboard(input_fasta, input_json, tree, output, wildcards): with open(input_json, 'r') as input_file: indices = json.load(input_file) with open(input_fasta) as file: fasta = file.read() with open(tree) as file: newick = file.read() output_dict = { ...
veg/bcell-phylo
python/output.py
output.py
py
523
python
en
code
0
github-code
90
6438732561
# 회전 방향 # 반시계 방향 북 서 남 동 dir = [(-1,0),(0,-1),(1,0),(0,1)] n,m = map(int,input().split()) # 맵의 크기 x,y,d = map(int,input().split()) # 주인공의 위치 x, y, 바라보고있는 방향 d 0 북쪽 arr = [list(map(int,input().split())) for _ in range(n)] # 맵 visited = [[False] * m for _ in range(n)] # 시작점 방문 체크 visited[x][y] = True # 방문한 칸 수 1 증가 ans ...
namoo1818/SSAFY_Algorithm_Study
이민지/[2주차]구현/4-4.py
4-4.py
py
1,471
python
ko
code
0
github-code
90
18454728689
def func(n): return 3*n + 1 if n % 2 != 0 else n//2 s = int(input()) inf = 1000000 l = [] l.append(s) for i in range(1, inf+1): ai = func(l[i-1]) if ai in l: print(i+1) break else: l.append(ai)
Aasthaengg/IBMdataset
Python_codes/p03146/s922123630.py
s922123630.py
py
235
python
en
code
0
github-code
90
32455888167
import PySimpleGUI as sg import DataBase import random import APIFuntion run = True steamKey = "" bpKey = "" startingSteamID = "" maxLevel = 1 # this is the minimum amount to run once anything less will just be pointless minValue = 0 while run: layout = [ [sg.Text("Steam API ID:", size=(20,...
henryphilbrook02/TF2_Backpack_Finder
GUI.py
GUI.py
py
5,544
python
en
code
0
github-code
90
39056209200
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 10 11:52:57 2023 @author: richardfremgen """ from sklearn.naive_bayes import ComplementNB from sklearn.feature_extraction.text import CountVectorizer from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_...
richfremgen/Fremgen_MSS_Portfolio
Code/3a_m1_tune.py
3a_m1_tune.py
py
10,997
python
en
code
1
github-code
90
71726031976
from flask import Flask from flask_cors import CORS import requests from decouple import config app = Flask(__name__) CORS(app) http_proxy = config('PROXY') https_proxy = config('PROXY') url = "https://www.guadeloupe.gouv.fr/booking/create/12828/0" proxyDict = { "http": http_proxy, "https": https_proxy, } ...
stevenfeliz/python-flask
app.py
app.py
py
868
python
en
code
0
github-code
90
28437740865
# Chapter 19. GAN, Auto-encoder # 생성적 적대 신경망 (GAN, Generative Adversarial Networks): 가상의 이미지를 만들어내는 알고리즘 # GAN 내부에서 (적대적인) 경합을 진행 # (Ian Goodfellow said) 보다 진짜 같은 가짜를 만들고자 하는 위조지폐범과 진짜 같은 가짜를 판별하고자 하는 경찰의 경합 # 이때 위조지폐범, 즉 가짜를 만들어 내는 파트를 생성자 (Generator) # (나머지) 경찰, 즉 진위를 가려내는 파트를 판별자 (Discriminator) # DCGAN (Deep Convol...
Myul23/Deep-Learning-for-everyone
19. 세상에 없는 얼굴 GAN, 오토인코더/implementation.py
implementation.py
py
8,829
python
ko
code
0
github-code
90
18235466789
n=int(input()) s=list(input()) r=[] g=[] b=[] for i in range(n): if s[i]=='R': r.append(i) elif s[i]=='G': g.append(i) else: b.append(i) import bisect def binary_search(a, x): # 数列aのなかにxと等しいものがあるか返す i = bisect.bisect_left(a, x) if i != len(a) and a[i] == x: retu...
Aasthaengg/IBMdataset
Python_codes/p02714/s193707958.py
s193707958.py
py
966
python
en
code
0
github-code
90
34346616387
import math def bisection(a,b,f,tolerance=1e-6,max_tolerance=100 ): for i in range(max_tolerance): c=(a+b)/2 if abs (f(c))< tolerance: print(f"Root found at x={c:7f}") return elif (f(c)*f(a)) < 0: max_tolerance=100 b=c else: ...
cmm25/SCIENTIFIC-COMPUTING
assignment.py
assignment.py
py
1,241
python
en
code
0
github-code
90
34377446470
# -*- coding: utf-8 -*- """ Created on Wed Jul 5 11:57:39 2017 @author: Andrei """ from gdcb_explore import GDCBExplorer import pandas as pd if __name__=="__main__": gdcb = GDCBExplorer() df_cars = gdcb.df_cars[["ID"]] df_codes = gdcb.df_predictors[["Code", "ID"]] df_cars.columns = ['CarID'] df_codes.co...
GoDriveCarBox/GDCB-4E-DEV
WORK/gdcb_explorer/gdcb_loader1.py
gdcb_loader1.py
py
607
python
en
code
0
github-code
90
2117616246
from filterpy.kalman import UnscentedKalmanFilter, MerweScaledSigmaPoints from filterpy.kalman import KalmanFilter from scipy.spatial import distance import numpy as np class Box: def __init__(self, positions, id=-1): self.positions = positions self.id = id self.time = 0 self.missed...
Tox1cCoder/Object-Tracking
tracker2.py
tracker2.py
py
6,831
python
en
code
0
github-code
90
36338542553
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import re import sys import time import random from tqdm import * from glob import glob from collections import defaultdict import cPickle from tensorflow.python.platform import gfile # Special voca...
limiao06/DMQA
data_utils.py
data_utils.py
py
9,462
python
en
code
0
github-code
90
36443250959
import pandas.util.testing as pdt import pandas as pd import common import collections import airbnb import os import glob def test_airbnb(): # clean the outputs folder first output_folder = 'tests/outputs/' expected_output_folder = 'tests/expected_outputs/' files = glob.glob(output_folder + '/*') ...
luc14/Kaggle_Airbnb
test_airbnb.py
test_airbnb.py
py
1,234
python
en
code
0
github-code
90
71164332137
from sklearn.preprocessing import MinMaxScaler import os, sys import json from concurrent.futures import ThreadPoolExecutor from functools import partial sys.path.append(os.path.abspath(os.path.join("..", ".."))) O_scaler = MinMaxScaler(feature_range=(-3.2, 2.3)) C_scaler = MinMaxScaler(feature_range=(-2.5, 2.4)) E...
iscv-lab/iscv-machine
tools/big_five/audio.py
audio.py
py
6,731
python
en
code
0
github-code
90
24340911215
import time from bluejay_bonanza_slot_machine_data import\ my_paytable, my_reel_1, my_reel_2, my_reel_3,\ my_symbols_to_unicode, my_virtual_stops from bandit import Bandit from random_squence_generator import get_random_sequence from utils import take_integer_on_input slot_machine = Bandit(my_r...
Japolk/one-armed-bandit
game.py
game.py
py
1,764
python
en
code
0
github-code
90
32693033108
import os from capytaine import * import capytaine.post_pro import numpy as np import logging import matplotlib.pyplot as plt os.system('cls') def plate_flexure_mode_shape(x, y, z): from math import pi, cos, sin, cosh, sinh device_height = 10.0 device_width = 6.0 device_thickness = 0.50 base_he...
berriera/wec_design_optimization
wec_design_optimization/oscillating_surge_device/oscillating_surge_device.py
oscillating_surge_device.py
py
3,835
python
en
code
0
github-code
90
7937923365
def Solver(): """ Input: None. Output: the shortest path in a reable way. """ S = genStates() G = genGraph(S) s = "EEEEEEE" #source node d = "WWWWWWW" #destination node result = genShortestPath(G,s,d) husband_wife = [' blue husband',' blue wife',' green husband',...
shellysolomonwang/Couple-River-crossing-Problem
couple-river-crossing-problem.py
couple-river-crossing-problem.py
py
6,328
python
en
code
0
github-code
90
27670800500
#!/usr/bin/env python3 import os import requests import aiml import irc.bot USERNAME = "FoxyVamp" # Substitute your bot's username TOKEN = "oauth:obejk6vxzumkae8hhgxpujowx1px3u" # OAUTH token (Get one here: https://twitchapps.com/tmi/) CHANNEL = "#Foxy_Fury" # Twitch channel to join STARTUP_FILE = "std-startup.xml" B...
CWing22/Fail1
cathy/cathytwitch.py
cathytwitch.py
py
1,747
python
en
code
0
github-code
90
73884510697
""" script to make postfit comparisons """ import ROOT import os,sys,math from collections import OrderedDict import json import re import numpy as np from CMSPLOTS.myFunction import DrawHistos, DrawConfig ROOT.gROOT.SetBatch(True) def MakePostPlot(ifilename: str, channel: str, prepost: str, bins: np.array, suffix: ...
KIT-CMS/Z_early_Run3
SignalFit/modules/postFitScripts.py
postFitScripts.py
py
18,524
python
en
code
0
github-code
90
19916579515
''' @author: diana.kantor Soil-specific Report functionality. Checks data for soil-specific indicators such as spikes, jumps, frozen soil flags, and missing volumetric calculations. ''' from crn import * import StandardReport SPIKE_THRESHOLD = 5.0 stndReport = StandardReport.StandardReport() class Soi...
eggsyntax/crnscript
src/sensorreport/SoilReport.py
SoilReport.py
py
6,260
python
en
code
0
github-code
90
18069458819
# https://atcoder.jp/contests/agc002/tasks/agc002_b n, m = map(int, input().split()) xy = [] for _ in range(m): x, y = map(int, input().split()) xy.append((x - 1, y - 1)) box = [0] * n box[0] = 1 num = [1] * n for x, y in xy: if box[x]: box[y] |= 1 num[x] -= 1 num[y] += 1 if not num[x...
Aasthaengg/IBMdataset
Python_codes/p04034/s631155548.py
s631155548.py
py
422
python
en
code
0
github-code
90
17932575479
# https://atcoder.jp/contests/abc079/tasks/abc079_d # ワーシャルフロイド h, w = map(int, input().split()) edge = [[] for _ in range(10)] for i in range(10): edge[i] = list(map(int, input().split())) num = [list(map(int, input().split())) for _ in range(h)] for k in range(10): for i in range(10): for j in rang...
Aasthaengg/IBMdataset
Python_codes/p03546/s995868052.py
s995868052.py
py
752
python
en
code
0
github-code
90
16845667446
import cv2 from pathlib import Path cwd = Path.cwd()/'trident/scripts' IMAGE_PATH = str(cwd/'rockfish.jpg') mlDir = cwd/'tf_files' def get_image(): img = cv2.imread(IMAGE_PATH) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) return img
jonnyk20/trident
trident/scripts/image_tools.py
image_tools.py
py
245
python
en
code
0
github-code
90
34537232549
import collections from typing import List ''' 当合并的条件有很多的时候,注意反过来思考,不要一味的找合并条件 ''' class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: ans =[] intervals=sorted(intervals) for interval in intervals: # 如果列表为空,或者当前区间与上一区间不重合,直接添加 if not ans ...
zhengyaoyaoyao/leetcodePython
leetcode/medium/56. 合并区间.py
56. 合并区间.py
py
839
python
zh
code
0
github-code
90
10950408791
# Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
blackberry/WebKit-Smartphone
webkit/WebKitTools/QueueStatusServer/handlers/queuestatus.py
queuestatus.py
py
3,344
python
en
code
13
github-code
90
18558288309
def main(): N, M = (int(_) for _ in input().split()) if N > 1 and M > 1: N = max(0, N-2) M = max(0, M-2) print(N * M) else: if N * M == 1: print(1) else: print(max(max(N, M)-2, 0)) return if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03417/s243447212.py
s243447212.py
py
264
python
en
code
0
github-code
90
20840306772
# Tool = "BESCOM ElecMeter" # HandcraftedBy : "Atharvan Technoligical Development Center (ATDC)"\ # Web : www.atharvantechsys.com # Version = "1.4" # LastModifiedOn : "5th April 2022" #!/usr/bin/python3 # -*- coding: utf-8 -*- import Resources import copy import requests from PyQt5.QtGui import * from ...
arun5k1095/BESCOMElecMeter
BESCOMElecMeter.py
BESCOMElecMeter.py
py
17,528
python
en
code
0
github-code
90
71605065898
from IPython.core.display import display, HTML from IPython.core.magic import register_line_magic, register_line_cell_magic @register_line_magic def bokehlab(line): """ Magic equivalent to %load_ext bokehlab. Injects keywords like 'plot' into global namespace. """ from bokehlab import CONF...
axil/bokehlab
bokehlab/bokehlab_magic.py
bokehlab_magic.py
py
1,900
python
en
code
1
github-code
90
29737866354
# imports libraries import pandas as pd from sklearn.ensemble import RandomForestRegressor # reads & describes data from files X = pd.read_csv('Xdata.csv') y = pd.read_csv('Ydata.csv') print(X.describe()) # drops the column name 'Date' from the dataset Xdrop = X.drop('Years',1) ydrop = y.drop('Years',1) # reads data...
ishaaty/superbowl23
predictions.py
predictions.py
py
815
python
en
code
0
github-code
90
21967978898
""" This is a mock CLI for sending requests for benchmarks. """ import time import pprint as pp from digi.util import patch_spec, get_spec room_gvr = ("bench.digi.dev", "v1", "rooms", "room-test", "default") measure_gvr = ("bench.digi.dev", "v1", "measures", "measure-test", "default") ROOM_ORIG_INTENT = 0.8 ROOM_IN...
digi-project/dspace
benchmarks/room_lamp.py
room_lamp.py
py
2,122
python
en
code
11
github-code
90
18252943719
import math def py(): print("Yes") def pn(): print("No") def iin(): x = int(input()) return x neko = 0 nya = 0 nuko = 0 h,w = map(int,input().split()) neko = h%2 nya = w%2 nuko = h * w /2 if neko + nya == 2: nuko = nuko + 1 if (h == 1)or(w == 1): nuko = 1 print(int(nuko))
Aasthaengg/IBMdataset
Python_codes/p02742/s861006122.py
s861006122.py
py
297
python
en
code
0
github-code
90
41169890155
# -*- coding: utf-8 -*- """ Created on Sun Oct 4 05:11:04 2020 @author: donbo """ # %% imports import importlib import jax import jax.numpy as jnp import cyipopt as cy from cyipopt import minimize_ipopt # import numpy as jnp # from scipy.optimize import minimize # this next line is CRUCIAL or we will lose preci...
donboyd5/weighting
src/geoweight_poisson_ipopt.py
geoweight_poisson_ipopt.py
py
4,354
python
en
code
0
github-code
90
18280153069
import operator class SegmentTree: def __init__(self, size, fn=operator.add, default=None, initial_values=None): """ :param int size: :param callable fn: 区間に適用する関数。引数を 2 つ取る。min, max, operator.xor など :param default: :param list initial_values: """ default = d...
Aasthaengg/IBMdataset
Python_codes/p02788/s554925231.py
s554925231.py
py
3,045
python
en
code
0
github-code
90