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
70062472105
import socket from _thread import start_new_thread as s from threading import Thread from multiprocessing import Process import threading from random import randint as r from random import choice def eratosthenes2(n): multiples = set() for i in range(2, n+1): if i not in multiples: yield i ...
Brian-RG/RSA-client-server-chat
server.py
server.py
py
3,312
python
en
code
0
github-code
36
8114541825
""" Defines a function wrapper that can be used to group calls to a 'listable' function into batches. """ import sys import traceback import asyncio from fsc.export import export from . import wrap_to_coroutine @export class BatchSubmitter: """ Function wrapper that collects calls to a function of one para...
FrescolinoGroup/pyasynctools
fsc/async_tools/_batch_submit.py
_batch_submit.py
py
4,827
python
en
code
0
github-code
36
5275367948
import os import json import psycopg2 import psycopg2.extras from sentence_transformers import SentenceTransformer from sklearn.metrics.pairwise import cosine_similarity model = SentenceTransformer('distilbert-base-nli-mean-tokens') alpha = 0.9 #Function that will take a list of goals and goal ids and output the sim...
kcirtapfromspace/cloudfoundry_circleci
src/bert/cleaned_bert_similarity.py
cleaned_bert_similarity.py
py
1,797
python
en
code
1
github-code
36
28523528787
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.model_coordinators.model_system import ModelSystem as CoreModelSystem from urbansim.model_coordinators.model_system import ModelSystem ...
psrc/urbansim
zurich_parcel/model_coordinators/model_system.py
model_system.py
py
2,157
python
en
code
4
github-code
36
9084026058
import requests import json import re import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.common.exceptions import NoSuchElementException # Create a new Firefox session capa...
Axelflg/get_info_JSON
Find_info.py
Find_info.py
py
7,050
python
en
code
0
github-code
36
7507981867
import os, sys, random from datetime import datetime platforms = { "darwin": "MacOS", "win32": "Windows32", "win64": "Windows64", "linux": "Linux", } def run_tool(): while True: now = datetime.now() current_time = now.strftime("%H:%M:%S") command = input(f"[{current_time}] ...
Vincent2212/CommandLine
main.py
main.py
py
3,462
python
en
code
0
github-code
36
2039679921
#!/usr/bin/env python3 import requests, json, dewiki, sys class ArgvError(Exception): def __init__(self): Exception.__init__(self, "Put in only '1' Value") class Search: ep = 'https://en.wikipedia.org/w/api.php' session = requests.Session() #endpoint text = '' def __init__(self, keywo...
youngmoneee/django_piscine
day03/ex02/request_wikipedia.py
request_wikipedia.py
py
1,638
python
en
code
0
github-code
36
18903389392
from uuid import uuid4 from logging import getLogger from uchicagoldrtoolsuite import log_aware from uchicagoldrtoolsuite.core.lib.convenience import log_init_attempt, \ log_init_success from .abc.transformer import Transformer from ..structures.archive import Archive from ..structures.stage import Stage __author...
uchicago-library/uchicagoldr-toolsuite
uchicagoldrtoolsuite/bit_level/lib/transformers/archivetostagetransformer.py
archivetostagetransformer.py
py
4,571
python
en
code
0
github-code
36
31180051801
from dataclasses import dataclass from datetime import datetime from sqlalchemy_serializer import SerializerMixin from app import db @dataclass class Result(db.Model, SerializerMixin): __tablename__ = 'results' name: str last_build: int last_result: str last_exception: str traceback: str u...
TomerCohen95/JenkinsViewer
models.py
models.py
py
740
python
en
code
0
github-code
36
74039762662
from rest_framework.decorators import api_view, permission_classes from rest_framework.response import Response from rest_framework import status from rest_framework import serializers from .models import * from .permissions import ValidApiKey import random #Supporting Functions def random_string(range_max,string=No...
ChrisBriant/nonogram_backend
api/views.py
views.py
py
5,695
python
en
code
0
github-code
36
11580214091
import os import time import random import sys import time import math from datetime import datetime from getpass import getpass from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from seleniu...
tomo-jp/pairsBot
pairs_automation.py
pairs_automation.py
py
2,928
python
en
code
0
github-code
36
71789959143
AIRFLOW_API_URL = 'localhost:8080' AIRFLOW_API_AUTH = ('airflow', 'airflow') AIRFLOW_API_HEADERS = { 'Accept': 'application/json', 'Content-Type': 'application/json' } DAG_ID_TO_CLONE = 'test_base_dag' CLONED_DAG_ID = 'test_base_8431_dag'
dmitriidavs/practice
AWS/lambda/creds.py
creds.py
py
250
python
en
code
0
github-code
36
19633985319
from pydub import AudioSegment from pydub.silence import split_on_silence import os import multiprocessing def split_audio(filename, audio_folder='audio_folder', output_folder='segments'): # Check if output folder exists and if not, create it if not os.path.isdir(output_folder): os.mkdir(output_folder)...
harshbhatia66/BallsDeepLearning
DataPipeline/segment_audio.py
segment_audio.py
py
1,714
python
en
code
0
github-code
36
6795419791
from django.conf import settings from rest_framework import viewsets, exceptions from rest_framework.decorators import action from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework_jwt.authentication import JSONWebTokenAuthentication from utils.certific...
tomasgarzon/exo-services
service-exo-events/event/api/views/event.py
event.py
py
4,675
python
en
code
0
github-code
36
24837779560
nombre = ['Edu', 'Joel', 'Richard', 'Mike', 'Rick'] otros = [1, 'Agosto', False, [1,3,4], 10.5] #Tuplas : solo que no se puede modificar (inmutables) notas = (1, 10, 20, 13, 14, 'Eduardo') # Diccionarios: es ordenado pero por sus llaves No por posiciones usuarios = { 'nombre':'Eduardo', 'apellido':'de Rivero'...
blasdch18/Code10
Backend/backend10/testFlask/colecciondata.py
colecciondata.py
py
494
python
es
code
0
github-code
36
74144129703
#!/usr/bin/env python # -*- coding: utf-8 -*- # ======================================= # Author : NareN # git : https://github.com/DEVELByte # ======================================= import logging import os import re import argparse from develbyte import create_app logger = logging.getLogger("default") def pur...
im-naren/flask-starter-kit
runserver.py
runserver.py
py
1,027
python
en
code
0
github-code
36
11642826592
from django.shortcuts import render from django.views.generic import CreateView, UpdateView, ListView from .models import Empresa from .forms import EmpresaForm from notafiscal.models import NotaFiscal def empresa_list(request): template_name ='empresa_list.html' objects = Empresa.objects.all() context ={...
vvalcristina/notafiscal
nfe/empresa/views.py
views.py
py
1,063
python
en
code
2
github-code
36
31292738689
import os import configparser def num_cpus(): try: return len(os.sched_getaffinity(0)) except AttributeError: return os.cpu_count() def max_workers(): return (num_cpus() * 2) + 1 # Read configuration file config = configparser.ConfigParser() config.read('config.ini') # Set bind variable ...
SaltisRS/ChatEndpoint-osrs
gunicorn_config.py
gunicorn_config.py
py
467
python
en
code
0
github-code
36
12896234781
""" Provides RESTful URLs for Route objects """ from flask import Blueprint, request from back_end.api import jsonify_decorator, token_decorator from back_end.db import routes from back_end.exceptions import InvalidContent ROUTES = Blueprint('route', __name__) @ROUTES.route('/<routeid>', methods=['GET']) @jsonify_d...
vedantchokshi/various-plans
back_end/api/routes.py
routes.py
py
1,842
python
en
code
1
github-code
36
42243204047
import numpy as np import argparse import sys import matplotlib.pyplot as plt from datetime import datetime max_value = 6 def classify(w, sample): return (np.sign(np.dot(w, sample))) def generate_dataset(num_data_points, dimension): # generate x0 of each data point (always 1) x0 = np.ones(shape=(num_data...
mjuvilla/ML-UPF-Homework
H1/ml_h1.py
ml_h1.py
py
4,452
python
en
code
1
github-code
36
31888132367
# -*- coding: utf-8 -*- import argparse import os import schedule import logging import logging.config import sys import time from redtrics.core.runner import Runner logging.config.fileConfig(os.path.join(os.path.dirname(__file__), '..', 'etc', 'logging.ini')) logger = logging.getLogger(__name__) def main(): pa...
tuananh-nguyen/redtrics
redtrics/cli/app.py
app.py
py
994
python
en
code
0
github-code
36
2744613256
from django import forms from events.models import Event from datetime import datetime from django.contrib.admin import widgets class EventInputForm(forms.ModelForm): class Meta: model = Event fields = ['organization', 'name', 'start_time','end_time', 'description', 'mask_profile', 'contact_name', ...
DigitalEmpowermentATX/DECAwebsite
digital_inclusion/events/forms.py
forms.py
py
1,532
python
en
code
0
github-code
36
70096834663
#!/usr/local/bin/python3 import os # Part 1 print("------- Part 1 -------") data = {} script_dir = os.path.dirname(__file__) with open(os.path.join(script_dir, "data.txt")) as file: for line in file: line = line.split() data[int(line[1])] = int(line[4]) turn = 0 det_die = 0 players = {k: [v] for ...
derBanz/AdventOfCode
AoC2021/day21/script.py
script.py
py
1,830
python
en
code
0
github-code
36
10978100631
from gensim import corpora, models, similarities import logging from Preprocess.py import MyCorpus processed_dir = 'Users/mlinegar/Data/LDA/BoW' _num_topics = 10 dictionary = corpora.Dictionary.load(processed_dir + "firsttry.dict") corpus = corpora.MmCorpus(processed_dir + "firsttry.mm") tfidf = models.TfidfModel(co...
mlinegar/RedditScraping
Analysis/Tranformations.py
Tranformations.py
py
435
python
en
code
0
github-code
36
35377030158
from clean_doc import clean_doc from gensim.models.doc2vec import LabeledSentence from gensim.models import Doc2Vec import gensim.models.doc2vec import gensim import multiprocessing cores = multiprocessing.cpu_count() assert gensim.models.doc2vec.FAST_VERSION > -1, "this will be painfully slow otherwise" class Lab...
wrat/Semantic-Relationship-Between-News
Doc2vec_model/doc2vec.py
doc2vec.py
py
1,124
python
en
code
0
github-code
36
21477557993
import sys n, b = map(int, input().split()) arr = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] c = 1000 def matrixmult(A,B): n = len(A) C=[[0]*n for _ in range(n)] for i in range(n): for j in range(n): for k in range(n): C[i][j]+=A[i][k]*B[k][j] ...
Minsoo-Shin/jungle
week02/10830_행렬제곱.py
10830_행렬제곱.py
py
820
python
en
code
0
github-code
36
32274499758
#!/opt/csw/bin/python # coding=utf-8 import re import fileinput from time import time from datetime import datetime urlRe = re.compile('(http://www\.|https://www\.|http://|https://|www\.)(?P<link>\S+)') youtubeUrlRe = re.compile('(youtube\.com/watch\?v=|youtube\.com/watch\?.*&v=|youtu.be/)(?P<id>[A-Za-z0-9_-]{11})') ...
sviik/marju
plugin/interceptor/old/__init__.py
__init__.py
py
2,001
python
en
code
1
github-code
36
74729792745
def print_board(board): print(f" {board[0]} | {board[1]} | {board[2]} ") print("---+---+---") print(f" {board[3]} | {board[4]} | {board[5]} ") print("---+---+---") print(f" {board[6]} | {board[7]} | {board[8]} ") def check_win(board, player): win_combinations = ((0, 1, 2), (3, 4, 5), (6, 7, 8)...
bolojutsu/tic-tac-toe
main.py
main.py
py
1,382
python
en
code
0
github-code
36
70808020583
from flask import Flask, request, jsonify from a_entities.bank_account import BankAccount from a_entities.customer import Customer from b_data_access_layer.postgres_bank_account_dao import BankAccountPostgresDAO from b_data_access_layer.postgres_customer_dao import CustomerPostgresDAO from c_service_layer.postgres_ban...
bluedragonscales/project0_banking
main.py
main.py
py
7,753
python
en
code
0
github-code
36
69829306344
from torchvision import transforms, datasets import h5py import os import numpy as np import torch from torch.utils.data.dataset import Dataset from torch.utils.data import DataLoader #参考:https://blog.csdn.net/shwan_ma/article/details/100012808 #https://github.com/pbizopoulos/signal2image-modules-in-deep-neural-networ...
im-wll/EEG-process
dataset/dataloader.py
dataloader.py
py
3,865
python
en
code
1
github-code
36
16178639967
# -*- coding: utf-8 -*- from high2low import Changer_low as ch_low import utils as util #from low2high import Changer_high as ch_high import is_horl as is_horl txt = input("Enter Korean Sentence: ") ch = ch_low() #ch_high = ch_high() hi = is_horl.isHigh() detect=hi.isThisHigh(txt) # 높임말 if detect ==1: hi.getSta...
joowhan/Translation_Project
lab/highlow_factory/ver3_chari/src/test.py
test.py
py
523
python
en
code
2
github-code
36
32153562900
# From codereview.stackexchange.com def partitions(set_): if not set_: yield [] return for i in range(2**len(set_)//2): parts = [set(), set()] for item in set_: parts[i&1].add(item) i >>= 1 for b in partitions(parts[1]): ...
dawiditer/MIT6002-pset1
ps1_partition.py
ps1_partition.py
py
2,699
python
en
code
0
github-code
36
10230915470
def binary_search(list, item): """ Данная функция реализует бинарный поиск. Параметры функции: A - список, item - искомое занчение. Функция вернет номер искомого значениея (его индекс). Функция начинает проверять среднее значение, если искомое значение больше среднего, то значения м...
Ragocha/PyWork
123.py
123.py
py
1,664
python
ru
code
0
github-code
36
39238016680
import cv2 import numpy as np def get_seg_size(images, threshold=23, pmapxy=None): seg_sizes = [] index = 0 for image in images: """ if index % 10 == 0: cv2.imshow("thres", thresh_image) cv2.waitKey(0) """ index += 1 if pmapxy is not None: ...
Alice-OSENSE/feature_err_analysis
feature_func.py
feature_func.py
py
989
python
en
code
0
github-code
36
30467468047
class Solution(object): def findErrorNums(self, nums): """ :type nums: List[int] :rtype: List[int] """ ans = [] for num in nums: #标记数组,把存在的index都标成负的 index = abs(num) - 1 #这里用abs,是因为在变负的过程中,可能没遍历到的,已经被变负了。 if nums[index] > 0: ...
dundunmao/LeetCode2019
645. Set Mismatch.py
645. Set Mismatch.py
py
810
python
zh
code
0
github-code
36
18282435233
import glob, os #class_NEs=set(['new york','islip', ' suffolk ', 'long island']) #class_words= set(['rain', 'raining', 'water', 'inches', 'record', 'wednesday', 'weather', 'flood', 'damage', 'storm' ]) small_NEs = set(['newtown', 'connecticut', 'sandy hook elementary school', 'Adam Lanza']) small_words=set(['shooting'...
macmania/Team-A-NLP
TeamJ/Unit8/para_cleaner.py
para_cleaner.py
py
946
python
en
code
1
github-code
36
8195166573
from PIL import Image, ImageOps, ImageDraw, ImageFont from bot.config import PICS_DIRECTORY, QUOTATION_DATABASE import textwrap import sqlite3 import random import os import io def get_random_quote(): conn = sqlite3.connect(QUOTATION_DATABASE) cursor = conn.cursor() count = cursor.execute('SELECT COUNT(...
Ku6iKRu6Ika/quote-bot
bot/utils.py
utils.py
py
1,504
python
en
code
0
github-code
36
21247224214
__author__ = 'yuerzx' import csv import pymongo from pymongo import MongoClient data_client = MongoClient() data_base = data_client.Locations #add authenticate for the MongoDB data_base.authenticate('EZYProperty', '8jshf7asd') super_c = data_base.supermarket counter = 0 err_counter = 0 with open("/home/yuerzx/Desktop...
yuerzx/python_information
supermarket_location/import_into_mongodb.py
import_into_mongodb.py
py
1,237
python
en
code
0
github-code
36
74753775465
from prophepy import Mock from .builtin_matchers import get_matcher from .exceptions import CustomMatcherError from .utils import map_for_dict, reveal_if_needed class Subject: ''' This class represents the specced object. ''' def __init__(self, value, object_behavior): ''' It is instanc...
Einenlum/specify
specify/subject.py
subject.py
py
2,436
python
en
code
0
github-code
36
15648874127
from __future__ import annotations from copy import deepcopy from math import prod class Dot(object): x: float y: float def __init__(self, x: float, y: float): self.x, self.y = x, y def __str__(self): return "(" + str(self.x) + ";" + str(self.y) + ")" class Polynomial(object): ...
migregal/bmstu-iu7-ca
lab_02/src/polynomial.py
polynomial.py
py
3,795
python
en
code
0
github-code
36
10346160454
import pandas as pd from pulp import * import itertools df = pd.read_excel('beers.xlsx') costs = df.\ assign(Warehouse_to_Bar = lambda x: x.Warehouse_to_Bar.astype(str)).\ set_index('Warehouse_to_Bar').\ to_dict() warehouses = ['A','B'] bars = [str(x) for x in range(1,6)] supply_ = [1000,400...
Takfes/notes-operations-research
src/A.misc/03.pulp-transportation/pulp-transportation.py
pulp-transportation.py
py
1,493
python
en
code
0
github-code
36
42682908850
import eventlet from Skull import ServerSkull from Ezgame import Ezgame from Vote import Vote class Player: def __init__(self, name, sid): self.name = name self.sid = sid self.connected = True class Room: def __init__(self, sio): self.sio = sio self.ev = "room" ...
marvqin/zoomhanabi
Room.py
Room.py
py
10,755
python
en
code
0
github-code
36
8882346001
import simplejson as json from datetime import datetime DEBUG = False # Zigbee catch-all decoder, just adds the following properties: # Only changes topic: # csn-zigbee/acp_id -> acp/acp_id/csn-zigbee class Decoder(object): def __init__(self, settings=None): print(" zigbee_catchall init()") re...
AdaptiveCity/acp_local_mqtt
acp_decoders/decoders/zigbee_catchall.py
zigbee_catchall.py
py
1,788
python
en
code
1
github-code
36
73819276585
from transformers import BertForTokenClassification, BertJapaneseTokenizer, get_linear_schedule_with_warmup from flask import Flask, render_template, request import argparse import json from predict import predict import torch import sys from pathlib import Path base_dir = Path(__file__).resolve().parents[1] sys.path.a...
ujiuji1259/NER
BERT/api.py
api.py
py
1,783
python
en
code
0
github-code
36
30800987858
print('1') #from src.__init__ import main from flask import Flask, request from flask_restx import Api, Namespace, fields, Resource ## local from settings import model_path, vocab_path, cnn_path from torch import nn # from src.controller.analyzeController import Analyze from src.controller.keywordController import ...
hmcck27/pshelper-server
src/app_for_server.py
app_for_server.py
py
6,957
python
ko
code
null
github-code
36
29391322952
from collections import defaultdict class Solution: def longestStrChain(self, words: List[str]) -> int: n = len(words) words.sort(key=lambda word: len(word)) graph = defaultdict(set) for i, word in enumerate(words): for j in range(len(word)): graph[word...
AnotherPianist/LeetCode
1129-longest-string-chain/1129-longest-string-chain.py
1129-longest-string-chain.py
py
587
python
en
code
1
github-code
36
21254500663
import json import boto3 from datetime import datetime current_date_time = datetime.now() sqs = boto3.resource('sqs', region_name='us-east-1') def lambda_handler(event, context): queue = sqs.get_queue_by_name (QueueName='CustomerOrders') date_time = current_date_time.strftime("%d/%m/%Y %H:%M:%S") ...
tmachek98/python-boto3
Lambda.py
Lambda.py
py
563
python
en
code
0
github-code
36
32630908689
import os import subprocess path = os.getcwd() # train the new model qu_train_data = path + "/data/quarterly.csv" qu_model = "linear_quarterly" exec_cmd1 = "python3 " + path + "/train_linear.py " + qu_train_data + " ./data/test.csv " + qu_model exec_cmd2 = "python3 " + path + "/train_log.py " + qu_train_data + " ./da...
chivesab/Vending-Machine-Management-System
ML/cronjob_quarterly.py
cronjob_quarterly.py
py
396
python
en
code
0
github-code
36
36266836523
# Create a class Car with attributes Model, year, and price # and a method cost() for displaying price. # Create two instances of the class and call the method for each instance class car: def __init__(self,mod,yr,prz): self.Model=mod self.year=yr self.price=prz def cost(self): print("cost: ",sel...
JK432/Car-class
main.py
main.py
py
409
python
en
code
0
github-code
36
2856409659
from matplotlib import pyplot as plt # 题目:某月气温变化表 # 知识点总结: # 1.x,y的输入 # 2.绘制 plt.plot() # 3.设置图片大小 plt.figure() # 4,保存到本地 plt.savefig() # 5.描述信息 xlabel() ylable() title() # 6.调整x,y的间距 xticks(),yticks() # 7.线条的样式 linestyle= # 8.标记出特殊的点 # 9.添加水印 # 设置图片大小 plt.figure(figsize=(16, 8), dpi=80) # 左闭右开 ...
srguf/DataAnalysis
matplotlib/折线图plot/单线/折线图.py
折线图.py
py
1,705
python
zh
code
0
github-code
36
34796334569
from django.urls import resolve, reverse from .. import views from .test_recipes_base import RecipesTestBase class RecipesSearchViewTest(RecipesTestBase): def test_search_view_function_is_correct(self): view = resolve(reverse('recipes:search')) self.assertIs(view.func, views.search) def test...
giovcandido/django-course-project1
recipes/tests/test_recipes_search_view.py
test_recipes_search_view.py
py
1,872
python
en
code
0
github-code
36
74644166183
# Updated code for part 1 in order to get part 2 # and didn't save copy. Only have Part II code with open('d8p1.txt', 'r') as f: data = [p.split() for p in f.read().strip().split('\n')] accumulator = 0 visited = {} start = 0 next_code = 1 stop_code = False last_index = len(data) - 1 occurrances = 0 while not s...
pdotneff/AdventOfCode
aoc_2020/day8/day8_part2.py
day8_part2.py
py
1,134
python
en
code
0
github-code
36
1783613538
import sqlite3 import time from telethon import TelegramClient from telethon import sync, events import re import json db = sqlite3.connect('Account.db') cur = db.cursor() x = 1 m = 0 while(True): if x == 23: print("Всего добыто:") print(m) break cur.execute(f"SELECT PHONE FROM Accou...
Black-Triangle-code/Telegram_coin_bot
balance.py
balance.py
py
1,310
python
en
code
123
github-code
36
71903174184
#! /usr/bin/env python import matplotlib.pyplot as plt from scipy.fftpack import fft from scipy.io import wavfile # get the api from scipy.signal import fftconvolve, convolve, stft, butter import numpy as np from scipy import signal import warnings warnings.filterwarnings("ignore") from numpy import array, diff, where...
buoyancy99/BobaBot
voice_utils/src/old_detection.py
old_detection.py
py
5,313
python
en
code
2
github-code
36
8446584828
import warnings from cupy import testing import cupyx.scipy.signal.windows as cu_windows import pytest from pytest import raises as assert_raises try: import scipy.signal.windows as cpu_windows # NOQA import scipy.fft # NOQA except ImportError: pass window_funcs = [ ('boxcar', ()), ('triang...
cupy/cupy
tests/cupyx_tests/scipy_tests/signal_tests/test_windows.py
test_windows.py
py
22,594
python
en
code
7,341
github-code
36
73811093863
import logging logger = logging.getLogger(__name__) def app(environ, start_response): path = environ.get('PATH_INFO', '') if path == '/exception': raise Exception('My exception!') data = "Request on %s \n" % path logger.info(data, extra={'tags': ['role:web', 'env:prod']}) start_response...
sebest-blog/gunicorn-with-docker
myapp.py
myapp.py
py
453
python
en
code
15
github-code
36
11141391697
import numpy as np import random as r # In this module 2-point crossover and non-(uniform) mutation will be implemented pc = r.uniform(0.4, 0.7) #probability of crossover pm = r.uniform(0.001, 0.3) #Probability of mutation def two_point_crossover(x1, x2): # X1: first parent chromosome # X2: Second parent...
Mohamedyasserhelmy/Marketing_Budget_Allocation
crossover.py
crossover.py
py
3,651
python
en
code
0
github-code
36
23077134371
from spa.clientside.asyncdbhandler import CAsyncDBHandler from spa import BaseServiceID, tagBaseRequestID class CPostgres(CAsyncDBHandler): # Asynchronous and SQL streaming postgreSQL service id sidPostgres = BaseServiceID.sidReserved + 0x6FFFFFF4 """ An Open flag option, which is specific to PostgreS...
udaparts/socketpro
bin/spa/clientside/upostgres.py
upostgres.py
py
1,257
python
en
code
27
github-code
36
14302599067
import os import cv2 as cv import numpy as np people = [] for i in os.listdir(r'C:\Users\Atul\Downloads\OpenCV_course\opencv-course-master\Resources\Faces\train'): people.append(i) #each folder in the faces folder corresponds to one person ben affleck,mindy,etc and name of folder is person's name so we store tar...
ajinkeya17/OpenCV-Course
Codebase/face_recognition_training.py
face_recognition_training.py
py
2,247
python
en
code
0
github-code
36
37290989369
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('user_profile', '0003_remove_userprofile_title'), ] operations = [ migrations.CreateModel( name='RegistrationPath...
bitapardaz/diabet
user_profile/migrations/0004_auto_20171023_0837.py
0004_auto_20171023_0837.py
py
952
python
en
code
0
github-code
36
8806299537
from django.test import TestCase from django.urls import resolve from django.http import HttpRequest from django.template.loader import render_to_string from django.utils.html import escape from lists.views import home_page, view_list from lists.models import Item, List from lists.forms import STR_EMPYT_LIST_ERROR, It...
juewuer/python-web-dev
superlists/lists/tests/test_views.py
test_views.py
py
7,695
python
en
code
0
github-code
36
23702247236
# -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __all__ = ["IterativeTwoDSearch"] import os import h5py import numpy as np from .two_d_search import TwoDSearch from ._grid_search import grid_search class IterativeTwoDSearch(TwoDSearch): cache_ext = ".h5" query_pa...
dfm/ketu
ketu/iterative.py
iterative.py
py
4,714
python
en
code
10
github-code
36
12420365719
from django.urls import path from . import views # register app namespace which is going to be used in URL names app_name = "my_app" urlpatterns = [ path("", views.example_view, name="example"), path("variable/", views.variable_view, name="variable") ]
felixdusengimana/python-django-web-development
04 Templates/template_study/my_app/urls.py
urls.py
py
262
python
en
code
0
github-code
36
4557856269
__author__ = 'Ong See Hai' __date__ = 'Nov 2020' __copyright__ = '(C) 2020, Ong See Hai' from qgis.core import (QgsProcessing, QgsProcessingAlgorithm, QgsProcessingParameterVectorLayer, QgsProcessingParameterMapLayer, QgsProc...
ebhoward/QgisIMPTools
scripts/OshPlatformx.py
OshPlatformx.py
py
6,875
python
en
code
0
github-code
36
10073007087
import numpy as np import json import timeit import os import argparse from pathlib import Path import sys from shapely.geometry import Polygon import numpy as np import numba from inspect import getmembers sys.path.append(os.path.realpath('hausdorff')) from hausdorff_dist import hausdorff_distance sys.path.append(o...
PhanVinhLong/vehicle-counting-aichcmc2020
count2.py
count2.py
py
6,482
python
en
code
1
github-code
36
19782973821
from datetime import datetime from scipy import misc import tensorflow as tf import os import src.facenet.detect_face import cv2 import matplotlib.pyplot as plt from helper import get_images_from_file_list, get_box_from_ellipse import math import pickle import dlib # ============================================ # Glob...
ryan-mccaffrey/glasses-for-everyone
detect_face.py
detect_face.py
py
18,364
python
en
code
2
github-code
36
33825739371
from domain.Errors import InvalidClassException from domain.Rental import Rental class RentalValidator(): def validate(self, rental): errors = "" if type(rental.get_id()) != int: errors += "Invalid id! \n" if len(rental.get_dvd_name()) == 0: errors += "Invali...
projectworldsofficial/Movie-rental-in-python
domain/RentalValidator.py
RentalValidator.py
py
1,369
python
en
code
1
github-code
36
3237711712
from django.db import models from rest_framework import serializers gender=( ("male","Male"), ("female","Female"), ) status=( ("Done","Done"), ("Pending","Pending"), ) Data=( ("share_all_data","Share All Data"), ("share_alerts_only","Share Alerts Only"), ) communication=( ("email","Email"),...
AdnanSiddiqui96/Projects-Backup
TestProject/Patient/models.py
models.py
py
15,374
python
en
code
0
github-code
36
12486515502
import cv2 from datetime import datetime, timedelta import geojson from geotiff import GeoTiff from models import Model0 import netCDF4 import numpy as np import pandas as pd import os from os import path from scipy import interpolate from scipy.io import loadmat, savemat import torch import wget import...
drivendataorg/snowcast-showdown
1st Place/src/features/constfeatures.py
constfeatures.py
py
13,858
python
en
code
12
github-code
36
40372645232
import datetime from django.utils import timezone from django.test import TestCase from django.urls import reverse from .models import Question def create_question(question_text, days): """Create a question with the given `question_text` and published the given numer of `days` offset to now (negative for qu...
gpuma/phuyu
polls/tests.py
tests.py
py
4,413
python
en
code
1
github-code
36
28713706413
# ----encoding='utf-8'----- # Chentian's code paradise import smtplib import email # 负责构造文本 from email.mime.text import MIMEText # 负责构造图片 from email.mime.image import MIMEImage # 负责将多个对象集合起来 from email.mime.multipart import MIMEMultipart from email.header import Header mail_host="smtp.163.com" mail_sender="chentstud...
codefreshstudent/day8
测试文件夹/测试发邮件.py
测试发邮件.py
py
1,338
python
en
code
0
github-code
36
25845948589
#!/usr/bin/python3 '''Unittest for class ``State``''' import unittest from models.review import Review from models.base_model import BaseModel class TestReview(unittest.TestCase): '''Init class to test State''' def test_class(self): '''Test to inheritance of class''' with self.subTest(msg='I...
darbumas/AirBnB_clone
tests/test_models/test_review.py
test_review.py
py
715
python
en
code
1
github-code
36
27101659507
''' Test Code Enter the radius of cylinder: 4 Enter the height of the radius: 5 Volume of cylinder is 251.3 cubic units ''' import math radius = float(input('Enter the radius of cylinder: ')) height = float(input('Enter the height of the radius: ')) volume = math.pi * ((radius**2) * height) print(f'Volume of cylinder i...
osipiosita/python-bootcamp
python/LAB/lab1/question4.py
question4.py
py
378
python
en
code
0
github-code
36
26211274731
import sys sys.stdin = open('input.txt') T = 10 for tc in range(1, T+1): N = int(input()) arr = [] for i in range(100): arr.append(list(map(int, input().split()))) # 100줄 읽어오기★★ sum_a = [] sum_b = [] for i in range(100): sum_a.append(sum(arr[i])) # a 가로 ...
hong00009/algo
swea/1209/sol.py
sol.py
py
728
python
en
code
0
github-code
36
15698017832
from django.shortcuts import render from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework import status from rest_framework.views import APIView from rest_framework.permissions import IsAuthenticated from django.db.models import Q from .serializer impor...
mohammad-reza-sasani/online-shop-react-django
backend/comment/views.py
views.py
py
2,202
python
en
code
0
github-code
36
5663610357
import methods import matplotlib.pyplot as plt def func(x, y): return 1 + 1.8*y*methods.np.sin(x) - y**2 x0 = 0 y0 = 0 x_end = 6 h = 0.1 x1, y1, h = methods.runge_kutta(x0, y0, x_end, func, h, True) x1_halved, y1_halved = methods.runge_kutta(x0, y0, x_end, func, h/2, False) x2, y2 = methods.adams(x1[:4], y1[:4]...
Melkye/Labs
Math/Lab8_Koshi_problem/Lab8_Koshi_problem/Lab8_Koshi_problem.py
Lab8_Koshi_problem.py
py
1,270
python
en
code
0
github-code
36
4430105383
# Time complexity - O(n) class Node(): def __init__(self, data): self.data = data self.next = None def printLL(head): while head is not None: print(str(head.data)+"->", end="") head = head.next print("None") return def takeInput(): head = Non...
Riyachauhan11/Python-learning-Concepts
linked lists/optimized_input_ll.py
optimized_input_ll.py
py
728
python
en
code
0
github-code
36
17836371460
""" A abordagem abaixo, utilizando RDD ao invés do Dataframe, começou a dar um erro de 'list index out of range', o qual não consegui corrigir. Então como estava levando muito tempo nesta abordagem, fiz utilizando Dataframe (arquivo NasaFileAnalysis.py). """ from operator import add textFile = sc.textFile("teste_sema...
apenas-ana/teste_spark
abordagemQueNaoFuncionou.py
abordagemQueNaoFuncionou.py
py
939
python
pt
code
0
github-code
36
31524008748
import fitz from loguru import logger def get_page_from_sheet(sheet: str, pdf_fpath=None, doc=None): """ Get the page number from the sheet. """ if (pdf_fpath is not None) and (doc is not None): raise ValueError("Only one of pdf_fpath or doc can be specified.") if pdf_fpath: doc =...
fuzzy-tribble/meche-copilot
meche_copilot/pdf_helpers/get_page_from_sheet.py
get_page_from_sheet.py
py
1,478
python
en
code
1
github-code
36
2838526539
from Action import Action class Game: def __init__(self, p1, p2): self.p1, self.p2 = p1, p2 self.winner, self.a1, self.a2 = None, None, None #Runs a game def play_game(self): self.a1, self.a2 = self.p1.choose_action(), self.p2.choose_action() # Send the actions played to ...
Magssch/TDT4113-computer-science-programming-project
project 2/Game.py
Game.py
py
1,436
python
en
code
0
github-code
36
7538069613
# Aloysio def solve(k, ns, m): if k < 0: return 0 if k == 0: return 1 if m[k] >= 0: return m[k] sol = 0 for n in ns: sol+= solve(k-n, ns, m) m[k] = sol return sol if __name__ == "__main__": n = 2 ns = [1, 2] m = [-1 for i in range(n+1)] p...
daily-coding-x-br/daily-coding
may/14/aloysio.py
aloysio.py
py
342
python
en
code
2
github-code
36
36728617897
from pwn import * from time import sleep pw= '8d16635db965bc4e0a97521e8105fad2' p = process('./lol.bin') #p = remote("auto-pwn.chal.csaw.io", 11001) #pid = gdb.attach(p, gdbscript=""" # b * runChallenge # """) #parse it p.sendlineafter('> ',pw) #sleep(1) p.recvuntil('\nMain is at ') #sleep(2)...
Aleks-dotcom/ctf_lib_2021
csaw_finals/pwn/crafty/sol.py
sol.py
py
1,079
python
en
code
1
github-code
36
75052351464
import random import socket, os class RAT_SERVER: def __init__(self, host, port): self.host = host self.port = port def build_connection(self): global client, addr, s s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((self.host, self.port)) ...
FZGbzuw412/Python-RAT
server.py
server.py
py
18,162
python
en
code
86
github-code
36
25917900708
from __future__ import print_function import argparse import random import math import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from os import listdir from os.path import join from moviepy.editor import * model = torch.hub.load('pytorch/vision', 'deeplabv3_resnet101', ...
WhiteNoise/deep-bgremove
createmask.py
createmask.py
py
2,592
python
en
code
61
github-code
36
37777774456
''' Server端流程 1. 建立socket,socket是负责具体通信的一个实例(可接两端的插口) 2. 绑定,为创建的socket指派固定的端口和ip地址 3. 接受对方发送的内容 4. 给对方反馈, 此步骤为非必须 ''' # socket 模块负责socket编程 import socket # 模拟服务器的函数 def serverFunc(): # 1.建立socket # socket.AF_INET:使用ipv4协议族 # socket.SOCK_DGRAM:使用UDP通信 sock = socket.socket(socket.AF_INET, socket.SOCK_D...
lzybb/ljbgit
普通课程/3-高级语法/net编程/v01.py
v01.py
py
1,529
python
zh
code
0
github-code
36
31618419583
import torch from pathlib import Path import copy import time import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np import pdb import skimage from distutils.version import LooseVersion from skimage.transform import resize as sk_resize device = torch.device("cuda:0" if torch.cuda.is_availab...
hariharan98m/ischemic-stroke-detection
fcn_roialign/master2/utils.py
utils.py
py
10,688
python
en
code
0
github-code
36
38191743871
import json leer = [] for linea in open('202006_movements.json','r'): leer.append(json.loads(linea)) #print (linea) datos = [] def leer(): for linea in open('202006_movements.json','r'): datos.append(json.loads(linea)) def recogidasPorPunto(): resultado = dict() for obj in d...
dalevale/GIW2020-21
practica2.py
practica2.py
py
1,371
python
es
code
0
github-code
36
42866864407
""" 3 / \ 9 20 / \ 15 7 return its zigzag level order traversal as: [ [3], [20,9], [15,7] ] """ # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # Definition for a binary tree node...
allen791210/LeetCode
103_Binary_Tree_Zigzag_Level_Order_Traversal.py
103_Binary_Tree_Zigzag_Level_Order_Traversal.py
py
1,289
python
en
code
0
github-code
36
4979629437
#Conversão de Bases Numéricas print("""Digite 1 para Conversão em Binário; Digite 2 para Conversão em Octal; Digite 3 para Conversão em Hexádecimal; """) esc = int(input('Escolha:')) num = int(input('Valor para Conversão:')) bin = "{:b}" .format(num) oc = "{:o}" .format(num) hex = "{:x}" .format(num) if esc == 1: ...
SloBruno/Curso_Em_Video_Python_Exercicios
ex037.py
ex037.py
py
446
python
pt
code
0
github-code
36
5049970089
import copy import json import math import struct from functools import partial from pathlib import Path, PosixPath import numpy as np # isort: off import torch import tensorrt as trt # isort: on # numpy doesn't know bfloat16, define abstract binary type instead np_bfloat16 = np.dtype('V2', metadata={"dtype": "bfloa...
NVIDIA/TensorRT-LLM
tensorrt_llm/_utils.py
_utils.py
py
6,159
python
en
code
3,328
github-code
36
13239914664
# import os import csv csv_path = os.path.join('..', 'Resources', 'budget_data.csv') # csv_path = 'D:\\UCIBootcamp\\Module3_challenge\\python_challenge\\PyBank\\Resources\\budget_data.csv' # total_month = 0 net_amount = 0 date = [] changes = [] profit_change_list = [] profit_change_list_2 =[] # decrease = [] # ...
dtnpht/python_challenge
PyBank/code/main.py
main.py
py
2,251
python
en
code
0
github-code
36
3572315429
import numpy matrix = numpy.loadtxt("similarity.txt") key_file = open("pair.txt", "r") keys = {} line = key_file.readline() while (line!=""): words = line.split(':', 1) keys[int(words[0])] = words[1].replace("\n", "") line = key_file.readline() def my_cmp(x,y): if x[1] < y[1]: return -1 elif x[1] > y[1]: re...
HenryZhou0333/CS411
similar_courses/process.py
process.py
py
632
python
en
code
2
github-code
36
19651817490
from binance.client import Client import pandas as pd import matplotlib.pyplot as plt import ta data = Client().get_historical_klines("BTCUSDT", Client.KLINE_INTERVAL_1DAY, "01 JANUARY 2018") df = pd.DataFrame(data, columns = ['timestamp', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_av', 'trad...
RaphaelFontaine/Trading
src/moving_average_crossing.py
moving_average_crossing.py
py
1,984
python
en
code
0
github-code
36
22420951914
from django.shortcuts import render,redirect from django.contrib import messages from .models import Courses def new(request): context = { 'course': Courses.objects.all() } return render(request, 'new.html', context) def create(request): errors = Courses.objects.basic_validator(request.P...
Wendy-Wu-Chiang/Python_stack
django/full_stack_django/courses_proj/courses_app/views.py
views.py
py
952
python
en
code
0
github-code
36
22545958900
class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ n=len(nums) low=0 mid=0 high=n-1 while mid<=high: if nums[mid]==0: nums[mid],nums[low]=nums[low],nu...
rudrasgithub/My-LeetCode-Submissions
0075-sort-colors/0075-sort-colors.py
0075-sort-colors.py
py
524
python
en
code
1
github-code
36
10558928752
def getPriority(a): if ord(a) >= 97: return ord(a)-96 else: return ord(a)-38 f = open("input.txt", "r") lines = [] ans1 = 0 ans2 = 0 for line in f.readlines(): lines.append(line[:len(line)-1]) first = line[:len(line)//2] second = line[len(line)//2:] for i in first: if i ...
YuehuaYin/Advent-Of-Code-22
Day-3/solution.py
solution.py
py
597
python
en
code
0
github-code
36
11883990410
from lcp.core.interfaces.module import Module from lcp.modules.camerafeed.camera_feed import CameraFeed import cv2 as cv import _thread class FaceDetector(Module): __name = "Face Detector" __version = "1.0" __dependencies = [CameraFeed] def __init__(self, config): super().__init__(self.__name...
huybthomas/LCP-Core-Old
src/lcp/modules/facedetector/face_detector.py
face_detector.py
py
1,900
python
en
code
0
github-code
36
39983009651
# Find out if a given number is an "Armstrong Number". # An n-digit number that is the sum of the nth powers of its digits # is called an n-Armstrong number. Examples : # 371 = 33 + 73 + 13; # 9474 = 94 + 44 + 74 + 44; # 93084 = 95 + 35 + 05 + 85 + 45. # Write a Python program that; # takes a positive integer number...
MattCon70/mypython
assigments/armstrong_number.py
armstrong_number.py
py
1,737
python
en
code
0
github-code
36
24537866239
from operator import itemgetter, add from pathlib import Path banks = list(map(int, Path("day6.txt").read_text().split())) n, history = len(banks), {} while tuple(banks) not in history: history[tuple(banks)] = len(history) i, mx = max(enumerate(banks), key = itemgetter(1)) banks[i] = 0 for i in range(i + 1, i...
AlexBlandin/Advent-of-Code
2017/day6.py
day6.py
py
675
python
en
code
0
github-code
36
70666328104
import xml.etree.ElementTree as ET bd=ET.Element("base") ventana=ET.SubElement(bd,"ventana", name="ventana-consultas") ventana_hide=ET.SubElement(ventana,"ventana-hide",) ventana_hide.set("option-hide","false") ET.dump(bd) tree = ET.ElementTree(bd) tree.write("C:/Users/ricar/Desktop/pruebas v1/pruebasv1.xml") estruc...
ColqueRicardo/v-version
pruebas/pruebas aisladas/archivos xml.py
archivos xml.py
py
829
python
es
code
0
github-code
36