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
16539700477
import os import subprocess import sphinx_autobuild.build from sphinx_autobuild.build import show def get_builder(watcher, sphinx_args, *, host, port, pre_build_commands): """Prepare the function that calls sphinx.""" def build(): """Generate the documentation using ``sphinx``.""" if not wat...
Nuitka/Nuitka-website
misc/sphinx_autobuild_wrapper.py
sphinx_autobuild_wrapper.py
py
1,176
python
en
code
10
github-code
6
7261153491
import cv2 import numpy as np img = cv2.imread('bookpage.jpg') grayscaled = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #retval, threshold = cv2.threshold(grayscaled, 11, 255 , cv2.THRESH_BINARY) threshold = cv2.adaptiveThreshold(grayscaled, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 115, 1) median = cv2.med...
felipemateus/vis-oCompEstudo
threshHoldExemple2/threshHold.py
threshHold.py
py
541
python
en
code
0
github-code
6
8398660267
import logging import numpy as np import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras import backend as K from tensorflow.keras import Sequential from tensorflow.keras.layers import Conv2D, Flatten, Dense from openfl.models.tensorflow import KerasFLModel class KerasCNN(KerasFLModel): """...
sarthakpati/OpenFederatedLearning
openfl/models/tensorflow/keras_cnn/keras_cnn.py
keras_cnn.py
py
2,530
python
en
code
1
github-code
6
12571576568
import requests import pandas from bs4 import BeautifulSoup import json url = 'https://www.imdb.com/chart/top/' response = requests.get(url).content soup = BeautifulSoup(response,'html.parser') title = soup.find_all('td', class_='titleColumn') rating = soup.find_all('strong') images = soup.find_all('img') movie_...
gpuligundla/IMDB-Top-Movies-List
imdb_scrap.py
imdb_scrap.py
py
979
python
en
code
0
github-code
6
28176425279
import sqlite3 import json from datetime import datetime from traceback import print_tb from helpers import create_table_if_not_exists, get_db_path, get_timeframe_path, format_data, \ acceptable, get_timeframes timeframes = get_timeframes() sql_transaction = [] start_row = 0 # start_row = 8400000 # that is where...
DuncteBot/chatbot
data_parser.py
data_parser.py
py
5,643
python
en
code
1
github-code
6
39697194939
# -*- coding: utf-8 -*- import scrapy from LaGou.items import LagouItem import LaGou.settings as settings class LagouSpider(scrapy.Spider): name = 'lagou' allowed_domains = ['https://www.lagou.com'] start_urls = ['http://https://www.lagou.com/'] def parse(self, response): if response.status==...
siqyka/Reptile
works/LaGou/LaGou/spiders/lagou.py
lagou.py
py
1,369
python
en
code
1
github-code
6
36818410851
import curses import curses.ascii from curses.textpad import Textbox class MyTextPad(Textbox): ignored_keys = { curses.KEY_PPAGE, # Page Up curses.KEY_NPAGE, # Page Down } def __init__(self, win, default): super().__init__(win) self.default = default self.line =...
AzaubaevViktor/tagging
console/my_textpad.py
my_textpad.py
py
2,571
python
en
code
0
github-code
6
37482811265
# coding: utf-8 import json import os import click import gql import graphql import requests from gql.transport.requests import RequestsHTTPTransport try: # python2 from urlparse import urlparse except ImportError: # python3 from urllib.parse import urlparse class SchemaSourceType(click.ParamType...
wapiflapi/gqldiff
gqldiff/clickgql.py
clickgql.py
py
2,223
python
en
code
1
github-code
6
6209107982
a = [] sum = 0 for i in range(9): a.append(int(input())) sum += a[i] a = sorted(a) i = 0 while i < 9: sum -= a[i] j = 0 while j < 9: if i != j and sum - a[j] == 100: break j += 1 if j < 9: break sum += a[i] i += 1 for k in range(9): if k != ...
jshyun912/BOJ
1000 ~ 5000/2309_일곱 난쟁이.py
2309_일곱 난쟁이.py
py
353
python
en
code
0
github-code
6
12992306131
''' Arbitrary parameters that matter a surprising amount for making photometry reasonably good. ''' __all__ = ['thresh', 'fwhm', 'radius', 'annuli_r'] # Thresholds for source identification after bias & flat fielding. # These must be low enough to catch good comparison stars. Too high, and # astrometry gets confused....
lgbouma/tr56reduc
src/define_arbitrary_parameters.py
define_arbitrary_parameters.py
py
735
python
en
code
1
github-code
6
31626864136
#!/usr/bin/env python3 DEBUG = False def debug_print(s): print(s) def check(s): """Returns two booleans, the first is whether there are character twins. The second is whether there are character triplets.""" t = sorted(s) t.append("\n") has_twins = False has_triplets = False run_count = 1...
Combatjuan/adventofcode
2018/day02/day2a.py
day2a.py
py
1,044
python
en
code
0
github-code
6
39608443773
import datetime import os import re import urllib.parse from itertools import groupby from django import forms as django_forms from django.conf import settings from django.core.paginator import Paginator, InvalidPage from django import urls from django.forms import fields from django.http import HttpResponse, HttpRe...
open-oni/open-oni
core/views/browse.py
browse.py
py
19,948
python
en
code
43
github-code
6
23262527075
__author__ = 'ravi' from pprint import pprint def get_word_count(file_name): content = {} for line in open(file_name): for word in line.rstrip().split(' '): content[word] = content.get(word, 0) + 1 return content words = get_word_count('mesg') pprint(words)
simula67/advanced-python-course-material
instructor-github/day2/wc.py
wc.py
py
294
python
en
code
0
github-code
6
72784612027
# https://www.codewars.com/kata/558d5c71c68d1e86b000010f from itertools import product as P from collections import Counter # precompute vampires = [] for L in (2,3): G = [range(0,10) for _ in range(L)] limit1 = 10**(2*L-1) limit2 = 10**L**2-1 for a,b in P(P(*G), P(*G)): p = int(''.join(m...
blzzua/codewars
7-kyu/vampire_numbers_less_than_1000000.py
vampire_numbers_less_than_1000000.py
py
1,072
python
en
code
0
github-code
6
15393461958
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def FindFirstCommonNode(self, pHead1, pHead2): # write code here stck1 = [] stck2 = [] h1,h2 = pHead1,pHead2 while h1: stck1.app...
shakesVan/Playground
Nowcoder/52.py
52.py
py
613
python
en
code
0
github-code
6
2534734761
import unittest from KPIAlgebras.response_objects import response_objects from KPIAlgebras.request_objects import request_objects class TestResponseObjects(unittest.TestCase): def test_response_sucess_is_true(self): value = "test" response_sucess = response_objects.ResponseSuccess(value) se...
luisfsts/KPIAlgebras
tests/response_objects/test_response_objects.py
test_response_objects.py
py
2,483
python
en
code
0
github-code
6
40610907305
# Import libraries import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import missingno as msno from _datetime import date from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.neighbors import LocalOutlierFactor f...
afatsumcemreg/feature_engineering
05_feature_scaling.py
05_feature_scaling.py
py
2,572
python
en
code
2
github-code
6
972412310
###Episode 1 import numpy as np import torch #Training data # Input (temp, rainfall, humidity) inputs = np.array([[73,67,43], [91,88,64], [87, 134, 58], [108, 43, 37], [69, 96,70]], dtype='float32') # targets (apples, oranges) targets = np.array([[56, 70], [81,101], [119, 133], [22,37], [103, 119]], dtype = 'float...
NancyGirdhar/PyTorch_Basics
PyTorchSeries_E1.py
PyTorchSeries_E1.py
py
6,595
python
en
code
0
github-code
6
36310398862
import pygame import colors import config class Field(pygame.sprite.Sprite): def __init__(self, x, y, color=None, img_path=None): super().__init__() self.x = x self.y = y self.color = color # sprite image if img_path: img = pygame.image.load(img_path)...
tobnie/human_planning_horizon
game/world/field.py
field.py
py
1,046
python
en
code
0
github-code
6
1370868487
"""Quizzes user on terms and definitions.""" import csv import random from collections import namedtuple RTN = lambda: '\n' def open_csv_populate_dct(): """Import a csv and populate a dictionary with its contents.""" dct = {} with open('csvs/terms_and_definitions.csv') as f: F_CSV = csv.reader(f...
craighillelson/terms_and_definitions
terms_and_definitions.py
terms_and_definitions.py
py
1,717
python
en
code
0
github-code
6
22610452246
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .models import Hybrid, Specialization, ContactPerson, Subject class MyUserAdmin(UserAdmin): model = Hybrid fieldsets = UserAdmin.fieldsets + ( (None, {'fields': ( 'middle_name', 'member', ...
hybrida/hybridjango
apps/registration/admin.py
admin.py
py
792
python
en
code
4
github-code
6
35914492844
class Point: def __init__(self, a=0, b=0): self.x = a self.y = b class Solution: def numIslands2(self, n: int, m: int, operators: list) -> list: directions = [(0, -1), (0, 1), (1, 0), (-1, 0)] matrix = [0] * (n * m) father = [i for i in range(n * m)] result = [...
Super262/LintCodeSolutions
data_structures/union_find/problem0434.py
problem0434.py
py
1,760
python
en
code
1
github-code
6
21867315415
import phywhisperer.interface.naeusb as NAE import phywhisperer.interface.program_fpga as LLINT import os import re import logging import pkg_resources import threading import time from phywhisperer.interface.bootloader_sam3u import Samba from phywhisperer.sniffer import USBSniffer, USBSimplePrintSink from phywhisperer...
newaetech/phywhispererusb
software/phywhisperer/usb.py
usb.py
py
34,049
python
en
code
77
github-code
6
7925957401
# ITP-100 Software Design # Student: Jeannotte, Michael # Instructor: Brown, Georgia # Date given to class: 9-12-2022 # Date of Submission: # Description: # Input: # Output: # Additional Comments: V 1.0 studentID = int(input('Enter your 6 digit Student Identification Number:')) F_name = input('Please Enter your First ...
ProjectInzom/public
PythonClass/Projects/Lab02/StudentRecords.py
StudentRecords.py
py
550
python
en
code
0
github-code
6
30477628890
# Count Pairs with given sum (2 Sum Problem) (Count Pairs Problem) # Count Pairs (returns count) def getPairsCount(arr, n, k): map = {} cnt = 0 for i in range(n): temp = k - arr[i] if temp in map: cnt += map[temp] if arr[i] in map: map[arr[i]] += 1 el...
prabhat-gp/GFG
Arrays/Arrays Easy/8a_pairs.py
8a_pairs.py
py
1,000
python
en
code
0
github-code
6
14048408200
from io import StringIO from pathlib import Path import streamlit as st import time from detect import detect import os import sys import argparse from PIL import Image import shutil import streamlit.components.v1 as components def get_subdirs(b='.'): ''' Returns all sub-directories in a spec...
fengxizxf/yolov-bird
main.py
main.py
py
9,736
python
en
code
3
github-code
6
1218087321
import os from collections import namedtuple #Define a named tuple to represent our files FileStruct = namedtuple("File", "file_name file_ext file_path dir") def XMLifyFile(file_struct): return '\t\t<file alias="' + file_struct.file_name + '">' + file_struct.file_path + "</file>\n" valid_exts = [".graphml", ".p...
cdit-ma/SEM
medea/src/app/Resources/resourceqrcmaker.py
resourceqrcmaker.py
py
1,521
python
en
code
3
github-code
6
30578979945
import os import json from datetime import date from flask import Flask, g, jsonify, request, abort from flask_cors import CORS #comment this on deployment from db.jfl_db import Database app = Flask(__name__) CORS(app) #comment this on deployment def get_db(): ''' Returns the document indexi...
zrahn93/jfl
jfl_services/run.py
run.py
py
11,376
python
en
code
0
github-code
6
83273089
import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score def read_file(): # 读取数据 df = pd.read_table("/you...
goelo/machine_learning
naive_bayes/smsspammessage.py
smsspammessage.py
py
2,190
python
en
code
4
github-code
6
11902565567
#!/usr/bin/env python3 from pprint import pprint import subprocess import pyone import config # ----------------------- # Connect to OpenNebula # ----------------------- one = pyone.OneServer(config.ONE['address'], session='%s:%s' % (config.ONE['username'], config.ONE['password'])) # prepare hosts to ips mapping hos...
OpenNebula/addon-3par
scripts/helpers/update-cpu-shares.py
update-cpu-shares.py
py
1,335
python
en
code
2
github-code
6
25881621247
#!/usr/bin/python f = open("in.txt", "r") overlapping = 0 for vrstica in f: a = vrstica.split(",") prvi, drugi = a[0].split("-"), a[1].split("-") if (int(prvi[0]) >= int(drugi[0]) and int(prvi[1]) <= int(drugi[1])) or ( int(prvi[0]) <= int(drugi[0]) and int(prvi[1]) >= int(drugi[1])): ...
Anja159/Advent_of_code_2022
Day4/part1.py
part1.py
py
364
python
en
code
1
github-code
6
18524942065
model = dict( type='AGMIDRPNet', drper=dict( type='AGMIDRPer', in_channel = 3, gather_width=6, drug_encoder=dict( type='DrugGATEncoder', num_features_xd=78, heads=10, output_dim=128, gat_dropout=0.2 ), ...
yivan-WYYGDSG/AGMI
configs/_base_/models/AGMI/agmi_8layers.py
agmi_8layers.py
py
1,075
python
en
code
1
github-code
6
42607005601
# -*- coding: utf-8 -*- # author: inpurer(月小水长) # pc_type lenovo # create_date: 2018/12/9 # file_name: client.py # description: 月小水长,热血未凉 from socket import * if __name__ == "__main__": serverName = '127.0.0.1' serverPort = 13000 clientSocket = socket(AF_INET, SOCK_STR...
inspurer/ComputerNetwork
echo服务/select实现并发/client.py
client.py
py
729
python
en
code
17
github-code
6
23248318495
import pygame #necessary pygame initializing pygame.init() #create a surface that will be seen by the user screen = pygame.display.set_mode((600, 400)) background= pygame.image.load('Background-1.png') #create a varible for degrees pf rotation degree = 0 while True: screen.blit(background, (0,0)) ...
Soupupup/pythonsensorgame
rotation test 2.py
rotation test 2.py
py
1,287
python
en
code
0
github-code
6
31016470858
# coding=utf-8 import document import shape from db import error, Trae_Fila, lee, rg_vacio, gpx, cl, copia_rg, FDC, GS_INS, u_libre, Busca_Prox, Fecha, i_selec, \ Abre_Aplicacion, Abre_Empresa from db import Int, Num, lista, Num_aFecha, lee_dc from aa_funciones import Serie, GetColumnasACC_CK, LineaToDc from shape imp...
JonathanServiaMandome/gsWord
utilities/certificate.py
certificate.py
py
36,095
python
es
code
0
github-code
6
74348094589
from collections import namedtuple, defaultdict from itertools import combinations, product from math import sqrt from typing import List INPUTTEST = 'inputtest.txt' INPUTREAL = 'input.txt' def getLines(fileName): file = open(fileName,'r') lines = file.read().splitlines() file.close() return lines c...
David-Hatcher/AoC2021
Day 19/Day19.py
Day19.py
py
5,987
python
en
code
1
github-code
6
11299411121
from functools import update_wrapper import logging from .action import FunctionAction from .request import Request from .traject import Traject from .config import Configurable from .settings import SettingSectionContainer from .converter import ConverterRegistry from .predicate import PredicateRegistry from .tween i...
magnus-lycka/morepath
morepath/app.py
app.py
py
8,665
python
en
code
null
github-code
6
30666636404
import sys import xbmc, xbmcgui import torrentitem #enable localization getLS = sys.modules[ "__main__" ].__language__ __cwd__ = sys.modules[ "__main__" ].__cwd__ # Actions ids ACTION_PARENT_DIR = 9 ACTION_PREVIOUS_MENU = 10 ACTION_MOVE_LEFT = 1 ACTION_MOVE_RIGHT = 2 ACTION_MOVE_UP = 3 ACTION_MOVE_DOWN = 4 ACTION_N...
vche/script.torrentrss
resources/lib/trackergui.py
trackergui.py
py
7,816
python
en
code
1
github-code
6
650752867
import os import sys import json import unittest import numpy as np import luigi import z5py import cluster_tools.utils.volume_utils as vu from sklearn.metrics import adjusted_rand_score from elf.segmentation.mutex_watershed import mutex_watershed from elf.segmentation.watershed import apply_size_filter try: from...
constantinpape/cluster_tools
test/mutex_watershed/test_mws.py
test_mws.py
py
2,409
python
en
code
32
github-code
6
27009005628
from scipy.io import loadmat import numpy as np import xlrd as x import pandas as pd def run(file, delimiter): file_name = file["file"] file_type_list = file_name.split(".") file_type = file_type_list[len(file_type_list) - 1] if file_type == 'mat': key = file["key"] array = read_mat(...
lisunshine1234/mlp-algorithm-python
data/read/read/run.py
run.py
py
1,021
python
en
code
0
github-code
6
35610337121
import cv2 import os cam = cv2.VideoCapture("video.avi") values = [] def discrimator(frame): return frame[0][0][1] != 253 # Read each frame. Use discriminator on each frame to output a zero or one. while True: ret, f = cam.read() if not ret: break values.append( discrimator(f) ) ...
sectalks/sectalks
ctf-solutions/LON0x26/bc/vid.py
vid.py
py
492
python
en
code
277
github-code
6
41087502611
import matplotlib.pyplot as plt import pandas as pd def main(): # Charger les données à partir du fichier CSV data = pd.read_csv("Parcoursup 2023 - Total.csv", delimiter=";") # Extraire les colonnes nécessaires dates = pd.to_datetime(data["Date"], format="%d/%m") # type: ignore en_attente = data[...
Ahhj93/Indicateur-Parcoursup-2023
parcoursup_candidats_en_attente.py
parcoursup_candidats_en_attente.py
py
1,820
python
fr
code
2
github-code
6
36960795245
from Player import Player # Asks user to input number of players, and creates as many player objects def initialisePlayers(players): noOfPlayers = int(input("How many players are there? ")) print() try: if noOfPlayers < 2: print("That's too few players! Please enter a number betwe...
mhourican01/jack-change-it
PlayerManager.py
PlayerManager.py
py
1,380
python
en
code
0
github-code
6
34836265477
from django.contrib.contenttypes.models import ContentType from django_filters import rest_framework as filters from music_app.models import Artist, Track, Album from music_app.apps import MusicAppConfig _content_types_id = { 'artist': ContentType.objects.get(app_label=MusicAppConfig.name, model='artist').id, ...
vladyslavtsurkan/django_music_application
music_app/api/filters.py
filters.py
py
1,745
python
en
code
0
github-code
6
40005326365
import pytest from xdlang.structures import XDType, ast from xdlang.visitors.parser import parse_text, transform_parse_tree def parse_and_transform_expr(program_text: str): parsed = parse_text(program_text, start="expr") ast = transform_parse_tree(parse_tree=parsed) return ast @pytest.mark.parametrize(...
mbednarski/xdlang
tests/ast/test_ast_literal.py
test_ast_literal.py
py
742
python
en
code
3
github-code
6
36358232508
import hide headers = hide.headers TOKEN = hide.TOKEN tell_token = hide.tell_token chat_id = hide.chat_id import http.client import mimetypes import ssl import json import time from time import localtime, strftime from datetime import datetime import requests import json # mac has some issue with SLL this fixes it tr...
tomashege/Olarm_zone_check
check_zone.py
check_zone.py
py
3,684
python
en
code
0
github-code
6
19243529886
import shlex import django_filters from django.core.exceptions import FieldError from django.db.models import Q # The function and Classes in this file are from https://github.com/nexB/scancode.io/blob/main/scanpipe/filters.py def parse_query_string_to_lookups(query_string, default_lookup_expr, default_field): ...
nexB/purldb
packagedb/filters.py
filters.py
py
2,388
python
en
code
23
github-code
6
15821882121
#!/usr/bin/env python import rospy from std_msgs.msg import Bool from audio_common_msgs.msg import AudioData import os import argparse import pyaudio import wave import datetime class AudioCapture: def __init__( self, is_record_topic, audio_data_topic, num_chan...
robotpt/ros-data-capture
src/data_capture/audio_capture2/scripts/capture.py
capture.py
py
4,708
python
en
code
0
github-code
6
43242321794
# Same as second example, but using F1 (ALM) import casadi.casadi as cs import opengen as og import json nu = 3 np = 1 u = cs.SX.sym("u", nu) p = cs.SX.sym("p", np) f = cs.dot(u, u) for i in range(nu): f += p * u[i] F1 = cs.sin(u[0]) - 0.3 C = og.constraints.Zero() U = og.constraints.Ball2(None, 0.5) problem =...
BjoernLindqvist/Crazyflie_NMPC
third_example.py
third_example.py
py
1,718
python
en
code
0
github-code
6
27757527715
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter import util as u def reset_param(t): stdv = 2. / math.sqrt(t.size(0)) t.data.uniform_(-stdv,stdv) class GCN_LSTM(nn.Module): def __init__(self, args, activation, device='cpu'): super().__init__() sel...
sunny77889/DyGCN
compare_models/GCN_LSTM/gcn_lstm.py
gcn_lstm.py
py
2,679
python
en
code
3
github-code
6
32028489205
# Prueba # # _nombreVariable = "platano-😸" # # print(_nombreVariable) #Comentario de 1 Linea # # """ # Patos # Todos # # queso # ... # """ """Prueba 01""" # cars = ["Ford","Volvo","BMW"] # # for x in cars: # print(x) # """Prueba 02""" # cars = ["Ford","Volvo","BMW"] # cars.append("Puros😨") # for x in cars: #...
Andreius-14/Notas_Mini
3.Python/1.sintaxis-py.py
1.sintaxis-py.py
py
2,111
python
en
code
0
github-code
6
13351154708
# -*- coding: utf-8 -*- #electrical calculator import math import cmath import numpy as np import matplotlib.pyplot as plot from matplotlib.offsetbox import AnchoredText #three phase power calculations def singlePhaseLoad( powerConsumed, powerFactor, leadLag): #powerConsumed in kW #power factor #leadLag ...
vdatl5/electricalCalculator
elecCalc.py
elecCalc.py
py
4,282
python
en
code
0
github-code
6
6905807226
NUM_ROWS = 5 NUM_COLS = 9 # construct a matrix my_matrix = {} for row in range(NUM_ROWS): row_dict = {} for col in range(NUM_COLS): row_dict[col] = row * col my_matrix[row] = row_dict # print(my_matrix) d_frmt = '{:<4} {:<4}' for k,v in my_matrix.items(): print("{", k, "}", "\t", v) frmt = '{...
hqpiotr/learning-python
2. Python - Rice/c3-dataAnalysis/week1/ex.py
ex.py
py
472
python
en
code
0
github-code
6
23837831992
''' Script for building and visualization of v(x) function for fixed x0 and gamma (OSCILLATING case of eigenfunction) ''' import numpy as np import matplotlib.pyplot as plt import pandas as pd import utils x0 = 0.41 gamma = 6.0 AFTER_TANGENT = False SUFFIX_NAME = '_after_tangent' if AFTER_TANGENT else '' CSV_FILE =...
leonel11/KaschenkoEquation
Scripts/oscillating_draw_v_function.py
oscillating_draw_v_function.py
py
2,269
python
en
code
0
github-code
6
73814974266
import mimetypes import os from bonobo.nodes import ( CsvReader, CsvWriter, FileReader, FileWriter, JsonReader, JsonWriter, PickleReader, PickleWriter ) FILETYPE_CSV = "text/csv" FILETYPE_JSON = "application/json" FILETYPE_PICKLE = "pickle" FILETYPE_PLAIN = "text/plain" READER = "reader" WRITER = "writer" clas...
python-bonobo/bonobo
bonobo/registry.py
registry.py
py
3,404
python
en
code
1,564
github-code
6
21569780010
import rospy import actionlib from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint from control_msgs.msg import FollowJointTrajectoryAction, FollowJointTrajectoryGoal from prl_pinocchio.tools.configurations import ConfigurationConvertor class Commander: """ This class is in charge of the contr...
inria-paris-robotic-lab/prl_hpp_tsid
prl_pinocchio/src/prl_pinocchio/commander.py
commander.py
py
6,622
python
en
code
0
github-code
6
33952361000
from pyimagesearch.centroidtracker import CentroidTracker from pyimagesearch.trackableobject import TrackableObject from imutils.video import VideoStream from imutils.video import FPS import numpy as np import argparse import imutils import time import dlib import cv2 ap = argparse.ArgumentParser() ap.add_argument("...
Nem3sisX/piedpiper-socialspace
Inside_Store_Model/run.py
run.py
py
4,748
python
en
code
6
github-code
6
27390985743
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath("../../")) sys.path.insert(0, os.path.abspath(".")) import ...
edoaltamura/swiftzoom
docs/source/conf.py
conf.py
py
3,219
python
en
code
0
github-code
6
42672162843
# -*- coding: utf-8 -*- """ Created on Apr 7 2021 Modified on May 05 2021 @author: Andres Sandino Convert "nii" image format in "png" in Lung WW=-500,WL=1500 """ #%% import os import numpy as np import matplotlib.pyplot as plt import cv2 import nibabel as nib # Patient number patient_no = 1 # Origin path and file...
andres87sg/LungCT
ConvertImages/get_nii_LungMask.py
get_nii_LungMask.py
py
1,553
python
en
code
1
github-code
6
10501866472
""" Fibonaci Number using Bottom-up Dynamic programming approach """ def fibonacci_num(num): table = {} for k in range(1, num+1): if k<=2: f=1 else: f = table[k-1] + table[k-2] table[k] = f print(table[k]) return table[k] fibonacci_num(100)
anojkr/coding-assignment
dynamic_programming/fibonacci.py
fibonacci.py
py
257
python
en
code
0
github-code
6
27894126033
def gcd(a, b): while b > 0: a, b = b, a % b return a def lcm(a, b): return int(a * b / gcd(a, b)) def solution(n, m): answer = [] if n < m: answer.append(gcd(n, m)) answer.append(lcm(n, m)) elif m < n: answer.append(gcd(m, n)) answer.append(lcm(m, n)) ...
SheepEatLion/Algorithms
num2_progms_1.py
num2_progms_1.py
py
473
python
ko
code
0
github-code
6
22460490121
import os import sys import argparse import time import warnings import torch import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt sys.path.append(os.path.join(os.getcwd().split('cbo-in-python')[0], 'cbo-in-python')) from src.torch.models import * from src.datasets import load_mnist_dat...
Igor-Tukh/cbo-in-python
demo/torch_nn_demo.py
torch_nn_demo.py
py
8,219
python
en
code
3
github-code
6
1822828953
#BinarySearch import math def binsearch(n,arr,alen): print("Array to search:",arr) si = 0 ei = alen-1 while si<=ei: m = math.ceil((si+ei)/2) if n == arr[m]: print("\t\tFound {} at {}".format(n,m)) return m elif n < arr[m]: ...
sushasru/LeetCodeCrunch
wwc_BinarySearch.py
wwc_BinarySearch.py
py
704
python
en
code
0
github-code
6
26625675366
from django import template import re try: from django.utils.safestring import mark_safe except ImportError: mark_safe = lambda s:s register = template.Library() def rfc3339_date(date): return date.strftime('%Y-%m-%dT%H:%M:%SZ') register.filter('atom_date', rfc3339_date) def atom_tag_uri(url, date=None)...
dokterbob/satchmo
satchmo/apps/satchmo_ext/product_feeds/templatetags/satchmo_feed.py
satchmo_feed.py
py
4,527
python
en
code
30
github-code
6
26712172198
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': s = "Доброе утро, товарищ" if 'а' in s: print(f"Порядковый номер первой буквы а: {s.find('а') + 1}") else: print("В предложении нет буквы а")
BorsukovVladislav/LR6
PyCharm/Individual/Task2.py
Task2.py
py
312
python
ru
code
0
github-code
6
40466806630
import pyvirtualcam import cv2 import time from filters import Filters import math from datetime import datetime import ML.HandTrackingModule as htm class VCam: def __init__(self, mxhand, video, f, detCon=0.5, cw=640, ch=480, du=True): cv2.namedWindow('feedback') self.videocap = video sel...
biguelito/funcam
vcam.py
vcam.py
py
5,797
python
en
code
0
github-code
6
30970248515
from euphorie.content.browser.country import ManageUsers from euphorie.content.countrymanager import ICountryManager from euphorie.content.sector import ISector class OSHAManageUsers(ManageUsers): @property def sectors(self): sectors_list = [] for sector in self.country.values(): i...
euphorie/osha.oira
src/osha/oira/content/browser/country.py
country.py
py
1,736
python
en
code
4
github-code
6
10981447634
''' Created on Oct 26, 2015 @author: jcheung Developed for Python 2. May work for Python 3 too (but I never tried) with minor changes. ''' import xml.etree.cElementTree as ET import codecs class WSDInstance: def __init__(self, my_id, lemma, context, index): self.id = my_id # id of the WSD instanc...
JGuymont/lesk-algorithm
lesk/loader.py
loader.py
py
2,227
python
en
code
3
github-code
6
31277293302
import unittest from unittest.mock import Mock from src.display.point import Point from src.display.window import Window class TestPoint(unittest.TestCase): def test_draw(self): # Given display = Mock() window = Window(Point.Zero, 10, 10, display) # When window.draw('hello ...
TrevorVonSeggern/gcode-terminal
test/testWindow.py
testWindow.py
py
1,503
python
en
code
0
github-code
6
22773337009
#!/usr/local/epics/modules/pythonIoc/pythonIoc from softioc import softioc, builder from netmon import netmon net = netmon("switch_list.csv") builder.LoadDatabase() softioc.iocInit() net.start_monit_loop() softioc.interactive_ioc(globals())
star-controls/network-switch-monitor
main.py
main.py
py
247
python
en
code
0
github-code
6
70808563069
import torch from .assign_result import AssignResult from .base_assigner import BaseAssigner def calc_region(bbox, ratio, stride, featmap_size=None): # Base anchor locates in (stride - 1) * 0.5 f_bbox = (bbox - (stride - 1) * 0.5) / stride x1 = torch.round((1 - ratio) * f_bbox[0] + ratio * f_bbox[2]) ...
thangvubk/Cascade-RPN
mmdet/core/bbox/assigners/region_assigner.py
region_assigner.py
py
8,816
python
en
code
177
github-code
6
38314545769
from src.web.fetch import Fetch class Coupang: URL = "https://www.coupang.com" _REQUEST_HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36", } _COOKIES = { # Update PCID...
jshyunbin/comment_crawler
src/mall/coupang.py
coupang.py
py
994
python
en
code
2
github-code
6
2857680026
import numpy as np import torch from functools import reduce # Required in Python 3 import operator def prod(iterable): return reduce(operator.mul, iterable, 1) def multi_index_to_single(tensor, index): i = 0 return torch.stack([index[i] * prod([tensor.shape[j] for j in range(i + 1, tensor.ndim)]) + in...
DavidRuhe/interferometry
src/gridding_python_improved/add_at.py
add_at.py
py
1,989
python
en
code
0
github-code
6
11924464860
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: if head: return_node = ListNode(head.val) curr...
jasonxchen/leetcode
0206-reverse-linked-list/0206-reverse-linked-list.py
0206-reverse-linked-list.py
py
546
python
en
code
2
github-code
6
14764098844
import sys from typing import List, Tuple def _get_element_orders(arr: List[int], key: int) -> Tuple[List[int], List[int], int]: """ return two lists - one of figures less than key and one of those greater - and the count of key in arr """ less, greater, equal = [], []...
JoeLove100/data-structures-and-algorithms
divide_and_conquer/majority_element.py
majority_element.py
py
1,557
python
en
code
0
github-code
6
22728666874
from imageai.Detection import ObjectDetection import os import sys prices = { 'bottle' : 11, 'apple' : 20, 'orange' : 20, 'sandwich' : 20, 'hot_dog' : 20, 'pizza' : 20, 'donut' : 20, 'cake' : 20 } def processImage(input_file,output_file) : os.environ['TF_CPP_MIN_LOG...
sawatdee/AI-image-processing
home/libs/shop_detection.py
shop_detection.py
py
1,461
python
en
code
0
github-code
6
15135490887
#!/usr/bin/env python2 from psychopy import core, visual, event #create a window to draw in myWin = visual.Window([400,400.0], allowGUI=False) #INITIALISE SOME STIMULI gabor = visual.GratingStim(myWin,tex="sin",mask="gauss",texRes=256, size=[1.0,1.0], sf=[4,0], ori = 0, name='gabor1') gabor.autoDraw = True...
honeymustard33/experiment_riskdetection
project/psycho/psychopy/demos/coder/stimuli/gabor.py
gabor.py
py
671
python
en
code
0
github-code
6
31015459461
import os import sys BASE_DIR = os.path.dirname(__file__) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, '../utils')) import tensorflow as tf import numpy as np import tf_util from pointnet_util import pointnet_sa_module, pointnet_fp_module def placeholder_inputs(batch_size, num_point): pointclou...
kxhit/BDCI2018-pointnet-
models/pointnet2_sem_seg_xyzi_final.py
pointnet2_sem_seg_xyzi_final.py
py
8,126
python
en
code
6
github-code
6
74494631546
""" Coin recognition, real life application task: calculate the value of coins on picture """ import cv2 import numpy as np def detect_coins(): coins = cv2.imread('../input_image/koruny.jpg', 1) gray = cv2.cvtColor(coins, cv2.COLOR_BGR2GRAY) img = cv2.medianBlur(gray, 7) circles = cv2.HoughCircles( ...
tinazhouhui/computer_vision
image_analysis/coin_amount_calculate.py
coin_amount_calculate.py
py
3,054
python
en
code
1
github-code
6
35508636359
#START{ import os from github import Github import json import sys import re import time from tabulate import tabulate def clone_repos(GITHUB_ACCESS_TOKEN,GITHUB_USERNAME): g = Github(GITHUB_ACCESS_TOKEN) # Create "repos" folder if it doesn't exist if not os.path.exists("repos"): os.makedirs("rep...
TAFFAHACHRAF/TAFFAHACHRAF
main.py
main.py
py
7,201
python
en
code
3
github-code
6
73924482426
import re from bs4 import BeautifulSoup ''' 要爬取信息: 1. 基本信息 2. 作者简介 3. 内容简介 4. 原文摘录 5. 推荐电子书 6. 推荐书籍 7. 评论 ''' class Parser(object): def __init__(self, soup): self.title = soup.find('span', property="v:itemreviewed") self.imgLink = soup.find('a', class_='nbg') ...
icecream-and-tea/labs_web
lab1/lab1_stage1/book_spider/src/html_parser.py
html_parser.py
py
5,863
python
en
code
2
github-code
6
37018468843
import numpy as np # randomly sampling 100 obsev from t-distribution N = 1000 df = N-1 X = np.random.standard_t(df, size = N) import matplotlib.pyplot as plt from scipy.stats import t x_values = np.arange(-5,5,0.1) y_values = t.pdf(x_values,df) # Sample Distribution count, bins, ignored = plt.hist(X, 20, density = ...
TatevKaren/mathematics-statistics-for-data-science
Probability-Distribution-Functions/Student t distribution.py
Student t distribution.py
py
634
python
en
code
88
github-code
6
40261683440
import sys sys.path.append("..") import os import pandas import re import math import argparse from models.train_model import get_training_model_new from train.ds_iterator import DataIterator from train.ds_client_generator import DataGeneratorClient from keras.optimizers import Adam from keras.callbacks import Learning...
piperod/beepose
beepose/train/train_stages.py
train_stages.py
py
7,547
python
en
code
8
github-code
6
37430539138
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' name: shopnum1 GuidBuyList.aspx SQL注入 referer: http://www.wooyun.org/bugs/wooyun-2015-0118447 author: Lucifer description: 文件GuidBuyList.aspx中,参数guid存在SQL注入。 ''' import sys import requests class shopnum_GuidBuyList_sqli_BaseVerify: def __init__(self, url): ...
iceyhexman/onlinetools
scanner/plugins/cms/shopnum/shopnum_GuidBuyList_sqli.py
shopnum_GuidBuyList_sqli.py
py
1,147
python
en
code
1,626
github-code
6
17547705346
from keras.models import Model, load_model, save_model from keras.layers import Input, Dense, Conv2D, Flatten, BatchNormalization, AveragePooling2D from keras.activations import relu, softmax from keras import backend as K from keras.optimizers import Adam, RMSprop, SGD import keras.initializers as initializers class ...
rlalpha/rl-trial
ppo/actor.py
actor.py
py
3,131
python
en
code
0
github-code
6
7161693364
""" Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time and uses constant extra space. Example 1: Input: nums = [1,2,0] Output: 3 Example 2: Input: nums = [3,4,-1,1] Output: 2 Example 3: Input: nums = [7,8,9,11,12] Output: 1 ...
CompetitiveCodingLeetcode/LeetcodeEasy
Hard/FirstMissingPositive_Q41.py
FirstMissingPositive_Q41.py
py
1,307
python
en
code
0
github-code
6
43627672364
from typing import List class Solution: # Two pointers def maximumScore(self, nums: List[int], k: int) -> int: i, j = k, k n = len(nums) res, minVal = nums[k], nums[k] while 0 < i or j < n-1: if i == 0: j += 1 elif j == n-1: ...
MichaelTQ/LeetcodePythonProject
solutions/leetcode_1751_1800/LeetCode1793_MaximumScoreOfAGoodSubarray.py
LeetCode1793_MaximumScoreOfAGoodSubarray.py
py
1,424
python
en
code
0
github-code
6
20774839234
import csv import math import time import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.ticker as mticker initial = time.time() B = 5e-4 RBW = 300 data = {} for k in range(11): for i in range(3): with open('C:\\Users\\uqfgotar\\Documents\\Magnetome...
gotamyers/Flux_conc_height
Read_multiple_data_files.py
Read_multiple_data_files.py
py
3,404
python
en
code
0
github-code
6
34900553836
#!/usr/bin/env python import argparse import collections import operator import os import re UA_RE = re.compile(r'"(Mozilla[^"]*?)"') def extract_log(file_obj, counts): for line in file_obj: m = UA_RE.search(line) if not m: continue counts[m.groups()[0]] += 1 def main(): ...
eklitzke/nginx-ua-extract
extract.py
extract.py
py
946
python
en
code
0
github-code
6
15273361459
from . import TestCase from flask import url_for from .. import db from ...models import User class UsersTest(TestCase): render_templates = False def test_list_users(self): self._create_user() response = self.as_user('get', url_for("users")) self.assertEquals(1, len(response.json[...
juokaz/flask-skeleton
website/api/tests/users_test.py
users_test.py
py
2,120
python
en
code
0
github-code
6
72132172028
import datetime import re import subprocess import sys from typing import Optional def run(argv: list[str]) -> subprocess.CompletedProcess: return subprocess.run( argv, capture_output=True, encoding='utf-8' ) def error(str: str) -> None: sys.stderr.write("%s\n" % str) def get_m...
djfo/dev-tools
merge_commits.py
merge_commits.py
py
3,438
python
en
code
1
github-code
6
19733029074
# -*- coding: utf-8 -*- import logging import requests from bs4 import BeautifulSoup logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('wb') class Client: def __init__(self): self.session = requests.Session() self.session.headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Wi...
KogameDev/WildberriesParser
main.py
main.py
py
1,056
python
en
code
0
github-code
6
44555345770
from py532lib.mifare import * import time import binascii import hashlib Mifare().SAMconfigure() Mifare().set_max_retries(MIFARE_SAFE_RETRIES) hs = hashlib.md5(b'ffffffffffffff') #這裡之後就會刪掉,不出示明文標籤 hs_md5 = hs.hexdigest() i=0 while True: ID = binascii.hexlify(Mifare().scan_field()) hs_ori = hashlib.md5(ID) ...
chyijiunn/NFC
09_hash_Tag.py
09_hash_Tag.py
py
660
python
en
code
0
github-code
6
15293278222
import numpy as np import pandas as pd from flask import Flask, render_template, request app = Flask(__name__) df = pd.read_csv("amazon_prime.csv") df = df.fillna("NaN") df["release_year"] = [str(x) for x in df['release_year']] def get_features(feats): input_columns = feats[0] inputs = feats[1] indices...
daBawse167/amazon-prime
app.py
app.py
py
4,782
python
en
code
0
github-code
6
37570271122
import re def fonct(text): x = re.compile(r'[A-Za-z0-9]{8,}') mo = x.search(text) if mo is not None: x = re.compile(r'\d+') y = re.compile(r'[a-z]+') z = re.compile(r'[A-Z]+') mo1 = x.search(text) mo2 = y.search(text) mo3 = z.search(text) if mo1 is...
bishkou/Automate-the-boring-stuff-with-python
Regex/PhoneEmailRegEx.py
PhoneEmailRegEx.py
py
520
python
en
code
1
github-code
6
37785863928
#!/usr/bin/env python3 # Modules libraries from PyInquirer import Separator from PyInquirer.prompts import list as PyInquirer_prompts_list from PyInquirer.prompts.common import if_mousedown from PyInquirer.prompts.list import basestring from prompt_toolkit.layout.controls import TokenListControl from prompt_toolkit.to...
starr-dusT/gitlab-ci
gitlabci_local/package/patcher.py
patcher.py
py
3,488
python
en
code
0
github-code
6
10220508565
from time import time from nazurin.database import Database from nazurin.models import Illust from .api import Zerochan from .config import COLLECTION patterns = [ # https://www.zerochan.net/123456 r"zerochan\.net/(\d+)", # https://s1.zerochan.net/Abcdef.600.123456.jpg # https://static.zerochan.net/A...
y-young/nazurin
nazurin/sites/zerochan/interface.py
interface.py
py
702
python
en
code
239
github-code
6
1822810123
#Symmetric Binary Tree #option-1 - using queue class Node(): def __init__(self,data): self.data = data self.lchild = None self.rchild = None ##class BSTree(): ## #def __init__(self): ## #self.root = None def insertlevelordertree(arr,root,i,n): if i <...
sushasru/LeetCodeCrunch
SymmetricBinaryTree.py
SymmetricBinaryTree.py
py
4,756
python
en
code
0
github-code
6
70357157629
# coding=utf-8 import numpy as np import matplotlib.pyplot as plt MapL = 15 # Chessboard size WinN = 5 # "Five"-in-a-row step = 0 # Steps taken steps = [] # Coordinates of each step end_flag = 0 # Game end flag board = np.zeros((MapL,MapL),dtype=np.int64) # chessboard mode = 4 # modes: 0:p...
BetaGem/Games
gobang.py
gobang.py
py
13,951
python
en
code
2
github-code
6
16119409500
import customtkinter as tk tk.set_appearance_mode("dark") janela = tk.CTk() janela.title("Janela 1") janela.geometry("400x350") janela.configure(fg_color="grey31") janela.resizable(width=False,height=False) colunas = list(range(13)) linhas = list(range(13)) janela.grid_columnconfigure(colunas, weight=1) j...
dudasaanches/interface-grafica
1.py
1.py
py
1,201
python
pt
code
0
github-code
6