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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
27410425777 | from io import UnsupportedOperation
import numpy as np
import unittest
class IntegerEncoder:
"""Encoder of integer values into a set of other encoding formats. (Binary and grey-decoded) are only supported now.
"""
def __init__(self) -> None:
return
def __binary_encoder(self, value... | skycoin/kcg-tiletool | int-encoder/IntegerEncoder.py | IntegerEncoder.py | py | 3,890 | python | en | code | 0 | github-code | 36 |
21439179828 | import scrapy
class QuotesSpider(scrapy.Spider):
name = "reviews"
start_urls = [
'https://domicilios.com/restaurantes/bogota/ppc-suba-menu?t=comentarios',
]
def parse(self, response):
for review in response.css("#reviewList > li"):
yield {
'text': review.cs... | VolodyaCO/e-Marketing_Konrad2019 | spider.py | spider.py | py | 1,152 | python | es | code | 1 | github-code | 36 |
10084552731 | import sys
input = sys.stdin.readline
import heapq
V, E = map(int, input().split())
nodes = [[] for _ in range(V)]
visited = [0] * V
for i in range(E):
a, b, c = map(int, input().split())
a -= 1
b -= 1
nodes[a].append((c, b))
nodes[b].append((c, a))
heap = []
heapq.heappush(heap, (0, 0))
sum_w =... | papillonthor/Cool_Hot_ALGO | twKim/최소 스패닝 트리.py | 최소 스패닝 트리.py | py | 577 | python | en | code | 2 | github-code | 36 |
36936928879 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Works with python2.6
import os
import sys
import math
import json
from subprocess import Popen, PIPE
from operator im... | mongodb/mongo | src/third_party/mozjs/extract/js/src/devtools/gc/gc-test.py | gc-test.py | py | 5,569 | python | en | code | 24,670 | github-code | 36 |
33930837671 | from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from bot_keyboards import (first_start_keyboard, menu_keyboard)
TOKEN = '5669721003:AAHm1uNSZyJXRw43GZH84cvwTXsmjD833zY'
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start','he... | MarietaKsenia/olxBot | repeat.py | repeat.py | py | 1,997 | python | uk | code | 0 | github-code | 36 |
74224409063 |
import datetime
import logging
import re
from math import ceil
import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
import seaborn as sns
import skimage.io as io
from numpy.linalg import LinAlgError
from skimage import img_as_float
from skimage.color import rgb2lab
from skimage.exposure im... | AntoineRouland/ki67 | src/v7_validation/run_v7.py | run_v7.py | py | 9,829 | python | en | code | 1 | github-code | 36 |
32992901988 | # class Binary(Expr): #op:string;left:Expr;right:Expr
# class Id(Expr): #value:string
# class IntLiteral(Expr): #value:int
# class BooleanLiteral(Expr): #value:boolean
from functools import reduce
class ASTGeneration(MPVisitor):
# program: exp EOF;
def visitProgram(self,ctx:MPParser.ProgramContext):
... | lykienminh/ppl-antlr | Chap03ASTGeneration/Q6.py | Q6.py | py | 1,943 | python | en | code | 0 | github-code | 36 |
40761159307 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: in... | QingbiaoLi/LeetCodeFighter | BinarySearch/230_KthSmallestElementInBST.py | 230_KthSmallestElementInBST.py | py | 2,218 | python | en | code | 0 | github-code | 36 |
10702184707 | # Import the dependencies.
import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
engine = create_engine("sqlite:///Resources/hawaii.sqli... | isabelleroet/sqlalchemy-challenge | app.py | app.py | py | 4,486 | python | en | code | 0 | github-code | 36 |
23472198434 | import pygame
from bullet import Bullet
from settings import *
life = 100
class Player(pygame.sprite.Sprite):
def __init__(self, pos):
global life
super().__init__()
'''
# size of player
self.image = pygame.Surface((32, 64))
# color of player
self.image.fi... | emilia-jura/summativeunit3 | player.py | player.py | py | 4,459 | python | en | code | 0 | github-code | 36 |
13656652058 | #!/usr/bin/python2.7 -tt
import constants
import indiv_lang_feature_extractor
import source_classifier
from myutils import myfile
import csv
import sys
import traceback
def style_rater(MODE,path,source_str,lang_exts,OUTPUT_FEATURES_TO_CSV_FN,CSV_DELIMITER,LIMIT_TO_NUM_FILES):
ret = 0
if MODE == constants.MO... | rabeal/procode | app/sourcestyle/sourcestyler.py | sourcestyler.py | py | 3,030 | python | en | code | 1 | github-code | 36 |
38495991100 | import imp
import os.path
from collections import namedtuple
ConfigValue = namedtuple('ConfigValue', ('name', 'description'))
class NotPresentType(object):
def __repr__(self):
return "NotPresent"
NotPresent = NotPresentType()
BASE_CONFIG = (
ConfigValue('token', 'github auth token'),
ConfigValue(... | mwhooker/gh | gh/ghconfig.py | ghconfig.py | py | 1,871 | python | en | code | 0 | github-code | 36 |
24339594409 | import scrapy
class GoStdlibSpider(scrapy.Spider):
"""Spider for scraping the Go standard libraries."""
name = "go-stdlib-spider"
def start_requests(self):
"""Start making requests."""
for url, kind in [
("https://godoc.org/-/go", "core"),
("https://godoc.org/-/su... | src-d/ml-mining | sourced/ml/mining/spiders/go_stdlib.py | go_stdlib.py | py | 861 | python | en | code | 8 | github-code | 36 |
20136544568 | import torch
import torch.nn as nn
import torch.nn.functional as F
from src.utils import config
from .Vis_Module import Vis_Module
class DeepFakeTSModel(nn.Module):
def __init__(self, mm_module_properties,
modalities,
window_size, window_stride,
modality_embeddi... | mmiakashs/Multimodal-Deepfakes-Detection | src/network/DeepFakeTSModel.py | DeepFakeTSModel.py | py | 10,428 | python | en | code | 0 | github-code | 36 |
71914015143 | from keras import layers, models, optimizers
MAXLEN = 128
CHARS = 1000
HIDDEN_DIM = 128
def make_encoder() -> models.Sequential:
model = models.Sequential(name='encoder')
model.add(layers.TimeDistributed(layers.Dense(HIDDEN_DIM), input_shape=(MAXLEN, CHARS)))
model.add(layers.LSTM(HIDDEN_DIM, return_sequ... | cympfh/twitter-dialogue-bot | bot/model.py | model.py | py | 1,131 | python | en | code | 0 | github-code | 36 |
41797863785 | from flask import render_template, url_for, request, flash, redirect, abort, send_from_directory
from flask_login import current_user
from werkzeug import exceptions
from datetime import datetime
from ics import Calendar as icsCalendar, Event as icsEvent
import os
from threading import Thread
import json
# ----------... | footflaps/ELSR-Website | core/routes_socials.py | routes_socials.py | py | 21,479 | python | en | code | 3 | github-code | 36 |
808076967 | l1 = []
l2 = []
for i in range(100):
x = int(input())
if x > 50 or x < -50:
l1.append(x)
else:
l2.append(x)
if len(l1) != 0:
for i in range(len(l1)):
print(l1[i], end = "")
print("")
else:
print("VUOTO1")
if len(l2) != 0:
media = sum(l2) / len(l2)... | itsmexp/UNICAL-FondamentiDiProgrammazione-1 | Programmi/N38.py | N38.py | py | 417 | python | en | code | 1 | github-code | 36 |
2464654134 | import csv
file = 'c:/Temp/Hospital_Inpatient_Discharges__SPARCS_De-Identified___2015.csv'
with open(file,'r') as cf:
rdr = csv.reader(cf, delimiter=',')
fo = open('c:/temp/tdata.txt','w')
for i, row in enumerate(rdr):
if not i:
head = row.copy()
else:
... | SPotekhin/wadetc | ppp.py | ppp.py | py | 504 | python | en | code | 0 | github-code | 36 |
11682439465 | from tkinter import *
from tkinter import ttk
from tkinter import font
import random
from BubbleSort import bubble_sort
from SelectionSort import select_sort
from MergeSort import merge_sort
from QuickSort import quick_sort
root = Tk()
root.title('Sorting Algorithms Visualizer')
#variables
HEIGHT = 700... | Isha1013/SortingAlgorithmsVisualizer | SortingAlg1.py | SortingAlg1.py | py | 4,093 | python | en | code | 0 | github-code | 36 |
556015803 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from pymongo import MongoClient
class JobparserPipeline(object):
def __init__(self):
client = MongoClient('local... | GruXsqK/Methods_scraping | Lesson_5/jobparser/pipelines.py | pipelines.py | py | 2,967 | python | en | code | 0 | github-code | 36 |
8413026987 | from flask import Flask, render_template
from flask_restful import Api
from resources.hotel import Hotels, Hotel
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
api = Api(app)
@app.before_first_request
def create_db():
db.create_... | mariorodeghiero/flask-python-rest-api-course | app.py | app.py | py | 590 | python | en | code | 0 | github-code | 36 |
73323091304 | from django.shortcuts import render
from Process.models import *
from django.contrib.auth.decorators import login_required
from django.contrib.auth import get_user_model,login,logout,authenticate
from django.http import HttpResponse
from django.shortcuts import redirect
from datetime import datetime
from django.... | ZidbeRR/Projekat-Grupa-2 | projekat/eIzbori/Process/views.py | views.py | py | 24,794 | python | en | code | 0 | github-code | 36 |
21503702095 | # -*- coding: utf-8 -*-
import os
import telebot
import time
import random
import threading
from emoji import emojize
from telebot import types
from pymongo import MongoClient
import game_classes
import lobbys
import cards
from tools import medit
import traceback
games=lobbys.games
from game_classes import codetoclass... | egor5q/Unknown-table-game- | bot.py | bot.py | py | 8,507 | python | ru | code | 0 | github-code | 36 |
28985068391 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import math
def openFile(filename):
with open(filename, "r") as file:
data = file.read()
return data
def parseInput(tileString):
processedTiles = []
tiles = tileString.split("\n\n")
#The first line should have the tile numb... | SocialFinanceDigitalLabs/AdventOfCode | solutions/2020/pughmds/day20/day20.py | day20.py | py | 15,196 | python | en | code | 2 | github-code | 36 |
23442328609 | import numpy.random as Random
import numpy as np
import pandas as pd
def rank_swapping(df, p, columns):
# sort in ascending
df_ = df
df_.sort_values(by=columns)
print("RankSwapping with p = " + str(p))
if p == 0:
print("Not Swapping :)")
return df_
for j in range(0, len... | sharwinbobde/cyber-data-analytics | Part-1/rank_swapping.py | rank_swapping.py | py | 1,114 | python | en | code | 0 | github-code | 36 |
38221108073 | from itertools import product
def solution(word):
dic = ['A', 'E', 'I', 'O', 'U']
data = []
for i in range(1,6):
data += list(map(''.join, product(dic, repeat=i)))
data.sort()
idx = data.index(word)
return idx + 1 | kh-min7/Programmers | 84512(모음사전).py | 84512(모음사전).py | py | 245 | python | en | code | 0 | github-code | 36 |
11577860341 | # 11651
dots = []
N = int(input())
for _ in range(N):
x, y = map(int, input().split(" "))
dots.append((x, y))
result = sorted(dots, key=lambda x: (x[1], x[0]))
for i in result:
print(i[0], i[1]) | starcat37/Algorithm | BOJ/Silver/11651.py | 11651.py | py | 209 | python | en | code | 0 | github-code | 36 |
1415008124 | from ninja import Router, Query
from ninja.pagination import paginate
import logging
from django.http import Http404
from datetime import datetime
from typing import List
from reservation_system.schemas.room import (
RoomSchema,
CreateRoomSchema,
PatchRoomSchema,
PutRoomSchema,
)
from reservation_syste... | kamranabdicse/Django-Pydantic-TTD | reservation_system/api/api_v1/controllers/room.py | room.py | py | 2,222 | python | en | code | 4 | github-code | 36 |
31277039754 | # Use filter to filter out countries starting with an 'E'
countries = ['Estonia', 'Finland', 'Sweden', 'Denmark', 'Norway', 'Iceland']
def filter_by_char(str):
if((len(str)>0) and (str.startswith('E'))) :
return True
return False
# We have to use lambda function sience we want to pass arguments to fi... | rameshovyas/30-Days-of-Python-Exercises | Day_14_Higher_Order_Functions/Level2/ex7.py | ex7.py | py | 421 | python | en | code | 2 | github-code | 36 |
74646035624 |
from enum import Enum,unique
# import function
'''
# x,y = function.login('zhangsan',13)
def fun (a,b,y):
x,y = y(a,b)
print('姓名:',x,'年龄:',y)
# 函数名作为函数参数
fun('zhangsan',12345,function.login)
class student(object):
# _slots_限制动态添加函数时函数的参数
# __slots__ = ('pass')
def __init__(self,name,age):
... | iospeng/python | pycharm_demo/demo/python/demo1/use.py | use.py | py | 2,617 | python | en | code | 0 | github-code | 36 |
37751767465 | r"""Inference components such as estimators, training losses and MCMC samplers."""
import torch
import torch.nn as nn
import torch.nn.functional as F
from itertools import islice
from torch import Tensor, BoolTensor, Size
from typing import *
from .distributions import Distribution, DiagNormal, AffineTransform
from ... | ADelau/lampe | lampe/inference.py | inference.py | py | 20,743 | python | en | code | null | github-code | 36 |
9730077980 | # buildiOS.py
import os
import subprocess
import errno
import shutil
from progSpec import cdlog, cdErr
def writeFile(path, fileName, fileSpecs, fileExtension):
#print path
makeDir(path)
fileName += fileExtension
pathName = path + os.sep + fileName
cdlog(1, "WRITING FILE: "+pathName)
fo=open(p... | BruceDLong/CodeDog | buildiOS.py | buildiOS.py | py | 4,068 | python | en | code | 16 | github-code | 36 |
28864712409 | import requests
import lxml
from bs4 import BeautifulSoup
import re
def dadjokes():
source = requests.get(
"https://www.boredpanda.com/funny-dad-jokes-puns/?utm_source=google&utm_medium=organic&utm_campaign=organic").text
soup = BeautifulSoup(source, 'lxml')
article = soup.find_all('ar... | rushihadole/discord_bot | jokescrapper.py | jokescrapper.py | py | 1,264 | python | en | code | 0 | github-code | 36 |
34024325932 | import PySimpleGUI as sg
import os
from PIL import Image as I
import datetime
import time
from COCO import Coco, Image, Anno
import utilities
def worm(dir_path: str, category: str, coco):
"""
recursive flow that adds image objects to the coco object
:param dir_path: the dir of the folder with all the data... | OmriHerzfeld1/FinalProject | Classificator.py | Classificator.py | py | 8,713 | python | en | code | 0 | github-code | 36 |
74090896742 | from bs4 import BeautifulSoup
from urllib.request import urlopen
from platform import subprocess
# if genlist = 0, then this script downloads the files, the cmd_downloader variable comes into play
# if genlist = 1, then this script generates a list.txt file containing direct links to music files in the working direct... | aviaryan/pythons | TheHyliaSoundtrack/hylia_s.py | hylia_s.py | py | 1,588 | python | en | code | 6 | github-code | 36 |
22321037083 | """
Author: Zhuo Su, Wenzhe Liu
Date: Feb 18, 2021
"""
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn as nn
import torch
from torch.nn import functional as F
from torchvision import models
import torch
import torch.nn as nn
import torch.nn.functiona... | elharroussomar/Refined-Edge-Detection-With-Cascaded-and-High-Resolution-Convolutional-Network | models/chrnet.py | chrnet.py | py | 10,342 | python | en | code | 4 | github-code | 36 |
16036460087 | # References https://github.com/Sayan98/pytorch-segnet/blob/master/src/model.py
# Small segnet version
import torch
import torch.nn as nn
import torch.nn.functional as F
import warnings
warnings.filterwarnings("ignore")
class Conv2dSame(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, ... | bbrangeo/pytorch-image-segmentation | models/segnet.py | segnet.py | py | 4,464 | python | en | code | 0 | github-code | 36 |
9587838757 | import math
from plugin import plugin
@plugin("gui calculator")
class Calculator:
"""
Opens GUI Calculator.
{Note: Trigonometric ratios take value in degrees.}
"""
def __call__(self, jarvis, s):
try:
import tkinter as tk
except ModuleNotFoundError:
jarvis.... | sukeesh/Jarvis | jarviscli/plugins/calculator.py | calculator.py | py | 10,375 | python | en | code | 2,765 | github-code | 36 |
23299064589 | from ext_cloud.BaseCloud.BaseNetworks.BaseGateway import BaseGatewaycls
from boto import vpc
from ext_cloud.AWS.AWSBaseCloud import AWSBaseCloudcls
class AWSGatewaycls(AWSBaseCloudcls, BaseGatewaycls):
__aws_gateway = None
__vpc = None
def __init__(self, *arg, **kwargs):
self.__aws_gateway = arg... | Hawkgirl/ext_cloud | ext_cloud/AWS/AWSNetworks/AWSGateway.py | AWSGateway.py | py | 1,211 | python | en | code | 0 | github-code | 36 |
36928025069 | #!/usr/bin/env python3
from sys import exit
from test.http_test import HTTPTest
from misc.wget_file import WgetFile
"""
This test ensures that Wget handles Cookie expiry dates correctly.
Simultaneuously, we also check if multiple cookies to the same domain
are handled correctly
"""
############# File Defin... | RMerl/asuswrt-merlin | release/src/router/wget/testenv/Test-cookie-expires.py | Test-cookie-expires.py | py | 2,137 | python | en | code | 6,715 | github-code | 36 |
74352481063 | # -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
GUFY - Copyright (c) 2019, Fabian Balzer
Distributed under the terms of the GNU General Public License v3.0.
The full license is in the file LICENSE.txt, distributed with this software.
----------------... | Fabian-Balzer/GUFY | GUFY/simgui_modules/scriptWriter.py | scriptWriter.py | py | 55,424 | python | en | code | 0 | github-code | 36 |
5029362000 | #WAP to find the Max and Min number using simple if condition.
num1 = int(input("Enter 1 No. :"))
num2 = int(input("Enter 2 No. :"))
num3 = int(input("Enter 3 No. :"))
num4 = int(input("Enter 4 No. :"))
num5 = int(input("Enter 5 No. :"))
if(num1>num2) and (num1>num3) and (num1>num4) and (num1>num5):
largest = num... | ShushantoSarkar/Python-SDP | Day2/Max and Min.py | Max and Min.py | py | 1,041 | python | en | code | 0 | github-code | 36 |
7950443823 | import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
import argparse
from argparse import ArgumentParser
from Bio import SeqIO
import numpy as np
import os
import pandas as pd
import pickle
import multiprocessing
NR... | Dowell-Lab/OCR_transcription_detection | get_overlaps.py | get_overlaps.py | py | 10,100 | python | en | code | 0 | github-code | 36 |
28678507762 | import abjad
import random
from organi.tools.see_pitches import see_pitches
# RECURSES TO MODIFY PITCH SEGMENTS
# A C B D C E
def permut_thirds(pitches):
pitch_list = []
i = 0
pitch_list.append(pitches[i])
while i < len(pitches) - 2:
i = i + 2
note = pitches[i]
pitch_list.append... | DaviRaubach/muda | muda/pitches_for_pd.py | pitches_for_pd.py | py | 4,142 | python | en | code | 3 | github-code | 36 |
17878125643 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The mriqc package provides a series of :abbr:`NR (no-reference)`,
:abbr:`IQMs (image quality metrics)` to used in :abbr:`QAPs (quality
assessment protocols)` for :abbr:`MRI (magnetic resonance imaging)`... | pGarciaS/PREEMACS | scripts/mriqc/mriqc/__init__.py | __init__.py | py | 482 | python | en | code | 8 | github-code | 36 |
5063223720 | __all__ = [
'AuthorizationView',
'RevokeTokenView',
'TokenView',
'IntrospectTokenView',
]
from calendar import timegm
from oauth2_provider.views import (
AuthorizationView,
RevokeTokenView,
TokenView,
)
from rest_framework import (
generics,
response,
status,
)
from ..authenti... | mind-bricks/UMS-api | apps/oauth/views.py | views.py | py | 1,410 | python | en | code | 0 | github-code | 36 |
31981036961 | """empty message
Revision ID: 01368a3a906b
Revises: 5e10a128f4c9
Create Date: 2020-09-14 12:46:33.026557
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '01368a3a906b'
down_revision = '5e10a128f4c9'
branch_labels = None
depends_on = None
def upgrade():
# ... | OsamuHasegawa/society-portal | migrations/versions/01368a3a906b_.py | 01368a3a906b_.py | py | 1,614 | python | en | code | 1 | github-code | 36 |
39472224381 | from sqlalchemy import func, ForeignKey
from sqlalchemy.orm import relationship, declared_attr
from models.comments import CommentsModel
from db import db
from models.enums import RoleType
from models.orders import OrdersModel
class UsersModel(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, prim... | a-angeliev/Shoecommerce | server/models/users.py | users.py | py | 1,602 | python | en | code | 0 | github-code | 36 |
32754344712 | from django.contrib import admin
from django.urls import path
from django.contrib.auth import views as auth_views
from rafacar.views import home
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', home), # tela inicio
path('home', home, name='home'),
path('contato/', views.... | HenriqueJunio/tcc_rafacar | rafacar/urls.py | urls.py | py | 1,097 | python | pt | code | 0 | github-code | 36 |
73118934184 | import datetime as dt
def workdays_count(date1, date2):
delta = date2 - date1
ddays = delta.days
print(f"Всего дней между ними {ddays}")
workdays = 0
while ddays > 0:
if date1.weekday() < 5:
workdays += 1
date1 += dt.timedelta(days=1)
ddays -= 1
return workd... | IlyaOrlov/PythonCourse2.0_September23 | Practice/mtroshin/Module 10/2.py | 2.py | py | 654 | python | ru | code | 2 | github-code | 36 |
27321467389 | from tkinter import Tk, Frame, Label, Entry, Button, RIGHT, TOP, YES, X
import tkinter.messagebox as box
import time
import math
import encryption
import trigger2
import threading
dig = []
digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
alert_dist = 30;
class Clock:
def __init__(self):
... | bryanlim95/simple-security-gui | main_security.py | main_security.py | py | 3,070 | python | en | code | 0 | github-code | 36 |
13142587611 | import argparse
from auxilliaries.settings_reader import SettingsReader
from graph_indexing.graph_indexing_components.graph_name_handler import GraphNameHandler
from graph_indexing.graph_indexing_components.graph_printer import GraphPrinter
from graph_indexing.graph_indexing_components.graph_relation_counter import Gr... | MichSchli/QARehash | graph_indexing/index_graph.py | index_graph.py | py | 2,658 | python | en | code | 1 | github-code | 36 |
16408236851 | """Filter chat messages"""
import logging
_LOG = logging.getLogger(__name__)
import discord
import doosbot.client
def init(client: doosbot.client.DoosBotClient, tree: discord.app_commands.CommandTree):
@client.event
async def on_message(message: discord.message.Message):
_LOG.info(f"MESSAGE { message.author.dis... | PimDoos/DoosBotPy | doosbot/modules/chat.py | chat.py | py | 881 | python | en | code | 0 | github-code | 36 |
43245032675 | """
@file util.py
@author Himanshu Mishra
This module contains all the utility functions required by other modules.
All the plotting and displaying features are included with this module.
"""
# Necessary libraries
import os, shutil
import sys
import string
import cv2 as cv # OpenCV library used for image processing
i... | bhawesh-source/OCR | engine/util.py | util.py | py | 11,167 | python | en | code | 0 | github-code | 36 |
21628491364 | from django.db import models
from django.conf import settings
from django.db import models, transaction
from django.core.mail import send_mail
import secrets
import string
from translation.metadata import TRANSLATION_LANGUAGE_CHOICES
from django.contrib.postgres.fields import ArrayField
TRANSCRIPT_TYPE = (
("ORIGI... | AI4Bharat/Chitralekha-Backend | backend/organization/models.py | models.py | py | 6,964 | python | en | code | 18 | github-code | 36 |
72640397223 | import librosa
import tensorflow as tf
import numpy as np
from copy import deepcopy
from tensorflow.keras.layers import Dense, Activation, Dropout, Conv1D, MaxPooling1D, BatchNormalization
from tensorflow.contrib.rnn import GRUCell, RNNCell
from util.hparams import *
def pre_net(input_data, training):
x = Dense(2... | chldkato/Tacotron-Korean | models/modules.py | modules.py | py | 2,717 | python | en | code | 3 | github-code | 36 |
72440795944 | #!/usr/bin/env python
from urllib.parse import urlparse, parse_qs
import json
import os
import logging
import re
import bs4
import trackleaders_scraper.common as common
def parse_riders_from_race_page(race_page_text):
race_page = bs4.BeautifulSoup(race_page_text, "html.parser")
rider_links = (... | garyvdm/trackleaders_scraper | trackleaders_scraper/getriders.py | getriders.py | py | 1,355 | python | en | code | 0 | github-code | 36 |
27366167047 | import torch
from torch.utils.data import Dataset
from gpt3.utils import add_special_tokens
from data_utils import *
tokenizer = add_special_tokens()
class GPT21024Dataset(Dataset):
def __init__(self, records, max_len=2048):
self.data = records
self.max_len = max_len
self.to... | Paleontolog/summarizer_service | train_model/gpt3/dataset.py | dataset.py | py | 1,569 | python | en | code | 0 | github-code | 36 |
26977564429 | """
Day 14 - Aug 19
Given two strings representing sentences, return the words that are not common to both strings (i.e. the words that only appear in one of the sentences). You may assume that each sentence is a sequence of words (without punctuation) correctly separated using space characters.
Ex: given the follow... | khloe-r/techical-interview-practice | solutions/hashmaps/day14.py | day14.py | py | 1,272 | python | en | code | 0 | github-code | 36 |
14722454202 | import json as js, pandas, os, re
from matplotlib import pyplot as plt
dataset_completo_path = "C:/Users/Mark/Marco/Magistrale/Anno I/Secondo semestre/DS & ML/Progetto/Social-Mapper-Extended/social_mapper2/dataset/dataset_completo.json"
cf_path = "C:/Users/Mark/Marco/Magistrale/Anno I/Secondo semestre/DS & ML/Prog... | gaelix98/progetto-fdsml | codici aggiunti/generate_cf.py | generate_cf.py | py | 1,504 | python | en | code | 1 | github-code | 36 |
28368810745 | import json
import os
import time
import logging
import glob
import csv
import os
import stat
import psycopg2
import sqlite3 as sql
delimiter='/'
environment = ''
bucket = ''
models = {}
def getDBString_PROD():
# Format DB connection information
sslmode = "sslmode=verify-ca"
# Format DB connection inf... | Diksha-cmd/Containerized-batch-pipeline-using-DockerHub-Pachyderm-Google-Cloud-Storage-Postgres-Cloud-Database | pipeline2/Pipeline_2.py | Pipeline_2.py | py | 4,047 | python | en | code | 0 | github-code | 36 |
73118851304 | def remove(matrix, digit):
for line in matrix:
i = 0
while i != len(line):
if line[i] == digit:
for lst in matrix:
lst.pop(i)
else:
i += 1
return matrix
my_matrix = [[1, 2, 2],
[4, 5, 6],
[7, ... | IlyaOrlov/PythonCourse2.0_September23 | Practice/achernov/module_5/task_4.py | task_4.py | py | 419 | python | en | code | 2 | github-code | 36 |
7537956633 | # O(n) runtime and O(1) space complexity
#
# Push every positive integer smaller than n (ther array size)
# to its position on the queue.
# Notice that the smallest positive integer that is not on the
# array cannot be bigger than n+1.
# Do a second pass on the array and return the first element
# that is not equal t... | daily-coding-x-br/daily-coding | may/06/centa.py | centa.py | py | 943 | python | en | code | 2 | github-code | 36 |
33763269561 | """The CLI entry of steamutils."""
from argparse import ArgumentParser
from ._version import __version__ as version
def main(argv=None):
"""Tools for performing analytics on steam users, steam groups and servers using the SteamAPI and various popular SourceMod plugins"""
parser = ArgumentParser()
parser.... | CrimsonTautology/steamutils | src/steamutils/__main__.py | __main__.py | py | 691 | python | en | code | 0 | github-code | 36 |
14411049043 | # coding: utf-8
import os
import sys
import logging
#logging.basicConfig()
from traceback import print_exc
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
def getLogger(name):
formatter = logging.Formatter(
fmt='%(asctime)s %(filename)s:%(lineno)s: %(levelname)-8... | rhee/browser-websocket-tts-server | getlogger.py | getlogger.py | py | 1,049 | python | en | code | 0 | github-code | 36 |
7667813533 | import glob
import pathlib
import pandas as pd
import xlsxwriter
import ghgscenario as gs
import lukeghg.crf.ghginventory as ghg
uid_file_dict = dict()
def uidmatrix_cell_count(uid_set:set):
return len(uid_set)
def possible_missing_uid(scenuid_set,uidmatrix_set):
return scenuid_set.difference(uidmatrix_set)
... | jariperttunen/lukeghg | lukeghg/lukeghg/scen/missinguid.py | missinguid.py | py | 2,888 | python | en | code | 0 | github-code | 36 |
3538900252 | import os
from celery import Celery
from celery.schedules import crontab
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sendmails.settings')
app = Celery('sendmails')
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task... | sama50/sendmails | sendmails/celery.py | celery.py | py | 635 | python | en | code | 1 | github-code | 36 |
2071413792 | from helpers.client import get_client, get_config
def main() -> None:
client = get_client()
config = get_config()
org_id = config["ORG_ID"]
# List webhooks endpoint
endpoint = f"org/{org_id}/webhooks"
resp = client.get(endpoint)
print(resp.json())
return None
if __name__ == "__mai... | snyk-omar/snyk-api-examples | src/webhooks.py | webhooks.py | py | 337 | python | en | code | 0 | github-code | 36 |
21644919031 | import glob
import os
import sys
import platform
import typer
import shutil
from .utils import runCommand, loadPedaUserConfig
loadPedaUserConfig()
app = typer.Typer()
@app.command(
context_settings={"allow_extra_args": True, "ignore_unknown_options": True}
)
def genbuild(ctx: typer.Context, buildDir: str = './b... | abhishekmishra/peda | pypeda/peda/cmk.py | cmk.py | py | 1,892 | python | en | code | 0 | github-code | 36 |
25978398804 | from app.models.models.mock_response_interceptor_type import MockResponseInterceptorType
from app.utils.utils import new_id
class MockResponseInterceptor(object):
def __init__(self,
mock_id: str,
response_id: str,
type: MockResponseInterceptorType,
... | sayler8182/MockServer | app/models/models/mock_response_interceptor.py | mock_response_interceptor.py | py | 2,352 | python | en | code | 2 | github-code | 36 |
5580225642 | import logging
import os
import math
import logging
import sys
import glob
from natsort import natsorted
import torchvision
import numpy as np
import cv2
from PIL import Image
import torch
from torch.utils.data import Dataset
from torchvision import transforms
from torch.nn import functional as F
from PIL import Imag... | masa-k-21414/explainable_trajectory_prediction_model | scripts/model/data/trajectories.py | trajectories.py | py | 31,981 | python | en | code | 4 | github-code | 36 |
41138281168 | import math
from helpers.routines import get_text_words
from models.letter_type import LetterTypes
class BayesSpamFilter:
probability_dictionary = {}
detection_threshold = 0.0
spam_probability = 0.0
def __init__(self, words_dictionary, total_ham, total_spam, initial_threshold, initial_spam_probabili... | ilbagrus/DataAnalysis | spam_filters/naive_bayes_filter.py | naive_bayes_filter.py | py | 2,570 | python | en | code | 0 | github-code | 36 |
29296064672 | from django.urls import path
from . import views
urlpatterns = [
path('healths/', views.HealthListView.as_view(), name='healths'),
path('health/<int:pk>', views.HealthDetailView.as_view(), name='healths-detail'),
path('fashions/', views.FashionListView.as_view(), name='fashions'),
path('fashion/<in... | anowar143/django-news-frontend | src/lifestyle/urls.py | urls.py | py | 534 | python | en | code | 1 | github-code | 36 |
20529220011 | import numpy as np
import matplotlib.pyplot as plt
greyhounds = 500
lads = 500
grey_height = 28 + 4 * np.random.randn(greyhounds)
lad_height = 24 + 4 * np.random.randn(lads)
plt.hist([grey_height,lad_height],stacked=True,color=['r','b'])
plt.show() | slm960323/ML_Diary | toyex_dog.py | toyex_dog.py | py | 251 | python | en | code | 0 | github-code | 36 |
33643104574 | # a python script that prints a character at index j in string s
# If the index is out of range, the program should print "j is out of range"
# If the string is empty the program should print "empty string"
s = "HelloWorld"
j = 20
if len(s) == 0:
print("Empty string")
elif j < len(s):
print(s[j])
else:
pr... | Willmuseve/simple-python | Strings/task2.py | task2.py | py | 345 | python | en | code | 0 | github-code | 36 |
10650991316 | def dfs(now, cnt):
global min_cnt
if now > N: return
if visited[now] <= cnt: return
visited[now] = cnt
if now == N:
min_cnt = min(min_cnt, cnt)
return
for dist in range(1, lst[now] + 1):
dfs(now + dist, cnt + 1)
T = int(input())
for tc in range(1, T + 1):
lst = lis... | elenaisnanocat/Algorithm | SWEA/algorithm수업_1/swea_13118_전기버스 2.py | swea_13118_전기버스 2.py | py | 493 | python | en | code | 0 | github-code | 36 |
8566701397 | # -*- coding: utf-8 -*-
"""
Created on 2017 10.17
@author: liupeng
wechat: lp9628
blog: http://blog.csdn.net/u014365862/article/details/78422372
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
slim = tf.contrib.slim
def lp_net_... | MachineLP/train_arch | train_cnn_multilabel/lib/model/lp_net/lp_net.py | lp_net.py | py | 3,221 | python | en | code | 195 | github-code | 36 |
28890119301 | #! /usr/bin/python
"""A script to push a new Pytype release to PyPI.
This script assumes that you have twine installed. The easiest way to run this
script is to run from inside of a virtualenv after "pip" installing "twine".
Also, this virtualenv should not have pytype installed already.
USAGE:
$> python release.py ... | google/pytype | build_scripts/release.py | release.py | py | 3,784 | python | en | code | 4,405 | github-code | 36 |
1938145805 | import pathlib
from typing import List
import kclvm.config
import kclvm.internal.util as util
import kclvm.internal.gpyrpc.gpyrpc_pb2 as pb2
KCL_MOD_PATH_ENV = "${KCL_MOD}"
def load_settings_files(
work_dir: str, files: List[str]
) -> pb2.LoadSettingsFiles_Result:
"""Load KCL CLI config from the setting fi... | kcl-lang/kcl-py | kclvm/config/settings.py | settings.py | py | 1,916 | python | en | code | 8 | github-code | 36 |
41009898222 | import os, sys, re
'''
@Author Alejandro Ortega
class Shell will emulate a bash terminal by using redirection
and piping. this Shell will also list the directories and will
change to desired directories
'''
class Shell:
def __init__(self):
self.executeCommand()
'''
executeCommand will... | utep-cs-systems-courses/project1-shell-alxrtega | shell/shell.py | shell.py | py | 5,222 | python | en | code | 0 | github-code | 36 |
1842661731 | import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
symbol_dict = {'cell': 'Celltrion',
'hmotor': 'HyundaiMotor',
'naver': 'NAVER',
'kakao': 'Kakao',
'lgchem': 'LGChemical',
'lghnh': 'LGH&H',
... | jaewonlee-728/2020-lfd | LFD_Project4/src/DataGenerator.py | DataGenerator.py | py | 7,789 | python | en | code | 0 | github-code | 36 |
72215136745 | # Utilities to parse alignment files from Schwartz Lab SOMA
# *and* to write alignments in Schwartz lab SOMA format
#
# We use functions and classes defined here both to convert
# from maligner to SOMA and from SOMA to maligner.
#
# This module could be better organized!
# Perhaps separate modules for parsing and writi... | LeeMendelowitz/maligner | lib/malignpy/schwartz/parse_soma_alignments.py | parse_soma_alignments.py | py | 22,652 | python | en | code | 6 | github-code | 36 |
2671700806 | import numpy as np
from const import PitchExtractorType
from voice_changer.DiffusionSVC.pitchExtractor.PitchExtractor import PitchExtractor
from voice_changer.RVC.deviceManager.DeviceManager import DeviceManager
import onnxruntime
class RMVPOnnxEPitchExtractor(PitchExtractor):
def __init__(self, file: str, gpu: ... | w-okada/voice-changer | server/voice_changer/RVC/pitchExtractor/RMVPOnnxEPitchExtractor.py | RMVPOnnxEPitchExtractor.py | py | 3,109 | python | en | code | 12,673 | github-code | 36 |
5313931877 | import datetime
from flask import Blueprint
from core import Utils
from exts import db, APIResponse
from models import Interview, Person
listing_resources = Blueprint('listing_resources', __name__)
@listing_resources.route('/interview/<interview_id>', methods=['GET'])
def get_interview(interview_id):
interview =... | msiddhu/interview_portal | backend/controllers/ViewController.py | ViewController.py | py | 1,172 | python | en | code | 1 | github-code | 36 |
22782893938 | # Graph Valid Tree
# Description
# Given n nodes labeled from 0 to n - 1 and a list of undirected edges
# (each edge is a pair of nodes), write a function to check whether these
# edges make up a valid tree.
# You can assume that no duplicate edges will appear in edges. Since all
# edges are undirected, [0, 1] is the... | Zhenye-Na/leetcode | python/261.graph-valid-tree.py | 261.graph-valid-tree.py | py | 2,485 | python | en | code | 17 | github-code | 36 |
39207358817 | # --- carolin schieferstein & jose c. garcia alanis
# --- utf-8
# --- Python 3.7 / mne 0.20
#
# --- eeg pre-processing for dpx-r40
# --- version: january 2020
#
# --- detect and annotate artifact distorted segments in continuous data,
# --- average reference
# ==========================================================... | CarolinSchieferstein/Master-DPX-EEG | python_scripts/02_artefact_detection.py | 02_artefact_detection.py | py | 11,112 | python | en | code | 1 | github-code | 36 |
5928787867 | import pygmt
fig = pygmt.Figure()
map_scale = 'f39/36.2/36.2/400+u'
topo_data = "@earth_relief_15s"
frame = ["WSne", "xaf+lx-axis", "yaf+ly-axis"]
style = "c0.3c" # Style for the scatter for plotting stations
pen_t = "black" # Pen outline
region = [34, 42, 35.5, 40]
FONT_SEHIR = "10p,Helvetica-Bold"
... | abdullahaltindal/commsenv_2023_tr_eq_sequence_figs | figure_1/fig1_a.py | fig1_a.py | py | 1,583 | python | en | code | 0 | github-code | 36 |
37334494671 | from importlib.resources import contents
import logging
import json
from aiogram import Bot, Dispatcher, types
from aiogram.types import Message
from data.config import BOT_TOKEN
from aiogram import types
# from aiogram.dispatcher.filters.builtin import CommandStart
from aiogram.types import InlineKeyboardMarkup, Inl... | DobbiKov/telegram-bot-web-app | bot/main.py | main.py | py | 5,445 | python | en | code | 3 | github-code | 36 |
71041153703 | import re
import sys
import os
import string
try:
sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
from com.dtmilano.android.viewclient import ViewClient
USE_BROWSER = True
# Starting: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.browser/.Bro... | xiaofan-wxf/app_emulate | jianianhua_emulate/browser-open-url.py | browser-open-url.py | py | 924 | python | en | code | 1 | github-code | 36 |
70474066663 | import time
import datetime
from timeConvert import dayInSeconds
from futureTides import HighTideKeeper, LowTideKeeper
import json
dayTimeTimeStamp = 1602907205
capeCharlesTimeStamp = 1592057307 #Low Tide morning of 6/13/2020 in Cape Charles Harbor
jamesTimeStamp = capeCharlesTimeStamp + 27480 #Jmes River Locks 458 mi... | blutherRVA/TideWeatherWebsite | flaskr/TideJsonWrites.py | TideJsonWrites.py | py | 1,135 | python | en | code | 0 | github-code | 36 |
7925860011 | class Queue_Two_Stacks():
def __init__(self):
self.stack_1 = []
self.stack_2 = []
def enqueue(self, item):
self.stack_1.append(item)
#print(self.stack_1)
def Add_Stack1_to_Stack2(self):
if len(self.stack_2) == 0:
# If stack_1 is empty, raise... | pnayak333/Stack-and-Que-Programs | Que_2_Stacks.py | Que_2_Stacks.py | py | 1,701 | python | en | code | 0 | github-code | 36 |
73339046183 | '''
Created on Sep 19, 2012
@author: jluker
'''
import logging
from config import config
from solrdoc import SolrDocument
from flask import request as current_request, current_app as app
from flask.ext.solrquery import SearchResponseMixin
__all__ = ['SolrResponse']
class SolrResponse(SearchResponseMixin):
... | adsabs/adsabs | adsabs/core/solr/response.py | response.py | py | 8,723 | python | en | code | 7 | github-code | 36 |
25978662424 | from flask import url_for, redirect, request
from flask_admin import BaseView, expose
from app.controllers import interceptors_controller
from app.models.models.http_method import HTTPMethod
from app.utils.utils import toast, call
class View(BaseView):
def is_visible(self):
return False
@expose('/')... | sayler8182/MockServer | app/views/interceptors/interceptors_view.py | interceptors_view.py | py | 3,836 | python | en | code | 2 | github-code | 36 |
12993263023 | import json
import time
import sys
import requests
def try_get_json(url, timeout=20):
t = time.time()
try:
with Timer("requests.get(%s)" % url):
response = requests.get(url, timeout=timeout)
except requests.exceptions.Timeout:
log("GET %s timed out after %s." % (url, time.time(... | opentable/mesos_stats | mesos_stats/util.py | util.py | py | 1,358 | python | en | code | 7 | github-code | 36 |
25172170933 | # -*- coding: utf-8 -*-
"""Setup tests for this package."""
from imio.prometheus.testing import IMIO_PROMETHEUS_INTEGRATION_TESTING # noqa: E501
from plone import api
import unittest
class TestView(unittest.TestCase):
"""Test that imio.prometheus is properly installed."""
layer = IMIO_PROMETHEUS_INTEGRATIO... | IMIO/imio.prometheus | src/imio/prometheus/tests/test_view.py | test_view.py | py | 849 | python | en | code | 0 | github-code | 36 |
3558679885 | from django.shortcuts import render
from django.http import HttpResponse
from .models import *
from django.shortcuts import redirect
import re
from django.utils.html import escape
def index(request, id=-1):
if not request.user.is_authenticated:
dir_tree = ''
file_content = ''
return render... | KacperSzczepanski/awww-webapp | webapp/utils/views.py | views.py | py | 3,284 | python | en | code | 1 | github-code | 36 |
7775088109 | class edge():
def __init__(self, src, nbr):
self.src = src
self.nbr = nbr
v = int(input())
e = int(input())
graph = {}
for i in range(v):
graph[i] = []
for i in range(e):
a, b = map(int, input().split())
graph[a].append(edge(a, b))
graph[b].append(edge(b, a))
visited = [0]*v
def conco... | nishu959/graphpepcoding | perfectfriendspep.py | perfectfriendspep.py | py | 796 | python | en | code | 0 | github-code | 36 |
2891422631 | """
api.middleware
~~~~~~~~~~~~~~
blah blah blah
"""
import json
from werkzeug.local import Local, release_local
from werkzeug.wrappers import Request, Response
from werkzeug.exceptions import BadRequest, NotAcceptable, HTTPException, abort
class BeforeAfterMiddleware(object):
"""A simple middleware... | Queens-Hacks/qcumber-api | api/middleware.py | middleware.py | py | 5,677 | python | en | code | 1 | github-code | 36 |
33149860797 | import argparse
import time
import io
import zenoh
import json
from servo import *
from pycdr2 import IdlStruct
from pycdr2.types import int8, int32, uint32, float64
@dataclass
class Vector3(IdlStruct, typename="Vector3"):
x: float64
y: float64
z: float64
@dataclass
class Twist(IdlStruct, typename="Twist"... | eclipse-zenoh/zenoh-demos | turtlebot3/zdrive-python/zdrive.py | zdrive.py | py | 3,143 | python | en | code | 27 | github-code | 36 |
12292682173 | #数据处理
import sys, pickle, os, random
import numpy as np
import gensim #add by wjn
## tags, BIO
tag2label = {"O": 0,
"B-KNOW": 1, "I-KNOW": 2,
"B-PRIN": 3, "I-PRIN": 4,
"B-OTHER": 5, "I-OTHER": 6
}
#输入train_data文件的路径,读取训练集的语料,输出train_data
def read_corpus(corpus_path... | wjn1996/Mathematical-Knowledge-Entity-Recognition | data.py | data.py | py | 6,414 | python | en | code | 31 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.