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
22690391778
import pandas as pd import auto_classification.src.helpers.preprocess_helper as preprocess_helper def prepare_dataset(params, df_features): df_features_trans = df_features feature_cols = params["feature_cols"] id_cols = params["id_cols"] max_bins = params["max_bins"] dummy_na = params["dummy_na"] ...
relue/auto_classification
src/api/preprocess.py
preprocess.py
py
2,060
python
en
code
0
github-code
90
3857919820
# ベクトルの方向を求める import math rad = math.atan2(3, 2) th = math.degrees(rad) # ベクトル演算 import numpy as np a = np.array([2, 2]) b = np.array([2, -1]) a + b a - b 2 * a # 直線の方程式 from sympy import Symbol, solve a = Symbol('a') b = Symbol('b') ex1 = -1*a + b - 2 ex2 = 2*a + b - 4 solve((ex1, ex2)) # 直線のなす角度 import math im...
ghard1053/python-st
py2/st4.py
st4.py
py
905
python
en
code
0
github-code
90
18638226958
import pygame import math from .sprite import Sprite class Raycaster: def __init__(self, surface, grid=None, objects=None, shading=True): if type(grid) is pygame.Surface: # Grid from image. grid = grid.convert_alpha() self.grid = [] temp_objects = [] for x in...
lewisc64/pyray
pyray/raycaster.py
raycaster.py
py
7,867
python
en
code
0
github-code
90
27457690543
from matplotlib.pyplot import imshow import numpy as np import cv2 from keras.preprocessing.image import img_to_array from tensorflow.keras.layers import Conv2D, MaxPooling2D, UpSampling2D from tensorflow.keras.models import Sequential SIZE=256 #Limiting to 256 size image as my laptop cannot handle lar...
hyebinkang/classification_study
5. AutoEncoder/89_Domain_Adaptation.py
89_Domain_Adaptation.py
py
2,499
python
en
code
0
github-code
90
19009194175
# -*- coding: utf-8 -*- """ Created on Sat Mar 10 20:00:16 2018 @author: Nabarun Chatterjee """ import pandas as pd # import the files import os app_dir = os.path.dirname(__file__) def files_import(): global app_dir symptom = pd.read_csv(os.path.join(app_dir, 'symptoms.csv')) diagnosis = p...
Tejas07PSK/ACM_c2c_DP
c2cHack/mlmodel/load_data.py
load_data.py
py
523
python
en
code
0
github-code
90
40697055402
import os import shutil path_to_your_files = 'D:\TautraUHI\RGB_imgs_corrected' copy_to_path = 'D:\TautraUHI\RGB_imgs_corrected_subset' files_list = sorted(os.listdir(path_to_your_files)) orders = range(6, len(files_list), 10) for order in orders: files = files_list[order] # getting 1 image after 3 images shu...
havardlovas/Underwater-Hyperspectral-Algorithms
Spectral-Algorithms and Image-Algorithms/copy_alternate_imgs.py
copy_alternate_imgs.py
py
448
python
en
code
1
github-code
90
9303725291
import jax import jax.numpy as jnp def my_dot(a, b): return jnp.dot(a, b) try: print("available GPU : ") print(jax.devices('gpu')) except: print('no GPU found, available device : ') print(jax.devices()) matrix_vector = jax.vmap(my_dot, in_axes=(0, None)) matrix_matrix = jax.vmap(my_dot, in_ax...
olivier-serris/singularity_containers
codes/jax_gpu.py
jax_gpu.py
py
580
python
en
code
0
github-code
90
12252551626
import matplotlib matplotlib.use('Agg') from matplotlib.font_manager import FontProperties import matplotlib.pyplot as plt import numpy as np import argparse def isfloat(num): try: float_equiv = float(num) return True except: return False def main(): #parse input arguments p...
blueleafysky/CloudFinalProject
rl/abr_graph/graph_results.py
graph_results.py
py
2,361
python
en
code
0
github-code
90
14289702080
Numbers = [] Size = int(input("Among how many numbers do you want to find the maximum?")) Numbers.append(int(input("Enter the first number:"))) for Counter in range(1, Size): Numbers.append(int(input("Enter the next number:"))) Max = Numbers[0] for Counter in range(1, Size): if(Max < Numbers[Counter]): ...
skkittu22/programs
python/Maximum.py
Maximum.py
py
409
python
en
code
0
github-code
90
38244789531
#!/usr/bin/env python3 import subprocess import sys import random from os.path import isfile, join import os import hashlib from argparse import ArgumentParser as ap checksumlist = {} hasherclass = hashlib.sha1 BLOCKSIZE = 16384 emptysums = [ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ...
roikale/sumcheck
sumcheck.py
sumcheck.py
py
3,543
python
en
code
0
github-code
90
27094389908
from spack import * class PyPyprof2html(PythonPackage): """Python cProfile and hotshot profile's data to HTML Converter""" homepage = "https://pypi.python.org/pypi/pyprof2html/" url = "https://pypi.io/packages/source/p/pyprof2html/pyprof2html-0.3.1.tar.gz" version('0.3.1', 'aa65a1635aac95e0487d...
matzke1/spack
var/spack/repos/builtin/packages/py-pyprof2html/package.py
package.py
py
482
python
en
code
2
github-code
90
45989275479
# my_solution import sys input = sys.stdin.readline ''' 1, 2, 3으로 숫자를 만들어야 한다. 따라서 어떤 n이라는 숫자를 만드려면 n-1 + 1 n-2 + 2 n-3 + 3 을 하면 된다. 따라서 n-1, n-2, n-3의 경우의 수를 모두 더해주면 n을 만들 수 있는 경우의 수를 구할 수 있다. ''' dp = [0 for _ in range(12)] # 1, 2, 3은 미리 설정해준다. dp[1] = 1 dp[2] = 2 dp[3] = 4 # n은 1~11까지의 수만 가능하다. 따라서 4~11까지 반복하면서 dp...
GwonPyo/Algorithm
Baekjoon/알고리즘 기초 문제집/브루트 포스/브루트 포스/1, 2, 3 더하기(9095)_s3.py
1, 2, 3 더하기(9095)_s3.py
py
732
python
ko
code
0
github-code
90
40651309264
import dataclasses import enum import functools import inspect import math import random from typing import Any, ClassVar, Dict, NamedTuple, Optional, Type import gym import numpy as np import pytest from gym import spaces from gym.envs.classic_control import CartPoleEnv from sequoia.common.config import Config from ...
lebrice/Sequoia
sequoia/settings/rl/incremental/setting_test.py
setting_test.py
py
43,108
python
en
code
185
github-code
90
26811480001
t = int(input()) INF = 2000000000 def bellman_ford(): dist = [INF] * (n+1) dist[1] = 0 for i in range(n): for edge in edges: cur = edge[0] nxt = edge[1] cost = edge[2] if dist[nxt] > dist[cur] + cost: dist[nxt] = dist[cur] + cost ...
cyw320712/problem-solving
Baekjoon/python/GraphSearch/1865.py
1865.py
py
784
python
en
code
3
github-code
90
13385878146
from fastapi.testclient import TestClient def test_post_request_with_special_characters(base_app): @base_app.action() def my_action(msg): return msg base_app.add_api_routes() test_input = base_app.get_action("my_action", func_kwargs={"msg": "+& "}).dict()["url"] expected = "/receiver?fun...
acivitillo/giotto
tests/integration/test_app.py
test_app.py
py
644
python
en
code
4
github-code
90
30875432466
# BOJ_1240_gold5-노드사이의거리 import sys from collections import defaultdict from heapq import heappop, heappush input = sys.stdin.readline def djikstra(node): dist = [float('inf')] * (n + 1) hq = [] dist[node] = 0 heappush(hq, [0, node]) while hq: current_dist, current_node = heappop(hq)...
Lee-hanbin/Algorithm
Python/BOJ/Gold/BOJ_1240_gold5-노드사이의거리/BOJ_1240_gold5-노드사이의거리.py
BOJ_1240_gold5-노드사이의거리.py
py
890
python
en
code
3
github-code
90
42351881606
# 0006 import os import re from collections import Counter # 统计最重要的单词, 统计单词出现的总次数最大 filepath = "./source/0006" files = os.listdir(filepath) # 设置一些不必要的词 stopword = ['and', 'a', 'an', 'or', 'but', 'to', 'the', 'of', 'is', 'i', 'he', 'was', 'as', 'be', 'have', 'has', 'had', 'also', 'wi...
DD-DDDD/ShowMeTheCode
0006.py
0006.py
py
959
python
en
code
0
github-code
90
35191327565
import logging import os from dotenv import load_dotenv load_dotenv() parentdir = os.path.dirname(os.path.abspath('__file__')) iface = os.getenv('IFACE') localstore = parentdir + "/localstore.txt" controller = os.getenv('CTRL') controller_port = os.getenv('CTRL_PORT') sw_table = int(os.getenv('TABLE')) dpid_sw = in...
jorgestivenm/GMM_OpenStack_implementation_real_time
shared.py
shared.py
py
1,197
python
en
code
0
github-code
90
17952992579
def warshall_floyd(cost): ret = [[1]*N for _ in [0]*N] for k in range(N): for i, c_left in enumerate(cost[i][k] for i in range(N)): for j, (c_now, c_right) in enumerate(zip(cost[i], cost[k])): if c_left + c_right < c_now: print(-1) exi...
Aasthaengg/IBMdataset
Python_codes/p03600/s267799900.py
s267799900.py
py
809
python
en
code
0
github-code
90
74765326377
import puzzle from collections import defaultdict # Part 1 def process_input(intext): start_text, inserts_text = intext.split("\n\n") inserts = {tuple(a.split(" -> ")[0]): a.split(" -> ")[1] for a in inserts_text.split("\n")} return list(start_text), inserts def step(in_text, inserts): out_text = [] for...
harveyj/aoc
2021/14.py
14.py
py
2,419
python
en
code
0
github-code
90
31423167493
#! usr/bin/env/python3 # coding:utf-8 # @Time: 2020-04-11 13:04 # Author: turpure import time import math import asyncio from src.services.base_service import BaseService class Worker(BaseService): """ fetch ebay listing from ibay day by day """ def __init__(self): super().__init__() ...
yourant/ur_cleaner
sync/ibay_sync/sync_wish_listing_from_ibay.py
sync_wish_listing_from_ibay.py
py
3,013
python
en
code
0
github-code
90
15063211501
import os import json import time import logging import ray import psutil import pytest import redis import requests from ray import ray_constants from ray.test_utils import wait_for_condition, wait_until_server_available import ray.new_dashboard.consts as dashboard_consts import ray.new_dashboard.modules os.environ...
aleSuglia/ray
dashboard/tests/test_dashboard.py
test_dashboard.py
py
7,990
python
en
code
null
github-code
90
5259043977
import sys import json from colorama import Fore, Back, Style from todo.constants import PROJECTFILE from todo.menu_utils import menuInterface import curses import re def check_int(element): if re.match(r'^-?\d+(?:\.\d+)?$', element) is None: return False return True def write(object): outfile =...
nightKrwler/TODO-CLI
todo/commands.py
commands.py
py
5,458
python
en
code
0
github-code
90
23548445356
'''A django abstract model and form for handling extra content in a model.''' VERSION = (0, 2, 'a1') def get_version(): if len(VERSION) == 3: v = '%s.%s.%s' % VERSION else: v = '%s.%s' % VERSION[:2] return v __version__ = get_version() __license__ = "BSD" __author__ = "Luca Sbardella"...
lsbardel/django-extracontent
extracontent/__init__.py
__init__.py
py
652
python
en
code
0
github-code
90
37589231152
# Written by Eric Martin for COMP9021 def balanced_brackets_in(pattern): pattern = iter(pattern) for c in pattern: if not c.isspace(): break else: return True brackets = dict(zip('([{', ')]}')) stack = [] while True: if c in brackets: stack.appe...
marey/UNSW_COMP9021
03.exercies/27.Balanced multiple type brackets/balanced_multiple_type_brackets.py
balanced_multiple_type_brackets.py
py
849
python
en
code
8
github-code
90
17278372862
from src.gameplay.core.tasks.clickInCoordinate import ClickInCoordinateTask def test_should_test_default_params(): waypoint = {} task = ClickInCoordinateTask(waypoint) assert task.name == 'clickInCoordinate' assert task.delayBeforeStart == 1 assert task.delayAfterComplete == 0.5 assert task.wa...
lucasmonstrox/PyTibia
tests/unit/gameplay/core/tasks/test_clickInCoordinate.py
test_clickInCoordinate.py
py
2,246
python
en
code
214
github-code
90
71789642538
#!/usr/bin/env python3 from math import floor def main(): with open("./inputs/day1.txt") as file: lines = file.read().splitlines() answer = 0 for line in lines: fuel = floor(int(line) / 3) - 2 answer += fuel print(answer) if __name__ == '__main__': main()
alu-/advent-of-code-2019
day1_part1.py
day1_part1.py
py
306
python
en
code
0
github-code
90
3099264496
### ## # # carltonnorthern/nickname-and-diminutive-names-lookup is licensed under the # # https://github.com/carltonnorthern/nickname-and-diminutive-names-lookup # # Apache License 2.0 # http://www.apache.org/licenses/ # ## ### import logging import collections import csv class NameDenormalizer(object): def __ini...
jabowery/delegate
nicknames.py
nicknames.py
py
1,191
python
en
code
2
github-code
90
23048094679
import turtle import string def clean(text): # Clean the data making it all lowercase and taking out all punctuation Alph = string.ascii_lowercase text = text.lower() new_string ="" for char in text: if char in Alph: new_string+= char elif char in string.whitespace: ...
elabay/cs2
Dictionaries/test_make_file.py
test_make_file.py
py
671
python
en
code
0
github-code
90
44246376058
from constants import logging, request, json, app, db from main import Main logging.basicConfig(level=logging.INFO, filename='/home/AbilityForAlice2/mysite/app.log', format='%(asctime)s %(levelname)s %(name)s %(message)s') # # logging.basicConfig(level=logging.INFO, filename='/home/AliceSurvival/...
Vo5torg/TimeForYou
flask_app.py
flask_app.py
py
1,127
python
en
code
0
github-code
90
20903570112
import os import sys import argparse import ast import logging import paddle paddle.enable_static() from utils.train_utils import train_with_dataloader import models from utils.config_utils import * from reader import get_reader from metrics import get_metrics from utils.utility import check_cuda from utils.utility im...
PaddlePaddle/Research
KG/DuKEVU_Baseline/paddle-video-classify-tag/train.py
train.py
py
7,266
python
en
code
1,671
github-code
90
40663376600
#!/bin/env python3 import subprocess import sys args = sys.argv try: CHOICE = args[1].lower() # prevent if no argument added except: CHOICE = "cpu" if CHOICE not in ("cpu", "mem"): CHOICE = "cpu" try: MAX_COUNT = int(args[2]) # if no 2nd argument except: MAX_COUNT = 10 def getTot...
mrizaln/bspwm-lynx-rice
.config/rofi/resource-monitor/who_monopolize_resource.py
who_monopolize_resource.py
py
2,874
python
en
code
0
github-code
90
72725448936
import json from io import BytesIO import shutil import pytest import factory from model_bakery import baker from rest_framework_simplejwt.tokens import RefreshToken from django.contrib.auth import get_user_model from django.conf import settings from django.core.files import File from django.test import override_setti...
tuliomitico/infinity_API
tests/test_store/e2e_tests.py
e2e_tests.py
py
4,924
python
en
code
0
github-code
90
39109250699
# Importação de Bibliotecas from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from datetime import datetime, timedelta import pandas as pd import zipfile import sqlite3 # Argumentos default defau...
Matheus-Homem/worldDB
airflow/dags/worldDB.py
worldDB.py
py
11,807
python
pt
code
0
github-code
90
8822266320
""" Implements the noise model and simulates the pressure level for a receiver Measuring noise from a point source passing by """ from copy import deepcopy import numpy as np import matplotlib.pyplot as plt import random from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernel...
ConstantinovMihai/DSE_AEMS
BayesOpt/noise.py
noise.py
py
7,266
python
en
code
0
github-code
90
35525371768
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="batch_tar", version="0.1.2", author='Guanliang Meng', author_email='linzhi2012@gmail.com', description="To tar/compress files/directories in batch mode.", long_description=long_descrip...
linzhi2013/batch_tar
setup.py
setup.py
py
1,046
python
en
code
0
github-code
90
13002754891
import json import os import random class Bot: DIRECTORY = 'user_responses' def __init__(self, user_id, vk_api, vk_upload): self.user_id = user_id self.vk_api = vk_api self.upload = vk_upload self.PATH = os.path.join(self.DIRECTORY, str(self.user_id) + '.json') self.DA...
Yourloff/bot_smetanka
bot.py
bot.py
py
4,409
python
en
code
0
github-code
90
2512696391
import sys from collections import deque sys.setrecursionlimit(100001) input = sys.stdin.readline def dfs(x): for i in l[x]: if visited[x] < visited[i]: visited[i] = visited[x] dfs(i) for i in range(int(input())): n = int(input()); k = int(input()) l = [[] for _ in range(n)...
0dOj/0dOj_Algorithm
Python/7000~7999/7511.py
7511.py
py
716
python
en
code
0
github-code
90
28165857253
import gdb import os class PrintRBT(gdb.Command): def __init__(self): super().__init__("print-rbt", gdb.COMMAND_USER) def invoke(self, arg, from_tty): root = gdb.parse_and_eval(arg) q = [root] nill_id = 0 dot_cmd = "digraph {" while len(q) > 0: nod...
kfggww/algorithms-in-c
script/algc-test-rbtree-gdb.py
algc-test-rbtree-gdb.py
py
1,576
python
en
code
1
github-code
90
7955002175
from pprint import pprint import collections grid = [[".", ".", ".", ".", ".", ".", ".", ], [".", ".", ".", "#", "#", ".", ".", ], [".", ".", "#", ".", "#", ".", ".", ], [".", ".", "#", ".", "#", ".", ".", ], [".", ".", "#", ".", "#", ".", ".", ], [".", ".", "#", ".", "#", ".", ...
shkolovy/path-finder-algorithms
flood_fill.py
flood_fill.py
py
3,858
python
en
code
0
github-code
90
11018530346
from typing import Tuple import numpy as np from numpy import ndarray from sigmaepsilon.math.numint import gauss_points as gp # LINES def Gauss_Legendre_Line_Grid(n: int) -> Tuple[ndarray]: return gp(n) # TRIANGLES def Gauss_Legendre_Tri_1() -> Tuple[ndarray]: return np.array([[1 / 3, 1 / 3]]), np.arr...
sigma-epsilon/sigmaepsilon.mesh
src/sigmaepsilon/mesh/utils/cells/numint.py
numint.py
py
3,572
python
en
code
2
github-code
90
32646595634
from goldSearch import * # parameter B = 48.0 H = 60.0 def f(y): a = B * (H - y) / H b = (B - a) / 2.0 A = (B + a) * y / 2.0 Q = (a * y**2) / 2.0 + 2.0 * (b*y/2) * y / 3.0 d = Q / A c = y - d I = (a * y**3) / 3.0 + 2.0 * (b * y**3 / 12.0) I_bar = I - A * d**2 return -I_bar / c y...
jyp-studio/numerical-method
E94086076_LAB9/max_sectionModulus.py
max_sectionModulus.py
py
489
python
en
code
2
github-code
90
23182032385
from const import * class Snake: def __init__(self): self.tail_count = 2 self.locationX = 100 self.locationY = 100 self.prev_locX = [80,60] self.prev_locY = [80,60] def head(self, last_key): if last_key == None: pass elif last_k...
Gandalf138/Snake
src/snake.py
snake.py
py
1,265
python
en
code
0
github-code
90
18315669139
import sys import math import copy from heapq import heappush, heappop, heapify from functools import cmp_to_key from bisect import bisect_left, bisect_right from collections import defaultdict, deque, Counter # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() ge...
Aasthaengg/IBMdataset
Python_codes/p02852/s561102208.py
s561102208.py
py
1,125
python
en
code
0
github-code
90
25199013140
#coding=utf-8 #聚类,对样本聚类,找到感兴趣的样本数据,如感兴趣的客户等 import pandas as pd from sklearn.tree import DecisionTreeClassifier as DTC from sklearn.tree import export_graphviz from sklearn.externals.six import StringIO import random inputfile="data/happiness_train_new.csv" class cluster(): def __init__(self,inputfile) : p...
saborforly/Machine-Learning
cluster/data_cluster.py
data_cluster.py
py
1,766
python
zh
code
0
github-code
90
6541990905
import json from flask import ( Flask, request, jsonify, Response, render_template ) import util from map.device import Device from map.router import DEFAULT_ACCESS_POINTS app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/location', methods=['POST']) def locatio...
beesaferoot/wifi-tracker
web-interface/app.py
app.py
py
2,849
python
en
code
0
github-code
90
15965553178
""" Helper functions for tests """ import os import sys import numpy as np TOPDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.join(TOPDIR, 'examples')) from util import run_ebtel def run_ebtelplusplus(config): return run_ebtel(config, TOPDIR) def generate_idl_test_da...
rice-solar-physics/ebtelPlusPlus
tests/helpers.py
helpers.py
py
2,443
python
en
code
7
github-code
90
2801710146
#from numpy.core.numeric import tensordot breakflag = False while True: import requests response = requests.get('https://favqs.com/api/qotd', headers = {'accept': 'application/json'}) data = response.json() quote = data["quote"]["body"] #print("Quote:", quote) #print(data) #print(quote) ...
PdxCodeGuild/class_salmon
code/Ryan/python_labs/lab_15_quotes_api.py
lab_15_quotes_api.py
py
13,257
python
en
code
5
github-code
90
35993679169
from django import forms from travel_app.models import City, Blog, Travel, Plan, Travel_Journal class CityModelForm(forms.ModelForm): class Meta: model = City exclude = ("author",) fields = "__all__" class BlogModelForm(forms.ModelForm): class Meta: model = Blog exc...
kowczanka/travel
travel_app/forms.py
forms.py
py
1,930
python
en
code
0
github-code
90
70528077418
import random import math import mmh3 from bitarray import bitarray import pickle ''' script to make a the bloomFilter class ''' class BloomFilter: # define data members: # constructor function: def __init__(self, keyfile, fdr, outfile): # initializing data members: self.fdr = ...
dombraccia/bloomfilters
src/BloomFilter.py
BloomFilter.py
py
3,953
python
en
code
1
github-code
90
20746191741
import math import torch from torch import nn import torch.nn.functional as F # from mmcv.cnn import ConvModule # from mmcv.cnn import build_norm_layer # from mmcv.runner import BaseModule # from mmcv.runner import _load_checkpoint # from mmseg.utils import get_root_logger # from ..builder import BACKBONES # =======...
Yanhua-Zhang/MultiTrans
Project_MultiTrans_V0/networks_my/module/module_Local_Global_fusion.py
module_Local_Global_fusion.py
py
7,990
python
en
code
0
github-code
90
9313987560
from utils import get_input INPUT = """ 2 5 4 1 2 6 7 9 12 24 24 41 50 14 24 24 4 1 1 42 42 24 """ input = get_input(INPUT)(input) from functools import reduce def assign(a, value, fr=0, to=None): if to is None: to = len(a) a[fr:to] = [value]*(to-fr) return a def solve(test_diff, students, N): ...
light-le/google_ks_hs_cj
final_exam.py
final_exam.py
py
2,555
python
en
code
0
github-code
90
26008646812
# on definit les jours valides tableau = ["lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"] # on demande de renseigner jour et heure jour=input("Veuillez saisir un jour : ") heure=input("Veuillez saisir une heure : ") heure=int(heure) # on verifie ...
GamerPsy/Remy_MyToolBox
PY-vrac/exercice3Tableau.py
exercice3Tableau.py
py
745
python
fr
code
2
github-code
90
44762463319
# Win rate predict model Func def model(dic): import pickle import pandas as pd from lightgbm import LGBMClassifier, plot_importance from xgboost import XGBClassifier model = None with open('model.pkl', 'rb') as file: model = pickle.load(file) # columns titles create colu...
Piat0046/LOL_winRate
riot_api/model/__init__.py
__init__.py
py
1,050
python
en
code
1
github-code
90
29620509653
import turtle import time import random t = turtle.Turtle() t.color('red') t.pendown() t.goto(100, 0) t.goto(100, 100) t.goto(0, 100) t.goto(0, 0) t.hideturtle() time.sleep(5)
loie/dailyprogrammer
easy_203.py
easy_203.py
py
179
python
en
code
0
github-code
90
7628912300
def _print_nice_indicator(s, i): """ Print a nice indicator showing the position of the character at index "i" in bytes "s" """ newline_before = s.rfind(b'\n', 0, i - 1) newline_after = s.find(b'\n', i) line = repr(s[newline_before + 1 : newline_after])[2:-1] # "b'" and "'" i -= newline...
stevenskevin/lua-2pda
pda.py
pda.py
py
4,986
python
en
code
0
github-code
90
5045005902
import sys sys.setrecursionlimit(10**9) def main(): N, M = map(int, input().split()) graph = [[] for _ in range(N)] for _ in range(M): u, v = map(int, input().split()) graph[u - 1].append(v - 1) graph[v - 1].append(u - 1) visited = [False] * N def dfs(v): visited[...
valusun/Compe_Programming
AtCoder/ABC/ABC287/C.py
C.py
py
738
python
en
code
0
github-code
90
22659914230
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys if sys.version_info[0] > 2: from tkinter import * import tkinter.ttk as ttk import tkinter.filedialog as tkFileDialog from tkinter.messagebox import * else: import ttk from T...
atsiaras/transit_simulator
transit_simulator/__run__.py
__run__.py
py
16,925
python
en
code
0
github-code
90
31665751701
import numpy as np from rdkit import DataStructs import torch import utils def dominate(ind1, ind2): all = np.all(ind1 <= ind2) any = np.any(ind1 < ind2) return all & any def gpu_non_dominated_sort(swarm: torch.Tensor): domina = (swarm.unsqueeze(1) <= swarm.unsqueeze(0)).all(-1) domina_any = (sw...
XuhanLiu/DrugEx
utils/nsgaii.py
nsgaii.py
py
3,607
python
en
code
180
github-code
90
5906386943
from dash.dependencies import Input, Output import plotly.express as px def register_callbacks(app,df): @app.callback( Output('bar-chart', 'figure'), Input('susdev-dropdown', 'value') ) #fonction qui met à jour l'histogramme du svg en fonction du pays sélectionné def update_bar_ch...
Cancaan/Projet-Dash-Python
dashboard/callback.py
callback.py
py
1,737
python
fr
code
0
github-code
90
39239140121
from rest_framework import serializers from .UserSerializer import UserSerializer from ..models import User, Employees """ EmployeeSerializer is used to serialize and deserialize the Employee model. Attributes: serializer_class (class): The class used to serialize and deserialize the Employee model. ...
Nojipiz/SimpleInventory
backend/inventory/serializers/EmployeeSerializer.py
EmployeeSerializer.py
py
1,966
python
en
code
0
github-code
90
42554831346
import os import torch import pickle import numpy as np from tqdm import tqdm import networkx as nx from sacred import Experiment from ggg.evaluation.plots.utils.plot_helpers import ( get_epoch_graphs, get_dataset_epochs_graphs, check_dataset_file, ) from ggg.evaluation.plots.utils.post_experiment_plots imp...
anon2022europe/icml2022
large_graphs/code/ggg/evaluation/plots/mmds_isomorphism.py
mmds_isomorphism.py
py
9,074
python
en
code
0
github-code
90
18405883669
from copy import copy N=int(input()) G=[[] for _ in range(N)] di=[-1]*N for i in range(N-1): u,v,w=map(int,input().split()) G[u-1].append([v-1,w]) G[v-1].append([u-1,w]) di[0]=0 for i in range(1,N): if di[i]!=-1:continue seen=[0]*N stack=[[0,0]] while stack: y,d=stack.pop() ...
Aasthaengg/IBMdataset
Python_codes/p03044/s375027285.py
s375027285.py
py
580
python
en
code
0
github-code
90
20126391449
from odoo import api, models, _ # pylint: disable=C8107 class ResPartnerBank(models.Model): """ This class upgrade the partners.bank to match Compassion needs. """ _inherit = "res.partner.bank" def build_swiss_code_vals(self, amount, *args): """In l10n_ch's build_swiss_code_vals the amount m...
ovesco/compassion-switzerland
partner_compassion/models/partner_bank_compassion.py
partner_bank_compassion.py
py
1,888
python
en
code
null
github-code
90
18314985879
import numpy as np from collections import defaultdict,deque N,K= map(int,input().split()) A = np.array([1]+list(map(int,input().split())))-1 Acs = np.cumsum(A) Acs %= K ans = 0 cnt = defaultdict(deque) for i,c in enumerate(Acs): cnt[c].append(i) while cnt[c]: if i-cnt[c][0]> K-1: cnt[c].p...
Aasthaengg/IBMdataset
Python_codes/p02851/s738888486.py
s738888486.py
py
401
python
en
code
0
github-code
90
18104073739
#!/usr/bin/env python3 from itertools import count, takewhile def prime(): prime = [] def _isPrime(n): for d in takewhile(lambda x: x * x <= n, prime): if n % d == 0: return False return True for i in count(2): if _isPrime(i): prime.append(i...
Aasthaengg/IBMdataset
Python_codes/p02257/s351137521.py
s351137521.py
py
667
python
en
code
0
github-code
90
20715251200
from django.contrib import admin from activity.models import Activity class ActivityAdmin(admin.ModelAdmin): fieldsets = [ ('name', {'fields': ['name']}), ('date', {'fields': ['date']}), ('publishTime', {'fields': ['publishTime']}), ('publisher', {'fields': ['publisher']}), ...
pxxgogo/FPGY
backend/activity/admin.py
admin.py
py
699
python
en
code
0
github-code
90
22922237491
import random def wolk(): pogoda = int(raw_input(''' type 1 if weather is Sunny type 2 if weather is Rainy what weather now? : ''')) print('Okey. Now you need set time!') time = int(raw_input(''' type 1 if a Day type 2 if a night what time now? : ''')) if (pogoda == 1 and time == 1 ): print('Ou, its g...
BorislavShutov/bash_script
1.py
1.py
py
1,801
python
en
code
0
github-code
90
35891322061
class Response: def __init__(self, f): self.raw = f self.encoding = "utf-8" self._cached = None def close(self): if self.raw: self.raw.close() self.raw = None self._cached = None @property def content(self): if self._cached is ...
jonathonlui/micropython-extras
urequests_ext/urequests_ext/responses.py
responses.py
py
1,757
python
en
code
1
github-code
90
18512149429
#!/usr/bin/env python3 a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 for i in range(1, len(a)): ans += a[i-1]-a[i] print(ans)
Aasthaengg/IBMdataset
Python_codes/p03292/s052826166.py
s052826166.py
py
152
python
en
code
0
github-code
90
2016036316
import turtle as t from paddle import Paddle from ball import Ball from net import Net from scoreboard import Score, Countdown, GameOver from boundaries import Boundary, GoalLine # game window setup/styling screen = t.Screen() screen.setup(width=1000, height=1000, startx=0, starty=0) screen.bgcolor("black") screen.tit...
finnhewes/100DaysofPython
Day22_PongGame/main.py
main.py
py
3,495
python
en
code
0
github-code
90
21524672360
import csv import os import pandas as pd import numpy as np from datetime import date, timedelta from pathlib import Path import re # point at "/home/canadmin/prefer/WRF/" data_path = "Kentucky/" #move to 2017 and 2018 year_folders = sorted(os.listdir(data_path)) print(year_folders) #''' for f_al...
kguilly/temperatureLSTM
Meto-Modelet-Suite/UtilityTools/extractTools/splitUTC.py
splitUTC.py
py
1,532
python
en
code
0
github-code
90
25239142561
import pandas as pd class DataOperations: def __init__(self,dataset_path = '../input/FutBinCards19.csv'): self.dataset_path = dataset_path def parseValue(self, x): x = str(x).replace('€', '') if ('M' in str(x)): x = str(x).replace('M', '') x = float(x) * 100000...
MortinerAzohen/Fifaproj
Data_operations/Prepare_data.py
Prepare_data.py
py
2,223
python
en
code
0
github-code
90
1986621320
import tkinter as tk import os from pathlib import Path import glob import sys def searchdir(): for item in filels: lbox.insert(tk.END, item) p = Path('/') filels = os.listdir(p) win = tk.Tk() win.title("LS GUI") win.geometry('475x275') win.configure(bg='#292929') userin = tk.Label(win, text="Directory...
CRStromberg/Unix
ls/gui.py
gui.py
py
556
python
en
code
0
github-code
90
898002449
''' This script plots the results of various algorithms at the same plot, and saves it as a pdf in the results/folder. Call it as: python plot_experiments fig_name folder1 ... folderN where folder* are the folders of the saved experiments. ''' import os.path import glob import numpy as np import pickle import argpars...
oxfordcontrol/Bayesian-Optimization
plot.py
plot.py
py
5,390
python
en
code
44
github-code
90
8354297855
import pandas as pd from math import pi from uncertainties import ufloat, unumpy import matplotlib.pyplot as plt from template import setup_plot data = pd.read_excel("data2.xlsx") r_1 = ufloat(8.6, 0.05) / 1e3 r_2 = ufloat(14.5, 0.05) / 1e3 h = ufloat(6.3, 0.05) / 1e3 R_1 = ufloat(24, 0.5) R_3 = ufloat(39, 0.5) * 1...
NOTfedos/msuexps
prak305/exp2.py
exp2.py
py
1,525
python
en
code
0
github-code
90
74318544936
"""Utility functions.""" from .const import IntelliFireCommand from .exceptions import InputRangError def _range_check(command: IntelliFireCommand, value: int) -> None: """Perform a value range check. Args: command (IntelliFireCommand): The command enum. value (int): The value to be checked. ...
jeeftor/intellifire4py
src/intellifire4py/utils.py
utils.py
py
720
python
en
code
4
github-code
90
17721784305
""" Faça uma lista de compras com listas, o usuário deve ter a possibilidade de inserir, apagar e listar valores da sua lista, não permita que o programa quebre com erros de índices inexistentes na lista. """ lista_compras = [] produto = [] opcao = '' while opcao != 's': opcao = input('Selecione uma opção: \n' ...
pasjunior/Curso_Python
aula90.py
aula90.py
py
1,206
python
pt
code
0
github-code
90
16566980839
import json from pathlib import Path from model.render import pdf INPUT_BASE_PATH = Path("testcases/annotation/") OUTPUT_BASE_PATH = Path("testcases/out/") OUTPUT_BASE_PATH.mkdir(parents=True, exist_ok=True) def get_pages(rm_files_path): content_file = rm_files_path.with_suffix(".content") with open(conten...
peerdavid/remapy
tests/annotation_test.py
annotation_test.py
py
1,416
python
en
code
172
github-code
90
18397428999
def main(): N, M = map(int, input().split()) lst = [list(map(int, input().split())) for _ in range(M)] p = list(map(int, input().split())) ans = 0 for i in range(2 ** N): # スイッチの状態をビット全探索 switch = [0] * N flag = True for j in range(N): # スイッチの状態を1パターン決める 1:ON, 0:OFF ...
Aasthaengg/IBMdataset
Python_codes/p03031/s857515846.py
s857515846.py
py
1,011
python
ja
code
0
github-code
90
1953386286
from lsdlm import utils, lsdlm import pickle import numpy as np import time import argparse def train(training_dataset, weight_matrix, save_to='data/pretrained_PEMS-BAY.model'): model = lsdlm.DLM(adj_mx=np.maximum(weight_matrix, weight_matrix.T), num_diff_periods=5) # undirected graph print('model created......
semink/LargeScale-DLM
main.py
main.py
py
1,561
python
en
code
3
github-code
90
73627405416
import traceback import xml.etree.ElementTree as etree from collections import defaultdict from bs4 import BeautifulSoup from tqdm import tqdm from utils import * class QA_Pairer(): def __init__(self, xml_path, name=None, out_folder="out", min_score=3, max_responses=3, out_format="txt", archiver=None): "...
EleutherAI/stackexchange-dataset
pairer.py
pairer.py
py
7,803
python
en
code
56
github-code
90
26950889091
#!/usr/bin/env python from gi.repository import Gtk, GLib, GObject, GdkPixbuf, Gio, Pango, GtkSource, Gdk from filemanager import MarkItFileManager from textview import MarkItTextView from documentview import MarkItDocumentView from workspaceview import MarkItWorkspaceView class MarkItSidebar (Gtk.Box): __gsign...
xyl0n/mark-it
sidebar.py
sidebar.py
py
5,569
python
en
code
6
github-code
90
5828454955
# -*- coding: utf-8 -*- # @Time : 2022/10/10 17:11 # @Author : Tom_zc # @FileName: permission_thread.py # @Software: PyCharm import logging import time import traceback from open_infra.utils.utils_kubeconfig import KubeconfigLib from permission.models import KubeConfigInfo logger = logging.getLogger("django") cl...
Open-Infra-Ops/open-infra
open_infra/open_infra/apps/permission/resources/permission_thread.py
permission_thread.py
py
2,058
python
en
code
0
github-code
90
18131686505
#!/usr/bin/env python3 """ Given a sorted array, convert it into a height-balanced (AVL) binary search tree. Reference: http://www.cs.ecu.edu/karl/3300/spr16/Notes/DataStructure/Tree/balance.html https://github.com/scirelli/jsdatastructures/tree/master/avlTree https://github.com/scirelli/pi_asm_armv6/tree...
scirelli/dailycodingproblem.com
problem_296/main.py
main.py
py
698
python
en
code
0
github-code
90
34871300880
from datetime import ( datetime, timedelta, ) import numpy as np import pytest from pandas._libs.algos import ( Infinity, NegInfinity, ) from pandas import ( DataFrame, Series, ) import pandas._testing as tm class TestRank: s = Series([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3]) df = D...
pandas-dev/pandas
pandas/tests/frame/methods/test_rank.py
test_rank.py
py
17,282
python
en
code
40,398
github-code
90
38095144909
''' Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... Example 1: Input: columnNumber = 1 Output: "A" Example 2: Input: columnNumber = 28 Output: "AB" Example 3: Input: columnNumber = 701 Outp...
DaneRosa/leetcode
problems/python/168.py
168.py
py
1,178
python
en
code
0
github-code
90
26809758247
from sklearn.metrics import explained_variance_score from sklearn.metrics import r2_score from sklearn.metrics import max_error from sklearn.metrics import accuracy_score from sklearn.metrics import roc_auc_score from sklearn.metrics import balanced_accuracy_score from sklearn.metrics import average_precision_score fro...
Queensbarry/PythonInAirSeaScience
statistics/sss.py
sss.py
py
29,600
python
en
code
15
github-code
90
12501548791
from chats.models import Chat, Message from django.contrib.auth.models import User from rest_framework import serializers from .models import Contact, Profile class ContactSerializer(serializers.ModelSerializer): user_info = serializers.SerializerMethodField('get_user_info') last_login = serializers.Serialize...
king-kite/kite-chat
users/serializers.py
serializers.py
py
2,798
python
en
code
0
github-code
90
1144713107
import sys def msLn(): print("Введіть свою вагу на Землі") massa = float(sys.stdin.readline()) print("Введіть кількість, на яку збільшуватиметься вага на Землі") x = float(sys.stdin.readline()) print("Введіть кількість років") years = int(sys.stdin.readline()) years = years + 1 ...
DmitriyPodkovko/python-for-kids
7_3.py
7_3.py
py
576
python
uk
code
0
github-code
90
44192551768
#student id : 1201200449 #student name : Lai Jian Hong #lab2 question 4 banana=1.5 grapes=5.60 qty_banana=int(input("Enter the quantity(comb)of banana bought :")) qty_grapes=int(input("Enter the quantity(kg)of grapes bought:")) total_banana=banana*qty_banana total_grapes=grapes*qty_grapes price=total_b...
Jianhong02/DPL5211Tri2110
lab2 q4.py
lab2 q4.py
py
604
python
en
code
0
github-code
90
42274780911
''' @author : manojbandari # Write a python program to find the square root of the given number # using approximation method # testcase 1 # input: 25 # output: 4.999999999999998 # testcase 2 # input: 49 # output: 6.999999999999991 ''' def main(): ''' # epsilon and step are initialized # don't change the...
manojbandari/20186096_cspp-1
cspp1-assignments/m5/p2/p2/square_root.py
square_root.py
py
614
python
en
code
0
github-code
90
350377631
import numpy as np import random import pandas as pd from sklearn.cluster import KMeans import matplotlib.pyplot as plt class ts_cluster(object): # num_clust def __init__(self, num_clust): ''' num_clust is the number of clusters for the k-means algorithm assignments holds the...
sfrcun/k-center
1_PPD_SSe.py
1_PPD_SSe.py
py
7,596
python
en
code
0
github-code
90
24498824971
##### IMPORTING ##### from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options from decimal import Decimal import requests import json import mysql.connector as mysql db = mysql.connect( user = 'root', password = '', host = 'localhost', database = 'foodpric...
MeecahCahayon/RecipeShoppingList
python/madbutcher.py
madbutcher.py
py
3,459
python
en
code
0
github-code
90
11173484950
#!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 import numpy as np def onMouse(event, x, y, flags, param): global img if event == cv2.EVENT_LBUTTONDOWN: print("LBTN Click", x, y) cv2.rectangle(img, (x - 50, y - 50), (x + 50, y + 50), (255, 0, 0), 2) cv2.imshow(' my canvas ',img) elif event == cv2.EV...
riversnails/linux_document
code2/3gkr/open_cv/test2.py
test2.py
py
1,745
python
en
code
0
github-code
90
14014571498
from collections import defaultdict from string import ascii_lowercase r = list(reversed(ascii_lowercase)) tc = int(input()) for _ in range(tc): s = input() price = int(input()) sm = 0 d = defaultdict(set) for i, c in enumerate(s): v = ord(c) - 96 sm += v d[c].add(i) rr...
hozblok/codeforces
1702/D_Not_a_Cheap_String.py
D_Not_a_Cheap_String.py
py
645
python
en
code
0
github-code
90
4586132332
def ttsanght(tokens): operators = [] postfix = [] uutien = {'+': 1, '-': 1, '*': 2, '/': 2, '^': 3} for token in tokens: if token.isdigit(): postfix.append(token) elif token in uutien: # Nếu token là một toán tử, xử lý các toán tử hiện tại trong danh sách operato...
tkieuvt/CoSoLapTrinh123
Nhom5/Bai124.py
Bai124.py
py
1,870
python
vi
code
0
github-code
90
2656121969
from django.db.models import Sum from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django_filters.rest_framework import DjangoFilterBackend from rest_framework import filters, mixins, status, viewsets from rest_framework.decorators import action from rest_framework.paginatio...
akiqq/foodgram-project-react
backend/api/views.py
views.py
py
5,157
python
en
code
0
github-code
90
29591385028
from collections import defaultdict, Counter from functools import cache rules = {} with open("resources/day14_input.txt") as f: polymer = f.readline().strip() f.readline() for line in f.readlines(): p, i = line.strip().split(" -> ") rules[p] = i @cache def mutate(a, b, steps): if step...
andrewmcloud/advent2021
day14.py
day14.py
py
807
python
en
code
0
github-code
90
27932709580
from tkinter import * import random import time class Ball: def __init__( self, canvas, paddle, color ): self.canvas = canvas self.paddle = paddle self.id = canvas.create_oval( 10,10, 25,25, fill = color ) self.canvas.move( self.id, 245, 100 ) starts = [ -3, -2, -1, 1, 2, 3...
chiedey/paddleball
paddleball.py
paddleball.py
py
3,052
python
en
code
0
github-code
90