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
d0c484fc3fd206da8d890d6bcc9cd58aff69fdc5
saqib1707/TV-Audience-Measurement
/ad-detection/hog.py
UTF-8
980
2.515625
3
[]
no_license
import matplotlib.pyplot as plt from skimage.feature import hog from skimage import data, exposure import cv2 import matplotlib.image as mpimg # image = data.astronaut() image = mpimg.imread('../data/barbara.jpg') fd = hog(image, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(2, 2), vi...
true
46c81ff38befe2b372401e15dfe7a297b7379493
xylar/old_compass
/landice/enthalpy-benchmark/plot_enthalpy_benchmark_B.py
UTF-8
1,813
2.546875
3
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
#!/usr/bin/env python from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat anaData = loadmat('./enthB_analy_result.mat') anaZ = anaData['enthB_analy_z'] anaE = anaData['enthB_analy_E'] anaT = anaData['enthB_analy_T'] anaW = anaData['enthB_analy_omega'] cp_ice = ...
true
fb778bbde6bef5b69ac02040991cfc394057f1df
AnastasiiaAndronova/python_training
/model/group.py
UTF-8
1,042
3
3
[ "Apache-2.0" ]
permissive
from sys import maxsize class Group: def __init__(self, name=None, header=None, footer=None, id = None): self.name = name self.header = header self.footer = footer self.id = id # метод определяет как будут выглядеть обьекты при выводе на консоль def __repr__(self): ret...
true
5983609866064f90d276fec7fa7a9af15c04658c
KickItAndCode/Algorithms
/DynamicProgramming/UniquePathsII.py
UTF-8
1,458
3.96875
4
[]
no_license
# 63. Unique Paths II # A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). # The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). # Now consider if some...
true
6e73ded2102fee4d8a66d48e720a314707ec4a0b
gholt/swiftly
/swiftly/cli/delete.py
UTF-8
14,692
2.671875
3
[ "Apache-2.0" ]
permissive
""" Contains a CLICommand that can issue DELETE requests. Uses the following from :py:class:`swiftly.cli.context.CLIContext`: ============== ===================================================== cdn True if the CDN Management URL should be used instead of the Storage URL. client_manager ...
true
8a8756a3632613cefbb8f64bf1399de83cb39107
unicorn09/information_retrieval_system
/ir_system.py
UTF-8
13,473
3.078125
3
[]
no_license
################################################################################### ## @file information_retrieval_system.py # @brief The information_retrieval_system.py is a basic information retrieval system # implemented using Python, NLTK and GenSIM. # @authors Yolanda de la Hoz Simon ###...
true
e9885f66b873303949b17d430fa594e26739850e
JaiPe/fishing-bot
/common/draw.py
UTF-8
1,063
2.828125
3
[]
no_license
import cv2 import numpy as np def annotate_contours_rect(image, contours, color=(0, 0, 255)): annotated_image = image.copy() for cnt in contours: rect = cv2.minAreaRect(cnt) box = cv2.boxPoints(rect) box = np.int0(box) ((x, y), (w, h), _) = rect cv2.drawContours(annotat...
true
a1b28863b4c70bf6ab031f83e60d172bb3f316d4
TouailabIlyass/python_sys
/courses.py
UTF-8
647
3.09375
3
[]
no_license
import threading mutex1=threading.Semaphore(1) mutex2=threading.Semaphore(0) mutex3=threading.Semaphore(0) i1,i2,i3=0,0,0 def th1(): global i1 mutex1.acquire() while i1<5: print("thread 1") mutex2.release() i1+=1 def th2(): global i2 mutex2.acquire() while i2<5: print("thread 2") mutex3.release() ...
true
f115cb8989e5a5707390b6122b0c6eec13c437ff
Laurelinex/flatland-model-diagram-editor
/flatland/decoration_subsystem/symbol.py
UTF-8
13,822
2.984375
3
[ "MIT" ]
permissive
""" symbol.py - Symbols from the Decoration Subsystem, loaded from the database """ from flatland.datatypes.geometry_types import Position from flatland.datatypes.connection_types import NodeFace from sqlalchemy import select, join, func, and_ from collections import namedtuple from flatland.database.flatlanddb import ...
true
3a0b289205ed5807f5484a23ac371fa8ed9f5eb4
M-Efforts/Machine_Learning
/ML_Projects/SVM_classifier.py
UTF-8
855
3.09375
3
[]
no_license
# 支持向量机分类 # 导入手写体数字加载器 from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split # 导入用于数据标准化模块 from sklearn.preprocessing import StandardScaler from sklearn.svm import LinearSVC # 导入用于详细的分类性能报告模块 from sklearn.metrics import classification_report digits = load_digits() digits.data.s...
true
d8d99fc38f71169a952d16e5dcf1a157507f9f30
lucasToniello/Calculo-Numerico
/projeto2/gaussSeidel.py
UTF-8
2,799
3.90625
4
[]
no_license
##################################################################### #################### Gauss-Seidel ############################ ##################################################################### # Função que calcula o módulo de um valor x def modulo(x): if x < 0: return (-1) * x else: return x ...
true
98f0c180d0117fe55e8081a335509252d584eade
WilliamDoNguyen/Python_Algorithms
/book_index.py
UTF-8
1,357
4.125
4
[]
no_license
#My attempt (only works for sequences that are in 3's) def bookindex(arr): newArr = [] for i in range(len(arr)-1): if arr[i] + 1 == arr[i+1]: print(i) newArr.append(arr[i]) newArr.append("-") print(newArr) print(arr[i]) if newArr[i...
true
6265b0bd5b89bacddbe4847782a5bcf0430220fa
chinmaishivaru/Python---MyCaptain
/positive_list.py
UTF-8
271
3.125
3
[]
no_license
l1=[12,-7,5,64,-14] l2=[12,14,-95,3] print("Input list1 = ",l1) print("Output: [", end=" ") for i in l1: if i>0: print(i, end=" ") print("]") print("Input list2 = ",l2) print("Output: [", end=" ") for i in l2: if i>0: print(i, end=" ") print("]")
true
eaab4a97b6138ae862c941c24fd130e31cfe19b6
pparaska/pythonAssignments
/oops/car.py
UTF-8
578
3
3
[]
no_license
from builtins import print from msilib import CAB class Car: def __init__(self, color, speed): self.__speed = speed self.__color = color def set_speed(self, value): self.__speed(value) def get_speed(self): return self.__speed def set_color(self, value): self....
true
c633e92260e2ba90f318d021668ece678e93affb
ubco-mds-2018-labs/DATA_533_LAB-4_Sonia_Karuna
/Mainbot/subpackage/ChatbotWorkings.py
UTF-8
1,658
3.4375
3
[]
no_license
# coding: utf-8 # In[4]: import random # Sentences we'll respond with if the user greeted us class Greet: def __init__(self, sentence): self.sentence = sentence self.GREET_KEYWORD = ("hello", "hi", "greetings", "sup", "what's up", "morning", "namastey", "hey", "sasria") self.GREET_RES...
true
445503b0afbff3aebf736f064f41035f209cb12b
xgironx/netnug
/vane/webapp/modeler/classes/base.py
UTF-8
5,355
2.859375
3
[]
no_license
"""Class representations of basic network data structures.""" from __future__ import absolute_import, division, print_function # from abc import ABCMeta, abstractmethod # from copy import copy, deepcopy import logging import numpy as np from .mixins import GraphMixin, IOMixin from .user_list import UserList logge...
true
f84458fc66711724bffb37a2f064b94a15db9ad5
SamuelShaju/3-Independent-ML-Project
/Project3/P32.py
UTF-8
5,207
3.15625
3
[]
no_license
import pandas as pd from sklearn.preprocessing import LabelEncoder from nltk import word_tokenize from string import punctuation from nltk.corpus import stopwords from nltk.stem import PorterStemmer from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from skl...
true
275b267fd7e71db98d828672a14038e03eef50be
Lucas-Brum/Curso-em-Video
/mundo 1/Desafios/Desafio025.py
UTF-8
306
3.859375
4
[]
no_license
print('\33[1:45m-=-\33[m' * 20) print('Procura a palavra no nome digitado silva e retorna true e false caso encontre ou não...') print('\33[1:45m-=-\33[m' * 20) nome = str(input('Digite o seu nome: ')).strip() print('\33[1:45m-=-\33[m' * 20) print('silva' in nome.lower()) print('\33[1:45m-=-\33[m' * 20)
true
7ecbe48f9b289b6aba831440dc7dd7c30dd1d00a
Playaowl/artworks
/showers/pi/examples/ch09/face-detector.py
UTF-8
436
2.703125
3
[ "MIT" ]
permissive
from SimpleCV import Camera, Display from time import sleep myCamera = Camera(prop_set={'width':320, 'height': 240}) myDisplay = Display(resolution=(320, 240)) while not myDisplay.isDone(): frame = myCamera.getImage() faces = frame.findHaarFeatures('face') if faces: for face in faces: print "...
true
f883a09f1f105f82424b5cc2b1e1757a102adc96
wangyu190810/code
/studytest/class_anthor_test.py
UTF-8
873
2.765625
3
[]
no_license
#! /usr/bin/python #-*- coding:utf-8 -*- #Filename: class_anthor_test.py #Author: wangyu190810 #E-mail: wo190810401@gmail.com #Date: 2014-07-24 #Description: import unittest from test_class_anthor import App class testAnthor(unittest.TestCase): anthor = App() def setUp(self): print "开始测试" ...
true
09d5a426affa02cd452f4c822e0bfe0c17e8bc08
patelmit911/JarvisN
/modules/music_module.py
UTF-8
1,346
2.625
3
[]
no_license
import os import sys import webbrowser import JarvisN.config_data from nltk.tokenize import word_tokenize from nltk.tag import StanfordNERTagger from itertools import groupby from JarvisN.database.datahelper import DataDbHelper class Music: def __init__(self): self.st = StanfordNERTagger(JarvisN.config_data.direc...
true
5f822382c7b2bb9e82e47a905fb78c1a20b1b088
moongchi98/MLP
/백준/MAR-APR/12907_동물원.py
UTF-8
475
3.265625
3
[]
no_license
#카운트 정렬에 표시 C = [0]*41 #숫자가 40까지 가능하기 때문에 범위를 41까지로 해줘야 한다. N = int(input()) arr = list(map(int,input().split())) for num in arr: C[num] += 1 prev_cnt = 2 answer = 1 for cnt in C: if cnt > prev_cnt: answer = -1 break prev_cnt = cnt if answer == -1: print(0) else: if 1 in C: ...
true
47e60450154666111f86603006f2fd4f780f839b
NickNil/Character-extraction-for-OCR
/OCR_with_sort.py
UTF-8
8,546
2.6875
3
[]
no_license
from pylab import * from PIL import Image from PIL import ImageEnhance from scipy import ndimage as ndimage import numpy as np import os import pywt import cv2 import Tkinter import tkMessageBox from tkFileDialog import askopenfilename from tkFileDialog import askdirectory __author__ = 'Nicklas' DEBUG = 0 top = Tkinte...
true
34104fc669e06a7a0d6bb656732340bcf07e36d4
Phaugt/encryption
/decr.py
UTF-8
420
2.765625
3
[ "MIT" ]
permissive
from cryptography.fernet import Fernet # we open on our key with open('secret.key', 'rb') as secret: key = secret.read() fernet = Fernet(key) # we open the sales file and decrypt it with open('csv1.png', 'rb') as encryptFile: encrypted = encryptFile.read() decrypt = fernet.decrypt(encrypted) #and now ...
true
bbfaefef3cff8ba2d422d71f96c37953a5cceebb
K4R-IAI/UROSActionLib
/ActionCodeGenerator.py
UTF-8
6,417
2.65625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import sys import getopt from pathlib import Path #TODO what happens of no name of the package is given e.g. GripperCommand class UROSActionCodeGenerator: def __init__(self, ActionDefinitionFile): try: opts, args = getopt.getopt(ActionDefinitionFile, "hi:", ["ifile="...
true
f33d3abb3708353be114456ce68f99bc78ac927b
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_34/255.py
UTF-8
537
3.078125
3
[]
no_license
#!/usr/bin/env python import sys, re def main (): line = sys.stdin.readline().split(); l = int(line[0]) d = int(line[1]) n = int(line[2]) dict = [sys.stdin.readline ().strip() for i in range (d)] for i in range(n): s = sys.stdin.readline().strip().replace (")", "]").replace ("(", "[")...
true
4b7f50bcdd6ad8e55dd0d6422d0c67ff0abcdc4b
Wlh12345678/PY1901Advance
/0410/demo01.py
UTF-8
888
3.46875
3
[]
no_license
""" 加锁 """ import threading, time def thread1(): # 锁1 给 线程1 加锁 lock1.acquire() # 使用延迟确保加锁成功 time.sleep(1) # 锁2 给 线程1 加锁 # 一秒钟后 锁2在线程2 已经加锁成功 此处需要等待线程2 释放资源(解锁)才能加锁 陷入等待 lock2.acquire() print("t21") def thread2(): # 锁2加锁 lock2.acquire() time.sleep(2) # 一秒钟后 锁1在线程1 已经...
true
5ec8408f41f7f1b65478949cba7646596e6952b2
charnley/rmsd
/tests/test_centroid.py
UTF-8
443
2.75
3
[ "BSD-2-Clause" ]
permissive
import numpy as np import rmsd as rmsdlib def test_centroid() -> None: a1 = np.array([-19.658, 17.18, 25.163], dtype=float) a2 = np.array([-20.573, 18.059, 25.88], dtype=float) a3 = np.array([-22.018, 17.551, 26.0], dtype=float) atms = np.asarray([a1, a2, a3]) centroid = rmsdlib.centroid(atms) ...
true
148c6eff11ed3faa8125ac0697e7f6ed364338ed
LiuY-ang/leetCode-Medium
/multiply.py
UTF-8
442
3.09375
3
[]
no_license
class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ ans="" multiplied,j=int(num1),len(num2)-1 carry=0 product,base=0,1 while j>=0: product=product+int(num2[j])*base*mul...
true
260e8b84b1e48c39c0961a5ee70432922e837ae5
LanKuDot/MazeArena-Console
/game_essential/game_widgets.py
UTF-8
8,055
3.34375
3
[]
no_license
"""The widget that would be used in the game """ from tkinter import * import tkinter as tk from .game_core import TeamType from .player_info import BasicPlayerInfo import logging _logger = logging.getLogger(__name__) class BasicPlayerInfoWidget(Frame): """The widget for setting and displaying BasicPlay...
true
2f1918f9b857b62a354b473e68ee2438e01bf424
TheJStone/anagrams
/anagrams.py
UTF-8
2,027
4
4
[]
no_license
import sys def getOrderedStr(str): """ :param str: a String :return: lexographical ordering of this string in lower case """ return ''.join(sorted(str.lower())) def parseDict(fileLoc): """ :param fileLoc: location of txt file with one word per line :return: a dictionary of sets mappin...
true
af420c50b5f1479e7dca2f620fda69bd01e57506
SeonJongYoo/Algorithm
/BOJ/ForCodingTest/DynamicProgramming1/RGBDistance2.py
UTF-8
1,223
2.953125
3
[]
no_license
# RGB 거리 2 import sys n = int(sys.stdin.readline().rstrip()) home = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(n)] home.insert(0, [0]) dp = [[0]*3 for _ in range(n+1)] dp[1][0] = home[1][0] dp[1][1] = home[1][1] dp[1][2] = home[1][2] i0, i1, i2 = 1, 0, 0 for i in range(2, n+1): if i > 2...
true
c98ec4b1a8122458ff5aa6f7c47454b3a1a0b2e6
zmayle/Planets
/planet_constants.py
UTF-8
4,180
2.921875
3
[]
no_license
# planet_constants.py # Zachary Mayle # 5/29/16 from game2d import * ##### Game Specs #: width of the game display GAME_WIDTH = 1400 #: height of the game display GAME_HEIGHT = 750 ##### Ship Specs #: the ship's width SHIP_WIDTH = 49 #: the ship's height SHIP_HEIGHT = 50 #: the ship's mass SHIP_MASS = 1.0 #: ship t...
true
c07fc46c65ba55de3c96420a39a7db0e31f2c226
caoandong/Calabi_Yau
/old/triangulate/numerical_test.py
UTF-8
9,222
2.5625
3
[]
no_license
import math import numpy as np import scipy import scipy.optimize import csv from scipy.optimize import fsolve import sympy as sp def get_vol_idx(heights): h1 = heights[0] h2 = heights[1] h3 = heights[2] idx_1 = 0 idx_2 = 0 idx_3 = 0 for i in range(1,h1+1): idx_1 += i*(i+1)/2 id...
true
85d177adcebe5ce90294864762323f7c80edb2bb
daniel-reich/ubiquitous-fiesta
/JBkfqYW4iYwmgvwTf_16.py
UTF-8
109
3.171875
3
[]
no_license
def is_prime(num): if num == 1: return False return sum([i for i in range(2, num) if num%i==0])==0
true
2df633a54256cf4a7b7ab42371027c117c94e347
jung9156/studies
/lecture/algorithm/problem/5658. 보물상자 비밀번호.py
UTF-8
456
2.75
3
[]
no_license
tn = int(input()) for ir in range(tn): N, K = map(int, input().split()) A = list(input()) A = A + A[:(N//4)-1] key = set() for i in range(N//4): q = '' n = 0 for i1 in range(N): n += 1 q += A[i+i1] if n == (N//4): n = 0 ...
true
87c652779aa5835409f99414fcad1ebad77d7d5e
CarlosGarcia9/26TestGit
/Ejemplos Python/PacoPython/Mongodb.py
UTF-8
643
3.265625
3
[]
no_license
import sys from pymongo import MongoClient client = MongoClient('localhost', 6000) #Conexion a base de datos azul db = client.Azul #Insertar una coleccion en MongoDB db.sites.insert({"url":"http://www.algo.com", "name":"Carlos"}) ###Leer un coleccion,creamos una variable y guardamos ahí los documentos s...
true
2ccd463ca1a8efe9dfdfa4f8e39ac56049e02ef2
0xdeadbad/NetWork
/Compartilhador de Arquivos/socket_helper.py
UTF-8
1,067
2.921875
3
[]
no_license
import struct from time import sleep class socket_helper: def __init__(self, app): self.app = app def send_msg(self, sock, msg, msgtype, adic=999): # Prefix each message with a 4-byte length (network byte order) msg = struct.pack('>I', len(msg)) + struct.pack('>I', msgtype) + struct.pack('>I'...
true
744548c71d9499fadd84c2e35d88416e0a45c710
XUN-N/File_Manager
/Copy_a_file.py
UTF-8
312
2.96875
3
[]
no_license
import os import shutil from tkinter import filedialog from tkinter import messagebox as mb def copying(file_path,file_name): source = file_path + '/' + file_name destination1 = filedialog.askdirectory() shutil.copy(source, destination1) mb.showinfo('confirmation', "File Copied !")
true
5643db64fde058ae96279e0cd0caa1a2bcc597bb
kessenma/206
/206_Final /darksky/darksky.py
UTF-8
4,589
3.25
3
[]
no_license
import calendar import json import plotly import requests import sqlite3 from datetime import datetime as dt # Set up weather access token weather_access_token = '80702cc5f70100072a7aa990299bd2b5' #Don't have to refresh very often/at all. User has 1,000 free calls a day. # caching pattern using the same caching patt...
true
a452bc6b47d5253396da2cc6d9eee9c145f5d454
mohitKhanna1411/COMP9322_20T3_UNSW
/Assignment2/dentist-service/app/demo/v1/database.py
UTF-8
2,053
2.953125
3
[]
no_license
import sqlite3 from sqlite3 import Error import os import re db_name = "z5266543.db" def database_controller(database, command): try: connection = sqlite3.connect(database) connection.set_trace_callback(print) except Error as e: print(e) cursor = connection.cursor() if len(re...
true
fb8424f5fa5d3011db5f987a33152cc0c4b4ff72
brightgems/entity_linking
/test/CN_DBpedia_test.py
UTF-8
1,744
2.65625
3
[]
no_license
import json import sys sys.path.append('..') from config import config from utils.utils import crawler myconfig = config() mycrawler = crawler(check_url='http://shuyantech.com/api/entitylinking/cutsegment?q=打球的李娜和唱歌的李娜不是同一个人') def CN_DBpedia_entity_linking(sentence): url = 'http://shuyantech.com/api/entitylinkin...
true
b4ad5ba0575ea27f11116abd4302e61a08ab284d
tfiers/unitlib
/tests/test_mpl.py
UTF-8
672
2.9375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes from matplotlib.lines import Line2D from unitlib import define_unit from unitlib.prefixes import milli second = define_unit("s") ms = milli * second volt = define_unit("V") mV = milli * volt x = np.linspace(0, 10) * ms y = np.random...
true
98f33e44f46ebbf0e9e7474a76533db1aaf07cfc
nayakshweta/conways_game_of_life
/Python/grid.py
UTF-8
1,175
3.65625
4
[]
no_license
from coordinate import Coordinate from cell import Cell class Grid: def __init__(self, row_count, column_count): self.row_count = row_count self.column_count = column_count self.cells = [] def mark_cell(self, x, y, status): coordinate = Coordinate(x, y) cell = Cell(coor...
true
6e24e94bdf642142779745c767f7ac20dec9dd59
halm90/cf-diff
/cc_fetcher.py
UTF-8
4,820
2.734375
3
[]
no_license
""" Interface to the CloudFoundry Cloud Controller REST API. Note(s): 1. Requires Python 3 """ import oauthlib.oauth2 import requests import requests_oauthlib from requests.packages.urllib3.exceptions import InsecureRequestWarning from logger import Logger from parameters import SysParams class Fai...
true
44c987dde4a266b383626d0d6df4b461c28e23f6
KangEunseo/2019-python-class
/First Semester/구구단.py
UTF-8
418
3.421875
3
[]
no_license
for i in range(2, 9+1): if i>7: break if i%2==0: continue print("--- "+str(i)+"단 ---") for j in range(1, 9+1): print("{} x {} = {}".format(i, j, i*j)) print() array=[] for i in range(1, 10, 2): array.append(i) print(array) array2=[i for i in range(1, 10, 2)] print(array2) array3=[i*i for i in...
true
ee07c9dced264b2b14c58c13ed280b75e4951ba7
mkgeneral/eew-prorotype
/src/producer.py
UTF-8
5,081
2.578125
3
[]
no_license
import sys import os import json import logging import pandas as pd from time import sleep from datetime import datetime, timedelta from openeew.data.aws import AwsDataClient from openeew.data.df import get_df_from_records import boto3 from configparser import ConfigParser config = ConfigParser() config.read_file(open...
true
e89dcee782e72534dcc87f06846efb66c46e1803
gossrock/rabbit_trails
/curses_panels.py
UTF-8
1,496
3.03125
3
[ "MIT" ]
permissive
# found at: https://stackoverflow.com/questions/21172087/i-need-an-example-of-overlapping-curses-windows-using-panels-in-python#21172088 # https://web.archive.org/web/20141015093753/https://mail.python.org/pipermail/python-list/2001-April/105015.html # https://mail.python.org/pipermail/python-list/2001-April/105015.htm...
true
a7b400bd84e364e49549651ef42a1fcf6caf8bbf
shaner13/Pygame
/side-scroller/shanegame.py
UTF-8
6,968
3.171875
3
[]
no_license
''' shane game to do things ''' import pygame, random, sys, time from threading import Timer # classes class Player(pygame.sprite.Sprite): def __init__(self, colour, w, h): super().__init__() #jumping attributes self.isJump = False self.jumpC...
true
9feddcfffebf18bd5f5c22c746099b2bffb5b8f1
Guepardo/Setup_Docker_Hadoop
/scripts/reducer.py
UTF-8
105
2.546875
3
[]
no_license
import sys def main(): for line in sys.stdin: print line[10:30] if __name__ == '__main__': main()
true
d452d35d6ba47efca5b686870624697f457254fe
temp176/AtCoder
/ABC/ABC109/a.py
UTF-8
184
3.140625
3
[]
no_license
a,b=[int(i) for i in input().split()] res = 0 f = False for i in range(1,4): res = a * b * i if res % 2 == 1: f = True if f: print('Yes') else: print('No')
true
7372144ed332c7e34a9c592db255878ccb57d393
appinho/SASelfDrivingCar
/sensors/camera.py
UTF-8
1,035
3.046875
3
[ "MIT" ]
permissive
import cv2 from picamera.array import PiRGBArray from picamera import PiCamera import time RESOLUTION = (640, 320) # RESOLUTION = (1920, 1088) SLEEP = 500 class CameraDriver: def __init__(self): self.camera = PiCamera() self.camera.resolution = RESOLUTION self.camera.framerate = 32 ...
true
65fc39ecbee8066c1370a2b039d2ead4a62e3183
mstrahlert/KVM-tools
/list_vms.py
UTF-8
1,605
2.890625
3
[]
no_license
#!/usr/bin/env python # # Magnus Strahlert @ 180305 # List memory & cpu of all KVM VMs along with the grand total from subprocess import PIPE, Popen import xml.etree.ElementTree as ET def cmdline(command): process = Popen(args = command, stdout = PIPE, shell = True, universal_newlines = True) r...
true
70f3fc43550472bc8122a0353af009dfb4b5760d
Aasthaengg/IBMdataset
/Python_codes/p03207/s345971236.py
UTF-8
129
2.953125
3
[]
no_license
N=int(input()) p=sorted([int(input()) for i in range(N)])[::-1] Sum=p[0]/2 for i in range(1,N): Sum=Sum+p[i] print(int(Sum))
true
9aa8f2229995c967d7f28a19f4caf48cbf01da56
Harini-Pavithra/GFG-11-Week-DSA-Workshop
/Week 2/Searching and Sorting/Merge Sort.py
UTF-8
2,648
4.4375
4
[]
no_license
Merge Sort Merge Sort is a Divide and Conquer algorithm. It repeatedly divides the array into two halves and combines them in sorted manner. Given an array arr[], its starting position l and its ending position r. Merge Sort is achieved using the following algorithm. MergeSort(arr[], l, r) If r > l ...
true
8fe26458b089201bed584eadac9689a4107a6dc0
blakearchive/sfmscripts
/blake_xml.py
UTF-8
3,345
3.125
3
[]
no_license
#!/usr/bin/env python import os import re import glob from lxml import etree class BlakeXML: """XML representation of a copy in the Blake Archive. Corresponds with one Blake xml file. Contains descriptions of each object (plate/page/etc) in the copy. """ def __init__(self, path): self.pat...
true
b9caa194563882665d0a5fb18617ec7e772ae0f9
AndriiTorchuk/CI
/ex3.py
UTF-8
430
3.125
3
[]
no_license
""" Exercise 3 """ from ex2 import * import unittest def add(self, x, y): if type(x) == int and type(y) == int: return x + y else: raise TypeError("invalid type: {} and {}".format(type(x), type(y))) class Test_calcu(unittest.TestCase): def setUp(self): self.calc = calculate() ...
true
3a36f782053cbe4cdbe54cfd1f85647dc682a111
xzzhang2016/Final-Project
/data_collect.py
UTF-8
4,947
2.609375
3
[]
no_license
import requests import pandas as pd import matplotlib.pyplot as plt import warnings import sqlite3 import sys import os try: import pycountry except: os.system('pip install pycountry') import pycountry warnings.filterwarnings('ignore') import IPython ####wrote fuction for world bank datas collection def ...
true
1517b284ed9a98104db82b643b1b899685cfa8e4
cansik/neuronal-dougles
/prepare/Hyphenator.py
UTF-8
36,887
3.09375
3
[]
no_license
""" Hyphenation, using Frank Liang's algorithm. This module provides a single function to hyphenate words. hyphenate_word takes a string (the word), and returns a list of parts that can be separated by hyphens. hyphenate_word("hyphenation") ['hy', 'phen', 'ation'] hyphenate_word("supercalifragili...
true
c054dd561bc04d70e8489dc9b344d6843bebddec
hanzmyco/sp2014.11-731
/hw2.0/n-gram/extract_ref.py
UTF-8
622
2.609375
3
[]
no_license
#!/usr/bin/env python import argparse import json import os, sys, math #file0=file('ref.txt','w+') argparser = argparse.ArgumentParser(prog='extract') argparser.add_argument('-x', '--pairs', dest='pairs', default='../lower_data.txt', help='Reference-Hypothesis pairs') args = argparser.parse_args() lc = 0 sys.stderr...
true
556c1f31d1120987ffae344a169185d1fc3acd79
axxsxbxx/SSAFY5-Algorithm
/week15_7_6/BOJ_1342_영주.py
UTF-8
704
3.6875
4
[]
no_license
# 1342. 행운의 문자열 (골드5) from math import factorial def permutation(depth, prev): if depth == length: lucky.add(''.join(case)) return for i in range(length): if not check[i]: if s[i] == prev: continue case[depth] = s[i] check[i] = True ...
true
a057eb85ea692053d6cc7149b98d6549b808141e
lukasbrunnerjku/Joystick
/joystick.py
UTF-8
5,391
2.890625
3
[]
no_license
import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import serial from serial import * # initialize serial port ser = serial.Serial(port="COM5", baudrate=9600, bytesize=EIGHTBITS, parity=PARITY_NONE, stopbits=STOPBITS_ONE, timeout=1, xon...
true
bbd460b695db3eb469fa91d3da26640836bb9064
muxgt/pycadl
/cadl/gan.py
UTF-8
19,128
2.78125
3
[ "Apache-2.0" ]
permissive
"""Generative Adversarial Network. """ """ Copyright 2017 Parag K. Mital. See also NOTICE.md. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless...
true
275b75d49db6305aa27087f7d3f820d4914b3264
KathrynT13/advWebTech
/week4/request.py
UTF-8
381
2.578125
3
[]
no_license
from flask import Flask, request app = Flask(__name__) @app.route("/") def root(): return "The default, 'root' route" @app.route("/account/", methods=['GET', 'POST']) def account(): if request.method =='POST': return "POST'ed to /account root\n" else: return "GET /account root" if __n...
true
c7aacb77ea1329751871f4a33b805ff22d70c127
maxfischer2781/cms_perf
/cms_perf/report.py
UTF-8
3,343
2.984375
3
[ "MIT" ]
permissive
""" The main loop collecting and reporting values """ from typing import Callable import sys import time from .setup.cli import CLI from .setup import cli_parser class PseudoSched: """Imitation of the ``cms.sched`` directive to compute total load""" def __init__(self, cpu=0, io=0, mem=0, pag=0, runq=0, maxl...
true
8b81964b2748fd92f720abfda4987f900fb53037
mfkiwl/kalman-filter-GNSS
/combined-filter.py
UTF-8
8,139
2.71875
3
[]
no_license
import numpy as np import sys import math from mpl_toolkits import mplot3d import matplotlib.pyplot as plt import random # reads file, outputs kalman filter instance with measurements, deviation, and q values passed def init_filter(gnss_file_name, mimo_file_name, q, plot): try: file_measurements = open(gns...
true
1bb59b79068a1106ccac5176a5f5dfc49c0f90d0
aleksmn/PyAutomateStuff
/gui-automation.py
UTF-8
379
2.78125
3
[]
no_license
# gui-automation import pyautogui import random # pyautogui.position() # get current position of mouse # pyautogui.moveTo(10, 10, duration=1.5) # pyautogui.moveRel(200, 0, duration=1.5) # pyautogui.moveTo(540, 26, duration=1.5) # pyautogui.click() # pyautogui.click(540, 26) # pyautogui.click(100, 100) # pyautogui....
true
0ab31c6002ccee6bdbc1630db212a000b399cf7a
caomanhhaipt/text_classification
/natural_language_processing/feature_extraction.py
UTF-8
4,738
2.84375
3
[]
no_license
import os import numpy as np from config import config_parser import math DIR_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) + "/" con = config_parser.Config(DIR_PATH + "config/settings.ini") con.get_config_file() NO_BELOW = con.get_setting('nlp', 'no_below') NO_ABOVE = c...
true
2d98b7ff1c558840fc5ad0f0d32ef51ff71c8f47
smokeytheblair/tamcolors
/tamcolors/tests/utils_tests/immutable_cache_tests.py
UTF-8
775
2.875
3
[ "Apache-2.0" ]
permissive
# built in libraries import unittest.mock # tamcolors libraries from tamcolors.utils.immutable_cache import ImmutableCache class DummyCache(ImmutableCache): def __init__(self, *args, **kwargs): self._args = args self._kwargs = kwargs class ImmutableCacheTests(unittest.TestCase): def test_in...
true
bc7b231ce604704b836ee6c6fa8e6d8cd89d29df
sndychvn/Python
/Practice/WebStats_Pandas_ggplot.py
UTF-8
829
3.0625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import style style.use('ggplot') web_stats = {'Day':[1,2,3,4,5,6], 'Visitors':[43,34,65,56,29,76], 'Bounce Rate':[65,67,78,65,45,52], 'Country' : ["USA", "FR", "IN", "TG", "GM", "ID"]} df=pd.D...
true
aff4acd651ac433b1135e14e208c4e1146e764e5
Tuchev/Python-Basics---september---2020
/02.Conditional_Statements/02.Exercise/06. Godzilla vs. Kong.py
UTF-8
798
3.75
4
[]
no_license
budget = float(input()) number_of_actors = float(input()) price_of_clothes = float(input()) price_for_decor = budget * 0.10 price_for_all_clothes = number_of_actors * price_of_clothes total_price_for_film = price_for_decor + price_for_all_clothes if number_of_actors > 150: total_price_for_clothes = price...
true
fbb99914bb160c92b070f0825bbffc84dff98b06
Lamarcke/PesquisadorClimaTempo
/simpleweather.py
UTF-8
4,897
2.765625
3
[]
no_license
from tkinter import * import requests import os import urllib.request from PIL import ImageTk, Image main = Tk() def get_icons(): script_run = './data/opened.dat' if not os.path.isfile(script_run): print("Iniciando download de icones...\nIsso pode levar alguns segundos...") icon_day = ['01d.pn...
true
d92bff9d07c93b4bf2cb825a0b311a0f571da528
rawalshree/classical-ciphers
/railfence.py
UTF-8
1,540
3.015625
3
[ "MIT" ]
permissive
''' Owner - Rawal Shree Email - rawalshreepal000@gmail.com Github - https://github.com/rawalshree ''' import math global plain global cipher global Success Success = False plain = "" cipher = "" class Railfence: def setKey(self, key): global Success try: self.key = int(key) ...
true
39b9c0176c3d19b231575d6a6a5b2122358aee15
aimustaev/ComputorV1
/computer_v/main/validation.py
UTF-8
1,210
3.3125
3
[]
no_license
import sys import re from collections import deque # eq stands for equation def elemantary_validation(args): #check if num args is not one if (len(args) != 1): pae("usage: python computor.py [-h] equation", 1) eq = args[0] # check for number of '=' arr = list(args[0]) n = arr.count("=") if (n != 1): pae("i...
true
35a53407eebddfe5b1644ec58a18a1fcf7448208
Anseik/algorithm
/과목평가/Algo1_구미_1반_안세익.py
UTF-8
1,570
3
3
[]
no_license
import sys sys.stdin = open('Algo1_구미_1반_안세익.txt') T = int(input()) for tc in range(1, T + 1): N, M, K = map(int, input().split()) arr = [list(map(int, input().split())) for _ in range(N)] # print(N, M, K) # print(arr) max_num = 0 min_num = 100 * (N * M) # 시작점 찾기(도넛모양의 좌측 상단) for r in...
true
23be83d8e61be49ae1c691425798be284cdb56b6
Pravin123321/The-Data-Wrangling-Workshop
/Chapter02/unittest_chapter2/test_chapter2.py
UTF-8
3,724
3.296875
3
[ "MIT" ]
permissive
# These are the unit tests for each exersize, load the module and pass the answer to each function and it will # return a bool of True or False depending on the answer being correct or false. # exercise 15 def test_exercise_15_1(x) -> bool: return x == [1 for x in range(0, 10000000)] def test_exercise_15_2(x) ...
true
c3034f5f93e8148bc553cb221fad8d22a2b53746
mackenzieweaver/Download-Meeting-Media
/dmm.py
UTF-8
3,871
2.984375
3
[ "MIT" ]
permissive
#! python3 # dmm.py - Download Meeting Media # Downloads all meeting media from jw.org # imports import requests, bs4, webbrowser, pprint, os # Dummy dictionary for testing info = {'month': 'enero', 'year': '2019', 'dates': '7-13', 'path': 'C:\\Users\\Mack W\\Documents\\Python\\personalProjects\\Meet...
true
5f593df699bce2c98b4ee50d420d3e21ec924318
ak7n14/Pet-Finder
/RandomClassifier.py
UTF-8
4,416
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import matplotlib.pyplot as plt dataset = pd.read_csv('train.csv') y = dataset.iloc[:, 23].values #unique, counts = np.unique(y, return_counts=True) #counts = counts / len(y) #ratios = dict(zip(unique, counts)) import random y_pred = np.zeros(len(y)) ...
true
678d358bc92cb44fbada98237133c4cfb0eba603
cohenjer/PIRS8
/tests/test_comparaison.py
UTF-8
2,233
2.765625
3
[ "MIT" ]
permissive
import numpy as np from src._comparaison import comparaison,compar_time def test_comparaison(i): """ Test of comparaison Need to change plot x,y label and title in comparaison to run the test. Parameters ---------- i : int i=1, plot data fitting error for simple case. i=2, ...
true
9b566f9dc18c5048b5671052737aad435f5acf1c
kimmyoo/python_leetcode
/10.MATH/1329_sort_matrix_diagonally/solution.py
UTF-8
811
3.65625
4
[]
no_license
class Solution(object): def diagonalSort(self, mat): """ :type mat: List[List[int]] :rtype: List[List[int]] the tricky part is for eles that falls on the the diagonal, the diff of i, j, ie. i-j is the same. so we use a list dict and put eles on the same diagonal to list, then...
true
5f373913825789ef6c3b4e7b2e1ce8cf1eb74681
AzurQ/Drawings
/Fractal/Simple/random_draw.py
UTF-8
3,547
3.09375
3
[]
no_license
import sys import os import json import argparse from draw import draw sys.path.insert(1, "/Users/azur/git/Drawings/Fractal/Common") from functions import generate_random_inputs, override # Draw a fractal from given inputs and random distribution for given inputs ## Fixed inputs may be provided as lists - all possibi...
true
28b24e892891d54ba8d6079e4a59dc28840c51f6
tahuh/SynbioBioModule
/Sam.py
UTF-8
1,474
2.78125
3
[]
no_license
#!/usr/bin/python """ Sam.py Stores Sam record and offers some manipulation functions This only works for FASTQ read mapped SAM file Author : Sunghoon Heo """ import re class SamHeader: def __init__(self): self.headers = [] def add(self, header): self.headers.append(header) class SamRecord: def __init__(sel...
true
7ebc5d482067dc1048c4ed72e556cd7293b56e29
backtothefuture3030/paikjoon
/백준2941.py
UTF-8
615
2.8125
3
[]
no_license
alpha = ["c=","c-","dz=","d-","lj","nj","s=","z="] a = input() count=0 while True: for i in alpha: while True: if i in a: if len(i)==3: a = a[:a.find(i)]+" "+a[a.find(i)+3:] count+=1 if len(i)==2: a = a[:...
true
093786f25a488d5987894196e5bef757997734cc
dborzov/geocode-postalcode
/unique_codes.py
UTF-8
445
3.03125
3
[]
no_license
import re codes = {} for i, line in enumerate(open("postal_codes.csv", 'rb').readlines()): matches = re.match('"(.+)",(.+)', line) if not matches: continue name, postal_code = matches.group(1), matches.group(2).rstrip().replace(" ","") postal_code = postal_code codes[postal_code] = codes.ge...
true
e458e701392a06f4ca1ea64cfe956e361214e181
BCDeshiG/Dead-Frontier-Bullet-Price
/Dead Frontier Bullets.py
UTF-8
1,233
4.1875
4
[ "MIT" ]
permissive
#Main body of code def Bullets(): while True: try: B=int(input("Please input the amount of bullets in your stack\n")) except ValueError: print("INVALID INPUT\n") else: break while True: try: maxB=int(input("Please input t...
true
b161d52d05477ee37fec6ca6219a2762f7d7333d
hendrikvgl/RoboCup-Spielererkennung
/code-master/tools/simulation_2d/Robot.py
UTF-8
353
3.234375
3
[]
no_license
class Robot(object): def __init__(self, name, xy, orientation): self.name = name self.xy = xy self.orientation = orientation self.forward = 0 self.sideward = 0 self.angular = 0 self.forward_multiplicator = 60 self.sideward_multiplicator = 90 ...
true
c58edbb505f167fdc6a1da000745b5c1ee25c2a9
memphis95/Algorithms
/DSA/Graphs/5. levelNodeUndirectedGraph.py
UTF-8
1,257
3.859375
4
[]
no_license
# Python code to implement the approach # Function to find the level of the given node def findLevel(N,edges,X): # Variable to store maximum vertex of graph maxVertex=0 for it in edges: maxVertex=max(maxVertex,max(it[0],it[1])) # Creating adjacency list adj=[[] for j in range(maxVerte...
true
614cd5d5a27acd607b46c4517c2b678e5a201979
Choojj/acmicpc
/단계별/09. 수학 1/08. Fly me to the Alpha Centauri.py
UTF-8
265
3.0625
3
[]
no_license
import sys import math T = int(sys.stdin.readline().rstrip()) for i in range(T): x, y = map(int, sys.stdin.readline().rstrip().split()) dist = y - x p = int(math.sqrt(dist)) remain = math.ceil((dist - (p * p)) / p) print(p * 2 - 1 + remain)
true
733b644aeb817e8a23b3d368d258809382f74d9d
sergeymironov0001/twitch-chat-bot
/wordscounterbot/__main__.py
UTF-8
3,028
2.984375
3
[ "MIT" ]
permissive
import configparser import getopt import logging.config import sys from wordscounterbot.twitch_words_counter_bot import TwitchWordsCounterBot default_server = "irc.chat.twitch.tv" default_port = 6667 def main(argv): server, port, channel, nickname, password = read_command_line_args(argv) logging.info("serve...
true
218fc8f109f2778b42d0b1231b0c465dd0c993de
HellRoads/python-2
/Python_File/Login/ces.py
UTF-8
170
2.75
3
[]
no_license
import string f = string.punctuation x = [i for i in f] a = "1534das.d64dsa" d = ["123456.","qq.com"] c = [x for x in d[0]] if x in c: print("!!!!!") else: print("@@@")
true
f02a70ffcbb63fb1f17a24fdb83f360b5bac7efe
BenJaEGo/DAE
/ops.py
UTF-8
802
2.609375
3
[]
no_license
import tensorflow as tf def get_weights_normal(name, shape, mean=0.0, stddev=0.1): variable = tf.get_variable(name=name, shape=shape, initializer=tf.truncated_normal_initializer( mean=mean, stddev=stddev ...
true
50834ee5d652cbbbe4aed50b23a08a75c69a59a1
antondelchev/Nested-Conditional-Statements---More-Exercises
/01. Match Tickets.py
UTF-8
860
3.484375
3
[]
no_license
budget = float(input()) category = input() men_in_group = int(input()) transport_cost = 0 tickets_cost = 0 if 1 <= men_in_group <= 4: transport_cost = 0.75 * budget elif 5 <= men_in_group <= 9: transport_cost = 0.6 * budget elif 10 <= men_in_group <= 24: transport_cost = 0.5 * budget elif 25 ...
true
b9527f96eec4e9be3060dd86f8918a5f310577ef
sid9211/MillionSongAttribution
/music_classifier_svc.py
UTF-8
889
2.609375
3
[]
no_license
import csv_io import numpy as np from sklearn import cross_validation from sklearn import svm from sklearn.svm import SVC from sklearn import preprocessing from sklearn.metrics import metrics def main(): #read in data, parse into training and target sets data = csv_io.read_data("./hotness_features_classes_sele...
true
a9686942756d62c3f8fae30062e4f8753445b448
Yukorin5/pythonscript
/study-sun/goes-plot-long.py
UTF-8
1,800
2.59375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime, subprocess import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.dates as mdates from astropy import units as u from observational_data import * #img = get_aia_image(193, datetime.datetime(2014,12,20,00,36)) subproc...
true
a94354960c04a78252794c93ff1d464ed0d55b4d
VinayakGadad/LearningDevops
/Algorithms/medium/cipher_match.py
UTF-8
637
4.25
4
[]
no_license
# Determine if two strings are a cipher match. Two strings are a cipher match # if they have the same ordering of characters, even if the characters themselves # are not the same. For example, “aabb” and “ccdd” are a cipher match, as are # “abccd” and “efggh” def cipher_match(str1, str2): return string_to_cipher(s...
true
fc3e3ae80ae7e3c0b73450d1effa3286f0583e30
janlehky/currencyConverter
/easy_converter.py
UTF-8
687
3.296875
3
[]
no_license
import sys import json import requests def convert(amount, base, to): url = f'https://api.ratesapi.io/api/latest?base={base}&symbols={to}' response = requests.get(url).json() return float(response['rates'][to])*float(amount) if __name__ == "__main__": if len(sys.argv) == 4: amount = sys.argv...
true
fc24e1e31525879abd9c34a3d9bb7939e0aade57
placeforyiming/Introduction-to-Algorithms-3rdEdition
/sorting/quicksort/quick_sort.py
UTF-8
712
3.34375
3
[]
no_license
# <<Introduction To Algorithms (3rd)>> p170 ~ p173 def quick_sort(input_list): def partition(input_list,p,r): # p start from 1 instead of 0, r end with len(list) instead of len(list)-1 x=input_list[r-1] i=p-2 for j in range(p-1,r): if input_list[j]<=x: #print (input_list[j]) i=i+1 temp=input_l...
true
cc810c3bf1f83a0cdaba611ab803e18a863157ce
SebastianSchildt/mqttledstrip
/mqttledstrip.py
UTF-8
6,094
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from driver import apa102 import time import json import paho.mqtt.client as mqtt import threading import socket UDP_BIND_ADDRESS = "0.0.0.0" UDP_PORT = 6789 MQTT_BROKER = "192.168.178.43" MQTT_LISTEN_TOPIC = "/robotstateled" BRIGHTNESS=10 NUMLEDS=44 class StripWorker(threading.Thread):...
true
78fb0440537bcaf85aec422f89f8c69782a399f4
ekanshs/graphex-nnmf
/ggp.py
UTF-8
2,506
3.15625
3
[]
no_license
import numpy as np from scipy.special import gamma as gamfn def sample_ggp(size, sig, tau, eps): """ Sample weights from truncated GGP. Equiv, sample from Poisson process w mean measure size*(1/gamma(1-sig))w^-(1+sig)*exp(-tau*w)1[w>eps] This is the adaptive thinning scheme described in Appendix C of ...
true
eabeea3ec1bd2d1b942a2de8a23423c4c64f833a
ibnahmadCoded/how_to_think_like_a_computer_scientist_Chapter_10
/fib.py
UTF-8
217
3.671875
4
[]
no_license
def fib(n): """returns the nth fibonacci number""" fibs = [0, 1] count = 0 while len(fibs) <= n: a = fibs[count] + fibs[count + 1] fibs.append(a) count += 1 return fibs[n]
true