repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/selection_sort.py | Sorting Algorithms/selection_sort.py | def selection_sort(nums):
# This value of i corresponds to how many values were sorted
for i in range(len(nums)):
# We assume that the first item of the unsorted segment is the smallest
lowest_value_index = i
# This loop iterates over the unsorted items
for j in range(i + 1, len(... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/merge_sort.py | Sorting Algorithms/merge_sort.py | def merge(left_list, right_list):
sorted_list = []
left_list_index = right_list_index = 0
# We use the list lengths often, so its handy to make variables
left_list_length, right_list_length = len(left_list), len(right_list)
for _ in range(left_list_length + right_list_length):
if left_list... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Merge-sort.py | Sorting Algorithms/Merge-sort.py | # merge sort
lst = [] # declaring list l
n = int(input("Enter number of elements in the list: ")) # taking value from user
for i in range(n):
temp = int(input("Enter element" + str(i + 1) + ": "))
lst.append(temp)
def merge(ori_lst, left, mid, right):
L, R = [], [] # PREPARE TWO TEMPORARY LIST TO HO... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Quick sort.py | Sorting Algorithms/Quick sort.py | def partition(arr, low, high):
i = low - 1 # index of smaller element
pivot = arr[high] # pivot
for j in range(low, high):
# If current element is smaller than or
# equal to pivot
if arr[j] <= pivot:
# increment index of smaller element
i = i + 1
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Counting Sort.py | Sorting Algorithms/Counting Sort.py | # Python program for counting sort
def countingSort(array):
size = len(array)
output = [0] * size
# Initialize count array
count = [0] * 10
# Store the count of each elements in count array
for i in range(0, size):
count[array[i]] += 1
# Store the cummulative count
for i in ... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Merge Sort.py | Sorting Algorithms/Merge Sort.py | # Python program for implementation of MergeSort
# Merges two subarrays of arr[].
# First subarray is arr[l..m]
# Second subarray is arr[m+1..r]
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r - m
# create temp arrays
L = [0] * (n1)
R = [0] * (n2)
# Copy data to temp arrays L[] and R[]
f... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Sorted_Inserted_Linked_List.py | Sorting Algorithms/Sorted_Inserted_Linked_List.py | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Circular_Linked_List:
def __init__(self):
self.head = None
def Sorted_Insert(self, new_node):
current = self.head
if current is None:
new_node.next = new_node
self... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/recursive-quick-sort.py | Sorting Algorithms/recursive-quick-sort.py | def quick_sort(l):
if len(l) <= 1:
return l
else:
return (
quick_sort([e for e in l[1:] if e <= l[0]])
+ [l[0]]
+ quick_sort([e for e in l[1:] if e > l[0]])
)
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Binary_Insertion_Sort.py | Sorting Algorithms/Binary_Insertion_Sort.py | def Binary_Search(Test_arr, low, high, k):
if high >= low:
Mid = (low + high) // 2
if Test_arr[Mid] < k:
return Binary_Search(Test_arr, Mid + 1, high, k)
elif Test_arr[Mid] > k:
return Binary_Search(Test_arr, low, Mid - 1, k)
else:
return Mid
e... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Bubble_Sorting_Prog.py | Sorting Algorithms/Bubble_Sorting_Prog.py | def bubblesort(list):
# Swap the elements to arrange in order
for iter_num in range(len(list) - 1, 0, -1):
for idx in range(iter_num):
if list[idx] > list[idx + 1]:
temp = list[idx]
list[idx] = list[idx + 1]
list[idx + 1] = temp
list = [19, 2... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/brickSort.py | Sorting Algorithms/brickSort.py | # Python Program to implement
# Odd-Even / Brick Sort
def oddEvenSort(arr, n):
# Initially array is unsorted
isSorted = 0
while isSorted == 0:
isSorted = 1
temp = 0
for i in range(1, n - 1, 2):
if arr[i] > arr[i + 1]:
arr[i], arr[i + 1] = arr[i + 1], arr... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Sorting Algorithms/Linear_Insertion_Sort.py | Sorting Algorithms/Linear_Insertion_Sort.py | def Linear_Search(Test_arr, val):
index = 0
for i in range(len(Test_arr)):
if val > Test_arr[i]:
index = i + 1
return index
def Insertion_Sort(Test_arr):
for i in range(1, len(Test_arr)):
val = Test_arr[i]
j = Linear_Search(Test_arr[:i], val)
Test_arr.pop(i)... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/determine_sign.py | nitkarshchourasia/to_sort/determine_sign.py | from word2number import w2n
# ? word2number then w2n then .word_to_num? So, library(bunch of modules) then module then method(function)???!
# return w2n.word_to_num(input_value)
# TODO: Instead of rounding at the destination, round at the source.
# Reason: As per the program need, I don't want a functionality to rou... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/counter_app/counter_app.py | nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/counter_app/counter_app.py | # Author: Nitkarsh Chourasia
# Date created: 28/12/2023
# Import the required libraries
import tkinter as tk
from tkinter import ttk
class MyApplication:
"""A class to create a counter app."""
def __init__(self, master):
# Initialize the master window
self.master = master
# Set the t... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/hello_world_excla_increment_app/hello_world_incre_decre_(!).py | nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/hello_world_excla_increment_app/hello_world_incre_decre_(!).py | import tkinter as tk
from tkinter import ttk
class MyApplication:
def __init__(self, master):
self.master = master
# Want to understand why .master.title was used?
self.master.title("Hello World")
self.create_widgets()
def create_widgets(self):
frame = ttk.Frame(self.... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/simple_calc_GUI/simple_calculator_GUI.py | nitkarshchourasia/to_sort/GUI_apps/tkinter_apps/simple_calc_GUI/simple_calculator_GUI.py | from tkinter import *
# To install hupper, use: "pip install hupper"
# On CMD, or Terminal.
import hupper
# Python program to create a simple GUI
# calculator using Tkinter
# Importing everything from tkinter module
# globally declare the expression variable
# Global variables are those variables that can be acces... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/manage.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/manage.py | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "todo_site.settings")
try:
from django.core.management import execute_from_command_line
except I... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/asgi.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/asgi.py | """
ASGI config for todo_site project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SET... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/settings.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/settings.py | """
Django settings for todo_site project.
Generated by 'django-admin startproject' using Django 4.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathl... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/__init__.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/__init__.py | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false | |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/wsgi.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/wsgi.py | """
WSGI config for todo_site project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/urls.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo_site/urls.py | """
URL configuration for todo_site project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='ho... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/views.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/views.py | from django.shortcuts import render, redirect
from django.contrib import messages
# Create your views here.
# Import todo form and models
from .forms import TodoForm
from .models import Todo
def index(request):
item_list = Todo.objects.order_by("-date")
if request.method == "POST":
form = TodoForm(... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/admin.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/admin.py | from django.contrib import admin
from .models import Todo
# Register your models here.
admin.site.register(Todo)
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py | from django.db import models
from django.utils import timezone
# Create your models here.
class Todo(models.Model):
title = models.CharField(max_length=100)
details = models.TextField()
date = models.DateTimeField(default=timezone.now)
def __str__(self) -> str:
return self.title
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/__init__.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/__init__.py | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false | |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py | # Create your tests here.
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/apps.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/apps.py | from django.apps import AppConfig
class TodoConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "todo"
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/forms.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/forms.py | from django import forms
from .models import Todo
class TodoForm(forms.ModelForm):
class Meta:
model = Todo
fields = "__all__"
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/migrations/0001_initial.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/migrations/0001_initial.py | # Generated by Django 4.2.5 on 2023-09-30 16:11
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Todo",
fields=[
(
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/migrations/__init__.py | nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/migrations/__init__.py | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false | |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/pdf_to_docx_converter/pdf_to_docx.py | nitkarshchourasia/to_sort/pdf_to_docx_converter/pdf_to_docx.py | # pip install pdf2docx
# Import the required modules
from pdf2docx import Converter
def convert_pdf_to_docx(pdf_file_path, docx_file_path):
"""
Converts a PDF file to a DOCX file using pdf2docx library.
Parameters:
- pdf_file_path (str): The path to the input PDF file.
- docx_file_path (str): The... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/word2number/word2number.py | nitkarshchourasia/to_sort/word2number/word2number.py | def word_to_number(word):
numbers_dict = {
"zero": 0,
"one": 1,
"two": 2,
"three": 3,
"four": 4,
"five": 5,
"six": 6,
"seven": 7,
"eight": 8,
"nine": 9,
"ten": 10,
"eleven": 11,
"twelve": 12,
"thirteen": ... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py | nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py | # imports modules
import time
from getpass import getuser
# user puts in their name
name = getuser()
name_check = input("Is your name " + name + "? → ")
if name_check.lower().startswith("y"):
print("Okay.")
time.sleep(1)
if name_check.lower().startswith("n"):
name = input("Then what is it? → ")
# Can add... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py | nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py | #########
__author__ = "Nitkarsh Chourasia <playnitkarsh@gmail.com>"
__version__ = "v 0.1"
"""
JARVIS:
- Control windows programs with your voice
"""
# import modules
import datetime # datetime module supplies classes for manipulating dates and times
import subprocess # subprocess module allows you to spawn new pr... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/JARVIS_python_bot/check_internet_con.py | nitkarshchourasia/to_sort/JARVIS_python_bot/check_internet_con.py | from sys import argv
try:
# For Python 3.0 and later
from urllib.error import URLError
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import URLError, urlopen
def checkInternetConnectivity():
try:
url = argv[1]
print(url)
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/one_rep_max_calculator/one_rep_max_calculator.py | nitkarshchourasia/to_sort/one_rep_max_calculator/one_rep_max_calculator.py | class OneRepMaxCalculator:
"""
A class to calculate the one-repetition maximum (1RM) for a weightlifting exercise.
"""
def __init__(self):
"""
Initializes the OneRepMaxCalculator with default values.
"""
self.weight_lifted = 0
self.reps_performed = 0
def get... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nitkarshchourasia/to_sort/one_rep_max_calculator/one_rep_max_calculator_gui.py | nitkarshchourasia/to_sort/one_rep_max_calculator/one_rep_max_calculator_gui.py | import tkinter as tk
class OneRepMaxCalculator:
"""
A class used to calculate the estimated one-repetition maximum (1RM) for a weightlifting exercise.
Attributes
----------
window : tk.Tk
The main window of the application.
weight_entry : tk.Entry
Entry field to input the weig... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/insert_in_bst.py | binary_search_trees/insert_in_bst.py | from typing import Optional
from tree_node import Node
def insert(root: Optional[Node], val: int) -> Node:
"""This function inserts a node with value val into the BST"""
# If the tree is empty, create a new node
if root is None:
return Node(val)
# If the value to be inserted is less than the... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/inorder_traversal.py | binary_search_trees/inorder_traversal.py | from typing import Optional
from tree_node import Node
def inorder(root: Optional[Node]) -> None:
"""This function performs an inorder traversal of a BST"""
# The inorder traversal of a BST is the nodes in increasing order
if root is None:
return
# Traverse the left subtree
inorder(root.... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/delete_a_node_in_bst.py | binary_search_trees/delete_a_node_in_bst.py | from typing import Optional
from inorder_successor import inorder_successor
from tree_node import Node
# The above line imports the inorder_successor function from the inorder_successor.py file
def delete_node(root: Node, val: int) -> Optional[Node]:
"""This function deletes a node with value val from the BST"""
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/main.py | binary_search_trees/main.py | from typing import Optional
from insert_in_bst import insert
from delete_a_node_in_bst import delete_node
from search_in_bst import search
from mirror_a_bst import create_mirror_bst
from print_in_range import print_in_range
from root_to_leaf_paths import print_root_to_leaf_paths
from validate_bst import is_valid_bst
fr... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/validate_bst.py | binary_search_trees/validate_bst.py | from typing import Optional
from tree_node import Node
def is_valid_bst(
root: Optional[Node], min_node: Optional[Node], max_node: Optional[Node]
) -> bool:
"""Function to check if a binary tree is a binary search tree"""
# If the tree is empty, return True
if root is None:
return True
#... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/mirror_a_bst.py | binary_search_trees/mirror_a_bst.py | from typing import Optional
from tree_node import Node
def create_mirror_bst(root: Optional[Node]) -> Optional[Node]:
"""Function to create a mirror of a binary search tree"""
# If the tree is empty, return None
if root is None:
return None
# Recursively create the mirror of the left and rig... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/search_in_bst.py | binary_search_trees/search_in_bst.py | from typing import Optional
from tree_node import Node
def search(root: Optional[Node], val: int) -> bool:
"""This function searches for a node with value val in the BST and returns True if found, False otherwise"""
# If the tree is empty, return False
if root is None:
return False
# If the ... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/print_in_range.py | binary_search_trees/print_in_range.py | from typing import Optional
from tree_node import Node
def print_in_range(root: Optional[Node], k1: int, k2: int) -> None:
"""This function prints the nodes in a BST that are in the range k1 to k2 inclusive"""
# If the tree is empty, return
if root is None:
return
# If the root value is in t... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/tree_node.py | binary_search_trees/tree_node.py | from typing import Optional
# Node class for binary tree
class Node:
def __init__(self, data: int) -> None:
self.data: int = data
self.left: Optional[Node] = None
self.right: Optional[Node] = None
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/inorder_successor.py | binary_search_trees/inorder_successor.py | from tree_node import Node
def inorder_successor(root: Node) -> Node:
"""This function returns the inorder successor of a node in a BST"""
# The inorder successor of a node is the node with the smallest value greater than the value of the node
current: Node = root
# The inorder successor is the left... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/binary_search_trees/root_to_leaf_paths.py | binary_search_trees/root_to_leaf_paths.py | from typing import Optional, List
from tree_node import Node
def print_root_to_leaf_paths(root: Optional[Node], path: List[int]) -> None:
"""This function prints all the root to leaf paths in a BST"""
# If the tree is empty, return
if root is None:
return
# Add the root value to the path
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/thired-party-haarcascade-mustache-on-face/utils.py | thired-party-haarcascade-mustache-on-face/utils.py | import os
import cv2
# source: https://stackoverflow.com/a/44659589
def image_resize(image, width=None, height=None, inter=cv2.INTER_AREA):
# initialize the dimensions of the image to be resized and
# grab the image size
dim = None
(h, w) = image.shape[:2]
# if both the width and height are None,... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/thired-party-haarcascade-mustache-on-face/mustache-add-on-face.py | thired-party-haarcascade-mustache-on-face/mustache-add-on-face.py | import cv2
from utils import image_resize
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier("face.xml")
nose_cascade = cv2.CascadeClassifier("Nose.xml")
mustache = cv2.imread("image/mustache.png", -1)
while True:
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/HTML_to_PDF/main.py | HTML_to_PDF/main.py | import pdfkit
import os
# Download wkhtmltopdf from https://wkhtmltopdf.org/downloads.html
# Set the path to the wkhtmltopdf executable
wkhtmltopdf_path = r"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
# Configure pdfkit to use wkhtmltopdf
config = pdfkit.configuration(wkhtmltopdf=wkhtmltopdf_path)
# Path of H... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/primelib/primelib.py | primelib/primelib.py | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 5 16:44:23 2017
@author: Christian Bender
This python library contains some useful functions to deal with
prime numbers and whole numbers.
Overview:
isPrime(number)
sieveEr(N)
getPrimeNumbers(N)
primeFactorization(number)
greatestPrimeFactor(number)
smallestPrimeFacto... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/first.py | Checker_game_by_dz/first.py | """
Author : Dhruv B Kakadiya
"""
# import libraries
import pygame as pg
from modules import statics as st
from modules.statics import *
from modules.checker_board import *
from modules.checker import *
# static variables for this particular file
fps = 60
WIN = pg.display.set_mode((st.width, st.height))
pg.display.... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/__init__.py | Checker_game_by_dz/__init__.py | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false | |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/modules/checker.py | Checker_game_by_dz/modules/checker.py | """
Author : Dhruv B Kakadiya
"""
import pygame as pg
from .checker_board import *
from .statics import *
from .pieces import *
class checker:
def __init__(self, window):
self._init()
self.window = window
# to update the position
def update(self):
self.board.draw(self.window)
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/modules/pieces.py | Checker_game_by_dz/modules/pieces.py | """
Author : Dhruv B Kakadiya
"""
from .statics import *
import pygame as pg
class pieces:
padding = 17
outline = 2
def __init__(self, row, col, color):
self.row = row
self.col = col
self.color = color
self.king = False
"""if (self.color == yellow):
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/modules/checker_board.py | Checker_game_by_dz/modules/checker_board.py | """
Author : Dhruv B Kakadiya
"""
import pygame as pg
from .statics import *
from .pieces import *
# checker board creation
class checker_board:
def __init__(self):
self.board = []
self.selected = None
self.black_l = self.white_l = 12
self.black_k = self.white_k = 0
self.... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/modules/__init__.py | Checker_game_by_dz/modules/__init__.py | """
Author : Dhruv B Kakadiya
"""
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Checker_game_by_dz/modules/statics.py | Checker_game_by_dz/modules/statics.py | """
Author : Dhruv B Kakadiya
"""
import pygame as pg
# size of board
width, height = 800, 800
rows, cols = 8, 8
sq_size = width // cols
# colours for board
yellow = (255, 255, 0)
white = (255, 255, 255)
green = (0, 255, 0)
gray = (128, 128, 128)
red = (255, 0, 0)
# colour for for next move
black = (0, 0, 0)
crow... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/data_dynamic.py | Quizzler Using Tkinter and Trivia DB API/data_dynamic.py |
'''
This file is responsible for fetching quiz questions from the Open Trivia Database API.
'''
import requests
parameters = {
"amount": 10,
"type": "multiple",
"category": 18
}
error_message = ""
try:
response = requests.get(url="https://opentdb.com/api.php", params=parameters, timeout=10)
res... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/question_model.py | Quizzler Using Tkinter and Trivia DB API/question_model.py | class Question:
def __init__(self, q_text, q_answer, q_options):
self.text = q_text
self.answer = q_answer
self.options = q_options
| python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/quiz_brain.py | Quizzler Using Tkinter and Trivia DB API/quiz_brain.py |
"""This file contains the logic that drives the quiz game, including managing the current question, checking answers, and tracking the score."""
import html
class QuizBrain:
def __init__(self, q_list):
self.question_number = 0
self.score = 0
self.question_list = q_list
self.curren... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/ui.py | Quizzler Using Tkinter and Trivia DB API/ui.py |
"""This file manages the graphical user interface of the quiz, using Tkinter to display questions, answer options, and the score to the user."""
from tkinter import *
from quiz_brain import QuizBrain
from data_dynamic import error_message
# Normal screen
BACKGROUND = "#608BC1"
CANVAS = "#CBDCEB"
TEXT = "#133E87"
# ... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/main.py | Quizzler Using Tkinter and Trivia DB API/main.py |
"""This file processes the fetched questions and prepares them for use in the quiz."""
from question_model import Question
from data_dynamic import question_data
from quiz_brain import QuizBrain
from ui import QuizInterface
# question_bank = []
# question_text = question["question"]
# question_answer = quest... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Quizzler Using Tkinter and Trivia DB API/data_static.py | Quizzler Using Tkinter and Trivia DB API/data_static.py | question_data = [
{
"question": "What is one of the main impacts of progress in hardware technologies on software?",
"correct_answer": "Need for more sophisticated programs",
"incorrect_answers": [
"Increase in hardware prices",
"Decrease in computational power",
... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Cat/cat.py | Cat/cat.py | """
The 'cat' Program Implemented in Python 3
The Unix 'cat' utility reads the contents
of file(s) specified through stdin and 'conCATenates'
into stdout. If it is run without any filename(s) given,
then the program reads from standard input itself,
which means it simply copies stdin to stdout.
It is fairly easy to i... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
geekcomputers/Python | https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Wordle/wordle.py | Wordle/wordle.py | # Get all 5 letter words from the full English dictionary
"""
# dictionary by http://www.gwicks.net/dictionaries.htm
# Load full English dictionary
dictionary = open("Dictionary.txt", 'r')
# Load new empty dictionary
new_dictionary = open("5 letter word dictionary.txt", "w")
# Read the full English dictionary
dictiona... | python | MIT | 21cbdf223aadd1c28293570d1106fe47af6e9434 | 2026-01-04T14:42:18.827821Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/setup.py | setup.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import glob
import os
import shutil
from os import path
from setuptools import find_packages, setup
from typing import List
import torch
from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension
torch_ver = [int(x) for x in to... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/analyze_model.py | tools/analyze_model.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
import numpy as np
from collections import Counter
import tqdm
from fvcore.nn import flop_count_table # can also try flop_count_str
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import CfgNode, ... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/lightning_train_net.py | tools/lightning_train_net.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# Lightning Trainer should be considered beta at this point
# We have confirmed that training and validation run correctly and produce correct results
# Depending on how you launch the trainer, there are issues with processes terminating correctl... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/lazyconfig_train_net.py | tools/lazyconfig_train_net.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Training script using the new "LazyConfig" python config files.
This scripts reads a given python config file and runs the training or evaluation.
It can be used to train any models or dataset as long as they can be
instantiated by the recurs... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/train_net.py | tools/train_net.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
A main training script.
This scripts reads a given config file and runs the training or evaluation.
It is an entry point that is made to train standard models in detectron2.
In order to let one script support training of many models,
this sc... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/plain_train_net.py | tools/plain_train_net.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Detectron2 training script with a plain training loop.
This script reads a given config file and runs the training or evaluation.
It is an entry point that is able to train standard models in detectron2.
In order to let one script support tr... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/convert-torchvision-to-d2.py | tools/convert-torchvision-to-d2.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import pickle as pkl
import sys
import torch
"""
Usage:
# download one of the ResNet{18,34,50,101,152} models from torchvision:
wget https://download.pytorch.org/models/resnet50-19c8e357.pth -O r50.pth
# run the conversion
./convert-torc... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/visualize_json_results.py | tools/visualize_json_results.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import json
import numpy as np
import os
from collections import defaultdict
import cv2
import tqdm
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.structures import Boxes, BoxMode, Instances
from dete... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/benchmark.py | tools/benchmark.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
A script to benchmark builtin models.
Note: this script has an extra dependency of psutil.
"""
import itertools
import logging
import psutil
import torch
import tqdm
from fvcore.common.timer import Timer
from torch.nn.parallel import Distrib... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/__init__.py | tools/__init__.py | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false | |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/visualize_data.py | tools/visualize_data.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import os
from itertools import chain
import cv2
import tqdm
from detectron2.config import get_cfg
from detectron2.data import DatasetCatalog, MetadataCatalog, build_detection_train_loader
from detectron2.data import detection_uti... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tools/deploy/export_model.py | tools/deploy/export_model.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import os
from typing import Dict, List, Tuple
import torch
from torch import Tensor, nn
import detectron2.data.transforms as T
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from det... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/dev/packaging/gen_install_table.py | dev/packaging/gen_install_table.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# -*- coding: utf-8 -*-
import argparse
template = """<details><summary> install </summary><pre><code>\
python -m pip install detectron2{d2_version} -f \\
https://dl.fbaipublicfiles.com/detectron2/wheels/{cuda}/torch{torch}/index.html
</code><... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_engine.py | tests/test_engine.py | # Copyright (c) Facebook, Inc. and its affiliates.
import json
import math
import os
import tempfile
import time
import unittest
from unittest import mock
import torch
from fvcore.common.checkpoint import Checkpointer
from torch import nn
from detectron2 import model_zoo
from detectron2.config import configurable, ge... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_export_torchscript.py | tests/test_export_torchscript.py | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import glob
import json
import os
import random
import tempfile
import unittest
import zipfile
import torch
from torch import Tensor, nn
from detectron2 import model_zoo
from detectron2.config import get_cfg
from detectron2.config.instantiate import dump_... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_registry.py | tests/test_registry.py | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torch
from detectron2.modeling.meta_arch import GeneralizedRCNN
from detectron2.utils.registry import _convert_target_to_string, locate
class A:
class B:
pass
class TestLocate(unittest.TestCase):
def _test_obj(self, obj):
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_model_analysis.py | tests/test_model_analysis.py | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torch
from torch import nn
from detectron2.utils.analysis import find_unused_parameters, flop_count_operators, parameter_count
from detectron2.utils.testing import get_model_no_weights
class RetinaNetTest(unittest.TestCase):
def setUp(se... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_visualizer.py | tests/test_visualizer.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import os
import tempfile
import unittest
import cv2
import torch
from detectron2.data import MetadataCatalog
from detectron2.structures import BoxMode, Instances, RotatedBoxes
from detectron2.utils.visualizer import ColorMo... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_export_caffe2.py | tests/test_export_caffe2.py | # Copyright (c) Facebook, Inc. and its affiliates.
# -*- coding: utf-8 -*-
import copy
import os
import tempfile
import unittest
from torch.hub import _check_module_exists
from detectron2 import model_zoo
from detectron2.utils.logger import setup_logger
from detectron2.utils.testing import get_sample_coco_image
try:... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_solver.py | tests/test_solver.py | import unittest
from detectron2.solver.build import _expand_param_groups, reduce_param_groups
class TestOptimizer(unittest.TestCase):
def testExpandParamsGroups(self):
params = [
{
"params": ["p1", "p2", "p3", "p4"],
"lr": 1.0,
"weight_decay": 3... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_model_zoo.py | tests/test_model_zoo.py | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import unittest
from detectron2 import model_zoo
from detectron2.config import instantiate
from detectron2.modeling import FPN, GeneralizedRCNN
logger = logging.getLogger(__name__)
class TestModelZoo(unittest.TestCase):
def test_get_returns_model... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/__init__.py | tests/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
| python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_packaging.py | tests/test_packaging.py | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
from detectron2.utils.collect_env import collect_env_info
class TestProjects(unittest.TestCase):
def test_import(self):
from detectron2.projects import point_rend
_ = point_rend.add_pointrend_config
import detectron2.pro... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_export_onnx.py | tests/test_export_onnx.py | # Copyright (c) Facebook, Inc. and its affiliates.
import io
import unittest
import warnings
import onnx
import torch
from packaging import version
from torch.hub import _check_module_exists
from detectron2 import model_zoo
from detectron2.config import get_cfg
from detectron2.export import STABLE_ONNX_OPSET_VERSION
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_scheduler.py | tests/test_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
import math
import numpy as np
from unittest import TestCase
import torch
from fvcore.common.param_scheduler import (
CosineParamScheduler,
MultiStepParamScheduler,
StepWithFixedGammaParamScheduler,
)
from torch import nn
from detectron2.solver import LRM... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_events.py | tests/test_events.py | # Copyright (c) Facebook, Inc. and its affiliates.
import json
import os
import tempfile
import unittest
from detectron2.utils.events import (
CommonMetricPrinter,
EventStorage,
JSONWriter,
get_event_storage,
has_event_storage,
)
class TestEventWriter(unittest.TestCase):
def testScalar(self):... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/test_checkpoint.py | tests/test_checkpoint.py | # Copyright (c) Facebook, Inc. and its affiliates.
import os
import tempfile
import unittest
from collections import OrderedDict
import torch
from iopath.common.file_io import PathHandler, PathManager
from torch import nn
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.checkpoint.c2_model_loadi... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/tracking/test_bbox_iou_tracker.py | tests/tracking/test_bbox_iou_tracker.py | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import unittest
from copy import deepcopy
from typing import Dict
import torch
from detectron2.config import CfgNode as CfgNode_
from detectron2.config import instantiate
from detectron2.structures import Boxes, Instances
from detectron2.tracking.ba... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/tracking/test_hungarian_tracker.py | tests/tracking/test_hungarian_tracker.py | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import unittest
from typing import Dict
import torch
from detectron2.config import instantiate
from detectron2.structures import Boxes, Instances
class TestBaseHungarianTracker(unittest.TestCase):
def setUp(self):
self._img_size = np.a... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/tracking/test_iou_weighted_hungarian_bbox_iou_tracker.py | tests/tracking/test_iou_weighted_hungarian_bbox_iou_tracker.py | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import numpy as np
import unittest
from typing import Dict
import torch
from detectron2.config import CfgNode as CfgNode_
from detectron2.config import instantiate
from detectron2.structures import Boxes, Instances
from detectron2.tracking.base_tracker imp... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/tracking/__init__.py | tests/tracking/__init__.py | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false | |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/tests/tracking/test_vanilla_hungarian_bbox_iou_tracker.py | tests/tracking/test_vanilla_hungarian_bbox_iou_tracker.py | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import numpy as np
import unittest
from typing import Dict
import torch
from detectron2.config import CfgNode as CfgNode_
from detectron2.config import instantiate
from detectron2.structures import Boxes, Instances
from detectron2.tracking.base_tracker imp... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.