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
22011657649
import time from fgo.common import * from fgo.管理室 import 随便选任务 from PIL import ImageGrab from fgo.model import stable_predict import numpy as np def 使用小技能(英灵位=0, 技能位=0): def 决定(): def 取消(): return MoveTo(1110, 185) + click() return MoveTo(875, 429) + click() + Wait(Exact(0.90)) + 取消() ...
thautwarm/do-you-like-wan-you-si
fgo/战斗.py
战斗.py
py
2,638
python
en
code
11
github-code
36
43587658067
import json as _json import re as _re from typing import List as _List from mitmproxy.http import HTTPFlow as _HTTPFlow from mitmproxy.io import FlowReader as _FlowReader from mitmproxy.io import FlowWriter as _FlowWriter from mitmproxy.io import tnetstring as _tnetstring from . import utils as _utils # ---------- C...
PSS-Tools-Development/pss-api-parser
src/anonymize.py
anonymize.py
py
5,070
python
en
code
4
github-code
36
36304843373
Import("env") def get_build_flag_value(flag_name): build_flags = env.ParseFlags(env['BUILD_FLAGS']) flags_with_value_list = [build_flag for build_flag in build_flags.get('CPPDEFINES') if type(build_flag) == list] defines = {k: v for (k, v) in flags_with_value_list} return defines.get(flag_name).strip('...
Georgegipa/UKP
scripts/rename_bin_file.py
rename_bin_file.py
py
475
python
en
code
0
github-code
36
33914103336
import os import unittest from unittest import mock from imageops.server import Server from imageops.utils import Utils class ServerCheckTest(unittest.TestCase): """ Unit Test Cases about Server Module """ def setUp(self): file_path = os.path.abspath(os.path.dirname(__file__)) os.env...
EdgeGallery/toolchain
imageops/imageops/tests/test_server_check.py
test_server_check.py
py
3,281
python
en
code
19
github-code
36
70951081705
import numpy as np import unittest import javabridge as J import imagej.imageplus as I import imagej.imageprocessor as IP class TestImageProcessor(unittest.TestCase): def setUp(self): J.attach() def tearDown(self): J.detach() def test_01_01_get_image(self): from cellprofiler.modu...
AnneCarpenter/python-imagej
tests/test_imageprocessor.py
test_imageprocessor.py
py
1,035
python
en
code
0
github-code
36
21323942849
from turtle import Turtle ALIGNMENT = "center" FONTS = { "default": ("Courier", 15, "normal"), "big": ("Courier", 25, "normal"), } class Scoreboard(Turtle): def __init__(self): super().__init__(visible=False) self.score = 0 self.high_score = open("data.txt").read() self.colo...
happy09123/Snake-Game
scoreboard.py
scoreboard.py
py
1,290
python
en
code
0
github-code
36
15640198972
from django.conf.urls import url,include from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from . import views urlpatterns = [ url(r"^$", views.HomePage.as_view(), name="home"), url(r"^index/$", views.TestPage.as_view(), name="test"), url(...
itzikorfa/SE-Lite-Scrum
SE_Project_VerX/urls.py
urls.py
py
1,153
python
en
code
0
github-code
36
72545214823
import hashlib class Codec: def __init__(self): self.url_list=[] self.hash_map={} self.current_id=0 self.alphabet='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' def encode(self, longUrl): shortUrl = 'http://tinyurl.com/' m = hash...
zhongchong/Leetcode
Leetcode/535.py
535.py
py
1,052
python
en
code
0
github-code
36
8161754177
import multiprocessing import time def pro1(q): # q에 데이터를 넣는다 for i in range(100): q.put(str(i)) time.sleep(0.1) def pro2(q): # q에 데이터를 빼낸다 for i in range(100): item = q.get() print(item) # JoinableQueue q.task_done() if __name__ == '__main__': queu...
weatherbetter/levelup-python
multi_process/multiprocess_JoinableQueue.py
multiprocess_JoinableQueue.py
py
540
python
en
code
0
github-code
36
29648508373
#! /usr/bin/env python3 # Author: Mohit Saini (mohitsaini1196@gmail.com) """ The entry point of DepG library. Read the `README.md` for more details. """ # pylint: disable=missing-function-docstring # pylint: disable=invalid-name # pylint: disable=missing-class-docstring import os from . import target_graph_builder...
mohitmv/depg
depg_lib_main.py
depg_lib_main.py
py
2,978
python
en
code
0
github-code
36
19279680101
import datetime import os import tensorflow as tf import numpy as np class Runner(object): def __init__(self, agent, env, train, load_path): self.agent = agent self.env = env self.train = train # True: entrenar agente, False: se carga agente entrenado self.episode = 1 se...
ericPrimelles/RLProject
runner.py
runner.py
py
4,209
python
en
code
0
github-code
36
38799425699
import discord import bdg import enum import requests import bs4 import datetime class BrawlModes(enum.Enum): BRAWLBALL = "brawlBall" SOLOSHOWDOWN = "soloShowdown" DUOSHOWDOWN = "duoShowdown" GEMGRAB = "gemGrab" BOUNTY = "bounty" HOTZONE = "hotZone" KNOCKOUT = "knockout" HEIST = ...
DanielKMach/BotDusGuri
src/commands/utilities/brawlmeta.py
brawlmeta.py
py
3,277
python
en
code
1
github-code
36
417814461
import os from collections import defaultdict def file_statistics(parent_dir): files_dict = defaultdict(list) for root, dirs, files in os.walk(parent_dir): for file in files: stat = os.stat(os.path.join(root, file)) if stat.st_size <= 100: files_dict[100].append...
Shorokhov-A/practical_tasks
Shorokhov_Andreiy_dz_7/task_7_4.py
task_7_4.py
py
747
python
en
code
0
github-code
36
16895923091
from tkinter import Tk,Button,Label,Frame,Canvas,Entry,Text,StringVar, ttk, filedialog, messagebox import pandas as pd from pandas import datetime, read_csv import numpy as np import matplotlib as mp from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk from matplotlib.figure impor...
FernandoLopezC/TSA
base.py
base.py
py
19,718
python
en
code
0
github-code
36
35401057235
class Bank: def __init__(self,name): self.name=name self.balance=0 def deposit(self): amount=int(input(f"Dear {self.name},Enter the amount that to be deposit : ")) self.balance=self.balance+amount print(f"-->{amount} deposited successfully....") print("Dear ",sel...
PranitRohokale/My-programs
bank account.py
bank account.py
py
1,612
python
en
code
0
github-code
36
15444060214
#!/usr/bin/env python from __future__ import print_function import sys import argparse def parse_stdin(in_file): d = {} for line in in_file: if ':' in line: split = line.split(':') stripped = [s.strip() for s in split] #if len(stripped) > 2: # print '...
amandasystems/cocp-automation-2017
conductor/gather_stats.py
gather_stats.py
py
1,288
python
en
code
0
github-code
36
16821571488
# Author: Bill Pengyuan Zhai. Harvard University. Yelin Group. Oct 2022 from Utils_torch_version import Network, get_nn_pairs, binary_basis, unpacknbits import numpy as np import matplotlib.pyplot as plt from scipy import sparse import scipy import scipy.linalg import qiskit import time import torch import math # try...
BILLYZZ/NFNet
Benchmark_torch_version_partial.py
Benchmark_torch_version_partial.py
py
9,049
python
en
code
1
github-code
36
42335398411
import warnings import torch from mmdet.core import bbox2result from ..builder import DETECTORS, build_backbone, build_head, build_neck from .base import BaseDetector from .single_stage import SingleStageDetector @DETECTORS.register_module() class TestGtDetector(SingleStageDetector): """Base class for single-sta...
mengqiDyangge/HierKD
mmdet/models/detectors/single_stage_test.py
single_stage_test.py
py
1,754
python
en
code
32
github-code
36
43194848130
import pickle as pkl import numpy as np from utils import clean_str import scipy.sparse as sp from tqdm import tqdm from utils import clean_str import torch word_embeddings = dict() with open('glove.840B.300d.txt', 'r') as f: for line in f.readlines(): data = line.split(' ') word_embedd...
MathIsAll/HDGCN-pytorch
build_fixed_graph.py
build_fixed_graph.py
py
7,500
python
en
code
5
github-code
36
41573028205
import logging def get_logger(): """Get logging.""" logging.getLogger('matplotlib.font_manager').setLevel(logging.WARNING) logger = logging.getLogger() logger.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s: - %(message)s', datefmt='%Y-%...
TitusWjt/class3
utils/log.py
log.py
py
474
python
en
code
0
github-code
36
20420839973
# -*- coding: utf-8 -*- from threading import Thread import queue import json import os , sys #导入requests库(请求和页面抓取) import requests #导入time库(设置抓取Sleep时间) import time #导入random库(生成乱序随机数) import random #导入正则库(从页面代码中提取信息) import re #导入数值计算库(常规计算) import numpy as np from PIL import Image from wordcloud import WordCloud #导...
ltzone/EE208Lab
jd_cmt_tags/_jd_cmt_TAGS.py
_jd_cmt_TAGS.py
py
3,546
python
en
code
0
github-code
36
23258044940
import tensorflow as tf import numpy as np sess = tf.Session() X = tf.placeholder(tf.float32, shape=(100, 3)) y = tf.placeholder(tf.float32, shape=(100)) beta = tf.placeholder(tf.float32, shape=(3)) p = tf.math.sigmoid(tf.tensordot(X, beta, 1)) Loss = -tf.math.reduce_sum(y * tf.math.log(p) + ((1. - y) * tf.math.log...
MarcToussaint/AI-lectures
MachineLearning/nn-exercise/getting_started.py
getting_started.py
py
987
python
en
code
67
github-code
36
34601010887
# Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements. # For example: # unique_in_order('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B'] # unique_in_order('AB...
raqune89/CodeWars
Unique In Order.py
Unique In Order.py
py
738
python
en
code
0
github-code
36
38715815112
#!/usr/bin/env python3 pad = ( (None, None, '1', None, None), (None, '2', '3', '4', None), ('5', '6', '7', '8', '9'), (None, 'A', 'B', 'C', None), (None, None, 'D', None, None) ) row = 2 col = 0 combo = [] with open('input.txt', 'r') as f: for line in f: for c in line.strip(): ...
lvaughn/advent
2016/2/combo_lock_2.py
combo_lock_2.py
py
981
python
en
code
1
github-code
36
74329032423
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import django_extensions.db.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Station', ...
opendata-stuttgart/metaEFA
meta_efa/main/migrations/0001_initial.py
0001_initial.py
py
1,045
python
en
code
33
github-code
36
4656654500
__author__ = 'Giuliano' import tkinter as tk from tkinter import * root = tk.Tk() root.geometry("400x650") root.configure(background='orange') class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.configure(background='orange') self.pack() ...
Alexanderkorn/A3-project
code/raster.py
raster.py
py
3,162
python
en
code
0
github-code
36
37314300998
# -*- coding:utf-8 -*- from openpyxl import Workbook from datetime import datetime def write_excel(filename): wb = Workbook() # load_work(filename) ws = wb.create_sheet('sheet', 0) wb.remove('sheet') ws = wb.active # default Sheet ws.title = 'Pi' ws['A1'] = 3.1415926 ws['A2'] = datetime...
huazhicai/Demo
openpyxl/demo2.py
demo2.py
py
580
python
en
code
0
github-code
36
31345155935
import csv def get_flow_size_in_packets(tcpflows, udpflows): tcp_output = open("tcp_flow_size_packets.csv", "w") tcp_writer = csv.writer(tcp_output, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) udp_output = open("udp_flow_size_packet.csv", "w") udp_writer = csv....
David47295/d58courseproject
d58/flow_size.py
flow_size.py
py
2,457
python
en
code
0
github-code
36
12227662181
#!/home/mcollier/miniconda3/bin/python # -*- coding: utf-8 -*- __author__ = "Matthew Collier" __version__ = "0.5" # Typical use cases: #hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/scan.py -v #hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/scan_db.py -s WMT #hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/sc...
mcStargazer/hf
scan_db.py
scan_db.py
py
17,177
python
en
code
0
github-code
36
13442778323
import os import argparse import tensorflow as tf import numpy as np from load import load_graph os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' """ Adapted from https://gist.github.com/morgangiraud/4a062f31e8a7b71a030c2ced3277cc20#file-medium-tffreeze-3-py """ if __name__ == '__main__': parser = argparse.ArgumentParse...
Yunski/nvidia-cnn
test_load.py
test_load.py
py
961
python
en
code
9
github-code
36
15820786578
# -*- coding: utf-8 -*- #+--------------------------------------------------------------------------+# # Importem mòduls # #+--------------------------------------------------------------------------+# from distancies import Cosinus, Intersection #+---------...
segama4/Image_Search_Engine
recuperador.py
recuperador.py
py
1,427
python
en
code
0
github-code
36
4712176028
import numpy as np import os import trimesh.points from abc import ABC from typing import List, Union from dataclasses import dataclass from OpenGL import GL as gl from .renderable import Renderable from .shaders.shader_loader import Shader from ..camera.models import BaseCameraModel, StandardProjectionCameraModel fro...
vguzov/cloudrender
cloudrender/render/pointcloud.py
pointcloud.py
py
12,029
python
en
code
16
github-code
36
1812506827
import os import re import torch from PIL import Image from torch.utils.data import Dataset import torchvision.transforms as T import utils class MyDataset(Dataset): def __init__(self, file_list: list, name2label, transform_flag=True): self.file_list = file_list self.name2label = name2label ...
newchexinyi/mobilefacenet
dataset.py
dataset.py
py
1,225
python
en
code
0
github-code
36
7702285883
# names = ['heier1', 'heier2', 'heier3'] # for name in names: # print( name ) sum = 0 for x in list( range(101) ): sum += x print( sum ) sum = 0 n = 100 while n > 0: sum = sum + n n = n - 2 print(sum)
Heier2013/learn_python
cycle.py
cycle.py
py
220
python
en
code
0
github-code
36
5950813494
import os class Weapon: stats = { "name": "Default_Weapon", "dmg": 1 } def __init__(self, weapon): # Select Weapon File weapon_path = "game\data\weapons" # Parsing Data try: with open(weapon_path + '/' + weapon, "r") as weapon_values: ...
jalowe13/The-One-Python
The-One-Python/The-One-Python/game/mechanics/weapon.py
weapon.py
py
869
python
en
code
0
github-code
36
8254895274
import sys grades = {'Biology':80, 'Physics':88, 'Chemistry':98, 'Math':89, 'English':79, 'Music':67, 'History':68, 'Art':53, 'Economics':95, 'Psychology':88} def g (x): y = {} for key, value in grades.items(): if key != x: y[key] = value mean = sum(y.values()) / len(y) mean1 = round(mean,...
bferguson02/Python_Programs
grades.py
grades.py
py
361
python
en
code
0
github-code
36
44265086055
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import pandas as pd df = pd.read_csv("File.txt", sep=" ") #print(df) moviewriter = animation.FFMpegWriter( fps=60) fig = plt.figure(figsize=(12, 6)) with moviewriter.saving(fig, 'myfile.mp4', dpi=100): integration_time = ...
josephmckenna/2021_April_IOP_IntroductionToCpp_Part1
extras/AnimateFigure.py
AnimateFigure.py
py
1,004
python
en
code
6
github-code
36
19245162119
''' CS5001 Fall 2022 Elif Tirkes Homework 3: What color is that square? ''' from chessboard import check_valid_row from chessboard import check_valid_column def main(): test_squares() def test_column_validity(): ''' Function -- test_column_validity presents three string-only te...
skippyskiddy/Python-Projects
Pokemon & Chess - Loops & Conditionals/test_squares.py
test_squares.py
py
2,210
python
en
code
0
github-code
36
35681548851
import os import sys import cv2 import time import pickle import numpy as np import pandas as pd from sklearn.decomposition import PCA from sklearn.svm import SVC from sklearn.metrics import confusion_matrix,accuracy_score,f1_score def generate_pca_dataset(datapath): time1 = time.clock() folders = [ '00000001', '00...
pradyumnameena/COL774-Machine-Learning
Assignment-4/pca.py
pca.py
py
9,783
python
en
code
0
github-code
36
38110745441
import os import shutil from pathlib import Path def checkPathExists(filePath): if not (os.path.exists(filePath)): errorMessage = f'File Path not found: {filePath}' print(errorMessage) raise FileNotFoundError(errorMessage) def recreateFolderPath(filepath): if not (os.path.exists(filepath)): print(f'Cr...
ibaadaleem/filmDatabase
fileManagement.py
fileManagement.py
py
1,354
python
en
code
0
github-code
36
40165431906
# -*- encoding: utf-8 -*- from django import template from django.contrib import admin from django.conf import settings register = template.Library() ''' templatetag, obtiene la configuración del menú ''' def get_config_menu(): return Menu.get_menu(self) register.filter('get_config_menu') class Menu(object): ...
elmanos/vari
vari/localesapp/templatetags/menu.py
menu.py
py
1,276
python
es
code
0
github-code
36
13123666146
#!/usr/bin/env python # coding: utf-8 # # Finding appropriate parametric models # - Code from: https://lifelines.readthedocs.io/en/latest/Examples.html # In[1]: # Imports from lifelines import * from lifelines.plotting import qq_plot import numpy as np import matplotlib.pyplot as plt import pandas as pd import seab...
mikkorekstad/M30-DV
Module C (Model Appropriateness)/Response Distributions.py
Response Distributions.py
py
3,895
python
en
code
0
github-code
36
23297154753
""" Series Meta Analysis. Some day this will be either the parent class of TAM and Adoption, or at least used by them. For now, needed to have the general class for use in integrations where it is sometimes used in unique ways. Note, at this time, this class does *not* handle the interpolation, fitting, etc; we will ne...
ProjectDrawdown/solutions
limbo/sma.py
sma.py
py
6,839
python
en
code
203
github-code
36
24951711823
from flask import render_template, request, redirect from app import app from models.book import * from models.book_list import book_list, add_new_book, delete_book @app.route('/') def index(): return render_template('index.html', book_list = book_list) @app.route('/stock') def display_stock(): return render_...
sshingler/Flask-library_homework
controllers/controller.py
controller.py
py
1,287
python
en
code
0
github-code
36
30071209692
# -*- coding: utf-8 -*- """ This code is open-sourced software licensed under the MIT license""" """ Copyright 2019 Marta Cortes, UbiComp - University of Oulu""" """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to d...
CUTLER-H2020/DataCrawlers
Economic/antalya_econ_cityofantalya_cityzonepuplictransportationpasengernumber_monthly.py
antalya_econ_cityofantalya_cityzonepuplictransportationpasengernumber_monthly.py
py
5,426
python
en
code
3
github-code
36
36728615207
from pwn import * from time import sleep port = 11021 pw= '13462b403d91edd8c8389517c1eca3ed' for i in range(1,40): print(pw) sleep(2) context.arch='amd64' #p = process('./lol2.bin') p = remote("auto-pwn.chal.csaw.io", port) #pid = gdb.attach(p, gdbscript=""" # b * runChallenge # ...
Aleks-dotcom/ctf_lib_2021
csaw_finals/pwn/crafty/parser.py
parser.py
py
2,317
python
en
code
1
github-code
36
36819222640
# type: ignore with open("input") as f: program = [tuple(line.strip().split()) for line in f] cycle = 0 reg = 1 rem = 0 strength = 0 out = [] for inst in program: if inst[0] == "addx": rem = 2 op = lambda r: r + int(inst[1]) elif inst[0] == "noop": rem = 1 op = lambda r: r ...
ocaballeror/adventofcode2022
10/day10.py
day10.py
py
791
python
en
code
0
github-code
36
13397163994
"""First prediction agent based on neural network.""" import numpy as np from dlgo.agent.base import Agent from dlgo.agent.helpers import is_point_an_eye from dlgo import encoders from dlgo import goboard from dlgo import kerasutil class DeepLearningAgent(Agent): """Deep Learning Agent Class.""" def __init__(...
Nkonovalenko/GoAI
dlgo/agent/predict.py
predict.py
py
2,968
python
en
code
0
github-code
36
2582809755
#In this challenge, you get to be the _boss_. You oversee hundreds of employees across the country developing Tuna 2.0, a world-changing snack food based on canned tuna fish. Alas, being the boss isn't all fun, games, and self-adulation. The company recently decided to purchase a new HR system, and unfortunately for yo...
pratik509/python-challenge
Pyboss/pyboss.py
pyboss.py
py
4,175
python
en
code
0
github-code
36
8158020365
import requests import urllib import json import time import pymysql def get_latitude_longtitude(address): address = urllib.parse.quote(address) url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + address+"&key=AIzaSyAzA3f6KHEpViCBcLFSWS3a2ywVr3fCIvY" while True: res = requests.get...
NTUBimd1092/project-1
python/GeoAPI.py
GeoAPI.py
py
1,979
python
en
code
0
github-code
36
21037490132
''' Thought process: create new container, fill up all elements from nums1 and nums2 find median. Time complexity O(m+n) ''' class Solution: def findMedianSortedArrays(self, nums1: list[int], nums2: list[int]) -> float: combine_list = [] i1 = 0 i2 = 0 while i1 < len(nums1) and i...
lochuhsin/LeetCodeRepo
algorithm/array/4. Median of Two Sorted Arrays(hard).py
4. Median of Two Sorted Arrays(hard).py
py
2,038
python
en
code
3
github-code
36
16127772066
import cv2 import imageio import pathlib def fadeInGif(pathimg1, pathimg2, filegif, len=10, frames_per_second=2): img1 = cv2.imread(pathimg1) img2 = cv2.imread(pathimg2) listimg = [] for seq in range(0,len): fadein = seq/float(len) dst = cv2.addWeighted(img1, 1-fadein, img2, fadein, 0...
doubsman/LedPanel64
python_dev/TransitionGif.py
TransitionGif.py
py
634
python
en
code
1
github-code
36
35438464473
from torch.utils.data import random_split import torch import argparse import json from pathlib import Path from dataloader import SquadLocalContextContrastiveDataset, QuacLocalContextContrastiveDataset, get_quac_sets, get_squad_sets from model import QClip from trainer import Trainer from tracker import WandBTracker ...
Veldrovive/QuestionContext
main.py
main.py
py
10,429
python
en
code
0
github-code
36
6703674654
import os, shutil from datetime import datetime, timedelta from tkinter import * import tkinter as tk from tkinter import filedialog, messagebox, ttk import sqlite3 def load_gui(self): # GUI set up using tkinter. self.lbl_origin = tk.Label(self.master, bg = "silver", text = "Origin directory:...
sajibhaskaran/Python_drills
PyDrill_db/modified_files_gui.py
modified_files_gui.py
py
7,843
python
en
code
0
github-code
36
21664219940
""" Receive an image - Global binarize image - Find word (connected component RETR_BOUNDARY) - Find Rectilinear Polygon Return an list of points in order """ import cv2 import numpy as np import sys import matplotlib.pyplot as plt PADDING = 2 def binarize(img): gray = cv2.cv...
qcuong98/clabel
rectilinear_polygon.py
rectilinear_polygon.py
py
3,815
python
en
code
0
github-code
36
28932021496
from django.shortcuts import render, redirect from models import Book # Create your views here. def index(request): books = Book.objects.all; context = { 'books': books } return render(request, 'app/index.html', context) def process(request): if request.method == "POST": Book.objec...
melissaehong/AllProjects
Python/django/fullstackbooks/apps/app/views.py
views.py
py
460
python
en
code
1
github-code
36
37244411947
# -*- coding: utf-8 -*- """ CAD120 data reader that is compatible with QSRlib. :Author: Yiannis Gatsoulis <y.gatsoulis@leeds.ac.uk> :Organization: University of Leeds """ from __future__ import print_function, division import sys import argparse import timeit import ConfigParser import os try: import cPickle as p...
gatsoulis/strands_data_to_qsrlib
src/cad120/cad120_qsr_keeper.py
cad120_qsr_keeper.py
py
4,946
python
en
code
0
github-code
36
70846797543
from pymongo import MongoClient from datetime import datetime import os, sys sys.path.append(os.path.join(os.path.dirname(sys.path[0]), 'backend')) import Model import Repository as repo def make_seats(secL, secH, rowL, rowH, seatL, seatH, secI=1, rowI=1, seatI=1): seats = [] for sec in range(secL, secH, secI...
DannyBarbaro/SeatSwap
db_code/EventCreator.py
EventCreator.py
py
1,618
python
en
code
0
github-code
36
27894883857
def articulation_points_util(graph, u, visited, disc, low, parent, time, result): visited[u] = True disc[u] = time[0] low[u] = time[0] time[0] += 1 children = 0 for v, w in enumerate(graph[u]): if w: if v == parent[u]: continue elif visited[v]: ...
stgleb/algorithms-and-datastructures
graphs/articulation_points.py
articulation_points.py
py
1,325
python
en
code
0
github-code
36
3721701885
import environ from io import BytesIO from PIL import Image, ImageFilter env = environ.Env() FILTERED_FILES = env('FILTERED_FILES', default='process_service/tmp/filtered') def filter(file, filename, ext, method='blur', is_file=False): filt = filt_obj.get(method, None) Filter = getattr(ImageFilter, filt) ...
olacodes/prog-image
process_service/filtering/filter.py
filter.py
py
875
python
en
code
1
github-code
36
22153329187
x = int(input()) for i in range(x): a, b = list(map(int, input().split())) result = b - a d = result % 2 if result > 0: if d == 0: print(2) else: print(1) elif result < 0: if d == 0: print(1) else: print(2)...
saurav912/Codeforces-Problemset-Solutions
CDFAddOddorSubtractEven.py
CDFAddOddorSubtractEven.py
py
658
python
en
code
0
github-code
36
20832740847
import awkward as ak from pocket_coffea.lib.cut_definition import Cut def dilepton(events, params, year, sample, **kwargs): MET = events[params["METbranch"][year]] # Masks for same-flavor (SF) and opposite-sign (OS) SF = ((events.nMuonGood == 2) & (events.nElectronGood == 0)) | ( (events.nMuonGood ...
ryanm124/AnalysisConfigs
configs/ttHbb/custom_cut_functions.py
custom_cut_functions.py
py
1,172
python
en
code
null
github-code
36
72219406185
import math import os.path from os.path import join import random import torch from torch.utils.data import DataLoader, Dataset from typing import Dict, AnyStr, Any from torchvision.transforms import transforms from .image_folder import is_image_file, make_dataset from PIL import Image import numpy as np from PIL imp...
leelxh/Adaptive-Texture-Filtering-for-Single-Domain-Generalized-Segmentation
texture_filter/datasets/smoothing_dataset.py
smoothing_dataset.py
py
1,899
python
en
code
5
github-code
36
21189060933
class Solution: def countBits(self, n: int) -> List[int]: # 결과값을 저장할 list를 미리 선언해준다. results = [0] # 1부터 n까지의 반복횟수를 지정해준다. for i in range(1, n+1): # i와 i-1의 비트 AND연산을 수행& +1하여 가장 오른쪽 비트를 제거 -> 1의 개수를 센다. results.append(results[i & i-1] + 1) return res...
KimGiii/Algorithm
0338-counting-bits/0338-counting-bits.py
0338-counting-bits.py
py
438
python
ko
code
0
github-code
36
12040540403
import os, sys, logging, glob2, csv import numpy as np import pandas as pd from sklearn.metrics.pairwise import cosine_similarity def create_directory(name): """ Create directory if not exists Parameters ---------- name : string name of the folder to be created """ try: ...
stannida/skill-embeddings
utils/helper_functions.py
helper_functions.py
py
3,147
python
en
code
1
github-code
36
14487480169
import urllib.request, urllib.parse from difflib import SequenceMatcher import json from msvcrt import getch serviceurl = 'http://www.omdbapi.com/?' apikey = '&apikey='+'da05069b' abv90=[] def match(s1, s2): s2p=s2[0:len(s1)] s1p=''.join(d for d in s1 if d.isalnum()) s2p=''.join(d for d in s2p if d.isa...
souvikchakraborty98/QuickScripts
z_test_1.py
z_test_1.py
py
1,554
python
en
code
0
github-code
36
14072972599
import player def get_player_details(): # Fill the code for getting user inputs and creating the card object name=input("Enter the Player Name :") matches=int(input("Enter the No of Matches Played:")) player_obj=player.Player(name,matches) return player_obj player_obj = get_player_details() no_o...
vivek0807/AllCodes
Python/main.py
main.py
py
607
python
en
code
1
github-code
36
74792104104
# this is not CURE, just heirarchical clustering # this is used to practice making a clustering algorithm import numpy as np import matplotlib.pyplot as plt import math # a vertex is just an x position and a y position # this makes is easier for grouping vertices together # rather than having 2 arrays for the x and ...
AdamPoper/CPSC-480-CURE-Clustering
heirarchical_clustering.py
heirarchical_clustering.py
py
9,062
python
en
code
0
github-code
36
12248576934
###################################################################### # Script for processing Diss. # # (C) Christoph Schaller, BFH ###################################################################### import os import sys import math import glob import numpy as np import fiona from shapely.geometry import Point...
HAFL-WWI/FINTCH-publication-code
2022-improving-local-maxima-idt/python/detection/Processing/fintch_processing_process_pub.py
fintch_processing_process_pub.py
py
14,644
python
en
code
0
github-code
36
40571855871
import unittest import os import shutil from ls import get_dir_files, get_dir_files_count, get_file_contents, get_file_line_count from .stubs import create_temp_file, get_test_file_path, TEST_DIR_PATH, TEST_SUBDIR_PATH class TestFilesHelpers(unittest.TestCase): def setUp(self): os.mkdir(TEST_DIR_PATH) ...
eveningkid/ls
tests/test_file_helpers.py
test_file_helpers.py
py
2,551
python
en
code
0
github-code
36
72549427943
import traceback from fastapi import HTTPException, Request from fastapi.exceptions import RequestValidationError from starlette.exceptions import HTTPException as StarletteHTTPException from starlette.responses import JSONResponse from tortoise.exceptions import IntegrityError from config import config from utils.pa...
OpenTreeHole/treehole_backend
utils/exceptions.py
exceptions.py
py
1,981
python
en
code
0
github-code
36
19544626210
# pip install pipwin # pip install pyaudio import pyaudio import wave from datetime import datetime, timedelta import numpy as np from multiprocessing import shared_memory def runCapture(recDevice, rec_controls_sm, saveFilesPath, SECONDS = 1): rec_controls = rec_controls_sm.buf p = pyaudio.PyAudi...
Richard-Kershner/Audio-Video-Screen-TimeStamp-Recorder
rec_audio.py
rec_audio.py
py
4,034
python
en
code
0
github-code
36
28630475186
from densefog import web import flask # noqa from icebox.model.iaas import image as image_model def describe_images(): params = web.validate_request({ 'type': 'object', 'properties': { 'limit': { 'type': 'integer', 'minimum': 1, 'maximu...
hashipod/icebox
core/icebox/api/public/image.py
image.py
py
3,641
python
en
code
0
github-code
36
12553211459
import datetime current_weight = 220 goal_weight = 180 average_lbs_week = 1.5 start_date = datetime.date.today() print('Today\'s Date is: {:%B %d, %Y}'.format(start_date)) end_date = start_date # print(end_date) while current_weight > goal_weight: end_date += datetime.timedelta(days=7) current_weigh...
iampaavan/Pure_Python
Weekly_Goal.py
Weekly_Goal.py
py
506
python
en
code
1
github-code
36
36289747092
from kafka.producer import KafkaProducer TOPIC_NAME = "kafka.client.tutorial" # producer는 생성한 레코드를 전송하기 위해 전송하고자 하는 토픽을 알고 있어야 한다. BOOTSTRAP_SERVER_HOST = "kafka_tutorial:9092" # 전송하고자 하는 카프카 클러스터 서버의 host와 IP를 지정 KEY_SERIALIZER = str.encode VALUE_SERIALIZER = str.encode producer = KafkaProducer( bootstrap_serve...
2h-kim/kafka-personal-study
simple-kafka-producer/kafka-producer-key-value.py
kafka-producer-key-value.py
py
833
python
ko
code
0
github-code
36
2356478535
from __future__ import print_function import argparse import cgi import locale import os import re import sys from .. import cli from .. import hocr from .. import ipc from .. import logger from .. import temporary from .. import text_zones from .. import unicode_support from .. import utils from .. import version f...
jwilk-archive/ocrodjvu
lib/cli/djvu2hocr.py
djvu2hocr.py
py
11,591
python
en
code
41
github-code
36
22354363555
import datetime import traceback import typing import humanfriendly import mergedeep import pytz import sqlalchemy.orm import mlrun.common.schemas import mlrun.config import mlrun.errors import mlrun.utils import mlrun.utils.helpers import mlrun.utils.regex import mlrun.utils.singleton import server.api.crud import s...
mlrun/mlrun
server/api/utils/projects/follower.py
follower.py
py
18,072
python
en
code
1,129
github-code
36
5462088920
import cv2 import numpy as np import logging from skimage import io import time from multiprocessing import Lock mutex = Lock() class AClassify: def __init__(self,uuid,net,image,s_client): logging.debug("intialisation is requested") self.url = s_client.generate_presigned_url(ClientMethod='get_objec...
gitibeyonde/pyms
lib/AnalyticsClassify.py
AnalyticsClassify.py
py
1,480
python
en
code
0
github-code
36
6999547749
# Functions to calculate optical flow import opyf import utils def analyze_frames(element): dir = "/media/madziegielewska/Seagate Expansion Drive/Diploma-Project/" analyzer = opyf.frameSequenceAnalyzer(f"{dir}Demo-App/static/segmentation_results/{element}") num = analyzer.number_of_frames utils.del...
mdziegielewska/Diploma-Project
Demo-App/opticalflow.py
opticalflow.py
py
994
python
en
code
0
github-code
36
16912146541
""" Setup Module for Blob Creator Author: Michael Kohlegger Date: 2021-09 """ import setuptools with open("README.md", "r", encoding="utf8") as readme_file: readme = readme_file.read() with open('requirements.txt', "r", encoding="utf8") as requirement_file: requirements = requirement_file.read().splitlines(...
mckoh/blob_creator
setup.py
setup.py
py
1,076
python
en
code
1
github-code
36
3511755621
import random print("Infinity Dice") def infinityDice(): running = True while running: sides = int(input("How many sides do you want?: ")) roll = random.randint(1,sides) print(f"You rolled {roll}") if input("Do you want to roll again? (y/n):") == "n": exit() infinityDice()
tanapolark/100_days_coding_python
day_24_def_2.py
day_24_def_2.py
py
303
python
en
code
0
github-code
36
20766513047
import sslscan from sslscan import modules from sslscan.module.scan import BaseScan class SSLScanScanner: def __init__(self, target): self.target = target self.scanner = sslscan.Scanner() def scan(self): self.scanner.scan(self.target) for server in self.scanner.get_results(): ...
shadowaxe99/MORE-AGENTS
cybersecurity_scanner/sslscan_scanner/sslscan_scanner.py
sslscan_scanner.py
py
655
python
en
code
0
github-code
36
34353630412
import dash_pivottable import dash_html_components as html def make_pivot_table(df): columns_in_table=["CLIMA_AMBIENTAL", "PAISAJE", "CODIGO", 'TIPO_RELIEVE', 'FORMA_TERRENO', 'MATERIAL_PARENTAL_LITOLOGIA', 'ORDEN',] new_df=df[columns_in_table].dropna() Data_to_use = [list(new_df)] + new...
DS4A-Team19-2021/Agustin-Codazzi-Project
apps/utils/utils_pivot_table.py
utils_pivot_table.py
py
782
python
en
code
1
github-code
36
28037620802
from setuptools import find_packages, setup # read the contents of README file from os import path from io import open # for Python 2 and 3 compatibility # get __version__ from _version.py ver_file = path.join('tensorpi', 'version.py') with open(ver_file) as f: exec(f.read()) this_directory = path.abspath(path....
xinychen/TensorPi
setup.py
setup.py
py
1,800
python
en
code
3
github-code
36
24011968546
# -------------------------------------------------------- # Licensed under The MIT License [see LICENSE for details] # -------------------------------------------------------- import numpy as np import os import sys from transforms3d.quaternions import * from transforms3d.euler import * from transforms3d.axangles imp...
liruiw/HCG
core/utils.py
utils.py
py
48,148
python
en
code
13
github-code
36
24593511416
# 4. Write a program that converts some amount of money from USD to BYN, # ask a user for the amount, store the ratio inside the program itself. usd = input("Enter the amount in US dollars:\n ") try: usd = float(usd) except ValueError: print("Data entry error.") exit() exchange_rates = 3.05 byn = usd * exc...
MikitaTsiarentsyeu/Md-PT1-69-23
Tasks/Voltov/Task1/task4.py
task4.py
py
392
python
en
code
0
github-code
36
10353313162
import streamlit as st import pickle model_random = pickle.load(open("model/forest.pkl", "rb")) from utils import head, body hasil = head() if st.button("Submit"): name, MDVP_FO,MDVP_FHI, MDVP_FloHz,MDVP_JitterPercent,MDVP_JitterAbs, MDVP_RAP, MDVP_PPQ,Jitter_DDP,MDVP_Shimmer,MDVP_ShimmerDb,Shimmer_APQ3, Shimmer...
FathanKhansaArby/FinalProject083
app/main.py
main.py
py
833
python
en
code
0
github-code
36
70987576744
#!/usr/bin/python2.7 import rospy from sensor_msgs.msg import Image import cv2 from cv_bridge import CvBridge bridge = CvBridge() def show_webcam(): cam = cv2.VideoCapture(0) if not cam.isOpened(): raise IOError("Cannot open webcam") while True: ret_val, img = cam.read() cv2.imsh...
E-pep/HaldisBot
catkin_ws/src/Line_Follower_pkg/imgPub.py
imgPub.py
py
924
python
en
code
1
github-code
36
21165644420
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from matrix import * from rand import rand_normal class Dense: """全连接层 Args: input_num: 输入节点数 units: 输出节点数 Attributes: inputs: 输入 inputs_grad: 输入的梯度 units: 输出节点数 kernel: 权值 kernel_grad: 权值的梯度 b...
straicat/data-mining-assignment
layer.py
layer.py
py
4,131
python
en
code
0
github-code
36
7998654007
def Theory(): t = str(input("이론값을 입력해주십시오 : ")) if not isfloat(t) or float(t) <= 0: return Theory() else: return float(t) def Experiment(): e = str(input("실험값을 입력해주십시오 : ")) if not isfloat(e) or float(e) < 0: return Experiment() else: return float(e) def isfloat(s): (m,_,n) = s.partition(".") return...
kyj0701/SoftWare2017
error.py
error.py
py
822
python
ko
code
0
github-code
36
15975975433
# *-* coding: utf-8 *-* """ Created on sam 22 mai 2021 19:11:56 CEST @author : vekemans """ import numpy as np from numpy.fft import \ rfft,irfft,fftfreq,\ rfft2,irfft2,rfftfreq from scipy import sparse from scipy.interpolate import interp2d import matplotlib import matplotlib.pyplot as plt nfig = 1 imp...
abbarn/lmeca2300
project/pylib/convergence.py
convergence.py
py
2,416
python
en
code
0
github-code
36
38688339389
import torch from utils.metrics import AURC import numpy as np from utils.measures import MSP def centralize(y:torch.tensor): return y-(y.mean(-1).view(-1,1)) def p_norm(y:torch.tensor,p, eps:float = 1e-12): if p is None or p == 0: return torch.ones(y.size(0),1,device=y.device) else: return y.norm(p=p,dim=...
lfpc/pNormSoftmax
pNormSoftmax.py
pNormSoftmax.py
py
3,632
python
en
code
1
github-code
36
74457197862
import json import os import sys import time from apscheduler.schedulers.blocking import BlockingScheduler from public import redis_con,get_conn from data_change import get_setting # 将数据查询到redis中 def get_data(): con = get_conn() cur = con.cursor() sql = f"SELECT id,title,Ncontent from {get_setting()} wher...
AYongmengnan/zimeiti
zimeiti/get_data_redis.py
get_data_redis.py
py
1,434
python
en
code
0
github-code
36
35376239294
# time-dependent solutions for P_00(t), P_01(t), and P_10(t) and P_01(t) # taken from Anderson 2017 Lecture Notes on Stochastic Processes with Applications in Biology # P_00(t) is the chance of being in the inactive state at t=t, given being in the inactive state at t=0 # or P_00(t) = P(x_t = 0 | x_0 = 0) with x=0 is b...
resharp/scBurstSim
solution/nonstat_markov.py
nonstat_markov.py
py
1,894
python
en
code
3
github-code
36
932629353
import datetime from neutron.common import rpc as proxy from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) class HeloAgentNotifyAPI(proxy.RpcProxy): """API for plugin to ping agent.""" BASE_RPC_API_VERSION = '1.0' def __init__(self, topic=None, version=None): ...
CingHu/neutron-ustack
neutron/api/rpc/agentnotifiers/helo_rpc_agent_api.py
helo_rpc_agent_api.py
py
1,219
python
en
code
0
github-code
36
22292420863
# 0. 동빈나 책. 1이 될때 까지. # 1. greedy # 2. 빼야한다면 빼고, 나눌수있다면 나누기먼저. # 입력예제 # 17 4 답은 3 n,k=map(int,input().split()) count=0 while 1: temp=(n//k)*k count+=n-temp n=temp if n<k: break count+=1 n//=k count+=n-1 print(count)
98hyun/algorithm
greedy/b_3.py
b_3.py
py
317
python
ko
code
0
github-code
36
69912139304
from ._common import basic_element SCHEMA = { "type": "dict", "required_keys": {"content": {"type": "string", "nullable": True}}, "optional_keys": {"urgent": {"type": "boolean", "default": False}}, } announcement_box = basic_element("announcement_box.html", SCHEMA)
eldridgejm/automata
automata/api/coursepage/elements/announcement_box.py
announcement_box.py
py
281
python
en
code
0
github-code
36
11358969821
import sys sys.stdin = open('일곱난쟁이.txt') def comb(dep=0): global check if check == 1: return if len(arr) == n: tmp = 0 for i in range(n): tmp += arr[i] if tmp == 100: check = 1 for j in sorted(arr): print(j) return ...
Jade-KR/TIL
04_algo/study/01/일곱난쟁이.py
일곱난쟁이.py
py
564
python
en
code
0
github-code
36
451073459
#!/usr/bin/python3 from .config_utils import get_base_config from .log_utils import get_module_logger import DNS import os import sys import time import validators CDIR = os.path.dirname(os.path.realpath(__file__)) ROOTDIR = os.path.abspath(os.path.join(CDIR, os.pardir)) BASECONFIG = get_base_config(ROOTDIR) LOGGI...
phage-nz/ph0neutria
core/dns_utils.py
dns_utils.py
py
1,379
python
en
code
299
github-code
36
17895276920
from typing import Dict, Mapping, Sequence, Text, Union import seqio import tensorflow as tf AUTOTUNE = tf.data.experimental.AUTOTUNE NALUE_INPUT_NAME = 'sentence' NALUE_OUTPUT_NAMES = ('vertical', 'domain', 'intent') T5Text = Union[tf.Tensor, Text] def toxic_comments_preprocessor_binary_classification( datas...
google/uncertainty-baselines
baselines/t5/data/preprocessors.py
preprocessors.py
py
11,183
python
en
code
1,305
github-code
36