seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
916481756
# find the value that a given monkey will scream: def solve_monkey(monkey, solved_monkeys, unsolved_monkeys): if monkey in solved_monkeys: return solved_monkeys[monkey] monkey_math = unsolved_monkeys[monkey].split(' ') left = solve_monkey(monkey_math[0], solved_monkeys, unsolved_monkeys) right =...
UncatchableAlex/advent2022
solutions/day21.py
day21.py
py
3,622
python
en
code
0
github-code
6
72532883709
import os from pathlib import Path import s4l_v1 import s4l_v1.analysis.viewers as viewers import s4l_v1.document as document import s4l_v1.model as model import s4l_v1.simulation.emfdtd as fdtd import s4l_v1.units as units from dotenv import load_dotenv from osparc_isolve_api import run_simulation from s4l_v1._api.ap...
ITISFoundation/osparc-simcore
tests/public-api/examples/s4l_tutorial.py
s4l_tutorial.py
py
3,834
python
en
code
35
github-code
6
33197235075
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import glob import pcraster as pcr import raster_func # set the clone map to the regional/local model clone_map_filename = "/scratch-shared/edwinhs/colombia_model_results/head/l1_top/head_20000101_l1.idf.map" pcr.setclone(clone_map_filename) # start a...
edwinkost/groundwater_model_comparison
comparing_and_evaluating_maps/etc/compare_and_evaluate_not-finished.py
compare_and_evaluate_not-finished.py
py
1,949
python
en
code
0
github-code
6
16813784584
import os import copy from typing import Dict import numpy as np import torch from collections import defaultdict from hsp.algorithms.population.policy_pool import PolicyPool from hsp.runner.shared.base_runner import make_trainer_policy_cls from hsp.utils.shared_buffer import SharedReplayBuffer from hsp.algorithms.popu...
samjia2000/HSP
hsp/algorithms/population/trainer_pool.py
trainer_pool.py
py
15,925
python
en
code
15
github-code
6
38744507299
import vidcap import pygame from baselines.ppo1.mlp_policy import MlpPolicy from baselines.trpo_mpi import trpo_mpi import gym import monkeywars import wrappers import numpy as np import time import tensorflow as tf from baselines import deepq def main(): env = monkeywars.Monkeywars(graphic_mode=True) w...
battuzz/RL_lab
monkeywars/enjoy_monkeywars.py
enjoy_monkeywars.py
py
2,459
python
en
code
0
github-code
6
34839802828
# -*- coding: utf-8 -*- """ Created on Tue Sep 21 01:32:51 2021 @author: vidhy """ from fastapi import FastAPI, File, UploadFile, Request import uvicorn import numpy as np from io import BytesIO from PIL import Image import requests from starlette.middleware.cors import CORSMiddleware from starlette.responses import ...
VidhyaGupta/Potato-Disease-Classification
api/main-tf-serving.py
main-tf-serving.py
py
1,938
python
en
code
0
github-code
6
45135866644
# code by : dev patel # https://www.github.com/dev22419/ i = 0 while i <= 5: x = input("enter a letter : ") x.lower() if x in ["a","e","i","o","u"]: print("it is an vowel . ") i = 6 else : print("you entered an constant . ")
dev22419/msu
pro/python/a7/24.py
24.py
py
266
python
en
code
1
github-code
6
29546474630
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def _new_id(self): # get an id from auto-increment self.cur_id += 1 return self.cur_id def _...
HeliWang/upstream
Tree/BST/find-dup-subtree.py
find-dup-subtree.py
py
1,870
python
en
code
0
github-code
6
8631033228
import tkinter DEFAULT_FONT = ('Helvetica', 14) ################################################### ############GAME OPTIONS CLASS##################### ################################################### class GameOptions: def __init__(self): ''' initialises GameOptions ''' ...
bsmorton/Othello
othello_prompt.py
othello_prompt.py
py
6,226
python
en
code
0
github-code
6
11782658861
# -*- coding: utf-8 -*- from random import randint class StaticAnswers: """ collection of callable static/ semi-static strings """ def __init__(self, nick=""): self.nickname = nick self.helpfile = { 'help': '!help -- display this text', 'version': '!version domain.tld -- receive XMPP server version', ...
mightyBroccoli/xmpp-chatbot
common/strings.py
strings.py
py
1,618
python
en
code
7
github-code
6
2026763119
import hashlib import os import shutil import zipfile import numpy as np def extract_aab(aab_file, extract_dir): """ 解压aab文件到指定目录 :param aab_file: aab文件路径 :param extract_dir: 解压目录 """ with zipfile.ZipFile(aab_file, 'r') as z: print(extract_dir) z.extractall(extract_dir) def g...
Nienter/mypy
personal/aabcom.py
aabcom.py
py
2,731
python
zh
code
0
github-code
6
40467524976
def solution(e, starts): num = [0 for _ in range(e+1)] # end까지 개수 저장하기 for i in range(1, e+1): for j in range(i, e+1): idx = i * j # j * k가 e보다 크다면 break if idx > e: break # 숫자가 동일한 경우 1 증가 if i == j: num[id...
Cho-El/coding-test-practice
프로그래머스 문제/파이썬/연습문제/억억단을 외우자.py
억억단을 외우자.py
py
739
python
ko
code
0
github-code
6
9424927662
APPNAME = "Aislinn" VERSION = "0.0.1" from waflib import Utils BIN_FILES = [ "bin/aislinn", "bin/aislinn-cc", "bin/aislinn-c++", "bin/mpicc", "bin/mpicxx" ] def options(ctx): ctx.load("compiler_cc python") def configure(ctx): ctx.load("compiler_cc python") if not ctx.env.CFLAGS: ...
spirali/aislinn
wscript
wscript
638
python
en
code
10
github-code
6
18680639270
import collections import torchvision.transforms as transforms import os import json try: from IPython import embed except: pass _DATASETS = {} Dataset = collections.namedtuple( 'Dataset', ['trainset', 'testset']) def _add_dataset(dataset_fn): _DATASETS[dataset_fn.__name__] = dataset_fn return...
awslabs/aws-cv-task2vec
datasets.py
datasets.py
py
12,841
python
en
code
96
github-code
6
1909072931
from pprint import pprint from config_loader import try_load_from_file from hpOneView.oneview_client import OneViewClient # To run this example fill the ip and the credentials bellow or use a configuration file config = { "ip": "<oneview_ip>", "credentials": { "userName": "<oneview_administrator_name>...
HewlettPackard/python-hpOneView
examples/uplink_sets.py
uplink_sets.py
py
3,986
python
en
code
86
github-code
6
2000640644
import webapp2 import jinja2 from google.appengine.api import users from google.appengine.ext import ndb import os from snippets import Words # from Tkinter import * JINJA_ENVIRONMENT=jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], autoescape=True ) ...
yolo117/Anagram-Checker
add.py
add.py
py
5,784
python
en
code
0
github-code
6
24287696833
def reachable(nums): i = 0 while i < len(nums) - 1: if nums[i] == 0: return False else: i += nums[i] if i == len(nums) - 1: return True return False def main(): assert reachable([1, 3, 1, 2, 0.1]) assert not reachable([1, 2, 1, 0,...
ckallum/Daily-Coding-Problem
solutions/#192.py
#192.py
py
365
python
en
code
0
github-code
6
19601208421
import sublime import sublime_plugin import re class Divideipv4segmentsCommand(sublime_plugin.TextCommand): def run(self, edit): full_select = sublime.Region(0, self.view.size()) splitted = self.view.split_by_newlines(full_select) text_archive = [] for text_line in splitted: text = self.view.substr(text_...
opendefinition/Threathunterspack
divideipv4segments.py
divideipv4segments.py
py
864
python
en
code
0
github-code
6
6581285508
from django.http import HttpResponse from django.http import HttpResponse import requests from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt import uuid reference_id = uuid.uuid4() def login(request): url = "https://test.cashfree.com/api/v1/order/create" pa...
Gunarjith/verceldeploy
masterlink/views.py
views.py
py
1,350
python
en
code
0
github-code
6
29210359176
import streamlit as st from PIL import Image import numpy as np def app(): display = Image.open('./Attendance-management.jpg') display = np.array(display) st.image(display) st.markdown(""" <style> .font { font-size:20px ; font-family: 'Cooper Black'; text-align: center; color: #00000...
dest-royer02/Attendance_Application
pages/welcomePage.py
welcomePage.py
py
468
python
en
code
1
github-code
6
38416857272
from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from core.models import * from recipe.serializers import RecipeSerializer, RecipeDetailSerializer RECIPE_URL = reverse('recipe:re...
deveshp530/recipe-app-api
app/recipe/tests/test_recipe.py
test_recipe.py
py
6,459
python
en
code
0
github-code
6
43111552824
from typing import Any, Dict, Iterable import pandas as pd from fugue import DataFrame, FugueWorkflow, PandasDataFrame, out_transform, transform from fugue.constants import FUGUE_CONF_WORKFLOW_CHECKPOINT_PATH def test_transform(): pdf = pd.DataFrame([[1, 10], [0, 0], [1, 1], [0, 20]], columns=["a", "b"]) d...
ofili/Wrangle-and-Analyze-Data
venv/Lib/site-packages/tests/fugue/test_interfaceless.py
test_interfaceless.py
py
3,306
python
en
code
0
github-code
6
41348833415
# Configuration file for the Sphinx documentation builder. # root_doc = 'index' master_doc = 'index' # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ---------------------------------------------------...
aureliusenterprise/doc_technical_manual
DOc/docs/source/conf.py
conf.py
py
1,408
python
en
code
0
github-code
6
8372518963
import pycosat from pprint import pprint # number of cells in sudoku NUM_CELLS = 81 # this can be used to interate all squares subset in 3x 3 # V V V # 1 2 3 4 5 6 7 8 9 #> 1 |0 0 0| 0 0 0| 0 0 0| # 2 |0 0 0| 0 0 0| 0 0 0| # 3 |0 0 0| 0 0 0| 0 0 0| # --------------------- #> 4 |0 0 0| 0 0 0| 0 ...
macartur/programming_ai
sudoku.py
sudoku.py
py
6,456
python
en
code
0
github-code
6
35430507994
# HOHMANN GUI # A GUI version of HOHMANN BASIC. # Basic program to calculate a Hohmann transfer between two coplanar, circular orbits. # The altitudes of the two orbits are defined by user input. # --------------------------------------------------- # Imports from orbit_toolbox import hohmann, Transfer from bodies_too...
weasdown/orbit-toolbox
Hohmann_GUI.py
Hohmann_GUI.py
py
2,090
python
en
code
0
github-code
6
18481259162
import time from roman_integer import Roman def check_for_higher_numerals(numeral): if "_I_V" in numeral: numeral = numeral.replace("_I_V", "MMMM") return numeral if __name__ == "__main__": start = time.time() roman = Roman() numerals = [i.strip() for i in open("Data/p089_roman.txt").rea...
BreadBug007/Project-Euler
Prob_89.py
Prob_89.py
py
857
python
en
code
0
github-code
6
25950565947
import sys import fileinput import csv import operator import numpy as np import scipy.spatial.distance as sd import pickle #python compare_google.py [google_match-norm] [avg-$count-norm] states.p statescores$count google = [] matrix = [] infile = sys.argv[2] google_reader = csv.reader(open(sys.argv[1], 'rb'), deli...
kris-samala/LBSN
data_analysis/compare_states.py
compare_states.py
py
1,233
python
en
code
2
github-code
6
11816060482
import numpy as np import torch with open("pdtSEIKA.csv", "r") as f: f_reader = np.loadtxt(f, delimiter=',', dtype=np.float32) predict = f_reader f.close() tensor = torch.from_numpy(np.load(r"C:\Users\cchen\PycharmProjects\LearnPyTorch/K05_excluded_xyz.npy")) # 101778, # 15,10,10 with open("ai__K05_SEIKA...
cchenyixuan/Banira
utils/predict_map.py
predict_map.py
py
545
python
en
code
0
github-code
6
72580436348
from fastapi import FastAPI from pydantic import BaseModel from fastapi.middleware.cors import CORSMiddleware from reconocer_form import analyze_general_documents from base_datos import crear_registro import asyncio app = FastAPI() origins = ["*"] app.add_middleware( CORSMiddleware, allow_origins=origins, ...
jefryne/web_placas
ia/detectar documento/api.py
api.py
py
898
python
es
code
0
github-code
6
18882639437
#! /usr/bin/env python3 import sys import json from flask import Flask, request app = Flask(__name__) def is_browser(ua_string): return ua_string.split('/')[0].lower() == 'mozilla' @app.route("/") def hello(): msg_content = "Hello World!" if is_browser(request.headers['User-Agent']): return "...
glennneiger/estate-backend
example/simple.py
simple.py
py
770
python
en
code
0
github-code
6
71737201468
from typing import List from project.appliances.appliance import Appliance from project.people.child import Child class Room: def __init__(self, name: str, budget: float, members_count: int): self.family_name = name self.budget = budget self.members_count = members_count self.chi...
tonytech83/Python-OOP
OOP_Exams/11_OOP_22_Aug_2020/hotel_everland/project/rooms/room.py
room.py
py
1,573
python
en
code
4
github-code
6
74291021627
import math import numpy as np from scipy.spatial import ConvexHull class LOS_guidance(): def __init__(self, params): self.ship_max_speed = params['ship_max_speed'] self.ship_ax_vel_lim = params['ship_ax_vel_lim'] self.ship_lat_acc_pos_lim = params['ship_lat_acc_pos_lim'] self.ship_...
spacedoge2320/Ship-OA-sim
Ship-OA-sim/Guidance_algorithms.py
Guidance_algorithms.py
py
28,641
python
en
code
0
github-code
6
8784244942
import os from django.conf import settings from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import redirect, render from django.urls import reverse, revers...
simranmadhok/Venter_CMS
Venter/views.py
views.py
py
9,673
python
en
code
0
github-code
6
20867652240
from vizasm.analysis.asm.cpu.AsmRegEx import AsmRegEx class AsmRegEx_arm(AsmRegEx): ''' Contains regular expressions (mostly in verbose mode) used for analyzing the assembler file on the arm architecture. Parameters ---------- RE_IVAR match e.g. "IVAR_0x291c" RE_CLASSR...
nachtmaar/vizasm
vizasm/analysis/asm/cpu/arm/AsmRegEx_arm.py
AsmRegEx_arm.py
py
7,381
python
en
code
0
github-code
6
38907524035
"""Create category Revision ID: bc8fb2b5aaaa Revises: cf3388347129 Create Date: 2023-05-06 09:44:36.431462 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'bc8fb2b5aaaa' down_revision = 'cf3388347129' branch_labels = None depends_on = None def upgrade() -> No...
rasimatics/excursio-backend
migrations/versions/bc8fb2b5aaaa_create_category.py
bc8fb2b5aaaa_create_category.py
py
1,266
python
en
code
1
github-code
6
14052300522
# vim set fileencoding=utf-8 from setuptools import setup with open('README.rst') as f: long_description = f.read() setup( name = 'AnthraxEplasty', version = '0.0.3', author = 'Szymon Pyżalski', author_email = 'zefciu <szymon@pythonista.net>', description = 'Anthrax - generating forms from Elep...
zefciu/anthrax-eplasty
setup.py
setup.py
py
1,242
python
en
code
0
github-code
6
11838557066
import pickle import os import sys import numpy as np import json_tricks as json import cv2 import torch import copy import random import torchvision.transforms as transforms from glob import glob from tqdm import tqdm from PIL import Image from natsort import natsorted import matplotlib.pyplot as plt from scipy.spati...
Qingwei-Li98/PoseEstimation
core/utils/infant_dataset.py
infant_dataset.py
py
8,713
python
en
code
0
github-code
6
73652411389
# 给你一个正整数 n ,返回 2 和 n 的最小公倍数(正整数)。 class Solution(object): def smallestEvenMultiple(self, n): """ :type n: int :rtype: int """ if n % 2 != 0: return 2 * n else: return n n = 5 a = Solution() print(a.smallestEvenMultiple(n))
xxxxlc/leetcode
competition/单周赛/311/smallestEvenMultiple.py
smallestEvenMultiple.py
py
359
python
zh
code
0
github-code
6
30364500871
import sys import mock import six from okonomiyaki.errors import InvalidMetadataField from ..python_implementation import PythonABI, PythonImplementation from hypothesis import given from hypothesis.strategies import sampled_from if sys.version_info < (2, 7): import unittest2 as unittest else: import unitt...
enthought/okonomiyaki
okonomiyaki/platforms/tests/test_python_implementation.py
test_python_implementation.py
py
4,083
python
en
code
2
github-code
6
33548298905
import sys import argparse import tensorflow as tf from keras.models import Model, load_model from keras.layers import TimeDistributed, Conv1D, Dense, Embedding, Input, Dropout, LSTM, Bidirectional, MaxPooling1D, \ Flatten, concatenate from keras.initializers import RandomUniform from keras.callbacks import EarlySt...
guardiaum/DeepEx
CNN_BLSTM_fit_hyperparams.py
CNN_BLSTM_fit_hyperparams.py
py
6,299
python
en
code
1
github-code
6
27054375172
import numpy as np import pandas as pd import config import sys import tensorflow as tf from keras import Sequential from keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from service.Preprocess import Preprocess from service.FeatureEngineer...
kalinVn/new_york_city_taxi_fare_predicton
service/TaxiFaresPredictionNYC.py
TaxiFaresPredictionNYC.py
py
2,573
python
en
code
0
github-code
6
32989650417
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, SelectField from wtforms.validators import InputRequired, Optional sizes = ['XS','S', 'M', 'L', 'XL'] ratings = [1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0] class AddCupcakeFo...
BradButler96/flask-cupcakes
forms.py
forms.py
py
825
python
en
code
0
github-code
6
24287653793
from random import random import bisect def get_new_state(current_state, transitions): transition_map = dict() for source, target, probability in transitions: if source not in transition_map: transition_map[source] = ([], []) if not transition_map[source][0]: transition...
ckallum/Daily-Coding-Problem
solutions/#175.py
#175.py
py
1,406
python
en
code
0
github-code
6
71375478588
# Import the utils import math import sys import os sys.path.append(os.path.abspath('../QUtils')) from qutils import pprint, graph # Import the QISKit SDK from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute # Create a Quantum Register with 2 qubits. q = QuantumRegister(3)...
maddy-tod/quantum
Code/MonteCarlo/NormalTest.py
NormalTest.py
py
1,675
python
en
code
3
github-code
6
27673629381
import numpy as np import math import cv2 #input hsvColor:[h,s,v], ranges between (0-180, 0-255, 0-255) #and output true hsvColor:[h,s,v] def get_right_V(hsvColor): h = float(hsvColor[0]) s = float(hsvColor[1]) s1 = float(hsvColor[1])/255 v1 = float(hsvColor[2]) h60 = h / 60.0 h60f ...
zznewclear13/Gradient_Colorizing_Fix
Gradient_Colorzing_Fix.py
Gradient_Colorzing_Fix.py
py
1,205
python
en
code
0
github-code
6
35914525125
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: longest="" i=1 j=0 if strs==[""]: return "" elif strs==["a"]: return "a" shortestword=10000 for word in strs: if len(word) < shortestword: ...
azbluem/LeetCode-Solutions
solutions/14.longest-common-prefix.py
14.longest-common-prefix.py
py
1,401
python
en
code
0
github-code
6
16540523617
import os import sys from nuitka.utils.FileOperations import ( areSamePaths, isFilenameBelowPath, isFilenameSameAsOrBelowPath, ) from nuitka.utils.Utils import ( isAndroidBasedLinux, isFedoraBasedLinux, isLinux, isMacOS, isPosixWindows, isWin32Windows, withNoDeprecationWarning, ...
Nuitka/Nuitka
nuitka/PythonFlavors.py
PythonFlavors.py
py
6,933
python
en
code
10,019
github-code
6
39972780174
#!/usr/bin/env python3 # ------------------------------------------------------------------------ # MIDI Control for SignalFlow # ------------------------------------------------------------------------ from signalflow import * import configparser import logging import mido import os logger = logging.getLogger(__name...
ideoforms/signalflow
auxiliary/libs/signalflow_midi/signalflow_midi.py
signalflow_midi.py
py
6,131
python
en
code
138
github-code
6
36208434520
import multiDownload as dl import pandas as pd import sqlite3 import json import os from datetime import datetime, timedelta import shutil import argparse import jieba from jieba import analyse from wordcloud import WordCloud from opencc import OpenCC import requests import emoji with open("scripts/config.json", "r") ...
arthurfsy2/Postcrossing_map_generator
scripts/createPersonalPage.py
createPersonalPage.py
py
15,829
python
en
code
0
github-code
6
10380773430
import torch.nn as nn from ..builder import BACKBONES from .base_backbone import BaseBackbone @BACKBONES.register_module() class RMNet(BaseBackbone): def __init__(self, depth,frozen_stages=-1): super(RMNet, self).__init__() self.frozen_stages = frozen_stages self.conv1 = nn.Conv2d(3, 64, ker...
fxmeng/mmclassification
mmcls/models/backbones/rmnet.py
rmnet.py
py
2,851
python
en
code
null
github-code
6
35228257702
#!/usr/bin/env python """Visualisation.py: Visualise data from simulation""" __author__ = "Murray Ireland" __email__ = "murray@craftprospect.com" __date__ = "22/10/2018" __copyright__ = "Copyright 2017 Craft Prospect Ltd" __licence___ = "" import vtk import numpy as np from math import tan, sin, cos, atan, pi # impo...
Craft-Prospect/CubeSatVis
python/visualisation.py
visualisation.py
py
24,867
python
en
code
2
github-code
6
655237097
import os from glob import glob import numpy as np import pandas as pd try: import imageio.v2 as imageio except ImportError: import imageio from tqdm import tqdm from xarray import DataArray from elf.evaluation import dice_score def run_prediction(input_folder, output_folder): import bioimageio.core ...
constantinpape/torch-em
experiments/unet-segmentation/livecell/check_cell_type_performance.py
check_cell_type_performance.py
py
2,148
python
en
code
42
github-code
6
72609945147
import requests from parsel import Selector url='http://www.porters.vip/verify/uas/index.html' # headers = { # 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3'} headers = {'User-Agent': 'PostmanRuntime/7.26.2', 'Host': 'www.porters.vip'...
0xdeciverAngel/anti-web-crawler
user agent.py
user agent.py
py
569
python
en
code
0
github-code
6
43193724256
# -*- coding: utf-8 -*- import streamlit as st from topics import TopicModel import pandas as pd import numpy as np from scipy.optimize import linear_sum_assignment import matplotlib.pyplot as plt import base64 @st.cache(allow_output_mutation=True) def load_corpus(url): return tm.load_corpus(url) # check the cach...
michaelweiss/topic-model-explorer
old/topic_model_explorer_stability.py
topic_model_explorer_stability.py
py
8,264
python
en
code
2
github-code
6
36264192726
from PyQt5.QtCore import QModelIndex, pyqtSignal, pyqtSlot, QVariant, QFile, QByteArray, QBuffer, QIODevice, QSize, \ QItemSelectionModel, QItemSelection from PyQt5.QtGui import QPixmap, QFont, QIcon from PyQt5.QtSql import QSqlQuery from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QDialog, QMessageBox f...
drug173/Python
applications/Tree1/widget1.py
widget1.py
py
13,903
python
ru
code
0
github-code
6
19621184365
#import libraries import tensorflow as tf import numpy as np import matplotlib.pyplot as plt """ This tutorial from the AI at UCLA's technical blog post: https://uclaacmai.github.io/Linear-Regression """ testlines = [] testans = [] trainlines = [] trainans = [] for line in open("boston2.txt", 'r').readlines()[0:100]...
canders1/COMSC343
_site/pdf/regression_class.py
regression_class.py
py
1,961
python
en
code
0
github-code
6
16543939917
import functools def makeTable(grid): """Create a REST table.""" def makeSeparator(num_cols, col_width, header_flag): if header_flag == 1: return num_cols * ("+" + (col_width) * "=") + "+\n" else: return num_cols * ("+" + (col_width) * "-") + "+\n" def normalizeCe...
Nuitka/Nuitka
nuitka/utils/Rest.py
Rest.py
py
927
python
en
code
10,019
github-code
6
75189166908
import pygame, threading pygame.init() white = (255, 255, 255) green = (0, 255, 0) blue = (0, 0, 128) X = 400 Y = 400 display_surface = pygame.display.set_mode((X, Y )) pygame.display.set_caption('Show Text') font = pygame.font.Font('freesansbold.ttf', 32) text = font.render('GeeksForGeeks', True, green, blue) ...
ger534/Proyecto2Arqui2
examplePygame.py
examplePygame.py
py
779
python
en
code
0
github-code
6
6497432832
from stock_util import StockUtil from logger import Logger from stock_db import StockDb import time import threading import requests from pandas import DataFrame import pandas as pd class StockMon(): def __init__(self): self.logger = Logger("StockMon") self.util = StockUtil() def...
jia-zhang/fp-client
lib/stock_mon.py
stock_mon.py
py
9,923
python
en
code
0
github-code
6
3477657730
import logging import posixpath from collections import defaultdict from typing import TYPE_CHECKING, Callable, Dict, Generator, Optional, Tuple from ...stash import ExpStashEntry from ..base import BaseExecutor from ..ssh import SSHExecutor, _sshfs from .base import BaseExecutorManager if TYPE_CHECKING: from scm...
gshanko125298/Prompt-Engineering-In-context-learning-with-GPT-3-and-LLMs
myenve/Lib/site-packages/dvc/repo/experiments/executor/manager/ssh.py
ssh.py
py
3,336
python
en
code
3
github-code
6
11557761416
import sys from classes import * import pprint import os # system keword 에 대한 dfa를 자동생성한다. def make_system_dfa(name, keyword): digit = "1234567890" char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" length = len(keyword) dfa = Dfa(name) dfa.set_final_states([length]) for i in range...
pula39/compiler_assignment1
lexical.py
lexical.py
py
8,178
python
en
code
0
github-code
6
5073225846
import asyncio import logging import aiohttp import aiohttp.server logger = logging.getLogger(__name__) class ProxyRequestHandler(aiohttp.server.ServerHttpProtocol): """ Inspired by https://github.com/jmehnle/aiohttpproxy Copyright Julian Mehnle, Apache License 2.0 """ def __init__(self): ...
raphaelm/cockatiel
functional_tests/utils_proxy.py
utils_proxy.py
py
2,602
python
en
code
4
github-code
6
41058208626
import re class Poly: def __init__(self,*terms): # __str__ uses the name self.terms for the dictionary of terms # So __init__ should build this dictionary from terms self.terms = {} for coeff,power in terms: assert type(coeff) in [int,float] as...
solomc1/python
ics 33/solutions/ile2 solutions/Lab 1/ZhongAaron/poly.py
poly.py
py
4,707
python
en
code
0
github-code
6
70911492987
print('zohair hashmi - 18b-127-cs - Section A') print('Practice Problem - 3.39') def collision(x1,y1,r1,x2,y2,r2): import math c_diff = ((x2-x1)**2+(y2-y1)**2) if c_diff <= (r1+r2)**2: return True else: return False x1 = collision(0,1,2,3,2,2) print(x1) x2 = collision(2,5,...
zohairhashmi17/Programming-Fundamentals-Detailed-Assignment
3.39.py
3.39.py
py
347
python
en
code
0
github-code
6
41495871576
from rdkit import Chem import argparse import math import os from sklearn.metrics import mean_squared_error, r2_score from statistics import stdev if __name__ == "__main__": parser = argparse.ArgumentParser(description='Calculate the RMSD value for a molecular property.') parser.add_argument('--original', '-o'...
sophiahoenig/NetworkBalanceScaling
utils/evaluate_results.py
evaluate_results.py
py
6,038
python
en
code
0
github-code
6
32500175374
from random import randint """ כתבו תוכנית הבוחרת באקראי מספר בין 1 ל-100. על המשתמש לנחש את המספר שנבחר ואחרי כל ניחוש יש להדפיס ״גדול מדי״ או ״קטן מדי״ לפי היחס בין המספר שנבחר לניחוש. בונוס: כדי שיהיה מעניין דאגו שמדי פעם התוכנית תדפיס את ההודעה הלא נכונה. """ def check_user_input(user_number): number = ra...
eehud738/python-
Section 2/HW6.py
HW6.py
py
1,025
python
he
code
0
github-code
6
8834313838
import mysql.connector from mysql.connector import Error class MySQL: def __init__(self, host='localhost', database=None, user=None, password=None): if database == None: return print("Please, enter your Database name!") elif user == None: return print("Please, enter your user name!"...
drigols/studies
modules/python-codes/modules/mysql/modules/exercises/hospital/hospital/database.py
database.py
py
3,910
python
en
code
0
github-code
6
30543923938
import sys import numpy as np import torch from tqdm import tqdm import matplotlib.pyplot as plt from Preprocessor import Preprocessor """ Dataset Snapshot: Dataset A: Normal Murmur Extra Heart Sound Artifact Dataset B: Normal Murmur Extrasystole """ class PASCAL(Preprocessor): def...
kendreaditya/heart-auscultation
src/preprocess/PASCAL-dataset.py
PASCAL-dataset.py
py
2,173
python
en
code
2
github-code
6
75189172348
import threading, time #REGISTROS ESCALARES Scalar_Reg = [ "FUC1K", "", "11110000", "00001111", "0000000A" ] #REGISTROS VECTORIALES Vector_Reg = [ ["0", "", "", "","", "", "", ""], ["1", "", "", "","", "", "", ""], ["2", "", "", "","", "", "", ""], ["3", "", "", "","", "", "", ""], ["4", "", "", "","", "", "", ""] ]...
ger534/Proyecto2Arqui2
procesador/REG_BANK.py
REG_BANK.py
py
2,353
python
en
code
0
github-code
6
32469600718
class Solution: def findJudge(self, n: int, trust: List[List[int]]) -> int: trust_counts = defaultdict(lambda: [0,0]) for truster, trusted in trust: trust_counts[truster][0] += 1 trust_counts[trusted][1] += 1 candidates = [person for person in ra...
MdAbedin/leetcode
0901 - 1000/0997 Find the Town Judge.py
0997 Find the Town Judge.py
py
437
python
en
code
7
github-code
6
26948867994
# Python for Everyone # Chapter 3 exercise 2 try: hrs = float(input('Enter Hours: ')) rate = float(input('Enter Rate: ')) except: print("Please enter a number") quit() if hrs <= 40: # no overtime pay = rate * hrs else: # calculate overtime pay = (hrs - 40) * rate * 1.5 + 40 * rate print...
dansdevelopments/py4e
py4e/chapter03/ex03_02.py
ex03_02.py
py
334
python
en
code
0
github-code
6
40696691343
import asyncio import re from collections import namedtuple from magma.magmad.check import subprocess_workflow DEFAULT_NUM_PACKETS = 4 DEFAULT_TIMEOUT_SECS = 20 PingCommandParams = namedtuple( 'PingCommandParams', ['host_or_ip', 'num_packets', 'timeout_secs'], ) PingInterfaceCommandParams = namedtuple( ...
magma/magma
orc8r/gateway/python/magma/magmad/check/network_check/ping.py
ping.py
py
5,786
python
en
code
1,605
github-code
6
3440116021
class Node: def __init__(self, val): self.val = val self.freq = 1 self.next = None self.last = None self.seq_next = None class FreqStack: def __init__(self): self.freq_to_root = {} self.val_to_node = {} self.max_freq = 0 def push(self, val: ...
cuiy0006/Algorithms
leetcode/895. Maximum Frequency Stack.py
895. Maximum Frequency Stack.py
py
1,718
python
en
code
0
github-code
6
26857827694
import os import numpy as np import torch import torch.nn as nn class Generator(nn.Module): def __init__(self, latent_dim, img_shape): super().__init__() self.img_shape = img_shape self.label_embed = nn.Embedding(10, 10) def block(in_feat, out_feat, normalize=True): la...
zeroone-universe/GM4MNIST
models/cGAN/model.py
model.py
py
1,673
python
en
code
0
github-code
6
30866831466
import uuid class CustomerGenerator: def __init__(self, client): self.client = client self.customers_api = client.customers def create_customer(self, **kwargs): print('create_customer', kwargs) result = self.customers_api.create_customer(body=kwargs) if result...
cbonoz/square21
customer_generator.py
customer_generator.py
py
502
python
en
code
1
github-code
6
25867921082
#import libraries import pandas as pd import numpy as np import bokeh from bokeh.plotting import figure, output_file, show from bokeh.models.tools import HoverTool from bokeh.core.properties import value from bokeh.models import ColumnDataSource, FactorRange from bokeh.plotting import figure import math from bokeh....
Fremont28/miami_flights-
flights_viz1.py
flights_viz1.py
py
12,432
python
en
code
0
github-code
6
39690983841
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="visbeat", version="0.0.9", author="Abe Davis", author_email="everyonehasadance@gmail.com", description="Code for 'Visual Rhythm and Beat' SIGGRAPH 2018", long_description=long_descript...
abedavis/visbeat
setup.py
setup.py
py
1,170
python
en
code
220
github-code
6
73674519546
'''This script contains the functions used to contruct and train the GAN.''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import tensorflow as tf # Change the environment variable TF_CPP_MIN_LOG_LEVEL to 2 to avoid the orderbooks about the compilation of the CUDA code os.environ['TF...
DanieleMDiNosse/GAN_Anomaly_Detection
train.py
train.py
py
17,245
python
en
code
0
github-code
6
33138124964
#mass import import pandas as pd import urllib.request import json import numpy as np import matplotlib.pyplot as plt from datetime import datetime, timedelta from sklearn.cluster import KMeans pd.options.display.max_rows = 999 #for getting the date 5 days ago daydif = str(datetime.today() - timedelta(days=5)) dayref ...
nicr0ss/RainDance
KMeans_model.py
KMeans_model.py
py
3,524
python
en
code
0
github-code
6
8870924854
from collections import deque import sys while True: try: a=str(input('Input final configuration: ')) N=int(a.replace(' ','')) if ((N>87654321)|(N<12345678)): raise ValueError('Incorrect configuration, giving up...') break except ValueError: print('Incorrect configuration, giving up...') sys.exit() ...
hanxuwu/Learning-Python
Principles of Programming/Assignment/Assignment1/ASS question2.files/rubiks_rectangle.py
rubiks_rectangle.py
py
5,218
python
en
code
3
github-code
6
74413558908
class Solution: def reverse(self, x: int) -> int: result = 0 x_abs = abs(x) limit = [-2**31, 2**31 - 1] while x_abs: modulo = x_abs % 10 result = result * 10 + modulo x_abs = x_abs // 10 if x < 0: result = -re...
garimaarora1/LeetCode-2023
reverse-integer/reverse-integer.py
reverse-integer.py
py
436
python
en
code
0
github-code
6
28381664206
import socket ''' Send given value to the given address. ''' def send_value(to_addr, value): if not to_addr: print("Remote Address Not Set!") return msg = "VALUE:%d" % value print("Sending '%s' to %s:%d" % (msg, to_addr[0], to_addr[1])) s = socket.socket() try: s.connect(t...
jsayles/Thing1and2
src/utils.py
utils.py
py
1,489
python
en
code
1
github-code
6
13859758386
import bs4 import requests from bs4 import BeautifulSoup SUPPORTED_LANGUAGES = ("EN", "__test__") def scrape_oxford_learners_dictionary(word: str) -> list[str]: def url(i: int) -> str: return ( f"https://www.oxfordlearnersdictionaries.com" f"/definition/english/{word}_{i}" ...
pavelkurach/vocab-builder
src/dict_scrapers.py
dict_scrapers.py
py
1,687
python
en
code
0
github-code
6
29147674060
#!/usr/bin/env python # coding: utf-8 # In[1]: import requests import bs4 # In[2]: 'http://books.toscrape.com/catalogue/page-2.html' # In[3]: 'http://books.toscrape.com/catalogue/page-3.html' # In[4]: base_url = 'http://books.toscrape.com/catalogue/page-{}.html' # In[5]: base_url.format('20') # In[...
maylinaung/python-learning
web_scrabing_book_example.py
web_scrabing_book_example.py
py
1,427
python
en
code
0
github-code
6
15304075993
from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassi...
tunir27/ICDCN-2019
Chennai_Floods_code/ML.py
ML.py
py
2,819
python
en
code
0
github-code
6
21907313029
from heapq import * import heapq class SlidingWindowMedian: def __init__(self): self.maxHeap, self.minHeap = [], [] def find_sliding_window_median(self, nums, k): result = [0.0 for x in range(len(nums) - k + 1)] for i in range(0, len(nums)): if not self.maxHeap or nums[i] <...
justinyoonsk/GTCI
09_Two_Heaps/02_sliding_window_median.py
02_sliding_window_median.py
py
2,044
python
en
code
0
github-code
6
3240628422
from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from entrepreneur.models import Usuario from authentication.serializers import UserListSerializers, UserSerializer @api_view(['GET', 'POST']) def user_api_view(request): # lista los usuari...
DevApa/auth_em
register/api.py
api.py
py
2,157
python
en
code
0
github-code
6
72531926909
# pylint: disable=redefined-outer-name # pylint: disable=unused-argument # pylint: disable=unused-variable import os import shutil from pathlib import Path from typing import Callable import pytest import yaml @pytest.fixture def tmp_compose_spec(tests_data_dir: Path, tmp_path: Path): src = tests_data_dir / "doc...
ITISFoundation/osparc-simcore
packages/service-integration/tests/test_command_config.py
test_command_config.py
py
1,231
python
en
code
35
github-code
6
19581541837
import textract import re import os import requests from bs4 import BeautifulSoup import time import random # ===================================== get paper url ===================================== urls = [ 'https://sj.ctu.edu.vn/ql/docgia/nam-2015/loaichuyensan-2/xuatban-782.html', 'https://sj.ctu.edu.vn/q...
oldguard69/lvtn
server/core/archive/crawl_data_1.py
crawl_data_1.py
py
3,229
python
en
code
0
github-code
6
2737490777
import wikipedia import pyfiglet word = pyfiglet.figlet_format("KAREN") print(word) while True: engine=input ("Search: ") def my_summary(): summ=wikipedia.summary(engine) return summ val = my_summary() print(val)
Shuklabrother/Search-engine.py
Index.py
Index.py
py
272
python
en
code
0
github-code
6
13015171086
import pickle import torch import argparse from foresight.models import * from foresight.pruners import * from foresight.dataset import * from foresight.weight_initializers import init_net def get_num_classes(args): return 100 if args.dataset == 'cifar100' else 10 if args.dataset == 'cifar10' else 120 def parse_...
SamsungLabs/zero-cost-nas
nasbench2_pred.py
nasbench2_pred.py
py
4,715
python
en
code
137
github-code
6
70808003389
from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import ImageDataGenerator import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg model = load_model("/home/yash/Desktop/PyImageSearch/checkpoints/emotion1.h5") classifier = cv2.CascadeClassi...
theartificialguy/Deep-Learning-Projects
Emotion and Gender Classification/Emotion Classification/recognition.py
recognition.py
py
1,841
python
en
code
2
github-code
6
35154021664
import json import os import cherrypy from jinja2 import Environment, FileSystemLoader # GET CURRENT DIRECTORY from helper import get_redis_connection, get_sorted_list from scrapper import main1 CUR_DIR = os.path.dirname(os.path.abspath(__file__)) env = Environment(loader=FileSystemLoader(CUR_DIR), trim_blocks=True)...
jayanthns/bseproect
run.py
run.py
py
1,974
python
en
code
0
github-code
6
130544530
from apirequests.stratz import search_match, get_global_variables, get_items_per_time def inicia_overlay(imagem_path, root, label, hero_id, players, heroes_against): regiao_busca = (580, 492, 62, 25) #posicao = pyautogui.locateOnScreen(imagem_path, region=regiao_busca, grayscale=True) label['text'] = "Ag...
caiorodrig0/dotahelper1
overlay/overlayfunctions.py
overlayfunctions.py
py
950
python
en
code
0
github-code
6
38048663522
from constants import API_STACK_BASE_URL import requests import sys class IpStack: def __init__(self, api_token: str, base_url: str): if base_url is None or base_url == '': base_url = API_STACK_BASE_URL self.api_token = api_token self.base_url = base_url def get_ip_locati...
AlejandroGC-SS/ip_stack_interface
ip_stack.py
ip_stack.py
py
1,318
python
en
code
0
github-code
6
37946645164
import ServerModule class StateMachine(): current_state = None nickname = None def __init__(self, start_state): self.current_state = start_state def login(self, nickname): self.nickname = nickname return ServerModule.login(nickname) def view_profile(self, nickname): ...
8Air/server-client_app
StateMachine.py
StateMachine.py
py
1,678
python
en
code
0
github-code
6
5390312333
class Node: def __init__(self, val): self.val = val self.next = None def deleteNode(root, target): if not root or not target: return "Error" if target.next: print(target.val) target.val = target.next.val target.next = target.next.next if not tar...
JarvisFei/leetcode
剑指offer代码/算法和数据操作/面试题18:删除链表的节点.py
面试题18:删除链表的节点.py
py
764
python
en
code
0
github-code
6
41295805453
import pygame from pygame.locals import * import numpy as np from conway import Life class GameOfLife(Life): def __init__(self, width = 1600, height = 1000, cell_size = 5, speed = 10): Life.__init__(self, width // 10, height // 10) self.width = width self.height = height self.cell_s...
hatiff/GameLife
Life.py
Life.py
py
2,437
python
en
code
0
github-code
6
29696388258
# Sales Program # Written by Tanner McCarthy # 9/20/21 # Prof Fried packagePrice = 99 discount = 0 #used a while loop so that it will keep running until I am satisfied with the input given to me #by the user #use True so that it will always run while True: #used try and except so that if an error comes up that wo...
TannerMcCarthy/SalesHW
sales.py
sales.py
py
5,233
python
en
code
0
github-code
6
42591021729
import os import numpy as np import pickle import argparse from implicit.bpr import BayesianPersonalizedRanking from implicit.nearest_neighbours import CosineRecommender from scipy.sparse import csr_matrix from methods import consul, oracle, PrivateRank, PrivateWalk np.random.seed(0) def recall(li, gt): if gt...
joisino/consul
evaluate.py
evaluate.py
py
8,347
python
en
code
5
github-code
6