blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
000f3e4956c35a1271281b4980f18f4271a3dabc
Python
dcrozz/GRADUATION-PRACTICE
/CRF/FeatureSelect.py
UTF-8
6,172
2.578125
3
[]
no_license
""" Feature Selection by Chi measure that can control numbers of labels example: py filename feature_number label1 label2 To be done (any amount of label) """ #coding:utf-8 def getFile(filename,label1,label2): lst = [] with open(filename) as f: #for test modify the line to 10 for line in f.readlines(): cur_...
true
66a12d4dabead12ce7b1dee5533bcf513c1e7efc
Python
usman-tahir/rubyeuler
/selection_sort.py
UTF-8
466
3.5625
4
[]
no_license
#!/usr/bin/env python from copy import deepcopy def selection_sort(array): new_array = deepcopy(array) for i in xrange(0,len(array)): for j in xrange(i,len(array)): if new_array[i] > new_array[j]: new_array[i], new_array[j] = new_array[j], new_array[i] return new_array ...
true
17021b5903df997dd916506a8e68c8e738ab914e
Python
Radu-Raicea/Stock-Analyzer
/flask/project/services/google_finance.py
UTF-8
3,659
2.90625
3
[ "BSD-3-Clause" ]
permissive
import re from decimal import Decimal from datetime import date from pyquery import PyQuery import requests import json GOOGLE_FINANCE_REPORT_TYPES = { 'inc': 'Income Statement', 'bal': 'Balance Sheet', 'cas': 'Cash Flow', } DATE = re.compile('.*(\d{4})-(\d{2})-(\d{2}).*') class GoogleFinance(object): ...
true
2fcd21cb5f58329e9b5cec3a5f2dcc26adc7375f
Python
Spider251/python
/pbase/day09/code/keywords_give_args.py
UTF-8
204
3.1875
3
[]
no_license
# keywords_give_args.py #此示例示意关键字传参 def myfun1(a,b,c): print("a的值是:",a) print("b的值是:",b) print("c的值是:",c) myfun1(c = 300, b = 200, a = 100)
true
765268893ba63101725420947a121724a53fb7ed
Python
santoshmurugan/Deep-Learning-COVID19-Detection
/dataloader.py
UTF-8
2,342
2.75
3
[]
no_license
import os from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from sklearn.model_selection import train_test_split import numpy as np from PIL import Image import torch import torchvision.transforms as transforms from pathlib import Path def get_dataloaders(device): '...
true
407c52cdc7910a9df20be5d1850da61010d8edcb
Python
sidtrip/hello_world
/CS106A/week5/sec5/heads_up.py
UTF-8
570
4.0625
4
[]
no_license
import random # Name of the file to read in! FILE_NAME = 'cswords.txt' def main(): # read the file words_list = load_data() # chosse a random word while True: #wait fo input input('Press enter for next word: ') #choose random number choice = random.choice(words_list) ...
true
964339532b419da2f5583b9c75cede7194827662
Python
kwokmoonho/Game_Python
/Asteroid/game.py
UTF-8
7,446
3.65625
4
[]
no_license
""" File: asteroids.py Original Author: Br. Burton Designed to be completed by others This program implements the asteroids game. Modified by: Kwok Moon Ho Class: CS241 Added features: 1. background 2. machine gun 3. game over (after ship killed) 4. you win (after you kill all the asteriods) 5. draw score """ from gl...
true
5b4345d760b043700e9c19d34adaebd6f218f179
Python
daniel36933/repositorio-2
/Biography_info.py
UTF-8
1,020
4.28125
4
[]
no_license
name = input("¿Cual es tu nombre?")#validación de solo letras. Date = input("Dame el día, el mes y el año, solo en números, ejemplo: 29 01 2021")#validación de solo números. Address = input("Dame la calle donde vives")#validación de solo letras y numeros. Metas = input("Metas personales")#validación de solo letras. pr...
true
aa03756ad49ec8831663d06a7367795f1df05b74
Python
tkyf/nlp100
/1chapter/07.py
UTF-8
220
3.59375
4
[]
no_license
#! /usr/bin/env python # -*- coding:utf-8 -*- def make_sentence(x, y, z): return "{}時の{}は{}".format(x, y, z) def main(): print(make_sentence(12, '気温', 22.4)) if __name__ == '__main__': main()
true
5ee04d558cf91d4a733c00b4fb71c5165d8e3528
Python
hoangcuong93/hoangcuong9x-fundamental-c4e23
/hoangcuong9x-fundamental-c4e23/session2/inso.py
UTF-8
119
3.640625
4
[]
no_license
n = int(input("n = ")) m = int(input("m = ")) for i in range(n, m + 1): r = i % 2 if r == 0: print(i)
true
7588162202427dea680c8847a8e2cce5240ed2e6
Python
LyunJ/pythonStudy
/18_OOP/static_method_class_method.py
UTF-8
510
4.03125
4
[]
no_license
# 정적 메소드 class Calc: @staticmethod def add(a, b): return a + b print(Calc().add(1, 2)) # 클래스 메소드 # self를 통하지 않고 바로 클래스가 메소드 호출 # 클래스 변수를 이용하는 메소드를 정의 class Person: count = 0 def __init__(self): Person.count += 1 @classmethod def show_count(cls): print('%d명 태어났습니다' % ...
true
df547fb5207882019a495ee1ea666f41f23a2acd
Python
kwmsmith/julia-shootout
/julia/julia_pure_python.py
UTF-8
1,164
2.953125
3
[ "BSD-2-Clause" ]
permissive
#----------------------------------------------------------------------------- # Copyright (c) 2012, Enthought, Inc. # All rights reserved. See LICENSE.txt for details. # # Author: Kurt W. Smith # Date: 26 March 2012 #----------------------------------------------------------------------------- # --- Python / Numpy ...
true
9961b0e9c8b8c659429732422eadfb0660e50292
Python
krispharper/AdventOfCode
/2016/14/1.py
UTF-8
924
3.375
3
[]
no_license
from hashlib import md5 def get_repeated_character(s, length): for i in range(len(s) - length + 1): if len(set(s[i:i + length])) == 1: return s[i] return None def set_hashes(hashes, number_of_hashings): for i in range(100000): s = salt + str(i).encode('ascii') for _...
true
f87751af67ae80e268ab4789d25cf43c649c0195
Python
FlavioK/Pren1GR33
/python/alignmentCalculatorConfigurator.py
UTF-8
1,309
2.640625
3
[]
no_license
__author__ = 'orceN' import sys import ConfigParser import argparse parser = ConfigParser.SafeConfigParser() parser.read('alignmentCalculatorDefinitions.cfg') argsparser = argparse.ArgumentParser(description='Configurator for alignmentCalculator definitions') argsparser.add_argument('-g', '--get', nargs=2, action='s...
true
aeffb30e6bb5e9344c68f1a40e62c82adfda7356
Python
kumc-bmi/i2p-transform
/ADD_SCILHS_100/query.py
UTF-8
8,442
2.625
3
[ "MIT" ]
permissive
from collections import OrderedDict #import cx_Oracle as cx # Please uncomment this if using Oracle import datetime import logging import os import re import sqlparse import sys import pymssql class mockLog(object): def p(self, s): print s def info(self, s): p(s) def debug(self, s): ...
true
98a4cf4aa7e87c0e5918d5150582fc6479748b1a
Python
lukasz-migas/SimpleParam
/simpleparam/utilities.py
UTF-8
2,083
3.25
3
[ "MIT" ]
permissive
"""Utilities""" import inspect import numbers def is_number(obj): """Check if value is a number""" if isinstance(obj, numbers.Number): return True # The extra check is for classes that behave like numbers, such as those # found in numpy, gmpy, etc. elif hasattr(obj, "__int__") and hasattr(...
true
acadd4a3d5ef978b8e0b2a292c07bb7fc35d0862
Python
hycesar/ls_ProtocolosComunicacao
/old_version/client.py
UTF-8
7,117
2.6875
3
[]
no_license
# terminal import os # constants import constant # tcp import socket # crypto suport import cript # passwords from getpass import getpass # intrusion import time # decode import base64 class Client: def __init__(self): self.CONN() def CONN(self): print("Abrindo socket...") self....
true
6af0e2a9782f95623a1ea89a33885a8d70e3c1a9
Python
Romalouz/Automation
/media/pc/manager.py
UTF-8
1,272
2.515625
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- # Title: manager.py # Package: Pc # Author: Romain Gigault import socket import struct from media import media class PCManager(object): def wake_on_lan(self,macaddress): """ Switches on remote computers using WOL. """ error = False # Ch...
true
dfc8f9e07351ce4e516775cc986b05b7b1f41d2b
Python
jpnewman/print_photo_exif_info
/helpers.py
UTF-8
3,117
2.59375
3
[ "MIT" ]
permissive
import exifread from mezmorize import Cache CACHE = Cache(CACHE_TYPE='filesystem', CACHE_DIR='cache') # https://github.com/drewsberry/gpsextract/blob/master/gpsread.py def ratio_to_float(ratio): """ratio_to_float.""" # Takes exif tag value ratio as input and outputs float if not isinstance(ratio, exif...
true
3c664c9b2609e81502df7123b64a19c695c9e13c
Python
moe-auda/pythonProject1
/app6.py
UTF-8
78
2.90625
3
[]
no_license
#tuples cant be modified like lists coordinates = (4, 5) print(coordinates[0])
true
863c256d9b9aae675365769bc7021f6724e83fe1
Python
Edogawa-Konan/code_in_school
/network/HW5/udp_scan.py
UTF-8
1,245
2.578125
3
[]
no_license
# -*- coding:utf-8 -*- # -*- by prime -*- import socket import struct class udp_scan: def __init__(self,hostname,timeout=3): self.host=hostname self.sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) self.sock.settimeout(timeout) def scan(self): for port in [53]: ...
true
54f650a5625234e04442667debb69d10e645e31d
Python
bayramtuccar/PythonNote
/hackerrank/countingValleys.py
UTF-8
2,372
3.3125
3
[]
no_license
#!/bin/python3 import sys UP_INPUT_TEXT = "U" DOWN_INPUT_TEXT = "D" EQUEL_TEXT = "_" UP_TEXT = "/" DOWN_TEXT = "\\" DRAW_MODE_ON = False def inc_dec_index(cur_text, new_text): ' Calculate index shift' inc_idx = 0 cur_char = cur_text[cur_text.__len__() - 1] if cur_char.__eq__(new_...
true
2038f5b93c7987a1284d279f6feac4fc4ee33424
Python
gloryxiao/python-core
/src/py2/base_dev/with_clause.py
UTF-8
681
3.25
3
[]
no_license
#!/user/bin/env python # coding=utf-8 import traceback class func(object): def __enter__(self): # raise Exception("haha") pass def __exit__(self, type, value, trace): print type print value print trace print traceback.format_exc(trace) # return True ...
true
f8703a82ad999125a182712b7f86e6f72192a498
Python
vyahello/upgrade-python-kata
/kata/08/decorators.py
UTF-8
1,966
4.21875
4
[ "MIT" ]
permissive
""" You have to write a bunch of decorators to trace execution. ----------------------------------- For doctests run following command: python -m xdoctest -v decorators.py or python3 -m xdoctest -v decorators.py For manual testing run: python decorators.py """ from typing import Callable, Generator, Any from functool...
true
1f984b41d7e53cdb6e4b74ac9094e2411d83ce83
Python
huyaoyu/numpy_2_pointcloud
/scripts/CameraDescriptor.py
UTF-8
1,317
2.640625
3
[]
no_license
import json import numpy as np from pyquaternion import Quaternion class CameraDescriptor(object): def __init__(self): super(CameraDescriptor, self).__init__() self.id = -1 self.centroid = None self.quaternion = None def get_id(self): return self.id def get_centr...
true
068f71938b6e302a0346180afa4907994f18655c
Python
gabriellaec/desoft-analise-exercicios
/backup/user_138/ch153_2020_04_13_20_21_31_494396.py
UTF-8
424
2.640625
3
[]
no_license
def agrupa_por_idade(dict1): dict2={} lista=[] for k in dict1.keys(): if k<=11: lista.append(k) dict2['criança']=lista elif k<=17: lista.append(k) dict2['adolescente']=lista elif k<=59: lista.append(k) dict2['adu...
true
f9cecdd5440c7a202d3ef2ad4ae8f2640c71fb44
Python
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/83_6.py
UTF-8
2,490
4.09375
4
[]
no_license
Python | Frequency of numbers in String Sometimes, while working with Strings, we can have a problem in which we need to check how many of numerics are present in strings. This is a common problem and have application across many domains like day-day programming and data science. Lets discuss certain ways in ...
true
9dddf912168b4a540ea7a4cf8f12d1f6d654393f
Python
knwnw/yandex-algorithmic-training
/lesson4/f.py
UTF-8
448
3.46875
3
[]
no_license
import sys data = sys.stdin.read() d = {} for line in data.strip().split('\n'): name, item, quantity = line.strip().split() if name not in d: d[name] = {item: int(quantity)} else: if item not in d[name]: d[name][item] = int(quantity) else: d[name][item] += ...
true
1943c8b6c5135b29865b9fb6716d7a8295e42888
Python
PaulJermann/ProjetPythonOrbitales
/1sFiona(prefix).py
UTF-8
1,182
2.953125
3
[]
no_license
import numpy from math import pi import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np #on cree plein de valeurs pour faire la grille dz=0.5 zmin=0 zmax=20 x = np.arange(zmin,zmax,dz...
true
3c229e2dffa84990d1840a32a9446bef9117e58c
Python
JoyD424/mesh_repair
/viewCrossSections.py
UTF-8
16,426
3.34375
3
[]
no_license
import sys, math, pygame, OpenGL, copy from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * # Constants SCREEN_WIDTH = 500 SCREEN_HEIGHT = 500 # Basic Colors black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] red = [1.0, 0.0, 0.0] ###################################...
true
066b2482b35e20b95f13883eacc41a3241945a10
Python
andersonpablo/Exercicios_Python
/Aula07/avaliando02-area-circulo.py
UTF-8
633
4.71875
5
[]
no_license
# -*- coding: utf-8 -*- # 2. Faça um algoritmo para calcular a área de um círculo, dado o valor do seu raio, que deve ser positivo # (maior que 0). A fórmula da área do círculo é: area = 3.14 * (raio ** 2). # Lê o valor do raio raio = float(input("Digite o raio do círculo: ")) # Verifica se o valor é positivo if rai...
true
6fef3a4904fbfcbcd1e8f9579f0a070a4c234c47
Python
hllj/projectai1
/algorithm.py
UTF-8
927
2.5625
3
[]
no_license
from environment import Environment import matplotlib.pyplot as plt WMAX = 1e3 dx = [-1, 0, 1, 1, 1, 0, -1, -1] dy = [1, 1, 1, 0, -1, -1, -1, 0] class Algorithm(): def __init__(self, start_point, end_point, ENV): self.E = ENV self.start_point = start_point self.end_point = end_point ...
true
8b8fab712fac9120708b388d86594de7a05f5370
Python
neuroph12/nlpy
/nltks/ppattachment.py
UTF-8
459
2.640625
3
[]
no_license
# Prepositional Phrase Attachment Corpus from collections import defaultdict import nltk entries = nltk.corpus.ppattach.attachments('training') table = defaultdict(lambda: defaultdict(set)) for entry in entries: key = entry.noun1 + '-' + entry.prep + '-' + entry.noun2 table[key][entry.attachment].add(entry.ver...
true
b89aed7f77928761291eb0f9fc0ea5bfe7ff3246
Python
augus2349/CYPFranciscoMC
/tira.py
UTF-8
118
2.65625
3
[]
no_license
if a > 6: if a==10: print("jdvjrfj") else: print("ijvoerfrfok") else: print("juifegoirj")
true
16ba5e6ae3a0ae742c81a7005655f7daef4d3b55
Python
davidgascon/qr_reader-scanner
/misc/last_name_cleanser.py
UTF-8
1,599
3.875
4
[]
no_license
#used to clean the data from the original last names csv. #initially I used pandas, but I quickly learned it would be easy to work with the csv file rather than the data type that pandas imported it as. I realized this when I tried to clean each name. #The main difference between this and first name cleanser is how the...
true
53ab30afc8a4fb2995f283e3460c71128fdb6720
Python
plusline/picoctf-2018-writeup
/General Skills/script me/script_me_solution.py
UTF-8
851
2.71875
3
[]
no_license
proble= '((())()) + (()()()) + (()) + () + (()()()(())()()) + (()) + (((()())()())()) + ()() + (()) + (()()()()()()()())' proble=proble.split(" + ") num=[] for one in proble: count=0 max_c=0 for i in range(len(one)): if one[i]=='(': count+=1 elif one[i]==')': ...
true
f08062b63a8db10fb4299d10ab978ca911f72bf6
Python
kpatel1293/CodingDojo
/DojoAssignments/Python/PythonFundamentals/Assignments/8_MultiplicationTable.py
UTF-8
1,150
4.40625
4
[]
no_license
# Optional Assignment: Multiplication Table # Create a program that prints a multiplication table in your console. # Your table should look like the following example: ''' x 1 2 3 4 5 6 7 8 9 10 11 12 1 1 2 3 4 5 6 7 8 9 10 11 12 2 2 4 6 8 10 12 14 16 18 20 22 24 3 3 6 9 12 15...
true
ea647e87cb34bd0c884183daf2802c52617dae8c
Python
Truncuso/astar_pathfinding_node_networks
/extract_canvas.py
UTF-8
3,153
2.828125
3
[]
no_license
import base64 import time import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options import os from PIL import Image from PIL import ImageDraw def test_url(): options = Options() user = "i7 8700" # change this to your windows username options.add_argu...
true
da1e7e801bd7723189f8748e77f9a463fd50d73e
Python
KocUniversity/comp100-2021f-ps0-olordevilg
/main.py
UTF-8
140
3.28125
3
[]
no_license
import numpy x = int(input("Enter x: ")) y = int(input("Enter y: ")) l = float(numpy.log2(x)) i = int("78457") print(x**y) print(l) print(i)
true
73143e1fcecb4f4a8a3e4dcac5fa6c360d7335e0
Python
tnakaicode/jburkardt-python
/i4lib/i4_huge.py
UTF-8
1,157
2.6875
3
[]
no_license
#! /usr/bin/env python # def i4_huge ( ): #*****************************************************************************80 # ## I4_HUGE returns a "huge" I4. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 04 April 2013 # # Author: # # John Burkardt # # Parameters...
true
0c16acea5a110f65daa313af62e16d8053c0eb42
Python
Chadtech/ChadTech-vSatz
/subbrackets.py
UTF-8
1,944
2.78125
3
[]
no_license
whichChar=brackets__leftparentheses for yit in range(len(whichChar.keys)): if event.key in whichChar.keys[yit] and whichChar.keys[yit].issubset(keys): charray.charen[curChar-1][2].append(whichChar) whichChar=brackets__rightparentheses for yit in range(len(whichChar.keys)): if event.key in whichChar.keys[yit] and w...
true
de7656c0458db1e1fdf9f35071d4ab0324f8f030
Python
adityatrivedi94/insertionsort
/insertionsort.py
UTF-8
286
3.640625
4
[]
no_license
def insertionsort(arr): for i in range(1,len(arr)): key =arr[i] j=i-1 while j>=0 and key <arr[j] : arr[j+1] =arr[j] j -= 1 arr[j+1] =key #Driver code to test arr =[12,11,13,5,6] insertionsort(arr) print ("sorted arry is:") for i in range(len(arr)): print ("%d" %arr[i])
true
05f5610f032c1923ed4cdabe6915deaaec7a573d
Python
UCL-EO/gurl
/gurl/list_file.py
UTF-8
11,085
3.09375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from pathlib import PosixPath, _PosixFlavour, PurePath from pathlib import Path from urlpath import URL import sys import stat ''' listfile utilities class based on list This is a particular type of list where we assume all items are filenames, URLs o...
true
e3307335edc442870675beb9473e81003477868f
Python
openpolis/pandaSDMX
/pandasdmx/message.py
UTF-8
5,382
2.71875
3
[ "Python-2.0", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
"""Classes for SDMX messages. :class:`Message` and related classes are not defined in the SDMX :doc:`information model <implementation>`, but in the :ref:`SDMX-ML standard <formats>`. pandaSDMX also uses :class:`DataMessage` to encapsulate SDMX-JSON data returned by data sources. """ from typing import ( List, ...
true
42c92713692c46014fd5afe1119718ec94eca313
Python
theodormanolescu/hero
/domain/character/took_damage.py
UTF-8
360
2.9375
3
[]
no_license
from application.event_interface import EventInterface class TookDamage(EventInterface): def __init__(self, character: 'Character', value: int): """ :type character: domain.character.character.Character """ self.character = character self.value = value def get_name(sel...
true
cf894985f1626978a8bf442a0c32c5a2f088d827
Python
Ge0f3/CTCI-Prep
/ch_1_Arrays_Strings/set_zero/set_zero.py
UTF-8
938
3.5625
4
[]
no_license
import unittest #O(MxN) solution with additional memory def setZero(matrix): row , cols = set(), set() for i in range(len(matrix)): for j in range(len(matrix[0])): if(matrix[i][j]) == 0: row.add(i) cols.add(j) for i in range(len(matrix)): for...
true
98e83161276ee4a51afdb8a487d9135a0c690379
Python
belozi/Python-Programs
/MITx 6.00.1x/lecture_5/L5_problem_8a.py
UTF-8
419
3.34375
3
[]
no_license
def isIn(char, aStr): if aStr == "": return False guess = len(aStr)/2 if aStr[guess] == "": return False elif aStr[guess] == char: return True elif char > aStr[-1] or char < aStr[0]: return False elif aStr[guess] > char: aStr = aStr[:guess] else: ...
true
6f54d1b329cb64a75cb415c7bc15de9d87f4506c
Python
markymauro13/CSIT104_05FA19
/10-28-19/function2.py
UTF-8
64
3.265625
3
[]
no_license
def sum(num1, num2): total = num1 + num2 print(sum(1,2))
true
823522176229d2f8028517876a8962eccf12bdf4
Python
nataliadolina/WebServer
/index1.py
UTF-8
5,943
2.578125
3
[]
no_license
from flask import Flask, url_for app = Flask(__name__) @app.route('/') @app.route('/index') def index(): return "<h1>Привет, Яндекс!</h1>" @app.route('/image_sample') def image(): return '''<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> ...
true
efca31bd1595a76df6cc5de9c173d058329823c4
Python
mek4nr/GANG-siteweb
/gangauth/utils.py
UTF-8
2,399
2.53125
3
[]
no_license
#!/usr/bin/env python from random import choice, shuffle from string import ( ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation ) from django.template.loader import get_template from django.template import Context from gangauth.models import EmailCheck from gangdev.utils import se...
true
04ab60844602197d9706bb3e2321106cd5874244
Python
BeeRedRnD/Financial-Data-Analysis-Python
/app.py
UTF-8
3,710
2.75
3
[]
no_license
import matplotlib matplotlib.use import matplotlib.pyplot as mpl import pandas as pd # Just making the plots look better mpl.style.use('ggplot') mpl.rcParams['figure.figsize'] = (8,6) mpl.rcParams['font.size'] = 12 def header(msg): print('*' * 150) print('[ ' + msg + ' ]') # Read the Fair Users CSV file ...
true
eec2179d6cf208a99d337f119e260253ba3bae88
Python
590shun/video_summarizer
/utils/eval.py
UTF-8
5,622
2.703125
3
[]
no_license
import os import sys import math import numpy as np from scipy import stats sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils.knapsack import knapsack_ortools """ From original implementations of Kaiyang Zhou and Jiri Fajtl https://github.com/KaiyangZhou/pytorch-vsumm-reinforce ht...
true
25d040fdb410c8f06770877724cf345431f6a0d1
Python
joepearson95/CloudComputing-AutoDeployment
/bucket.py
UTF-8
800
3.125
3
[]
no_license
# Imports for creating a random string in order to allow the bucket to be unique import random import string # Function that takes in an integer that specifies the length of the random string generated def random_string(length): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in ra...
true
4bcd871d5d857828c34970321723f24c9fe34935
Python
arty-hlr/CTF-writeups
/2019/Insomnihack/curlpipebash/writeup.py
UTF-8
648
2.78125
3
[]
no_license
import requests headers = { "User-Agent": "curl/7.61.0" # if it looks like curl and talks like curl... } def main(): url = "https://curlpipebash.teaser.insomnihack.ch/print-flag.sh" r = requests.get(url, headers=headers, stream=True) for l in r.iter_lines(): print("print-flag got line: {}".for...
true
5ddafff479459935ed9654091e92d62c24079ec2
Python
ruslankrivoshein/gcp_sdk
/infra/bigquery/cl_direction/cl_direction_schema.py
UTF-8
1,163
2.78125
3
[]
no_license
import os import time from dotenv import load_dotenv from google.cloud import bigquery def create_dm_direction_schema(): load_dotenv() client = bigquery.Client() dataset_id = os.environ.get("DATASET_ID") project_id = os.environ.get("PROJECT_ID") table_name = 'cl_direction' query = f""" ...
true
c23b06c09ade82274a8f6118fce9169f6dd0c3a0
Python
Chalol/Pygame-calculator
/calculator_by_Pygame ver.2.py
UTF-8
10,578
3.09375
3
[]
no_license
# This code is about calculator by PyGame for calculate # This is second version # for subject Software development and practice I # Code by 6001012630021 Chanakan Thimkham # Ref. of my code : # Module : https://www.pygame.org/docs/ # Change button color : https://bit.ly/2p3bSUI # Github : https:/...
true
de6aa463ee47ffa87cad71c27d15cd9f386c660b
Python
Programacion-Algoritmos-18-2/ejercicio-extra-clase-s7-JosePullaguariQ
/principal.py
UTF-8
778
3.609375
4
[]
no_license
#Importamos todas la clases que vamos a utilizar from modelado.mimodelo import * listaDatos = [88, 55,0, 7, 2, 56, 34, 1, 99, 15] #Creamos una lista con los elementos a ordenar objOr = Ordenamiento(listaDatos) #Creamos un objeto tipo Ordenamiento para obtener los metodos que ordenan print("Arreglo desor...
true
da978a1a566f71514527a52823680d9f75b69115
Python
falcondai/influence-game
/main/login.py
UTF-8
2,130
2.75
3
[ "MIT" ]
permissive
from flask.ext.login import LoginManager, UserMixin from bson.objectid import ObjectId from Crypto import Random, Hash from main import app from database import mongo login_manager = LoginManager() login_manager.init_app(app) class User(UserMixin): def __init__(self, user_dict=None, **kwargs): ...
true
c97701752538fe3fb147c21cac3a9174259973eb
Python
mhgd3250905/CleanWaterSpiderOnPython
/Spiders/HXSpider.py
UTF-8
1,971
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- from Bmob import BmobUtils from HtmlUtils import HtmlGetUtils,HtmlPostUtils from ListHtmlSpider import HXHtmlDealUtils from ContentSpider import ContentHtmlSpider class HX: #http://wap.ithome.com/ithome/getajaxdata.aspx?page=2&type=wapcategorypage def startSpider(self): ''' ...
true
c5968e3405970ac08b154248564b2ff0d4b55ab0
Python
YuenyongPhookrongnak/01_TradingSeries
/Part5_6_live_trading.py
UTF-8
4,365
2.640625
3
[]
no_license
import pandas as pd from binance.client import Client from binance_keys import api_key, secret_key from datetime import datetime, timedelta import time from binance.exceptions import * from auxiliary_functions import * client = Client(api_key, secret_key) symbols = ['BTC','ETH','LTC'] start_n_hours_ago = 48 balance_u...
true
5c1cbeffe05d59bec786a8ed43e962ec0fce3db5
Python
Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021
/answers/Utkarsh Srivastava/Day 16/Question 2.py
UTF-8
100
3.265625
3
[ "MIT" ]
permissive
arr = input().split() for i in range(len(arr)): if(arr[i]=='1'): print(i) break
true
22bf867b4a239fa914d7b4dbef15f2a8b0a59bde
Python
auralshin/competetive-code-hacktoberfest
/python/bst_bfs_dfs.py
UTF-8
2,707
4.4375
4
[]
no_license
''' Binary Search Tree (BST) new data < node goto left child new data > node goto right child ### INPUT ### 7 3 5 2 1 4 6 7 ### OUTPUT ### Height of tree is 3 3 2 5 1 4 6 7 BFS is 3 2 5 1 4 6 7 DFS is 3 2 1 5 4 6 7 ''' # create a node, assign children to None class Node: def __init__(self...
true
b958357fd362d138d39bdaef9b3fbc5a4301b9d5
Python
mmisono/kvm-bpf-tools
/kvm_vmexit_time.py
UTF-8
3,631
2.609375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python from __future__ import print_function from collections import defaultdict from time import sleep from bcc import BPF from exit_reason import EXIT_REASON text = """ struct tmp{ u64 time; int nested; unsigned int exit_reason; }; struct value{ u64 cumulative_time; u64 count; ...
true
184a066403ee51e61081305137c56b9813e3c9d0
Python
tpqls0327/Algorithm
/Baekjoon/stack/10828_스택_D.py
UTF-8
407
3.25
3
[]
no_license
import sys input = sys.stdin.readline n = int(input()) arr = [] for _ in range(n): tmp = input().split() if tmp[0] == 'push': arr.append(int(tmp[1])) elif tmp[0] == 'pop': print(arr.pop() if arr else -1) elif tmp[0] == 'top': print(arr[-1] if arr else -1) elif tmp[0] == 'siz...
true
e9d727b6163054843f89a7604cf1ad748653747a
Python
antweer/learningcode
/intro2python/objectexercises/e1objectbasics.py
UTF-8
607
3.75
4
[]
no_license
#!/usr/bin/env python3 class Person(): def __init__(self, name, email, phone): self.name= name self.email= email self.phone = phone def greet(self, other_person): print("Hello {}, I am {}!".format(other_person.name, self.name)) if __name__ == "__main__": sonny = Person("So...
true
a34a819bce16a38a33f0d794ef29fee033b111ff
Python
Recorichardretardo/python-pickiling
/JSON/deserialization/deserialization-from-string/Examples/Example1/app.py
UTF-8
199
2.84375
3
[]
no_license
import json json_string = '''{"name":"Mark","age":22,"spec":"math","fee":1000.0, "isPass":true, "backlogs": null}''' student = json.loads(json_string) print(type(student)) print(student["name"])
true
352fcbc13257c2e89ded905cf005b82c41a6f307
Python
fariszahrah/crypto-twitter
/phase-0/cluster.py
UTF-8
1,155
3.375
3
[]
no_license
""" Cluster data. """ ''' creates partitions using the community module ''' import community import pickle import networkx as nx import matplotlib.pyplot as plt from collections import Counter def partition(graph): ''' takes a graph and returns a dict of nodes to their parition ''' partition = commu...
true
b3976c96d3a7ae065120e89594495951a23174f9
Python
the-louie/pylobot
/plugins/snow.py
UTF-8
717
2.5625
3
[ "MIT" ]
permissive
# coding: utf-8 from commands import Command class Snow(Command): def __init__(self): self.op_channel = '#dreamhack.op2' self.swarm_channel = '#dreamhack.swarm' self.output_channel = '#dreamhack.c&c' def on_privmsg(self, event): """ Expose some functions """ client = event['client'] source = event['...
true
be19a8ace9aea2e7515da92e499cabc83a908471
Python
hellion86/pythontutor-lessons
/3. Вычисления/Улитка.py
UTF-8
769
3.921875
4
[]
no_license
''' Условие Улитка ползет по вертикальному шесту высотой h метров, поднимаясь за день на a метров, а за ночь спускаясь на b метров. На какой день улитка доползет до вершины шеста? Программа получает на вход натуральные числа h, a, b. Программа должна вывести одно натуральное число. Гарантируется, что a>b. ''' h = i...
true
a9d5ca74de085233c7d5aadd12b5d0b3df4aa9fe
Python
Oiapokxui/fiddlingwithgspread
/gcloud.py
UTF-8
3,426
3.1875
3
[]
no_license
import gspread import pandas as pd from oauth2client.service_account import ServiceAccountCredentials class SheetHandler : """ Class responsible for loading into memory the sheet from Google Spreadsheets, and update it. ... Attributes: service_account (gspread.Client) : Client object for ...
true
61c04abd3a73c2bfb783688ac4da8c4ca98abfb5
Python
dawnonme/Eureka
/main/leetcode/739.py
UTF-8
317
2.921875
3
[]
no_license
class Solution: def dailyTemperatures(self, T: List[int]) -> List[int]: stack, ans = [], [0] * len(T) for i, t in enumerate(T): while stack and stack[-1][0] < t: _, idx = stack.pop() ans[idx] = i - idx stack.append((t, i)) return ans
true
46ff34546994118a42cf86fddfe10363e90d301f
Python
RedditRook/20171800022d02
/수업내용/200917/마우스입력처리.py
UTF-8
782
2.890625
3
[]
no_license
from pico2d import * os.chdir('C:\\Users\\user\\Desktop\\대학\\2d게임프로그래밍\\resource') width = 1280 height = 1024 def handle_events(): global running,x,y events =get_events() for event in events: if event.type ==SDL_QUIT: runnig =False elif event.type ==SDL_MOUSEMOTION: ...
true
91a62a371db819d2988c5c16c2fe300fc5b12f09
Python
FangyangJz/Black_Horse_Python_Code
/第二章 python核心/HX01_python高级编程/hx17_内建函数.py
UTF-8
1,595
3.90625
4
[]
no_license
# !/usr/bin/env python # -*- coding:utf-8 -*- # author: Fangyang time:2018/3/30 # range # python2 中直接返回一个列表, python3中是一个迭代值 # python2中为了解决上面的问题,用xrange, 更节省空间 # map # map(function, sequence[,sequence,...]) -> list x = map(lambda x:x**x, [1,2,3]) print([i for i in x]) x = map(lambda x,y : x+y, [1,2,3],[4,5,6]) print...
true
9f190e3d63bdfa7db7abffa34e91b7fd4e90556e
Python
Zeniuus/pyvalidator
/tests/field/test_integer.py
UTF-8
2,320
2.59375
3
[ "MIT" ]
permissive
import pytest from pyvalidator import field def test_integer_type(): spec = field.Integer() assert spec.validate_field(3) assert spec.validate_field(3) assert spec.validate_field('3') assert spec.validate_field(0) assert spec.validate_field('0') assert spec.validate_field(-3) asse...
true
68b6a46507e7b9f1c1f777ae93be10f864568ea4
Python
MariannaPyrih/pr1
/2programm.py
UTF-8
134
3.375
3
[]
no_license
import math x=0 i=0 while x<=0.5: y= (2.5*(pow(x,3)))/(math.exp(2*x)+2) i=i+1 print ('y[',i,']= ' , y) x+=0.1 print()
true
491f91c83329be0be650c4c87aa27b8f743dbf51
Python
lucassimon/flask-lab
/tests/apps/test_responses.py
UTF-8
6,206
2.609375
3
[]
no_license
import pytest from apps.responses import Response class TestRespNotAllowedUser: def test_should_response_raises_an_error_when_resource_is_not_str(self, client): with pytest.raises(ValueError) as e: Response(None) assert e.value.__str__() == "O parâmetro resource precisa ser um string...
true
262e375da3e842fb2ea9040dcb7e741143822cc7
Python
shrkw/sqlite3_paramstyle
/tests/test_sqlite3.py
UTF-8
1,599
2.734375
3
[ "MIT" ]
permissive
# coding:utf-8 from __future__ import division, print_function, absolute_import import pytest import sqlite3paramstyle @pytest.fixture def conn(): return sqlite3paramstyle.connect(":memory:") @pytest.fixture def cur(): return sqlite3paramstyle.connect(":memory:").cursor() def test_cursor_execute_without_...
true
b44fe441c51084b47c0d63efd8b7a03f0430b406
Python
ahao214/HundredPY
/CrazyPython/07/gobang.py
UTF-8
404
3.71875
4
[]
no_license
import sys try: a = int(sys.argv[1]) b = int(sys.argv[2]) c = a / b print("你输入的两个数相除的结果是:", c) except IndexError: print("索引错误:运行程序时输入的参数个数不对") except ValueError: print("数值错误:程序只能接受整数参数") except ArithmeticError: print("算术错误") except Exception: print("未知异常")
true
1b65f5655d634de0091e9ac8c518a79a89dfa343
Python
Connerhaar/CSE212-Final-Project
/Final_Project/Python_Files/Sample_answer1.py
UTF-8
514
3.765625
4
[]
no_license
def undo_example(): print("To continue writing hit enter twice, to undo hit enter and then type (u)") sentence = (input('Please start writing: ')) stack = sentence.split() while True: choice = input("") if choice == '': phrase = " ".join(stack) new = input(f'{phr...
true
3c560c1f86bbafbedb91a0d5dfa4db9a30ac4fc0
Python
haoqihua/Crypto-Project
/demo.py
UTF-8
4,579
2.859375
3
[ "MIT" ]
permissive
import rsa import pyaes import os import OT from random import * # A 256 bit (32 byte) key key = os.urandom(16) #print key print("Assuming Auctioneer and all biders are authenticated\n") (public_A, private_A) = rsa.newkeys(512) (public_B, private_B) = rsa.newkeys(512) (public_C, private_C) = rsa.newkeys(512) print("S...
true
44ef1f42ade58d7f275e272738838d5dc4f1111f
Python
manellbh/nltk-cheatsheet
/chap3-processing-raw-text/chap3.py
UTF-8
1,876
2.65625
3
[]
no_license
from __future__ import division import nltk,re, pprint from urllib import urlopen """P.24: convert text hAck3r using regular expressions and substitution""" def hacker(s): s = s.lower() if re.search('ate', s): s = s.replace('ate', '8') if re.search('e', s): s = s.replace('e', '3') if re.search('i', s): s = s...
true
5737d364b5e42baabf913aa3649df40bdbca2367
Python
ege-psd/Toolkit
/Python Projects/kisiler-veriler.py
UTF-8
486
3.21875
3
[ "Unlicense" ]
permissive
file = open('kisiler-veriler.txt','a') while True: file = open('kisiler-veriler.txt','a') print('Selam,Hoşgeldin.') isim = input('İsminizi Giriniz: ') soyisim = input('Soyisminizi Giriniz: ') yas = input('Yaşınızı Giriniz: ') file.write('\nİsminiz: ') file.write(isim) file.write('\nS...
true
ceb2a89900e549a3ef3d2cd77a15f5ce1d29176a
Python
edwardfc24/kruskal-repository
/kruskal.py
UTF-8
1,919
3.59375
4
[]
no_license
from operator import itemgetter class Kruskal: def __init__(self): self.nodes = {} self.order = {} def prepare_structure(self, node): self.nodes[node] = node # {2: 2, 5: 5} self.order[node] = 0 # {2: 0, 5:0} # {'a': 'd'} # {'d': 'd'} # {'f': 'd'} def find_nod...
true
5c3b83bb87f213ab21c3cfd0bd4a7c19e5f28d0a
Python
daniel-reich/ubiquitous-fiesta
/pmYNSpKyijrq2i5nu_15.py
UTF-8
501
3.0625
3
[]
no_license
from itertools import product def darts_solver(sections, darts, target): # product creates iterable of all combinations of possible scores for given number of darts, add to set # to remove duplicates, filter only those which add up to target and sort in ascending order of each dart's score sets = sorted([t for t...
true
df858b6616204d51bd380dabab6b8572bc4c1e42
Python
AsanalievBakyt/classwork
/ranges.py
UTF-8
322
2.921875
3
[]
no_license
list_num = [] ranges = [[1,2,4], [2,3,100],[7,8,20]] for i in range(len(ranges)): max_num = 0 min_num = 10000000 elem = ranges[i] for num in elem: if num > max_num: max_num = num if num < min_num: min_num = num list_num.append([min_num, max_num]) print(list_nu...
true
c274afd9d62f7e03dc9b63c31e8813237295720c
Python
MarioViamonte/Curso_Python
/exercicio/exercicio4.py
UTF-8
111
3.25
3
[ "MIT" ]
permissive
''' for / while 0 10 1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 ''' for p, r in enumerate(range(10,1,-1)): print(p,r)
true
aedd61fc82fd7fb35352638bb26cd7b7f3c3ae66
Python
pannuprabhat/IntelligentTrafficManaagementSystem
/hardware.py
UTF-8
931
3.109375
3
[]
no_license
import serial #Serial imported for Serial communication import time #Required to use delay functions while True: try: ArduinoSerial = serial.Serial('com5',9600,timeout = 1) break except: print ("Unable to connect to the device.") time.sleep(2) continue def...
true
011b874418b7f870af762cee3dfeff440a937bcc
Python
owasp-sbot/OSBot-Utils
/_to_remove/sync.py
UTF-8
1,527
2.515625
3
[ "Apache-2.0" ]
permissive
# legacy code, was created when trying to minimise dependencies, but it is # beter to use the @sync attribute from syncer module # # based on code from https://github.com/miyakogi/syncer/blob/master/syncer.py # # import sys # from functools import singledispatch, wraps # import asyncio # import inspect # import types ...
true
58dab21e2bb1d2891a364cfcbe364ea2143d7bd0
Python
tamique-debrito/coupled_pcla_numpy
/blur_function.py
UTF-8
3,723
2.78125
3
[]
no_license
import numpy as np from scipy.signal import convolve2d from utils import normalize_prob WINDOW_OPTIONS = {'hann': np.hanning} def make_window(win_size, win_padding, win_type): assert win_type in WINDOW_OPTIONS, f"Unsupported window type {win_type}" base = WINDOW_OPTIONS[win_type](win_size) return np.con...
true
70f2d560c555fd01fb886e044a6cba9ab66725da
Python
epitts1013/RoomAdventure
/RoomAdventureRevolutions.py
UTF-8
26,846
3.46875
3
[]
no_license
########################################################################################### # Name: Eric Pitts # Date: 3/21/18 # Description: Room Adventure Revolutions ########################################################################################### ###IMPORTS#################################################...
true
d903c2a059552b88dab2f0663a6145afe387e587
Python
javatican/migulu_python
/class1/print1.py
UTF-8
194
3.09375
3
[]
no_license
print('Single Quotes') print("double quotes") print('can do this',5) #print('cannot do this:'+5) #print('Can't do this') print('you\'ll have success here') print("you'll have success here too")
true
cf2697278e7127d6a01344eeccae534e92fdc742
Python
graycarl/iamhhb-ddd
/iamhhb/libs/database.py
UTF-8
1,968
2.984375
3
[]
no_license
import sqlite3 class DB(object): """DataBase Connection Manager""" def __init__(self, filename): self.filename = filename self._conn = None @property def conn(self): if not self._conn: self._conn = sqlite3.connect(self.filename) # about the `Row`: http...
true
89087d63cd10f008fb3a9ce9d92c31539f858fbc
Python
nico35490/AI_TP
/text_preprocessing.py
UTF-8
243
3.046875
3
[]
no_license
from nltk.tokenize import RegexpTokenizer tokenizer = RegexpTokenizer(r'\w+') tokenizer.tokenize('Eighty-seven (miles it\'s %to go, yet. Onward! 3.88') """ ['Eighty', 'seven', 'miles', 'it', 's', 'to', 'go', 'yet', 'Onward', '3', '88'] """
true
6516f52dc32ec5074c6a711a5c4bf2ce945a5e62
Python
Flamcom27/ATM
/main.py
UTF-8
1,474
3.625
4
[]
no_license
def get_banknotes(dict_bank, sum): list_of_banknotes = [] def function(banknote): nonlocal sum nonlocal list_of_banknotes nonlocal dict_bank banknotes = sum // banknote amount = dict_bank.get(f'{banknote}$') dict_bank.update({f'{banknote}$': amount - banknotes}) ...
true
f58cbe495a085818b7f706e50708444e5c0a94af
Python
Aasthaengg/IBMdataset
/Python_codes/p03402/s686109800.py
UTF-8
805
3.359375
3
[]
no_license
import sys input = sys.stdin.readline def main(): A, B = [int(x) for x in input().split()] C = [] for i in range(100): if i < 50: C.append(["#"] * 100) else: C.append(["."] * 100) whitecnt = 1 blackcnt = 1 for i in range(1, 50, 2): if whitecn...
true
5fe1e01e04e82389d3db170e7350bbe79cb9453f
Python
Aasthaengg/IBMdataset
/Python_codes/p02267/s813407248.py
UTF-8
252
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- def main(): s_length = raw_input() s = set(raw_input().strip().split(' ')) t_length = raw_input() t = set(raw_input().strip().split(' ')) print len(s.intersection(t)) if __name__ == '__main__': main()
true
eebe2a1ad849056da389a0746b9a19ef51a70463
Python
HongHanh120/generate-image-captcha
/scripts/generate_split_captcha.py
UTF-8
6,037
2.578125
3
[]
no_license
import os import random import string import bcrypt from PIL import Image, ImageFilter from PIL.ImageDraw import Draw from PIL.ImageFont import truetype from io import BytesIO from datetime import datetime from captcha_web_services.models import ImgCaptcha import django os.environ["DJANGO_SETTINGS_MODULE"] = "generate...
true
63cb62a826eddabc88b3fce1c451342df12f66c8
Python
juliahwang/WeatherSoundTest
/django_apps/utils/etc/mp3.py
UTF-8
1,285
2.625
3
[]
no_license
import os import eyed3 current = os.getcwd() def find_mp3(current): # 추후에 media root로 고정(mp3저장되는 위치로) # TODO DB에 넣도록, model에 필요한 필드 정보 추가, img 저장위치에 대한 고찰 # chdir를 이용하여 glob을 이용해볼까? -> 차선책 """ current 폴더 안에 있는 모든 mp3의 정보 앨범이미지 가져온다. :param current: 작업 폴더 :return: None """ for path,...
true
9041e6442350c283f163cb60e87e6982178a6b62
Python
Akshu1723/guvi
/codekata/fibanocci.py
UTF-8
140
3.296875
3
[]
no_license
nks=int(input()) aks=1 bks=1 print(aks,bks,end=" ") while(nks-2): ck=aks+bks aks=bks bks=ck print(ck,end=" ") nks=nks-1
true
8fd2da5ad9d4a57e6a2b808f017a3df2bd0e206d
Python
saint333/python_basico_1
/condicionales/2_ejercicio.py
UTF-8
459
3.78125
4
[]
no_license
#Escribir un programa que almacene la cadena de caracteres contraseña en una variable, pregunte al usuario por la contraseña e imprima por pantalla si la contraseña introducida por el usuario coincide con la guardada en la variable sin tener en cuenta mayúsculas y minúsculas. contraseña="holamundo123" contra=input("Esc...
true