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
13271941086
from __future__ import annotations import json from pathlib import Path from typing import TYPE_CHECKING import pytest from pyk.kore.parser import KoreParser from pyk.kore.syntax import And, App, Kore, Or, Pattern, SortVar, kore_term if TYPE_CHECKING: from collections.abc import Mapping from typing import A...
runtimeverification/pyk
src/tests/unit/kore/test_parser.py
test_parser.py
py
4,551
python
en
code
12
github-code
1
30840715674
import random import string import cv2 import os import argparse BASE_DIR = os.getcwd() def cut_img(image, column_num, row_num, prefix_name): """ image: 이미지 경로 column_num: 가로로 자를 갯수 row_num: 세로로 자를 갯수 prefix_name: 고정된 이름 """ if os.path.isdir(os.path.join(BASE_DIR, 'cuted_img')): f...
yyeseull/Assignment
image_cut_merge/cut_image.py
cut_image.py
py
2,100
python
en
code
0
github-code
1
41055670466
from test_tools.example_stubber import ExampleStubber class ConfigStubber(ExampleStubber): """ A class that implements stub functions used by AWS Config unit tests. The stubbed functions expect certain parameters to be passed to them as part of the tests, and raise errors if the parameters are not as...
awsdocs/aws-doc-sdk-examples
python/test_tools/config_stubber.py
config_stubber.py
py
3,153
python
en
code
8,378
github-code
1
43556660305
""" Reverse a 3-digit integer. Example 1: Input: number = 123 Output: 321 Example 2: Input: number = 900 Output: 9 """ class Solution: """ @param number: A 3-digit number. @return: Reversed number. """ def reverseInteger(self, number): numberStr = list(str(number)) tmp = numberStr[...
TripleC-Light/LintCode
37/LintCode.py
LintCode.py
py
521
python
en
code
0
github-code
1
34189951363
import matplotlib.animation as animation from pyparticles.utils.pypart_global import * from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import matplotlib import numpy as np import pyparticles.pset.particles_set as ps import pyparticles.pset.logger as log import pyparticles.animation.animated...
simon-r/PyParticles
pyparticles/main/main.py
main.py
py
11,061
python
en
code
77
github-code
1
34000053425
# n = 10 # a = [4, 5, 7, 2, 7, 4, 8, 3, 9, 3] n = int(input()) a = [int(i) for i in input().split(" ")] a.sort() m = n % 2 alice = 0 bob = 0 while n > 0: if n % 2 == m: alice += a[-1] else: bob += a[-1] a.pop() n -= 1 print(alice - bob)
yojiyama7/python_competitive_programming
atcoder/_old/some/b_card_game_for_two.py
b_card_game_for_two.py
py
273
python
en
code
0
github-code
1
21130305160
from db import DB from crawl import Crawl from goods import Goods from mail import Mail import time import sched class Monitor: def __init__(self, email='1656704949@qq.com', rate=60, note=60 * 60): self.scheduler = sched.scheduler(time.time, time.sleep) self.goods_dict = {} self.db = DB() ...
zhangbincheng1997/mall-monitor
web/monitor.py
monitor.py
py
3,752
python
en
code
10
github-code
1
41291806836
import boto3 from botocore.exceptions import ClientError import json from botocore.vendored import requests dynamodb = boto3.resource('dynamodb', region_name='us-east-1', endpoint_url="https://dynamodb.us-east-1.amazonaws.com") subscriptions_table = dynamodb.Table('test') AWS_REGION = "us-east-1" SUBJECT = "newsApp -...
allexg/newsApp
email-newsletter-Lambda/lambda_function.py
lambda_function.py
py
2,691
python
en
code
0
github-code
1
6142096003
import re class Solution: def myAtoi(self, s: str) -> int: s_array = s.split() if s_array: s_f = s_array[0] if re.match(r'^\+-',s_f): return 0 else: return 0 if re.match(r'\+?(\-?\d+)',s_f): s_fu = re.match(r'\...
fatihtx/practice_codes
myAtoi.py
myAtoi.py
py
1,012
python
en
code
0
github-code
1
5170271632
from os import name from django.shortcuts import render from django.http import HttpResponse from django.core.files.storage import FileSystemStorage from subprocess import run, PIPE import sys ,os import detect from webs.controller import count,data_label from webs.controller import banana_ripe_or_raw,guava_rip...
LoneWolf1999-Th/Fruit_Detect
webs/views.py
views.py
py
2,801
python
en
code
0
github-code
1
17308331819
import os.path import random import urllib.request from duckduckgo_images_api import search def image_download(request, target_dir, max_trials=10): results = search(request) count = len(results['results']) if count == 0: return None for i in range(min(max_trials, count)): #index = rand...
4sunshine/langbox
utils/web.py
web.py
py
699
python
en
code
0
github-code
1
32534904655
# main source file import os from .utils import update_poe_env, check_config import poe class Poe: def __init__(self, bot: str = "capybara"): self.poe_token = check_config() self.poe_proxy = os.getenv('POE_PROXY') self.poe_client = poe.Client(self.poe_token, proxy=self.poe_proxy)...
Mushrr/poe_terminal_chat
poe_terminal_chat/poeterminal.py
poeterminal.py
py
1,322
python
en
code
3
github-code
1
39560119331
import numpy as np import multiprocessing as mp from itertools import repeat import time import pandas as pd # Custom functions from other files we wrote import PSOTestFuncs as tf from PSOInit import pso_init from PSOInit import qpso_init from PSOUpdate import veloc_update from PSOUpdate import point_update from PSOU...
anyapriya/PSO
PSOMain.py
PSOMain.py
py
12,258
python
en
code
0
github-code
1
25142521036
from typing import Any, Dict import argparse import torch import torch.nn as nn import torch.nn.functional as F CONV_DIM = 64 FC_DIM = 128 IMAGE_SIZE = 28 class ConvBlock(nn.Module): """ Simple 3x3 conv with padding size 1 (to leave the input size unchanged), followed by a ReLU. """ def __init__(s...
cluePrints/fsdl-text-recognizer-2021-labs
lab2/text_recognizer/models/cnn.py
cnn.py
py
4,320
python
en
code
null
github-code
1
14240741723
import gym import gymnasium def gym_space_migration(gym_space: gym.Space) -> gymnasium.Space: if isinstance(gym_space, gym.spaces.Discrete): return gymnasium.spaces.Discrete(gym_space.n) elif isinstance(gym_space, gym.spaces.Box): return gymnasium.spaces.Box( low=gym_space.low, ...
DevSlem/recommender-system-rl-tutorial
recsim_env/utils.py
utils.py
py
1,103
python
en
code
0
github-code
1
16565983104
import keras import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential # Dense 全连接层,Activation 激活函数 from keras.layers import Dense, Activation # 优化器 from keras.optimizers import SGD def replace_char(string, char, index): string = list(string) string[index] = char return ''.joi...
1060807523/GitRepositories
code/Mask_RCNN-master/samples/drive/Nonlinear_regression.py
Nonlinear_regression.py
py
2,013
python
zh
code
0
github-code
1
74163824034
import numpy as np from random import * from fractions import Fraction import random def fill(banks,bankNum): borrowers = 0 # go through each row/bank for x in range (0, bankNum): # input user for filling banks line = input() # split input splitLine = line.split() ...
darejester/PythonStudies
bankLoaning/bankLoan.py
bankLoan.py
py
2,072
python
en
code
0
github-code
1
7518399441
import sys from collections import namedtuple, OrderedDict import atexit import logging from absl import flags import gin import numpy as np from pysc2.lib.features import parse_agent_interface_format, SCREEN_FEATURES, MINIMAP_FEATURES, Features, FeatureType from pysc2.env.environment import StepType from pysc2.lib.act...
sati290/sc2ai
sc2ai/environments/sc2env.py
sc2env.py
py
6,301
python
en
code
0
github-code
1
36766820641
""" HTTP client tool for Svom Retries requests with power law delays and a max tries limit @author: henri.louvin@cea.fr """ import threading import time import requests import asyncio import aiohttp import signal # Log import logging log = logging.getLogger('http_client') class HttpClient(threading.Thread): ...
HSF/Crest
crestdb-client/python/cli/crest/io/httpio.py
httpio.py
py
9,021
python
en
code
3
github-code
1
74130368032
import yaml import os import random import numpy as np import pandas as pd from tqdm import tqdm import torch import torchvision from torch.utils.tensorboard import SummaryWriter from utils import get_root from transforms import Resize, ToTensor, BatchRicianNoise, BatchRandomErasing from dataset import DenoisingDa...
cviaai/ADAIR
denoising/train_denoising.py
train_denoising.py
py
9,811
python
en
code
0
github-code
1
34366092564
# -*- coding: utf-8 -*- from builtins import object from PyQt5 import QtCore, QtGui, QtWidgets try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_qgsnewhttpconnectionbase(object): def setupUi(self, qgsnewhttpconnectionbase): qgsnewhttpconnectionbase.s...
kalxas/rasdaman
applications/qgis-wcps/qgis3/QgsWcpsClient1/qgsnewhttpconnectionbase.py
qgsnewhttpconnectionbase.py
py
2,617
python
en
code
4
github-code
1
73062309793
# -*- coding: utf-8 -*- from mrjob.job import MRJob from mrjob.protocol import JSONProtocol, RawValueProtocol from mrjob.step import MRStep import numpy as np ######################## Helper Methods and Classes ########################## def cholesky_solution_linear_regression(x_t_x,x_t_y): ''' Finds par...
AmazaspShumik/MapReduce-Machine-Learning
Linear Regression MapReduce/LinearRegressionTS.py
LinearRegressionTS.py
py
6,517
python
en
code
22
github-code
1
290347917
import requests import re import pymysql from lxml import etree header = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"} reques = requests.get('http://www.open.com.cn/encrollregulation-3333.html', headers=header) reques.encoding = 'u...
zhouf1234/untitled9pachon
测试10.py
测试10.py
py
2,910
python
es
code
1
github-code
1
10258457825
from server import * from functionGen import * from trigger import * from spi import * import math import time import queue import threading import sys class MiddleWare: def __init__(self): self.points = 60 self.living = True self.server = Server() self.spi = Spi(self.points) ...
Typhoone/IEP
BackEnd/src/python/middleWare.py
middleWare.py
py
4,386
python
en
code
0
github-code
1
24390060708
from flask import Flask, make_response from bson.json_util import dumps from models import note import json import pymongo import UserDAO import PlacesDAO import Place import WeatherHour import AlertInfo import WeatherCamLink app = Flask(__name__) app.debug = True connection_string = "mongodb://localhost" connection ...
theNerd247/twcHackathon
app.py
app.py
py
1,188
python
en
code
0
github-code
1
25348338231
# encoding: utf-8 import sys import os import io from managermentFileForqiniu import managerfile import logging import datetime ##log logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',datefmt='%Y %m %d %H:%M:%S',filename='SyncOperation_main.log',file...
weixlkevin/SmartHomekit
SyncOperation.py
SyncOperation.py
py
1,213
python
en
code
0
github-code
1
9345705854
# -*- coding: utf-8 -*- #Za GUI from turtle import Turtle, Screen #Za komunikaciju from socket import socket, AF_INET, SOCK_STREAM #Za multi-threading from _thread import start_new_thread #Za odgodu-vrijeme from time import sleep def primi_thread(c): while True: y = c.recv(500).decode('UTF-8') pad...
jyyblue1987/pingpong_game
server.py
server.py
py
3,901
python
en
code
0
github-code
1
44401912202
import serial import numpy as np import csv device=serial.Serial("/dev/ttyUSB0",230400) distance0=1 distance1=7.5 ##mm arange=np.arange(distance0,distance1,0.1) f= open("data/trail9-5.4mm.csv","w") writer=csv.writer(f) for i in arange: print("Move Slit to: ",str(i)) input("Press enter to continue") ...
cwru-robin/Phys301
Photon Counting/take_data.py
take_data.py
py
532
python
en
code
0
github-code
1
26198111833
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # PYTHON_ARGCOMPLETE_OK """ SVG Templating System (C) Max Gaukler and other members of the FAU FabLab 2013-2022 unlimited usage allowed, see LICENSE file """ from lxml import etree from copy import deepcopy import inspect from io import BytesIO import re import locale im...
fau-fablab/etiketten
svgtemplate.py
svgtemplate.py
py
15,188
python
en
code
2
github-code
1
38793762624
#!/usr/bin/env python # Create status info of ISC DHCPd leases in JSON format. # # Depends on python module netaddr. # Install with pip install netaddr. # Depends on iscconf for parsing dhcpd.conf. # Install with pip install iscconf # Depends on python 2.7 for argparse. # # This was written because dhcpstatus kept...
stemid/devops
tools/dhcpstatus.py
dhcpstatus.py
py
5,321
python
en
code
9
github-code
1
26731665258
#!/usr/bin/env python3.6 """Simulate trees under site + gene + lineage + site x lineage variation.""" import variation import my_module as mod def main(): """Simulate gene trees for genes with gene + lineage + sitexlineage variation. This will involve a base tree for each bin per gene each gene will have...
alanbeavan/simulating_substituion_rate
scripts/s_g_l_sxl.py
s_g_l_sxl.py
py
1,100
python
en
code
0
github-code
1
37458586421
import numpy as np import pandas as pd import time MAX_EPISODES = 13 # 游戏回合 FRESH_TIME = 0.3 # 每步移动的时长 ALPHA = 0.1 # 学习速率 GAMMA = 0.99 # 折减系数 class Maze_Env(): def __init__(self): self.N_STATES = 6 # 一维迷宫的长度 self.ACTIONS = ['left', 'right'] # agient 拥有的操作 def reset(s...
Lufffya/DeepRL
1-1-Q-Learning/simple_maze.py
simple_maze.py
py
3,870
python
en
code
1
github-code
1
31130560486
""" @Filename: core/testcase/test_login.py @Author: 小蔡 @Time: 2022/09/28 20:30 @Describe: ... """ import json import requests # def img2code(file): # url = "http://47.106.70.21:5516/auth/login" # # data = { # "user": "pengjiangchun", # "pass2": "3eb5f9a3a31fb000969e696d7c3cc71f", # ...
15946859495/UI_frame
core/until/funcs.py
funcs.py
py
1,602
python
en
code
0
github-code
1
365934322
import sys from hypothesis.version import __version__ message = """ Hypothesis {} requires Python 3.6 or later. This can only happen if your packaging toolchain is older than python_requires. See https://packaging.python.org/guides/distributing-packages-using-setuptools/ """ if sys.version_info[:3] < (3, 6): # pra...
webanck/GigaVoxels
lib/python3.8/site-packages/hypothesis/_error_if_old.py
_error_if_old.py
py
383
python
en
code
23
github-code
1
41337878373
import pandas as pd from sodapy import Socrata from math import ceil soil_variables = ['ph_agua_suelo_2_5_1_0', 'potasio_k_intercambiable_cmol_kg', 'f_sforo_p_bray_ii_mg_kg'] def create_client(): client = Socrata("www.datos.gov.co", None) return client def get_data(dataset_identifier, **kwargs)...
Juanes7222/Parcial1
API/api.py
api.py
py
2,044
python
en
code
0
github-code
1
30647054410
# -*- coding: utf-8 -*- """ Created on Tue Oct 24 09:27:21 2017 @author: Admin """ import pandas as pd ### READ IN DATA SOURCE ### READ DIFFRENT SECTIONS FOR TRAIN, TEST, PREDICT df_train = pd.read_csv('LMPD_STOPS_DATA_CLEAN_V1_HEADERS.csv', nrows=100000, skipinitialspace=True) # SAve Headers for the next selections...
arkingsolver/SciKit_Learn_LMPD
scikit_linear_citation.py
scikit_linear_citation.py
py
2,314
python
en
code
0
github-code
1
1186013100
# Marty Dang 3/13/18 # This program does the followering: # 1. Takes in an input of a .txt file, as command prompt # 2. It then scans and picks out the individual words # 3. Outputs those words to another file # 4. In that other file, it should append the link of the website with the word # 5. Append all of tha...
flnasc/ricoeur_and_others
code/TopicNavigator/Front-End/javascriptdata.py
javascriptdata.py
py
2,091
python
en
code
1
github-code
1
41171074257
import sys def matrixChainOrderDynamicProgramming(input_array: list, size_of_input: int): ''' Dynamic Programming Python implementation of Matrix Chain Multiplication. See the Cormen book for details of the following algorithm. For simplicity of the program, one extra row and one extra colum...
Rubix982/Algor
apps/base/src/matrix_chain_multiplication.py
matrix_chain_multiplication.py
py
3,479
python
en
code
1
github-code
1
39509611798
T = int(input()) for i in range(1,T+1): N = int(input()) num_list = list(map(int,input().split())) min_value = num_list[0] max_value = num_list[0] for j in num_list: if j <= min_value: min_value = j if j >= max_value: max_value = j ...
choikeunyoung/algorithm
SWEA/파이선 SW 문제해결 기본/1 일차/min_max.py
min_max.py
py
357
python
en
code
1
github-code
1
71921287393
import random # n = no of numbers def randomlist(n): List = [] for i in range(n): List.append(random.randrange(1000)) return List if __name__ == "__main__": List = randomlist(10) print(List)
ariel055132/data-structure
Sorting/LC_sorting/randomList.py
randomList.py
py
220
python
en
code
0
github-code
1
22290846655
import sys from math import inf, cos, sin, pi input = sys.stdin.readline cases, min_rad, max_rad = map(int, input().strip().split()) points = {} def pprint(coords): print("{} {}".format(coords[0], coords[1])) sys.stdout.flush() def find_circle(): res = None coords = [(x, y) for x in ra...
dhrumilp15/Puzzles
codejam/20/1b/p2.py
p2.py
py
3,543
python
en
code
0
github-code
1
42583292052
# derivative of polynomial class Derivative: '''The first derivative of a polynomial in standard algebraic notation.''' def __init__(self, equation, variable="x"): '''Create the polynomial and distinguished the first nomial.''' self._first = equation.split('+')[0] self._variable = var...
guoweier/DSAP_exercise
Chapter2/P-2-33.py
P-2-33.py
py
1,526
python
en
code
0
github-code
1
72152597793
from fastapi import APIRouter, Depends, HTTPException, status, Response from requests import session from controllers.controllers import ReservationController from controllers.exceptions import ReservationException from dependencies import get_token_header from models import models from schemas import schemas from db.d...
Landris18/PamREST
Backend/routers/reservations.py
reservations.py
py
2,557
python
en
code
4
github-code
1
32874145932
""" Link: https://codeforces.com/contest/540/problem/C Time complexity: O(2 * n * m) Space complexity: O(n * m) """ from queue import Queue directions = [(1, 0), (-1, 0), (0, 1), (0, -1)] def bfs(start_r, start_c, end_r, end_c, graph, n, m): q = Queue() q.put((start_r, start_c)) while q.qsize() != 0: ...
hieuducnguyen/BigOCourse
05_bfs/ice_cave.py
ice_cave.py
py
1,173
python
en
code
2
github-code
1
16348260053
import inspect import traceback import uuid import warnings from dataclasses import dataclass, field from datetime import datetime from typing import Any import pyttman from pyttman.core.containers import MessageMixin, Reply from pyttman.core.decorators import LifecycleHookRepository from pyttman.core.mixins import Pr...
Hashmap-Software-Agency/Pyttman
pyttman/core/internals.py
internals.py
py
4,999
python
en
code
7
github-code
1
8966558426
import unittest import os import requests_mock import tableauserverclient as TSC TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets') ADD_TAGS_XML = os.path.join(TEST_ASSET_DIR, 'view_add_tags.xml') GET_XML = os.path.join(TEST_ASSET_DIR, 'view_get.xml') GET_XML_USAGE = os.path.join(TEST_ASSET_DIR, 'view...
srmonteiro/dataFlying
templates/static/server-client-python-0.7/test/test_view.py
test_view.py
py
8,750
python
en
code
1
github-code
1
6331063126
import numpy as np from sklearn.datasets import make_moons import matplotlib.pyplot as plt import neural_network as nn def plot_decision_boundary(pred_func, X, y): x_min, x_max = X[:, 0].min() - 0.5, X[:, 0].max() + 0.5 y_min, y_max = X[:, 1].min() - 0.5, X[:, 1].max() + 0.5 h = 0.01 xx, yy = np.meshgr...
blackz54/cs491project3
driver.py
driver.py
py
1,364
python
en
code
0
github-code
1
16168565185
from datetime import datetime from json import loads from random import choice from shutil import disk_usage def main(): """Main function that returns the values to the shell script that runs this.""" time = datetime.now() time = time.strftime("%m/%d/%Y, %H:%M:%S") print(f"{check_session()} / {get_dis...
pasenidis/ricing
bar/main.py
main.py
py
1,569
python
en
code
0
github-code
1
72212308833
import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from . import MNISTAttack class MNIST_LBFGS(MNISTAttack): def __init__(self, model_class, weights_file, regularization="l2"): super().__init__(model_class, weights_file) assert reg...
FoConrad/NN-Hashing
attacks/mnist_lbfgs.py
mnist_lbfgs.py
py
1,664
python
en
code
0
github-code
1
7116919725
def classPhotos(redShirtHeights, blueShirtHeights): if len(redShirtHeights) != len(blueShirtHeights): return False redShirtHeights.sort(reverse=True) blueShirtHeights.sort(reverse=True) first_row = 'RED' if redShirtHeights[0] < blueShirtHeights[0] else 'BLUE' for idx in range(len(redShirtH...
Theeyecode/python_alg
Easy/class_photo.py
class_photo.py
py
752
python
en
code
0
github-code
1
25082195093
import mysql.connector from mysql.connector import errorcode cnx = mysql.connector.connect(user='USERNAME', database='NAME') cursor = cnx.cursor() query = ("SELECT brand, post, price FROM posts ") cursor.execute(query) for (brand, post, price) in cursor: print("{}, {} {}".format( brand...
SanHacks/Scrape-to-MySQL-Beautifulsoup-python
query.py
query.py
py
368
python
en
code
3
github-code
1
70673994913
import os import shutil import argparse import subprocess import random import pandas as pd import numpy as np import pickle as pkl import scipy as sp import networkx as nx import scipy.stats as stats import scipy.sparse as sparse from torch import nn from torch import optim from torch.nn import functional as F from ...
KennthShang/PhaBOX
main.py
main.py
py
55,258
python
en
code
16
github-code
1
14651838374
# Time Complexity - O (n * log n) def left(i): return 2*i + 1 def right(i): return 2*i + 2 def heapify(arr, n, i, max_min): if max_min == 'max': def comp(ele,large): return ele > large elif max_min == 'min': def comp(ele, small): return ele < small else: ...
DhruvSrikanth/Algorithms
Sorting/heap_sort.py
heap_sort.py
py
1,326
python
en
code
0
github-code
1
22623785092
import logging import time import socket import config import json import sys if config.API_ENABLED: if sys.version_info >= (3, 0): # If using python 3, use urllib.parse and urllib.request instead of urllib and urllib2 from urllib.parse import urlencode from urllib.request import Request, u...
ZuopanYao/TravelNetwork
shadowsocks-py-mu/shadowsocks/dbtransfer.py
dbtransfer.py
py
12,012
python
en
code
0
github-code
1
24551877733
# -*- coding: utf-8 -*- """ runserver ~~~~~~~~~ 로컬 테스트를 위한 개발 서버 실행 모듈. """ import sys from photolog import create_app # 한글 설정관련 세팅 reload(sys) sys.setdefaultencoding('utf-8') application = create_app() if __name__ == '__main__': print('starting test server......') application.run(host='0.0...
niceman5/pywebapp
pyapp/photolog/runserver.py
runserver.py
py
398
python
ko
code
0
github-code
1
70735315874
# %% import os import glob import random import monai from os import makedirs from os.path import join from tqdm import tqdm from copy import deepcopy from time import time import numpy as np import torch from torch.utils.data import Dataset, DataLoader from datetime import datetime import cv2 import argparse from mat...
bowang-lab/MedSAM
comparisons/DeepLabV3+/train_deeplabv3_res50.py
train_deeplabv3_res50.py
py
8,501
python
en
code
1,269
github-code
1
19209564635
from tkinter import * import matplotlib.pyplot as plt from PIL import ImageFilter,Image import numpy as np #import cv2 from IPython import get_ipython import pyperclip def input_emnist(st): #opening the input image to be predicted im_open = Image.open(st) im = Image.open(st).convert('LA') #conversi...
sg1498/EMNIST
final_PROJECT_KERAS.py
final_PROJECT_KERAS.py
py
6,648
python
en
code
1
github-code
1
38386534113
# Szimuláljuk a dobókockadobást! 1-6 from random import choice, randint, shuffle # randint fgv nem build-in function # randint függvény a standard libary része number = randint(1, 6) print(number) numbers = [2, 4, 6, 8] shuffle(numbers) print(numbers) cards = ["alsó", "felső", "király", "ász"] card = choice(cards) ...
aszabo25/python-training
random_samples.py
random_samples.py
py
342
python
en
code
0
github-code
1
9670033772
from ab5 import hgratient from typing import Optional import colorama import sys from pystyle import Center, Colorate, Colors, Write import tls_client import os def setTitle(title: Optional[any] = None): os.system("title "+title) setTitle("BitBoost V2 | Server Booster") def clear(): if sys.platform in ["linux...
BitStore-dev/BitBoost
BitBoost.py
BitBoost.py
py
4,595
python
en
code
84
github-code
1
22239787685
import numpy as np import codecs import sys import logging from nns import RecurrentNN from utils import Timer from dataproviders import TwitterApiDataProvider, TwitterTrainingDataProvider, DatasetBuilder logging.basicConfig(stream=sys.stderr) logger = logging.getLogger("root") logger.setLevel(logging.DEBUG) timer = T...
mishadev/stuff
tensorflow_tests/scripts/main.py
main.py
py
2,247
python
en
code
0
github-code
1
4767963304
class Variant: def __init__(self, name: str, filename: str, rarity: float, shouldExcludeInDifference = False, layersToExclude: 'list[str]' = [] ): """ :param name: name of variant :param filename: name of file with extension :param rarity: rarirty from 0-1 """ self.n...
kbhutani0001/generative-nft
Variant/__init__.py
__init__.py
py
507
python
en
code
8
github-code
1
264626137
from django.urls import path from . import views urlpatterns = [ path('school_list/', views.schList, name='schList'), #院校列表展示 path('edit_sch/', views.editSch, name='editSch'), #编辑院校信息 path('update_sch/', views.updateSch, name='updateSch'), path('detail_sch/', views.detailSch, name='detailSch'),...
zhouf1234/django_obj
school/urls.py
urls.py
py
2,415
python
kn
code
0
github-code
1
28558110791
from django.http import HttpResponse import json from .models import MailingList, MailingListGroup def listinfo(request): resp = HttpResponse(content_type='application/json') groupdata = [{ 'id': g.id, 'name': g.groupname, 'sort': g.sortkey, } for g in MailingListGroup.objects.al...
postgres/pgweb
pgweb/lists/views.py
views.py
py
642
python
en
code
66
github-code
1
897774222
from pwn import * r=remote('172.16.7.10',9007) elf=ELF('bin7') read_addr=0x806e070 fakeret_addr=0x8048999 ROP1='' ROP1+='lljjjllkklljjjjjjhhhjjjlllllll' ROP1+='x'*0x2c ROP1+=p32(read_addr) ROP1+=p32(fakeret_addr) ROP1+=p32(0) ROP1+=p32(elf.bss()) ROP1+=p32(len(asm(shellcraft.sh()))) r.recvuntil('(h...
Cossack9989/SEC_LEARNING
PWN/2018BCTF/BCTF_Final2018_AI_binStack/bin7.py
bin7.py
py
533
python
en
code
13
github-code
1
33810970716
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 9 17:19:35 2020 Class Message - Access to elements of a message dict in ReDial - Methods: - @author: nicholas """ import json from nltk.tokenize import word_tokenize from nltk.stem.porter import PorterStemmer imp...
Vachonni/ReDial
Objects/Message.py
Message.py
py
4,340
python
en
code
0
github-code
1
170088954
# -*- coding: utf-8 -*- ''' /************************************************************************************************************************** SemiAutomaticClassificationPlugin The Semi-Automatic Classification Plugin for QGIS allows for the supervised classification of remote sensing images, provid...
jem0101/BigSwag-SQA2022-AUBURN
TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/semiautomaticgit@SemiAutomaticClassificationPlugin/maininterface/GOESTab.py
GOESTab.py
py
11,658
python
en
code
2
github-code
1
9122061868
import numpy as np import pandas as pd import matplotlib.pyplot as plt import time import argparse import os import datetime from algorithms.kmeans import KMeans from algorithms.kmeanspp import KPlusPlus from algorithms.kmeansgraph import KMeansGraph from algorithms.kmeans_sa import KMeans_SA if __name__ == '__main__...
alepmaros/k-means
main.py
main.py
py
6,439
python
en
code
0
github-code
1
40316461163
from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import filedialog from tkinter import scrolledtext import time, datetime import threading import logging import soundfile as sf import numpy as np import os window = Tk() window.geometry('450x520') window.title('INotepad.cloud - Phần mềm ...
truyentdm/Apps
MergeAudio/MergeAudio.py
MergeAudio.py
py
4,725
python
en
code
1
github-code
1
16555099455
from copy import deepcopy from functools import reduce import numpy as np class Chromosome: def crossover(self, other): pass def mutate(self, step=None): pass def evaluate(self): pass class FloatChromosome(Chromosome): def __init__(self, ll, ul, degree, pm, b, crossover_fu...
hrkec/APR
Lab4/chromosome.py
chromosome.py
py
2,957
python
en
code
0
github-code
1
73506504353
from django.shortcuts import redirect, render from django.http import HttpResponse from apps.Habitacion.models import Habitacion from apps.Habitacion.form import HabitacionForm # Create your views here. def home(request): return render(request, 'base/base.html') def index(request): habitacion = Habit...
Daniel-Vega-Rojas/Actividad08_base
apps/Habitacion/views.py
views.py
py
1,899
python
es
code
1
github-code
1
3243322415
# Residual Dense Network for Image Super-Resolution # https://arxiv.org/abs/1802.08797 from functools import partial import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from model import common from model.matrix import * def make_model(args, parent=False): return MetaRDN(args)...
miracleyoo/Meta-SSSR-Pytorch-Publish
model/metafrdn.py
metafrdn.py
py
8,590
python
en
code
4
github-code
1
34660031378
# -*- coding: utf-8 -*- import logging import os import unittest from linkml.generators.pythongen import PythonGenerator from linkml_runtime import SchemaView from linkml_owl.util.loader_wrapper import load_structured_file from linkml_owl.dumpers.owl_dumper import OWLDumper from funowl.converters.functional_converter ...
linkml/linkml-owl
tests/test_examples/test_rpg.py
test_rpg.py
py
1,849
python
en
code
9
github-code
1
38833144048
import random import sys import argparse import numpy as np import os class subset_sum_data: def __init__(self, file_name='./determ_data/mazes.npz', max_length=8, range_min=3, range_max=10): self.file_name = file_name self.range_min = range_min self.range_max = range_max ...
dadadaOrange/Combinatorial-Optimazation-Project
data_generation.py
data_generation.py
py
3,338
python
en
code
0
github-code
1
28303693280
# Write py4DSTEM formatted .h5 files. # # See filestructure.txt for a description of the file structure. import h5py import numpy as np from collections import OrderedDict from os.path import exists from os import remove as rm from .read_utils import is_py4DSTEM_file, get_py4DSTEM_topgroups from .metadata import meta...
magnunor/py4DSTEM
py4DSTEM/io/native/write.py
write.py
py
13,944
python
en
code
null
github-code
1
42865082927
from flask import Flask, request, render_template import numpy as np import pandas as pd #import xgboost as xgb import joblib model = joblib.load('xgb_model.sav') app = Flask(__name__) @app.route('/') def home(): return render_template('home.html') @app.route('/prediction', methods=[ 'POST']) def prediction(): ...
riyag25/Customer-Churn-Prediction
app.py
app.py
py
2,912
python
en
code
0
github-code
1
11698126912
from cgi import test import torch import dataset import model import numpy as np import os import argparse device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") parser = argparse.ArgumentParser() parser.add_argument("--dataset_name", default='PeMSD8', help='Dataset Name', type=str) args = parser.pars...
gortwwh/GMTSCLR
pretrain_vae.py
pretrain_vae.py
py
1,271
python
en
code
0
github-code
1
32196524176
""" Screen scraper for NYC Landmarks Preservation Commission data, as found on citylaw.org. To replicate what this scraper does, go here: http://www.nyls.edu/centers/harlan_scholar_centers/center_for_new_york_city_law/cityadmin_library/ Check the "LANDMARKS" checkbox, then enter "cofa" in the search keywords box a...
brosner/everyblock_code
everyblock/everyblock/cities/nyc/landmarks/retrieval.py
retrieval.py
py
6,333
python
en
code
130
github-code
1
18084590411
import datetime,requests import pickle from pathlib import Path import requests import streamlit as st from streamlit_lottie import st_lottie import json import ssl,os,urllib import altair as alt import pandas as pd import numpy as np from matplotlib import pyplot as plt from PIL import Image from io import BytesIO # ...
williamc1998/ml-test
azuredash.py
azuredash.py
py
4,844
python
en
code
0
github-code
1
37689030555
from tax_calculator import TaxCalculator from format_handler import CentRounder class PayCalculator: def __init__(self, hourly_rate: int, hours_worked: int, tfn: int, threshold_claimed: bool, residence: str): self.gross_pay = self.__calculate_gross(hourly_rate, hours_worked) self.tax_amount = self....
paigegoldhagen/cedarwood-docs
src/pay_calculator.py
pay_calculator.py
py
3,298
python
en
code
0
github-code
1
72387689634
from itertools import permutations def solution(N, number): answer = 0 # 0도 포함이기 때문 dp = [[] for _ in range(9)] # 최소 개수는 자신 빼기 자신 dp[1] = [N] dp[2] = [int(str(N)+str(N)),N+N,N-N,int(N/N),N*N] print('') for i in range(3,9): for j in combi_list(i): for k ...
cafe-jun/codingTest-Algo
N번째수_신준석.py
N번째수_신준석.py
py
2,096
python
ko
code
0
github-code
1
23029378005
def main(): positive_examples_path = "org_id.csv" positive_examples = set() with open(positive_examples_path, 'r') as file: positive_examples = {line.strip() for line in file.readlines()} lacA_examples_path = "lacA.csv" lacY_examples_path = "lacY.csv" lacZ_examples_path = "lacZ.csv" ...
alex-medvedev-msc/operons
negative_set.py
negative_set.py
py
1,037
python
en
code
0
github-code
1
15767671976
from pyspark import SparkConf, SparkContext import collections conf = SparkConf().setMaster("local").setAppName("RatingsHistogram") sc = SparkContext(conf=conf) lines = sc.textFile("file:///SparkCourse/ml-100k/u.data") popular_movies = lines.map(lambda x: (int(x.split()[1]), 1)).reduceByKey(lambda x, y: x+y) popular_...
TalhaAsmal/Taming-Big-Data-Pyspark-Udemy
popular-movies.py
popular-movies.py
py
520
python
en
code
0
github-code
1
26573286125
import torch import torchvision import numpy as np from torchvision import datasets import torchvision.transforms as transforms from torch.utils.data.sampler import SubsetRandomSampler import torch.optim as optim import torchvision.models as models from torchvision.utils import make_grid import time import copy class ...
Constanter/Kaggle
ComputerVision/ImageClassification/FlowersRecognition/PytorchSolution/main.py
main.py
py
7,551
python
en
code
0
github-code
1
71464292195
import pandas as pd import plotly.express as px from plotly.subplots import make_subplots import plotly.graph_objs as go df = pd.read_csv('data/info_data_job_market_research.csv') def graph_npuestos_ciudad(df): df_ub_da = df[df['Tipo puesto'] == 'Data Analyst'] df_ub_da = df_ub_da['Ubicación'].copy() d...
cespanac/ds_job_market_research
graphs.py
graphs.py
py
8,698
python
en
code
2
github-code
1
71217212195
import keyboard import time each_line = input("What to spam") amount = int(input("How many times")) print("you have 5 seconds to open whatever you want to spam") time.sleep(5) for i in range (1, amount): keyboard.write(each_line) keyboard.press('enter') print("Done")
GnomeyDev/PythonScripts
UniSpammer1.py
UniSpammer1.py
py
296
python
en
code
0
github-code
1
74916500834
import math from trajectories.point import Point from trajectories.trajectory import Trajectory class Frechet: def __init__(self, traj1, traj2): self.P = traj1 self.Q = traj2 self.LF = dict() self.LR = dict() self.BF = dict() self.BR = dict() self.eps = [] ...
donsheehy/geomcps
trajectories/frechet.py
frechet.py
py
13,278
python
en
code
1
github-code
1
43621128939
import glob import os import random import shutil dataset_name = 'flower_dataset' dataset_name_after = 'flower_dataset_imagenet' base_path = os.path.join('..', dataset_name) divide_path = os.path.join('..', dataset_name_after) train_percentage = 8 / (8 + 2) val_percentage = 2 / (8 + 2) # 将文件按照对应比例划分为训练集和测试集 def sh...
Brian417-cup/OpenMMLabCamp
flower/data_dealing/divide_train_and_val.py
divide_train_and_val.py
py
2,292
python
en
code
1
github-code
1
71705104033
#!/usr/bin/env python import sys import json import logging import pika from os import environ from artnet import dmx from os.path import realpath, dirname, join class ArtNetTransmitter(object): FPS = 15 ARTNET_BROADCAST_IP = "2.255.255.255" RABBIT_HOST = '192.168.0.42' def __init__(self): sel...
arbalet-project/frontage-artnet
transmitter.py
transmitter.py
py
4,257
python
en
code
0
github-code
1
17540865999
import torch import scanpy as sc import numpy as np import pytorch_lightning as pl from sklearn.preprocessing import LabelEncoder, OneHotEncoder from torch_geometric.data import HeteroData, InMemoryDataset from torch_geometric.loader import DataLoader from data.helpers import downsample_adata, check_normalized class ...
srdsam/TranscriptomicsGNN
data/CellGeneDataset.py
CellGeneDataset.py
py
4,055
python
en
code
0
github-code
1
24618527866
import os import sys import numpy as np import pandas as pd pd.options.display.float_format = "{:,.2f}".format import logging from datetime import datetime, timedelta from features import quantize # from __main__ import logger_name logger_name = "simple_average" log = logging.getLogger(logger_name) class SimpleAv...
aleksei-mashlakov/parking-forecast
src/PMV4Cast/simple_average.py
simple_average.py
py
2,470
python
en
code
1
github-code
1
20356849460
from copy import deepcopy from tqdm import tqdm class Tokenizer: """ 两种数据类型的映射的抽象类 """ def tokenize_A2B(self,data):pass def tokenize_B2A(self,data):pass class DictTokenizer(Tokenizer): def __init__(self,data2label): """ 输入字典构建词典 如果是一对一的话构建反向词典 ...
ReturnTR/PytorchModelCode
CommonTools/TorchTool.py
TorchTool.py
py
2,338
python
en
code
0
github-code
1
2837694708
#!/usr/bin/env python from setuptools import setup, find_packages version = __import__('pipetter').VERSION setup( name='Pipetter', version='.'.join([str(v) for v in version]), description='Uniform registration and processing of inclusion tags for information pulled from other sources, such as websites.', pac...
melinath/django-pipetter
setup.py
setup.py
py
430
python
en
code
16
github-code
1
10471860826
from time import sleep print('Carregando...') i = 0 while i < 10: print('{}...'.format(i+1)) i += 1 sleep(0.25) print() c = -1 Sum = 0 while i != 0: i = int(input('Idade: ')) Sum += i c += 1 med = Sum/c print('\nMédia: {}'.format(med)) print('O último valor não é considerado\n')
pedroivoal/CursoEmVideo
Python/al.14.Estrutura de Repetição (while) (colorido)/00.txt.py
00.txt.py
py
311
python
pt
code
0
github-code
1
11507239217
import numpy as np from scipy import io import matplotlib.pyplot as plt import hio import dynamic_support import Error_Reduction # 讀檔 filepath = 'D:\IP_20220311_25a\IP_20220311\patched_rawdata_20220311.mat' patch_data = io.loadmat(filepath) measured_intensity = (patch_data['sym_rawdata']) measured_amp = np.sqrt(measure...
github-ywtsai/PyCDI
IP_HIOpack.py
IP_HIOpack.py
py
4,836
python
en
code
0
github-code
1
18310305703
#Trapping Rain Water #Naive approach def trappingWater(arr,n): #Code here res=0 for i in range(1,n-1): left=arr[i] for j in range(i): left=max(left,arr[j]) right=arr[i] for k in range(i+1,n): right=max(right,arr[k]) res=res+(min(left,righ...
Kush999/DSA-sheet
arrays/Trapping_water.py
Trapping_water.py
py
399
python
en
code
0
github-code
1
411212400
# pylint: disable=W0621,C0114,C0116,W0212,W0613 import pathlib import textwrap import pytest from dae.annotation.annotation_pipeline import AnnotatorInfo, AttributeInfo from dae.annotation.annotation_factory import AnnotationConfigParser from dae.genomic_resources import build_genomic_resource_repository from dae.geno...
iossifovlab/gpf
dae/dae/annotation/tests/test_annotation_pipeline_config.py
test_annotation_pipeline_config.py
py
13,205
python
en
code
1
github-code
1
10236991454
from __future__ import division import argparse import logging import os import random import time import torch import torch.nn as nn import torch.optim as optim from torch import FloatTensor from torch.autograd import Variable, grad from torch.utils.data import DataLoader import torchvision.utils as vu...
CirQ/AnimeNet
main.py
main.py
py
10,620
python
en
code
0
github-code
1
27592570260
__author__ = 'Grishnak' import libtcodpy as libtcod from button import * from check_box import * from color_text import * from dialog_box import * from inventory import * def get_centered_text(text, width): head = text s = len(head) pos = width - s/2 return head, pos class HotBar(): def __init__(s...
GrishdaFish/Ascension
utils/menus/hot_bar.py
hot_bar.py
py
6,653
python
en
code
2
github-code
1
71009697633
######################################################################################################################## # Problem 22: Names Scores ######################################################################################################################## # Using names.txt (right click and 'Save Link/Targ...
jorisroovers/project_euler
problem22/solution.py
solution.py
py
1,723
python
en
code
0
github-code
1
32509475909
import VAPublishUtil as VAUtil import EchoItemXML import os __author__ = 'Administrator' def echo_all(): """重新生成所有版本的配置文件""" for xml_node in VAUtil.PUBLISH_CONFIG_DOC.findall("feature"): branch_dir = xml_node.get("branchDir") feature_dir = os.path.join(VAUtil.PRE_PUBLISH_ROOT_DIR, branch_dir...
jiaox99/publishTools
pythonScripts/ReEchoAllItem.py
ReEchoAllItem.py
py
700
python
zh
code
3
github-code
1