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
36988267529
# TODO merge naive and weighted loss. import torch import torch.nn.functional as F def weighted_nll_loss(pred, label, weight, avg_factor=None): if avg_factor is None: avg_factor = max(torch.sum(weight > 0).float().item(), 1.) raw = F.nll_loss(pred, label, reduction='none') return torch.sum(raw * w...
implus/PytorchInsight
detection/mmdet/core/loss/losses.py
losses.py
py
4,005
python
en
code
845
github-code
36
39556953839
import pytest def Fibonacci(n): # Check if input is 0 then it will print incorrect input if n < 0: print("Incorrect input") # Check if n is 0 then it will return 0 elif n == 0: return 0 # Check if n is 1,2 it will return 1 elif n == 1 or n == 2: return 1 else:...
Orya-s/U_code-CyberArk
exercises/week5/PythonIntermediate/tests/test_ex_1.py
test_ex_1.py
py
480
python
en
code
0
github-code
36
8617197984
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Fetching user description and subscriptions given a channel id. Usage: python 11_scrape_youtube_subscriptions.py Input data files: data/mbfc/to_crawl_users.csv Output data files: data/mbfc/active_user_subscription.json.bz2 """ import up # go to root folder import o...
avalanchesiqi/youtube-crosstalk
crawler/10_scrape_youtube_subscriptions.py
10_scrape_youtube_subscriptions.py
py
2,192
python
en
code
11
github-code
36
18369494327
import pandas as pd import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn.svm import LinearSVC from sklearn.metrics import confusion_matrix #Function importing data from .txt file def gatherData(directory): with open(directory, "rb") as myFile: data_table = pd.read_csv(myFile,...
trcz/human-activity-prediction
activity_prediction.py
activity_prediction.py
py
1,585
python
en
code
1
github-code
36
8460120819
#!/usr/bin/python3 # 文件名:client.py # 导入 socket、sys 模块 import socket from time import ctime import sys import os import time # host = socket.gethostname() host = "172.16.1.14" port = 6666 BUFSIZ = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) while True: d...
yywbxgl/onnx_tools
python_script/runtime_client.py
runtime_client.py
py
1,107
python
en
code
2
github-code
36
35098607020
import numpy as np from numpy import genfromtxt from functools import reduce #--- przerabianie grzybow ---# mushroom = genfromtxt('dane/mushroom.csv', delimiter=',' ,dtype = str) classes = mushroom[:,0].copy() last = mushroom[:,-1].copy() training_set= mushroom training_set[:,0]= last training_set[:,-1]=clas...
iSeptio/archive_ML_mushroom_clasification_tree
lista1.py
lista1.py
py
7,049
python
en
code
0
github-code
36
12487134300
""" Functions - Lab Check your code: https://judge.softuni.bg/Contests/Practice/Index/1727#0 SUPyF2 Functions-Lab - 01. Grades Problem: 1. Grades Write a function that receives a grade between 2.00 and 6.00 and prints the corresponding grade in words • 2.00 – 2.99 - "Fail" • 3.00 – 3.49 - "Poor" • 3.50 – 4...
SimeonTsvetanov/Coding-Lessons
SoftUni Lessons/Python Development/Python Fundamentals September 2019/Problems And Files/12 FUNCTIONS - Дата 9-ти октомври, 1830 - 2130/01. Grades.py
01. Grades.py
py
831
python
en
code
9
github-code
36
13213708677
from bson import ObjectId from pydantic import BaseModel, Field from typing import Optional class PyObjectId(ObjectId): @classmethod def __get_validators__(cls): yield cls.validate @classmethod def validate(cls, v): if not ObjectId.is_valid(v): raise ValueError("Invalid ob...
danbeaumont95/e-commerce-app-backend
app/address/model.py
model.py
py
2,057
python
en
code
0
github-code
36
3270675130
import os import csv File = os.path.join("Resources","election_data.csv") count_khan = 0 count_correy = 0 count_votes = 0 count_Li = 0 count_tooley = 0 candidates = [] with open(File) as csvfile: csvreader = csv.reader(csvfile, delimiter=",") next(csvreader, None) for row in csvreader: ...
Jrfelix13/Winning-Losing-with-Python
election_data_PY.py
election_data_PY.py
py
1,839
python
en
code
0
github-code
36
2251108548
""" PySynth Output Classes We contain the PySynth OutputHandler, and OutputControl. Both classes handle and manage output from synth chains, and send them to output modules attached to the Control class. The Output class is the engine of this process, pulling audio info and passing it along. The OutputControl class ...
Owen-Cochell/python-audio-synth
pysynth/output/base.py
base.py
py
18,629
python
en
code
1
github-code
36
9261684422
from queue import PriorityQueue class Graph: # edges is a matrix and the size of the matrix depends on the number of vertices def __init__(self, numOfVertices): self.v = numOfVertices self.visited = [] self.edges = [[-1 for i in range(numOfVertices)] for j in range(numOfVertices)] ...
adelewg/algorithms
dijkstra.py
dijkstra.py
py
736
python
en
code
0
github-code
36
75071113384
import requests import pandas as pd import numpy as np import seaborn as sns from bs4 import BeautifulSoup import warnings import nltk #import surprise import scipy as sp from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer from nltk.corpus import stopwords ...
Liixxn/MovieMender
tags.py
tags.py
py
6,909
python
en
code
1
github-code
36
18457796268
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response import Image as PILImage from uds.core.util.stats import charts from uds.core.auths.auth import webLoginRequired fr...
karthik-arjunan/testuds
server/src/uds/admin/views/reporting/usage.py
usage.py
py
3,158
python
en
code
1
github-code
36
2847707503
# Qus:https://leetcode.com/problems/maximal-rectangle/ # time complexity is O(n*2n) # 2*n for calculating max Rectangle for a row # n for number of rows in the matrix def largestRectangleArea(h): """ :type heights: List[int] :rtype: int """ # try to draw a graph first # ...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Maximal Rectangle.py
Maximal Rectangle.py
py
2,343
python
en
code
2
github-code
36
34696314892
#!/usr/bin/env python3 # coding : utf-8 # @author : Francis.zz # @date : 2021-06-30 15:25 # @desc : 创建线程池 from multiprocessing import Pool from concurrent.futures import ThreadPoolExecutor import os, time, random def call_func(name): print('Run task %s (%s)...' % (name, os.getpid())) # 调用cmd命令的任务函数 def cal...
zzfengxia/python3-learn
use_process_pool.py
use_process_pool.py
py
1,365
python
en
code
0
github-code
36
7165695440
def projectionArea(grid: list[list[int]]) -> int: projection_x = sum(max(i) for i in grid) projection_z = sum(j > 0 for i in grid for j in i) projection_y = sum(max(s[i] for s in grid) for i in range(len(grid))) return sum([projection_x, projection_y, projection_z]) grid = [[1, 2], [3, 4]] # grid = [...
SafonovVladimir/mornings
05 may/15.py
15.py
py
364
python
en
code
0
github-code
36
28518041187
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from urbansim.datasets.dataset import Dataset as UrbansimDataset from opus_core.datasets.dataset_factory import DatasetFactory from opus_core.storag...
psrc/urbansim
psrc_parcel/datasets/faz_persons_dataset.py
faz_persons_dataset.py
py
4,601
python
en
code
4
github-code
36
18021354525
# in aridity_comparison2 def IA_two(T): if np.isnan(T): return np.nan elif ((T == 1) or (T == 2) or (T == 3) or (T == 4)): return 10 else: return 20 def RA_two(T): if np.isnan(T): return np.nan elif (T == 1) or ((T == 2) or (T == 3) or (T == 4) or (T == 5)): ...
adrHuerta/GCC2_aridity_changes
src/utils.py
utils.py
py
2,339
python
en
code
1
github-code
36
12573117304
from tkinter import * from datetime import date from tkinter import messagebox from PIL import Image from tkinter.ttk import Combobox import openpyxl from openpyxl import Workbook import pathlib import tkinter as tk import customtkinter from tkinter import ttk #initial customtkinter.set_appearance_mode("System") textco...
agarg1107/healthcare
doc.py
doc.py
py
24,634
python
en
code
0
github-code
36
37775641382
"""给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。""" # 定义一个单链表 class ListNode: def __init__(self, x): self.val = x self.next = None # val代表值,next代表指针 class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head # head是...
cookie-rabbit/LeetCode_practice
easy/83/1.py
1.py
py
1,027
python
zh
code
1
github-code
36
41524333829
import cv2 # working with, mainly resizing, images import numpy as np # dealing with arrays import os # dealing with directories from random import shuffle # mixing up or currently ordered data that might lead our network astray in training. from tqdm import tqdm # a nice p...
MourabitElBachir/Face_Detection_Deep_Learning
code/preparing_data.py
preparing_data.py
py
1,845
python
en
code
0
github-code
36
1408772797
name = "on-temp-status-change-notifier-slack" add_files = ( "ruleset.py", ) add_modules = True # find modules in directory (folders having __init__.py file) and add them to container extra_commands = ( # ("RUN", "pip install my-wonderful-lib==1.0") ) labels = { "networking.knative.dev/visibility": "clu...
airspot-dev/iot-demo
rulesets/apps/class-a/on-temp-status-change-notifier-slack/__deploy__.py
__deploy__.py
py
1,243
python
en
code
1
github-code
36
69816265383
"""Stream type classes for tap-sharepointsites.""" from singer_sdk.typing import ( DateTimeType, ObjectType, PropertiesList, Property, StringType, ) from tap_sharepointsites.client import sharepointsitesStream class ListStream(sharepointsitesStream): """Define custom stream.""" primary_...
storebrand/tap-sharepointsites
tap_sharepointsites/streams.py
streams.py
py
1,003
python
en
code
2
github-code
36
38164483571
import itertools import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from matplotlib import gridspec from scipy import linalg from scipy.optimize import basinhopping from skimage.filters import gabor_kernel from skimage.transform import resize from sklearn import feature_selection from sklearn....
franzigeiger/training_reductions
analysis/fit_gabor_filters.py
fit_gabor_filters.py
py
23,923
python
en
code
3
github-code
36
14415686598
#!/usr/bin/env python3 from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.preprocessing import StandardScaler from sklearn.svm import SVR from sklearn.ensemble import RandomForestRegressor class Surrogate: """ Surrogate models """ def __init__(self, hparams): self.model_n...
RobinSeaside/S4IS
src/Surrogate.py
Surrogate.py
py
2,259
python
en
code
1
github-code
36
25525348936
OKGREEN = '\033[92m' OKCYAN = '\033[96m' WARNING = '\033[93m' ENDC = '\033[0m' data = [29, 10, 14, 37, 14, 20, 7, 16, 12] def PrintColorData(data, i, j): for index, value in enumerate(data): if i-j > 1 and index == i-1: print(OKCYAN + str(value) + ENDC, end=' ') elif index == j: ...
KonkanokAinthong/Lab8
Ex3.py
Ex3.py
py
1,285
python
en
code
0
github-code
36
36048548399
import os from uuid import uuid4 from datetime import timedelta SECRET_KEY = os.urandom(32) # Grabs the folder where the script runs. basedir = os.path.abspath(os.path.dirname(__file__)) # create JWT secretkey JWT_SECRET_KEY = 'm.f.ragab5890@gmail.comtafi_5890_TAFI' JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=12) # Ena...
mfragab5890/shop-sales
backend/instance/config.py
config.py
py
478
python
en
code
0
github-code
36
16354953325
import configparser # implements a basic configuration language for Python programs import os # provides a portable way of using operating system dependent functionality import sys # system-specific parameters and functions import numpy as np # the fundamental package for scientific computing with Python from logz...
cmikke97/Automatic-Malware-Signature-Generation
src/Model/nets/generators/dataset.py
dataset.py
py
6,823
python
en
code
9
github-code
36
23620664915
import math import sys import os import itertools import traceback import copy import datetime from collections import deque from collections import Counter from random import shuffle, choice import json import multiprocessing """ Hexagons are handled in the QRS coordinate system. Refer to https://www.redblobgames...
volzotan/LensLeech
pattern/generate.py
generate.py
py
26,043
python
en
code
5
github-code
36
70441911783
import sys input = sys.stdin.readline class Solution: def __init__(self) -> None: numCoins, target = map(int, input().split()) coins = [] for _ in range(numCoins): coins.append(int(input())) self.minimumUseOfCoins(coins, target) def minimumUseOfCoins(self, coins: li...
cjy13753/algo-solutions
baekjoon/solution_11047.py
solution_11047.py
py
595
python
en
code
0
github-code
36
19561046033
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @author:Scdh @file:#121 卖股票的最佳时机.py @time:2020/11/11 """ class Solution: """ 本题自己的解法和官方的解法,自己写的解法直接用双指针来操作的,官方解法通过比较当前最小值和当前最大收益来更新迭代寻找最大收益 """ def maxProfit(self, prices): """ 首先定义卖出价指针和买入价指针,循环判断卖出价-买入价的状态来判断当前最小买入价和更新最大收益 ...
Scdh2020/LeetCode
simple/#121 卖股票的最佳时机.py
#121 卖股票的最佳时机.py
py
2,911
python
zh
code
0
github-code
36
19739037889
from vigilo.models.tables import Dependency from vigilo.models.demo import functions from vigilo.models.test.controller import ModelTest class TestDependency(ModelTest): """Test de la table Dependency.""" klass = Dependency attrs = { 'weight': 42, 'warning_weight': 24, } def __i...
vigilo/models
src/vigilo/models/test/test_dependency.py
test_dependency.py
py
800
python
en
code
4
github-code
36
39916650041
import scrapy class QuotesSpider(scrapy.Spider): name="quotes" start_urls=[ 'http://quotes.toscrape.com/page/1/' ] def parse(self,response): for quote in response.xpath('//div[@class="quote"]'): yield { 'page':response.url, 'text':quote.xpath...
nigo81/python_spider_learn
scrapy/tutorial/tutorial/spiders/queots_spider.py
queots_spider.py
py
714
python
en
code
3
github-code
36
36120731703
import yaml from termcolor import colored import torch from fortex.nltk import NLTKSentenceSegmenter, NLTKWordTokenizer, NLTKPOSTagger from forte.common.configuration import Config from forte.data.multi_pack import MultiPack from forte.data.readers import MultiPackTerminalReader from forte.common.resources import Reso...
asyml/forte
examples/chatbot/chatbot_example.py
chatbot_example.py
py
4,076
python
en
code
230
github-code
36
38380409709
import pytest, os import warnings, collections, operator, logging import generic_utils ## see https://docs.pytest.org/en/latest/example/simple.html#incremental-testing-test-steps from typing import Dict, Tuple # store history of failures per test class name and per index in parametrize (if parametrize used) ##_test_f...
cp4cds/cmip6_range_check_old
scripts/local_pytest_utils.py
local_pytest_utils.py
py
11,159
python
en
code
1
github-code
36
73566784744
def main(): while True: print("Meniu:") print("1. Rezolvare expresii matematice") print("2. Evaluare expresii booleane") print("3. Verificare tip și valoare expresii") print("4. Calcul valoare variabilă întreagă z") print("5. Comparare și explicație expresii") ...
KetSchnaider/Anul2
PI/Lab1/lab1.py
lab1.py
py
6,272
python
ro
code
0
github-code
36
43104587774
import csv source = open("Protein.txt", "r") matrix = [[], [], [], [], [], []] for x in range(6): line = source.readline() while True: c = source.read(1) if c == '>' or c=='': break if (c!='\n' and c!='\r') : matrix[x].append(c) compare = open("BLOSUM62.txt", "r") compareator = [[0 for x in range(25)] ...
Ras-al-Ghul/UPGMA-Phylogenetic-Tree
Q2a.py
Q2a.py
py
1,420
python
en
code
2
github-code
36
7785334319
# Phylogenetic Trees via Maximum Parsimony # Ran Libeskind-Hadas # April 2016 # This program uses the Maximum Parsimony Method and Nearest Neighbor # Interchange to find a local optimum maximum parsimony phylogenetic tree # with branch lengths. # The input comprises a list of tip names, a list of characters, and # a ...
mattthewong/computational_biology
HW4/parsimony.py
parsimony.py
py
8,943
python
en
code
0
github-code
36
40569343475
from PySide6.QtWidgets import ( QComboBox, QGroupBox, QHBoxLayout, QLabel, QVBoxLayout, ) from game.ato.flight import Flight from game.ato.starttype import StartType from game.theater import OffMapSpawn from qt_ui.models import PackageModel class QFlightStartType(QGroupBox): def __init__(self...
dcs-liberation/dcs_liberation
qt_ui/windows/mission/flight/settings/QFlightStartType.py
QFlightStartType.py
py
1,582
python
en
code
647
github-code
36
9461209696
''' Scheduling Aircraft Landing (Static Case) with multiple runways Landing times of aircrafts are determined satisfying certain constraints Constraints- The aircraft should land within a predetermined time interval Clearance time between two landings should be satisfied if they are landing on ...
ayushjain1594/Aircraft-Landing-Schedule
static_case_multi_runway/schedule.py
schedule.py
py
5,577
python
en
code
3
github-code
36
3298505771
import socket class ACPCCommunication: def __init__(self, sock=None): if sock is None: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) else: self.sock = sock self.name = "ACPCCommunication" self.MSGLEN = 1024 def connect(self, host, port)...
jangmino/RLPokerBot
ACPCCommunication.py
ACPCCommunication.py
py
1,295
python
en
code
0
github-code
36
8757575635
# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import itertools import json from odoo import models, fields, api, _ from odoo.addons.sale.models.sale import SaleOrderLine as SOL from odoo.addons.sale.models.sale import SaleOrder as SO from odoo.tools import float_compare, float...
odof/openfire
of_sale/models/of_sale.py
of_sale.py
py
69,395
python
en
code
3
github-code
36
70618999465
import rospy from std_msgs.msg import Float32 from std_msgs.msg import Int16 import time a = 0 rospy.init_node('flag', anonymous=True) def listener(): while 1: flag = raw_input("enter flag: ") if flag == "f": global a a = a+1 #print(a) rospy.loginfo...
vamsi1961/auv-beginner-tutorials
src/log.py
log.py
py
456
python
en
code
0
github-code
36
14065564339
N = int(input()) switch = list(map(int, input().split())) S = int(input()) s_n = [] s_change = [1, 0] for i in range(S): s, n = map(int, input().split()) s_n.append([s, n]) for j in range(S): if s_n[j][0] == 1: for m in range(N): if not (m+1) % s_n[j][1]: switch[m] = s_...
yeon-june/BaekJoon
1244.py
1244.py
py
842
python
en
code
0
github-code
36
6655725401
import sys def check(lst): for i in range(0,len(lst)-1): if lst[i] in (lst[:i]+lst[(i+1):]): return False return True def main(): file=open('input','r') lst=file.readlines() for i in range(4,len(lst[0])-1): if check(lst[0][i-4:i]): print(i) brea...
cos-imo/AdventOfCode
2022/Jour 6/solution620221.py
solution620221.py
py
359
python
en
code
0
github-code
36
32685087909
#!/usr/bin/env python # -*- encoding: utf-8 -*- # @author: orleven from lib.core.env import * import json from sqlalchemy import and_ from flask import request from flask import Blueprint from lib.core.enums import ApiStatus from lib.core.model import DNSLog from lib.core.model import WebLog from lib.hander import db ...
orleven/Celestion
lib/hander/apihander.py
apihander.py
py
4,136
python
en
code
30
github-code
36
19589266829
import json import argparse from sklearn.metrics import classification_report from eval_F1 import exact_match_score, f1_score, metric_max_over_ground_truths import numpy as np def compute_span_f1(pred_span, gold_span): gold_start, gold_end = gold_span pred_start, pred_end = pred_span tp, fp, fn = 0, 0, 0 ...
blender-nlp/NewsClaims
eval/eval_claim_detection.py
eval_claim_detection.py
py
8,147
python
en
code
17
github-code
36
42819009238
#06 - Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1,…,n. n = int(input("Insert a number:")) choice = "x" while choice.lower() != "s" and choice.lower() != "p": choice = input("Do you want to compute\nThe sum of 1...
gvheisler/SimpleProblemsPython
SimpleProgrammingProblems/Elementary/06.py
06.py
py
660
python
en
code
0
github-code
36
75127650664
import sys from cravat import BaseAnnotator from cravat import InvalidData import sqlite3 import os class CravatAnnotator(BaseAnnotator): def annotate(self, input_data, secondary_data=None): out = {} achange = input_data['achange'] aa_321 = { 'Asp': 'D', 'Ser': 'S', 'Gln': 'Q', 'Lys...
KarchinLab/open-cravat-modules-karchinlab
annotators/dida/dida.py
dida.py
py
2,863
python
en
code
1
github-code
36
17096699473
import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics input_file = ('data_perf.txt') # Load data 載入資料 x = [] with open(input_file, 'r') as f: for line in f.readlines(): data = [float(i) for i in line.split(',')] x.append(data) X = np.array(x) # Find the best epsilon 找...
neochen2701/TQCPans
機器學習Python 3答案檔/MLA202.py
MLA202.py
py
1,602
python
en
code
4
github-code
36
28867458807
#!/usr/bin/env python3 import zipfile import wget import re # CoVoST2 translations file covost2_url = 'https://dl.fbaipublicfiles.com/covost/covost2.zip' # File with CommonVoice English sentences translated to Catalan by humans covost2_source_file = 'validated.en_ca.en' # Output file covost2_target_file = 'covost2-...
jmontane/covost2-ca
get_covost2.py
get_covost2.py
py
1,632
python
en
code
0
github-code
36
7789447417
#Ques - 1 (Index Based Iteration) lst=[10,346,895,8,4721] sum=0 for i in range(5): sum=sum+lst[i] print(sum) #List Based Iteration sum=0 ist=[10,346,895,8,4721] for value in ist: sum=sum+value print(sum)
diamondzxd/Python-classes
04th session/1st.py
1st.py
py
215
python
en
code
0
github-code
36
37458267107
from pprint import pprint from fukushima_population import data import json with open('periodic_table.json', 'r') as f: t = json.load(f) # print(t) for i in range(len(t["elements"])): n = t["elements"][i]["name"] sym = t["elements"][i]["symbol"] print(f"{n}という元素は{sym}と表記する") # lookup = {} # for e...
lbrichards/asaka
python_kiso_2021_05/dict_study.py
dict_study.py
py
539
python
en
code
2
github-code
36
13941103507
class Banka: jazyk = 1 def __init__(ucet,heslo,suma,pokusy,cislo): ucet.heslo = heslo ucet.suma = suma ucet.pokusy = pokusy ucet.cislo = cislo ucty = list() file = open("ucty.txt", "r") a = file.readline() while a != "": b = file.readline() c = file.readline() d = f...
pekacc/bankomat
bankomat.py
bankomat.py
py
5,031
python
en
code
0
github-code
36
7958737031
import argparse import glob import logging import os import random import re import shutil import stat import subprocess # Path to the directory containing this source file. SRC_DIR = os.path.dirname(os.path.realpath(__file__)) BINARIES_DIR = os.path.join(SRC_DIR, 'binaries') def generate_shaders(no_of_files, output...
google/randomized-graphics-shaders
clusterfuzz-black-box-fuzzers/wgslsmith/run.py
run.py
py
2,023
python
en
code
3
github-code
36
42839289218
class tree_node: def __init__(self,data): self.data=data self.right=None self.left=None class link_binary_search_tree: def __init__(self): self.root=None def search_tree_add_data(self,data): temp=self.root if not temp: self.root=tree_nod...
MANOJSAHIT/voice-assistant-on-calendar
link_binary_search_tree.py
link_binary_search_tree.py
py
2,348
python
en
code
0
github-code
36
39955757095
#!/usr/bin/env python #This script is to sort ArXiv papers according to your interest using Machine Learning algorithms. import os import urllib import itertools import feedparser from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity #from sklearn.linear_mod...
indiajoe/ArXivSorter
ArXivSorter.py
ArXivSorter.py
py
13,331
python
en
code
0
github-code
36
23452539852
# coding=utf-8 from oss2.api import * from oss2.auth import * from flask import current_app def get_oss_auth_sigi(): # access_key_id, access_key_secret access_key_id = current_app.config["ACCESS_KEY_ID"] access_key_secret = current_app.config["ACCESS_KEY_SECRET"] auth = AuthV2(access_key_id, access...
z1421012325/py_flask_online_classroom
OnlineClassroom/app/utils/aliyun_oss.py
aliyun_oss.py
py
1,316
python
en
code
0
github-code
36
40364812017
from testbot.executors.errors import ExecutorError from testbot.executors.generic import GenericExecutor from testbot.task import BotTask class FileExistsExecutor(GenericExecutor): def __init__(self, task: BotTask, submission_id: int, test_config_id: int): super().__init__(task=task, submission_id=submiss...
tjumyk/submit-testbot
testbot/executors/file_exists.py
file_exists.py
py
998
python
en
code
0
github-code
36
30296900686
# QUESTION1(PART1) def ask_question(): print("who is the founder of facebook?") print("Mark Zukerbergdef") ask_question() ask_question() ask_question() ask_question() ask_question() # QUESTION1(PART2) def ask_question(): i=0 while i<=100: print("Who is the Founder of Facebook?") print(...
2Estranger/function
meraki1.py
meraki1.py
py
1,070
python
en
code
1
github-code
36
74537281383
#!/usr/bin/env python # -*- coding: utf_8 -* __author__ = "Benoit Delbosc" __copyright__ = "Copyright (C) 2012 Nuxeo SA <http://nuxeo.com>" """ jenkviz.command ~~~~~~~~~~~~~~~~ Crawl a Jenkins to extract builds flow. """ import os import logging from model import open_db, close_db, list_builds from crawl impo...
bdelbosc/jenkviz
jenkviz/command.py
command.py
py
2,109
python
en
code
6
github-code
36
72079445865
# 1717번 # 문제 # 초기에 {0}, {1}, {2}, ... {n} 이 각각 n+1개의 집합을 이루고 있다. 여기에 합집합 연산과, 두 원소가 같은 집합에 포함되어 있는지를 확인하는 연산을 수행하려고 한다. # 집합을 표현하는 프로그램을 작성하시오. # 입력 # 첫째 줄에 n(1 ≤ n ≤ 1,000,000), m(1 ≤ m ≤ 100,000)이 주어진다. m은 입력으로 주어지는 연산의 개수이다. 다음 m개의 줄에는 각각의 연산이 주어진다. # 합집합은 0 a b의 형태로 입력이 주어진다. 이는 a가 포함되어 있는 집합과, b가 포함되어 있는 집합을 합친다...
kkhhkk/Study-Algorithms
backjoon/1717.py
1717.py
py
1,725
python
ko
code
0
github-code
36
15889446300
""" This is a calculator for IRD tax ranges. Reference: https://www.ird.govt.nz/income-tax/income-tax-for-individuals/tax-codes-and-tax-rates-for-individuals/tax-rates-for-individuals """ class TaxCalculator: """Tax calculator for IRD income brackets""" def __init__(self, income, country='nz'): self.in...
kris-classes/5421
week_9/calculator.py
calculator.py
py
975
python
en
code
0
github-code
36
32018992802
# -*- coding: utf-8 -*- """ Author : Jason See Date : 2022/6/9 15:50 Tool : PyCharm Content: """ import json import urllib.request def get_response_dic(data): url = 'http://192.168.30.128/api_jsonrpc.php' header = {'Content-Type': 'application/json'} data = bytes(data, 'utf-8') request = urll...
zcsee/pythonPra
zabbix_pra/demo2.py
demo2.py
py
2,611
python
en
code
0
github-code
36
22196508979
import math def lyapunov_exponent(d): lamb = 0 for i in range(len(d)-2): lamb += math.log((abs(d[i+2]-d[i+1])+1e-17)/(abs(d[i+1]-d[i])+1e-17)) lamb /= len(d) return lamb def logistic_f(alpfa, x0, n): y = [0] * n y[0] = x0 x = x0 for i in range(1, n): x = alpfa*x*(1-x) ...
jecht1014/book
shumi/chaos/lyapunov_exponent.py
lyapunov_exponent.py
py
649
python
en
code
0
github-code
36
35217612682
from enum import IntEnum import requests from urllib.request import urlopen import urllib from selenium import webdriver from bs4 import BeautifulSoup import http.client from openpyxl import Workbook from openpyxl import load_workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell.cell import ILLEGAL_...
Just-Doing/python-caiji
src/work/20220420/herealth.py
herealth.py
py
7,238
python
en
code
1
github-code
36
31279302042
import json import ray import requests from fastapi import Body, FastAPI from typing import List, Dict from ray import serve from ray.serve.handle import RayServeDeploymentHandle from fi.service.lastpx import LastpxService from fi.service.side import SideService from fi.service.trddate import TrddateService from fi.se...
tju-hwh/Yet-Another-Serverless-Benchmark
finra/ray/fi/main.py
main.py
py
5,041
python
en
code
0
github-code
36
74194893543
from torchvision import models import torch.nn as nn import torch.nn.functional as F import torch from initialize_delf import init_delf, init_densenet_TL, init_delf_TL, init_resnet101gem, init_delf_pca def initialize_model(model_name, num_classes, freeze_layers, use_pretrained=True): # Initialize these variables w...
kauterry/cs231n-retrieval
Kaushik/pretrain/model.py
model.py
py
5,634
python
en
code
2
github-code
36
28328861625
from asyncio.windows_events import NULL import pstats import sys import tkinter as tk import tkinter.ttk as ttk import time class Window(tk.Frame): FRAME_PADX: int = 30 FRAME_PADY: int = 15 FRAME_SIZEX: int = 1000 FRAME_SIZEY: int = 300 BUTTON_SIZEX: int = 10 BUTTON_SIZEY: int = 30 BUTTON...
izumi0x01/psych-antam-advanced-experiment
myWindow.py
myWindow.py
py
12,304
python
en
code
0
github-code
36
28313512486
''' task2, program 2 Graph implemented as an adjacent list ''' class Graph: def __init__(self, tmp): self.res = [] i = 0 while i < len(tmp): while len(self.res) <= tmp[i][0]: self.res.append([]) while len(self.res) <= tmp[i][1]: self.re...
lemishAn/prak_sem5
task2/program4.py
program4.py
py
1,036
python
en
code
0
github-code
36
28982520802
import csv from app import db, Category with open('csv/categories.csv') as f: i = 0 reader = csv.reader(f) for row in reader: """if i == 0: i += 1 continue""" category = Category( title=row[1], category_id=row[0] ) db.session...
cadilow/flask_5th_week_project
csv/import_csv_categories_to_db.py
import_csv_categories_to_db.py
py
358
python
en
code
0
github-code
36
14128007238
#!/usr/local/bin/ python3 # -*- coding:utf-8 -*- # __author__ = "zenmeder" class Solution(object): # dp def wordBreak(self, s, wordDict): if not s: return True if not wordDict: return False length = len(s) dps = ([True] if s[0] in wordDict else [False]) + [False]*(length-1) for i in range(1, length):...
zenmeder/leetcode
139.py
139.py
py
1,221
python
en
code
0
github-code
36
70014230503
import sys sys.stdin = open('input.txt', 'r') sys.stdout = open('output.txt', 'w') a = int(input()) l1 = [] while a>0: c = a%2 l1.append(c) a = a//2 for i in reversed(l1): print(i,end = '')
BEASTnORCA765/python-RISHAV
decimal to binary.py
decimal to binary.py
py
209
python
en
code
0
github-code
36
31046654638
import asyncio import uuid from pycaret.datasets import get_data from sqlalchemy.sql import text from .app.database import async_engine from .app.models import ( Base, Client, Payment, ) def split_data_client_payments(): df = get_data("credit").reset_index().rename(columns={"index": "ID"}) clien...
ryankarlos/FastAPI-example-ml
src/load_data_into_tables.py
load_data_into_tables.py
py
1,599
python
en
code
1
github-code
36
26821754249
from django.urls import path from . import views app_name = 'myids' urlpatterns = [ path('', views.view_index, name='index'), path('stat', views.view_stat, name='stat'), path('conn', views.view_conn, name='conn'), path('query_conn', views.query_conn, name='query_conn'), path('query_stat', views.qu...
ponedo/Network-intrusion-detection-system-based-on-heuristic-downsampling-and-random-forest
web_module/myids/urls.py
urls.py
py
351
python
en
code
3
github-code
36
22682169641
import sys import time import numpy as np import cv2 import blazeface_utils as but # import original modules sys.path.append('../../util') from utils import get_base_parser, update_parser, get_savepath # noqa: E402 from model_utils import check_and_download_models # noqa: E402 from image_utils import load_image #...
axinc-ai/ailia-models-tflite
face_detection/blazeface/blazeface.py
blazeface.py
py
7,170
python
en
code
14
github-code
36
12573475230
def distributeChocolate(points): l = [1] * len(points) if len(l) < 1: return 0 for x in range(+1, len(points)-1): print(l) if points[x-1] < points[x]: l[x] += 1 if l[x] <= l[x-1]: l[x] = (l[x-1] + 1) if points[x] > points[x-1] and l[x] ...
AG-Systems/programming-problems
firecode/Chocolate-time!.py
Chocolate-time!.py
py
1,220
python
en
code
10
github-code
36
18399557832
from fastapi import APIRouter, Request, HTTPException, Body, Path from linebot import LineBotApi, WebhookHandler from linebot.exceptions import InvalidSignatureError from linebot.models import StickerSendMessage, TextSendMessage from machine_leanning.model_text_classifire import intent_model from models.token_line impo...
watcharap0n/m-business
routers/wh_client.py
wh_client.py
py
5,144
python
en
code
2
github-code
36
11263854107
from dataclasses import dataclass from enum import Enum from typing import Optional @dataclass class Objective: id: Optional[int] user_id: int name: str initial_date: str final_date: str initial_investment: str recurring_investment: str goal_value: str @dataclass class User: user...
brunotsantos1997/robson-api
app/data/model.py
model.py
py
964
python
en
code
1
github-code
36
28068596152
# 1. 별자리 만들기 # 특정 원소가 속한 집합을 찾기 def find_parent(parent, x): # 루트 노드를 찾을 때까지 재귀 호출 if parent[x] != x: parent[x] = find_parent(parent, parent[x]) return parent[x] # 두 원소가 속한 집합을 합치기 def union_parent(parent, a, b): a = find_parent(parent, a) b = find_parent(parent, b) if a < b: p...
hwanginbeom/algorithm_study
2.algorithm_test/20.11.29/20.11.29_wooseok.py
20.11.29_wooseok.py
py
3,501
python
ko
code
3
github-code
36
15444955984
import tensorflow as tf import pandas as pd import numpy as np from tensorflow.keras import layers from tensorflow import feature_column from matplotlib import pyplot as plt # settings display options pd.options.display.float_format = "{:.2f}".format train_df = pd.read_csv("https://download.mlcc.google.com/mledu-dat...
vitoryeso/ml_crash_course
Binary_classification.py
Binary_classification.py
py
1,179
python
en
code
0
github-code
36
18999820575
import math import re with open("input.txt") as f: original_pieces = [l.split("\n") for l in f.read().split("\n\n")] def flip(tile): # along horizontal axis return tile[::-1] def v_flip(tile): # along vertical axis return rotate270(flip(rotate(tile))) def rotate(tile): # 90 degrees clockwise r...
markwanders/AdventOfCode2020
day20/jigsaw.py
jigsaw.py
py
5,509
python
en
code
0
github-code
36
36173603713
import random import re from collections import Counter, namedtuple re_smiley = re.compile(r'[8;:=%][-oc*^]?[)(D\/\\]') re_smiley_reversed = re.compile(r'[)(D\/\\][-oc*^]?[8;:=%]') re_smiley_asian = re.compile(r'\^[o_.]?\^') extra_smileys = ['<3', '\o', '\o/', 'o/'] re_smileys = [re_smiley, re_smiley_reversed, re_smil...
Thor77/MarkovPy
markov/markov.py
markov.py
py
5,811
python
en
code
2
github-code
36
11537413568
import cv2 def getdifference(a, b): # test image #a, b should be image.jpeg image = cv2.imread('./frames/'+str(a)) gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) histogram = cv2.calcHist([gray_image], [0], None, [256], [0, 256]) # data1 image image = cv2.imread('./frames/'+str(b)) gray_image1 = c...
pa-kh039/nlp_video_descriptor
diff.py
diff.py
py
618
python
en
code
0
github-code
36
12427720105
from fhir.resources.bundle import Bundle from fhir.resources.bundle import BundleEntry from fhir.resources.encounter import Encounter from . import merge_resources from . import fhir_utils # DataContract with the service indicates that a complete bundle entry containing resource will be sent # This methond simply tr...
LinuxForHealth/fhir-resources
src/cdp_fhir_resource_mgmt/fhir/fhir_patient_batch_handler.py
fhir_patient_batch_handler.py
py
8,242
python
en
code
0
github-code
36
26453541576
import gmpy2 thenumber = 600851475143 prime = 2 answer = 0 while thenumber > 1: if thenumber % prime == 0: thenumber = thenumber//prime continue prime = gmpy2.next_prime(prime) answer = prime print(answer) """ gmpy2 에 있는 next_prime 을 썼음. 다음에 소수에 대한 함수들을 만들어봅시다요 """
hojin-kim/projectEuler
prob003.py
prob003.py
py
348
python
ko
code
2
github-code
36
2847651013
# Qus:https://leetcode.com/problems/intersection-of-two-linked-lists/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def getIntersectionNode(self, headA, headB): """ :type head1, h...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Intersection of Two Linked Lists.py
Intersection of Two Linked Lists.py
py
1,665
python
en
code
2
github-code
36
72694771304
from typing import List class Solution: def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int: if not A: return 0 def sameNum(arr: List[int]) -> dict: result = {} for i in arr: if i in result: r...
githubli97/leetcode-python
202011/20201127/q454.py
q454.py
py
1,337
python
en
code
0
github-code
36
71961794665
import math import sys import imutils sys.path.append("..") import cv2 import torch import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches from DatasetBuilding.drivingDataset import DrivingDataset from torch.utils.data import DataLoader from modelCNN import CNN def drawLivePredictio...
FredCarvalhoOliveira/SelfDrivingCar
scripts/testing/evaluateLiveModelDriving.py
evaluateLiveModelDriving.py
py
3,078
python
en
code
5
github-code
36
37319398459
import torch import numpy as np from utils.misc import soft_update from model.BCAgent import BCAgent from model.utils.model import * class BahaviorClone(object): def __init__(self, name, params): self.name = name self.lr = params.lr self.gamma = params.gamma self.tau = params.t...
bic4907/Overcooked-AI
model/bc.py
bc.py
py
2,420
python
en
code
19
github-code
36
40716413842
while True: try: a=input() a=list(a) break except: print("Invalid input") break b=sorted(a,reverse=True) if(a<b): print(''.join(str(x) for x in b)) else: print("impossible")
vaseem14/GUVI
greatest.py
greatest.py
py
188
python
en
code
0
github-code
36
39803344453
from django.utils.translation import gettext_lazy as _ from django.db import models import uuid from internal_users.models import InternalUser from customer_users.models import CustomerUser from homepageapp.models import RepairOrdersNewSQL02Model as RepairOrder from django.utils import timezone from core_operations.mod...
zjgcainiao/new_place_at_76
appointments/models.py
models.py
py
5,933
python
en
code
0
github-code
36
74653289704
# brute force solution # don't have flexibility # for learning purposes only value = 200 # how many we want to collect ways = 0 # how many ways to collect the target for coin200 in range(value, -1, -200): for coin100 in range(coin200, -1, -100): for coin50 in range(coin100, -1, -50): for coin20 in ra...
EricRovell/project-euler
deprecated/031/python/031.brute.py
031.brute.py
py
517
python
en
code
0
github-code
36
22622252680
# 인식시킬 사진을 Clova API를 통해 요청을 보내, 인식 결과를 받아온다. # req(파일) : 파일 데이터 전송 # 1. requests를 통해 Clova API 주소에 요청을 보낸다. # 2. 응답 받은 json을 파싱하여 원하는 결과를 출력한다. import requests import os from pprint import pprint as pp naver_id = os.getenv('NAVER_ID') naver_secret = os.getenv('NAVER_SECRET') url = "https://openapi.naver.com/v1...
jungeunlee95/python-practice
API/NaverApi-Cloud9/workspace/naverapi_clova_face.py
naverapi_clova_face.py
py
1,331
python
ko
code
0
github-code
36
42296358444
import os import logging from xdg.BaseDirectory import xdg_config_home, xdg_state_home from typing import Dict import yaml from .log import LogManager from cfancontrol import __version__ as VERSION class Environment(object): APP_NAME: str = "cfancontrol" APP_FANCY_NAME: str = "Commander²" APP_VERSION: ...
maclarsson/cfancontrol
cfancontrol/settings.py
settings.py
py
3,776
python
en
code
3
github-code
36
34994415249
#!/usr/bin/env python # -*- coding: utf-8 -*- """http://www.pythonchallenge.com/pc/rock/arecibo.html:kohsamui:thailand""" __author__ = "子風" __copyright__ = "Copyright 2015, Sun All rights reserved" __version__ = "1.0.0" import get_challenge from PIL import Image import copy import time def getdata(url): f = get...
z-Wind/Python_Challenge
Level32_Nonogram.py
Level32_Nonogram.py
py
7,587
python
en
code
0
github-code
36
19089281909
import datetime from django.db import models from imagekit.models import ImageModel from structure.models import Author from video.managers import PublishedVideoManager from tagging.fields import TagField class Video(ImageModel): name = models.CharField(max_length=255) slug = models.SlugField(unique=True) ...
queensjournal/queensjournal.ca
apps/video/models.py
models.py
py
1,662
python
en
code
2
github-code
36
7648246473
""" 167. 两数之和 II - 输入有序数组 给定一个已按照 非递减顺序排列 的整数数组 numbers ,请你从数组中找出两个数满足相加之和等于目标数 target 。 函数应该以长度为 2 的整数数组的形式返回这两个数的下标值。numbers 的下标 从 1 开始计数 ,所以答案数组应当满足 1 <= answer[0] < answer[1] <= numbers.length 。 你可以假设每个输入 只对应唯一的答案 ,而且你 不可以 重复使用相同的元素。 示例 1: 输入:numbers = [2,7,11,15], target = 9 输出:[1,2] 解释:2 与 7 之和等于目标数 9 。因此 i...
Zoushuang86/Algorithm_interview_course_code
03-Array/167-twoSum.py
167-twoSum.py
py
1,552
python
zh
code
0
github-code
36
6964335494
from flask import Flask, render_template, request, url_for, jsonify from base64 import b64encode, b64decode app = Flask(__name__) img = "" @app.route('/upload', methods=["POST", "GET"]) def up(): global img img = request.get_json() return img["image"] def main(): app.run() if __name__ == "__main__"...
leesamu/garffiti
app/dummy_server.py
dummy_server.py
py
333
python
en
code
0
github-code
36
69993904103
import re import base64 import xml.dom.minidom import zlib from xml.parsers.expat import ExpatError def repr_saml_request(saml_str, b64=False): """Decode SAML request from b64 and b64 deflated and return a pretty printed representation """ try: msg = base64.b64decode(saml_str).decode() if b64...
italia/spid-django
src/djangosaml2_spid/utils.py
utils.py
py
1,171
python
en
code
40
github-code
36