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
24680540350
class Solution: def findKthBit(self, n: int, k: int) -> str: s = "0" # print(str(int(not int(s1)))) def getBinary(s,n): if n == 0: return s invertedS = [str(int(not int(bit))) for bit in s] reversedInvertedS =...
YosefAyele/Leetcode-and-Codeforces-Problems
1545-find-kth-bit-in-nth-binary-string/1545-find-kth-bit-in-nth-binary-string.py
1545-find-kth-bit-in-nth-binary-string.py
py
531
python
en
code
2
github-code
1
22593934162
# -*- coding: utf-8 -*- import cv2 import numpy as np from PIL import Image import glob import os from tqdm import tqdm def color_map(N=256, normalized=False): def bitget(byteval, idx): return ((byteval & (1 << idx)) != 0) dtype = 'float32' if normalized else 'uint8' cmap = np.zeros((N, 3), dtype...
ISCAS007/torchseg
tools/covert_voc_format.py
covert_voc_format.py
py
1,890
python
en
code
7
github-code
1
22020722236
from . import app from twilio.twiml.messaging_response import MessagingResponse from .models import Question from flask import url_for, request, session @app.route('/question/<question_id>') def question(question_id): question = Question.query.get(question_id) session['question_id'] = question.id return sm...
picsul/short-message-survey
sms_app/question_view.py
question_view.py
py
798
python
en
code
1
github-code
1
9512230126
from datetime import timedelta from feast import FeatureView, Field from feast.types import Float64, String import pandas as pd from entities import properties_entity from data_sources import properties_source properties_fv = FeatureView( name="properties_fv", entities=[properties_entity], ttl=timedelta...
Thangphan0102/RealEstateProject
feature_repo/feature_views.py
feature_views.py
py
1,165
python
en
code
0
github-code
1
12000953748
# -*- coding: utf-8 -*- # those error codes shall be transformed into exceptions, where applicable NO_ERROR = 0 # ERROR_INI_FILE_NOT_EXISTS = 1 ERROR_LR_FILE_NOT_EXISTS = 2 ERROR_SIG_FILE_NOT_EXISTS = 3 ERROR_SG_FILE_NOT_EXISTS = 4 INVALID_MEASUREMENT_ID = 5 ERROR_LOG_DIR_NOT_EXISTS = 6 USE_CASE_NOT_IMPLEMENTED = 7 ...
actris-scc/ELDAmwl
ELDAmwl/errors/error_codes.py
error_codes.py
py
2,180
python
en
code
3
github-code
1
43198314648
""" ✘ Commands Available - • `{i}fullpromote <reply user/ username>` Promote User With All rights """ import asyncio from telethon.errors import BadRequestError from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidError from telethon.tl.functions.channels import DeleteUserHistoryRequest, Ed...
LoopXS/addons
fullpromote.py
fullpromote.py
py
1,738
python
en
code
0
github-code
1
2422288587
import logging from odoo import api, fields, models, _ from odoo.exceptions import UserError, MissingError _logger = logging.getLogger(__name__) class ProcurementGroup(models.Model): _inherit = 'procurement.group' @api.model def _run_scheduler_tasks(self, use_new_cursor=False, company_id=False): ...
decgroupe/odoo-addons-dec
procurement_run_mts/models/procurement_group.py
procurement_group.py
py
3,969
python
en
code
2
github-code
1
71681309794
import json import datetime import requests from common.logger import warning, debug def attribute_test(test: dict, attributes: list, kind: type) -> None: buf = [] try: for i in attributes: buf.append(i) test = test[i] except KeyError: warning('fatal error, key ' + ...
Chenrt-ggx/ObjectOriented
common/config.py
config.py
py
1,970
python
en
code
3
github-code
1
7612589965
import os, time, logging import numpy as np import cv2 import tensorflow as tf # TF object detection imports from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util ''' Custom object detection wrapper functions ''' from object_detection.utils import visualization_utils...
cnmy-ro/Enhanced-DeepSORT
custom_utils.py
custom_utils.py
py
2,670
python
en
code
3
github-code
1
18929715693
from tkinter import * def main(): window = Window() window.mainloop() class Window(Tk): def __init__(self): super().__init__() # object attributes self.title_text = "Config Dictionary" self.width = 275 self.height = 200 # configure self.title(self.title_text) self.config(width = self.width, height...
rontarrant/tkoopython
001_window/window_013_config_dictionary.py
window_013_config_dictionary.py
py
2,167
python
en
code
2
github-code
1
35659180945
#!/usr/bin/env python3 # Input: # 24 bit vectors, number of vectors is 200000 (not too big!!!) # # The general idea: # We need to put vectors with Hamming distance <=2 (i.e. <=2 bits are different) in same cluster # To do that, we first find all duplicates for [x x 1 1 1 1 1 1 ... 1 1] mask, meaning first 2 bits #...
alexeypolo/learning_and_playground
coursera/Stanford-Algorithms/course3-greedy-mst-dp/week2/clustering_big.py
clustering_big.py
py
5,499
python
en
code
0
github-code
1
7417790842
#!/usr/bin/env python3 import os import traceback ## Not sure what this was originally intended for. Leaving for now. BLF # for key, val in gemsModules.deprecated.delegator.settings.subEntities: # if val in gemsModules.deprecated.delegator.settings.deprecated: # pass # prototype: need to build import sta...
GLYCAM-Web/gems
gemsModules/deprecated/sequence/receive.py
receive.py
py
11,290
python
en
code
1
github-code
1
2341825486
from fastapi import APIRouter, WebSocket from ..wallets import router as walletRouter router = APIRouter( tags=['Websocket endpoints'], responses={ 404: {"description": "Resource does not exist"} }, ) router.include_router( router=walletRouter, prefix='/wallets', ) @router.websocket(...
timmypelumy/web3_utils_fastapi
routers/ws/index.py
index.py
py
517
python
en
code
1
github-code
1
14194255928
import hashlib import inspect import operator from typing import Callable, Optional, Union import cloudpickle import numpy as np class _FakeArgSpec: def __init__( self, args=None, varargs=None, varkw=None, defaults=None, kwonlyargs=None, kwonlydefaults=None...
loganbvh/py-tdgl
tdgl/parameter.py
parameter.py
py
14,810
python
en
code
24
github-code
1
2420058577
from odoo import api, models, fields, tools import logging _logger = logging.getLogger(__name__) class MailActivityTeam(models.AbstractModel): _inherit = 'mail.activity.team' # image: all image fields are base64 encoded and PIL-supported image = fields.Binary( string="Image", attachment...
decgroupe/odoo-addons-dec
mail_activity_team_image/models/mail_activity_team.py
mail_activity_team.py
py
1,369
python
en
code
2
github-code
1
36453588883
class Solution: # @param A : list of integers # @return an integer def solve(self, A): length = len(A) left = 0 right = length-1 while left < right: mid = left + (right-left)//2 if A[mid] == A[mid-1]: if (mid)%2 != 0: ...
SaiChandraCh/IB
src/week_3/day_11_binary_search_1/assignment/2_single_element_sorted_array.py
2_single_element_sorted_array.py
py
765
python
en
code
0
github-code
1
10353210307
import cv2 from tracker import KCFTracker def tracker(cam, frame, bbox): tracker = KCFTracker(True, True, True) # (hog, fixed_Window, multi_scale) tracker.init(bbox, frame) while True: ok, frame = cam.read() timer = cv2.getTickCount() bbox = tracker.update(frame) bbox ...
ryanfwy/KCF-DSST-py
run.py
run.py
py
1,159
python
en
code
68
github-code
1
26491128149
#sample function #accept a list of integers as its input #output a new list consisting of any positive integers #sample input: [1,-3,9,-2,7] def sample_function_name(input_list): output_list = [] for i in range(0, len(input_list)): if input_list[i] >= 0: output_list.append(input_list[i...
hiyawnewhaile/Python_class
w1/d1/samples/sample_2.py
sample_2.py
py
391
python
en
code
0
github-code
1
72908934433
all_rucksacks = open("day3_input.txt").read().split("\n") def get_item_prio(item: str) -> int: if 'a' <= item <= 'z': return ord(item) - 96 if 'A' <= item <= 'Z': return ord(item) - 38 else: breakpoint() prio_score = 0 for rucksack in all_rucksacks: nb_items = len(rucksack) /...
LucineGx/advent_of_code_2022
day3.py
day3.py
py
794
python
en
code
0
github-code
1
20868560186
from struct import unpack_from from collections import namedtuple from smbus2 import SMBus Measurement = namedtuple("Measurement", "temperature,humidity,dust") class DrsDust: REGISTER=0 def __init__(self, bus=1, i2c_address=0x08): self.address = i2c_address self.bus = SMBus(bus) ...
satanowski/smog-o-meter
smogometer/services/DrsDust.py
DrsDust.py
py
752
python
en
code
0
github-code
1
15689594548
# -*- coding: utf-8 -*- # 作者:Sosai # 时间:2021/10/29 10:11 # 名称:BST实现.PY # 工具:PyCharm class TreeNode: def __init__(self, val): self.data = val self.leftChild = None self.rightChild = None self.parent = None class BinarySearchTree: def __init__(self, valList): self.root...
MsSusai/Python_Practice
数据结构与算法/BST实现.py
BST实现.py
py
4,987
python
en
code
1
github-code
1
19466962586
# -*- coding: utf-8 -*- """ @file @brief Function solving the TSP problem """ import random def distance_point(p1, p2): """ Returns the Euclidian distance between two points. Retourne la distance euclidienne entre deux points. @param p1 point 1 @param p2 point 2 @return ...
sdpython/code_beatrix
src/code_beatrix/algorithm/tsp.py
tsp.py
py
3,498
python
en
code
1
github-code
1
29855912138
def solution(n, arr1, arr2): answer = [] for i in range(n): arr1_e = list(str(bin(arr1[i])[2:]).zfill(n)) arr2_e = list(str(bin(arr2[i])[2:]).zfill(n)) code = '' for j in range(len(arr1_e)): code += max(arr1_e[j], arr2_e[j]) e = '' for c in code: ...
wisehero/programmers
level1/비밀지도.py
비밀지도.py
py
455
python
en
code
0
github-code
1
439035070
class Fooset(set): def __init__(self, s=(), foo=None): super(Fooset,self).__init__(s) if foo is None and hasattr(s, 'foo'): foo = s.foo self.foo = foo @classmethod def _wrap_methods(cls, names): def wrap_method_closure(name): def inner(self,...
tcfraser/quantum_tools
code/quantum_tools/misc/fooset.py
fooset.py
py
1,235
python
en
code
1
github-code
1
74003467553
import pygame, random from functools import reduce class Meteor(pygame.sprite.Sprite): """Clase para crear los sprites para generar los meteoros Args: pygame ([type]): [description] """ def __init__(self) -> None: super().__init__() self.image = pygame.image.load("meteor.pn...
baubyte/pygamePractice
games/meteors/meteors.py
meteors.py
py
2,779
python
es
code
0
github-code
1
16778996304
inversores = [ "1,Veriee,vvasilkov0@qq.com,Female,Besançon", "2,Lizbeth,locklin1@tiny.cc,Female,Jawand", "3,Tymon,thillum2@diigo.com,Male,Rîbniţa", "4,Teddie,tschofield3@ehow.com,Male,Tlogoagung", "5,Dom,dantonin4@squarespace.com,Male,Tonjongsari", "6,Armstrong,acreegan5@reverbnation.com,M...
pablokan/23prog1
parciales/M2/parcial_01_pereyra_ariana.py
parcial_01_pereyra_ariana.py
py
3,344
python
es
code
0
github-code
1
12934811377
from __future__ import annotations import operator from copy import copy from itertools import chain from collections.abc import Callable from dataclasses import replace from functools import partialmethod from random import sample from typing import Any, Hashable, Iterable, List, Optional, Sequence, Tuple, Union from...
Telofy/SquigglyPy
squigglypy/tree.py
tree.py
py
9,286
python
en
code
2
github-code
1
70646935393
import re, nltk, bs4 import pandas as pd import numpy as np from numpy.linalg import norm import scipy as sp from scipy.sparse import csr_matrix as csr import random from string import punctuation from nltk.corpus import stopwords from collections import defaultdict file_path = 'C:\\path\\to\\both_files\\' ...
guenter-r/knn
tf_idf.py
tf_idf.py
py
5,501
python
en
code
5
github-code
1
72401623715
import cv2 import numpy as np import os from os.path import join from time import time from os import listdir import matplotlib.pyplot as plt from src.data.utils.make_dir import make_dir import src.data.constants as c # Set working directory to script location c.setcwd(__file__) files = c.RAW_FILES_GENERALIZE kernel ...
gummz/cell
src/data/annotate_old.py
annotate_old.py
py
2,259
python
en
code
0
github-code
1
36039178243
import math def findCheapestPrice(n, flights, src, dst, K): """ :type n: int :type flights: List[List[int]] :type src: int :type dst: int :type K: int :rtype: int """ prices = {} for s, e, p in flights: prices[(s,e)] = p dp = [[math.inf for _ in range(n)] for _ in r...
zhaoxy92/leetcode
dynamic-programing/787_cheapest_flights_with_k_stops.py
787_cheapest_flights_with_k_stops.py
py
1,316
python
en
code
0
github-code
1
31211098990
from logic.areas import Area, SubArea from maze_builder.types import Room, DoorIdentifier, Direction, DoorSubtype, Item LEFT = Direction.LEFT RIGHT = Direction.RIGHT UP = Direction.UP DOWN = Direction.DOWN ELEVATOR = DoorSubtype.ELEVATOR rooms = [ Room( name='The Moat', rom_address=0x795FF, ...
blkerby/MapRandomizer
python/logic/rooms/crateria.py
crateria.py
py
22,018
python
en
code
21
github-code
1
2378379818
def task01(): s = 'Hello, user!' half_len = len(s) // 2 if len(s) % 2 == 1: half_len += 1 new_s = s[half_len:len(s)] + s[0:half_len] print(new_s) def task02(): s = 'Hello user' arr = s.split() new_s = arr[1] + ' ' + arr[0] print(new_s) def task03(): s = 'Hello, fuckn\' us...
ppashk/university
fifth term/labsPy/lab07.py
lab07.py
py
2,128
python
en
code
0
github-code
1
70448869794
class OculusScript(Actor.Actor): def __init__(self): self.LeftHandContainer = Container(0) self.RightHandContainer = Container(0) self.CameraContainer = Container(0) self._MainCamera = Camera(0) self._CameraTransform = None self._LeftHandTransform = None se...
bazinga94/VR_Danuri
Assets/script/OculusScript.py
OculusScript.py
py
8,005
python
en
code
0
github-code
1
18419955399
"""Model for Slide game - keeps data in a double array, such that Model[x][y] refers to the value at (x,y) on the grid displayed to the user.""" import random import slideexceptions from Observable import Observable from GlobalConstants import * class Model: def __init__(self, num): """ Initi...
tiroffp/Slide
model0.py
model0.py
py
10,736
python
en
code
0
github-code
1
32796762532
import cv2 import numpy as np import sys if (len(sys.argv) > 1): filename = sys.argv[1] else: print('Pass a filename as first argument') sys.exit(0) img1 = cv2.imread(filename, cv2.IMREAD_COLOR) img2 = img1.copy() DEFAULT = img1.copy() DEFAULT2 = img2.copy() def get_points_img1(event, x, y...
mtsafur/vision-por-computadora
practicas-clase/clase-4/practica-2/practica_2.py
practica_2.py
py
2,879
python
en
code
0
github-code
1
25411012625
import logging import threading from devil.android import device_errors from devil.utils import reraiser_thread from devil.utils import watchdog_timer from pylib import constants from pylib.base import base_test_result from pylib.base import test_collection DEFAULT_TIMEOUT = 7 * 60 # seven minutes class _ThreadSa...
hanpfei/chromium-net
build/android/pylib/base/test_dispatcher.py
test_dispatcher.py
py
11,922
python
en
code
289
github-code
1
74262851234
from app.models import Product,db,SCHEMA,environment from sqlalchemy.sql import text from datetime import date from faker import Faker fake = Faker() def seed_products(): product1 = Product( name = 'Shirt', price = 30.00, description= 'Workout shirt', created_at=fake.date_between(start_date='-5y', end_d...
xuantien93/IronReligion
app/seeds/products.py
products.py
py
1,558
python
en
code
0
github-code
1
38572335275
from numpy import sign from functools import cmp_to_key INPUT_FILENAME ="input" TEST1_FILENAME ="test1.txt" TEST2_FILENAME ="test2.txt" PART = 1 DEBUG = False DIVIDER_PACKETS = [[[2]], [[6]]] def debug_print(s: str): if(DEBUG): print(s) def parse_pair(pair: str): left, right = pair.splitlines() ...
MPinna/AOC22
13/solve13.py
solve13.py
py
2,284
python
en
code
0
github-code
1
35889571199
from contextlib import closing import wolframalpha import boto3 import sys import os wolfram_app_id = "APPID-WOLFRAM" wolfram_client = wolframalpha.Client(wolfram_app_id) query = str(sys.argv[1]) print(":: Question: " + query + "\n") print("++ Getting Answer from WolframAlpha...\n") wolfram_response = wolfram_client....
panggi/question-answering-wolfram-polly
wolframsynth.py
wolframsynth.py
py
1,229
python
en
code
1
github-code
1
11637370478
from flask import Flask from . import provedores def create_app(): """Create Flask application.""" app = Flask( __name__, static_folder = "assets", instance_relative_config = False ) with app.app_context(): # ------------ # Provedores # ------...
brasil-em-numeros/brasil-em-numeros
dashboard/__init__.py
__init__.py
py
833
python
en
code
1
github-code
1
1601838586
import requests, re res = requests.get('http://langlang2017.com') html = res.text.encode('ISO-8859-1').decode(res.apparent_encoding) # print(html) pattern = re.compile('<li><img.*?src="img/(.*?)"', re.S) con = re.findall(pattern, html) print(con) for i in con[0]: ur = 'http://langlang2017.com/img/' + i r = re...
Lousm/Python
04_爬虫/week1/day03/07zhengze.py
07zhengze.py
py
391
python
en
code
0
github-code
1
33529844024
import numpy as np from sympy.physics.mechanics import ReferenceFrame,Point,Vector from sympy import symbols from matplotlib import pyplot as plt from mpl_toolkits import mplot3d from mpl_toolkits.mplot3d import proj3d from matplotlib.text import Text from stl import mesh from mpl_toolkits.mplot3d.art3d import Line3D,L...
JonathanCamargo/Dinamica_Mecanica_Material_Interactivo
tools/vis.py
vis.py
py
6,914
python
en
code
0
github-code
1
70343042914
def convert_to_int(): ''' continuesly take an input from user and convert it to int within a try-except block ''' while True: try: user_input = int(input("Enter a number: ")) except ValueError: print("Invalid input") continue print("The number ...
s2e-lab/SecurityEval
Testcases_Copilot/CWE-703/author_2.py
author_2.py
py
401
python
en
code
31
github-code
1
72540925474
# Test app main components. # python -m pytest tests/app/test_main.py import pytest from fastapi import status from fastapi.testclient import TestClient from app.main import app from app.models import models def test_index(): with TestClient(app) as client: response = client.get("/") assert resp...
igmalta/ml-classification-api
tests/app/test_main.py
test_main.py
py
2,543
python
en
code
0
github-code
1
10990304604
import torch from torch import nn from torch.autograd import Function import pywt from functools import partial def get_configs(model_name="wave_vit_s"): args = { "wave_vit_s": dict(stem_hidden_dim=32, embed_dims=[64, 128, 320, 448], num_heads=[2, 4, 10, 14], mlp_ratios=[8, 8,...
towhee-io/towhee
towhee/models/wave_vit/wave_vit_utils.py
wave_vit_utils.py
py
5,531
python
en
code
2,843
github-code
1
36239962708
from services.serve import db from datetime import datetime from typing import List, Tuple from sqlalchemy import func, desc class Visit(db.Model): __tablename__ = 'visits' id = db.Column(db.Integer,primary_key=True) ip = db.Column(db.String(20),nullable=False) visitable_id = db.Column(db.Integer,null...
mentimun-mentah/zooka-watersports
restapi/services/models/VisitModel.py
VisitModel.py
py
1,765
python
en
code
2
github-code
1
41021367685
import subprocess from subprocess import PIPE,Popen # p=subprocess.call(["ls", "-l"]) pswrd = "Akashbajpai$1226" p = Popen(['echo', pswrd], stdout=PIPE) p1 = Popen(["sudo", "-S","ls", "-la"], stdin=p.stdout, stdout=PIPE) # p1.stdin.write(b'Akashbajpai$1226\n') stdout= p1.communicate()[0] print(stdout.decode()) print(p...
akbajpaiRH/PracticeProgress
Subprocess/sub_call.py
sub_call.py
py
333
python
en
code
0
github-code
1
74768388192
import os import time import constants PHOTO = "foto" LAMP = "lamp" MOVEMENT = "movimiento" VIDEO = "video" ALARM = "alarma" REBOOT = "reiniciar" SHUTDOWN = "apagar" MOVEMENT = "movimiento" # NOTE: is this the best solution? def _exiting_commands(bro, sender, reason): """ The way to proced a shutting down or reb...
delhoyo31415/FourthBrother
handlers.py
handlers.py
py
5,036
python
en
code
0
github-code
1
40377723310
import re import requests from tasks.m3u.record import M3uItemType, M3URecord class M3UDeserializer( object ): __RE_ITEM = re.compile( r"(?:^|\n)#EXTINF:((?:-)\d+(\.\d+)?)([^,]+)?,([A-Z].*?)[\r\n]+(.*)" ) __RE_ATTRIBUTE = re.compile( r"(\w*-\w*)=([\"'].*?[\"'])" ) __RE_SERIE = re.compil...
pe2mbs/iptv-server
tasks/m3u/reader.py
reader.py
py
1,832
python
en
code
0
github-code
1
33370297522
#!/usr/bin/env python # coding: utf-8 import numpy as np import pickle import sys import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) from robo.fmin import bayesian_optimization # Global Configuration try: CFG = sys.argv[1] CFG = CFG.replace(".py", "") SEED = int(sys....
zehsilva/prior-predictive-specification
bo_optimization/bo_run.py
bo_run.py
py
833
python
en
code
2
github-code
1
18607397296
# -*- coding: utf-8 -*- """ @Datetime: 2019/3/4 @Author: Zhang Yafei """ from django.urls import path, re_path from organization.views import OrgView, AddUserAskView, OrgHomeView, OrgCoueseView, OrgTeacherView, OrgDescView from organization.views import AddFavView, TeacherListView, TeacherDetailView app_name = 'org'...
zhangyafeii/mxonline
apps/organization/urls.py
urls.py
py
1,124
python
en
code
0
github-code
1
33475013754
bl_info = { "name": "HECL", "author": "Jack Andersen <jackoalan@gmail.com>", "version": (1, 0), "blender": (2, 80, 0), "tracker_url": "https://github.com/AxioDL/hecl/issues/new", "location": "Properties > Scene > HECL", "description": "Enables blender to gather meshes, materials, and texture...
AxioDL/hecl
blender/hecl/__init__.py
__init__.py
py
11,246
python
en
code
15
github-code
1
15684526765
from aiogram import Bot, Dispatcher, types, executor import requests import json btn = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2) btn.add("USD-UZS", "RUB-UZS", "EURO-UZS", "CNY-UZS", "WON-UZS", "DINOR-UZS") token = "Bot_token" bot = Bot(token=token) dp = Dispatcher(bot) @dp.message_han...
Sardor746/Valutchik
Valyuta/Valyuta.py
Valyuta.py
py
2,272
python
en
code
0
github-code
1
10914492253
class Solutions: def tandemBicycle(self,redShirtSpeeds, blueShirtSpeeds, fastest): redShirtSpeeds.sort() blueShirtSpeeds.sort() sum = 0 if fastest == True: for idx in range(len(redShirtSpeeds)): sum += max(redShirtSpeeds[idx],blueShirtSpeeds[len(blueShirtS...
kitbitsks/alg_sol
tandemBicycle.py
tandemBicycle.py
py
566
python
en
code
0
github-code
1
18653186375
from django.conf.urls import url from django.urls import path from .views import (TicketAPIView, TicketAPIDetailView, ProjectTicketAPIDetailView, TicketReadAPIView, OrderTicketAPIDetailView, VisitAPIView, VisitAPIDetailView, TicketVisitAPIDetailView) app_name = "api-tickets" # app_name will help...
KUSH23/bkend
tickets/api/urls.py
urls.py
py
998
python
en
code
1
github-code
1
30640759983
import discord from discord.ext import commands class MyClient(discord.Client): async def on_ready(self): print('Logged on as {0}!'.format(self.user)) async def on_message(self, message): print('Message from {0.author}: {0.content}'.format(message)) if message.content.startswith('\u2...
Ban-Ironic-Ohms/discordbot
micah_s_marvelous.py
micah_s_marvelous.py
py
1,628
python
en
code
0
github-code
1
11396360104
import string import re alpha = string.ascii_lowercase string = 'Python has a string format operator %%. This functions analogously to printf format strings in C, e.g. "spam=%%s eggs=%%d" %% ("blah", 2) evaluates to "spam=blah eggs=2"' string1 = string.lower() list_of_symbols = ['(', '#', '$', '%', '&', "'", '(', ')...
nick-github-sa/python50days
python45/python1.py
python1.py
py
1,025
python
en
code
0
github-code
1
32422131788
from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from time import sleep # 模拟鼠标操作-鼠标拖动-滑动验证码 driver = webdriver.Chrome() driver.get("https://reg.taobao.com/member/reg/fill_mobile.htm") driver.maximize_window() sleep(3) # 点击确定按钮 element1 = driver.fin...
chinashenqiuwuyanzu/wuyanzu
python1/taobao.py
taobao.py
py
1,227
python
en
code
0
github-code
1
42589540928
# -*- coding: utf-8 -*- """ Created on Wed Sep 6 19:59:37 2017 @author: saber_master """ import requests from bs4 import BeautifulSoup import bs4 UA = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36' headers = {'User-Agent':UA} # 获取url...
saberly/qiyuezaixian
spider/bilibili/beautifulsoup.py
beautifulsoup.py
py
1,546
python
en
code
0
github-code
1
34898742152
STANDARD_CHARACTER_RACES = ['human', 'dwarf', 'half orc', 'gnome', 'halfling', 'high elf'] # the standard elf is technically a moon elf. ELVEN_RACES = ['moon elf', 'sun elf', 'night elf', 'wood elf', 'blood elf'] NONSTANDARD_CHARACTER_RACES = ['dragonborn', 'tiefling', 'tabaxi'] EVIL_CHARACTER_RACES = ['drow', 'orc...
JosephDaniels/Dnd-3.5-Rolepy
race.py
race.py
py
3,798
python
en
code
0
github-code
1
27592126496
import sys from collections import deque input = sys.stdin.readline n, m = map(int, input().split()) arr = [list(map(int, input().split())) for x in range(m)] f1, f2 = map(int, input().split()) def limit_weight(f1, f2): graph = [[] for x in range(n + 1)] for v1, v2, w in arr: graph[v1].append((v2, w...
ChoHon/Algorithm
week 03/Test/1939_2.py
1939_2.py
py
1,103
python
en
code
0
github-code
1
22092391820
tentaS = 0 tentaB = 0 tentaA = 0 acertoS = 0 acertoB = 0 acertoA = 0 for i in range(int(input())): nome = input() TS, TB, TA = list(map(int, input().split())) AS, AB, AA = list(map(int, input().split())) tentaS += TS tentaB += TB tentaA += TA acertoS += AS acertoB += AB acertoA += A...
JoaoAssalim/Beecrowd-Solution
Python/2310.py
2310.py
py
558
python
pt
code
5
github-code
1
29543562609
# sensor gains (weights) self.sensor_gains = [ 1.0+( (0.4*abs(p.theta)) / pi ) for p in supervisor.proximity_sensor_placements() ] ... # return an obstacle avoidance vector in the robot's reference frame # also returns vectors to detected obstacles in the robot's referen...
Kio07/Sewage-cleaning-robot-madurAI-HCL-hackathon
cross obstacle.py
cross obstacle.py
py
1,577
python
en
code
0
github-code
1
11225620250
import os, sys # DIR PATH: D:\Environments\practices of the python pro\Bark app\presentation dir_path = os.path.dirname(os.path.realpath(__file__)) # PARENT DIR PATH: D:\Environments\practices of the python pro\Bark app parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir)) sys.path.insert(0, parent_d...
Zoki92/Practices-of-python-pro
Bark app/presentation/__main__.py
__main__.py
py
3,957
python
en
code
0
github-code
1
11677435519
def calculate(people): tracks={"max":0, "count":0} time=0 max=0 while people or tracks["count"]: if time in people: for person in people[time]: finish_time=person[0]+person[1] if finish_time not in tracks: ...
m7mdony/GPC-FTW
2016/bridges/main.py
main.py
py
1,899
python
en
code
0
github-code
1
12837436067
from datetime import datetime, timedelta from django.db import models from django.db.models import Q from django.contrib.postgres.fields import JSONField from simple_history.models import HistoricalRecords from web.sns import notify_productcategory_change from web.managers import ArticleManager from web.gs1_code_lists ...
hackcasa/zappa_final
web/models.py
models.py
py
22,739
python
en
code
1
github-code
1
6159276942
n = int(input()) st = [] ans = 0 its = True sam = False ls = list(map(int,input().split())) st.append(ls[0]) for i in range(1, n - 1): if not its: st.append(buf) its = True st.append(ls[i]) #print(n - 1, '%', i, '=', (n - 1) % i, 'df') #print(ls[0], ls[i]) if ls[0] == ls[...
Markit125/acmp
17.py
17.py
py
888
python
en
code
0
github-code
1
2594957093
#coding=utf-8 # import json2lua_base_lib import my_libs.json2lua_base_lib as json2lua_base_lib input_file_name = "test.json" ## json 文件名 output_file_name = "result_test.lua" ## 输出文件名 def json_file_2_lua_file(input_file_name,output_file_name): json2lua_base_lib.file_to_lua_file(input_file_name,output_file_na...
UnderDarkNight/DST_MOD_Forward_In_Predicament
_program_tools/excel2lua/my_libs/start_json2lua.py
start_json2lua.py
py
939
python
en
code
0
github-code
1
74913147553
import requests import os import sys import json import argparse import shlex import urllib.parse import xml.etree.ElementTree as ET import configparser from typing import List, Any, Union, Dict, Tuple, Optional import readline class apimodule: """ Arguments modulename: The name of the module ...
thka2315/gapicli
gapicli.py
gapicli.py
py
14,177
python
en
code
0
github-code
1
25431989159
import sys input = sys.stdin.readline n = int(input()) nums = sorted(list(map(int,input().split()))) #res = int(1e9)*3 res = [] ans = int(1e9)*3 for i in range(n-2): l,r = i+1, n-1 while l<r: s = nums[i]+nums[l]+nums[r] if abs(s)<ans: res = [nums[i],nums[l],nums[r]]...
reddevilmidzy/baekjoonsolve
백준/Gold/2473. 세 용액/세 용액.py
세 용액.py
py
510
python
en
code
3
github-code
1
39452056561
import random import subprocess class CowLecturer: cows = [ "bong","default","dragon","elephant","eyes","kitty","moose","small", "stegosaurus","three-eyes","turkey","turtle","udder","www" ] msgs = [ "KID!!! Don't you know `sudo` will blow the earth?", "Man! holy `sudo` is ...
yunchih/sudo-lecturer
lecturer/lecture.py
lecture.py
py
1,534
python
en
code
1
github-code
1
21617622868
from bs4 import BeautifulSoup from jinja2 import Environment, FileSystemLoader with open('pending_follow_requests.html', 'r') as f: html = f.read() soup = BeautifulSoup(html, 'html.parser') users = [] for element in soup.find_all('div', {'class': 'pam _3-95 _2ph- _a6-g uiBoxWhite noborder'}): user = {} ...
yassindaboussi/Pending-follow-requests
FromHtml/ExtractAndRender.py
ExtractAndRender.py
py
952
python
en
code
1
github-code
1
70647530913
#!/usr/bin/env python3 #https://github.com/syakoo/galois-field #pip install git+https://github.com/syakoo/galois-field import argparse, sys, os.path, math from galois_field import GFpn from lib.wg_gf_lib import SimuGF from galois_field.core import validator #---------------------------- def show_examples(): scr...
guenterjantzen/workshop-groups
wg_gf.py
wg_gf.py
py
9,532
python
en
code
0
github-code
1
30659121754
import re pattern = re.compile(r'\<.+?\>', re.DOTALL) def cleanJson(jsonStr): return re.sub(pattern, '', jsonStr) def hashtagPreprocss(text, hashtags): hashtag = '' for item in hashtags: try: hashtag += item['text'] except KeyError: continue text += hashtag return text.lower()
jinshengwang92/USA2012GeneralElectionBasedOnTwitterData
helper.py
helper.py
py
294
python
en
code
0
github-code
1
27636250485
#https://code-maven.com/range-vs-xrange-in-python import sys r = range(10000) print(sys.getsizeof(r)) # 80072 x = xrange(10000) print(sys.getsizeof(x)) # 40 """ The variable holding the range created by range uses 80072 bytes while the variable created by xrange only uses 40 bytes. The reason is that range create...
anubeig/python-material
MyTraining_latest/MyTraining/04.diffrences/range_vs_xrange.py
range_vs_xrange.py
py
1,186
python
en
code
0
github-code
1
35510313483
#!/usr/bin/env python import os from os.path import join, dirname THIS_DIR = dirname(__file__) def install_from_file(command, filename, version_separator): """ Install requirement from a file with the given command. The files use the standard version separator '==' which will get replaced with what...
pretenders/deploystream
scripts/get_dependencies.py
get_dependencies.py
py
843
python
en
code
5
github-code
1
5099702172
import json from flask import Blueprint, request from werkzeug.datastructures import ImmutableMultiDict from api import http_status from api.errors import ApiException, ValidationException from api.forms.module_set_config import ModuleSetConfigForm from api.forms.module_set_value import ModuleSetValueForm from core.mod...
brewmajsters/brewmaster-backend
api/routes.py
routes.py
py
8,055
python
en
code
1
github-code
1
12212610838
"""Defines base classes""" import abc from collections import namedtuple from typing import Dict, List, Optional, Type, Union from convtools.base import BaseConversion _none = BaseConversion._none class BaseStep: STEP_TYPE = "base_step" ensures_type: Optional[Type] = None TypeValueCodeGenArgs = namedtupl...
simrit1/convtools
src/convtools/contrib/models/base.py
base.py
py
4,078
python
en
code
null
github-code
1
74708557793
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : 2016-12-05 10:27:37 # @Author : Arms (526923945@qq.com) # @Link : https://armszhou.github.io # @Version : $Id$ from xlrd import open_workbook import re import os workbook_name = '钱端(定制版)接口汇总.xlsx' result_file_name = 'IID_Data' result_file_path = '/'.join...
ArmsZhou/Python3-Practice
实战/read_data_from_excel.py
read_data_from_excel.py
py
856
python
en
code
0
github-code
1
14368524880
import numpy as np def sub(m1,m2): c = m1 - m2 print("Trừ: ") print(c) def add(m1,m2): c = m1 + m2 print("Cộng: ") print(c) def mult(ma,mb): sa = ma.shape sb = mb.shape if sa[1] == sb[0]: c = ma @ mb else: print("Kích thước không phù hợp") c = np.float16(c) ...
longvubach/B-i-6
hammatran.py
hammatran.py
py
865
python
vi
code
2
github-code
1
38117905328
# 用户输入以及while 循环 # name =input("小伙子请输入你的名字") # print("我获取到了你的名字:",name) # 提示字段过长,就封装到一个变量中 prompt = "If you tell us who you are, we can personalize the messages you see." prompt += "\nWhat is your first name? " # name = input(prompt) # print(name) # 获取数字类型 # age=input("年轻人你的年纪是多少?") # age=int(age) # print(age) # hei...
mochengyanyu/Python-spider-demo
05.py
05.py
py
3,053
python
en
code
0
github-code
1
33198834237
import datetime import datetime from django.core.paginator import Paginator from django.db.models import Q from django.utils import timezone from django.http import JsonResponse from django.shortcuts import render, redirect from django.urls import reverse_lazy from .models import Message from .forms import MessageForm...
Sampleeeees/MyHouse24
Messages/views.py
views.py
py
4,814
python
en
code
0
github-code
1
12157928524
import torch.nn as nn from torch.nn import functional as F class Encoder(nn.Module): """ (3, 64, 64)の画像を(1024,)のベクトルに変換するエンコーダ """ def __init__(self): super(Encoder, self).__init__() self.cv1 = nn.Conv2d(3, 32, kernel_size=4, stride=2) self.cv2 = nn.Conv2d(32, 64, kernel_size=...
chika-sawa/WorldModels
src/model/encoder.py
encoder.py
py
754
python
en
code
0
github-code
1
23165249908
# -*- coding: utf-8 -*- # ============================================================================= # Author : Ahmadreza Farmahini Farahani # Created Date : 2023/4 # Project : This project is developed for "Machine Learning and Pattern Recognition" course # Supervisor : Prof. Sandro Cumani # =====...
ahmadrezafrh/Gender-Identification-MLPR
postprocess.py
postprocess.py
py
4,786
python
en
code
0
github-code
1
32054174669
from openerp.osv import fields, osv import tools class sales_order(osv.Model): _inherit = "sale.order" def _prepare_invoice(self, cr, uid, order, lines, context=None): res = super(sales_order, self)._prepare_invoice(cr, uid, order, fields, context=context) #res['comment'] += 'Teste123' return res sales...
rpenido/openerp-cust-simples
sale.py
sale.py
py
329
python
en
code
0
github-code
1
4689579478
from exercicio1 import leiaInt pessoa = {} cadastrados = [] soma = media = 0 while True: pessoa.clear() pessoa[' nome '] = str(input("Digite um nome: ")) while True: pessoa[' sexo '] = str(input("Digite o sexo: [M/F]")).upper()[0] if pessoa[' sexo '] in 'MF': break prin...
fagneroliveira558/projects_python_pro_gitHub
projects_pessoais/aulasDePython/projeto_tratamento_de_erros/conjunto_lista_e_dicionario.py
conjunto_lista_e_dicionario.py
py
1,494
python
pt
code
0
github-code
1
28905968047
"""Add hospitalizedDischarged column Revision ID: 58ea38a64c64 Revises: bc309f70af25 Create Date: 2021-01-12 15:41:17.174849 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '58ea38a64c64' down_revision = 'bc309f70af25' branch_labels = None depends_on = None d...
COVID19Tracking/covid-publishing-api
migrations/versions/58ea38a64c64_add_hospitalizeddischarged_column.py
58ea38a64c64_add_hospitalizeddischarged_column.py
py
708
python
en
code
9
github-code
1
70520052195
import json from django.shortcuts import render, redirect from .forms import * from .models import * from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from djang...
Badr-Mohammed9/shopuProject
shop/views.py
views.py
py
3,527
python
en
code
0
github-code
1
27393257484
#!/usr/bin/env python from tasks import * from utils.functions import get_folder from pathlib import Path import config # Run all tasks here, can also comment out those not wanted def main(): # Create output.csv in output folder using files in data (starting with ASO) create_output() # get correct e...
tyulab/ixCells
run.py
run.py
py
1,309
python
en
code
0
github-code
1
72449217314
#!/usr/bin/python3 """Gets user, their tasks done, undone and total and prints the done tasks""" from requests import get from sys import argv if __name__ == '__main__': url1 = get('https://jsonplaceholder.typicode.com/todos?userId=' + argv[1]) url2 = get('https://jsonplaceholder.typicode.com/users/' + argv[1...
AyshaMuss/holberton-system_engineering-devops
0x15-api/0-gather_data_from_an_API.py
0-gather_data_from_an_API.py
py
725
python
en
code
0
github-code
1
72744196835
from django.urls import path from . import views urlpatterns = [ path("", views.index, name='firstpage'), path("posts", views.posts, name='posts'), path("posts/<slug>", views.posts_detail, name='info'), #slug - posts/myfirstpost ]
StrixPO/Django_blog_skeleton
my_site/blog/urls.py
urls.py
py
246
python
en
code
0
github-code
1
45737922134
from turtle import Screen from paddle import Paddle from ball import Ball from scoreboard import Scoreboard import time # Create the game window screen = Screen() screen.bgcolor('black') screen.setup(800, 600) screen.title('My Pong Game') screen.tracer(0) # Create the right paddle and left paddle r_paddle = Paddle(35...
LJW92/PythonProjects
GUI Projects/PongGame/main.py
main.py
py
1,570
python
en
code
0
github-code
1
10681643242
import torch import torch.nn as nn import torch.nn.functional as F class SRCNN(nn.Module): def __init__(self, c, n1, n2, n3, f1, f2, f3): super(SRCNN, self).__init__() # patch extraction self.F1 = nn.Conv2d( in_channels=c, out_channels=n1, kernel_size=f1, stride=1, padding=...
thepooons/SRCNN
src/models.py
models.py
py
833
python
en
code
2
github-code
1
19578363552
import os import shutil import subprocess import tempfile from functools import wraps import click from PIL import ImageOps from tqdm import tqdm from .outliner import outliner def xml_wrap(tag, inner, **kwargs): kw = ' '.join('%s="%s"' % (k, str(v)) for k,v in kwargs.items()) if inner is None: r...
ali1234/bitmap2ttf
bitmap2ttf/convert.py
convert.py
py
3,625
python
en
code
95
github-code
1
17358841868
import yaml from pprint import pprint from netmiko import ConnectHandler file = "/home/mwhite/.netmiko.yml" with open(file) as f: yaml_out = yaml.load(f) device = yaml_out["cisco3"] with ConnectHandler(**device) as connected: output = connected.find_prompt() print(output)
mickdcsw/PyPlus
class3/class3_task5.py
class3_task5.py
py
287
python
en
code
0
github-code
1
70706181794
import paho.mqtt.client as mqtt import time import grovepi import grove_rgb_lcd from grove_rgb_lcd import * import statistics buzzer = 3 button = 4 grovepi.pinMode(button,"INPUT") tones = { "B0": 31, "B1": 62, "C2": 65, "CS2": 69, "D2": 73, "DS2": 78, "E2": 82, "F2": 87, "FS2": 93, "G2": 98, "GS2": 104, "A2": 110, "AS...
usc-ee250-spring2021/lab05-the-duo
ee250/lab05/tuner_rpi_sub.py
tuner_rpi_sub.py
py
2,412
python
en
code
0
github-code
1
73176238435
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="pexen", version="0.0.3", author="Jiri Jaburek", author_email="comps@nomail.dom", description="Python EXecution ENvironment, scheduler included", long_description=long_description, ...
comps/pexen
setup.py
setup.py
py
792
python
en
code
1
github-code
1
11496524767
import praw from praw.models import MoreComments import datetime sarcComments = [] def readReplies(comment, regFile, sarcFile): replies = comment.replies for reply in replies: if isinstance(reply, MoreComments): continue body = reply.body.lower() tokens = body.split(". ") ...
chrisw2529/Natural-Language-Processing
finalProj/collectData.py
collectData.py
py
3,077
python
en
code
0
github-code
1
746501982
# Flask-TurnKey Version 0.0.1 # App.py # Flask from flask import Flask # Flask-TurboDuck from flask_turboduck.db import Database app = Flask(__name__) app.config.from_object('config.Configuration') db = Database(app) def create_tables(): User.create_table()
DommertTech/flask-turnkey
flask_turnkey/app.py
app.py
py
266
python
en
code
1
github-code
1
28666281069
from urllib.request import urlopen from bs4 import BeautifulSoup # 텍스트 읽기 - 영어 url = 'https://www.pythonscraping.com/pages/warandpeace/chapter1.txt' textPage = urlopen(url) print(textPage.read()[:1000]) print('='*100) # 러시아어+프랑스어 url = 'https://www.pythonscraping.com/pages/warandpeace/chapter1-ru.txt' textPage = ur...
japark/PythonWebScraper
ReadFiles/read_txt.py
read_txt.py
py
807
python
en
code
0
github-code
1