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
15984679226
from functools import partial import operator from typing import Generator, Iterable, Optional, Union from .batching import batch from .empirical import empirical_kernel_fn, NtkImplementation, DEFAULT_NTK_IMPLEMENTATION, _DEFAULT_NTK_FWD, _DEFAULT_NTK_S_RULES, _DEFAULT_NTK_J_RULES from jax import random import jax.num...
google/neural-tangents
neural_tangents/_src/monte_carlo.py
monte_carlo.py
py
13,261
python
en
code
2,138
github-code
90
34622013356
# -*- coding:utf-8 -*- import os import xml.etree.ElementTree as ET import numpy as np import matplotlib.pyplot as plt from PIL import Image from pylab import * mpl.rcParams['font.sans-serif'] = ['SimHei'] def parse_obj(xml_path, filename): tree = ET.parse(xml_path + filename) objects = [] for obj in tree.f...
Bing8023/Test
venv/直方图边框与面积的比.py
直方图边框与面积的比.py
py
1,961
python
en
code
0
github-code
90
18484474709
def is_square(N): i = 0 while i**2 < N: i += 1 if i**2 == N: return i return None N = int(input()) r = is_square(8*N+1) if r is None: print("No") else: print("Yes") k = (r-1)//2 size = k+1 print(size) length = k ans = [[-1]*length for _ in range(size)] u...
Aasthaengg/IBMdataset
Python_codes/p03230/s703581358.py
s703581358.py
py
613
python
en
code
0
github-code
90
19253784965
from sys import stdin from collections import deque def dfs_recur(adjacency, check, start): check[start] = True res = str(start) + ' ' if start in adjacency: for vertex in adjacency[start]: if not check[vertex]: res += dfs_recur(adjacency, check, vertex) return res d...
ag502/algorithm
Problem/BOJ_1260_DFS와 BFS_Adjacency_List/main.py
main.py
py
2,367
python
en
code
1
github-code
90
31663306565
# 给定一个整数数组,判断是否存在重复元素。 # 如果任何值在数组中出现至少两次,函数返回 true。如果数组中每个元素都不相同,则返回 false。 # 示例 1: # 输入: [1,2,3,1] # 输出: true # 示例 2: # 输入: [1,2,3,4] # 输出: false # 示例 3: # 输入: [1,1,1,3,3,4,3,2,4,2] # 输出: true class Solution: def containsDuplicate(self, nums: List[int]) -> bool: hashtable = {} for n in ...
wzwhit/leetcode
217存在重复元素.py
217存在重复元素.py
py
614
python
zh
code
0
github-code
90
25374979651
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, String, Integer, Table from sqlalchemy.orm import sessionmaker from sqlalchemy import MetaData DATABASE_NAME = 'Bot' engine = create_engine('mysql+pymysql://user:pass@HOST:3306/DB') Base = decl...
URLbug/bot_sentence_bot
bot_sentence_bot/database.py
database.py
py
1,232
python
en
code
1
github-code
90
45989224369
# My Solution1(product, 304ms) ''' 수열의 조건은 다음과 같다 1. N개의 자연수 중에서 M개를 고른 수열 (단, N개의 자연수는 모두 다른 수이다.) 2. 같은 수를 여러 번 골라도 된다. 같은 수를 여러 번 골라도 된다면, 중복 순열을 사용하면 된다. 따라서 중복 순열을 만들어주는 product함수를 사용했다. ''' from itertools import product import sys input = sys.stdin.readline n, m = map(int, input().split()) # n: 총 숫자의 개수...
GwonPyo/Algorithm
Baekjoon/알고리즘 기초 문제집/브루트 포스/브루트 포스(N과 M)/N과 M_7(15656)_s3.py
N과 M_7(15656)_s3.py
py
2,509
python
ko
code
0
github-code
90
21311067371
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from geojson.feature import * class Random_Sample_Charge_Location_Model: def __init__(self): self.ev_charging_events = pd.read_csv('../data/raw/charges_derived_joi...
rossmclane/demand_projection
src/models.py
models.py
py
2,351
python
en
code
0
github-code
90
19017535865
from math import inf class Solution: def __tugOfWarHelper (self, arr, n, hf_sz, prev_idx, curr_tot): if (hf_sz == 0): curr_diff = abs((2 * curr_tot) - self.tot) if (curr_diff < self.res): self.res = curr_diff ptr1, ptr2 = 0, 0 for j in ...
Tejas07PSK/lb_dsa_cracker
Backtracking/Tug of War/solution.py
solution.py
py
1,147
python
en
code
2
github-code
90
18185688339
import numpy as np from random import randint D=int(input()) c=[int(i) for i in input().split()] s=[] for d in range(D): s.append([int(i) for i in input().split()]) v = [0]*D last = [[0 for i in range(26)] for d in range(D)] t=[0]*D v_pre=0 for d in range(D): if d>=1: last[d] = last[d-1][:] ...
Aasthaengg/IBMdataset
Python_codes/p02618/s475972337.py
s475972337.py
py
1,109
python
en
code
0
github-code
90
341826044
# -------------------------------------- # -*- coding: utf-8 -*- # @Time : 2022/8/24 15:39 # @Author : wzy # @File : visual.py # --------------------------------------- import math import cv2 import numpy as np import torch from matplotlib import pyplot as plt from data import data_load, transform, data_to_tensor f...
Berry-Wu/Visualization
visual.py
visual.py
py
6,426
python
en
code
44
github-code
90
10135352162
n = int(input()) binary = [] if n == 0: print(0) else: while n: if n%(-2): binary.append('1') n = n//(-2)+1 else: binary.append('0') n //= -2 print(''.join(reversed(binary)))
jjin134518/TIL
algorithms/boj_2089_-2진수.py
boj_2089_-2진수.py
py
248
python
en
code
0
github-code
90
4026943199
from socket import * from utils import * import time, datetime, struct, sys, random storage = {} def send(file_name, address, port, send_socket): f = read_file(file_name, chunk_size=DATA_LENGTH) send_socket.settimeout(0.01) next_seq = 0 base = 0 packet = None cwnd = WND_SIZE timer = None ...
HopeCheung/UDP-Achieve-TCP
Sender.py
Sender.py
py
4,474
python
en
code
0
github-code
90
69984272298
from pyiot.xiaomi.aqara import ( Gateway, SensorHt, SensorMotionAq2, SensorSwitchAq2, CtrlNeutral, CtrlNeutral2, Plug, Switch, WeatherV1, Magnet, ) from time import sleep import unittest import os from pyiot.zigbee.aqaragateway import AqaraGateway # sid = '0x000000000545b741' c...
angrysoft/pyiot
tests/test_aqara.py
test_aqara.py
py
3,533
python
en
code
0
github-code
90
22165962897
from django.shortcuts import render_to_response from django.template import RequestContext from opencsp.models import AlgorithmSubject from django.core.urlresolvers import reverse from django.core.urlresolvers import NoReverseMatch import inspect, sys class LayoutPositions: TOP = 0 BOTTOM = 1 WINDOW = 2 JSON = 3 ...
UmSenhorQualquer/opencsp
server/opencsp/plugins/OpenCSPPlugin.py
OpenCSPPlugin.py
py
3,589
python
en
code
0
github-code
90
23297013828
# -*- encoding: utf-8 -*- ''' @Time : 2022/04/07 10:02:49 @Author : Yu Runshen ''' # here put the import lib import sys, os class Solution: def minCostClimbingStairs(self, cost): size = len(cost) if size == 1: return cost[0] elif size == 2: return min(cost)...
OhOHOh/LeetCodePractice
python/No746.py
No746.py
py
529
python
en
code
0
github-code
90
18236507819
N, K = map(int, input().split()) numgcd = [0]*(K+1) sumgcd = 0 mod = 10**9+7 for i in range(1, K+1)[::-1]: numgcd[i] = pow(K//i, N, mod) count = 2 while count*i <= K: numgcd[i] -= numgcd[count*i] count += 1 sumgcd += numgcd[i]*i print(sumgcd%mod)
Aasthaengg/IBMdataset
Python_codes/p02715/s459084487.py
s459084487.py
py
278
python
en
code
0
github-code
90
11730212809
from feeluown.models import ModelType from feeluown.utils.reader import wrap from feeluown.gui.page_containers.table import Renderer from feeluown.gui.base_renderer import TabBarRendererMixin async def render(req, **kwargs): app = req.ctx['app'] ui = app.ui tab_index = int(req.query.get('tab_index', 0)) ...
SihabSahariar/FeelUOwn
feeluown/gui/pages/coll_library.py
coll_library.py
py
1,554
python
en
code
null
github-code
90
19982476451
""" /lib/living.py emsenn@Stirling 190411 The master object of the MUD, all objects inherit it at some point """ import sys from stirling.obj.object import MasterObject from stirling.cmd import find_cmd class Living(MasterObject): def __init__(self): super(Living, self).__init__() self.cmd_modul...
hannerz/stirling
stirling/obj/living/living.py
living.py
py
1,499
python
en
code
1
github-code
90
71026302697
from copy import deepcopy import logging import os import re from build_migrator.common.algorithm import flatten_list from build_migrator.common.argument_parser_ex import ArgumentParserEx import build_migrator.common.os_ext as os_ext from build_migrator.common import subprocess_ex from build_migrator.helpers import ( ...
KasperskyLab/BuildMigrator
build_migrator/parsers/msvc_cl.py
msvc_cl.py
py
23,139
python
en
code
30
github-code
90
32709512124
import requests from APIkey import getApiKey def rankInvocador(id): try: URL = "https://br1.api.riotgames.com/lol/league/v4/entries/by-summoner/" + \ id + "?api_key=" + getApiKey() dados = requests.get(URL) return dados.json() except KeyError as erro: print(erro)
samuelreissilv4/LeagueStats
mvc/ranked.py
ranked.py
py
319
python
en
code
0
github-code
90
1441912458
import json class Emulator(object): def __init__(self, mode, data, lambda_function): self.lambda_function = lambda_function if isinstance(data, dict): self.data = data else: self.data = json.loads(data) if mode == "auto": self.mode = self._guess...
mprzytulski/stylist
stylist/emulator/aws.py
aws.py
py
1,246
python
en
code
0
github-code
90
28869230318
import os import re import urllib import urlparse from django.http import HttpResponseRedirect from facetools.url import translate_url_to_facebook_url, facebook_redirect GET_REDIRECT_PARAM = 'facebook_redirect' class FandjangoIntegrationMiddleware(object): def process_response(self, request, response): ...
ericpalakovichcarr/django-facetools
facetools/middleware.py
middleware.py
py
3,207
python
en
code
13
github-code
90
31034292956
import hashlib import os import time # Gives the user the option to create a new baseline or monitor files using an existing baseline print("What would you like to do?") print("A) Collect a new baseline") print("B) Begin monitoring file with saved baseline") response = input("Please select A or B: ").upper() print("Us...
quin-baebler/FileIntegrityMonitor
File Integrity Monitor.py
File Integrity Monitor.py
py
3,275
python
en
code
0
github-code
90
40984877405
""" Задание 4 Сгенерировать 100 рандомных чисел и записать их в файл random_numbers.txt, где одна строка = одно число """ import random with open('random_numbers.txt', 'w') as file: numbers = random.sample(range(1, 10000), 100) lines = [f"{number}\n" for number in numbers] file.writelines(lines) print("E...
edyankov/AQA_Python_Hillel
HomeTask_7.4.py
HomeTask_7.4.py
py
397
python
ru
code
0
github-code
90
44157342359
# -*- coding: utf-8 -*- from time import sleep from datetime import datetime import email as email_utils from django.template.loader import render_to_string from django.utils import timezone from django.core import mail from celery.utils.log import get_task_logger from proj.celery import celery_app import proj.settin...
denispan1993/vitaliy
applications/cart/tasks.py
tasks.py
py
10,100
python
en
code
0
github-code
90
33510760828
import unittest import pinocchio as pin import numpy as np @unittest.skipUnless(pin.WITH_FCL_SUPPORT(),"Needs FCL") class TestGeometryObjectBindings(unittest.TestCase): def setUp(self): model = pin.buildSampleModelHumanoid() self.collision_model = pin.buildSampleGeometryModelHumanoid(model) d...
zhangOSK/pinocchio
unittest/python/bindings_geometry_object.py
bindings_geometry_object.py
py
1,298
python
en
code
0
github-code
90
12976699623
from rest_framework import serializers from rest_framework import viewsets from minecode.models import ResourceURI class ResourceURISerializer(serializers.ModelSerializer): class Meta: model = ResourceURI class ResourceURIViewSet(viewsets.ModelViewSet): queryset = ResourceURI.objects.all() seri...
maxhbr/purldb
minecode/api.py
api.py
py
378
python
en
code
null
github-code
90
35501694468
from __future__ import print_function from bs4 import BeautifulSoup from nltk import tokenize from nltk.sentiment.vader import SentimentIntensityAnalyzer import os import sys FAKE_DOMAINS = [ "abcnews", "now8news", "celebtricity", "infowars", "naturalnews", "libertywritersnews", "thelastlineof...
b-huynh/fake-news-analyzer
text_analysis.py
text_analysis.py
py
2,772
python
en
code
0
github-code
90
17958899664
import base64 from pathlib import Path SOURCE = Path("licenses.txt") TARGET = Path("oscduplicator") / Path("license_text.py") with open(SOURCE, "r", encoding="utf-8") as f: license_text = f.read() encoded_text = base64.b64encode(license_text.encode("utf-8")).decode("utf-8") with open(TARGET, "a", encoding="...
aruma256/OSCDuplicator
embed_license_text.py
embed_license_text.py
py
464
python
en
code
1
github-code
90
73211087338
import os, sys import pickle import h5py, tqdm, itertools import numpy as np # These are for training def load_pyramid_hdf(path, pickle_for_training=False): """ :param path: path of the hdf5 from matlab :param pickle_for_training: when pickle for training, only shear angle in the simulation result will be...
Cybernetics-Lab-Aachen/OptiDrape
Data/pickle_data.py
pickle_data.py
py
9,408
python
en
code
0
github-code
90
17295177285
""" linear regression (offline) optimizer constructs a linear regression model for design space exploration. it trains the model with many selected samples and freezes the model to search. a command to test "lr-offline-optimizer.py": ``` python example_optimizer/lr-offline-optimizer.py \ ...
alexding1226/CAD-contest-C
lr-offline-optimizer-ted.py
lr-offline-optimizer-ted.py
py
8,444
python
en
code
0
github-code
90
18309032909
X = int(input()) n = X % 100 m = X // 100 cnt = 0 for a in reversed(range(1, 6)): while n - a >= 0: n -= a cnt += 1 if cnt <= m: print(1) else: print(0)
Aasthaengg/IBMdataset
Python_codes/p02843/s345579495.py
s345579495.py
py
185
python
en
code
0
github-code
90
32665377221
from __future__ import absolute_import import torch from torch import nn from torch.autograd import Variable import numpy as np from ret_benchmark.losses.registry import LOSS from ret_benchmark.utils.log_info import log_info import numpy as np import random @LOSS.register("noXBM_loss") class noXBMLoss(nn.Module): ...
alibaba-edu/Ranking-based-Instance-Selection
ret_benchmark/losses/noXBM_loss.py
noXBM_loss.py
py
1,602
python
en
code
30
github-code
90
8936260377
""" Simple pipeline to train an Scikit-Learn model everyday and push the model to production. """ import datetime import os from airflow import models import mlengine_operator BASE_DIR = 'gs://ff-predictor/trainer' TRAINER_BIN = os.path.join(BASE_DIR, 'trainer-0.1.tar.gz') TRAINER_MODULE = 'trainer.task' RUNTIME_VER...
hongtw/gcp_ml_engine
dags/ff_daily_pipeline.py
ff_daily_pipeline.py
py
2,598
python
en
code
0
github-code
90
74305920615
#v1. DFS + Memoization,需要加大recursion limit import sys sys.setrecursionlimit(100000000) class Solution: def wordBreak(self, s, dict): memo = {} # index: false max_len = -1 for word in dict: max_len = max(max_len, len(word)) ans = self.dfs(s, 0, dict, memo, max_len) ...
fudigit/Basic_Algorithm
6.Combination-based_DFS&Memoization_Search/107.Word_Break.py
107.Word_Break.py
py
2,969
python
en
code
0
github-code
90
44054121757
from statistics import mean def main(): reverse_arr() twenty() third_prob() asend() def reverse_arr(): arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in range(10): print("Enter number position", i) arr[i] = int(input("Enter number: ")) arr.reverse() print(arr) def twenty(...
BrendanGlancy/akron
old/semester-1/logic-programming/11-lesson/lecture.py
lecture.py
py
983
python
en
code
2
github-code
90
23356360606
from django.forms.models import model_to_dict from rest_framework.response import Response from rest_framework.decorators import api_view from products.models import Product from products.serializers import ProductSerializer # Create your views here. @api_view(["GET"]) def api_home(request, *args, **kwargs): in...
Olugbengz/Deeper_DRF
backend/api/views.py
views.py
py
1,067
python
en
code
0
github-code
90
7298106937
from collections import defaultdict def solve(nb_players, last_marble): state = [0, 1] curr_val = 2 curr_idx = 1 player = 0 scores = defaultdict(int) while curr_val <= last_marble: if curr_val % 1000 == 0: print(curr_val) if curr_val % 23 == 0: curr_idx = (curr_idx - 7) % len(state) rm_val = sta...
LysanderGG/Advent-of-code-2018
day09.py
day09.py
py
1,797
python
en
code
0
github-code
90
18376374369
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C # CreatedDate: 2020-06-25 17:21:17 +0900 # LastModified: 2020-06-25 17:28:09 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): n = int(input()) d = list(map(int, input().split())) d.sort() # print(d) ...
Aasthaengg/IBMdataset
Python_codes/p02989/s803260770.py
s803260770.py
py
518
python
en
code
0
github-code
90
8497984206
#!/usr/bin/env python # Part of TotalDepth: Petrophysical data processing and presentation # Copyright (C) 1999-2011 Paul Ross # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either ver...
agilescientific/logio
logio/LIS/core/test/TestByteConvertTimeSpace.py
TestByteConvertTimeSpace.py
py
10,208
python
en
code
9
github-code
90
18206221109
import sys import math sys.setrecursionlimit(10**7) n, s = map(int, input().split()) a = list(map(int, input().split())) dp = [0 for _ in range(s+1)] dp[0] = 1 for i in range(n): _dp = [0 for _ in range(s+1)] for j in range(s+1): if j+a[i] <= s: _dp[j+a[i]] += dp[j] _dp[j+a[i]]...
Aasthaengg/IBMdataset
Python_codes/p02662/s922292510.py
s922292510.py
py
413
python
en
code
0
github-code
90
18354601506
import copy from .settings import * class Reversi: def __init__(self): self.turn = BLACK self.oppTurn = WHITE self.board = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0,128, 1, 0, 0], [0, 0, 1,128, 0, 0], ...
junkanai/revai
revpy/reversi.py
reversi.py
py
4,378
python
en
code
0
github-code
90
43954685750
from collections import * from itertools import * from functools import * import re arr = [] for l in open("i1"): oo,b = l.split() a,b,c = b.split(",") a0,a1 = a.split("..") b0,b1 = b.split("..") c0,c1 = c.split("..") # add +1 as the input is inclusive and range is used later arr.append((o...
Scheir/AdventOfCode
AoC21/d22/22.py
22.py
py
2,568
python
en
code
0
github-code
90
23241392613
from sys import stdin, stdout def work_width(table: list): tmp: list = list(table) tmp.reverse() for i in tmp: table.append(i) def solution(): r, c = map(int, stdin.readline().rstrip().split()) table: list = list() for _ in range(r): table.append(list(stdin.readline().rstrip(...
anothel/CodeKata
백준/Bronze/3023. 마술사 이민혁/마술사 이민혁.py
마술사 이민혁.py
py
721
python
en
code
1
github-code
90
30380125457
import numpy as np class GeneticAgents(object): def __init__(self, shape=(3, 5), population_size=64, max_num_active_paths=3, seed=None): np.random.seed(seed) self.num_modules, self.num_layers = shape self.max_num_active_paths = max_num_active_paths self.population...
oarriaga/pathnet.keras
src/genetic_agents.py
genetic_agents.py
py
3,073
python
en
code
1
github-code
90
74085718697
from datasets import load_dataset def load_multiwoz_v22(split="train"): """ Splits: ['train', 'validation', 'test'] WARNING ------- NonMatchingChecksumError: Checksums didn't match for dataset source files: https://github.com/huggingface/datasets/issues/1876 use `ignore_verifications...
ErikEkstedt/datasets_turntaking
datasets_turntaking/dataset/conversational/multiwoz_v22.py
multiwoz_v22.py
py
1,487
python
en
code
7
github-code
90
12955736382
# -*- coding: utf-8 -*- """ Created on Wed Jul 11 20:48:18 2018 @author: Ashusan """ x="glbal" def foo(): print("x inside:", x) foo() print("x outside:", x) x="glbal" def foo(): x=x*2 print(x) foo() x="glb" def foo(): global y y="lcl" print(x) foo() print(y) ...
santoshsr19/Python-DS
basics/global_variable.py
global_variable.py
py
672
python
en
code
0
github-code
90
30286359973
from django.shortcuts import render, redirect from bai5.forms import * from bai5.models import * class PublisherController(): def create_publisher(request): if request.method == "POST": form = PublisherForm(request.POST) if form.is_valid(): try: ...
ducminh-2000/demo_bai5_django
demo_bai5/bai5/controller/publisherController.py
publisherController.py
py
1,607
python
en
code
0
github-code
90
30691748350
import sqlite3 sl_conn = sqlite3.connect('demo_data.sqlite3') sl_curs = sl_conn.cursor() create_table = """ CREATE TABLE demo ( s VARCHAR(1), x INTEGER, y INTEGER ); """ insert = """ INSERT INTO demo ( s, x, y) VALUES ('g', 3, 9), ('v', 5, 7), ('f', 8, 7); """ sl_curs.execute(create_table)...
noahh40/sprint-2-unit-3
demo_data.py
demo_data.py
py
898
python
en
code
0
github-code
90
70252598058
import os import struct import binascii import socket import threading from datetime import datetime from time import time, sleep from json import load, loads, dumps from enum import Enum from src.utils import * from src.db_worker import * from src.db_connect import CONN from src.logs.log_config import logger class ...
customr/tracker_receiver
src/protocols/Wialon/Wialon.py
Wialon.py
py
6,421
python
en
code
2
github-code
90
21334362925
from types import * from time import time from numpy import * from numpy.random import normal, uniform, randint, seed from numpy import round arraytype=type(zeros(1)) def nonzero1d(a): return nonzero(a)[0] def armax(a): if NUMARRAY: return a.max() else: return max(ravel(a)) def armin(a): return a.min()...
gic888/MIEN
math/array.py
array.py
py
23,591
python
en
code
2
github-code
90
70156123496
from PySide6.QtCore import QSize from PySide6.QtWidgets import QDialog, QWidget, QLineEdit, QApplication, QVBoxLayout, QLabel, QComboBox, \ QDialogButtonBox from src.pattern_tracking.logic.tracker.AbstractTracker import AbstractTracker from src.pattern_tracking.logic.tracker.TrackerManager import TrackerManager fr...
Wanchai290/tmita-optical-cardyomyocyte-analysis
src/pattern_tracking/qt_gui/top_menu_bar/trackers/NewTrackerQDialog.py
NewTrackerQDialog.py
py
3,904
python
en
code
1
github-code
90
11333023476
import pandas as pd import matplotlib.pyplot as plt import numpy as np import ipdb as ipdb lsvm = pd.read_csv('lsvm.csv') rbfsvm = pd.read_csv('rbfsvm.csv') mlp = pd.read_csv('mlp.csv') lsvm_mean = lsvm.mean() rbfsvm_mean = rbfsvm.mean() mlp_mean = mlp.mean() lsvm_mean = lsvm_mean.values rbfsvm_mean = rbfsvm_mean...
jzm0144/AdversarialML
Project6/calc_final_mask.py
calc_final_mask.py
py
723
python
en
code
1
github-code
90
21784147068
from xlsschema import SchemaXls import numpy as np from xlrd import xldate_as_tuple class SchemaPesi: def __init__(self, file_): self.dati = SchemaXls(file_) self.ncol = self.dati.ncol - 1 self.nrow = self.dati.nrow - 1 self.tab_pesi = np.array([0 for i in xrange(self.nrow * self.n...
pippomuzzo/ucttp_for_fim
server/SchemaPesi.py
SchemaPesi.py
py
1,281
python
en
code
0
github-code
90
15577512673
# Задайте список из n чисел последовательности (1 + 1/n)^n и выведите # на экран их сумму. # Пример: # Для n=4 {1: 2, 2: 2.25, 3: 2.37, 4: 2.44} Сумма 9.06 n = int(input('Введите число-> ')) my_list = list() for x in range (1, n + 1): f = round ((1 + 1 / x) **x, 2) my_list.append(f) print(my_list) pri...
Denis16-07-82/Python2.0
task3.py
task3.py
py
446
python
ru
code
0
github-code
90
28768600176
from leer.core.lubbadubdub.ioput import IOput from leer.core.lubbadubdub.address import address_from_private_key from secp256k1_zkp import PrivateKey keys = [PrivateKey() for i in range(5)] adr1,adr2,adr3,adr4,adr5= [address_from_private_key(keys[i]) for i in range(5)] def test_ioput(): ioput_serialize_deserialize(...
WTRMQDev/leer
leer/tests/lubbadubdub/test_ioput.py
test_ioput.py
py
3,758
python
en
code
5
github-code
90
15523406099
import random from datetime import datetime as dt from fastapi.testclient import TestClient from sqlmodel import Session from app.definitions import EmissionType, EnergyCategory, EnergyLocation from app.models import Energy from app.repositories import EnergyRepository def test_get_consumo_promedio_mensual( cli...
Arkemix30/hack-the-future-api
tests/test_energy_consumo_promedio.py
test_energy_consumo_promedio.py
py
1,220
python
en
code
0
github-code
90
22665904780
import argparse import os from datetime import datetime from tdm.gfs.noaa import noaa_fetcher NOW = datetime.now() def main(args): nf = noaa_fetcher(args.year, args.month, args.day, args.hour) os.mkdir(args.target_directory) nf.fetch(args.requested_resolution, args.target_directory, nthrea...
tdm-project/tdm-tools
tdm/app/gfs_fetch.py
gfs_fetch.py
py
1,981
python
en
code
0
github-code
90
529518182
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ :script:`main_maze` script :author: Coignion Tristan, Tayebi Ajwad, Becquembois Logan :date: 22/11/2018 This script is used to display a maze on a screen Uses: - graphical_maze - tkinter - maze.py - square.py (Dependancy) """ from gra...
Saauan/Maze
src/main_maze.py
main_maze.py
py
33,217
python
en
code
0
github-code
90
6773371406
from astropy.table import Table import astropy.units as u from emmanoulopoulos.emmanoulopoulos_lc_simulation import Emmanoulopoulos_Sampler from emmanoulopoulos.lightcurve import LC import json from json import encoder import logging from pathlib import Path from tqdm import tqdm logger = logging.getLogger(__name__) ...
lena-lin/emmanoulopoulos
scripts/simulate_lightcurves.py
simulate_lightcurves.py
py
1,910
python
en
code
4
github-code
90
73473818536
import logging import multiprocessing from multiprocessing.dummy import active_children from multiprocessing.pool import ThreadPool import os from multiprocessing import Pool, cpu_count, Process, Lock from threading import Thread from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, wait from concurre...
jaytouz/dons-scrapper
src/runner/process.py
process.py
py
5,964
python
en
code
1
github-code
90
73177304935
from verifai.simulators.webots.webots_task import webots_task from verifai.simulators.webots.client_webots import ClientWebots try: from controller import Supervisor except ModuleNotFoundError: import sys sys.exit('This functionality requires webots to be installed') from dotmap import DotMap import numpy ...
BerkeleyLearnVerify/VerifAI
examples/webots/controllers/scenic_cones_supervisor/scenic_cones_supervisor.py
scenic_cones_supervisor.py
py
1,838
python
en
code
152
github-code
90
73884650857
""" ############################################ cv_process.py ########################################### Authors: Marcel Reith-Braun (ISAS, marcel.reith-braun@kit.edu), Jakob Thumm ####################################################################################################### Calculates approximate first pas...
KIT-ISAS/Approx_FPTD_for_Motion_Models
cv_process.py
cv_process.py
py
49,114
python
en
code
1
github-code
90
9738905266
import cv2 import time import numpy as np import logging import json import base64 LOG = logging.getLogger(__name__) LOG.setLevel(logging.INFO) ENGLISH_CHAR_MAP = [ '#', # Alphabet normal 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',...
kibernetika-ai/docnet
open_reader_hook.py
open_reader_hook.py
py
8,070
python
en
code
0
github-code
90
18262487839
n,m = map(int,input().split()) s,c = [0]*m,[0]*m for i in range(m): s[i],c[i] = map(int,input().split()) s[i] -= 1 number = ['0']*n for j in range(m): if number[s[j]] != '0' and number[s[j]] != str(c[j]): print('-1') quit() elif s[j] == 0 and c[j] == 0 and n != 1: print('-1') ...
Aasthaengg/IBMdataset
Python_codes/p02761/s648603241.py
s648603241.py
py
466
python
en
code
0
github-code
90
11944939445
''' https://www.acmicpc.net/problem/10819 문제 ''' from itertools import permutations def permutations_method(ary, n): result = [] # return할 배열 if n == 0: return [[]] if n == 1: result = [[i] for i in ary] return result for i in range(len(ary)): element = ary[i] p...
EcoFriendlyAppleSu/algo
algoStudy/실전문제/차이를_최대로.py
차이를_최대로.py
py
1,138
python
ko
code
0
github-code
90
8705598325
#!/usr/bin/env python3 import json import os import magic import delegator from py2neo import Graph ROOT_FS_PATH = '/Volumes/SkyF19F77.D10D101D20D201OS' LOGFILE = 'uniq_opens.txt' NEO4J_USERNAME = 'neo4j' NEO4J_PASSWORD = 'hunter2' # For AuraDB: NEO4J_HOST = 'neo4j+s://randomly-generated.databases.neo4j.io' # For...
corellium/ios_persistence_mapping
process_opens.py
process_opens.py
py
5,234
python
en
code
7
github-code
90
14023774137
import os import sys root_path = os.path.abspath(os.path.split(__file__)[0]) root_path = os.path.join(root_path, os.pardir, os.pardir) sys.path.insert(0, os.path.join(root_path, 'OpportunityURL')) sys.path.insert(0, root_path) import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "OpportunityURL.settings") d...
VikasNeha/CustomSupplierSolutions_Backend
Scrapers/CA/labavnorg_scraper_old.py
labavnorg_scraper_old.py
py
6,747
python
en
code
0
github-code
90
18038787439
s = str(input()) z = 'YES' while len(s) != 0: if s[:11] == 'dreameraser': s = s[11:] elif s[:10] == 'dreamerase': s = s[10:] elif s[:13] == 'dreamereraser': s = s[13:] elif s[:12] == 'dreamererase': s = s[12:] elif s[:7] == 'dreamer': s = s[7:] elif s[:5] ...
Aasthaengg/IBMdataset
Python_codes/p03854/s566146111.py
s566146111.py
py
490
python
en
code
0
github-code
90
37659066246
#Program to take file of trees and make a csv of the branch lengths #Required packages: #Pandas #Argparse import pandas as pd import argparse class find_branch_lengths: #Controls the running of each of the commands required to make the csv file def __init__(self, tree_file): self.make_...
dekoning-lab/slim-tree
DataPostProcessing/find_branch_lengths.py
find_branch_lengths.py
py
2,646
python
en
code
4
github-code
90
11074853491
import time import functools def benchmark(func): @functools.wraps(func) def wrapper(*args, **kwargs): start = time.perf_counter() return_value = func(*args, **kwargs) end = time.perf_counter() t = end - start name = func.__name__ print(f'Функция {na...
grishenkovp/useful_code
python_timer.py
python_timer.py
py
1,324
python
ru
code
0
github-code
90
21671551738
import sys import pandas as pd import csv import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.utils import shuffle from sklearn import metrics TOURNEY_COLS = ['Season', 'Wteam', 'Wscore', 'Lteam', 'Lscore', 'Wscorediff', 'Lscorediff',...
wang19k/PredictingMarchMadness
game_predictor.py
game_predictor.py
py
10,766
python
en
code
0
github-code
90
16954225168
import cv2 import MobileNetSSDModule as mnssdm cap = cv2.VideoCapture(0) cap.set(3,640) cap.set(4,480) myModel = mnssdm.mnSSD("SSD-Mobilenet-v2", 0.5) while True: success, img = cap.read() objects = myModel.detect(img, True) # img = jetson.utils.cudaToNumpy(imgCuda) cv2.imshow("Image"...
henokali1/Social-Distance-Monitoring
Jetson Nano/prj-files/tst/V0.py
V0.py
py
598
python
en
code
0
github-code
90
24479196046
import mysql.connector #random UID will be done once we have the program ready to go to preven creating duplicate values during testing mydb = mysql.connector.connect( host="localhost", user="root", password="abcd1234", database="arcedia" ) users=[ (1000,"User01","1234","abc@gmail.com","Fulln...
Eshaann-sharma/ecommerce_prototype
PROJECT_E/datagen.py
datagen.py
py
1,076
python
en
code
1
github-code
90
31628164328
''' import threading class Factoriel (threading.Thread): def __init__(self, number, name): threading.Thread.__init__(self) self.number = number self.name = name def run(self): print(f"Thread naziva {self.name} je pokrenut") factoriel = 1 for i in range(1, self....
StVu1991/AlgebraPythonAdvanced
thread_demo.py
thread_demo.py
py
2,011
python
en
code
0
github-code
90
20902147102
import paddle import paddle.fluid as fluid import pdb def normalize(x, axis=-1): x = fluid.layers.l2_normalize(x=x, axis=axis) return x def euclidean_dist(x, y, batch_size): m, n = batch_size, batch_size xx = fluid.layers.elementwise_mul(x, x) xx = fluid.layers.reduce_sum(xx, dim=1, keep_dim=Tru...
PaddlePaddle/Research
CV/PaddleReid/reid/loss/triplet_loss.py
triplet_loss.py
py
2,854
python
en
code
1,671
github-code
90
37368960660
import hashlib class Block: """ Simple block object. """ def __init__(self, index, timestamp, data, previous_hash, nonce, num_zeros): self.index = index self.timestamp = timestamp self.data = data self.previous_hash = previous_hash self.nonce = nonce self...
TooKennySupreme/simple_blockchain
code/resources/block.py
block.py
py
1,148
python
en
code
null
github-code
90
8893710108
import pytest import requests import checks import data.geodata @pytest.mark.reverse class TestSimpleReverse: """Тесты на внутренние ошибки сервера и формат ответа""" @pytest.mark.parametrize('extension', ['xml', 'json', 'jsonv2', 'geojson', 'geocodejson']) def test_send_request_using_format(self, extens...
semenovichelena/Nominatim_API_tests
tests/test_reverse_geocoding.py
test_reverse_geocoding.py
py
1,944
python
ru
code
0
github-code
90
16543228059
import pytest import time import wasp import apps.test import settings def step(): wasp.system._tick() wasp.machine.deepsleep() time.sleep(0.1) wasp.system.step = step wasp.watch.touch.press = wasp.watch.touch.i2c.sim.press wasp.watch.touch.swipe = wasp.watch.touch.i2c.sim.swipe wasp.system.secondary_ini...
wasp-os/wasp-os
wasp/boards/simulator/test_smoke.py
test_smoke.py
py
4,370
python
en
code
752
github-code
90
27222331618
import camera import objects import services from interactions.base.immediate_interaction import ImmediateSuperInteraction from routing import SurfaceIdentifier, SurfaceType from sims4.math import Vector3, Quaternion, Location, Transform, vector_normalize from terrain import get_terrain_height from scripts_cor...
AlinaNikitina1703/Sims4ScriptCore
Scripts/scripts_core/sc_goto_camera.py
sc_goto_camera.py
py
4,881
python
en
code
2
github-code
90
73647883816
# while 문 연습 count = 0 while count < 5: print(count) count = count + 1 # while else 문 연습 count = 0 while count < 5: print(count) count = count + 1 else: print(count) # break 문 연습 count = 0 while count < 5: print(count) count = count + 1 if count == 3: break # continue 문 엽습 #...
freshmea/weizman_python_class
homework/과제3-2_1.py
과제3-2_1.py
py
1,103
python
en
code
5
github-code
90
4466475752
from os import getcwd, path, remove, environ,listdir import random from telnetlib import STATUS from flask import request, jsonify,send_from_directory from werkzeug.utils import secure_filename from app import app,mongo from flask_cors import cross_origin import time from datetime import datetime #now = datetime.n...
TZANDY/SPPLCI
backend/modulos/app/controller/files.py
files.py
py
4,971
python
en
code
0
github-code
90
25086111305
import os import argparse import pickle from dataset import VidOR from tqdm import tqdm import glob dataset_path ='/home/wluo/vidor-dataset' anno_path = os.path.join(dataset_path,'annotation') video_path = os.path.join(dataset_path,'video') frame_path = os.path.join(dataset_path,'frame') local_ffmpeg_path = '/home/wlu...
Robbie-Luo/vidor-i3d
frames.py
frames.py
py
1,577
python
en
code
1
github-code
90
43843917010
""" 根据一棵树的中序遍历与后序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如,给出 中序遍历 inorder = [9,3,15,20,7] 后序遍历 postorder = [9,15,7,20,3] 返回如下的二叉树: 3 / \ 9 20 / \ 15 7 """ # 解答:类似105题的做法,只是把前序改成了后序,而后序最后一位是根节点,仍然用递归来做 # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x ...
wtrnash/LeetCode
python/106从中序与后序遍历序列构造二叉树/106从中序与后序遍历序列构造二叉树.py
106从中序与后序遍历序列构造二叉树.py
py
1,372
python
en
code
2
github-code
90
23061714147
import matplotlib.pyplot as plt import numpy as np def lagranz(x, y, t): """Интерполяция с помощью интерполяционного полинома Лагранжа.""" sum = 0 for i in range(0, len(y)): prod = 1 for j in range(0, len(y)): if i != j: prod *= (t - x[j]) / (x[i] - x[j]) ...
SergeiShumilin/Mth
lagranz_interpolation.py
lagranz_interpolation.py
py
2,235
python
ru
code
0
github-code
90
9205357369
""" Steven Kundert Created on Wed Oct 25 00:11:23 2017 """ # Create a string, this is the example used in the slides S = 'acacag$' # Create an empty list to insert each suffix's beginning index into SA = [] # Put the index for the beginning of the entire string in the list # A list with one item is sorted ...
StevOK/5323-Bioinformatics
suffix_array_sort.py
suffix_array_sort.py
py
730
python
en
code
0
github-code
90
6337642519
#!/usr/bin/env python3 """Conv forward""" import numpy as np def conv_forward(A_prev, W, b, activation, padding="same", stride=(1, 1)): """Performs a convolution on images with channels""" m, h, w, c = A_prev.shape kh, kw, c, nc = W.shape sh, sw = stride if padding == 'valid': ph = 0 ...
luischaparroc/holbertonschool-machine_learning
supervised_learning/0x07-cnn/0-conv_forward.py
0-conv_forward.py
py
1,175
python
en
code
6
github-code
90
18322458699
N,T=map(int,input().split()) ablist=[] bsum=0 for _ in range(N): a,b=map(int,input().split()) ablist.append((a,b)) bsum+=b ablist.sort() dp=[[0]*T for _ in range(N+1)] for i in range(1,N+1): a,b=ablist[i-1] for j in range(T): dp[i][j]=dp[i-1][j] if j-a>=0: dp[i][j]=max(dp[i][j],dp[i-1][j-a]+...
Aasthaengg/IBMdataset
Python_codes/p02863/s984445953.py
s984445953.py
py
487
python
en
code
0
github-code
90
35697504790
# Run ml.py to get machine learning model first # !/usr/bin/env python # coding: utf-8 from flask import Flask, render_template, redirect, request from flask_sqlalchemy import SQLAlchemy import pandas as pd from ie import forecast # Add SQLAlchemy dependencies import sqlalchemy from sqlalchemy.ext.automap import auto...
Thinguyen23/group3_project
apps/myapp.py
myapp.py
py
2,432
python
en
code
0
github-code
90
72318374378
from large_image.constants import SourcePriority from large_image.tilesource import TileSource try: from importlib.metadata import PackageNotFoundError from importlib.metadata import version as _importlib_version except ImportError: from importlib_metadata import PackageNotFoundError from importlib_met...
girder/large_image
sources/dummy/large_image_source_dummy/__init__.py
__init__.py
py
1,223
python
en
code
162
github-code
90
73445603495
#Question Link: https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3421/ k = int(input("Enter the value for K: ")) pList = [] for i in range(1, k+2): c = 1 for j in range(1, i+1): if i == k+1: pList.append(c) c = int(c * (i - j)...
aniyaz/Leet-Practice
pascalTriangle.py
pascalTriangle.py
py
338
python
en
code
0
github-code
90
26593140685
from autobahn.asyncio.wamp import ApplicationSession from autobahn.asyncio.wamp import ApplicationRunner from db.schema import Tickers from db.db_url import db_url from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from asyncio import coroutine import nltk # coins = [['btc', 'bitcoin'], ['...
SamJohannes/polo-analyser
ticker_connection.py
ticker_connection.py
py
2,032
python
en
code
0
github-code
90
37649979421
import os import threading import time import tkinter as tk import tkinter.ttk as ttk from tkinter import filedialog as fd from tkinter.scrolledtext import ScrolledText import tkinter.messagebox import pygame import utils from RecordControl import * import datetime from Login import Login class MainPage(ttk.Frame): ...
pvrtykv/SpeechTranscription
MainPage.py
MainPage.py
py
8,329
python
en
code
0
github-code
90
5975216050
from flask import render_template, flash, redirect, request, url_for, abort from flask.ext.login import login_user, logout_user, login_required, current_user from datetime import datetime from . import issues from forms import IssueForm, CommentForm from ..models import Issue, User, Comment from .. import db @issues.r...
mbithenzomo/bc-6-my-issue-tracker
app/issues/views.py
views.py
py
4,316
python
en
code
0
github-code
90
42045391074
# @Time : 2023.05.19 # @Author : Darrius Lei # @Email : darrius.lei@outlook.com from agent.net import * from agent.algorithm.base import Algorithm from agent.algorithm import alg_util from lib import glb_var import torch class Sarsa(Algorithm): '''State-Action-Reward-State-Action algorithm Notes: -...
DarriusL/DRL-ExampleCode
agent/algorithm/sarsa.py
sarsa.py
py
4,171
python
en
code
4
github-code
90
19020575567
"""COMPUTE THE FID FOR GAN EVALUATION""" from ast import In import tensorflow as tf import numpy as np import math from tensorflow.keras.applications import InceptionV3 from tqdm import tqdm import dataloader from time import time from scipy import linalg from tensorflow.keras.layers import Input, Conv2D, Glo...
parth-shastri/adv_syn_data_aug_cs_lid
frechet_distance.py
frechet_distance.py
py
4,533
python
en
code
0
github-code
90
24651194719
# coding: UTF-8 import sys l1l111l1_opy_ = sys.version_info [0] == 2 l1ll1lll_opy_ = 2048 l1l1l111_opy_ = 7 def l1l11_opy_ (l11l1l_opy_): global l1lll1ll_opy_ l1ll1l1_opy_ = ord (l11l1l_opy_ [-1]) l1l11l11_opy_ = l11l1l_opy_ [:-1] l111lll_opy_ = l1ll1l1_opy_ % len (l1l11l11_opy_) l11111_opy_ = l1l11l11_opy_ [:l111...
FrodoPhil87/Repository.Excalibur
plugin.video.reloadedtv/kappa.py
kappa.py
py
2,020
python
en
code
0
github-code
90
20083477960
import requests import time # import logging import winsound winsound.Beep(600, 1000) url = 'https://cd.jd.com/stocks?callback=jQuery6770117&type=getstocks&skuIds=100028068835%2C100028068843%2C100050087025&area=12_904_907_50559&_=1679997916768' flag = True while flag: r = requests.get(url) print(...
KendrickKan/CPP_NJUST
temptest/test.py
test.py
py
852
python
en
code
4
github-code
90
24018775644
""" 3. Пользователь вводит месяц в виде целого числа от 1 до 12. Сообщить к какому времени года относится месяц (зима, весна, лето, осень). Напишите решения через list и через dict. """ year_periods = { "winter": [12, 1, 2], "spring": [3, 4, 5], "summer": [6, 7, 8], "autumn": [9, 10, 11] } while True: ...
kwazart/python-project
part01-begginer/lesson-02/task_03.py
task_03.py
py
920
python
ru
code
0
github-code
90