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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
70077253225 | from __future__ import print_function
import requests, lxml.html
headers = {'user-agent': 'taco'}
urls_to_check = [
'http://www.packtpub.com/application-development/python-data-structures-and-algorithm',
'https://www.packtpub.com/big-data-and-business-intelligence/learning-data-mining-python-second-edition',
... | chris-hamberg/scrapers | packt.py | packt.py | py | 1,212 | python | en | code | 0 | github-code | 36 |
9423482446 | #programa que lea un periodo de tiempo en segundos
# y muestre el numero de dias, horas, minutos y segundos
dias = 0
horas = 0
minuto = 0
segundos = 0
total = 0
dato_leido = input('Introduzca el número de segundos: ')
if dato_leido.isdigit():
segundos = int(dato_leido)
meses = segundos // 2592000
segundos ... | staryellow7/Ejercicios-Python | Unidad 1 - Guia de Ejercicios 1/ejercicio14.py | ejercicio14.py | py | 673 | python | es | code | 0 | github-code | 36 |
246221889 | import datetime
import pandas as pd
from helper.fetch import Fetch
from helper.dynamic_scrape import DynamicScrape
from helper.property_helper import PropertyHelper
class Dhalia(object):
source = 'Dhalia'
columns = [
'Reference', 'Town', 'Type', 'Stage',
'Bedrooms', 'Bathrooms',
'Tot... | brandonabela/Malta-Property-Analysis | src/export/dhalia.py | dhalia.py | py | 5,369 | python | en | code | 2 | github-code | 36 |
17116817824 | import sys
import argparse
import os
import math
from ROOT import TCanvas, TColor, TGaxis, TH1F, TPad, TString, TFile, TH1, THStack, gROOT, TStyle, TAttFill, TLegend, TGraphAsymmErrors, TLine
from ROOT import kBlack, kBlue, kRed, kCyan, kViolet, kGreen, kOrange, kGray, kPink, kTRUE
from ROOT import Double
from ROOT imp... | BinghuanLi/post_tWIHEP | plotters/make_systHists.py | make_systHists.py | py | 11,190 | python | en | code | 0 | github-code | 36 |
43851216200 | import Diverter as di
def ChoiceMaker(data,filereports):
print("Done with data reading, Ready To start Analysis")
print()
print()
Choice=input("Which report you want to generate? (enter choice All/Single) ")
if(Choice.lower()=="all" or Choice.lower()=="all"):
di.diverter(data... | AbhiDasariNYU/ApplicationStatusBot | Choice.py | Choice.py | py | 1,003 | python | en | code | 0 | github-code | 36 |
27876220800 | # Core Pkgs
import streamlit as st
#Other Pkgs
#EDA Pkgs
import pandas as pd
import codecs
from pandas_profiling import ProfileReport
#Component Pkgs
import streamlit.components.v1 as components #v1 is version1 : If new features are added, then it will not break your app
from streamlit_pandas_profiling import st_pro... | yashpupneja/StreamAI | DS_pandas_profiling.py | DS_pandas_profiling.py | py | 2,412 | python | en | code | 0 | github-code | 36 |
2509822081 | # Iris Recognition
# 04. Module to match iris descriptions.
# Language: Python 3
import numpy
import cv2
ROTATIONS = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def _rotate_norm_image(image, rotation):
output = numpy.zeros(image.shape, image.dtype)
if rotation == 0:
... | EmmanuelOlofintuyi/Biometrics | Iris Recognition/d_match_iris.py | d_match_iris.py | py | 1,516 | python | en | code | 0 | github-code | 36 |
1938073175 | from pathlib import Path
import json
from .util import filter_fields
def KMANGLED_encode(
data, sort_keys=False, indent=None, ignore_private=False, ignore_none=False
):
return json.dumps(
filter_fields(data, ignore_private, ignore_none),
sort_keys=sort_keys,
indent=indent,
)
def... | kcl-lang/kcl-py | kclvm/compiler/extension/builtin/system_module/json.py | json.py | py | 652 | python | en | code | 8 | github-code | 36 |
70656671785 | """
Some of code was taken from https://pytorch.org/vision/stable/_modules/torchvision/models/resnet.html
"""
import torch
from torch import Tensor, nn
from typing import Optional, List
from torchvision.models import resnet18
def conv3x3(input_size: int, output_size: int, stride: int = 1) -> nn.Conv2d:
return nn... | timtibilov/AttentionOCR | src/model/cnn.py | cnn.py | py | 4,622 | python | en | code | 7 | github-code | 36 |
74678278503 | from django.contrib.auth.decorators import permission_required , login_required
from django.shortcuts import render , redirect , get_object_or_404,HttpResponseRedirect , HttpResponse
from form_1.forms import Form1Form
from form_1.models import Form1
from giris.views import login_view
from .models import Form3 as Form3... | orhunakar01/hekimbey01 | form3/views.py | views.py | py | 3,907 | python | en | code | 1 | github-code | 36 |
35259366868 | from os.path import abspath, dirname, realpath
pythonpath = abspath(dirname(dirname(dirname(realpath(__file__)))))
django_settings = 'liveapi.settings'
bind = '0.0.0.0:8000'
workers = 2
timeout = 30
max_requests = 1500
max_requests_jitter = int(max_requests * 0.1)
preload = True | KhameBigDataGroup/live-webapi-consumer | confs/gunicorn/main.py | main.py | py | 284 | python | en | code | 0 | github-code | 36 |
21141404825 | # variable1
slipGaji = "PT. XYZ"
garis = '------------------'
namaPegawai1 = "Ahmad"
agama = "Islam"
jumlahAnak = 2
gaji_pokok = 4000000
tunjangan_jabatan = 20/100
tunjangan_keluarga = 10/100
gaji_kotor = gaji_pokok + 800000 + 400000
zakat_profesi = gaji_kotor - 2.5/100
take_home_pay = gaji_pokok + 800000 + ... | bahlurali/pw | python 1.py | python 1.py | py | 3,048 | python | id | code | 0 | github-code | 36 |
3112497590 | #!/usr/bin/env python3.7
import argparse
import json
import sys
def matches(parts, subject):
if len(parts) == 0:
yield subject
return
part, *rest = parts
# If we're extracting something from `subject`, and `subject` is neither a
# list nor a dict, then there's nothing to extract. W... | dgoffredo/jex | src/jex.py | jex.py | py | 2,192 | python | en | code | 0 | github-code | 36 |
70925956263 | class newNode:
def __init__(self, data):
self.data = data
self.left = self.right = None
# Function to find height of a tree
def height(root, ans):
if (root == None):
return 0
left_height = height(root.left, ans)
right_height = height(root.right, ans)
ans[0] = max(ans[... | shuklaforyou/place | advance/dyanamic programing/dp on tree/problem/diameter of tree (binary)/firstapproch.py | firstapproch.py | py | 825 | python | en | code | 0 | github-code | 36 |
71636759143 | class Nodo:
def __init__(self, tipo, nombre=None, isArray=None, direccion=None, siguiente=None, etiquetaTrue=None, etiquetaFalse=None):
self.tipo = tipo # Tipo de dato
self.nombre = nombre # Nombre del nodo donde retornamos el valor
self.isArray = isArray
self.direccion = direccio... | jpcifuentes16/antlr-python3 | Visitor/Nodo.py | Nodo.py | py | 541 | python | es | code | 0 | github-code | 36 |
74060632744 | import time
from server.decorators import with_logger
from server.rating import RatingType
from .game import Game
from .typedefs import GameType, InitMode, ValidityState
@with_logger
class CustomGame(Game):
init_mode = InitMode.NORMAL_LOBBY
game_type = GameType.CUSTOM
def __init__(self, id_, *args, **k... | FAForever/server | server/games/custom_game.py | custom_game.py | py | 755 | python | en | code | 64 | github-code | 36 |
22782479678 | #
# @lc app=leetcode id=118 lang=python3
#
# [118] Pascal's Triangle
#
# https://leetcode.com/problems/pascals-triangle/description/
#
# algorithms
# Easy (58.01%)
# Likes: 11256
# Dislikes: 361
# Total Accepted: 1.4M
# Total Submissions: 1.9M
# Testcase Example: '5'
#
# Given an integer numRows, return the firs... | Zhenye-Na/leetcode | python/118.pascals-triangle.py | 118.pascals-triangle.py | py | 1,061 | python | en | code | 17 | github-code | 36 |
31056930437 | import os.path
from flask import Flask
from flaskext.sqlalchemy import SQLAlchemy
CONFIG_FILEPATH = os.path.join(os.path.dirname(__file__), "../config.cfg")
def auto_register_modules(app):
"""Registers modules from :mod:`subleekr` to application."""
import subleekr
for modname in subleekr.__modules__:
... | sublee/subleekr | subleekr/app.py | app.py | py | 732 | python | en | code | 1 | github-code | 36 |
34222277716 | # -*- coding: utf-8 -*-
import logging
import xml.sax
import slpyser.xmlparser.handlers as handlers
from slpyser.model.abap_objects.AbapDictionary import AbapDictionary
from slpyser.model.abap_objects.AbapMessageClass import AbapMessageClass
from slpyser.model.abap_objects.AbapTextPool import AbapTextElement
class ... | thalesvb/slpyser | slpyser/xmlparser/SAPLinkContentHandle.py | SAPLinkContentHandle.py | py | 10,301 | python | en | code | 0 | github-code | 36 |
69954683303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/21 0021
# @Author : justin.郑 3907721@qq.com
# @File : covid.py
# @Desc : 获取疫情数据
import json
import time
import demjson
import jsonpath
import requests
import pandas as pd
from io import BytesIO
from PIL import Image
from bs4 import BeautifulSoup... | justinzm/gopup | gopup/event/covid.py | covid.py | py | 24,122 | python | en | code | 2,477 | github-code | 36 |
18845748066 | import os,sys,shutil,multiprocessing
sys.path.append("..")
from base.get_config import MyConfig as myconfig
pid=multiprocessing.current_process().pid#获取pid进程编号
folderpath=myconfig("project","project_path").value+myconfig("project","data_path").value
def folder_create(path=None):
if path:
path=path
else:
path=fo... | cainiaosun/study | 测试/自动化合并/autotest/base/web_ui/running_folder.py | running_folder.py | py | 1,130 | python | en | code | 0 | github-code | 36 |
73000266663 | def create_model(opt):
model = None
if opt.model == 'pix2pix':
assert(opt.dataset_mode == 'aligned')
from .pix2pix_model import Pix2PixModel
model = Pix2PixModel()
elif opt.model == 'pix2pix_three':
assert(opt.dataset_mode == 'aligned_three')
from .pix2pix_model_three... | cyduoot/facefusion | models/__init__.py | __init__.py | py | 876 | python | en | code | 0 | github-code | 36 |
30898403361 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: dutrasr
# @Date: 2015-08-27 01:17:31
# @Last Modified by: dutrasr
# @Last Modified time: 2015-09-20 22:13:08
#import modules
import os
###################################################################################
# Recebe um diretorio com as pastas co... | dutrasrInf/Biometrics-of-Human-Gait-Using-Kinect | GenerateInfo/travelToDir.py | travelToDir.py | py | 1,117 | python | de | code | 0 | github-code | 36 |
42130961103 | from beautifultable import BeautifulTable
from Contact_new import Contact
class InMemoryImpl:
contact_list = []
@classmethod
def addContact(cls):
name = input("enter name: ")
email = input("enter email: ")
mobile = input("enter mobile: ")
address = input("enter address:... | adityaKoteCoder/codex | Contactbook/inmemory.py | inmemory.py | py | 3,251 | python | en | code | 0 | github-code | 36 |
1947165541 | def solution(s):
p_ = 0
y_ = 0
for i in s:
if i in ['p', 'P']:
p_ += 1
if i in ['y', 'Y']:
y_ += 1
if p_ == y_: return True
else: return False
| hellokena/Programmers | 코딩테스트 연습/Level 1/연습문제_문자열 내 p와 y의 개수.py | 연습문제_문자열 내 p와 y의 개수.py | py | 203 | python | en | code | 0 | github-code | 36 |
25756148314 | computer_price = {
"HP": 600,
"DELL": 650,
"MACBOOK": 12000,
"ASUS": 400,
"ACER": 350,
"TOSHIBA": 600,
"FUJITSU": 900,
"ALIENWARE": 1000,
}
user_key = input("Type of computer you want to check: ")
print("Price of",user_key,":",computer_price[user_key.upper])
| Supporter09/C4T-B05 | python/section11/Dict4/print_price_2.py | print_price_2.py | py | 291 | python | en | code | 1 | github-code | 36 |
27481966234 | def some_function(sentence):
bad_words = ["lame"]
lister = []
for i in sentence:
lister.append(i)
new_sent = "".join(lister)
for a in bad_words:
if a in new_sent:
new_sent = new_sent.replace(a, "*" * len(a))
print(new_sent)
some_function("It's so lame that today... | kteel620/Python-Files | Word_Censor.py | Word_Censor.py | py | 387 | python | en | code | 0 | github-code | 36 |
154684037 | from django.urls import path
from home import views
urlpatterns = [
path('sign', views.sign, name='sign'),
path('', views.loginp, name='loginp'),
path('logoutp', views.logoutp, name='logoutp'),
path('base', views.base, name='base'),
path('mainhome', views.mainhome, name='home'),
# path('account... | Atharv4507/SP | home/urls.py | urls.py | py | 768 | python | en | code | 0 | github-code | 36 |
37290685399 | from django.shortcuts import render,redirect
from django.template.context_processors import csrf
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from utilities import utility_functions
from django.contrib.auth.decorators import login_required
from django.http import HttpResp... | bitapardaz/bitasync | payment/views.py | views.py | py | 6,561 | python | en | code | 0 | github-code | 36 |
41644824235 | from pathlib import Path
import string
import unicodedata
import time
import torch
import torch.nn as nn
import numpy as np
from torch.optim import Adam
def find_files(path, pattern):
return Path(path).glob(pattern)
names_dir = './datasets/data/names'
pat = '*.txt'
print(list(find_files(names_dir, p... | sbl1996/pytorch-snippets | char_lstm.py | char_lstm.py | py | 4,373 | python | en | code | 0 | github-code | 36 |
20158271860 | #import sqlTesting as sqlT
from matplotlib.pyplot import connect
import connect as sqlT
import os
#Runs through connect.py until the user is done
again = 'y'
while(again == 'y'):
os.system('CLS')
sqlT.user(sqlT.my_cursor, sqlT.my_db)
again = input("Press y to continue and n to quit: ")
whi... | ZachGr/project0 | main.py | main.py | py | 522 | python | en | code | 0 | github-code | 36 |
13653886738 | import matplotlib.pyplot as plt
def main():
filename = input('Enter a file name: ')
X = [0,1,2,3,4,5]
Y=[0.78,0.92,0.91,0.88,0.88,0.89]
#plt.ylabel('Generation with best result')
plt.ylabel('Accuracy of result')
plt.plot(X,Y)
plt.xlabel('Degree of polynomial')
plt.... | agatachamula/genetic-algorthm | graphs.py | graphs.py | py | 422 | python | en | code | 0 | github-code | 36 |
74258267945 | # https://takeuforward.org/interviews/tcs-nqt-coding-sheet-tcs-coding-questions/
# Eample 1:.
# Input: N = 1100110
# Output: 146
# Explaxnation: 1100110 when converted to octal number is “146”.
s = "1100110"
n = len(s)
# Ensure the length of s is a multiple of 3 by adding leading zeros if necessary
... | Danuragtiwari/tcs-nqt | Number System/2.py | 2.py | py | 636 | python | en | code | 0 | github-code | 36 |
34921941272 | import numpy as np
import pandas as pd
import torch
import pickle
import random
import re
from tqdm import tqdm
from transformers.modeling_utils import PoolerAnswerClass
data_path={
'mfc': '/data/news/mfc/',
'gvfc': '/data/news/GVFC/GVFC/GVFC_headlines_and_annotations.xlsx',
'twitter': '/data/tweet/twitter... | xymou/Frame_Detection | data/load_data_multi.py | load_data_multi.py | py | 11,117 | python | en | code | 1 | github-code | 36 |
73421338023 |
import sys
import json
import buildCNNModel as cnn
from loadutils import retrieve_model, loadProcessedData, saveDevPredictionsData
from evaluation_helper import convert_raw_y_pred, get_f1, get_precision, get_recall
import numpy as np
def printUsage():
print("USAGE:\n\ntrain a CNN model")
print("All training d... | Chucooleg/CapsNet_for_NER | code/trainCNNModel.py | trainCNNModel.py | py | 3,296 | python | en | code | 10 | github-code | 36 |
28798067661 | # By: Jared Donnelly
# CS 110 - Prof. Kevin Ryan
# I pledge my Honor that I have abided by the Stevens Honor System
def main():
print("The following program accepts numerical inputs and sums them")
print("Please list all the numbers you would like to enter in a list separated by spaces")
sumables = input("... | Eric-Wonbin-Sang/CS110Manager | 2020F_hw5_submissions/donnellyjared/DonnellyJaredP2-1.py | DonnellyJaredP2-1.py | py | 605 | python | en | code | 0 | github-code | 36 |
34535894055 | #!/usr/bin/python
# open a microphone in pyAudio and get its FFT spectrum
import pyaudio
import numpy as np
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
INPUT_BLOCK_TIME = 0.08
GLIDING_DIVIDER = 4
INPUT_FRAMES_PER_BLOCK = int(RATE*INPUT_BLOCK_TIME/GLIDING_DIVIDER)
soundtype = np.dtype([('l',np.int16),('r',... | maralorn/pythonlights | sound.py | sound.py | py | 1,790 | python | en | code | 0 | github-code | 36 |
74784438504 | import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, input_dim : int, output_dim : int, hidden_dim : list,
num_layers:int, dropout_rate:float=0.):
super(MLP, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.hidden... | GarfieldCK/AI-module | ai_modules/models/module.py | module.py | py | 1,034 | python | en | code | 0 | github-code | 36 |
27559465226 | import tkinter as tk
class Crossword:
def __init__(self, window):
self.window = window
self.window.geometry('800x800')
self.window.title('Mazal Tov!')
self.grid_size = 16
self.cell_size = 2
self.last_et_id = 0
self.entry_texts = {}
title_frame = tk... | Yuvashkenazi/crossword | plan_bet/mainb.py | mainb.py | py | 2,623 | python | en | code | 0 | github-code | 36 |
9571225314 | from wq.db import rest
from .models import Site, AssessmentType, Assessment, Map
from .serializers import AssessmentTypeSerializer, AssessmentSerializer, MapSerializer
from django.conf import settings
rest.router.register_model(
Site,
fields="__all__",
cache="none",
map=[{
'mode': 'list',
... | erikriver/disasters | db/assessments/rest.py | rest.py | py | 1,386 | python | en | code | 0 | github-code | 36 |
28923184781 | #10655 : 마라톤 1
"""
USACO 2014 December Prob 1
O(N^2) is impossible. Use Partial Sum instead.
"""
import sys
input= sys.stdin.readline
#Define manhatten distance
def get_dist(prev, after):
x1, y1 = prev
x2, y2 = after
dist = abs(x1-x2)+ abs(y1-y2)
return dist
N = int(input().rstrip())
coordinates = [... | GuSangmo/BOJ_practice | BOJ/10655.py | 10655.py | py | 1,052 | python | en | code | 0 | github-code | 36 |
16049471546 | import subprocess
import os
import logging
import platform
from tqdm import tqdm
from ffcuesplitter.exceptions import FFMpegError, FFCueSplitterError
from ffcuesplitter.utils import makeoutputdirs, Popen
if not platform.system() == 'Windows':
import shlex
class FFMpeg:
"""
FFMpeg is the base class interf... | jeanslack/FFcuesplitter | ffcuesplitter/ffmpeg.py | ffmpeg.py | py | 8,582 | python | en | code | 21 | github-code | 36 |
7706234863 | from pathlib import Path
from ruamel.yaml import YAML
yaml = YAML()
def get_tasks_files():
matches = []
matches.extend(list(Path(".").rglob("tasks/*.yaml")))
matches.extend(list(Path(".").rglob("tasks/*.yml")))
matches.extend(list(Path(".").rglob("handlers/*.yaml")))
matches.extend(list(Path(".")... | jonsible/iac | find_modules.py | find_modules.py | py | 1,795 | python | en | code | 0 | github-code | 36 |
29004603171 | from meeseeks.context import ChangedRoomMessageCtx, LoginCtx
from meeseeks.serializers import ContextFactory, ContextSerializer
from tests.base import BaseTestClass
class TestContextFactory(BaseTestClass):
"""Tests of ContextFactory class. """
def test_resister(self):
ctx_factory = ContextFactory()
... | tolstoyevsky/meeseeks | tests/test_serializers.py | test_serializers.py | py | 1,607 | python | en | code | 1 | github-code | 36 |
769348877 | from get_notes import get_notes
from model import create_network
import pandas as pd
import numpy
import json
from keras.utils import np_utils
from keras.callbacks import ModelCheckpoint
def train_network():
notes = get_notes()
with open("data/notes.json", "w") as filename:
json.dump(notes, filenam... | tanelxen/riff-composer | train.py | train.py | py | 3,628 | python | en | code | 0 | github-code | 36 |
10227649807 | """The page module holds the Page class for the web page factory"""
from pathlib import Path
from typing import List
from factory.elements import Element
class Page:
"""Page class holds elements of a web page"""
def __init__(self, name: str, route: str, elements: List[Element]) -> None:
"""Create t... | brianjstroh/bstroh | factory/page.py | page.py | py | 1,113 | python | en | code | 1 | github-code | 36 |
36619014009 | # pylint: disable=not-callable, no-member, invalid-name, line-too-long, wildcard-import, unused-wildcard-import, missing-docstring
import torch
import e3nn.point.data_helpers as dh
from e3nn import rs
import numpy as np
torch.set_default_dtype(torch.float64)
def test_data_helpers():
N = 7
lattice = torch.ran... | clementbernardd/ares_fork | lib/ares/e3nn_ares/tests/point/data_helpers_test.py | data_helpers_test.py | py | 3,520 | python | en | code | 0 | github-code | 36 |
26608837899 | # 一万个小时学习Python
# 持续付出 持续输出
# 开发时间:2022/5/21 22:00
#函数内的变量叫局部变量,函数外的变量叫全局变量
#用globe可以把局部变量变成全部变量
def fun(a,b):
global c #1:把局部变量变成全局变量
c=a+b
return c
print(fun(20,30))
print(c)
| wuji8626/py_code | chap12/9variable.py | 9variable.py | py | 327 | python | zh | code | 0 | github-code | 36 |
34014676895 | from flask import Flask, request, abort, render_template, make_response
import json, requests
from StringIO import StringIO
from time import sleep
try:
from metatool import metatool
except ImportError:
import metatool
try:
from metatool import viz
except ImportError:
import viz
try:
from metatool... | CottageLabs/metatool | metatool/web.py | web.py | py | 3,276 | python | en | code | 1 | github-code | 36 |
29935238101 | import numpy as np
import matplotlib.pyplot as plt
import json
import matplotlib as mpl
import matplotlib.cm as cm
import cmocean
from colormaputil import truncate_colormap
def getMaxBracket(minYear, maxYear, data):
curMax = 0
for year in range(minYear, maxYear):
ranges = data[str(year)]['ranges']
... | rosslh/Historical-Tax-Rate-Visualizor | plot.py | plot.py | py | 2,244 | python | en | code | 0 | github-code | 36 |
41709462249 | import unittest
import json
from django.test import TestCase
from datetime import datetime
from utente.models import Utente, Prodotto, ProdottoCarrello, Carrello, Pagamento, Ordine
from vetrine.models import Vetrina, VetrinaAmministratore, ResocontoVendite
# test della creazione di un utente e verifica del relativo c... | MattiaCani/Progetto-ISW | progettoISW/test_unitari/test_models_utente.py | test_models_utente.py | py | 3,801 | python | it | code | 1 | github-code | 36 |
2265860444 | import os
import sys
import importlib
import pkgutil
from contextlib import contextmanager
from typing import TypeVar, Union, Generator
from pathlib import Path
PathType = Union[os.PathLike, str]
T = TypeVar("T")
ContextManagerFunctionReturnType = Generator[T, None, None]
class cached_property(object):
""" A prop... | BorealisAI/DT-Fixup | spider/semparser/common/utils.py | utils.py | py | 2,616 | python | en | code | 15 | github-code | 36 |
16823182799 | '''
author: Ramayan Mardi
email: jaymisra.programmer@gmail.com
=======================================
:about: This is script file of the game,
:name: Flappy Game
:version: 1.0.1
:requirement:
python -> 3.10.0 or upper
pygame -> 2.5.2
This script file controls, all the game related stuff i.e game state, render... | ramayanbindas/Flappy | flappy.py | flappy.py | py | 16,627 | python | en | code | 1 | github-code | 36 |
4412908153 | a,b,x = map(int, input().split())
ok = 0
ng = 10**9+1
while ng-ok > 1:
n = (ok + ng)//2
d = len(str(n))
if a*n + b*d <= x:
ok = n
else:
ng = n
print(ok)
| burioden/atcoder | submissions/abc146/c.py | c.py | py | 172 | python | en | code | 4 | github-code | 36 |
16666146143 | a = input()
mod = "0123456789X"
j = 1
t = 0
for i in range(12):
if a[i] == '-':
continue
t += int(a[i]) * j
j += 1
if mod[t % 11] == a[12]:
print("Right")
else:
a = a[:12] + mod[t % 11]
print(a)
| wLUOw/LuoGu | Lists/ProbList101/P1055/src/main.py | main.py | py | 227 | python | en | code | 0 | github-code | 36 |
19337719477 | import pygame
import math
from global_timer import TimedObject
class BossDeathCutscene(TimedObject):
def __init__(self, map_center_pos, boss) -> None:
self.lifetime = 999990
self.map_center_pos = map_center_pos
self.boss = boss
self.boss.global_timer.attach(self)
self.bos... | jordenskraften/snake-python | boss_death_cutscene.py | boss_death_cutscene.py | py | 3,964 | python | en | code | 0 | github-code | 36 |
3992904999 | #!/opt/local/bin/python
from this import d
from pygel3d import hmesh, graph, gl_display as gl
from os import getcwd
graphs = [
'hand.graph',
'armadillo_symmetric.graph',
'bunny.graph',
'feline.graph',
'fertility.graph',
'warrior.graph']
objs = [
'usai_hand_tri.obj',
'armadillo.obj',
'bunny.obj',
'feline.obj',
'fertil... | janba/GEL | src/demo/FEQ-Remeshing/feq-remeshing-example.py | feq-remeshing-example.py | py | 1,290 | python | en | code | 82 | github-code | 36 |
36339108749 | import random as r
class Player:
def __init__(self):
self.points = 30
self.toughness = 0
self.damage = 0
self.kills = 0
self.update_stats()
self.print_info()
def update_stats(self):
print(f"you have {self.points} points, you can spread them between toug... | Sashabus/homework | game/main.py | main.py | py | 4,252 | python | en | code | 0 | github-code | 36 |
31948081711 | import requests
import streamlit as st
st.title("Weather Report ☁️")
def kelvin_to_celsius(kelvin):
return kelvin - 273.15
def kelvin_to_fahrenheit(kelvin):
return (kelvin - 273.15) * 9/5 + 32
def get_wind_direction(degrees):
directions = ["North", "North-East", "East", "South-East", "South"... | Yashwanth-2701/Weather-Report | app.py | app.py | py | 2,512 | python | en | code | 0 | github-code | 36 |
71335938983 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def rightSideView(self, root: Optional[TreeNode]) -> List[int]:
height = 0
subtree = root
... | architjee/solutions | Leetcode/right side view of binary tree.py | right side view of binary tree.py | py | 932 | python | en | code | 0 | github-code | 36 |
17238007858 | # Q6. Write a program for creation, insertion, deletion operation in files, text files, csv files, excel files, etc.
def read_file(file):
for line in file.readlines():
print(line.rstrip('\n'))
def write_file(file):
n = int(input('Enter no. of line you want to have in file : '))
for i in range(n):
file.... | Sandeepbhatt3287/JMI-MCA | V-sem/PatternMatchingUsingPythonProgramming/LAB_ASSIGNMENTS/Assignment1(29SEP2020)/Solution6A.py | Solution6A.py | py | 1,538 | python | en | code | 0 | github-code | 36 |
74050471784 | import parlai.core.build_data as build_data
import os
from parlai.core.build_data import DownloadableFile
RESOURCES = [
DownloadableFile(
'https://raw.githubusercontent.com/openai/generating-reviews-discovering-sentiment/master/data/test_binary_sent.csv',
'test_binary_sent.csv',
'519cea7ed4... | facebookresearch/ParlAI | parlai/tasks/sst/build.py | build.py | py | 1,576 | python | en | code | 10,365 | github-code | 36 |
71845266663 | from .opt_cards import DCONSTR
def add_dtable(se, key, value):
"""Add a DTABLE entry to the SE and the optmodel
Parameters
----------
key : str
The DTABLE unique key. The algorithm automatically attempts to add
a sufix to prevent repeated keys.
value : float
The value corre... | compmech/structmanager | structmanager/optimization/sol200/edit_structural_element.py | edit_structural_element.py | py | 2,917 | python | en | code | 1 | github-code | 36 |
12755359416 | import json
from loadsmart_elb_operations.elb_operations import *
def elb_healthcheck(client, elbName):
health = True
if elb_validation(client, elbName):
instances_state = instances_health(client, elbName)
if 'OutOfService' in instances_state.values():
health = False
if health:
res = {
'status_co... | hbarajas/loadsmart_sre | app_operations.py | app_operations.py | py | 1,915 | python | en | code | 0 | github-code | 36 |
27048798228 | import zedlib
import pygame
import math
class GameSprite:
def __init__(self, image, x, y):
self.image = image
self.rect = self.image.get_rect()
self.position = zedlib.Position(x, y)
self.x_acceleration = 0.0
self.y_acceleration = 0.0
self.x_velocity = 0.0
se... | JoeZlonicky/ZedLib | zedlib/game_sprite.py | game_sprite.py | py | 3,403 | python | en | code | 0 | github-code | 36 |
19839716589 | from __future__ import print_function
import cv2 as cv
import matplotlib.pyplot as plt
if __name__ == "__main__":
img = cv.imread('images/dog1.jpeg')
gray_img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
dst = cv.equalizeHist(gray_img)
gray_hst = cv.calcHist([gray_img], [0], None, [256], [0, 256])
gray_hs... | AnhVietPham/Deep-Learning | Computer-Vision/opencv-course/histogram.py | histogram.py | py | 683 | python | en | code | 0 | github-code | 36 |
35898596942 | from create_dataframe import create_dataframe
import numpy as np
meta_data = create_dataframe()
def split_save():
# 25 images per class
value = meta_data.groupby('category_name', group_keys=False).apply(lambda x: x.sample(n=25, replace=False))
value.sort_index(inplace=True)
meta_data.drop(value.index,... | mckunkel/TestDistilling | data_stuff/split_save_data.py | split_save_data.py | py | 667 | python | en | code | 0 | github-code | 36 |
37706551416 | import os
import time
import shutil
import unittest
import threading
from tadek.core import settings
from tadek.engine import channels
from tadek.engine import testresult
from tadek.engine.testresult import *
from engine import commons
__all__ = ["TestResultTest", "TestResultCoreDumpsTest"]
class OutputThread(thr... | tadek-project/tadek-common | tests/engine/testresult.py | testresult.py | py | 6,191 | python | en | code | 2 | github-code | 36 |
43570030497 | import warnings
from pymysql.tests import base
import pymysql.cursors
class CursorTest(base.PyMySQLTestCase):
def setUp(self):
super(CursorTest, self).setUp()
conn = self.connections[0]
self.safe_create_table(
conn,
"test", "create table test (data varchar(10))",
... | PyMySQL/Tornado-MySQL | tornado_mysql/tests/test_cursor.py | test_cursor.py | py | 1,959 | python | en | code | 408 | github-code | 36 |
30668828069 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
##
# @file genCode.py
# @brief 根据json文件生成错误码头文件以及文档
# 头文件:./release/tuya_error_code.y
# 文档 :./release/tuya_error_code.md
# @author huatuo
# @version 1.0.0
# @date 2021-09-27
# @note 支持参数1修改文件名,如:"base",使用默认命名则传递空:""
# @note 支持参数2传入指定模块列表,参数形式支持如下:
# "... | tuya/tuyaos-development-board-t2 | software/TuyaOS/scripts/error_code/genCode.py | genCode.py | py | 9,935 | python | en | code | 2 | github-code | 36 |
73857162662 |
import math
from SynRD.publication import Publication, Finding, VisualFinding, TAXONOMY
import numpy as np
import pandas as pd
import statsmodels as sm
import statsmodels.stats.weightstats
class Assari2019Baseline(Publication):
DEFAULT_PAPER_ATTRIBUTES = {
'id': 'assari2019baseline',
'length_page... | DataResponsibly/SynRD | SynRD/papers/assari2019baseline.py | assari2019baseline.py | py | 18,601 | python | en | code | 0 | github-code | 36 |
25578075693 | import random
def print_board(b):
print()
print("Board:")
size = len(b)
for i in range(size):
print(b[i], end="")
print()
def main():
board = []
for i in range(8):
board.append(random.randint(0, 9))
print_board(board)
kyle_score = 0
class_score = 0
turn... | romantmanuel/COP2500C | Notes (10-16-23) - PyGame.py | Notes (10-16-23) - PyGame.py | py | 1,145 | python | en | code | 0 | github-code | 36 |
38871003901 | """
Solution of Codechef Problem - Chef on a trip
Problem Code - CHEFTRAV
Link - https://www.codechef.com/problems/CHEFTRAV
"""
import sys
out = sys.stdout
testcases = int(input())
while testcases > 0:
n = int(input())
places = {}
end_city = set([])
for i in range(n):
source = input()
destina... | karanm97/codingProblems | cheftrav.py | cheftrav.py | py | 661 | python | en | code | 0 | github-code | 36 |
10989202262 | import random
#Colgadito es la lista de palabras para jugar
colgadito = ["puma", "chinchilla", "pudu", "huemul", "condor", "güiña", "guanaco"]
#Figura es lo que va mostrando la consecuencia de los errores del jugador
figura = ['''
+++++
|
|
|
====''', '''
+++++
O |
|
|
====''', '''
+++++
O |
| ... | Joaoguzman/PROYECTO-JUEGO-COLGADO | colgado.py | colgado.py | py | 2,959 | python | es | code | 0 | github-code | 36 |
28580043069 | from django.shortcuts import render
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated
from order.models import Order
from order.serializers.order import OrderSerializer
class OrderView(generics.ListCreateAPIView):
queryset = Order.objects.all()
serializer_class = Orde... | PROFabdalla/payment_app | order/views.py | views.py | py | 999 | python | en | code | 0 | github-code | 36 |
734577939 |
# https://randerson112358.medium.com/email-spam-detection-using-python-machine-learning-abe38c889855
# https://blog.textedly.com/spam-text-message-examples
#Import libraries
import numpy as numpy
import pandas as panda
import nltk
from nltk.corpus import stopwords
import string
#Load the data
# dataFrame = panda.... | hatem-elsheref/email-spam-detection | main.py | main.py | py | 3,394 | python | en | code | 0 | github-code | 36 |
71873734503 | import pygame as pg
pg.init()
COLOR_INACTIVE = pg.Color('lightskyblue3')
COLOR_ACTIVE = pg.Color('dodgerblue2')
FONT = pg.font.Font(None, 32)
class InputBox:
def __init__(self, x, y, w, h, text=''):
self.rect = pg.Rect(x, y, w, h)
self.color = COLOR_INACTIVE
self.text = text
s... | andreidumitrescu95/Python-Sorting-Algorithm-Visualizer | Helper/input_helper.py | input_helper.py | py | 1,768 | python | en | code | 3 | github-code | 36 |
14625474319 | from django.shortcuts import render,redirect
from .forms import RegisterForm
# Create your views here.
def register(request):
# 从 get 或者 post 请求中获取 next 参数值
# get 请求中,next 通过 url 传递,即 /?next=value
# post 请求中,next 通过表单传递,即 <input type="hidden" name="next" value="{{ next }}"/>
redirect_to = request.POST.... | rainy0824/blog_project | users/views.py | views.py | py | 1,686 | python | zh | code | 0 | github-code | 36 |
14159945677 | """the errors of the two systems are compared"""
with open("../../iob_outputs_from_html/emBERT_eval/result.conllup", "r", encoding="utf-8") as f:
lines = f.readlines()
error = 0
sent = ""
diff = list()
for i in range(len(lines)):
if i == 0:
continue
if lines[i] != "\n":
if lines[i + 1].spl... | huspacy/huspacy-resources | scripts/ner_data_analysis/spacy_bert_diff/visualization/spacy_bert_check_differences.py | spacy_bert_check_differences.py | py | 1,516 | python | en | code | 0 | github-code | 36 |
43319941106 | import torch
import shutil
import torch.optim as optim
import numpy as np
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from utils import AverageMeter, min_max_normalize, save_checkpoint
from dataset import DAEDataset
from model import ModelRec
transform = transforms... | ANnick2908/Data_Science_Projects | Denoising_Autoencoder/train.py | train.py | py | 2,622 | python | en | code | 0 | github-code | 36 |
7175166932 | import matplotlib.pyplot as plt
import cv2
import time
start_time = time.time()
# Titik awal
x1 = 1
y1 = 7
# Titik Akhir
x2 = 7
y2 = 15
dy = y2-y1
dx = x2-x1
step = dx if dx > dy else dy
xInc = dx / step
yInc = dy / step
x=x1
y=y1
len=y2+x2
# x axis value list.
x_number_list = []
x_number_list.append(x1)
... | albirrkarim/dda-bresenham | dda.py | dda.py | py | 966 | python | en | code | 0 | github-code | 36 |
25544326890 | import numpy as np
import cvxpy as cp
import matplotlib.pyplot as plt
# double integrator
# state is [x, vx, y, vy]
T = 0.1 # timestep in seconds
A = np.kron(np.eye(2),np.array([[1, T], [0, 1]]))
B = np.kron(np.eye(2), np.array([[0.5*T**2], [T]]))
class MPC:
def __init__(self, prediction_horizon = 10, number_of... | dev10110/interagent_mpc | no_obstacle_mpc.py | no_obstacle_mpc.py | py | 2,690 | python | en | code | 0 | github-code | 36 |
70848016743 | import sys
import os.path
import re
import warnings
from io import StringIO
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
from patsy import dmatrices
import six
class PerfData():
__DATETIME_HEADER__ = "start-time"
_... | cloudfoundry/credhub-perf-release | src/headroomplot/headroomplot.py | headroomplot.py | py | 5,644 | python | en | code | 0 | github-code | 36 |
71739250344 | #!/usr/bin/python3
"""
This module defines a class called Square.
"""
class Square:
"""
This class represents a square shape.
"""
def __init__(self, size=0):
"""
Initializes a new instance of the Square class
Args:
size (int): The side length of the square.
Rai... | JAMBITI/alx-higher_level_programming | 0x06-python-classes/2-square.py | 2-square.py | py | 641 | python | en | code | 0 | github-code | 36 |
74537107943 | import micropython
import machine
# Allocate memory for the case of an exception was rised in an IRQ
micropython.alloc_emergency_exception_buf(100)
class Encoder:
"""
Scheduler is used for soft IRQ, unfortunately, on rp2 the deph is set to 8
which appears to make lose signals
"""
def ... | bdelaup/upy_class_libs | libs/romi2/encoder.py | encoder.py | py | 1,755 | python | en | code | 2 | github-code | 36 |
4100346454 | from django.urls import path
from myapp import views
urlpatterns = [
path('project/create', views.projectcreate),
path('project/show', views.projectshow),
path('employee/create', views.employeecreate),
path('employee/show', views.employeeshow),
path('project/view/<int:id>', views.projectview, name='proj... | mudassir-cm/m2m | myapp/urls.py | urls.py | py | 802 | python | en | code | 0 | github-code | 36 |
2927331509 | import os
import time
from pathlib import Path
template = "#include<bits/stdc++.h>\n#define mod 1000000007\n#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)\n#define pb push_back\n#define mp make_pair\n#define ll long long int\n#define fi first\n#define se second\n#define vll std::vector<ll>... | Aditya20kul/450-DSA-questions | createFile.py | createFile.py | py | 1,387 | python | en | code | 2 | github-code | 36 |
11378633561 | #!/bin/python3
import os
# Complete the sockMerchant function below.
def sockMerchant(n, array):
counts = {}
for item in array:
try:
counts[item] += 1
except KeyError:
counts.update({item: 1})
n_pairs = 0
for key in counts.keys():
n_pairs += counts[key... | scouvreur/hackerrank | interview-prep-kit/warm-up-challenges/sock_merchant.py | sock_merchant.py | py | 579 | python | en | code | 1 | github-code | 36 |
74644371943 | import sys
import pygame
import pygame.gfxdraw
class Rubrika:
def __init__(self, x, y, a, b, szin, szoveg):
self.x = x
self.y = y
self.a = a
self.b = b
self.szin = szin
self.szoveg = szoveg
def negyzet(self, kepernyo):
return pygame... | pdoszpod11/SchoolProjects | WhoWantsToBeAMillionaire/Game/NHF_UI_v1.py | NHF_UI_v1.py | py | 12,337 | python | hu | code | 0 | github-code | 36 |
670561323 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import paths as paths
from DataBaseProxy import DataBaseProxy
from util import Utility
util = Utility()
dbp = DataBaseProxy()
year = 2017
month = 5
day = 6
#km macchine per enjoy e car2go in una settim... | michelelt/MyTool | Analysis/parkingsAnalysis.py | parkingsAnalysis.py | py | 8,244 | python | en | code | 0 | github-code | 36 |
19107043906 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 10:54:37 2018
@author: Administrator
"""
from greedyBandit import GreedyBandit
from decGreedyBandit import DecGreedyBandit
from optiBandit import OptiBandit
from UCBBandit import UCBBandit
from TSBandit import TSBandit
import matplotlib.pyplot as plt
... | JJ-Tom-Li/Reinforcement-Machine-Learning | Programming Project -1 -MAB/main.py | main.py | py | 1,356 | python | en | code | 0 | github-code | 36 |
36979603033 | def add_numbers(n1, n2):
result = n1+n2
return result
def multiply_numbers(n1, n2):
result = n1 * n2
return result
num1 = float(input("enter first num:"))
num2 = float(input("enter second num:"))
summ = add_numbers(num1, num2)
product = multiply_numbers(num1, num2)
print("the sum of the two numbers is:", summ,... | EndesewB/Python3 | funcPractice.py | funcPractice.py | py | 354 | python | en | code | 0 | github-code | 36 |
975733751 | """
File: model_ops.py
Author: Tomáš Daniš
Login: xdanis05
Description: Module holding functions implementing model operations - such as training, predicting or evaluating
"""
import torch.nn as nn
import torch.nn.utils as tut
import torch.optim as optim
import torch
from tqdm import tqdm
import torchtext.data as tor... | AgiNetz/FIT-VUT-projects | Thesis - Machine Comprehension using Commonsense Knowledge/Source codes/Baseline/model_ops.py | model_ops.py | py | 4,576 | python | en | code | 0 | github-code | 36 |
15239706297 | # Downloadable Modules
import os
import socket
import argparse
import atexit
import time
from threading import Thread
# Self-made Modules
import database_utility as db_util
from ping_utility import ping_service
from handlers import conn_handler
import schemas
import config
# Startup of server
# Initialize Variabl... | arhamchopra/decentralized-file-storage | server/server.py | server.py | py | 2,094 | python | en | code | 1 | github-code | 36 |
22776733908 | import json
import sys
import os
import exceptions as e
import dev
from decouple import config
import time
import itemdat
import pathlib
pathto = str(pathlib.Path().absolute())
devmsg = dev.Dev.SendMessage()
devmsg("Setting up RPG module...")
class RPG():
def __call__(self):
self.start_up()
pass
... | Maxuss/XAI | rpg.py | rpg.py | py | 11,367 | python | en | code | 1 | github-code | 36 |
22905033389 | import requests
import json
import re
req=requests.Session()
header={
"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
}
url="http://www.122.gov.cn/m/map/select"
page=req.get(url=url,headers=header)
print(page.text)
patte... | nanxung/testProject | test.py | test.py | py | 585 | python | en | code | 0 | github-code | 36 |
17580721838 | import sqlite3
import sys, os
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6 import *
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from utils.database_table_setup import *
from utils.promo_management_sql import *
class Prom... | roymagtibay/pos_system | promo/admin/promo_management.py | promo_management.py | py | 6,249 | python | en | code | null | github-code | 36 |
42186826955 | import discord
from discord.ext import commands
from discord.utils import get
import json
from discord.ext.commands import has_permissions, MissingPermissions
import asyncio
bot = commands.Bot(command_prefix="!")
@bot.event
async def on_ready():
print("Ticket bot running...")
@bot.command()
async def help_me(ctx... | stevewoz1234567890/disocrd-bot | ticket_bot.py | ticket_bot.py | py | 5,611 | python | en | code | 0 | github-code | 36 |
27861498270 | import os
def search_cells(cells, target, size=0):
return_list = []
if size == 0:
size = len(cells)
cell = cells[0]
remaining_cells = []
if len(cells) > 1:
remaining_cells = cells.copy()
remaining_cells.remove(cell)
for value in cell:
remain_tar = targe... | Tbilgere/killer_sudoku_cell_lister | killer_sudoku_cell_lister.py | killer_sudoku_cell_lister.py | py | 2,662 | python | en | code | 0 | github-code | 36 |
34377275517 | """
Pipeline modules to prepare the data for the PSF subtraction.
"""
import time
import warnings
from typing import Optional, Tuple
import numpy as np
from astropy.coordinates import EarthLocation
from astropy.time import Time
from typeguard import typechecked
from pynpoint.core.processing import ProcessingModule... | PynPoint/PynPoint | pynpoint/processing/psfpreparation.py | psfpreparation.py | py | 27,088 | python | en | code | 17 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.