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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
6554163613 | import wx
import os
import cv2
import core
import device
from utils import load_graph_model
def selectModel():
path = os.path.dirname(os.path.abspath(__file__))
number = 0
if number == 0:
modelPath = path+r"\Mobnet075F-model-stride16.json"
return modelPath
def initializeModel(m... | terry30207/background_remove | ui.py | ui.py | py | 3,551 | python | en | code | 0 | github-code | 13 |
36514547110 | class BabyShop:
def __init__(self, name, brand, price, safety_standard, good_availability, warranty, age_suitability, supplier,
country):
self.name = name
self.brand = brand
self.price = price
self.safety_standard = safety_standard
self.good_availability = go... | DanyloShyshla/verbose-garbanzo | Models/baby_shop.py | baby_shop.py | py | 616 | python | en | code | 0 | github-code | 13 |
14106688400 | import os
import simplejson
import numpy as np
import matplotlib.pyplot as plt
from common import *
class Point_Object:
def __init__(self, position, is_sink, collision_radius, field_radius):
self.position = position
self.collision_radius = collision_radius
self.field_radius = field_radius... | Victor-YG/ARRT | src/environment.py | environment.py | py | 8,785 | python | en | code | 1 | github-code | 13 |
72722352017 | """empty message
Revision ID: abc83a63df8d
Revises: c5d5f52381c5
Create Date: 2021-02-17 14:32:47.552539
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'abc83a63df8d'
down_revision = 'c5d5f52381c5'
branch_labels = None
depends_on = None
def upgrade():
# ... | knolist/knolist | migrations/versions/abc83a63df8d_.py | abc83a63df8d_.py | py | 982 | python | en | code | 1 | github-code | 13 |
28978923684 | from django.utils import timezone
from django.db import models
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator, MaxValueValidator
from decimal import Decimal
from django.db.models.signals import pre_delete
from django.dispatch import receiver
import os
class Product(mod... | Gyan-Bano/tugas-pbp-gyan | main/models.py | models.py | py | 2,580 | python | en | code | 0 | github-code | 13 |
3345873243 | import ptypes
from ptypes import *
import functools,operator,itertools,types
import logging
ptypes.setbyteorder(ptypes.config.byteorder.bigendian)
### X.224 Variable
class X224Variable(ptype.definition):
cache = {}
@X224Variable.define
class CR_TPDU(pstruct.type):
'''Connection Request'''
type = 0xe
... | arizvisa/syringe | template/protocol/x224.py | x224.py | py | 8,636 | python | en | code | 35 | github-code | 13 |
24769702949 | import os
import Opioid2D
from Opioid2D.public.Node import Node
from pug import Filename, Dropdown
from pug.component import *
from pig.components.behavior.Animate_Grid import Animate_Grid
from pig.components.controls.Key_Direction_Controls import \
Key_Directi... | sunsp1der/pug | pig/components/controls/Key_Animate_Direction.py | Key_Animate_Direction.py | py | 4,893 | python | en | code | 0 | github-code | 13 |
75055471696 | from flask import abort, render_template, flash, redirect, url_for
from flask_login import current_user, login_required
from .. import db
from ..models import Notes
from .forms import NotesForm
from . import user
@user.route('/')
@user.route('/index')
@login_required
def index():
notes = Notes.query.all()
return re... | Man-Jain/Flask-Keep | app/user/views.py | views.py | py | 791 | python | en | code | 0 | github-code | 13 |
6198811922 | class Request:
def __init__(self, token, type, flags, datacenter, complete_func, quick_ack_func):
self.message_id = 0
self.message_seq_no = 0
self.connection_token = 0
self.retry_count = 0
self.failed_by_salt = False
self.completed = False
self.cancelled = Fal... | vijfhoek/telecli | mtproto/request.py | request.py | py | 1,594 | python | en | code | 0 | github-code | 13 |
7093242307 | from django.http.response import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import authenticate, login as lgn, logout as lgout
from .forms import SignUpForm
from .models import Film
@csrf_exempt
def signup(request):
if request.method == 'POST':
form = SignUp... | aliiimaher/DownloadMovie-BackEnd | DownloadMovie_BackEnd/backend/views.py | views.py | py | 2,545 | python | en | code | 5 | github-code | 13 |
33528179049 | import os
import time
import random
# import git
from redis import Redis
import tempfile
import pickle
import zlib
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from celery import Celery
from flask import send_file, jsonify
from matplotlib.ticker import MaxNLocator
from collec... | luyangliuable/human-values-code-machine-learning-app | project/machine_learning/app.py | app.py | py | 6,122 | python | en | code | 0 | github-code | 13 |
21666901039 | import time
import unittest
import time
from datetime import datetime
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, DeclarativeBase
from sqlalchemy_mixins import TimestampsMixin
class Base(DeclarativeBase):
__abstract__ = True
class BaseModel(Base, TimestampsMi... | absent1706/sqlalchemy-mixins | sqlalchemy_mixins/tests/test_timestamp.py | test_timestamp.py | py | 2,503 | python | en | code | 697 | github-code | 13 |
8772577022 | from dataclasses import dataclass
import pickle
class Serializable:
@classmethod
def from_bytes(cls, bytearr: bytes):
obj = pickle.loads(bytearr)
if not isinstance(obj, cls):
raise TypeError(f"Unpickled object is not instance of {cls}")
return obj
def __bytes__(self):... | SiegfriedWagner/python-chat | chat/shared/message.py | message.py | py | 1,067 | python | en | code | 0 | github-code | 13 |
72104795219 | def longestPalindrome(s):
if len(s) == 1 or len(s) == 2:
return s
res = [s[i: j] for i in range(len(s)) for j in range(i + 1, len(s) + 1)]
print(res)
res = [i for i in res if len(i) > 1 and i == i[::-1]]
print(res)
print(max(res))
return max(res)
s= "abcabcbb"
print(longestPalindrom... | abhishekbudruk007/interview_practise_2022 | Problem Solving/Strings/longest_palindromic_string.py | longest_palindromic_string.py | py | 325 | python | en | code | 0 | github-code | 13 |
13514315436 | from cement.utils.misc import minimal_logger
from ebcli.core import io
from ebcli.lib import elasticbeanstalk, heuristics, utils
from ebcli.objects.exceptions import NotFoundError
from ebcli.objects.platform import PlatformVersion
from ebcli.objects.solutionstack import SolutionStack
from ebcli.operations import commo... | aws/aws-elastic-beanstalk-cli | ebcli/operations/solution_stack_ops.py | solution_stack_ops.py | py | 6,608 | python | en | code | 150 | github-code | 13 |
38221717952 | # Game
import pygame, sys, time, math, numpy, random
from pygame.locals import *
pygame.init()
pygame.mixer.init()
pygame.display.set_caption('Dungeon Crawler')
screen_width = 1920
screen_height = 1080
screenRect = pygame.Rect(0, 0, screen_width, screen_height)
screen = pygame.display.set_mode((screen_... | twitchBrittle/pydungeon | Game.py | Game.py | py | 29,346 | python | en | code | 0 | github-code | 13 |
14335682632 | import cv2
import numpy as np
import glob
import new_matriculas
import os
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
C = np.zeros((9251, 100), dtype=np.float32)
E = []
for i in range(0,37):
for j in range(0,250):
E.append(i)
E.append(i)
E = np.array(E, np.float32)
E = E.res... | KrakenPredator/PracticaObligatoria2 | entrenamiento.py | entrenamiento.py | py | 3,356 | python | en | code | 0 | github-code | 13 |
27764162638 | from django.shortcuts import get_object_or_404, render
from .models import Category
def category(request, slug):
context = {}
category = get_object_or_404(Category, slug=slug)
context['category'] = category
context['page_title'] = "Latest Posts for {}".format(category.title)
context['page_heading'... | fishisawesome/volrac_blog | categories/views.py | views.py | py | 471 | python | en | code | 0 | github-code | 13 |
72605040339 | N = input()
Tmap = []
for _ in range(int(N)):
Tmap.append(input().split(' '))
answer = []
def divide(x, y, n):
counter = 0
for i in range(y, y+n):
for j in range(x, x+n):
counter += int(Tmap[i][j])
if counter == 0 or counter == n*n:
answer.append('w' if counter == 0 else... | gitdog01/AlgoPratice | levels/level_19/2630/main.py | main.py | py | 530 | python | en | code | 0 | github-code | 13 |
32079616556 | from db import db, dbcursor
def create_drivers():
dbcursor = db.cursor()
dbcursor.execute("USE cars")
Name = input("Enter driver's Names: ")
Email = input("Enter driver's email address: ")
query = "INSERT INTO drivers (Name, Email) VALUES (%s,%s)"
values = (Name, Email)
dbcursor.execu... | ekmenjo/mysql-python | drivers.py | drivers.py | py | 496 | python | en | code | 0 | github-code | 13 |
21495561383 | from django.contrib import admin
from django.urls import path, include
from customer import views
urlpatterns = [
path("register", views.RegisterView.as_view(), name="register"),
path("login", views.LoginView.as_view(), name="login"),
path("home", views.HomeView.as_view(), name="home"),
path("products/... | Sweethasgar/E-Commerce | customer/urls.py | urls.py | py | 766 | python | en | code | 0 | github-code | 13 |
21335525406 | # -*- coding: utf-8 -*-
import numpy as np
def bin_search(x, z, dx, dz, beta=0.5, precision=0.001):
"""
:array x: (n x 1) matrix
:array z: (n x 1) matrix
:array dx: (n x 1) matrix
:array dz: (n x 1) matrix
:float beta: N_2(beta)
:float precision: threshold
"""
n = x.shape[0]
t... | Greenwind1/misc_py | optimization/primal_dual_path_fm/bin_search.py | bin_search.py | py | 1,398 | python | en | code | 0 | github-code | 13 |
4860243717 | from pathops import (
Path,
PathPen,
OpenPathError,
OpBuilder,
PathOp,
PathVerb,
FillType,
bits2float,
float2bits,
ArcSize,
Direction,
simplify,
NumberOfPointsError,
)
from matplotlib.path import Path as MPath
def mpl2skia(mpl_path, transform=None):
if transform... | leejjoon/mpl-speech-bubble | mpl_speech_bubble/mpl_pathops.py | mpl_pathops.py | py | 2,725 | python | en | code | 0 | github-code | 13 |
26473990218 | from optimization.src.Solution import Solution
from optimization.src.Strategy import Strategy
from optimization.src.TSPOptimizerClosestCityStrategy import TSPOptimizerClosestCityStrategy
class RatioHeuristicStrategy(Strategy):
def __init__(self, origin_city, possible_trip_cities, required_cities, max_trip_time,
... | marianoo-andres/EasyTripServer | optimization/src/RatioHeuristicStrategy.py | RatioHeuristicStrategy.py | py | 1,671 | python | en | code | 0 | github-code | 13 |
18634372573 | import math
import pandas as pd
import numpy as np
from read_data import *
import matplotlib.pyplot as plt
def scatterplot(regiondata,inputdata,LOB='LOB1'):
""" Scatter plot of loss for one region against one predictor input
Arguments: regiondata is a pandas dataframe from output of getLOBdata for one region
... | lm2612/mpe-cdt-teamA | scatterplotdata.py | scatterplotdata.py | py | 1,579 | python | en | code | 0 | github-code | 13 |
27802968572 | #20c10 하면 20만 시간복잡도는 충분하다
from itertools import combinations,permutations
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
min_val = 1e9
for comb in list(combinations(range(N), N//2)):
sum_1 = 0
sum_2 = 0
for i, j in permutations(comb, 2):
sum_1 += arr[i][j]
for i, j i... | tkdgns8234/DataStructure-Algorithm | Algorithm/백준/판교가는길/완전탐색&백트래킹/스타트와_링크.py | 스타트와_링크.py | py | 480 | python | en | code | 0 | github-code | 13 |
72301403538 | import diffcp
from py_utils.random_program import random_cone_prog
from py_utils.loaders import save_cone_program, save_derivative_and_adjoint, load_derivative_and_adjoint
import numpy as np
np.set_printoptions(precision=5, suppress=True)
# We generate a random cone program with a cone
# defined as a product of a 3-d... | csquires/ConeProgramDiff-benchmarking | diffcp_examples/ecos_example.py | ecos_example.py | py | 1,725 | python | en | code | 0 | github-code | 13 |
7704563530 | class FitnessTrace:
"""
Trace / log the fitness at regular intervals during optimization.
This is used for plotting the optimization progress afterwards.
"""
def __init__(self, trace_len, max_evaluations):
"""
Create the object instance.
:param trace_len: Max length of fitn... | Hvass-Labs/swarmops | swarmops/FitnessTrace.py | FitnessTrace.py | py | 2,418 | python | en | code | 70 | github-code | 13 |
29507107782 | k = int(input())
encoding_map = {}
for i in range(k):
character, encoding = input().split()
encoding_map[encoding] = character
sequence = input()
message = str()
n = len(sequence)
ptr = 0
while ptr < n:
current_encoding = str()
for j in range(ptr, n):
current_encoding += sequence[j]
i... | galacticglum/contest-solutions | CCC/S2_2010.py | S2_2010.py | py | 485 | python | en | code | 0 | github-code | 13 |
17333690224 | import logging
from aac.io.parser import parse
from aac.lang.active_context_lifecycle_manager import get_active_context
from aac.lang.constants import DEFINITION_NAME_SCHEMA, PRIMITIVE_TYPE_STRING, ROOT_KEY_VALIDATION
from aac.lang.definitions.collections import get_definition_by_name, get_definitions_by_root_key
from... | jondavid-black/AaC | python/tests/plugins/validators/test__validate_root_keys.py | test__validate_root_keys.py | py | 4,124 | python | en | code | 14 | github-code | 13 |
31112021052 | #Abrir uma imagem colorida, transformar para tom de cinza e aplique a técnica Crescimento de Regiões (Region Growing). Para isto, pegue uma imagem qualquer real, com tanto que a mesma possua um objeto se destaque do fundo. Inicialize a semente com um clique neste objeto, conforme o Tópico 21 e encontre uma regra de ade... | VivianeSouza923/ComputerVisionPy_Lapisco | 23/QUESTÃO23.py | QUESTÃO23.py | py | 4,185 | python | pt | code | 0 | github-code | 13 |
2000480594 | import json
import mysql.connector
from typing import Optional
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.params import Body
from mysql.connector.utils import NUMERIC_TYPES
from pydantic import BaseModel
app = FastAPI()
origins = [
"http://lo... | amalmekni/reactproject | src/back/main.py | main.py | py | 3,984 | python | en | code | 0 | github-code | 13 |
655657946 | # Use this python3 script to create sym links to files at paths in filesCropSubTOM.csv
# ####.rec ordered by subTOM index (ordered 0001-#### in ascending order of Dynamo index)
# Michael Wozny 2020
import numpy as np
import os, shutil, csv
# path to filesCropSubTOM.csv
srcFile = 'filesCropSubTOM.csv'
srcDir = os.getc... | mwozn/DYNAMO_dipoles_to_MOTL | symlink_tomos_by_subTOM_idx.py | symlink_tomos_by_subTOM_idx.py | py | 1,109 | python | en | code | 0 | github-code | 13 |
3720770376 | # -*- coding: utf-8 -*-
import time
def reconnector(func):
def decorated_func(*args, **kwargs):
result = func(*args, **kwargs)
if not result:
for _ in range(10):
time.sleep(5)
result = func(*args, **kwargs)
if result:
... | BloodyPhoenix/Pokemon_Go_scrapper | reconnector.py | reconnector.py | py | 537 | python | ru | code | 0 | github-code | 13 |
5764811 | import json
from datetime import date, datetime, timedelta
import google.oauth2.credentials
from apiclient.discovery import build
from dateutil.parser import parse
from django.shortcuts import get_object_or_404
from accounts.models import CustomUser
def build_service(user_id):
user = get_object_or_404(CustomUse... | jamescrg/minhome | apps/home/google.py | google.py | py | 2,282 | python | en | code | 0 | github-code | 13 |
27551138936 | #!/usr/bin/python3
"""Module is an introduction to networking with urllib in Python."""
import sys
import urllib.request as request
def url_fetch():
"""Prints response from POST request with parameters to a given url."""
if len(sys.argv) < 3:
return
url = sys.argv[1]
header = {'email': sys.a... | adobki/alx-higher_level_programming | 0x11-python-network_1/2-post_email.py | 2-post_email.py | py | 554 | python | en | code | 0 | github-code | 13 |
2376693150 | #!/usr/bin/python3
# tutorialspoint.com/python3/os_pipe.htm
# cython > how to use Cyton to compile Python 3 into C
import os, sys, time
def main():
print("The child will write text to a pipe and \n the parent will read the text written by child.")
# File descriptors r, w for reading and writing
r,w = os.... | Compilador-Text2Text/1erPrototip | experiments/os_pipe.py | os_pipe.py | py | 766 | python | en | code | 0 | github-code | 13 |
23695986766 | # Imports
import pygame
from pygame.locals import *
from sys import exit
# Init
pygame.init()
# Screen Settings
screenWidth = 1280
screenHeight = 720
screen = pygame.display.set_mode((screenWidth, screenHeight)) # TELA
pygame.display.set_caption('Jogo Teste')
# Game Loop
while True:
for event in pygame.event.g... | iuritorres/estudos | Python/POO/games/pygame outro/main.py | main.py | py | 564 | python | en | code | 1 | github-code | 13 |
73054982417 | import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.linear_model import LogisticRegression, LinearRegression
import warnings
warnings.filterwarnings('ignore')
class MetaClean:
'''
This class will contain all the functions required for one stop dat... | FlintyTub49/MAHA | MAHA/MAHA.py | MAHA.py | py | 9,004 | python | en | code | 1 | github-code | 13 |
11322912226 | import pytest
from rdopkg.cli import rdopkg, rdopkg_runner
from rdopkg import exception
import actions
def test_actions_availability():
r = rdopkg('actions')
assert r == 0, "Some action functions are NOT AVAILABLE"
def test_actions_continue_short():
r = rdopkg('-c')
assert r == 1, "-c succeeded wi... | softwarefactory-project/rdopkg | tests/test_actions.py | test_actions.py | py | 1,091 | python | en | code | 28 | github-code | 13 |
6767066248 |
import numpy as np
import random
#we are going to have 1 input the map which will be lots of 0s and 1s
#if we visit a 1 then we have an island, unless a 1 connected to that 1
#adjacently has already been visited, ignore diagonals
# 10010
#e.g area=[[1,0,0],[1,1,0],[0,0... | JordanBarton/carrot47 | island_problem.py | island_problem.py | py | 2,199 | python | en | code | 0 | github-code | 13 |
32403506005 | import nltk
dwords = [r'\bgross\b', r'\bdisgusting\b', r'\brevolting\b', r'\brepulsive\b', r'\bicky\b', r'\byucky\b', r'\bnasty\b', r'\bvile\b', r'\brepugnant\b', r'\brepellent\b', r'\bnauseating\b', r'\bheinous\b']
twords = ['gross', 'disgusting', 'revolting', 'repulsive', 'icky', 'yucky', 'nasty', 'vile', 'repugnant... | lkpinette/pennant | aod/utils.py | utils.py | py | 899 | python | en | code | 0 | github-code | 13 |
70452915217 | # Made by Nanta XE
# Team: Xiuz Code
# OPEN SOURCE
import os
import json
import time
import subprocess
import re
import hashlib
import random
########
for xiuz in ['requests', 'bs4']:
while 1:
try:
exec(f'import {xiuz}')
break
except:
subprocess.check_output(f'python3 -m pip install {xiuz}'.split())
###... | Zusyaku/Termux-And-Kali-Linux-V3 | twetdown.py | twetdown.py | py | 2,898 | python | en | code | 10 | github-code | 13 |
25565894533 | from collections import deque
vowels = deque(input().split())
consonants = deque(input().split())
flowers = {
"rose": "rose",
"tulip": "tulip",
"lotus": "lotus",
"daffodil": "daffodil",
}
is_found_word = False
while vowels and consonants:
letters = [vowels.popleft(), consonants.pop()]
for f... | mustanska/SoftUni | Python_Advanced/Exams/flowers_finder.py | flowers_finder.py | py | 769 | python | en | code | 0 | github-code | 13 |
40217547223 | """Surface velocity of any spinning object with radius rho and local spherical coordinates Phi and Theta."""
import numpy as np
from one_ray_solver.velocities import velocity_abc
class SurfaceVelocityRigidSphere(velocity_abc.VelocityABC):
"""Surface velocities u1 and u3 of a perfect rigid sphere."""
def __in... | uhrwecker/Spin | one_ray_solver/velocities/surface_vel.py | surface_vel.py | py | 1,530 | python | en | code | 0 | github-code | 13 |
14880574417 | import socket
import os
import signal
from time import sleep
# https://docs.python.org/3/howto/sockets.html
# https://docs.python.org/3/library/socket.html#module-socket
def handle_signal(signum, frame):
while True:
try:
pid, status = os.waitpid(-1, os.WNOHANG)
if pid == 0:
... | ekomissarov/edu | some-py-examples/fork-example/frk-with-socket.py | frk-with-socket.py | py | 1,569 | python | en | code | 0 | github-code | 13 |
9426795871 | from multiprocessing.spawn import prepare
import os
import hashlib
import subprocess
import re
import tqdm
from typing import List, Tuple, Dict
from . import config, template, utils, dstruct, queries
class CodeQLException(Exception):
pass
class CodeQLTable:
def __init__(self, name, colnames, content):
... | uacatcher/uacatcher-repo | scripts/components/core/codeql.py | codeql.py | py | 42,108 | python | en | code | 9 | github-code | 13 |
8342236103 | from django.shortcuts import render,redirect
from django.http import HttpResponse
# Create your views here.
from django.contrib.auth import login, authenticate
from django.contrib.auth.forms import UserCreationForm
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
nltk.download('vader_lexicon')
... | Dnnsmoyo/botlearnai | api/views.py | views.py | py | 2,997 | python | en | code | 0 | github-code | 13 |
70722677778 | def F(b):
return (b)*5/9+32
def C(d):
return ((d)-32)/5*9
#b為輸入的攝氏溫度
#d為輸入的華氏溫度
def main():
o=(input("Enter a action:"))
if o.isdigit():
a=int(o)
if a==1:
b=input("Enter Celsius temperature:")
if b.isdigit():
c=F(int(b))
print("... | alisonsyue100/py4e | W1-7.py | W1-7.py | py | 962 | python | en | code | 0 | github-code | 13 |
4593941785 | class Solution:
# @param A, B: Two string.
# @return: the length of the longest common substring.
def longestCommonSubstring(self, A, B):
m = len(A)
n = len(B)
if m == 0 or n == 0:
return 0
ans = 0
for i in range(m):
for j in range(n)... | ultimate010/codes_and_notes | 79_longest-common-substring/longest-common-substring.py | longest-common-substring.py | py | 1,489 | python | en | code | 0 | github-code | 13 |
39828788430 | #150 DAYS PYTHON CODING
#DAY2 PYTHON CODE
#TO FIND A FACTORIAL OF A GIVEN INPUT NUMBER
#4!=4*3*2*1=24
def fact(number):
if number==0:
return 1
return number*fact(number-1)
print("enter the value of the number")
number=int(input())
print("factorial of number... | Bodlavikram/BASIC-PYTHON-CODE-FOR-PARTICE | day2codefactorial.py | day2codefactorial.py | py | 341 | python | en | code | 0 | github-code | 13 |
17058508794 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class QrcodeEntity(object):
def __init__(self):
self._desk_id = None
self._qrcode_id = None
self._relation_id = None
self._shop_id = None
@property
def desk_id(... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/QrcodeEntity.py | QrcodeEntity.py | py | 2,288 | python | en | code | 241 | github-code | 13 |
27736447652 | import torch
import torchaudio
from torch.utils.data import Dataset, random_split
from sklearn.model_selection import train_test_split
from .preprocess import preprocess_audio
from torchvision import transforms
# Define your dataset class
class CustomDataset(Dataset):
def __init__(sel... | yriyazi/Hubert-Emotion_Detection | dataloaders/datasets.py | datasets.py | py | 2,667 | python | en | code | 2 | github-code | 13 |
25667998966 | from datetime import datetime
from os import path
import time
USE = True
def backup(pxf):
''' Backup Data extension'''
lb = path.join(pxf.Settings.etc_folder, 'last_backup')
if not path.isfile(lb):
with open(lb, 'wb') as f:
f.write(str(time.time()))
with open(lb, 'rb') as f:
if float(f.read(... | Skarlett/proxbox | src/tasks/standard.py | standard.py | py | 573 | python | en | code | 0 | github-code | 13 |
40004671384 | import sys
import os
import argparse
import json
import readline
from chunkypipes.util.commands import BaseCommand
ARGV_PIPELINE_NAME = 0
ARGV_FIRST_ARGUMENT = 0
EXIT_CMD_SUCCESS = 0
EXIT_CMD_SYNTAX_ERROR = 2
readline.set_completer_delims(' \t\n;')
readline.parse_and_bind('tab: complete')
class Command(BaseCommand)... | djf604/chunky-pipes | chunkypipes/util/commands/configure.py | configure.py | py | 4,872 | python | en | code | 5 | github-code | 13 |
40980396253 | #Name: Juan Gonzalez
#ID: 1808943
num1 = int(input())
num2 = int(input())
num3 = int(input())
num4 = int(input())
num5 = int(input())
num6 = int(input())
works = False
x = 0
y = 0
for i in range(-10,11):
for j in range(-10, 11):
if ((((num1 * i) + (num2 * j)) == num3) and (((num4 * i) + (... | jagonz-coding/hello-world | Homework2/6.22.py | 6.22.py | py | 533 | python | en | code | 0 | github-code | 13 |
32183778921 | import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
from konlpy.tag import Komoran, Hannanum, Kkma, Okt
from tqdm import tqdm
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.preprocessing.sequence import p... | kkkkang1009/AxperIance | ai/nl/filmrate/filmrate_modeling.py | filmrate_modeling.py | py | 5,442 | python | ko | code | 0 | github-code | 13 |
6270352567 | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 20 19:43:18 2019
@author: E442282
"""
import numpy as np
import cv2
import os
import sys
from matplotlib import pyplot as plt
def getColorSpaces(image):
rgb = cv2.cvtColor(image,cv2.COLOR_RGB2BGR)
gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
return r... | ddurgaprasad/DIP | Project/test2.py | test2.py | py | 7,703 | python | en | code | 0 | github-code | 13 |
72489872977 | from logic_gate import LogicGate
class BinaryGate(LogicGate):
def __init__(self, label):
# LogicGate.__init__(self, label)
super().__init__(label)
self.pin_a = None
self.pin_b = None
def get_pin_a(self):
if self.pin_a == None:
return int(
... | ldnicolasmay/RunestonePythonDS3 | src/Chapter01/binary_gate.py | binary_gate.py | py | 998 | python | en | code | 0 | github-code | 13 |
5453499097 | import pygame
from settings import WINDOW_WIDTH, WINDOW_HEIGHT, WHITE
from entities.player import Player
class Game:
def __init__(self):
pygame.init()
window_size = (WINDOW_WIDTH, WINDOW_HEIGHT)
self.screen = pygame.display.set_mode(window_size)
pygame.display.set_caption('Game')... | soupss/roguelike | roguelike/game.py | game.py | py | 859 | python | en | code | 0 | github-code | 13 |
14528595885 | #import cc.arduino.*
#import org.firmata.*
#Firmata firmata
from funciones import Arduino, guardarArchivo
#variables para almacenar el valor de los sensores medidos en arduino
sensor1=0 #sensor1=alargamiento
sensor2=0 #sensor2=fuerza
VV=45 #VV= valor de PWM para la valvula proporcional
VIR=3470 #VIR=Valor... | jfquinones/tensile-test-machine | maquinadetraccion.py | maquinadetraccion.py | py | 9,202 | python | es | code | 0 | github-code | 13 |
26544026949 | from __future__ import print_function
from __future__ import unicode_literals
import atexit
import getopt
import os
import sys
from .blame import Blame
from .changes import Changes
from .config import GitConfig
from .metrics import MetricsLogic
from . import (basedir, clone, extensions, filtering, format, help, interva... | ejwa/gitinspector | gitinspector/gitinspector.py | gitinspector.py | py | 6,178 | python | en | code | 2,282 | github-code | 13 |
32786379086 | import telebot
from telebot import types # кнопки
from string import Template
bot = telebot.TeleBot("1191699863:AAGisx_Riems732iRr-2eDbdiNbaA0sMZ54")
user_dict = {}
class User:
def __init__(self, city):
self.city = city
keys = ['fullname', 'phone', 'driverSeria',
'driverNumber',... | MyrzatayEldar/FirstRepository | primer.py | primer.py | py | 9,892 | python | en | code | 1 | github-code | 13 |
20602298563 | import unittest
from ecdsa import SigningKey, curves
from ecdsa.util import sha256, sigdecode_der, sigencode_der
from eth_kms_signer.utils import to_v_r_s
class TestSignUtils(unittest.TestCase):
def test_signing(self):
priv_key = SigningKey.generate(curve=curves.SECP256k1)
pub_key = priv_key.ver... | viswanathkgp12/eth_kms_signer | tests/test_sign_utils.py | test_sign_utils.py | py | 751 | python | en | code | 5 | github-code | 13 |
73730647377 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""webhook for hexo blog"""
__author__ = 'Lavenkin'
import os
class FormatTxt(object):
def getFilePath(self, path):
self._filePath = path
return self
def fileOpen(self):
try:
with open(self._filePath, encoding = 'utf-8') as f:
self._content = []
fo... | larkin-keith/export-data-ttigame | FormatTxt.py | FormatTxt.py | py | 765 | python | en | code | 0 | github-code | 13 |
17943255175 | from login import *
import codecs
import configparser
import os
from genologics.lims import *
from genologics import config
from genologics import entities
@then('check all samples')
def get(context):
lims = login(context)
samples = lims.get_samples()
assert len(samples) > 0
# sample = samples[0]
submitter, ... | viaboxxsystems/genologics-behave | features/steps/samples.py | samples.py | py | 1,336 | python | en | code | 0 | github-code | 13 |
35856368582 | import cv2
import numpy as np
import torchvision.transforms as transforms
class SimCLRTrainDataTransform(object):
"""
Transforms for SimCLR
Transform::
RandomResizedCrop(size=self.input_height)
RandomHorizontalFlip()
RandomApply([color_jitter], p=0.8)
RandomGrayscale(p=0.... | lebrice/pytorch-lightning-bolts | pl_bolts/models/self_supervised/simclr/simclr_transforms.py | simclr_transforms.py | py | 3,183 | python | en | code | null | github-code | 13 |
22624834142 | import os
import threading
from datetime import datetime
from otree.api import *
from otree.database import db
import common.SessionConfigFunctions as scf
doc = """
Landing app used to queue up users.
"""
lock = threading.Lock()
COUNT = [0]
def inc_and_get():
cnt = 0
with lock:
COUNT[0] += 1
... | rossspoon/market-prefs | landing/__init__.py | __init__.py | py | 3,257 | python | en | code | 0 | github-code | 13 |
17113610754 | """
author_model.py
===============
"""
from typing import Dict
from sqlalchemy import (ARRAY, Boolean, Column, ForeignKey, Integer,
String)
from sqlalchemy.orm import relationship
from agr_literature_service.api.database.base import Base
from agr_literature_service.api.database.versioning im... | alliance-genome/agr_literature_service | agr_literature_service/api/models/author_model.py | author_model.py | py | 1,823 | python | en | code | 1 | github-code | 13 |
4078943871 | #!/usr/bin/python3
"""
All of the routes for place resource
"""
from flask import jsonify, abort, request, Blueprint
from models import storage
from models.place import Place
from models.review import Review
places = Blueprint("places", __name__)
@places.route("/<string:place_id>", methods=['GET'])
def get_place_wit... | srinitude/AirBnB_clone_v3 | api/v1/views/places.py | places.py | py | 2,973 | python | en | code | 0 | github-code | 13 |
25541784167 | # Guessing Game Two www.practicepython.org/exercise/2015/11/01/25-guessing-game-two.html
# In a previous exercise, we’ve written a program that “knows” a number and asks a user to guess it.
# This time, we’re going to do exactly the opposite.
# You, the user, will have in your head a number between 0 and 100.
# The p... | lupp1/practicepy_solutions | guessing_game_two.py | guessing_game_two.py | py | 1,974 | python | en | code | 0 | github-code | 13 |
25194141911 | from requests_html import HTMLSession
session = HTMLSession()
url = 'http://gutenberg.org/files/11/11-0.txt'
r = session.get(url)
contents = r.html.text
with open('E:/GitPro/alice.txt','w',encoding = 'utf-8') as f:
f.write(contents)
| moxuanranm/newlearn | spider.py | spider.py | py | 262 | python | en | code | 0 | github-code | 13 |
14970982527 | # 卷积神经网络
import time
import torch
import torch.utils.data as Data
import torchvision
import sys
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def loadData(batch_size):
# 可下载 训练集,转化为Tensor格式
mnist_train = torchvision.datasets.FashionMNIST(root='D:/PycharmProjects/pytorch_data/Datasets/F... | Money8888/pytorch_learn | CNN/LeNet.py | LeNet.py | py | 6,845 | python | en | code | 1 | github-code | 13 |
14517529413 | import random
on=-1
while on!=1:
x=int (input('entrez votre chiffre pour misez '))
wow=[]
for i in range (0,10):
wow.append (random.randint (1,10))
x2=wow.pop(0)
print (x2)
if x!=x2:
print ('vous avez perdu')
else:
print ('vous avez gagné... | Tadeu-Luc/Python | Pari inutile 0 à 10.py | Pari inutile 0 à 10.py | py | 356 | python | fr | code | 0 | github-code | 13 |
3612909545 | from collections import Counter
import requests
url = "https://sites.google.com/site/dr2fundamentospython/arquivos/Video_Games_Sales_as_at_22_Dec_2016.csv"
csv = requests.get(url).text
linhas = csv.splitlines()
lista_marcas = []
lista_vendas = []
tipo_jogos = []
for i in range(1, len(linhas) - 1):
if 'Action' i... | thamyresr/fundamentos-python | Exercicio 11 B.py | Exercicio 11 B.py | py | 1,170 | python | pt | code | 0 | github-code | 13 |
44624108854 | #!/usr/bin/env python
import os
import jinja2
import yaml
from optparse import OptionParser
def render(tpl_path, context):
path, filename = os.path.split(tpl_path)
return jinja2.Environment(
loader=jinja2.FileSystemLoader(path or './')
).get_template(filename).render(context)
usage = "usage: %pro... | snovikov/j2parser | j2parse.py | j2parse.py | py | 1,273 | python | en | code | 0 | github-code | 13 |
72690437458 | import numpy as np
from typing import Optional, Callable, List
from torchvision.datasets import CIFAR10
class CIFAR10Subset(CIFAR10):
def __init__(self,
root: str,
all_classes: List[int],
classes_to_learn: List[int] = None,
dreamed_data=None,
... | Rolkarolka/Dreaming-CL | models/CIFAR10Subset.py | CIFAR10Subset.py | py | 1,304 | python | en | code | 1 | github-code | 13 |
11505251086 | """Unit tests for Caravel"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
import unittest
from mock import Mock, patch
from caravel import db
from caravel.models import DruidCluster
... | francisliyy/caravel-aidp | tests/druid_tests.py | druid_tests.py | py | 4,015 | python | en | code | 0 | github-code | 13 |
70441165457 | """
Problem Statement:-
Write a simple python program and declare a tuple initially having all vowels of the English alphabet in it and unpack its contents and store them in some variables as v1,v2,v3,v4,v5 and then assign the elements as v5,v4,v3,v2,v1 sequence.
# The required output is as:
The initial tuple is: ('a... | Jayprakash-SE/Engineering | Semester4/PythonProgramming/Prutor/Week3/Q4.py | Q4.py | py | 536 | python | en | code | 0 | github-code | 13 |
21891682904 | import unittest
from mock import Mock
from datetime import datetime
from mock import Mock, patch
from grok_test_case import GrokTestCase
from grokpy.connection import Connection
from grokpy.exceptions import GrokError
from grokpy.model import Model
from grokpy.stream import Stream
from grokpy.client import Client
cl... | Komeil1978/grok-py | tests/unit/test_model.py | test_model.py | py | 4,769 | python | en | code | 0 | github-code | 13 |
5169521091 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
import requests
driver = webdriver.Firefox()
# driver.get("https://dxarid.uzex.uz/")
# https://dxarid.uzex.uz/ru/trade/lot/5356270/
url = "https://dxarid.uzex.uz/ru/ajax/filter?LotID... | Miracle-byte/zero_corruption | crawler/dxarid.py | dxarid.py | py | 1,501 | python | en | code | 1 | github-code | 13 |
5281142633 | """This module processes the arguments given by the .ini file"""
from decimal import Decimal
from distutils.util import strtobool
from pathlib import Path
import ast
import configparser
import os
import shutil
class ArgProcessor():
"""Class that handles the .ini arguments"""
def __init__(s... | david-tedjopurnomo/TrafFormer | trafformer/arg_processor.py | arg_processor.py | py | 2,197 | python | en | code | 0 | github-code | 13 |
4368753709 | #!/usr/bin/env python
import argparse, json, os, requests
# Utilities
def write_json(filename, data):
with open(filename, "w") as f:
json.dump(data, f, indent=2, separators=(",", ": "))
f.write("\n")
# General processing
def process(issues):
summary = []
for issue in issues:
if ... | WebKit/standards-positions | summary.py | summary.py | py | 6,036 | python | en | code | 215 | github-code | 13 |
39215215564 | loaded_items = []
with open('knapsack1.txt') as f:
first = True
for line in f:
split_line = line.split()
if first:
knapsack_size = int(split_line[0])
else:
loaded_items.append((int(split_line[0]), int(split_line[1])))
first = False
def knapsack(items, capacity):
scores = [[0] * (capacity+1)]
counter... | elliotjberman/algorithms | pt2_week3/knapsack.py | knapsack.py | py | 902 | python | en | code | 0 | github-code | 13 |
72915299858 | import enum
import pathlib
import itertools
import functools
import dataclasses
from typing import (cast, TYPE_CHECKING, Any, Callable, Iterable, List, Optional,
Sequence, Set, Type, Union, Tuple)
from qutebrowser.qt import machinery
from qutebrowser.qt.core import (pyqtSignal, pyqtSlot, QUrl, QObj... | qutebrowser/qutebrowser | qutebrowser/browser/browsertab.py | browsertab.py | py | 47,756 | python | en | code | 9,084 | github-code | 13 |
69981743059 | from xbmcswift2 import Plugin, xbmcgui
from resources.lib import mainaddon
plugin = Plugin()
url1 = "https://audioboom.com/channels/4829847.rss"
@plugin.route('/')
def main_menu():
items = [
{
'label': plugin.get_string(30001),
'path': plugin.url_for('episodes1'),
... | leopheard/TheScathingAtheist | addon.py | addon.py | py | 1,271 | python | en | code | 0 | github-code | 13 |
29765124599 | # -*- coding: utf-8 -*-
"""
Created on Thu May 12 11:44:28 2022
-This class is used to do model training
- We can also use transfer learning but there are
two things to consider(input_size, output_size)
@author: aceso
"""
#%% module
import pandas as pd
import os
from sklearn.preprocessing import OneHotEncoder
impor... | AceSongip/Sentiment_Analysis | sentiment_analysis_training.py | sentiment_analysis_training.py | py | 3,260 | python | en | code | 0 | github-code | 13 |
35794183853 | from __future__ import division
from common import *
def tfqmr(B, A, x, b, tolerance, maxiter, progress, relativeconv=False, callback=None):
#####
# Adapted from PyKrylov (https://github.com/dpo/pykrylov; LGPL license)
#####
r0 = b - A*x
rho = inner(r0,r0)
alphas = []
betas = []
resid... | kamccormack/EQporoelasticity | local_lib/block/iterative/tfqmr.py | tfqmr.py | py | 2,169 | python | en | code | 6 | github-code | 13 |
3542555182 | from songthread.services import SongthreadService
from django.test import TestCase
from music.models import Track
from math import ceil
class SongthreadServiceTestCase(TestCase):
def test_populate_track_using_spotify_lookup_returns_correct_results(self):
track = Track
track.spotify_uri = 'spotify... | abbas123456/solocover | songthread/tests.py | tests.py | py | 1,276 | python | en | code | 0 | github-code | 13 |
73533696976 | from lib.embedding.vectorizer import FaceVectorizer
from lib.detection.detector import Detector
from PIL import Image
from torchvision import transforms
import numpy as np
import pandas as pd
from PIL import Image, ImageDraw, ImageFont
import torch
from utils.utils import *
#def compare_imgs(name, img):
# CUDA for P... | jsmithdlc/FaceRecognition | src/recognize.py | recognize.py | py | 2,611 | python | en | code | 0 | github-code | 13 |
14263943030 | from django.conf.urls import patterns,include, url
urlpatterns = patterns('accounts.views',
#url(r'^$','index',name='accounts_index'),
# Signup, signin and signout
url(r'^signup/$','signup',name='signup'),
url(r'^signin/$','signin',name='signin'),
url(r'^signout/$','signout',name='signout'),... | lihm09/SmartCar | accounts/urls.py | urls.py | py | 390 | python | en | code | 1 | github-code | 13 |
32496609786 | """-----------------------------------------
一、采集我的人脸数据集
获取本人的人脸数据集10000张,使用的是dlib来
识别人脸,虽然速度比OpenCV识别慢,但是识别效
果更好。
人脸大小:64*64
-----------------------------------------"""
import cv2
import dlib
import os
import random
import tkinter as tk
from tkinter import messagebox
def img_change(img, light=1, bias=0):... | sytsunboy2008/face-recognition | load.py | load.py | py | 4,079 | python | en | code | 0 | github-code | 13 |
19265583660 | '''
obj serilization
reg expression
pip
'''
import pickle; #obj serilization
'''
dumps -> obj to binary serial
loads -> bin to obj deserial
dump -> obj to bin but save as file
load -> load bin data from file and convert back to obj
'''
'''
L1= list(range(100));
print(L1);
L1_b=pickl... | 99002531/python | pick11.py | pick11.py | py | 808 | python | en | code | 0 | github-code | 13 |
71366116177 | import warnings
from benchopt import BaseSolver, safe_import_context
with safe_import_context() as import_ctx:
from sklearn.exceptions import ConvergenceWarning
from sklearn.svm import LinearSVC
class Solver(BaseSolver):
name = 'sklearn'
install_cmd = 'pip'
requirements = ['scikit-learn']
... | softmin/ReHLine-benchmark | benchmark_SVM/solvers/sklearn.py | sklearn.py | py | 941 | python | en | code | 2 | github-code | 13 |
21145568360 | from contextlib import suppress
from os import remove
from secrets import token_hex
import math
import time
import boto3
from pyrogram import Client, filters
from pyrogram.errors import RPCError, MessageNotModified
from pyrogram.filters import media, poll, private, user
from pyrogram.types import Message, InlineKeyboar... | saintcurfew/filetolink | main.py | main.py | py | 4,318 | python | en | code | 0 | github-code | 13 |
16376292326 | from BSTNode import Node
class BST:
size = 0
def __init__(self) -> None:
self.root = None
def insert(self, value):
"""
Returns 'True' if node was successfully inserted.
Returns 'False' if node was not successfully inserted.
"""
newNode = Node(value)
... | hilmiguner/Python-Projects | Data Structures/BinarySearchTree/BST.py | BST.py | py | 2,054 | python | en | code | 1 | github-code | 13 |
20174806453 | import json
from datetime import datetime, timedelta
from channels.layers import get_channel_layer
from celery import shared_task
from common.serializers import UUIDEncoder
from common.timer import Timer
from databases.classes import DatabaseConnector
from databases.models import Database
from dataframes import Dataf... | AlvaroJSnish/revolve | revolve/retrains/tasks.py | tasks.py | py | 3,590 | python | en | code | 0 | github-code | 13 |
10079562030 | from math import sqrt
import random
import Person
from Restaurants import Restaurant
# me=Person.Person()
# me.first_name="Ceyda"
# me.second_name="Günes"
#
# me.print_my_name()
#
# user2=Person.Person()
# user2.first_name="Erdem"
# user2.second_name="Cimenoglu"
# user2.print_my_name()
#
# user3=Person.Person()
# u... | marektdu/losgehts | losgeht.py | losgeht.py | py | 3,511 | python | en | code | 0 | github-code | 13 |
70213070098 | import algosdk.encoding
from algosdk.constants import PAYMENT_TXN, APPCALL_TXN, ASSETTRANSFER_TXN
from flask import Flask, request, jsonify, render_template, Response, session, url_for, redirect
import ipfshttpclient
import os, tempfile, mimetypes
from algosdk import mnemonic, account
from algosdk.future.transaction im... | jaysingh/AlgoRoyalty | main.py | main.py | py | 14,201 | python | en | code | 0 | github-code | 13 |
6683912977 | #################################################
# File Name:bamtofragments.py
# Author: Pengwei.Xing
# Mail: xingwei421@qq.com,pengwei.xing@igp.uu.se,xpw1992@gmail.com
# Created Time: Tue Nov 29 15:46:09 2022
#################################################
import pysam
import sys
import argparse
def fargv():
... | pengweixing/scFFPE | Snakemake/bamtofragments.py | bamtofragments.py | py | 5,691 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.