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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38650650381 | class sv():
def __init__(self,name,x,y) -> None:
self.name = name
self.x = x
self.y = y
def __str__(self) -> str:
return f'{self.name} {self.x} {self.y}'
n = int(input())
ds = list()
while n > 0:
name = input()
a = list(map(int,input().split()))
s = sv(name, a[0]... | LinhNguyenDuc2002/Python-practice | OPP/bxh.py | bxh.py | py | 425 | python | en | code | 0 | github-code | 54 |
25886301855 | #!/usr/bin/env python3.4
########################################
#------------Donjon & Python-----------#
#---------------Personnage-------------#
#--------------------------------------#
#-----------------v1.0-----------------#
#--------------------------------------#
#------------Tristan Le Saux-----------#
#------... | Hugal31/Donjon-Python | Personnage.py | Personnage.py | py | 6,785 | python | fr | code | 1 | github-code | 54 |
18155984302 | """
DockCI - CI, but with that all important Docker twist
"""
# TODO fewer lines somehow
# pylint:disable=too-many-lines
import functools
import logging
import sys
import tempfile
from collections import OrderedDict
from enum import Enum
from itertools import chain
import docker
import py.path # pylint:disable=imp... | sprucedev/DockCI-Agent | dockci/models/job.py | job.py | py | 32,650 | python | en | code | 0 | github-code | 54 |
71673308001 | # SINGLETON
gameObjects = {}
def retrieveOrCrateObject(
# basic props
name, descr="no description",
# self props
grabbable=False, breakable=False, killable=False, talks=False,
opens=False, closed=False, locked=False, accepts=False,
# interaction with other objects props... | antillgrp/Maryville-University-Online-Master-s-in-Software-Development | SWDV-600-Intro-to-Programming/Week-8-Adventure-Game-Project/The-Oblemurs-Mansion.py | The-Oblemurs-Mansion.py | py | 29,135 | python | en | code | 1 | github-code | 54 |
12785791910 | """
Contains helper methods and classes for social media upload and data gathering
"""
import time
from contextlib import contextmanager
from datetime import timedelta
from io import BytesIO
from pathlib import Path
from typing import Union, Dict
from pyfacebook import GraphAPI, FacebookError
from PIL.Image import Ima... | thecodingbob/framebot | src/framebot/social.py | social.py | py | 7,560 | python | en | code | 2 | github-code | 54 |
12357632807 | import json
import os
import requests
import sys
# network programming
BASE_URL = "https://canvas.ltu.se/api/v1"
COURSE_ID = 19899
# required Environment Variables
# CANVAS_TOKEN
# Get the value of the "token" environment variable
CANVAS_TOKEN = os.environ.get("CANVAS_TOKEN")
# Check if the variable is set
if CANVA... | NMLami/course103 | test_canvas_users.py | test_canvas_users.py | py | 1,396 | python | en | code | 0 | github-code | 54 |
14611796319 | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import re
import gc
import uuid
from PIL import Image
def get_jpeg_file_yield(dirpath):
"""
指定したディクレクトリからJPEGファイルを列挙してパスを取得する(yield)
"""
file_pattern = re.compile(r'.+\.(jpg|JPG|jpeg|JPEG)$')
for filename in os.lis... | TakuroFukamizu/yhd2018-ai | resize.py | resize.py | py | 2,041 | python | en | code | 0 | github-code | 54 |
40661920284 | from wtforms import Field
from wtforms.widgets import TextInput
from app.models import Tag
class TagListField(Field):
widget = TextInput()
def __init__(self, label=None, validators=None,
**kwargs):
super(TagListField, self).__init__(label, validators, **kwargs)
def _value(self)... | giligiliduang/new_zhidao | app/main/forms/custom_fields.py | custom_fields.py | py | 1,508 | python | en | code | 0 | github-code | 54 |
41354398911 | """
Contents:
get_group_and_neighborhood_information
get_neighborhood_information
"""
#############
## LOGGING ##
#############
import logging
from astrobase import log_sub, log_fmt, log_date_fmt
DEBUG = False
if DEBUG:
level = logging.DEBUG
else:
level = logging.INFO
LOGGER = logging.getLogger(__name... | lgbouma/cdips | cdips/vetting/initialize_neighborhood_information.py | initialize_neighborhood_information.py | py | 12,901 | python | en | code | 3 | github-code | 54 |
25033571728 | from typing import List, Optional, Tuple
import numpy as np
import mindspore
from mindspore import Tensor
from mindspore.ops import operations as P
import mindspore.common.dtype as mstype
def generate(
model=None,
config=None,
input_ids: Optional[Tensor] = None,
input_mask: Optional[Te... | viewsetting/MindSpore-GPT2 | src/process_gpt2_output.py | process_gpt2_output.py | py | 15,061 | python | en | code | 5 | github-code | 54 |
15689985915 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
i... | nischalshrestha/automatic_wat_discovery | Notebooks/py/amolgijare/titanic-notebook/titanic-notebook.py | titanic-notebook.py | py | 7,393 | python | en | code | 2 | github-code | 54 |
15611155461 | # V0
# V1
# http://bookshadow.com/weblog/2017/08/30/leetcode-path-sum-iv/
class Solution(object):
def pathSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
dmap = {1 : 0}
leaves = set([1])
for num in nums:
path, val = num / 10, num % 10... | yennanliu/CS_basics | leetcode_python/Breadth-First-Search/path-sum-iv.py | path-sum-iv.py | py | 2,610 | python | en | code | 69 | github-code | 54 |
37843128589 | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:wchao118
@license: Apache Licence
@file: utils.py
@time: 2019/07/08
@contact: wchao118@gmail.com
@software: PyCharm
"""
from python_speech_features import mfcc
import scipy.io.wavfile as wav
import random
import numpy as np
import os
import config
all_a... | think-chao/ASR | utils.py | utils.py | py | 3,079 | python | en | code | 0 | github-code | 54 |
11024202498 | from isbnlib import *
import sys
import csv
isbns = []
with open('/home/jgibbs/PycharmProjects/isbn_organizer/history-1494170264404.csv') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in spamreader:
try:
#print(row[0])
#print(meta(row[0]))
... | whachyzachy/bookDB | main_file.py | main_file.py | py | 1,232 | python | en | code | 0 | github-code | 54 |
3908592910 | h, w = map(int, input().split())
A = [[int(i) for i in input().split()] for j in range(h)]
R_sum = [sum(i) for i in A]
C_sum = [0]*w
for i in range(w):
C_sum[i] = sum([r[i] for r in A])
for i in range(h):
print(' '.join(map(str, [R_sum[i]+C_sum[j]-A[i][j] for j in range(w)])))
| yudai1102jp/atcoder | typical90/004.py | 004.py | py | 288 | python | en | code | 0 | github-code | 54 |
17414189898 | #Crie um programa que leia uma lista de números do usuário e exiba a soma desses números.
num = int(input('Digite a quantidade de números que irão ser inseridos: '))
#inicia a lista vazia
nums = []
#pede pra inserir os números
for i in range(num):
#pede pra digitar um por um
n = int(input('Digite o... | ferreirabatistamariaeduarda/N1---Lista-1---Python-B-sico | Questão 6.py | Questão 6.py | py | 470 | python | pt | code | 0 | github-code | 54 |
28784986679 | from bisect import bisect_left, bisect_right
def count_by_range(array, l_value, r_value):
l_idx = bisect_left(array,l_value)
r_idx = bisect_right(array,r_value)
return r_idx - l_idx
def solution(words, queries):
answer = []
array = [[] for _ in range(10001)]
reversed_array = [[] for _ in r... | 82KJ/Coding-Test-with-python | ====/BinarySearch/실전문제/Q30_가사검색.py | Q30_가사검색.py | py | 861 | python | en | code | 0 | github-code | 54 |
30843818404 | #!/usr/bin/env python
import csv
class PowerManagement():
"""
Parser class for Linear Technologies ISP Hex file
"""
record_type = { "PMBUS_WRITE_BYTE": 0x01,
"PMBUS_WRITE_WORD": 0x02,
"PMBUS_WRITE_BLOCK": 0x03,
"PMBUS_READ_BYTE_EXPECT": 0x04... | alextrem/pypm | pm/powermanagement.py | powermanagement.py | py | 2,063 | python | en | code | 0 | github-code | 54 |
8279837536 | from textblob import TextBlob
text = open(r"2nd Sem\NLP\alicespellingMistake.txt")
textString = ""
for i in text:
textString += i + " "
print('Text with error: ')
print(textString)
textString = TextBlob(textString)
correctedText = textString.correct()
print('\nCorrected Text:')
print(corre... | ChristyBinu-4/Lab-assignments | 2nd Sem/NLP/9.spellingCorrector.py | 9.spellingCorrector.py | py | 329 | python | en | code | 0 | github-code | 54 |
45050571892 | import sys
import time
from container import Container
# Ввод аргументов командной строки.
if len(sys.argv) != 5:
print("Incorrect command line! You must write:\n"
" main -f infile outfile01 outfile02\n"
" Or:\n"
" main -n number outfile01 outfile02\n")
exit(1)
print("S... | Michaelkh20/ACS_Khoollgm_Mikhail | Task_3/main.py | main.py | py | 1,883 | python | en | code | 0 | github-code | 54 |
4258126133 | import math
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
from tensorflow.keras.initializers import Constant
from hanser.models.layers import Conv2d, Norm, Act, Linear, NormAct, Identity, GlobalAvgPool, Dropout
from hanser.models.modules import... | sbl1996/tfnas | tfnas/models/legacy/resnetpp/search.py | search.py | py | 7,947 | python | en | code | 0 | github-code | 54 |
23224587085 | # variant 8
import math
print('Hi there, let\'s do our second task! (Perimeter, Diagonal length)')
length = int(input('Enter the length of the rectangle: '))
print('Good!')
width = int(input('Enter the width of the rectangle: '))
perimeter = (length + width) * 2
diagonal = math.sqrt(length ** 2 + width ** 2)
prin... | vovakpro13/PythonLabs | Lab_1/task_2.py | task_2.py | py | 432 | python | en | code | 0 | github-code | 54 |
19796510261 | '''List dependency'''
origlist =[40, 50 , 60, 70]
newlist = [origlist] * 3
origlist[1] = 99
newlist
'''Pay attention on lista3'''
lista1 = ["carro", "barco"]
lista2 = [lista1] * 3
lista3 = lista1 * 3
lista1[1] = "metrô"
| renatamuy/pythonnoob | list_dependency.py | list_dependency.py | py | 245 | python | en | code | 0 | github-code | 54 |
5519114812 | from __future__ import absolute_import, print_function
from typing import AnyStr
import tweepy
import datetime
import json
from textblob import TextBlob
class StreamListener(tweepy.StreamListener):
def __init__(self, tag, tweet_tag_store):
super().__init__()
self.tweet_tag_store = tweet_tag_store
self.tag =... | amanjaiswalofficial/youter | backend/app/custom/twitter_listener.py | twitter_listener.py | py | 1,645 | python | en | code | 0 | github-code | 54 |
35540639230 | from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse, Http404
from django.views import generic
from django.views.decorators.http import require_http_methods
from django.db.models import Q, FilteredRelation
from django.db.models import Sum, F, Func, Value, CharField, Coun... | arrivealive/masuda-deleter | backend/python/src/masuda/web/views/graph_views.py | graph_views.py | py | 2,737 | python | en | code | 0 | github-code | 54 |
2119170010 | from django.conf.urls import url
from . import views
urlpatterns=[
# url(r'index/',views.hello),
# url(r'test/',views.test),
url(r'add',views.add,name='add'),
url(r'ado',views.ado,name='ado'),
url(r'xs',views.xs,name='xs'),
url(r'xq/(?P<pk>[0-9]+)',views.xq,name='xq'),
url(r'shanchu/(?P<pk>... | wuyunfeicc/python | blog/boke/urls.py | urls.py | py | 475 | python | en | code | 1 | github-code | 54 |
11228322386 | from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def get_largest_prime_factor(): # 주소창에서 값을 받아와 num 변수에 저장해주는 함수
num = int(request.args.get("input", "")) # input= 으로 값을 받아올 수 있게 해줌
largest_prime_factor = rtn_largest_prime_factor(num)
return str(largest_prime_factor... | Leejooyoon/primefactor | prime_factor.py | prime_factor.py | py | 1,342 | python | ko | code | 0 | github-code | 54 |
24538904941 | from PyQt5.QtGui import QPixmap
from PySide2.QtGui import QPainter
from PySide2.QtWidgets import QApplication, QMessageBox, QGraphicsView
from PySide2.QtUiTools import QUiLoader
from PySide2.QtCore import QFile, QRectF
class Stats:
def __init__(self):
qFile_stats = QFile("../../QT Designer/first_alter.ui... | Jqlong/pythonTest | PythonQT/test.py | test.py | py | 832 | python | en | code | 0 | github-code | 54 |
8859239263 | import pathlib
from setuptools import find_packages, setup
import background_process
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / "README.md").read_text(encoding="utf-8")
with open("requirements.txt") as f:
requireds = f.read().splitlines()
setup(
install_requires=requireds,
... | HaiND94/CHANGE_BACKGROUND_VIDEO | setup.py | setup.py | py | 847 | python | en | code | 0 | github-code | 54 |
501592241 | import pendulum
import logging
from furl import furl
from typing import Tuple
from typing import Union
from typing import Iterator
from share.harvest import BaseHarvester
logger = logging.getLogger(__name__)
PAGE_SIZE = 25
NSF_FIELDS = [
'id',
'agency',
'awardeeCity',
'awardeeCountryCode',
'aw... | CenterForOpenScience/SHARE | share/harvesters/gov_nsfawards.py | gov_nsfawards.py | py | 2,713 | python | en | code | 97 | github-code | 54 |
42418493031 | from scrapers.config import PAGE_URLS
from scrapers.scraper import download_single_page
from scrapers.utils import timer
@timer
def download_many():
count = 0
for url in PAGE_URLS():
download_single_page(url)
count += 1
print("All downloaded!")
return count
if __name__ == '__main... | Xupeiyi/burning_straws | scrapers/serial.py | serial.py | py | 356 | python | en | code | 0 | github-code | 54 |
30933220612 | import urllib.request
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
BASE_URL = "https://pokemoncries.com/"
for i in range(905):
print(f'downloading cry {i + 1} of 905...')
if i <= 648:
urllib.request.urlretrieve(f"{BASE_URL}/cries-old/{i + 1}.mp3", f'C:\\Users\\natanie... | natanfrost/pokedex | src/assets/cries/poke-cries-download.py | poke-cries-download.py | py | 527 | python | en | code | 0 | github-code | 54 |
12987759932 | """
This is the module which gives a report for the seller with a given adress,
surface, taxe, rework, etc.
"""
# import libraries
import streamlit as st
def Detail_report():
"""
This function is printing a report for the seller with a given adress,
surface, taxe, rework, etc.
:return: results and p... | FredericGodest/Immo-insights | details.py | details.py | py | 5,849 | python | fr | code | 1 | github-code | 54 |
17347545080 | from pathlib import Path
from PyQt5.QtWidgets import (
QHBoxLayout,
QPushButton,
QWidget,
QAction,
QSizePolicy,
QVBoxLayout,
QFileDialog
)
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QSize
from PyQt5 import QtWidgets
from constant.enums import ArchType, PanelMode
from controller... | s-triar/tooth-aligner | view/toolbar_top/save_load_project.py | save_load_project.py | py | 4,066 | python | en | code | 0 | github-code | 54 |
25968831057 | from bs4 import BeautifulSoup
file = open("./Google.html", "rb")
html = file.read().decode('utf-8')
bs = BeautifulSoup(html, "html.parser")
# print(bs.title)
# 1. Tag: the first one eg: bs.title
# 2. NavigatableString: eg: bs.title.string
# 3. BeautifulSoup: entire file eg: bs
# 4. Comment: without comment eg: bs.... | zhu-yifang/crawler | test/testBS4.py | testBS4.py | py | 1,371 | python | en | code | 0 | github-code | 54 |
73168410082 | # encoding: utf-8
from flask_restful import Resource, request
from flask import g
from app import db, auth
from app.models import User, Article
from app.etc import success_msg, fail_msg
class set_article(Resource):
'设置文章能否被评论'
@auth.login_required
def post(self):
data = request.get_json(force=Tr... | Oreadox/blog | app/api/set_article.py | set_article.py | py | 789 | python | en | code | 0 | github-code | 54 |
43909858562 | #-*- coding:utf-8 -*-
import datetime,random,hashlib,md5
class zzdibang:
def __init__(self):
self.dbd=dbd
def company_list(self,frompageCount,limitNum,name='',group_id="",company_id=""):
sqls=''
argument=[]
if name:
sqls+=' and a.name like %s'
argumen... | cash2one/zzpython | dibang/dibang/func/dibang_function.py | dibang_function.py | py | 38,157 | python | en | code | 0 | github-code | 54 |
9840432899 | from stepper_motor import Stepper
from screen import Screen
from camera import CameraSystem
from time import sleep
import sys
import os
import subprocess
import RPi.GPIO as GPIO
class Smart_Owl():
def __init__(self, pin_def, step_seq):
self.step_seq = step_seq
self.stepper_L = Stepp... | having11/smart-owl-robot | smart_owl.py | smart_owl.py | py | 1,231 | python | en | code | 0 | github-code | 54 |
12231850969 | def solution(progresses, speeds):
answer = []
last = 0 #이전 작업의 배포일
for p, s in zip(progresses, speeds):
div, mod = divmod(100-p, s) #몫, 나머지 구하기
if mod != 0: #나머지가 있으면
div += 1 #배포일 +1
if last >= div: #이전 기능보다 먼저 개발된 경우
answer[-1]+=1 #이전 작업 배포일에 함께 배포
e... | Algo-Git/Code | 40차시/PRO_기능개발/PRO_기능개발_kdy.py | PRO_기능개발_kdy.py | py | 580 | python | ko | code | 3 | github-code | 54 |
11671289937 | #!/usr/bin/env python3
#
# In this assignment, you write a program that brute-forces the
# closest vector problem (CVP) as shown in Chapter 7 (Lattices).
# You implement the scenario shown in Figures 2 to 4:
#
# - We operate on a two-dimensional Cartesian coordinate system
# - Distance is measured as Euclidean distance... | RichardRiss/Workshop_Cryptographie | 10_post_quantum_cryptography/cvp.py | cvp.py | py | 2,812 | python | en | code | 0 | github-code | 54 |
43602278706 | import sys
import os
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = r'C:\Program Files\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Program Files\Python36\tcl\tk8.6'
buildOptions = {"include_files": [r'C:\Program Files\Python36\DLLs\tcl86t.dll',
r'C:\Prog... | paulpan05/geocalculator | setup.py | setup.py | py | 1,041 | python | en | code | 0 | github-code | 54 |
877616519 | import os
import tempfile
import shutil
import time
from unittest import mock
from unittest.mock import MagicMock
from munch import Munch
import pytest
from copr_backend.exceptions import CoprSignError, CoprSignNoKeyError, CoprKeygenRequestError
from copr_backend.sign import (
get_pubkey, _sign_one, sign_rpms_in_... | fedora-copr/copr | backend/tests/test_sign.py | test_sign.py | py | 13,109 | python | en | code | 95 | github-code | 54 |
338790752 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | raymondEhlers/OVERWATCH | doc/conf.py | conf.py | py | 7,071 | python | en | code | 10 | github-code | 54 |
11535057710 | def computepay(h,r):
if h > 40 :
pay= 40 * r + r * 1.5 * (h - 40 )
else :
pay=r*h
#return 42.37
return pay
hrs = input("Enter Hours:")
rate= input("Enter Rate:")
#p = computepay(10,20)
#print("Pay",p)
p=computepay(float(hrs),float(rate))
print(p)
| walidayada92/python | test.py | test.py | py | 296 | python | en | code | 0 | github-code | 54 |
10975933138 | import sys
sys.stdin = open('input.txt', 'r')
T = int(input())
for tc in range(1,T+1):
p,q,r,s,w = map(int, input().split())
a_res = p*w
if (w-r) > 0:
b_res = q + (w-r)*s
else:
b_res = q
if a_res < b_res:
ans = a_res
else:
ans = b_res
print('#{} {}'.format... | kimsh8337/daliy-coding | 싸피/200214/d2.1284_수도요금경쟁.py | d2.1284_수도요금경쟁.py | py | 330 | python | en | code | 0 | github-code | 54 |
74803271841 | # Fairlearn algorithms and utils
from fairlearn.postprocessing import ThresholdOptimizer
from fairlearn.widget import FairlearnDashboard
def thresholdOptimizer(X_train, Y_train, A_train, model, constraint):
"""
Parameters:
y_train: input data for training the model
X_train: list of ground truths
co... | xmpuspus/parity-fairness | parity/thresholdOptimizer.py | thresholdOptimizer.py | py | 1,801 | python | en | code | 5 | github-code | 54 |
43565132434 | #ssh -i ~/.ssh/ec2key.pem ubuntu@ec2-50-16-62-250.compute-1.amazonaws.com
import sys, site
site.addsitedir('/home/timmyt/.virtualenvs/smarttypes/lib/python%s/site-packages' % sys.version[:3])
sys.path.insert(0, '/home/timmyt/projects/smarttypes')
from smarttypes.config import *
#ubuntu amis: http://alestic.com/
imag... | greeness/SmartTypes | smarttypes/ec2/startinstance_runscript_stopinstance.py | startinstance_runscript_stopinstance.py | py | 780 | python | en | code | 3 | github-code | 54 |
72368213603 | from django.db import models
from django.contrib.auth.models import User
from PIL import Image
# Create your models here.
class UserProfileInfo(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
portfolio_site = models.URLField(
verbose_name='Portfolio Site',
blank=True
... | AlperAKBAS/django-deployment-example | learningusers/basic_app/models.py | models.py | py | 832 | python | en | code | 1 | github-code | 54 |
21959996685 | from oslo_config import cfg
from nova_solverscheduler.scheduler.solvers import constraints
from nova_solverscheduler.scheduler.solvers import costs
from nova_solverscheduler import solver_scheduler_exception as exception
scheduler_solver_opts = [
cfg.ListOpt('scheduler_solver_costs',
defau... | gsaily/QoS-aware-VM-allocation | src/nova-solver-scheduler-master/nova_solverscheduler/scheduler/solvers/__init__.py | __init__.py | py | 2,953 | python | en | code | 1 | github-code | 54 |
22089767666 | from ctypes import create_string_buffer
import struct
"""
Add two audio frames together.
Adapted from pydub/pyaudioop.py.
"""
def add_audio_bytes(b1: bytes, b2:bytes, sample_size):
clip = lambda v : max(min(v, 0x7FFFFFFF), -0x7FFFFFFF)
sample_count = int(len(b1) / sample_size)
result = create_string_buffer... | aaqil-a/discord-audio-gui-bot | utils.py | utils.py | py | 1,189 | python | en | code | 0 | github-code | 54 |
41287173121 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By :
# Created Date:
# version ='1.0'
# ---------------------------------------------------------------------------
from classes.Endereco import Endereco
from classes.PessoaFisica imp... | insper-classroom/refatoracao-de-endereco-pedido-e-criacao-de-testes-JoaoLucasMBC | classes/Pedido.py | Pedido.py | py | 795 | python | pt | code | 0 | github-code | 54 |
2517897885 | import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import log_loss, roc_auc_score
from sklearn.ensemble import RandomForestClassifier
df_train = pd.read_csv("../input/train.csv")
qid_abs_diff = list(abs(df_train["qid1"] - df_train["qid2"]))
df_leakage = pd.D... | sajedjalil/Data-Science-Pipeline-Detector | dataset/quora-question-pairs/Triskelion/an-unusual-informative-feature.py | an-unusual-informative-feature.py | py | 1,680 | python | en | code | 8 | github-code | 54 |
3638791292 | def factorial(n):
'returns n! for input integer n'
res = 1
for i in range(1,n+1):
res *= i
return res
def acronym(phrase):
'return the acronym of the input string phrase'
res = ''
for word in phrase.split():
res += word[0].upper()
return res
def divisors(n):
... | asccharania/learning | python/accumulatorPractice.py | accumulatorPractice.py | py | 717 | python | en | code | 0 | github-code | 54 |
9985364723 | import requests
import json
class greenPapayaDataUtils :
def __init__(self) :
self.infura_url = 'https://nft.api.infura.io/networks/43113/'
self.proj_id = '85e35e212e7c431a838571e469b3c64b'
self.proj_secret = '67760e3a23204a7e84a170d1364e33c0'
# token_address is a String by defau... | papayaverse/demo | .ipynb_checkpoints/greenPapayaDataUtils-checkpoint.py | greenPapayaDataUtils-checkpoint.py | py | 1,808 | python | en | code | 0 | github-code | 54 |
21475995621 | #code1
dr = [1, -1, 0, 0]
dc = [0, 0, 1, -1]
def bfs(r, c):
queue = []
queue.append((r, c))
visited = [[0xfffff] *N for _ in range(N)]
visited[r][c] = 0
while queue:
r, c = queue.pop(0)
for d in range(4):
nr = r + dr[d]
nc = c + dc[d]
h = 0
... | chocolajin/Algorithm-Study | Advanced/5250_최소비용.py | 5250_최소비용.py | py | 2,031 | python | en | code | 0 | github-code | 54 |
32844285446 | import pywikibot
import re
from pywikibot.bot import (SingleSiteBot, ExistingPageBot)
ALEPHBET = (0, 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'יא', 'יב', 'יג', 'יד', 'טו', 'טז', 'יז', 'יח', 'יט', 'כ', 'כא', 'כב', 'כג', 'כד', 'כה', 'כו', 'כז', 'כח', 'כט', 'ל')
class MefarshimToDafBot(SingleSiteBot, ExistingPa... | shalomori123/pywikibot-scripts | mefarshim_gemara/bot mefarshim to daf.py | bot mefarshim to daf.py | py | 2,183 | python | fa | code | 0 | github-code | 54 |
40634226790 | """
Python Back-Up Script
I wrote this script to backup some important files.
It backs up the files to a local folder as well as to an external hard drive.
It creates a new subdirectory which has its name constructed with the current date and time.
"""
import datetime
import os
import shutil
GOOGL... | dcsherman/glycolic-cowbells | backUpScript2.py | backUpScript2.py | py | 3,199 | python | en | code | 0 | github-code | 54 |
31184584972 | r"""Module for the management of turning band fields.
.. codeauthor:: Frédéric Richard <frederic.richard_at_univ-amu.fr>
"""
from afbf.utilities import pi, linspace, zeros, tan, arctan2, cos, unique
from afbf.utilities import log, nonzero, floor, absolute, amax, amin
from afbf.utilities import sqrt, diff, sum, array,... | fjprichard/PyAFBF | afbf/Simulation/TurningBands.py | TurningBands.py | py | 16,551 | python | en | code | 3 | github-code | 54 |
41361869168 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 11:54:19 2019
@author: simranmadhok
"""
import numpy as np
import pandas as pd
MIN_AVG_SCORE = 3
student_scores = pd.read_csv(r"turkiye_student_evaluation.csv")
print("----------INITIAL STUDENT SCORE-------")
print(student_scores)
local = np.ar... | simranmadhok/InstructorPerformanceML | populate_data.py | populate_data.py | py | 663 | python | en | code | 0 | github-code | 54 |
37163163836 | n=int(input())
m=int(input())
graph={}
for i in range(n):
graph[i]=[]
for _ in range(m):
x, y=map(int, input().split(' '))
graph[x].append(y)
graph[y].append(x)
"""print(graph)
b=int(input())
visited=[b]
sosedi=graph[b].copy()
#обход графа в ширину(bfs)
print('bfs')
while sosedi != []:
i=sosedi.pop(... | tea-with-lemon/IU9 | Python/graphs.py | graphs.py | py | 844 | python | en | code | 2 | github-code | 54 |
5782285518 | #!/usr/bin/env python3
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Wrench, Twist, Vector3Stamped, Accel
from sensor_msgs.msg import Imu
from rospy.exceptions import ROSException
# from dutuuv_msgs.msg import AngularVelocityCommand, TorqueCommand
from dutuuv_control.PidController import... | zengyizhe/dutuuv | dutuuv_control/scripts/VelocityController.py | VelocityController.py | py | 5,172 | python | en | code | 0 | github-code | 54 |
18957327103 | import cv2
import numpy as np
import json
from app.source.utils.config import config
import os
class BlankRestorer:
def __init__(self, set_path):
self.scans_path = os.path.join(set_path, 'scans')
os.mkdir(self.scans_path)
with open(os.path.join(set_path, 'generator_data.json'), 'r') as f:
... | NoblFriend/Form-reader-and-evaluator | app/source/modules/restorer.py | restorer.py | py | 2,422 | python | en | code | 0 | github-code | 54 |
26612491440 | from scapy.all import *
import sys
import time
TIME_OUT = 3
ping_address = sys.argv[1]
i = 1
while True:
p = IP(dst=ping_address, ttl=i) / ICMP()
try:
start_time = time.time()
rp =sr1(p,timeout=TIME_OUT,verbose = 0)/ICMP()
end_time = time.time() - start_time
except TypeError:
... | Maozshechtman/NSLookupScript | mytraceroute.py | mytraceroute.py | py | 505 | python | en | code | 1 | github-code | 54 |
71231846881 | """NumpyMemmapImagingExtractor class.
Classes
-------
NumpyMemmapImagingExtractor
The class for reading optical imaging data stored in a binary format with numpy.memmap.
"""
import os
from pathlib import Path
from typing import Tuple, Dict
import numpy as np
from tqdm import tqdm
from ...imagingextractor import ... | catalystneuro/roiextractors | src/roiextractors/extractors/memmapextractors/numpymemampextractor.py | numpymemampextractor.py | py | 3,082 | python | en | code | 10 | github-code | 54 |
18952369559 | NUM_BLOCKS = 26
# mon 8am + 105 hours = fri 5pm
# 105 = 4 * 24hr + (17hr - 8hr)
WEEK_HOURS = 24 * 4 + (17 - 8)
# fri 5pm + 63 hours = mon 8am
WEEKEND_HOURS = 24 * 2 + 24 - (17 - 8)
BLOCK_SIZE = 2
NUM_WEEKENDS = BLOCK_SIZE * NUM_BLOCKS
| mishra-lab/scheduler | src/constants.py | constants.py | py | 238 | python | en | code | 2 | github-code | 54 |
43496053236 | from typing import Callable, Iterable, List, Tuple
import gym
import numpy as np
import tensorflow as tf
from tensorflow.keras import Input, Model
from myrecall.envs import MW_ACT_LEN, MW_OBS_LEN
EPS = 1e-8
LOG_STD_MAX = 2
LOG_STD_MIN = -20
def gaussian_likelihood(x: tf.Tensor, mu: tf.Tensor, log_std: tf.Tensor) ... | Sweety-dm/RECALL | myrecall/sac/models.py | models.py | py | 13,492 | python | en | code | 0 | github-code | 54 |
16047287789 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
from functools import lru_cache
from itertools import permutations, repeat
from typing import Dict, Iterator, Union, List
INPUT_FILE = "input.txt"
NUMBER_OF_BITS = 36
class Program:
def __init__(self):
self.memory = {}
def write_to... | mikeleppane/Advent_of_Code | 2020/Day_14/solution_part2.py | solution_part2.py | py | 3,103 | python | en | code | 0 | github-code | 54 |
22825740845 | import json
import requests
regions = ['Asia','Europe','MEA','New+Zealand','United+States']
hotels = []
def test_hotels_number():
for region in regions:
url = f"https://www.millenniumhotels.com/api/search/destinations?keywords=®ionName={region}"
get_response = requests.get(url)
if get_res... | Linda-test/mhr_scripts | functions/common/pachong.py | pachong.py | py | 674 | python | en | code | 0 | github-code | 54 |
1009041916 | import argparse
import json
def main(args):
train_entity_ids = set()
with open(args.train, 'r') as f:
for line in f:
data = json.loads(line)
train_entity_ids.add(data['entity_id'])
seen = set()
with open(args.eval, 'r') as f, \
open(args.eval + '.seen', 'w') a... | rloganiv/streaming-cdc | scripts/split_unseen.py | split_unseen.py | py | 914 | python | en | code | 3 | github-code | 54 |
34761822358 | from PIL import Image
deltax = 69.3
deltay = 108
currentx = 0
currenty = 0
img = Image.open("allcards.png")
for i in range(4):
for j in range(13):
area = (currentx, currenty, currentx+deltax, currenty+deltay)
cropped_img = img.crop(area)
title=str(i*13+j+1)+".png"
cropped_img.save(title)
currentx += delt... | yassirnajmaoui/JacquesNoir | assets/crop_all.py | crop_all.py | py | 358 | python | en | code | 0 | github-code | 54 |
72945056162 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 19 11:09:40 2021
@author: maelb
"""
def somme(N):
if N > 0:
return N+somme(N-1)
else:
return 0
print(somme(9))
def contientZero(N):
if(N<10):
return N == 0
elif(N%10 == 0):
return True
else:
contientZero(N//10)... | maelbel/L3SPIInfo | programmation_impérative_avancée/Recursivité/récursivité.py | récursivité.py | py | 747 | python | en | code | 1 | github-code | 54 |
4531596914 | #Matheus Collares Rodrigues
from selenium.webdriver.common.by import By
from lib import Lib
from time import sleep
import pyautogui
class TesteUndb (Lib):
URL = 'https://undbclassroom.undb.edu.br/login/index.php#'
__EMAIL_TEXTBOX = By.ID, 'username'
__SENHA_TEXTBOX = By.ID, 'password'
__ACESSAR_BUTTON... | MCollaresR/Projetos_UNDB | TRAB_PY/CASOS_TESTE.py | CASOS_TESTE.py | py | 4,519 | python | en | code | 0 | github-code | 54 |
32570838881 | import copy
import json
import pytest
from randovania.bitpacking import bitpacking
from randovania.bitpacking.bitpacking import BitPackDecoder
from randovania.games.game import RandovaniaGame
from randovania.layout.base.major_items_configuration import MajorItemsConfiguration
def _create_config_for(game: Randovania... | vgm5/randovania | test/layout/test_major_items_configuration.py | test_major_items_configuration.py | py | 2,548 | python | en | code | null | github-code | 54 |
13316036767 | import unittest
from src.core.common.adjustments.whitespace import collapse_whitespace
class UnitTests(unittest.TestCase):
def test_collapse_whitespace(self):
res = collapse_whitespace("test a b c d e \n f")
self.assertEqual("test a b c d e f", res)
if __name__ == '__main__':
suite = unittest.Tes... | stefantaubert/tacotron2 | src/core/common/adjustments/whitespace.tests.py | whitespace.tests.py | py | 413 | python | en | code | null | github-code | 54 |
27414348159 | from asyncio import coroutines
import django
from django import forms
from .models import Producto
class ProductosForms(forms.ModelForm):
class Meta:
model = Producto
fields = ('referencia','nombre', 'cantidadSistema','enTienda','enBloque2','enBloque5')
widgets ={
'referencia':... | adrianvh33/inventario | producto/forms.py | forms.py | py | 2,283 | python | es | code | 0 | github-code | 54 |
3527255822 | from psycopg2 import connect
from psycopg2.extras import execute_values
# Get this from ENV variables or configuration store
config = {
"host": "0.0.0.0",
"dbname": "news",
"user": "root",
"password": "root",
"port": "5432"
}
def main(category: str):
with connect(**config) as conn:
r... | narenaryan/news-denormalizer | migrate_authors.py | migrate_authors.py | py | 1,298 | python | en | code | 0 | github-code | 54 |
73460365280 | from __future__ import print_function
import base64
import functools
import os
import pickle
import re
import requests
import shutil
import socket
import sys
import time
from datetime import datetime
from datetime import timezone
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from ... | evgenytsydenov/python_course | exchanger/engine.py | engine.py | py | 16,575 | python | en | code | 6 | github-code | 54 |
43263723250 | import inspect
from .holders import CommandHolder
from .converters import Converter
from .translations import LocaleEngine
from .exceptions import CheckFailed, FrameworkException
__all__ = ["command", "Command"]
def command(bot=None, **kwargs):
""" Command creation decorator when not using @bot.command """
... | ClarityMoe/Karen | base/commands.py | commands.py | py | 4,449 | python | en | code | 0 | github-code | 54 |
15504279011 | import tensorflow as tf
def sum():
return tf.ones([2,2,2])
def resize_by_axis(image, dim_1, dim_2, ax):
resized_list = []
unstack_img_depth_list = tf.unstack(image, axis = ax)
for i in unstack_img_depth_list:
resized_list.append(tf.image.resize(i, [dim_1, dim_2]))
stack_img = tf.stack(resized_list, axis=ax)
... | mihirp1998/EmbLang | vis_imagine_static_voxels/resize_voxel.py | resize_voxel.py | py | 680 | python | en | code | 5 | github-code | 54 |
33894638860 | def count11(seq):
# define this function and return the number of occurrences as a number
count = 0
for i in range(0,len(seq)-1):
if (seq[i] == seq[i+1] == 1):
count+=1
# insert code to return the number of occurrences of 11111 in the sequence
return count
print(coun... | sudharshanavp/course-assignments | Helsinki_Courses/Building_of_AI/ex7_intermediate.py | ex7_intermediate.py | py | 367 | python | en | code | 1 | github-code | 54 |
30053531497 | import argparse
import os
import pickle
import random
from functools import partial
from multiprocessing import Pool
from pathlib import Path
import numpy
import rdkit
import torch
import tqdm
from models.global_utils import BASELINE_DIR, SMILES_DIR, DATA_DIR
from models.hiervae.src.mol_graph import MolGraph
from mod... | TUM-DAML/MAGNet | models/hiervae/preprocess_hiervae.py | preprocess_hiervae.py | py | 2,537 | python | en | code | 5 | github-code | 54 |
2800318356 | print ("Bem vindo a Calculadora de IMC")
def calcular_imc(peso, altura):
# Fórmula do IMC: IMC = peso / (altura^2)
imc = peso / (altura ** 2)
return imc
def classificar_imc(imc):
if imc < 18.5:
return "Abaixo do peso"
elif 18.5 <= imc < 24.9:
return "Peso normal"
el... | Johnizio/IMC | Calcular IMC.py | Calcular IMC.py | py | 1,148 | python | pt | code | 0 | github-code | 54 |
19156080508 | """ouvidoMusical URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | DiegoCorrea/ouvido_musical-Back | apps/service/urls.py | urls.py | py | 1,399 | python | en | code | 1 | github-code | 54 |
31571103003 | import psycopg2
from models.models import Balance, Transaction
def sql_connection(db_name: str,
db_user: str,
db_password: str,
db_host: str,
db_port: str,
target_session_attrs: str,
sslmode: str):
co... | LucasSteinach/billing | sql/sql_queries.py | sql_queries.py | py | 5,511 | python | en | code | 0 | github-code | 54 |
21434376000 | '''
The algo is used to find the shortest
distanece between all the vertices in a
weighted graph. Cannot be used with
negative edge graphs.
'''
nv = 4
INF = 999
def floyd(G):
dist = list(map(lambda i: list(map(lambda j:j, i)), G))
print(dist)
for k in range(nv):
for i in range(nv):
... | Bruces1998/DSA | graphs/floyd_warshall.py | floyd_warshall.py | py | 824 | python | en | code | 0 | github-code | 54 |
16047411529 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
INPUT_FILE = "input.txt"
def calculate_sum_of_yes_counts():
yes_count = list()
counts = set()
with open(INPUT_FILE, "r") as f_handle:
for line in f_handle:
line = line.rstrip()
if line:
for char in ... | mikeleppane/Advent_of_Code | 2020/Day_6/solution_part1.py | solution_part1.py | py | 634 | python | en | code | 0 | github-code | 54 |
7923681601 | import unittest.mock as mock
from contextlib import contextmanager
from django.conf import settings
from django.db.utils import ConnectionHandler
from django.test.utils import override_settings
from analytics_data_api.tests.test_utils import set_databases
from analyticsdataserver.tests.utils import TestCaseWithAuthen... | eduNEXT/edx-analytics-data-api | analyticsdataserver/tests/test_views.py | test_views.py | py | 2,739 | python | en | code | null | github-code | 54 |
22448925648 | """Строим модель"""
from typing import List, Dict
from keras.models import Model
from data_generator import DataGenerator
def predict(model: Model,
data_generator: DataGenerator):
prediction = [None] * sum(len(data_generator.get_indices_and_lengths(i)) for i in range(len(data_generator)))
for i... | slonoten/deep_nlp | model.py | model.py | py | 1,028 | python | en | code | 0 | github-code | 54 |
26217505358 | from inspect import getmembers, isfunction
from flask import abort, jsonify, request, Response
import calculator as calculator
math_list = [func[0] for func in getmembers(calculator, isfunction)] # List of operations done by the app
def index() -> Response:
"""
Return all the operations that can be done by t... | juliaflach/calculator | routes.py | routes.py | py | 1,094 | python | en | code | 0 | github-code | 54 |
31791548565 | from flask import Flask, jsonify
from flask import Blueprint
from flask import request
import sys,os,boto3,time,math,random
import logging,json
resource_api = Blueprint('resource_api', __name__)
s3_client=boto3.client("s3")
def uniqid(prefix):
m = time.time()
sec = math.floor(m)
ran = random.randint(0,967... | jagriti-hub/flaskapis | test/code/resource.py | resource.py | py | 12,105 | python | en | code | 0 | github-code | 54 |
26204867738 | import numpy as np
import matplotlib.pyplot as plt
# import os
# print(os.listdir('..'))
# collect data
path = '../ex1data2.txt'
X = []
Y = []
with open(path) as f:
# data = f.read().splitlines()
for line in f:
line = line.split(',')
X.append([float(line[0]), float(line[1])])
Y.append(f... | Tran-Nam/training-ARS | ex1/code/ex3.py | ex3.py | py | 559 | python | en | code | 0 | github-code | 54 |
41228488077 | import pytest
from github import UnknownObjectException, GithubException
from rest_framework.exceptions import ValidationError, APIException
from repository_score import check_github
@pytest.mark.parametrize("stargazers_count, forks_count, expected_is_popular", [
(1, 3, False),
(1, 249, False),
(0, 250, ... | Santana94/PopularGithubRepositories | repository_score/tests/test_check_github.py | test_check_github.py | py | 2,560 | python | en | code | 0 | github-code | 54 |
1210221702 | """
01.11.22
실버1
- 단지 번호 붙이기
- 총단지수 출력
- 총단지만큼, 각각 단지내 집의 수를 오름차순으로 정렬하여 한줄씩 출력
-입력
7
0110100
0110101
1110101
0000111
0100000
0111110
0111000
-출력
3
7
8
9
"""
import sys
from collections import deque
# bfs 탐색
def bfs(graph, x, y):
queue = deque()
queue.append((x, y))
graph[x][y] = 0 # 방문 표시
count = 1
... | angelatto/Algorithm | BAEKJOON/1일1솔/2667.py | 2667.py | py | 1,363 | python | ko | code | 0 | github-code | 54 |
42934044981 | import os
import sys
import subprocess
import shutil
import re
import logging
from typing import List
from argparse import ArgumentParser, Namespace
from datetime import datetime
from .git import get_changes_from, get_last_tag
from .text_manipulation import preprocess_commit_messages
from ello.project import ProjectM... | ellotecnologia/ello-sdk | ello/sdk/changelog.py | changelog.py | py | 2,470 | python | en | code | 0 | github-code | 54 |
9517135255 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import tensorflow as tf
import pickle
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatte... | Dmiller313/rv-tensorflow-server | app/src/train_model.py | train_model.py | py | 1,463 | python | en | code | 0 | github-code | 54 |
39935615027 | import appdaemon.appapi as appapi
class Actions(appapi.AppDaemon):
def initialize(self):
self.log("Hello from Actions")
self.bootstrap()
def trigger(self,intent,slots):
if not hasattr(self,intent):
return "Action for {} not defined in webhook".format(intent)
intentfu... | sriramsv/hass-apps | apps/actions.py | actions.py | py | 1,190 | python | en | code | 0 | github-code | 54 |
11821020721 | from scipy.optimize import minimize
import pandas as pd
import numpy as np
import tkinter
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import tkinter.font as tkFont
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
import networkx as nx
from ma... | MuhammetRidvanInce/phD-Thesis | Model_Algoritmalari/DesktopApplication/deneme2.py | deneme2.py | py | 76,389 | python | tr | code | 0 | github-code | 54 |
1976793564 | import time
from fixture.session import SessionHelper
from fixture.coupon import CouponHelper
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class Application:
def __init__(self):
caps = DesiredCapabilities.FIREFOX
caps["marionette"] ... | IlyaSiz/python_training | fixture/application.py | application.py | py | 959 | python | en | code | 0 | github-code | 54 |
2072848082 | #!/usr/local/bin/python
from middlewared.client import Client
from middlewared.client.utils import Struct
import os
import re
import sys
def ldap_conf_ldap(client, ldap_conf):
try:
ldap = Struct(client.call('datastore.query', 'directoryservice.ldap', None, {'get': True}))
except:
sys.exit(0)
... | mactanxin/freenas | src/freenas/usr/local/libexec/nas/generate_ldap_conf.py | generate_ldap_conf.py | py | 2,841 | python | en | code | null | github-code | 54 |
38555618130 | import sys
n = int(raw_input())
wallets = map(lambda x: int(x), raw_input().split())
coinsLeft = sum(wallets)
pos = 0
def move(dir):
sys.stdout.write(dir)
def findClosest(pos, walls):
if coinsLeft == walls[pos]: return None
l = pos
r = pos
while l >= 0 or r < len(walls):
if walls[l] != 0: return l
... | danoctavian/fuckarounds | codeforces/B.py | B.py | py | 841 | python | en | code | 0 | github-code | 54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.