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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18514261079 | from fractions import gcd
N = int(input())
A = tuple(map(int, input().split()))
l = A[0]
for i in range(1, N):
l = l * A[i] // gcd(l, A[i])
l = l - 1
f = 0
for a in A:
f += l % a
print(f)
| Aasthaengg/IBMdataset | Python_codes/p03294/s651202628.py | s651202628.py | py | 199 | python | en | code | 0 | github-code | 90 |
18756162021 | from .data_utils import rev_dict
CONSONANTS = [3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3621, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630]
UPPERS =... | clovaai/dmfont | datasets/thai_decompose.py | thai_decompose.py | py | 3,235 | python | en | code | 124 | github-code | 90 |
5930163929 | def function1():
print("dlfjge")
print("ыыыыы")
function1()
def function2(x):
return 2*x
a = function2(5)
print(a)
def sumtwo(x,y):
return x+y
sa = sumtwo(500,600)
print (sa)
def fun5(some):
print(some)
print("sgawrgwerg")
def fun6():
return 5
def fun8(x):
print(x)
print("krs... | Linar468/ProjectForJob | 28. Python (Introduction)/Functions.py | Functions.py | py | 1,171 | python | ru | code | 1 | github-code | 90 |
8970730036 | import logging.config
from amaascore.tools.csv_tools import csv_stream_to_objects
from amaasutils.logging_utils import DEFAULT_LOGGING
from amaascore.csv_upload.utils import process_normal, interface_direct_csvpath
class Uploader(object):
@staticmethod
def json_handler(orderedDict, params):
Dict = d... | amaas-fintech/amaas-core-sdk-python | amaascore/csv_upload/csv_uploader.py | csv_uploader.py | py | 1,991 | python | en | code | 0 | github-code | 90 |
1442275532 | import pygame
from pygame.sprite import Sprite
class Alien(Sprite):
"""Sebuah class yang merepresentasikan sebuah armada alien."""
def __init__(self, ai_game):
"""Inisiasi alien dan mengatur posisi awal mulainya."""
super().__init__()
self.screen = ai_game.screen
self.settings ... | aggagah/tubes3pp | alien.py | alien.py | py | 1,187 | python | id | code | 0 | github-code | 90 |
18362528939 | n,k = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
ans = 1
div = []
for i in range(1,int(S**0.5)+2):
if S%i == 0:
if S//i != i:
div.append(S//i)
div.append(i)
else:
div.append(i)
div.sort()
L = []
for i in range(len(div)):
cur = div[i... | Aasthaengg/IBMdataset | Python_codes/p02955/s670137868.py | s670137868.py | py | 1,011 | python | en | code | 0 | github-code | 90 |
18038475399 | # dfs
import sys
sys.setrecursionlimit(10**6)
C = ['dream', 'dreamer', 'erase', 'eraser']
S = input()
L = len(S)
def dfs(x, l):
if l == L:
return True
elif l > L:
return False
match = S[l:l+7]
for c in C:
if match.find(c) == 0:
if dfs(c, l+len(c)):
... | Aasthaengg/IBMdataset | Python_codes/p03854/s187519382.py | s187519382.py | py | 389 | python | en | code | 0 | github-code | 90 |
18212720149 | from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = dict()
zeros = 0
for _ in range(N):
a, b = tuple(map(int, input().split()))
if not any((a, b)):
zeros += 1
continue
g = gcd(a, b) * (a // abs(a)) if all((a, b)) else a if a else b
p = a // g, b // g
d[p] = d.get(p, 0) + 1
do... | Aasthaengg/IBMdataset | Python_codes/p02679/s995773418.py | s995773418.py | py | 592 | python | en | code | 0 | github-code | 90 |
2054888141 | #!/usr/bin/python3
# Defines recurse function
import requests as r
def recurse(subreddit, hot_list=[], last=None):
"""
queries the Reddit API for the titles of all a subreddit's hot articles
return: List of the titles, or None if none
"""
g = r.get('https://api.reddit.com/r/{}/hot'
... | Maxastuart/holberton-system_engineering-devops | 0x16-api_advanced/2-recurse.py | 2-recurse.py | py | 947 | python | en | code | 0 | github-code | 90 |
13117496919 | """This file contains my solutions to Leetcode prob lem 215: Kth Largest Element in Array."""
# Quick Select Solution - Hoare's partitioning algorithm
# time complexity: O(n), best and average cases, O(n ^2) worst case
# space complexity: O(1)
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> in... | EricMontague/Leetcode-Solutions | medium/problem_215_kth_largest_element_in_array.py | problem_215_kth_largest_element_in_array.py | py | 2,255 | python | en | code | 0 | github-code | 90 |
2234025998 | import heapq
class Solution:
def minimumEffortPath(self, heights: List[List[int]]) -> int:
visited = set((0, 0))
q = [(0, (0, 0))]
param_x = len(heights) - 1
param_y = len(heights[0]) - 1
target = (param_x, param_y)
while len(q):
required_effort, (x, y) = ... | vyshor/LeetCode | Path With Minimum Effort.py | Path With Minimum Effort.py | py | 1,046 | python | en | code | 0 | github-code | 90 |
33859371378 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
:file:`bin/services/fetch_ris_entries.py` - Fetch the RIS RIPE entries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fetch the whois entries from a whois server.
"""
import ConfigParser
import socket
import redis
import time
from ... | CIRCL/bgp-ranking | bin/services/fetch_ris_entries.py | fetch_ris_entries.py | py | 4,054 | python | en | code | 100 | github-code | 90 |
8473456706 | N, M = map(int,input().split(' '))
N1 = N - 7 # 행을 8개씩 몇번을 계산해야될지.
M1 = M - 7 # 열을 계산
counts, W_B, B_W, board = list(), list(), list(), list()
B = ['B', 'W', 'B', 'W', 'B', 'W', 'B', 'W'] # B 부터 시작하는 리스트 생성
W = ['W', 'B', 'W', 'B', 'W', 'B', 'W', 'B'] # W 부터 시작하는 리스트 생성
answer = 64
# W_B 과 B_W 규칙 8x8 배열 보드 생성
for _ in ... | ji-hun-choi/Baekjoon | 10.브루트포스/01018.py | 01018.py | py | 1,051 | python | ko | code | 1 | github-code | 90 |
70968642536 | #These variables are needed to make local variables in functions global
custom_end=''
homework_end=''
assignment_end=''
test_end=''
quiz_end=''
final_end=''
custom_advance_details=''
def quizzes():
while True:
quiz_weight=input('How much does your quizzes weigh? or if not applicable type n/a ')
... | ksu-is/Will-I-Fail-Calculator | Calculator.py | Calculator.py | py | 15,775 | python | en | code | 0 | github-code | 90 |
17767078453 |
import pathlib
from pprint import pprint
import sqlalchemy as s
import os
import csv
#create desktop directory_path object
def get_path(desktopath:str):
try:
path = pathlib.Path(desktopath)
except FileNotFoundError as e:
print("Incorrect path address to the folder")
return path
def g... | symonkipkemei/file-counter | refilecounter.py | refilecounter.py | py | 3,101 | python | en | code | 1 | github-code | 90 |
72141302376 | '''
Abstraction to achive the Encapsulation (Only provide the application usage to use hiding the implementation details)
so i created the simple LibraryManagement System for understanding
Real world example with explanation:
we all are using the car so if we need t... | BALAVIGNESHDOSTRIX/PYTHON-OOPS_PROGRAMS | Abstract_Encapsulation.py | Abstract_Encapsulation.py | py | 3,493 | python | en | code | 0 | github-code | 90 |
30282053359 | import math
import random
import pylab as plt
import numpy as np
random.seed(0)
def rand(a, b):
return (b - a) * random.random() + a
def make_matrix(m, n, fill=0.0):
mat = []
for i in range(m):
mat.append([fill] * n)
return mat
def sigmoid(x):
return 1.0 / (1.0 + math.exp(-x))
de... | lzm0706/pattern-recognition | nn_batch_main.py | nn_batch_main.py | py | 7,245 | python | en | code | 0 | github-code | 90 |
41824969715 | from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine
from flask import Flask, jsonify, render_template
from flask_cors import CORS
engine = create_engine("sqlite:///ds_salaries.sqlite")
# reflect an existing database into a new model
Base = automap_... | kealvarez/project3 | app.py | app.py | py | 2,634 | python | en | code | 1 | github-code | 90 |
27576225322 | import math
from typing import List
from __init__ import Invoice, Plays
class Performance4Display(object):
def __init__(self, play, audience, amount, volume_credits) -> None:
self.play = play
self.audience = audience
self.amount = amount
self.volume_credits = volume_credits
clas... | twotwo/refactoring-python | ch1/_statement.py | _statement.py | py | 2,289 | python | en | code | 0 | github-code | 90 |
34515930367 | import os
def check_disk():
stat = os.statvfs(os.getcwd())
available_mb = (stat.f_bavail * stat.f_frsize) / (1024.0 ** 2)
total_mb = (stat.f_blocks * stat.f_frsize) / (1024.0 ** 2)
available_percent = available_mb / total_mb * 100
status = available_percent > 2.0
return status
| ministryofjustice/cla_backend | cla_backend/apps/status/healthchecks.py | healthchecks.py | py | 306 | python | en | code | 5 | github-code | 90 |
42669963348 | from django.shortcuts import get_object_or_404
from rest_framework.decorators import api_view, permission_classes
from django.contrib.auth import get_user_model
from rest_framework.permissions import *
from django.http import JsonResponse
from .serializers import *
from movies.models import *
from movies.serializers im... | yr7256/HOLY | final_pjt_back/accounts/views.py | views.py | py | 6,510 | python | ko | code | 1 | github-code | 90 |
5937671720 | class Solution:
def removeDuplicates(self, s: str) -> str:
myStack = []
for char in s:
if len(myStack) != 0 and char == myStack[-1]:
myStack.pop()
else:
myStack.append(char)
return ''.join(myStack)
| AlexanderBlake/Data-Structures-and-Algorithms | 2023/Leetcode/problem1047.py | problem1047.py | py | 295 | python | en | code | 89 | github-code | 90 |
73423474537 | from django.urls import path
from django.contrib.auth.views import LoginView, LogoutView
from. import views
from . import views
app_name = "mitienda"
urlpatterns = [
path('register/', views.register, name='register'),
path('login/', LoginView.as_view(template_name='mitienda/login.html'), name='login'),
... | Donkami04/ecommerce-py | tienda/mitienda/urls.py | urls.py | py | 1,030 | python | en | code | 0 | github-code | 90 |
44872199178 | import sys
num = int(sys.stdin.readline())
num_list = list(map(int, sys.stdin.readline().split()))
dp = [1 for _ in range(num)]
for i in range(num):
for j in range(i):
if num_list[j] < num_list[i]:
dp[i] = max(dp[i], dp[j] + 1)
now = max(dp)
pos = num - 1
ans = []
while now > 0:
if dp[pos... | Quinsie/BOJ | Python/BOJ_14002_가장 긴 증가하는 부분 수열 4.py | BOJ_14002_가장 긴 증가하는 부분 수열 4.py | py | 476 | python | en | code | 0 | github-code | 90 |
18319007350 | from fastapi import APIRouter, Depends, status, HTTPException
from database.db import get_db
from sqlalchemy.orm import Session
from schemas import schemas
from models import models
from uuid import UUID
from auth import oauth2
# from fastapi.security import OAuth2PasswordBearer
from datetime import datetime, timedelt... | anuran-roy/c4-backend-project2 | routes/orders.py | orders.py | py | 3,453 | python | en | code | 0 | github-code | 90 |
17712038441 | from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
from recognizeCls import Recognize
class HotboxFast3184(Recognize):
def __init__(self):
super(HotboxFast3184, self).__init__()
... | hezimz/weBeesRouters | code/hotboxCls.py | hotboxCls.py | py | 2,174 | python | en | code | 0 | github-code | 90 |
30751003743 | import numpy
from sys import argv
import h5py
import matplotlib.pyplot as plt
# data_path, shear_num = argv[1], int(argv[2])
shear_num = 20
half_num = int(shear_num/2)
data_path = "D:/"
# g = numpy.linspace(0,0.05, shear_num)
# theta = numpy.random.uniform(0,2*numpy.pi,shear_num)
# cos_2theta = numpy.cos(2*theta)
# ... | hekunlie/astrophy-research | selection_bias/CFHT_simu/shear_points.py | shear_points.py | py | 1,231 | python | en | code | 2 | github-code | 90 |
35364369967 | import logging
import sys
import os
import time
import pytest
from automatos_framework.base_test_case import BaseTestCase, TestParameter
from automatos_framework.ctd_testbed import CTDTestbed
sys.path.insert(0, "OSP_test_automation/osp_api_and_common_utils")
from neutron import Neutron
from nova import Nova
from parame... | tayseer619/openstack | TestCases/Hugepage/test_hugepage_instance_cold_migration.py | test_hugepage_instance_cold_migration.py | py | 2,535 | python | en | code | 1 | github-code | 90 |
17434336290 | from __future__ import absolute_import
from __future__ import division
import copy
import tensorflow.compat.v1 as tf
def capture_variables(fn):
"""Utility function that captures which tf variables were created by `fn`.
This function encourages style that is easy to write, resonably easy to
understand but agai... | tensorflow/adanet | research/improve_nas/trainer/subnetwork_utils.py | subnetwork_utils.py | py | 2,012 | python | en | code | 3,473 | github-code | 90 |
73379034538 | import pandas as pd
# properties of tidy data
# 1. Each variable forms a column.
# 2. Each observation forms a row.
# 3. Each type of observational unit forms a table.
# pew dataset has one of the common issues of untidy data i.e it has column headers representing values instead of variables
pew_df = pd.read_csv('da... | Kimmirikwa/tidy-data | tidy_pew.py | tidy_pew.py | py | 1,171 | python | en | code | 0 | github-code | 90 |
18547797309 | s=input()
aflag=0
bflag=0
cflag=0
for i in range(3):
if s[i]=='a':
aflag+=1
if s[i]=='b':
bflag+=1
if s[i]=='c':
cflag+=1
if aflag==1 and bflag==1 and cflag==1:
print('Yes')
else:
print('No') | Aasthaengg/IBMdataset | Python_codes/p03385/s256026008.py | s256026008.py | py | 213 | python | ur | code | 0 | github-code | 90 |
11870267735 | # Return inverted dictionary
def invert_dict(d):
inverse = dict()
# Loop through items in original dict
# To get each key list values
for key in d:
# Loop through items in dict list values
for item in d[key]:
# Check for key in inverted list... | ericel/python101 | ljournal_8.py | ljournal_8.py | py | 1,716 | python | en | code | 0 | github-code | 90 |
17931225099 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
num = list(map(int, readline().strip()))
for bits in range(1 << 3):
tmp = num[0]
for i in range(3):
if bits & (... | Aasthaengg/IBMdataset | Python_codes/p03545/s324568889.py | s324568889.py | py | 818 | python | en | code | 0 | github-code | 90 |
18012379709 | import sys
input = sys.stdin.readline
def main():
N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)
use = v[:A]
print(sum(use)/A)
fac = [0 for _ in range(N+1)]
fac[0],fac[1] = 1,1
for i in range(2,N+1):
fac[i] = (fac[i-1]*i)
x = v.cou... | Aasthaengg/IBMdataset | Python_codes/p03776/s877252447.py | s877252447.py | py | 613 | python | en | code | 0 | github-code | 90 |
18504507139 | s = input()
k = int(input())
s1=0
sn1='0'
for i in range(len(s)):
if(s[i] == '1'):
s1+=1
else:
sn1=s[i]
break
ans='0'
if(s1>=k):
ans='1'
else:
ans=sn1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03282/s575363504.py | s575363504.py | py | 203 | python | en | code | 0 | github-code | 90 |
43612240756 | import RPi.GPIO as GPIO
import time
import requests
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
oldstate = GPIO.LOW
while True:
if GPIO.input(4) == GPIO.HIGH and oldstate == GPIO.LOW:
print('LOW -> HIGH')
oldstate = GPIO.HIGH
requests.get('http://91.181.93.103:4040/add/visitor?area_id=1&d... | vives-projectweek-1-2020/Market-queue | code.py | code.py | py | 508 | python | en | code | 0 | github-code | 90 |
18358644579 | n,m,p=map(int,input().split())
g=[[] for _ in range(n)]
e=[]
for _ in range(m):
a,b,c=map(int,input().split())
a,b=a-1,b-1
c-=p
g[a].append([b,c])
e.append([a,b,-c])
# ベルマンフォード法
# edges:エッジ、有向エッジ[a,b,c]a->bのエッジでコストc
# num_v:頂点の数
# source:始点
def BellmanFord(edges,num_v,source):
#グラフの初期化
inf=float("inf")... | Aasthaengg/IBMdataset | Python_codes/p02949/s815418033.py | s815418033.py | py | 1,141 | python | ja | code | 0 | github-code | 90 |
37379150378 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sga', '0005_auto_20151118_2013'),
]
operations = [
migrations.CreateModel(
name... | ruben-dossantos/sga | server/sga/migrations/0006_auto_20151123_1932.py | 0006_auto_20151123_1932.py | py | 822 | python | en | code | 0 | github-code | 90 |
37930654024 | from typing import Optional
from unittest import TestCase
class DoublyLinkedListNode:
def __init__(
self,
key: int,
value: int,
prev: Optional["DoublyLinkedListNode"] = None,
next: Optional["DoublyLinkedListNode"] = None,
):
self.key = key
self.value = v... | saubhik/leetcode | problems/lru_cache.py | lru_cache.py | py | 3,766 | python | en | code | 3 | github-code | 90 |
18814564457 | import re
import pytz
import datetime as dt
from collections import defaultdict
import lxml.html
from openstates.scrape import Scraper, Bill, VoteEvent
from utils import LXMLMixin
from .utils import clean_text, house_get_actor_from_action, senate_get_actor_from_action
bill_types = {
"HB ": "bill",
"HJR": "j... | openstates/openstates-scrapers | scrapers/mo/bills.py | bills.py | py | 26,612 | python | en | code | 820 | github-code | 90 |
43665201473 | import os
import sys
from flask.json import jsonify
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from auth.AuthService import requires_auth
from schemas.LanguageSchema import LanguageSchema
from flask import ... | vgotra/FSND | projects/04_capstone/backend/controllers/LanguageController.py | LanguageController.py | py | 1,861 | python | en | code | 0 | github-code | 90 |
27093929918 | from spack import *
class PyJpype(PythonPackage):
"""JPype is an effort to allow python programs full access to java class
libraries."""
homepage = "https://github.com/originell/jpype"
url = "https://pypi.io/packages/source/J/JPype1/JPype1-0.6.2.tar.gz"
version('0.6.2', '16e5ee92b29563dcc63... | matzke1/spack | var/spack/repos/builtin/packages/py-jpype/package.py | package.py | py | 656 | python | en | code | 2 | github-code | 90 |
36164260148 | """
Provides test routines for FEM-BV-VARX routines.
"""
import unittest
import os
import numpy as np
from reor.fembv_varx import FEMBVVARXLocalLinearModel
TEST_DATA_PATH = os.path.realpath(os.path.dirname(__file__))
class TestFEMBVVARXLocalLinearModelFit(unittest.TestCase):
"""Provides unit tests for linear V... | azedarach/reor | tests/test_fembv_varx.py | test_fembv_varx.py | py | 2,209 | python | en | code | 1 | github-code | 90 |
20375939984 | import requests
import json
import time
import shutil
#import csv
#from contextlib import closing
import datetime
import zipfile
import os
#**************** CLASS *****************
# connectionDetails
#****************************************
class connectionDetails:
def __init__(self, clientId, clientSe... | stef-tel/Pilot-Billing-Preview-Tool | module1.py | module1.py | py | 11,925 | python | en | code | 0 | github-code | 90 |
25288141070 | import os
import random
class PhotoSelector(object):
"""
Random selection of photos by various methods.
For now, this just selects randomly from the whole collection.
"""
def __init__(self, root_dir, exclude):
self.root_dir = root_dir
self.exclude = exclude
self.exclude_p... | markgw/photohop | src/photohop/selector.py | selector.py | py | 2,818 | python | en | code | 0 | github-code | 90 |
18804724512 | import numpy as np
from plyfile import PlyData, PlyElement
def read_ply(path):
with open(path, 'rb') as f:
plydata = PlyData.read(f)
x = np.array(plydata['vertex']['x'])
y = np.array(plydata['vertex']['y'])
z = np.array(plydata['vertex']['z'])
vertex = np.stack([x, y, z], a... | ChrisWu1997/DeepCAD | utils/pc_utils.py | pc_utils.py | py | 772 | python | en | code | 167 | github-code | 90 |
33370945312 | #coding:utf-8
import unittest,os,sys
from appium import webdriver
from appium.common.exceptions import NoSuchContextException
from selenium.webdriver.common.touch_actions import TouchActions
from time import sleep
from Page import *
class AndroidEmail(unittest.TestCase,email126Android.Email126Page):
"""... | lipengju/selenium-appium | TestCase/Auto_AndroidEmailApp.py | Auto_AndroidEmailApp.py | py | 1,058 | python | en | code | 3 | github-code | 90 |
73419536937 | from app.reddit_classes import *
from sqlalchemy import create_engine
from sqlalchemy.sql import text as sql_text
from sqlalchemy.sql.expression import TextClause
from db.repo import Repo
class MySQL_Alchemy_Repo(Repo):
def __init__(self, local=False) -> None:
db_user, db_pass, db_host, db_port, db = (
... | jayyydyyy/reddit-emoji | db/mysql_alchemy_repo.py | mysql_alchemy_repo.py | py | 2,100 | python | en | code | 0 | github-code | 90 |
26676544220 | from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name='netbox_fusioninventory_plugin',
version='0.6',
description='A Plugin for import devices from fusion inventory agent',
long_description=long_description,
... | hiddenman/netbox-fusioninventory-plugin | setup.py | setup.py | py | 660 | python | en | code | 7 | github-code | 90 |
18016013899 | n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1
m = A[0]
for i in range(n-1):
if A[i+1] <= 2*m:
ans += 1
else:
ans = 1
m += A[i+1]
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03786/s353770653.py | s353770653.py | py | 190 | python | en | code | 0 | github-code | 90 |
24621295290 | from __future__ import unicode_literals, print_function
from django import forms
from django.core.validators import EMPTY_VALUES
from django.test import TestCase
from django_auxilium.forms.time import TimeField
class TimeFieldTest(TestCase):
@classmethod
def setUpClass(cls):
cls.form = TimeField()
... | viktorijat/timezones_site_test | venv/lib/python2.7/site-packages/django_auxilium/tests/forms/time.py | time.py | py | 900 | python | en | code | 0 | github-code | 90 |
18529104499 | n = int(input())
s = input()
cnt = 0
for i in range(1, n-1):
tmp = 0
r, l = s[:i], s[i:]
rs = list(set(r))
for ri in rs:
if l.count(ri) > 0:
tmp += 1
cnt = max(cnt, tmp)
print(cnt) | Aasthaengg/IBMdataset | Python_codes/p03338/s069388539.py | s069388539.py | py | 222 | python | en | code | 0 | github-code | 90 |
13491484857 | from room import *
from player import *
from item import *
from monster import *
import os
import updater
player = Player()
def createWorld():
entrance = Room("You are in the entrance of The Dungeon of the End")
player.location = entrance
longsword.putInRoom(entrance)
hideArmor.putInRoom(entrance)
... | rdk25/EndDungeon | main.py | main.py | py | 5,460 | python | en | code | null | github-code | 90 |
36270044397 | import datetime
import io
import itertools
import random
import typing as t
from distutils.util import strtobool
from json import JSONDecodeError
from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models import Prefetch, Q
from django.http import StreamingHttpResponse
fro... | guldfisk/cubeapp | limited/views.py | views.py | py | 17,536 | python | en | code | 1 | github-code | 90 |
72057666217 | from flask_restx import Namespace, Resource, reqparse, fields
from app.main.utils.token import token_required
from app.main.service.shipping_service import get_shipping_price
shipping_ns = Namespace("shipping_price")
headers = reqparse.RequestParser()
headers.add_argument("Authentication", required=True, location="... | wards-a/fashion-campus | app/main/controller/shipping_controller.py | shipping_controller.py | py | 945 | python | en | code | 0 | github-code | 90 |
21325978045 | # imports are just external libraries to use code already writen by other people
import glob
import matplotlib.pyplot as plt
import pandas as pd
from lkpr_scripts import LKPR_pressure
from davis_scripts import DAVIS_pressure
# Defines all the constants used from the table
BARO_DATA_LKPR = glob.glob("./data/*/*/BARO/... | LaChope/janek-thesis | plot_pressure.py | plot_pressure.py | py | 1,267 | python | en | code | 0 | github-code | 90 |
8703424890 | from DB import DB
from Defaults import Defaults
from pprint import pprint
import json
def initSimulationsCollection():
DB.initSimCollection()
def initVillagesCollection():
DB.initVillagesCollection()
def initStatsCollection():
DB.initStatsCollection()
def addSampleData():
#Simulation
sampleSim =... | calebTZD/RTSsim | initDB.py | initDB.py | py | 724 | python | en | code | 0 | github-code | 90 |
18351857709 | import sys
sys.setrecursionlimit(100000)
def solve(x,a,ans=0):
if x == 0:
return ans
else:
return solve(x-1,a[1:],ans+1/a[0])
N = int(input())
a = list(map(int,input().split()))
print(1/solve(N,a)) | Aasthaengg/IBMdataset | Python_codes/p02934/s447632612.py | s447632612.py | py | 214 | python | en | code | 0 | github-code | 90 |
23575996336 | import asyncio
import websockets
async def hello(websocket, path):
print(path)
while True:
message = "Test"
await websocket.send(message)
await asyncio.sleep(1)
start_server = websockets.serve(hello, "localhost", 8765)
asyncio.get_event_loop().run_until_complete(start_server)
async... | rharshit/Ticker_Fetcher | Tests/server.py | server.py | py | 354 | python | en | code | 0 | github-code | 90 |
25110786679 | from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import re
import copy
from optparse import OptionParser
import pyverilog.utils.version
import pyverilog.utils.signaltype as signaltype
from pyverilog.dataflow.dataflow_analyzer import VerilogDataflowAnalyzer
from pyveril... | hcng10/DAM | examples/generateMuxTemplate.py | generateMuxTemplate.py | py | 15,329 | python | en | code | 0 | github-code | 90 |
29542176857 | # -*- coding: utf-8 -*-
# @Time : 2022/3/7 16:41
# @Github : https://github.com/monijuan
# @CSDN : https://blog.csdn.net/qq_34451909
# @File : 1572. 矩阵对角线元素的和.py
# @Software: PyCharm
# ===================================
"""给你一个正方形矩阵 mat,请你返回矩阵对角线元素的和。
请你返回在矩阵主对角线上的元素和副对角线上且不在主对角线上元素的和。
示例 1:
输入:mat ... | monijuan/leetcode_python | code/AC1_easy/1572. 矩阵对角线元素的和.py | 1572. 矩阵对角线元素的和.py | py | 2,168 | python | zh | code | 0 | github-code | 90 |
40392477620 | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
username = '成歩堂龍一'
age = '25'
email = 'naruhodo@example.com'
like = 'リンゴとウインナー'
job = '弁護士'
return render_template('card.html',
username=username,
... | hama28/Flask_App | test1_hello/app.py | app.py | py | 543 | python | en | code | 1 | github-code | 90 |
24675934732 | #!usr/bin/env python3
"""Projektname: Verteilerliste
Anforderungen:
* Auflisten der Liste
* Suchen in der Liste
* Einfügen in der Liste
* Löschen in der Liste
Listeninhalte:
* Rufnummer (01 2345678)
*Equipmentposition (bsp. Links/Rechts/Oben/Unten)
* Type (Bsp. Pager, Phone,... | theBrebb/ETC_INtroPython | Python_Intro_ETC/verteilerliste.py | verteilerliste.py | py | 2,033 | python | de | code | 0 | github-code | 90 |
73141501095 | def all_longest_strings(input_array):
# solution 1
# longest = len(max(input_array, key=len))
# return [i for i in input_array if len(i) == longest]
# solution 2
# return [i for i in input_array if len(i) == len(max(input_array, key=len))]
# solution 3
longest = 0
longest_array = []
... | dacodekid/dacodekid.com | docs/snippet/code-signal/arcade/intro/smooth-sailing/all-longest-strings/all-longest-strings.py | all-longest-strings.py | py | 660 | python | en | code | 0 | github-code | 90 |
28406875958 | #selenium education
from selenium import webdriver
import time
import math
from selenium.webdriver.common.by import By
path = r"C:\project\chromedriver3.exe"
url = "http://suninjuly.github.io/alert_accept.html"
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
try:
browser = webdriver.Chrome(executable_... | agafonovg/Selenium_education | done/lesson2_3.py | lesson2_3.py | py | 718 | python | en | code | 0 | github-code | 90 |
999009261 | """
Module for handling the entire game, excluding GUI/TUI.
"""
from typing import Callable
from word import random_word
class Game(object):
"""
The main class for the hangman game itself.
"""
def __init__(self, gameover_func: Callable, correct_func: Callable, update_func: Callable):
... | IshanKumar22/hangman | hangman.py | hangman.py | py | 1,734 | python | en | code | 0 | github-code | 90 |
43630898598 | def arrayF(n):
F = [0] * (n + 1)
i=2
while (i * i <= n):
if (F[i] == 0):
k=i * i
while (k <= n):
if (F[k] == 0):
F[k] = i;
k += i
i += 1
return F
def factorization(x, F):
primeFactors = []
while (F[x] > ... | pavlomorozov/algorithms | src/codility/python/11_sieve_of_eratosthenes/Factorization.py | Factorization.py | py | 492 | python | en | code | 0 | github-code | 90 |
33734684574 | # gen_primes.py
import pprint
import math
def gen_primes(n):
primes = [2]
for i in range(3,n):
for k in range(2,int(math.sqrt(i)) + 1):
if i % k == 0: break
else: primes.append(i)
return primes
pprint.pprint(gen_primes(1000))
| Kingdageek/Learn_Python | gen_primes.py | gen_primes.py | py | 237 | python | en | code | 0 | github-code | 90 |
40650878864 | """ TODO: Tests for the EWC Method. """
from functools import partial
from typing import ClassVar, Type
import numpy as np
import pytest
from torch import Tensor
from sequoia.common import Loss
from sequoia.common.config import Config
from sequoia.conftest import slow
from sequoia.methods.trainer import TrainerConfi... | lebrice/Sequoia | sequoia/methods/ewc_method_test.py | ewc_method_test.py | py | 4,224 | python | en | code | 185 | github-code | 90 |
27925559639 | """This is code for training a critic with or without minibatch optimal ray selection.
Once the critic is trained, contour plots are made which record some gradient flow lines for n points. An empirical
histogram for the gradient penalty sampling strategy is also created.
"""
import os
import sys
sys.path.append(os.g... | tmilne5/decongestion_toy_examples_final | critic_trainer.py | critic_trainer.py | py | 7,738 | python | en | code | 0 | github-code | 90 |
42122787753 | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from numpy import arange,array
ust = array([ 1.41345315e-01, 7.68131167e-01, 1.46433093e-01,
2.80893516e-26, 4.33366183e-22, 5.62769707e-02,
1.92785759e-01])
labels = ['RSSI Only', 'Phase Only', 'Cross', 'AND', 'OR', 'XOR', 'Syn']
plt.... | gymmer/py_ofdm_cs | dist/KG_merge_random_fast.py | KG_merge_random_fast.py | py | 704 | python | en | code | 3 | github-code | 90 |
11098014317 | # Recebe o valor dos minutos do usuário
minutos = int(input("Digite a quantidade de minutos atuais: "))
# Calcula o fatorial dos minutos
fatorial = 1
for i in range(1, minutos + 1):
fatorial *= i
# Concatena a senha com o fatorial calculado
senha = "LIBERDADE" + str(fatorial)
# Exibe a senha na tela
... | EduardaMandara/fase-2-cap-3 | Case_04/case-4.py | case-4.py | py | 376 | python | pt | code | 0 | github-code | 90 |
6071128079 | import torch
from torch import nn
def decode(model, label_vocab, batch, config):
batch_size = len(batch)
labels = batch.labels
output = model(batch)
prob = output[0]
predictions = []
for i in range(batch_size):
if i < len(prob):
if (config.use_crf):
pred = pro... | WentDong/NLP_Project | model/Decoder.py | Decoder.py | py | 4,544 | python | en | code | 0 | github-code | 90 |
71124241896 | import sys
sys.path.append('/home/ron/framework')
import drawer
from mod_python import apache
from igraph import *
def inputs(req, shape):
def color(var, info):
if var in info:
c = list(color_name_to_rgb("#%s" % info[var][:6]))
c.reverse()
if len(info[var])>6 and (info[v... | laironald/Govt-rddash | py/marker.py | marker.py | py | 1,259 | python | en | code | 0 | github-code | 90 |
20264802636 | from PIL import Image
import numpy as np
import dlib
import openface
import argparse
import os
def _main(args):
# Create a HOG face detector using the built-in dlib class
face_detector = dlib.get_frontal_face_detector()
face_aligner = openface.AlignDlib(args.lmarks)
# Load the image
img = np.arra... | rohitgr7/facenet-tf | tools/face_align.py | face_align.py | py | 1,763 | python | en | code | 1 | github-code | 90 |
19732249881 | # Databricks notebook source
spark.read.format('delta').load('s3://tfsdl-corp-pr1-prod/processed/delta/pr1/resb/').createOrReplaceTempView('resb')
# COMMAND ----------
# MAGIC %sql
# MAGIC select *
# MAGIC from resb
# MAGIC limit 5
# COMMAND ----------
# import all temp views
spark.read.format('delta').load('s3://t... | raul-martinez-tfs/databricks-test-notebooks | Lighthouse/troubleshooting/2023-05-31 e1lsg ioh drop.py | 2023-05-31 e1lsg ioh drop.py | py | 4,702 | python | en | code | 0 | github-code | 90 |
36910337025 | import unittest
from networkx import number_strongly_connected_components
from pychoco.model import Model
from pychoco.objects.graphs.directed_graph import create_directed_graph, create_complete_directed_graph
class TestGraphNbStronglyConnectedComponents(unittest.TestCase):
def test1(self):
m = Model()... | chocoteam/pychoco | tests/graph_constraints/test_graph_nb_strongly_connected_components.py | test_graph_nb_strongly_connected_components.py | py | 765 | python | en | code | 9 | github-code | 90 |
18323962409 |
n=int(input())
d=list(map(int,input().split()))
from collections import Counter
c=Counter(d)
mod=998244353
ans=1
key=set(c.keys())
if d[0]==0 and c[0]==1 and set(range(len(key))) == key:
for i in range(len(key)):
#print(i,c[i],c[i+1],c[i]**c[i+1])
ans=ans*c[i]**c[i+1] %mod
else:
ans=0
print(a... | Aasthaengg/IBMdataset | Python_codes/p02866/s877394054.py | s877394054.py | py | 323 | python | en | code | 0 | github-code | 90 |
23561620974 | """
- Author: Sharif Ehsani
- Date: August 2020
- https://github.com/sharifehsani
Programming Exercises
5. Sum of Numbers
Assume that a file containing a series of integers is named my_numbers.txt and exists on the computer’s disk.
Write a program that reads all of the numbers stored in the file and calculates their ... | sharifehsani/starting-out-with-python | chapter7/sum_of_numbers.py | sum_of_numbers.py | py | 1,556 | python | en | code | 0 | github-code | 90 |
43067462037 | class Node:
def __init__(self, data=None):
self.data = data
self.link = None
def __str__(self):
return self.data
class SLinkedList:
def __init__(self):
self.head = None
def printList(self):
node = self.head
while node is not None:
print(nod... | dongyun3586/Problem_solving_using_programming | school_test.py | school_test.py | py | 2,657 | python | en | code | 0 | github-code | 90 |
45989081799 | import sys
from collections import deque
sys.setrecursionlimit(5000)
input = sys.stdin.readline
'''
보통 bfs로 푸는 것이 효율적이라고 알고 있어서 bfs로 풀었다.
하지만 정답자를 보니 bfs보다 dfs로 푼 사람이 많아 dfs로도 풀어보았다.
백준에서 RecursionError가 발생해 setrecursionlimit함수로 재귀 제한을 늘렸다.
+ 그냥 편한 방식을 풀면 될 것 같다.
'''
def dfs(row, col, arr):
# row, col이 범위를 벗어나면 F... | GwonPyo/Algorithm | Baekjoon/Graph/유기농 배추(1012)_dfs, bfs.py | 유기농 배추(1012)_dfs, bfs.py | py | 3,102 | python | ko | code | 0 | github-code | 90 |
21403538816 | import numpy as np
import os
import random
import re
import sys
DAMPING = 0.85
SAMPLES = 10000
def main():
if len(sys.argv) != 2:
sys.exit("Usage: python pagerank.py corpus")
corpus = crawl(sys.argv[1])
ranks = sample_pagerank(corpus, DAMPING, SAMPLES)
print(f"PageRank Results from Sampling (... | digital-dictator/Harvard-CS80 | pagerank.py | pagerank.py | py | 4,034 | python | en | code | 0 | github-code | 90 |
74338097256 | from django.contrib import admin
from geodata_mart.vendors import models
@admin.register(models.Vendor)
class VendorAdmin(admin.ModelAdmin):
"""Data vendors"""
list_display = (
"id",
"name",
"abstract",
"description",
"users",
"staff",
"admins",
... | kartoza/geodata-mart | geodata_mart/vendors/admin.py | admin.py | py | 1,506 | python | en | code | 2 | github-code | 90 |
74728748775 | #!/usr/bin/env python3
# @Date : 2022/1/17
# @Filename : 519.py 随机翻转矩阵
# @Tag : 水塘抽样
# @Autor : LI YAO
# @Difficulty : Medium
from heapq import *
from typing import List, Optional
from collections import defaultdict, deque
from itertools import product,combinations,permutations,accumulate
from ra... | GeneralLi95/leetcode | Python/519.py | 519.py | py | 1,459 | python | en | code | 0 | github-code | 90 |
10528998772 | from openerp import models, api, fields, _
from openerp.exceptions import Warning
class StockMove(models.Model):
_inherit = "stock.move"
lot_creation_pack = fields.Many2one('stock.production.lot', string="Lote")
causa = fields.Char(string=u"Causa no conformidad")
@api.onchange('lot_creation_pack')
... | JoryWeb/illuminati | poi_product_dimensions/stockV9.py | stockV9.py | py | 1,251 | python | en | code | 1 | github-code | 90 |
74765347817 | #!/usr/bin/env python3
import puzzle
import re
import networkx as nx
def parse(INPUT):
G = nx.Graph()
for l in INPUT.split('\n'):
op_mat = re.match('(\w+): (\w+) (.) (\w+)', l)
if op_mat:
G.add_node(op_mat.group(1), op = op_mat.group(3), l=op_mat.group(2), r=op_mat.group(4))
else:
lit_mat ... | harveyj/aoc | 2022/21.py | 21.py | py | 1,759 | python | en | code | 0 | github-code | 90 |
20531155678 | import urllib.parse
import json
from collections import defaultdict
import urllib.request
from typing import Any, DefaultDict, Dict, Optional, Set
class GithubClient:
def __init__(self, api_token: Optional[str]) -> None:
self.api_token = api_token
def get(self, path: str) -> Any:
url = urllib... | Ma27/nix-review | nixpkgs_review/github.py | github.py | py | 1,548 | python | en | code | null | github-code | 90 |
32730241183 | """Token system
The capture gui application will format tokens in the filename.
The tokens can be registered using `register_token`
"""
from . import lib
_registered_tokens = dict()
def format_tokens(string, options):
"""
Replace the tokens with the correlated strings
:param string: the filename of th... | Colorbleed/maya-capture-gui | capture_gui/tokens.py | tokens.py | py | 1,977 | python | en | code | 72 | github-code | 90 |
9197889927 | class Solution:
def location(self, s):
sub = ord(s) - 65
return sub//6, sub%6
def distance(self, c1, c2):
c1x, c1y = self.location(c1)
c2x, c2y = self.location(c2)
return abs(c1x-c2x)+abs(c1y-c2y)
def minimumDistance(self, word):
leftHand = word[0]
r... | TPIOS/LeetCode-cn-solutions | 1320.py | 1320.py | py | 704 | python | en | code | 0 | github-code | 90 |
74412916136 | '''
Created on Oct 15, 2016
@author: thierry
'''
import kivy
kivy.require('1.9.1')
from kivy.uix.widget import Widget
from kivy.core.image import Image
from kivy.graphics import Color, Rectangle, RoundedRectangle, Ellipse, Line, Quad
from kivy.properties import NumericProperty, BoundedNumericProperty
from kivy.proper... | tsouche/setgame | client_old/g_card.py | g_card.py | py | 11,682 | python | en | code | 0 | github-code | 90 |
17710324838 | DEBUG = True
DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"NAME": "utopiadev",
"USER": "utopiadev_django",
"PASSWORD": "utopiadev_django",
}
}
# Use your own email settings
SERVER_EMAIL = 'email@example.com'
ADMINS = (
('Utopia Admins', SER... | alekos23/utopia-crm | local_settings_sample.py | local_settings_sample.py | py | 5,626 | python | en | code | null | github-code | 90 |
73096899178 | import pprint
from collections import defaultdict
from datetime import date, datetime
from decimal import Decimal
import logging
import random
from django.db import transaction
from django.utils import timezone
from mp.models import APIKey
logger = logging.getLogger(__name__)
MP_KEYS = [
"ozon",
] # "wb"
KEY_... | SpeedyM282/ka-space-heroku-main | backend/mp/helpers/__init__.py | __init__.py | py | 4,988 | python | en | code | 1 | github-code | 90 |
18151022309 |
N, M = map(int, input().split())
# cities = [[0] * N for i in range(N)]
# print(cities)
cities = {}
for a in range(N):
cities[a+1] = []
# print(cities)
for i in range(M):
i1, i2 = map(int, input().split())
cities[i1].append(i2)
cities[i2].append(i1)
# print(cities)
def connected_components(graph):... | Aasthaengg/IBMdataset | Python_codes/p02536/s526265000.py | s526265000.py | py | 658 | python | en | code | 0 | github-code | 90 |
35900831130 | import numpy as np
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
import time
import pycuda.reduction as reduction
import pycuda.gpuarray as gpuarray
def makeStencil(hrad = 3.01):
grad = int(hrad+1)
xs = np.arange(-grad, grad+1, dtype=np.int32)
XS,YS,ZS = np.meshgrid(x... | TransformativeRoboticsLab/peridynamics | state_based/modules/pd.py | pd.py | py | 9,872 | python | en | code | 1 | github-code | 90 |
20468556760 | import numpy as np
from sklearn import svm
from sklearn.cross_validation import train_test_split
# Import the MNIST dataset
# http://scikit-learn.org/stable/modules/svm.html
"""
1. Use the Sklearn implementation of support vector machines to train a classifier to distinguish 3's from 8's (using the MNIST data from t... | akkikiki/courses | csci5622/homework/svm/sklearn/svm_report.py | svm_report.py | py | 3,004 | python | en | code | 0 | github-code | 90 |
22722540117 | """Xlib related mock objects.
To be used for testing purposes by emulating Xlib and Window Managers behaviour.
Only methods used by PyWO will be implemented!
It should be enough to just change the core.XObject._XObject__DISPLAY
to new mock instance, and change core.ClientMessage.
First phase is to write working, tes... | akaihola/PyWO | tests/Xlib_mock.py | Xlib_mock.py | py | 21,344 | python | en | code | 9 | github-code | 90 |
15296544946 | from pwn import *
r = process('./babyheap')
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')
def alloc(size):
r.sendlineafter('Command: ', '1')
r.sendlineafter('Size: ', str(size))
def update(idx, content, size=0):
r.sendlineafter('Command: ', '2')
r.sendlineafter('Index: ', str(idx))
if size:
... | Kyle-Kyle/Pwn | fsop/babyheap/solve_2.23.py | solve_2.23.py | py | 1,836 | python | en | code | 16 | github-code | 90 |
37314609049 | from urllib.request import urlretrieve
import pandas as pd
import os, time
csv_fpath = './csv/wt_data.csv'
wt_data = pd.read_csv(csv_fpath, sep=';')
wt_id = wt_data['id'].values
wt_iurl = wt_data['img_url'].values
wlen = len(wt_id)
img_folder = './img'
if not os.path.isdir(img_folder):
os.mkdir(img_folder)
f... | world970511/kakao_webtoon_reco | crawl/webtoon_img_download.py | webtoon_img_download.py | py | 411 | python | en | code | 0 | github-code | 90 |
25251150879 | # coding: utf8
"""
---------------------------------------------
File Name: 2-add-two-numbers
Description:
Author: wangdawei
date: 2018/4/20
---------------------------------------------
Change Activity:
2018/4/20
---------------------------------------------
"""
# Defi... | sevenseablue/leetcode | src/leet/2-add-two-numbers.py | 2-add-two-numbers.py | py | 1,467 | python | en | code | 0 | github-code | 90 |
10052653413 | from django import template
register = template.Library()
@register.simple_tag(takes_context = True)
def query_replace(context, field, value):
"""
Gets HttpRequest from context, returns querystring with updated field-value.
django.core.context_processors.request places a request in the default
contex... | transientskp/banana | banana/templatetags/query_replace.py | query_replace.py | py | 1,146 | python | en | code | 4 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.