blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
17b45f549a6f609e87db3654ffba224b97e25de8
angelicaba23/MisionTic2022
/Python/factura.py
UTF-8
1,898
3.53125
4
[]
no_license
""" ------------MinTic----------------- -------------UPB------------------- -------Angélica Barranco----------- """ #factura num_factura = 0 menu = "si" while menu == "si": print("\n\tBienvenido a la tienda PY") num_factura += 1 l = 0 codigo_a = [] producto_a=[] precio_a =[] cantidad_a = [...
true
93e7b1bae6ea0eeaf78acd9f59cd42576922bad4
Tititun/python-basics
/lesson_1/task_6.py
UTF-8
551
3.921875
4
[]
no_license
start_km = int(input('Введите число километров в первый день:\n')) target_km = int(input('Введите желаемый результат:\n')) day_number = 1 current_km = start_km # можно и несоздавать новую переменную и использовать start_km, но по мне так читабельнее. while current_km < target_km: current_km *= 1.1 day_number...
true
d4c61e979e9c3a99331924b9e07b3e72d5724300
NeenaBenny1995/Luminaronlineclassneenabeny
/object oriented programming/polymorphism/methodoverriding.py
UTF-8
203
2.9375
3
[]
no_license
class Parent: def proprties(self): print("10lackh") def marry(self): print("with arun") class Child(Parent): def marry(self): print("with sibin") ch=Child() ch.marry()
true
cdba04b9752b1fd14366e0d03c60b9329ad6d2f3
karu99/python
/reversehun.py
UTF-8
149
3.25
3
[]
no_license
ab=int(input()) ab=list(map(int,input().split())) ab.sort() ab.reverse() if(ab[0]==0): print("0") else: for i in ab: print(i,end='')
true
764acc9d403a6f1cf928d19ec0abec4523f81965
Frander98/codigo_python
/alg_enum_exhaustiva.py
UTF-8
758
4.1875
4
[]
no_license
#Este es un ejemplo de un algortimo de enumeración exhaustiva en el que se evalúan todas las posibilidades hasta encontrar una respuesta. En este caso específico sirve para saber si {objetivo} tiene una raíz{respuesta} cuaadrada exacta o no. Lo que le decimos a la computadora es "Prueba todas las posibilidades hasta qu...
true
2df39b7c91084a24060dbe7c1577c0c0c3ff76bd
yuki-koyama/sequential-line-search
/python-examples/acquisition-func-comparison.py
UTF-8
5,041
2.765625
3
[ "MIT" ]
permissive
import pySequentialLineSearch import numpy as np import sys import matplotlib.pyplot as plt import seaborn as sns import itertools from joblib import Parallel, delayed from typing import Optional, Tuple # A dummy function for testing def calc_simulated_objective_func(x: np.ndarray) -> float: return -np.linalg.nor...
true
aeab08ae94caacaf9418fcfbee8205d25a7494e3
rodolfosgarcia/ClovisBrayPuzzle
/getGIFimg.py
UTF-8
625
2.640625
3
[]
no_license
from PIL import Image """ 00 fragment_v2_2ca110b1-cf68-4dc2-8c2d-2d42b0c48c48.gif ^ 00 fragment_v2_7d3faa25-9371-4373-8b1c-814c9bc3b046.gif s 02 fragment_v2_1c754b9c-6edd-41f8-b924-5eca909579d1.gif b 02 fragment_v2_5223ec41-703c-41cd-9ba9-7c0d7bad0a8f.gif m 02 fragment_v2_9010eff9-c33e-4ad9-b680-2067619ecfc6.gif 6 0...
true
b907b7c4544b5075ed4a0b0d09420e9e198acc02
henriquesuenaga88/adventofcode
/day2/day2.py
UTF-8
1,806
3.234375
3
[]
no_license
dict = { 'U': -1 , 'D': 1 , 'L': -1 , 'R': 1 } x_position = 1; y_position = 1; def getKeypadFromPosition(x, y) : keypad = [ ['1', '2', '3'] , ['4', '5', '6'] , ['7', '8', '9'] ]; return keypad[y][x]; def isAcceptableVerticalValue(direction) : return direct...
true
1ffb9eb6fede1b56e36e4b094a244feedfbfd557
JustinCoenen/1NMCT1-LaboBasicProgramming-JustinCoenen
/Labo_09_oot/test.py
UTF-8
974
2.984375
3
[]
no_license
from model.Speler import Speler from model.Geboortedatum import Geboortedatum speler1 = Speler("naam", "voornaam", 2, Geboortedatum.get_random_data()) speler2 = Speler("Peter2", "Vandenbroucke2", 3, Geboortedatum.get_random_data()) speler3 = Speler("Peter3", "Vandenbroucke3", 4, Geboortedatum.get_random_data()) #prin...
true
77f1b65ec94a262f1aa306298634229470875c00
Ironarrow98/GBN_Algorithm
/receiver.py
UTF-8
2,686
2.90625
3
[]
no_license
import socket from packet import packet import sys import time # Main function def main(args): # Check the number of arguments is correct or not if not len(args) == 5: print('Error 2: expected 5 arguments, %d was received' %(len(args))) sys.exit(2) # Check if the type of argument...
true
83a614047837c525d4fbcc87c5df6e41bdd92677
ddmin/CodeSnippets
/PY/DailyProgrammer/easy6.py
UTF-8
308
3.34375
3
[]
no_license
# [Easy] Challenge 6 import os import math import time a = 1 n = 1 s = 0 i = 0 while True: i += 1 os.system('clear') print(f'Current Iteration: {i}') print(f'Current Prediction: {s}') print(f'Error: {abs(math.pi - s)}') time.sleep(0.01) s += n * (4 / a) a += 2 n *= -1
true
b985e2fb464042bc62770e33bb24fa185f7296f3
daisuke834/Coursera
/MachineLearning__Stanford/2_LogisticRegression/ex2_1_scipy_LogisticRegression.py
UTF-8
2,514
2.65625
3
[]
no_license
#Copyright (C) 2016 Daisuke Hashimoto. All Rights Reserved. import numpy as np import matplotlib.pyplot as plt import math import scipy.optimize as optimize import my_machine_learning as _myml _fh = open('ex2data1.txt') _data_array = list() _index =0 _M = None _N = None for _line in _fh: _line = _line.strip() _data ...
true
47b98b6c19add7657676fffde886741c89e03ab0
yawudede/mmd_rs
/TEST_CODE/EXP_test/tst_argparser.py
UTF-8
4,231
3.015625
3
[ "Apache-2.0" ]
permissive
# python tst_py_cmd.py --gpus 6,7 # python tst_py_cmd.py -- import os import argparse from argparse import Action class DictAction(Action): """ argparse action to split an argument into KEY=VALUE form on the first = and append to a dictionary. List options can be passed as comma separated values, i.e ...
true
0c3b61f1bcb80fdced784fa50ad045a57983b2b0
10ks/py_utils
/experiments/scope_test.py
UTF-8
304
3.359375
3
[ "MIT" ]
permissive
def fffunc(): print(i) def func2(param1): print(param1) # print(y) # NameError: name 'y' is not defined print(x) def func1(): y = 30 func2(20) for a in range(10): print(a) for i in range(4): print(i) print("---") print(a) print(i) fffunc() x = 10 func1()
true
5374c15681ff0cba17df8699e9d3e793455f5aa8
nishuai/py_seq
/remove_mapped_pairdreads.py
UTF-8
5,303
2.6875
3
[]
no_license
#### Removes reads from host for a better performance of virus genome denovo assembly #### Input: sam file from Tophat or other mapping softwear, paired end fastq files 1 and 2 #### Once reads found to be mapped to the host genome then delete the both reads in 2 paired end files #!/usr/bin/python import os, sys, argpar...
true
f596eff3e6064bff7d41a962c2ce51910d9ef531
frederic-mahe/bioinformatics-scripts
/GC_content.py
UTF-8
2,668
2.671875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Calculate GC-content of nucleotide sequences in fasta format. """ from __future__ import print_function __author__ = "Frédéric Mahé <mahe@rhrk.uni-kl.de>" __date__ = "2012/02/15" __version__ = "$Revision: 1.0" # Copyright 2012 Frédéric Mahé <mahe@rhrk.uni-kl.de> #...
true
dc407f5723f7e9622a5ed75455b4f825c17e07cc
Anagha99/SAS_DeepLearning
/Extracting_dominant_colors_of_images/helper_functions/detection_helper.py
UTF-8
3,552
2.59375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np # Transforms object detection table from wide format to long format def object_detections_wide_to_long(conn, input_table, output_table, replace=True, num_objects=5): conn.loadactionset('fedSql') if replace == True: replace_option = "{options replace=tr...
true
e3c7c13a83a9fff6fef8a048466ce7f201087b51
floblanc/Rubik
/g0.py
UTF-8
792
2.578125
3
[ "MIT" ]
permissive
import moves as mv from utils import apply_move_e, make_edges, algo g0_moves = [["L", ""], ["R", ""], ["F", ""], ["B", ""], ["U", ""], ["D", ""]] def check_g0(cube): for j in range(24): face = int(j / 4) cubbie = cube[j] pos = j % 4 if cubbie == "U" and (face == 1 or face == 3): return False elif cubbi...
true
b0afd8707d52e09367b5a0cfc74b9ce6c71d3a5a
farhapartex/code-ninja
/Leetcode/sort/matrix-cells-in-distance-order.py
UTF-8
479
3.015625
3
[]
no_license
class Solution: def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: data = {} for r in range(R): for c in range(C): value = abs(r0-r) + abs(c0-c) if value not in data: data[value] = [[r,c]] ...
true
efffac7fd051cfb64842927901c1a88912093941
qiankun2/aline_invasion
/alien_invasion.py
UTF-8
835
2.90625
3
[]
no_license
import sys import pygame from pygame.sprite import Group import game_functions from setting import Settings from ship import Ship #创建游戏函数 def run_game(): # 初始化背景,让pygame能够正确的工作 pygame.init() #创建一个游戏窗口对象 ai_settings = Settings() screen = pygame.display.set_mode((ai_settings.screen_width,ai_settin...
true
39f4d376d5b1701dba8ff86bbfa157c47e2a7a14
cameronbeach12/RestaurantSeatingSystem
/Restaurant Seating System/seat.py
UTF-8
219
3
3
[]
no_license
class seat: def __init__(self): self.occupied = False def changeOccupied(self): if self.occupied == True: self.occupied = False else: self.occupied = True
true
d5c61ea34bc22404e881972f1ed24085857cdc37
JoshuaDBruton/Onion_Excercises
/Or_excercises/ex3.py
UTF-8
449
3
3
[]
no_license
import numpy as np import cv2 # Create a black image img = np.zeros((512,512,3), np.uint8) # Draw a diagonal blue line with thickness of 5 px cv2.line(img,(0,0),(511,511),(255,0,0),5) font=cv2.FONT_HERSHEY_SIMPLEX cv2.putText(img, 'Left', (0,), font, 1, (0.0,255),3,cv2.CV_AA) #img = cv2.line(img,(0,0),(511,511),(255...
true
63cc57b70c2d341860134beb941f5c070dbfbaf0
Ankitgupta2/DPPYDS63021AUG
/funtions_in_python/named_parameter.py
UTF-8
562
4.15625
4
[]
no_license
# python allows us to pass parameter in 2 formats # 1. positional parameter # 2. named parameter # you can mix both styles, but positional parameters # are given first and named parameter afterward def mean(a,b,c,d): avg = (a+b+c+d)/4 return avg # call styles m = mean(12,34,56,78) # positional parameter pri...
true
7264a2f7b84fa1a998e9d1041843c6effc2d8635
ChangshengZhang/zhihu
/proxy_pool/Manager/ProxyManager.py
UTF-8
4,498
2.609375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # !/usr/bin/env python """ ------------------------------------------------- File Name: ProxyManager.py Description : Author : JHao date: 2016/12/3 ------------------------------------------------- Change Activity: 2016/12/3: ------------...
true
e10ae29c0719fa858fb6745710dda322dee7c6c6
QianchuanJiang/SKlearnEX
/EX21_分词工具(jieba).py
UTF-8
267
2.890625
3
[]
no_license
import jieba # 导入向量化工具; from sklearn.feature_extraction.text import CountVectorizer vect = CountVectorizer() cn = jieba.cut('那只敏捷的棕色狐狸跳过了一只懒惰的狗') cn = [' '.join(cn)] vect.fit(cn) print(vect.vocabulary_)
true
5aca905893423b7a5c869a34e898cbd84c2bb392
stephanefschwarz/EMET
/emet/hypothesis/get_from_newYourkTimes.py
UTF-8
3,260
2.890625
3
[ "MIT" ]
permissive
import requests as r from bs4 import BeautifulSoup as bs import pandas as pd import sys class GetNewsFromReuters(object): __news = [] __key_words = [] __urls = [] def get_news(self, key_words): """Get news from bbc based on a list of key words Parameters ---------- key_words : list ...
true
3176dffed181d96cb79dd6ac684b7777bf61ee89
penglee87/leetcode
/leetcode_015.py
UTF-8
3,199
4.25
4
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' 给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。 注意:答案中不可以包含重复的三元组。 例如, 给定数组 nums = [-1, 0, 1, 2, -1, -4], 满足要求的三元组集合为: [ [-1, 0, 1], [-1, -1, 2] ] 题意分析: 这道题目是输入一个数组nums。找出所有的3个数使得这3个数之和为0.要求1.输出的3个数按小到大排序,2.3个数的组合不重复。 比如输入[-1,0,1,...
true
7ad4e99d0c029bb71117f84d9fde7bd599bde18d
caiyo/thirteen_python
/game_service/tests/thirteenService.py
UTF-8
8,744
3.046875
3
[]
no_license
import sys, os sys.path.insert(0, os.path.abspath('..')) import unittest2 as unittest from lib.models.card import Card from lib.models.exceptions import InvalidHandType, InvalidAction from lib.models.player import Player from lib.enums.rank import Rank from lib.enums.suit import Suit from lib.enums.hand import HandTyp...
true
9dd03386acfda11b5738e61c75ed0d22555d55f6
miroso/pis_code
/practicioner_bundle/ch12-resnet/resnet_cifar10_decay.py
UTF-8
3,844
2.953125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Training ResNet on CIFAR-10 Example: $ python resnet_cifar10_decay.py --output output \ --model output/resnet_cifar10.hdf5 Attributes: model (str): path to our final serialized model after training output (str): base directory...
true
5544ac82bbd7b2209846afacb60a8c5dcbb4439f
yuliaserhienko/airfares
/airlines/abstractions.py
UTF-8
2,125
2.640625
3
[]
no_license
import aiohttp import logging log = logging.getLogger(__name__) class FareFinder: def __init__(self, url: str, username: str, password: str, headers: dict, certificate: any, proxy: str or None, timeout: int, verify_ssl: bool): self.url = url self.headers = head...
true
ff78f830e47b1ed2a00961b627c52da98a582512
anahrgovic/PAF
/Ispit_4/zad3.py
UTF-8
498
2.90625
3
[]
no_license
import matplotlib.pyplot as plt import Pendulum as pnd p1=pnd.Pendulum(60,1,0.1,0.01) p1.oscillate(5) p2=pnd.Pendulum(1,1,0.1,0.01) p2.oscillate(5) plt.figure("pendulum1") plt.plot(p1.t_,p1.theta_) plt.figure("pendulum2") plt.plot(p2.t_,p2.theta_) plt.show() #kut otklona unosi se u stupnjevima te se u init funkci...
true
5c0e2d4244395942059700e6610781007d6bbb45
subinmun1997/Kakao_chatbot
/파이썬 시작하기/main1.py
UTF-8
105
2.953125
3
[]
no_license
from calc import add, mul a = add(10, 20) print('a={}'.format(a)) b = mul(10, 2) print('b={}'.format(b))
true
3a9ccb7c541556755caff1131fffd812bb4692d7
gshridhar/pylrn
/latticePath.py
UTF-8
745
4.09375
4
[]
no_license
#!/usr/bin/python # Author: Shridhar Gadekar # Date: 12th May 2015 # Purpose: Calculate the lattice paths in 20 x 20 grid """ Lattice paths Problem 15 Starting in the top left corner of a 2x2 grid and only able to move to to the right and down, there are exactly 6 routs to the bottom right corner. How many such rou...
true
0d157980188e334a4b2efa950ef75ab3ba8ade90
whyweplay/mcgcn
/metrics.py
UTF-8
1,304
2.59375
3
[]
no_license
#!/usr/local/bin/python import tensorflow as tf def masked_softmax_cross_entropy(preds, labels, mask): loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) loss *= mask return tf.reduce_mean(loss) def mask...
true
b87cad36280a876b83dbf09d846248ce5faa0e9e
konstantin0921/PyTorch_Tutorial
/clean_output_demo.py
UTF-8
559
3.25
3
[]
no_license
from IPython import display import pandas as pd from os import system, name from time import sleep # define our clear function def clear(): # for windows if name == "nt": _ = system("cls") # for mac and linux(here, os.name is 'posix') else: _ = system("clear") df_base = pd.DataFrame({...
true
6f4f89d4710013d17978062f7925dda89045c13a
WinterDing/pytest_prac
/tests/func/test_fixture.py
UTF-8
274
2.875
3
[]
no_license
#coding:utf-8 import pytest @pytest.fixture() def some_data(): return 42 def test_some_data(some_data): assert some_data == 42 @pytest.fixture() def a_tuple(): return (1, 'foo', None, {'bar':23}) def test_a_tuple(a_tuple): assert a_tuple[3]['bar'] == 23
true
3927eb3233937107db812f0a3af0f576c21fb021
nikhil-jagshettiwar/Python-Small-Projects
/decorator/decorator_4.py
UTF-8
807
3.703125
4
[]
no_license
class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return "Coord: " + str(self.__dict__) def add(a, b): return Coordinate(a.x + b.x, a.y + b.y) def sub(a, b): return Coordinate(a.x - b.x, a.y - b.y) def wrapper(function): def chec...
true
dbfb721631e0cb4f487ad573baabb6f226955a8f
seawavve/CSR
/tutorial/KoNLPy_tutorial.py
UTF-8
174
2.78125
3
[ "Apache-2.0" ]
permissive
! pip install konlpy from konlpy.tag import Okt okt=Okt() text=u'나는 오늘 배가 고프지 않아' print(okt.morphs(text)) print('***********') print(okt.nouns(text))
true
df3d7e0dc648ec836a8714abef6b0504e33b0323
dudupo/introcomputerscience
/exercises/script.py
UTF-8
181
2.734375
3
[]
no_license
fullpath = 'C:\\Users\\david~ponar\\workspace\\introHW\\exercises\\exercises\\ex\\ex{0}.py' def createExercies() : for i in range(2,20): open(fullpath.format(i) , 'x')
true
ac049196f3e0b10294b68b31f312d175f5632534
BramSW/iccv_2019_few_shot_3d_wallace
/extra_files/check_fine_tuning.py
UTF-8
404
2.59375
3
[]
no_license
import pickle import numpy as np num_shots_arr = [1,2,3,4,5,10,25] allowed_cats = ["benches", "cabinets", "lamps", "sofas", "rifles", "vessels"] a = pickle.load(open("finetuning_results_dict_generator_complete.pickle", "rb")) for num_shots in num_shots_arr: score = np.average([np.average(scores) for tup,scores i...
true
d291bcf242a208cbc5f5fd8d5d614ef97ea36fbd
fagan2888/lumen
/lumen/transforms/base.py
UTF-8
5,623
3.375
3
[]
no_license
""" The Transform components allow transforming tables in arbitrary ways. """ import datetime as dt import pandas as pd import param class Transform(param.Parameterized): """ A Transform provides the ability to transform a table supplied by a Source. """ transform_type = None __abstract = ...
true
be3d010d24ec82183280cc2e011a1db5b2001c38
BreenIsALie/-Python-Hello-World
/ex13.py
UTF-8
497
3.234375
3
[]
no_license
__author__ = 'BreenIsALie' # Exercise 13, Exercises taken from http://learnpythonthehardway.org/book/ # Parameters, unpacking and Variables # import the argument variable (argv) for use. This is a MODULE (IMPORTANT TO REMEMBER) from sys import argv # Take input from argv and assign it to variables script, first, sec...
true
562bfff1c2a8710a436542c220bb58d536d495b8
CodeFluid/BucleFor
/buclefor.py
UTF-8
83
3.8125
4
[]
no_license
veces = int(raw_input("Ingrese un numero: ")) for i in range(veces): print i
true
9d103ae0a5de382b8be439e949a06ca1e67ac8a3
kpaape/belt_reviewer
/apps/logins/models.py
UTF-8
2,259
2.625
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. import re import bcrypt EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') NAME_REGEX = re.compile(r'^[a-zA-z]+$') class UserManager(models.Manager): def basic_validat...
true
2fcb19932117e4f151f66f75a981b270eeecf059
nicolaswee/cs3219-d
/backend/post/s3_handler.py
UTF-8
819
2.765625
3
[]
no_license
import boto3 import os class S3File: s3_client = boto3.client( "s3", aws_access_key_id=os.environ['S3_KEY'], aws_secret_access_key=os.environ['S3_SECRET_ACCESS_KEY'] ) def __init__(self, S3_BUCKET): self.S3_BUCKET = S3_BUCKET def upload_file_to_s3(self, file, formatted...
true
d4928e6ec4b4d1e67b189c7ee4f0d4bc12f63965
OZDKS/django_girls_attempt
/sample.py
UTF-8
435
3.6875
4
[]
no_license
pytanie="Django grirls jest fajne? " czy_prawda = (4 == 3*2) print(pytanie) if czy_prawda: print('Jasne, ze jest! ;)') else: print('No niezbyt ;(') def welocome_on_django(name): print('Hi ' + name + '!') print('Welcome on Django Girls!') django_girls_list = {"Magda", "Kasia", "Ania", "Zuzia"} for name in djang...
true
21552868e180cc9236860fc5daf2a5d1acbd343b
sdyz5210/python
/selenium/keyboard.py
UTF-8
956
2.765625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/evn python # -*- coding: utf-8 -*- # python version 2.7.10 from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver = webdriver.Firefox() driver.get("http://www.baidu.cn") #输入框输入内容 driver.find_element_by_id("kw").send_keys("seleniumm") time.sleep(1) #删除多输入的字符m dr...
true
917790b917187685219999ce686416e27d126550
divyshri/AI-Learns-to-play-Flappy-Bird
/flappy_bird.py
UTF-8
15,547
3.4375
3
[]
no_license
""" The classic game of flappy bird. Make with python and pygame. Features pixel perfect collision using masks :o """ #importing all the required libraries import pygame import random import os import time import neat import pickle pygame.font.init() # init font #Set the Screen Width WIN_WIDTH = 600 WIN_HEIGHT = 80...
true
876f8761d595642f05ce06a70d843164d9110299
maniero/SOpt
/Python/Algorithm/SumPrimes.py
UTF-8
352
3.703125
4
[ "MIT" ]
permissive
n = int(input('Digite um número inteiro positivo: ')) soma = 0 conta = 0 num = 2 while conta < n: primo = True for i in range(2, num): if num % i == 0: primo = False break if primo: print(num) soma += num conta += 1 num += 1 print(soma) #https://pt....
true
7fe2671bce5441c3320e9b624f3566565a1809f2
DronicX/ANCLA
/functions/printData.py
UTF-8
201
3.25
3
[]
no_license
def printData(data, action, specification, variable = None): if variable is not None: for tweet in data["Tweets"]: print(tweet[variable]) else: print(data["Tweets"])
true
be0b849200b2b7dc312fc75daf974726c1de9678
serkef/google_jam_18
/0. Practice Session/3.horserace/horses.py
UTF-8
893
3.640625
4
[]
no_license
from operator import itemgetter speeds = [] for case in range(int(input(''))): horses = [] my_distance, horse_count = list(map(int, input('').split())) for i in range(horse_count): horse = {} x_pos, horse['speed'] = list(map(int, input('').split())) horse['distance'] = my_distanc...
true
dcfc62a592f4b80bd89235158c4d55d67ba98c64
colinkelleher/TeamSoftwareProject
/webfiles/analytics_charts_js.py
UTF-8
3,561
2.8125
3
[]
no_license
#!/usr/bin/python3 from python.webpage_functions import print_main, get_html_template from python.stockInfo.graphing_functions.graphing_functions_js import * from python.stockInfo.graphing_functions.graphing_functions import get_how_full_locations_are from json import dumps # Randomized list from https://gist.github....
true
5dcc3e07e0d1a4c32b982069d616e55086a68daa
BRReed/6001-PS
/ps2/hangman.py
UTF-8
10,547
4.53125
5
[]
no_license
# Problem Set 2, hangman.py # Name: # Collaborators: # Time spent: # Hangman Game # ----------------------------------- # Helper code # You don't need to understand this helper code, # but you will have to know how to use the functions # (so be sure to read the docstrings!) import random import string WORDLIST_FILEN...
true
376dcd72e7b6d75d5e468330601bc49536e56133
divya2424/crud-auth-django
/api/crud/serializers.py
UTF-8
1,987
2.53125
3
[]
no_license
from rest_framework import serializers from .models import Credential import requests from django.conf import settings import json headers = { "Content-Type": settings.CONTENT_TYPE, "Accept": settings.ACCEPT[0], } ''' Credential Serializer class created ''' class CredentialSerializer(serializers.Serializer): ...
true
b8ac7382ecbff05075004670c24fddce6122da00
PacktPublishing/Software-Architecture-with-Python
/Chapter05/thumbnail_pc.py
UTF-8
2,849
3.328125
3
[ "MIT" ]
permissive
# Code Listing #2 """ Thumbnail converter using producer-consumer architecture """ import threading import time import string import random import urllib.request from PIL import Image from queue import Queue class ThumbnailURL_Generator(threading.Thread): """ Worker class that generates image URLs """ de...
true
8ca5015597438f9071107605943077fead999ae3
MalteHillmann/fcivparser
/fcivparser.py
UTF-8
1,279
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/python # # Convert XML with hashes to CSV files # Thanks to @ddurvaux for sharing! # # Contribution: Malte F. Hillmann # import xml.etree.ElementTree as etree import argparse import base64 import ntpath # configure arguments accepted by this script parser = argparse.ArgumentParser(description='Process the X...
true
4fcc47c95e2521bebd667b89be1e46ef78eade85
darongliu/fairseq
/examples/disentengle_hubert/speech_feature_extraction/load_audio.py
UTF-8
750
3.078125
3
[ "MIT" ]
permissive
def load_audio(manifest_path): """ description: similar loading function as in fairseq, to load tsv file intput: wav2vec manifest format tsv file output: root: root directory names: filename inds: tot: number of files sizes: audio length """ names, in...
true
62d4baa92cd7f60f8369f28fd87b186af822e17f
giuscri/problem-solving-workout
/fizzbuzz.py
UTF-8
382
3.890625
4
[]
no_license
# Ispired by this post # http://blog.codinghorror.com/why-cant-programmers-program/ def fizzbuzz(a, b): for x in range(a, b): if x%3==0: print('Fizz',end='') if x%5==0: print('Buzz',end='') if x%3!=0 and x%5!=0: print(x,end='') # Very conservat...
true
00c69729b74199147540f9657b15af6a594d20ee
xuecheng27/WWW21-Structural-Information
/Q8_AnomalyDetection/anomaly_ba.py
UTF-8
12,094
2.703125
3
[]
no_license
import matplotlib matplotlib.rcParams['text.usetex'] = True from igraph import Graph import numpy as np from Q8_AnomalyDetection.distance_measure import * import matplotlib.pyplot as plt import logging.config import settings logging.config.dictConfig(settings.LOGGING_SETTINGS) logger = logging.getLogger('normal') cl...
true
d99c04705c38175bfdf2d80552d90e0cacb16d83
skang6283/broker-er
/prototype/recommendation.py
UTF-8
5,216
2.609375
3
[]
no_license
import os import math import pandas_datareader as web import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential from keras.layers import Dense, LSTM import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') import matplotlib matplotlib.use("agg") f...
true
3880c64eb65b79080feb54efcaa75c8270b18919
dagster-io/dagster
/examples/docs_snippets/docs_snippets/concepts/assets/observations.py
UTF-8
1,882
2.53125
3
[ "Apache-2.0" ]
permissive
# ruff: isort: skip_file from dagster import job, op def read_df(): return range(372) def read_df_for_date(_): return 1 def persist_to_storage(_): return "tmp" def calculate_bytes(_): return 1.0 # start_observation_asset_marker_0 from dagster import AssetObservation, op @op def observation_...
true
65fdab74a32475e1eafc1376b862b4b94ab016be
GayatriMunde/DataExtractFromPdf
/dataExtractFromPdf.py
UTF-8
1,729
3.390625
3
[]
no_license
#Importing the library import PyPDF2 import pandas as pd import re #Creating PDF object pdfFileObj = open(r"creditcard.pdf",'rb') pdfReader = PyPDF2.PdfFileReader(pdfFileObj) pageObj = pdfReader.getPage(0) # extracting text from page txt = pageObj.extractText() #print(txt) # closing the pdf file object pdfFileObj....
true
c8f0b983541825b0d6904277229bf6e7b3da98ac
leondelee/PointGCN
/utils/pooling.py
UTF-8
337
2.703125
3
[]
no_license
# Author: llw import torch as t def global_pooling(input_features): max_feature = t.max(input_features, 1).values var_feature = t.var(input_features, 1) return t.cat([max_feature, var_feature], dim=1) if __name__ == '__main__': a = t.randn(2, 3, 4); print(a) print(t.max(a, 1).values) # p...
true
2ab78f1fbd8014e39d14019fa8be7fabe362cc94
SIN3R6Y/xbox-tools
/python-scripts/xbox/nv2a.py
UTF-8
5,078
2.5625
3
[]
no_license
from . import memory def read_u8(address): return memory.read_u8(0xFD000000 + address) def read_u16(address): return memory.read_u16(0xFD000000 + address) def read_u32(address): return memory.read_u32(0xFD000000 + address) def write_u8(address, value): memory.write_u8(0xFD000000 + address, value) def write_u1...
true
0123e0a8047831e25f7e98a8e2939f15b9831d33
JulyKikuAkita/PythonPrac
/cs15211/PrimePalindrome.py
UTF-8
6,417
4.25
4
[ "Apache-2.0" ]
permissive
__source__ = 'https://leetcode.com/problems/prime-palindrome/' # Time: O(N) # Space: O(1) # # Description: Leetcode # 866. Prime Palindrome # # Find the smallest prime palindrome greater than or equal to N. # # Recall that a number is prime if it's only divisors are 1 and itself, and it is greater than 1. # # For exam...
true
3e7a0225fb08201ebd984a0a13da124910faaebf
SurabhiDhyani/gui
/calculator.py
UTF-8
2,932
3.296875
3
[]
no_license
from tkinter import * tk=Tk() tk.title("Calculator") en=Entry(tk,width=40, borderwidth=5) en.grid(row=0, column=0, columnspan=3, padx=5, pady=5) f_num=0 op="" def button_click(number): en.insert(END,number) def button_clear(): en.delete(0,END) def button_add(): input_num=en.get() gl...
true
2e9af9b69df5838afb23d415a2622a27fac0fb8b
orrmatityahu/pyramid
/main.py
UTF-8
856
3.328125
3
[]
no_license
from utils.file_utils import build_pyramid from utils.math_utils import build_paths, calculate_sum_for_paths, count_duplicates_numbers_in_array, sort_dict def main(): file_name = 'files\\input.txt' # get pyramid array try: pyramid = build_pyramid(file_name) except IOError: print 'File...
true
229e598d45027d7d6dc9dc70f60d617a3c755a85
Whodroppedthesoap/CSE
/Hangman - IvanM.py
UTF-8
878
3.421875
3
[]
no_license
import random Word_bank = ["Snap back to reality oops there goes humanity", "Reality is sometimes a disappointment", "It was and it was beautiful", "Thanos Snap", "I'm sorry little one", "You should've gone for the head", "I knew you would still care", "What did it cost? , Everything", "Aveng...
true
f8582f864b4b1a8deff28f226f6bd43f3d2e2211
FannyChung/PythonHardWay
/ex13.py
UTF-8
146
2.5625
3
[]
no_license
from sys import argv script, first, second, third=argv print "The script: ",script print"first: ",first print"second: ",second print"third:",third
true
5781d9b95d6d627cefc2cd55faf8e21357bf4d87
murane/PS
/Python/atcoder/ABC_184_B.py
UTF-8
165
3
3
[]
no_license
import sys r=sys.stdin.readline N,X=map(int,r().split()) S=r().strip() for ch in S: if ch=='o': X+=1 else: if X!=0: X-=1 print(X)
true
d0301fcc5b2fdcc4bfc461a025cef3166e42660c
Jackweb199229/python
/for loop in push-ups print.py
UTF-8
59
2.78125
3
[]
no_license
for char in "Push-ups": print(char) print("push-ups done")
true
3564b4a30022e165c6d99fc10cfdf15e59fb5af5
iMbaGong/PythonLearning
/Day7/str.py
UTF-8
159
3.125
3
[]
no_license
list1=[123,'adf ad',111,22] print(list1*5) list1+=[1,2] print(list1) print(list1[-1]) list1.append(2) print(list1[1].title()) print(list1[-3:-1]) print(*list1)
true
3e4a9ace8a56d80f15cbda831644badffd4a449f
imodpasteur/LoopExtrusion
/simulations/150kb_Unloading/input_data_generate_f1.py
UTF-8
1,125
2.734375
3
[ "MIT" ]
permissive
import numpy as np L=600 # Select random initial loading of extrusion start = np.random.randint(277,325) anchor_left=276 anchor_right=325 print("variable j equal", start-1) print("variable i equal", start+1) print("variable L equal", L) print("variable Left_anch equal", anchor_left) print("variable Right_anch equal", a...
true
bb5473a473396e2ed44d925289345f74b89f13d8
avellar1975/python
/cursoemvideo/exercicio032.py
UTF-8
201
3.90625
4
[]
no_license
ano = int(input('Digite um ano: ')) bissexto = ano % 4 if (bissexto == 0): print('O ano de {} é um ano BISSEXTO'.format(ano)) else: print('O ano de {} não é um ano bissexto'.format(ano))
true
78269c117c2a7e40c0c149a91a695192fad26a9a
GuptaAman08/CompetitiveCoding
/Code Chef/March 2019/March_2019_lunchtime/pogo_approach_2.py
UTF-8
246
2.59375
3
[]
no_license
list_a = [int(x) for x in input().split()] n, k = list_a list_b = [int(x) for x in input().split()] # def recursion(start, end): # if # return x cur_max = list_b[0] for i in range(k): res = recursion(i, k) # 5 2 # 3 6 4 7 2
true
ca95fb108cd9459b34da1cb7c499a678a011f729
crisgh/X-Serv-15.4-Django-calc
/calc/views.py
UTF-8
1,101
3.453125
3
[ "Apache-2.0" ]
permissive
from django.shortcuts import render from django.http import HttpResponse, HttpResponseNotFound # Create your views here. def calculadora(request): return HttpResponse('Puedes sumar, restar, multiplicar y dividir numeros mediante el formato:<p><FONT COLOR="blue"><b> 127.0.0.1:8000/numero(signo)numero</b></FONT></p...
true
fd63f1a79e427317a42854a195c5ce00d258ee80
YoussephAhmed/AutoMailSender
/SendingMails.py
UTF-8
1,176
3
3
[]
no_license
import os import sys import random import smtplib class applicant: __name = "" __mail = "" def __init__(self,name,mail): #assuming first line is name and second is mail self.__name=name self.__mail=mail def set_name(self, name): self.__name = name def set_mail(self, m...
true
62d1a2e420d6db5da380359fd8f9187fb3abc9d4
kmaterna/Tutorials_for_intermediate
/Pygmt/pygmt_colorbars.py
UTF-8
1,044
2.6875
3
[]
no_license
# Color bar examples import pygmt # Concepts: Colorbar placement, text labels, bounding box, triangles, units, intensity. min_vert=0 max_vert=10 label_interval=2; pygmt.makecpt(C="jet",T=str(min_vert-0.1)+"/"+str(max_vert+0.1)+"/0.1",H="mycpt.cpt"); fig = pygmt.Figure(); fig.coast(region=[-122.8, -121.8, 37.2, 38.2...
true
5bc086192b9883a874f413edbe512e084ea80ba2
grewy/practice_py
/Array/kadane.py
UTF-8
618
3.9375
4
[]
no_license
#!/usr/bin/python """ Given an array containing both negative and positive integers. Find the contiguous sub-array with maximum sum. """ class KadaneAlgo(object): def __init__(self, array): self._list = array def max_sum_subarray(self): sum_so_far = self._list[0] max_sum = self._list[...
true
342e6e3175fceec750ac38485753870acf1f9643
beebrain/fooling-dnn
/src/mnist_diff_arch.py
UTF-8
4,916
2.609375
3
[ "MIT" ]
permissive
import os import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras import backend as K from keras.models import load_model import numpy as np """ Here we test our fooling images with more...
true
fa443b32ead8aff26825402405c2d6ba17686126
kloong87li/catanomous
/boardtest.py
UTF-8
3,229
2.578125
3
[]
no_license
import cv2 import imutils import numpy as np from PIL import Image import argparse, time from utils.cv import CVUtils from utils.gui import GUIUtils from catan.config import CVConfig from catan.game import CatanomousGame from utils.debug import Debugger # Fetches an image # if source == 'C'. then get from camera d...
true
91509a5ff186d4f93504d6b5448baca698ba0137
chaozc/leetcode
/python/p005.py
UTF-8
1,119
3.09375
3
[]
no_license
#Manachar Algorithm #http://www.felix021.com/blog/read.php?2040 #O(n) class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ if len(s) == 0: return '' ps = "#" for ch in s: ps += ch+"#" m_id = 0 ...
true
3967c8773b638f3a8097e5ad8b67050e44b04655
git-thinker/OCR_dataset_generator
/generate.py
UTF-8
8,647
2.703125
3
[]
no_license
from PIL import Image, ImageDraw, ImageFont, ImageFilter from tqdm import tqdm import json import random import os import cv2 import numpy as np """ Noise generateing from https://www.cnblogs.com/wojianxin/p/12499928.html """ class Generator: def __init__(self): self.configPath = "cfg.json" def ...
true
9ce045506b7fd427ef27ec667b3487c7dae9369d
lotcarnage/code_storage
/python/tools/for_c/make_c_random_number_table.py
UTF-8
2,647
2.71875
3
[ "MIT" ]
permissive
import random _c_soruce_template = ''' #include <{c_header_file_name}> #include <stdint.h> const {number_type} {table_name}[{num_numbers}] = {{ {numbers} }}; '''[1:-1] _c_header_template = ''' #ifndef {include_guard} #define {include_guard} #include <stdint.h> #define NUMBER_OF_{table_name}_ELEMENTS ({num_numbers}) ...
true
b9dd587164d2f6dba553d0d457a5578d7fe77ab9
joyceliaoxy/Dog-and-Cat-classification
/image_classification.py
UTF-8
3,369
2.625
3
[]
no_license
# CNN practice code with Dog and Cat image data from kaggle import cv2 import numpy as np import os from random import shuffle from tqdm import tqdm import matplotlib.pyplot as plt train_dir = 'all/train' test_dir = 'all/test' # define image size and learning rate img_size = 50 lr = 1e-3 # read trianing data train_...
true
11f7c929979e69430d2e796d19f7f5516e222bc0
prinpice/Algorithm-Practice
/SW Expert Academy/[swexpert]1945_간단한 소인수분해.py
UTF-8
550
3.53125
4
[]
no_license
T = int(input()) for t in range(T): total_list = [0, 0, 0, 0, 0] N = int(input()) while N != 1: if N % 2 == 0: total_list[0] += 1 N = N // 2 if N % 3 == 0: total_list[1] += 1 N = N // 3 if N % 5 == 0: total_list[2] += 1 ...
true
d9cb7b1e299c54f6c89e8cc974fa12482cb94fa3
ArthurFMR/technical-test-backend
/backend/utils/manage_token.py
UTF-8
410
2.90625
3
[]
no_license
import jwt secret_key = "b'855119b3c4e5e95d7f9ff51e06277963'" def create_token(data): token = jwt.encode(data, secret_key, algorithm='HS256').decode('utf-8') return token def decode_token(token): if "Bearer" in token: # if the token come with Bearer header, remove it token = token.replace('Bea...
true
890d848f3bbe000864469dc2d1d386689209cdd9
keiouok/atcoder
/ABC/126/e.py
UTF-8
2,575
3.125
3
[]
no_license
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii...
true
bc9c480d5ad25ac6ba8ad8314b7705d73056d36b
WiseHoon/python
/0103/tuple1.py
UTF-8
125
3.0625
3
[]
no_license
mytuple1 = [0.1,0.2] mytuple2 =(1,2,3,4,mytuple1) mytuple1.append(0.3) mytuple3 = tuple(mytuple1) print(mytuple3)
true
4b23f79de318ef0ceeb5f5d95a674a63e2538760
asolove/My-Chess-Game
/chess_board.py
UTF-8
2,929
4.1875
4
[]
no_license
"""This creates the board consisting of all the various squares. """ # Each square on the board is going to be its own object class Square(object): #I will need to create the board before placing pieces #Otherwise the squares will be set to empty occupying_piece = None def __init__(self, color): ...
true
9e1c5462b0c27b55077e18b554789ba2d1fe2223
Rvk1605/Python
/Programs/Lisa Workbook.py
UTF-8
231
2.796875
3
[]
no_license
n,k=map(int, input().split()) a=list(map(int, input().split())) pg=0 count=1 for i in a: for j in range(1,i+1): if j==k or j==i+1: pg=pg+1 if j==pg: count=count+1 print(count)
true
7f31435d5c5232d0e763658b3371c097f781765b
Official21A/PyCookNum
/6.Complex/complex.py
UTF-8
492
4.3125
4
[]
no_license
# Problem 6 # Working with complex numbers, and performing mathmatical operations on them. # They can be used very simple in two ways a = complex(2, 4) # 2 + 4j b = 3 - 5j # Methods a.real # 2 a.imag # 4 a.conjugate() # 2 - 4j # Math c = a + b # 5 - j d = a * b # 26 + 2j e = a / b # 23.. + 63.. j # To do complicate ...
true
0bb4b58b814a267bbad8080a2df2e2e746f4e787
rehabiftikhar93/web-development
/error.py
UTF-8
380
3.296875
3
[ "Unlicense" ]
permissive
def spam (DividedBy): try: return 42/DividedBy except ZeroDivisionError: print('error') print (spam(2)) print (spam(12)) print (spam(0)) print (spam(1)) def spam (DividedBy): return 42/DividedBy try: print (spam(2)) print (spam(12)) print (spam(0)) print ...
true
2e42887a863c7120d1c46505baf4a491112be8c5
Anupam124jain/ICO
/webapp/py_solc/buyToken.py
UTF-8
943
2.609375
3
[]
no_license
from webapp.py_solc.ERC20 import IcoToken from webapp.py_solc.crowd_sale import CrowdSale import binascii class BuyTokens: crowdsale = CrowdSale() token = IcoToken() crowd_sale_address = crowdsale.crowdsale_contract_address token_address = token.token_contract_address w3 = token.w3 #Set cr...
true
bd4913ba7101c3e6b19fb9e8cb03b253b84a3ed0
joostnibbeling/node-immunisation
/code/example_ga_mo.py
UTF-8
2,133
2.890625
3
[]
no_license
""" Approximates Pareto front for multiobjective immunisation with a single run of SMS-EMOA and NSGAII GA Then plots the results """ import ga import utils import matplotlib.pyplot as plt graph = utils.get_graph("graphs/karate.gml") adj = utils.get_adj_np(graph) # The GA operators parameters = {} parameters['lda'] ...
true
7627f76fd5af7c73aa2b338ceccb3bab33daa3c5
jsyangcs/SImple-python-scripts
/class_attr.py
UTF-8
188
3.265625
3
[]
no_license
class Person(object): __count=0 def __init__(self,name): self.name=name Person.__count=Person.__count+1 print Person.__count p1=Person('Bob') p2=Person('Adam') print Person.__count
true
4399b8b70b7c0ef10a2a03006cf78b849441059d
miyamotok0105/python_sample
/tutorial/c-api/memory/gc1.py
UTF-8
886
2.953125
3
[]
no_license
import gc import resource import ctypes def mem(): print('Memory usage : % 2.2f MB' % round( resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024.0/1024.0,1) ) # We are using ctypes to access our unreachable objects by memory address. class PyObject(ctypes.Structure): _fields_ = [("refcn...
true
21d27a26da70b8b98497a83b832538e22afce2b5
jung9156/studies
/lecture/algorithm/problem/1213.string.py
UTF-8
282
3.359375
3
[]
no_license
for ir in range(10): n = int(input()) word = input() words = input() wn = len(word) cou = 0 for idx in range(len(words)): if words[idx] == word[0]: if words[idx:idx+wn] == word: cou += 1 print('#{} {}'.format(n, cou))
true
1185df0536d7ce783116fb8a9f819709cf218e4a
megasan/210-CT
/coursework 3.py
UTF-8
746
4.375
4
[ "MIT" ]
permissive
""" Write the pseudocode for a function which returns the highest perfect square which is less or equal to its parameter (a positive integer). Implement this in a programming language of your choice. """ def power(number): x = 1 """ check if every square number going up from 1 fits. """ while x * x < ...
true
44b990f6c049a3ac7c121abb9321b15d525b41c2
sunnovosad/Py3007
/Lesson_04/04_home_task_0.py
UTF-8
1,482
4.78125
5
[]
no_license
# 0.0 # Вывести на экран все числа в диапазоне от 10 до 20 for i in range(10, 21): print(i) print('*' * 30); print() # 0.1 # Спросить у пользователя два числа: a и b, вывести все числа в диапазоне от a до b. a = int(input('Enter number a: ')) b = int(input('Enter number b: ')) print('Range for [a, b] will be: '...
true